1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-28 06:30:16 +00:00

Code review changes and improved formatting.

This commit is contained in:
IrgendwerA8 2019-03-09 21:40:57 +01:00
parent 1359ad793d
commit 203f4c80d4

View File

@ -58,19 +58,24 @@
/* Device control block */
struct __dcb {
unsigned char device; /* device id */
unsigned char unit; /* unit number */
unsigned char command; /* command */
unsigned char status; /* command type / status return */
void *buffer; /* pointer to buffer */
unsigned char timeout; /* device timeout in seconds */
unsigned char unused;
unsigned int xfersize; /* # of bytes to transfer */
unsigned char aux1; /* 1st command auxiliary byte */
unsigned char aux2; /* 2nd command auxiliary byte */
unsigned char ddevic; /* device id */
unsigned char dunit; /* unit number */
unsigned char dcomnd; /* command */
unsigned char dstats; /* command type / status return */
void *dbuf; /* pointer to buffer */
unsigned char dtimlo; /* device timeout in seconds */
unsigned char dunuse; /* - unused - */
unsigned int dbyt; /* # of bytes to transfer */
union {
struct {
unsigned char daux1; /* 1st command auxiliary byte */
unsigned char daux2; /* 2nd command auxiliary byte */
};
unsigned int daux; /* auxiliary as word */
};
};
typedef struct __dcb DCB;
typedef struct __dcb dcb_t;
/* I/O control block */
@ -91,7 +96,7 @@ struct __iocb {
unsigned char spare; /* spare byte */
};
typedef struct __iocb IOCB;
typedef struct __iocb iocb_t;
/* DOS 2.x zeropage variables */
@ -103,7 +108,7 @@ struct __dos2x {
unsigned char errno; /* number of occured error */
};
typedef struct __dos2x DOS2X;
typedef struct __dos2x dos2x_t;
/* A single device handler formed by it's routines */
@ -119,17 +124,17 @@ struct __devhdl {
void *reserved; /* unused */
};
typedef struct __devhdl DEVHDL;
typedef struct __devhdl devhdl_t;
/* List of device handlers, as managed in HATABS */
struct __hatabs {
unsigned char id; /* ATASCII code of handler e.g. 'C','D','E','K','P','S','R' */
DEVHDL* devhdl; /* Pointer to routines of device */
devhdl_t* devhdl; /* Pointer to routines of device */
};
typedef struct __hatabs HATABS;
typedef struct __hatabs hatabs_t;
/* Floating point register */
@ -143,7 +148,7 @@ struct __fpreg {
#endif
};
typedef struct __fpreg FPREG;
typedef struct __fpreg fpreg_t;
enum { /* enum for access of floating point registers */
R0 = 0, /* (to use as index) */
@ -201,7 +206,7 @@ struct __os {
#else
unsigned char abufpt[4]; // = $1C-$1F ACMI BUFFER POINTER AREA
#endif
IOCB ziocb; // = $20-$2F ZERO PAGE I/O CONTROL BLOCK
iocb_t ziocb; // = $20-$2F ZERO PAGE I/O CONTROL BLOCK
unsigned char status; // = $30 INTERNAL STATUS STORAGE
unsigned char chksum; // = $31 CHECKSUM (SINGLE BYTE SUM WITH CARRY)
@ -225,7 +230,7 @@ struct __os {
unsigned char freq; // = $40 CASSETTE BEEP COUNTER
unsigned char soundr; // = $41 NOISY I/0 FLAG. (ZERO IS QUIET)
unsigned char critic; // = $42 DEFINES CRITICAL SECTION (CRITICAL IF NON-Z)
DOS2X fmszpg; // = $43-$49 DISK FILE MANAGER SYSTEM ZERO PAGE
dos2x_t fmszpg; // = $43-$49 DISK FILE MANAGER SYSTEM ZERO PAGE
#ifdef OSA
unsigned char ckey; // = $4A FLAG SET WHEN GAME START PRESSED
unsigned char cassbt; // = $4B CASSETTE BOOT FLAG
@ -286,7 +291,7 @@ struct __os {
unsigned char _free_1[0xD4-0x7F-1]; // USER SPACE
// Floating Point Package Page Zero Address Equates
FPREG fpreg[4]; // = $D4-$EB 4 REGSITERS, ACCCESS LIKE "fpreg[R0].fr"
fpreg_t fpreg[4]; // = $D4-$EB 4 REGSITERS, ACCCESS LIKE "fpreg[R0].fr"
unsigned char frx; // = $EC 1-BYTE TEMPORARY
unsigned char eexp; // = $ED VALUE OF EXP
#ifdef OS_REV2
@ -311,8 +316,8 @@ struct __os {
unsigned char radflg; // = $FB ##OLD## 0=RADIANS, 6=DEGREES
};
FPREG* flptr; // = $FC/$FD 2-BYTE FLOATING POINT NUMBER POINTER
FPREG* fptr2; // = $FE/$FF 2-BYTE FLOATING POINT NUMBER POINTER
fpreg_t* flptr; // = $FC/$FD 2-BYTE FLOATING POINT NUMBER POINTER
fpreg_t* fptr2; // = $FE/$FF 2-BYTE FLOATING POINT NUMBER POINTER
// --- Page 1 ---
@ -375,7 +380,7 @@ struct __os {
unsigned char caux1; // = $023C COMMAND AUX BYTE 1
unsigned char caux2; // = $023D COMMAND AUX BYTE 2
};
unsigned caux; // = $023C/$023D (same as above as word)
unsigned int caux; // = $023C/$023D (same as above as word)
};
unsigned char temp; // = $023E TEMPORARY RAM CELL
unsigned char errflg; // = $023F ERROR FLAG - ANY DEVICE ERROR EXCEPT TIME OUT
@ -395,7 +400,7 @@ struct __os {
unsigned char pdvmsk; // = $0247 ##rev2## 1-byte parallel device selection mask
unsigned char shpdvs; // = $0248 ##rev2## 1-byte PDVS (parallel device select)
unsigned char pdimsk; // = $0249 ##rev2## 1-byte parallel device IRQ selection
unsigned reladr; // = $024A/$024B ##rev2## 2-byte relocating loader relative adr.
unsigned int reladr; // = $024A/$024B ##rev2## 2-byte relocating loader relative adr.
unsigned char pptmpa; // = $024C ##rev2## 1-byte parallel device handler temporary
unsigned char pptmpx; // = $024D ##rev2## 1-byte parallel device handler temporary
unsigned char _reserved_1[29]; // = $024E-$026A RESERVED
@ -557,38 +562,7 @@ struct __os {
// --- Page 3 ---
union {
DCB dcb; // = $0300-$030B DEVICE CONTROL BLOCK
struct {
unsigned char ddevic; // = $0300 PERIPHERAL UNIT 1 BUS I.D. NUMBER
unsigned char dunit; // = $0301 UNIT NUMBER
unsigned char dcomnd; // = $0302 BUS COMMAND
unsigned char dstats; // = $0303 COMMAND TYPE/STATUS RETURN
union {
void* dbuf; // = $0304/$0305 data buffer address
struct {
unsigned char dbuflo; // = $0304 1-byte low data buffer address
unsigned char dbufhi; // = $0305 1-byte high data buffer address
};
};
unsigned char dtimlo; // = $0306 DEVICE TIME OUT IN 1 SECOND UNITS
unsigned char dunuse; // = $0307 UNUSED BYTE
union {
unsigned int dbyt; // = $0308/$0309 number of bytes to transfer
struct {
unsigned char dbytlo; // = $0308 1-byte low number of bytes to transfer
unsigned char dbythi; // = $0309 1-byte high number of bytes to transfer
};
};
union {
unsigned int daux; // = $030A/$030B first and second auxiliary
struct {
unsigned char daux1; // = $030A 1-byte first command auxiliary
unsigned char daux2; // = $030B 1-byte second command auxiliary
};
};
};
};
dcb_t dcb; // = $0300-$030B DEVICE CONTROL BLOCK
unsigned int timer1; // = $030C/$030D INITIAL TIMER VALUE
#ifdef OSA
unsigned char addcor; // = $030E ##old## ADDITION CORRECTION
@ -611,17 +585,17 @@ struct __os {
unsigned char stackp; // = $0318 SIO STACK POINTER SAVE CELL
unsigned char tstat; // = $0319 TEMPORARY STATUS HOLDER
#ifdef OSA
HATABS hatabs[12]; // = $031A-$033D handler address table
hatabs_t hatabs[12]; // = $031A-$033D handler address table
unsigned int zeropad; // = $033E/$033F zero padding
#else
HATABS hatabs[11]; // = $031A-$033A handler address table
hatabs_t hatabs[11]; // = $031A-$033A handler address table
unsigned int zeropad; // = $033B/$033C zero padding
unsigned char pupbt1; // = $033D ##1200xl## 1-byte power-up validation byte 1
unsigned char pupbt2; // = $033E ##1200xl## 1-byte power-up validation byte 2
unsigned char pupbt3; // = $033F ##1200xl## 1-byte power-up validation byte 3
#endif
IOCB iocb[8]; // = $0340-$03BF 8 I/O Control Blocks
iocb_t iocb[8]; // = $0340-$03BF 8 I/O Control Blocks
unsigned char prnbuf[40]; // = $03C0-$3E7 PRINTER BUFFER
#ifdef OSA
unsigned char _spare_6[151]; // = $03E8-$047F unused