OpenCBM
|
Shared library / DLL for accessing the driver Commodore GCR conversion functions. More...
Go to the source code of this file.
Macros | |
#define | DBG_USERMODE |
#define | DBG_PROGNAME "OPENCBM.DLL" |
#define | DLL |
mark: We are building the DLL */ | |
Functions | |
int CBMAPIDECL | gcr_5_to_4_decode (const unsigned char *source, unsigned char *dest, size_t sourceLength, size_t destLength) |
Decode GCR data. More... | |
int CBMAPIDECL | gcr_4_to_5_encode (const unsigned char *source, unsigned char *dest, size_t sourceLength, size_t destLength) |
Encode GCR data. More... | |
Shared library / DLL for accessing the driver Commodore GCR conversion functions.
Definition in file gcr_4b5b.c.
#define DBG_PROGNAME "OPENCBM.DLL" |
The name of the executable
Definition at line 24 of file gcr_4b5b.c.
#define DBG_USERMODE |
Mark: We are in user-space (for debug.h)
Definition at line 21 of file gcr_4b5b.c.
int CBMAPIDECL gcr_4_to_5_encode | ( | const unsigned char * | source, |
unsigned char * | dest, | ||
size_t | sourceLength, | ||
size_t | destLength | ||
) |
Encode GCR data.
This function encodes a buffer of 4 plain bytes into a buffer of 5 GCR bytes
source | The pointer to the source buffer of 4 read-only plain bytes |
dest | The pointer to the destination buffer of 5 GCR bytes |
sourceLength | The size of the source buffer, it should be greater or equal to 4. If the size given is less than or equal to 0 this is taken as assertion, since it denotes unwanted programming behaviour. |
destLength | The size of the destination buffer, it should be greater or equal to 5. If the size given is less than or equal to 0 this is taken as assertion, since it denotes unwanted programming behaviour. |
Remarks:
The function in fact can be called with buffer lengths less than recommended, it then does partial conversions as long as there is input available or as long as output buffer bytes are allowed to be written.
The source and destination buffer pointers are allowed to overlap partially. As long as destination is less than or equal to source or as long as destination is bigger than source+3, it is allowed to let the buffers overlap. Other conditions are taken as assertions since conversion errors will occur (data taken as input gets overwritten before). This behaviour allows to construct in-place buffer conversions.
Definition at line 206 of file gcr_4b5b.c.
References DBG_ASSERT, DBG_PREFIX, DBG_WARN, FUNC_ENTER, and FUNC_LEAVE_INT.
int CBMAPIDECL gcr_5_to_4_decode | ( | const unsigned char * | source, |
unsigned char * | dest, | ||
size_t | sourceLength, | ||
size_t | destLength | ||
) |
Decode GCR data.
This function decodes a buffer of 5 GCR bytes into a buffer of 4 plain bytes
source | The pointer to the source buffer of 5 read-only GCR bytes |
dest | The pointer to the destination buffer of 4 plain bytes |
sourceLength | The size of the source buffer, it should be greater or equal to 5. If the size given is less than or equal to 0, this is taken as assertion, since it denotes unwanted programming behaviour. |
destLength | The size of the destination buffer, it should be greater or equal to 4. If the size given is less than or equal to 0 this is taken as assertion, since it denotes unwanted programming behaviour. |
Remarks:
The function in fact can be called with buffer lengths less than recommended, it then does partial conversions as long as there is input available or as long as output buffer bytes are allowed to be written.
The source and destination buffer pointers are allowed to overlap partially. As long as destination is less than source+2 or as long as destination is bigger than source+4, it is allowed to let the buffers overlap. Other conditions are taken as assertions since conversion errors will occur (data taken as input gets overwritten before). This behaviour allows to construct in-place buffer conversions.
Definition at line 81 of file gcr_4b5b.c.
References DBG_ASSERT, DBG_PREFIX, DBG_WARN, FUNC_ENTER, and FUNC_LEAVE_INT.