Mkd64 module API  1.3b
API for creating own mkd64 modules
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Block Class Reference

Class representing a single block on a C64 disk. More...

#include <mkd64/block.h>

Related Functions

(Note that these are not member functions.)

BlockStatus Block_status (const Block *self)
 Get status of the block.
const BlockPosition * Block_position (const Block *self)
 Get position (track/sector) of the block.
uint8_t Block_nextTrack (const Block *self)
 Get track number of the following block in the chain.
uint8_t Block_nextSector (const Block *self)
 Get sector number of the following block in the chain.
void Block_nextPosition (const Block *self, BlockPosition *pos)
 Get the position of the following block in the chain.
IModule * Block_reservedBy (const Block *self)
 Get module instance reserving the current block.
void Block_setNextTrack (Block *self, uint8_t nextTrack)
 Set track number of the following block in the chain.
void Block_setNextSector (Block *self, uint8_t nextSector)
 Set sector number of the following block in the chain.
void Block_setNextPosition (Block *self, const BlockPosition *pos)
 Set the position of the following block in the chain.
int Block_reserve (Block *self, IModule *by)
 Reserve this block for later use.
int Block_unReserve (Block *self)
 Try to unreserve the block by asking the module to release it.
int Block_allocate (Block *self)
 Allocate the current block.
int Block_free (Block *self)
 Free the current block.
uint8_t * Block_data (Block *self)
 Get a pointer to the 254 bytes of data inside the block.
uint8_t * Block_rawData (Block *self)
 Get a pointer to the 256 bytes of raw data inside the block.

Detailed Description

Class representing a single block on a C64 disk.

Friends And Related Function Documentation

int Block_allocate ( Block *  self)
related

Allocate the current block.

ATTENTION: This does not check anything. Make sure you never allocate a block that is currently reserved by some other module. If you need a reserved block, ask for it using Block_unReserve()!

Parameters
selfthe block
Returns
1 on success, 0 on failure
uint8_t * Block_data ( Block *  self)
related

Get a pointer to the 254 bytes of data inside the block.

ATTENTION: You can call this for ANY block. Make sure you never modify block data allocated or reserved by some other module!

Parameters
selfthe block
Returns
pointer to the data
int Block_free ( Block *  self)
related

Free the current block.

ATTENTION: This does not check anything. Make sure you never free a block you didn't allocate yourself!

Parameters
selfthe block
Returns
1 on success, 0 on failure
void Block_nextPosition ( const Block *  self,
BlockPosition *  pos 
)
related

Get the position of the following block in the chain.

The BlockPosition pos is filled with the first two bytes of the block, which is the position of the next block for chained blocks.

Parameters
selfthe block
posthe BlockPosition to hold the result
uint8_t Block_nextSector ( const Block *  self)
related

Get sector number of the following block in the chain.

returns the second byte of the block, which is the sector number of the next block for chained blocks.

Parameters
selfthe block
Returns
sector number of the next block
uint8_t Block_nextTrack ( const Block *  self)
related

Get track number of the following block in the chain.

returns the first byte of the block, which is the track number of the next block for chained blocks.

Parameters
selfthe block
Returns
track number of the next block
const BlockPosition * Block_position ( const Block *  self)
related

Get position (track/sector) of the block.

Parameters
selfthe block
Returns
the position of the block
uint8_t * Block_rawData ( Block *  self)
related

Get a pointer to the 256 bytes of raw data inside the block.

This includes the first two bytes that are normally used for chaining. ATTENTION: You can call this for ANY block. Make sure you never modify block data allocated or reserved by some other module!

Parameters
selfthe block
Returns
pointer to the data
int Block_reserve ( Block *  self,
IModule *  by 
)
related

Reserve this block for later use.

Parameters
selfthe block
bypointer to the module reserving the block
Returns
1 on success, 0 on failure
IModule * Block_reservedBy ( const Block *  self)
related

Get module instance reserving the current block.

Parameters
selfthe block
Returns
pointer to the module reserving this block, or 0 if not reserved
void Block_setNextPosition ( Block *  self,
const BlockPosition *  pos 
)
related

Set the position of the following block in the chain.

Parameters
selfthe block
posthe position of the next block in the chain
void Block_setNextSector ( Block *  self,
uint8_t  nextSector 
)
related

Set sector number of the following block in the chain.

Parameters
selfthe block
nextSectorsector number of the next block in the chain
void Block_setNextTrack ( Block *  self,
uint8_t  nextTrack 
)
related

Set track number of the following block in the chain.

Parameters
selfthe block
nextTracktrack number of the next block in the chain
BlockStatus Block_status ( const Block *  self)
related

Get status of the block.

Parameters
selfthe block
Returns
the current status
int Block_unReserve ( Block *  self)
related

Try to unreserve the block by asking the module to release it.

Parameters
selfthe block
Returns
1 on success, 0 on failure

The documentation for this class was generated from the following file: