Merge branch 'master' into feature/plus4-tgi-driver

This commit is contained in:
Bob Andrews
2025-06-01 23:12:27 +02:00
committed by GitHub
2213 changed files with 191473 additions and 27985 deletions

View File

@@ -137,7 +137,7 @@ struct __antic {
** Called during every vertical blank; see SYSVBV, VVBLKI, CRITIC, and VVBLKD,
** as well as the SETVBV routine.
*/
#define NMIEN_VBI 0x40
#define NMIEN_VBI 0x40
/* [Reset] key pressed */
#define NMIEN_RESET 0x20

94
include/_atari5200os.h Normal file
View File

@@ -0,0 +1,94 @@
/*****************************************************************************/
/* */
/* _atari5200os.h */
/* */
/* Internal include file, do not use directly */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
#ifndef __ATARI5200OS_H
#define __ATARI5200OS_H
struct __os {
/*Page zero*/
unsigned char pokmsk; // = $00 System mask for POKEY IRQ enable
unsigned char rtclok[2]; // = $01,$02 Real time clock
unsigned char critic; // = $03 Critical section flag
unsigned char atract; // = $04 Attract mode counter
union {
struct {
unsigned char sdlstl; // = $05 Save display list LO
unsigned char sdlsth; // = $06 Save display list HI
};
void* sdlst; // = $05,$06 Display list shadow
};
unsigned char sdmctl; // = $07 DMACTL shadow
unsigned char pcolr0; // = $08 PM color 0
unsigned char pcolr1; // = $09 PM color 1
unsigned char pcolr2; // = $0A PM color 2
unsigned char pcolr3; // = $0B PM color 3
unsigned char color0; // = $0C PF color 0
unsigned char color1; // = $0D PF color 1
unsigned char color2; // = $0E PF color 2
unsigned char color3; // = $0F PF color 3
unsigned char color4; // = $10 PF color 4
unsigned char paddl0; // = $11 POT0 Shadow
unsigned char paddl1; // = $12 POT1 Shadow
unsigned char paddl2; // = $13 POT2 Shadow
unsigned char paddl3; // = $14 POT3 Shadow
unsigned char paddl4; // = $15 POT4 Shadow
unsigned char paddl5; // = $16 POT5 Shadow
unsigned char paddl6; // = $17 POT6 Shadow
unsigned char paddl7; // = $18 POT7 Shadow
/*cc65 runtime zero page variables*/
unsigned char rowcrs_5200; // = $19 Cursor row (conio)
unsigned char colcrs_5200; // = $1A Cursor column (conio)
unsigned char* savmsc; // = $1B/$1C Pointer to screen memory (conio)
unsigned char _filler_1[0xE3]; // = $1D-$FF Filler
/*Stack*/
unsigned char stack[0x100]; // = $100-$1FF Stack
/*Page 2 OS variables*/
void (*vinter)(void); // = $200 Immediate IRQ vector
void (*vvblki)(void); // = $202 Immediate VBI vector
void (*vvblkd)(void); // = $204 Deferred VBI vector
void (*vdslst)(void); // = $206 DLI vector
void (*vkeybd)(void); // = $208 Keyboard IRQ vector
void (*vkeypd)(void); // = $20A Keyboard continuation vector
void (*vbrkky)(void); // = $20C Break key interrupt vector
void (*vbreak)(void); // = $20E BRK instruction interrupt vector
void (*vserin)(void); // = $210 Serial input ready vector
void (*vseror)(void); // = $212 Serial output data needed vector
void (*vseroc)(void); // = $214 Serial output completed vector
void (*vtimr1)(void); // = $216 POKEY timer 1 IRQ vector
void (*vtimr2)(void); // = $218 POKEY timer 2 IRQ vector
void (*vtimr4)(void); // = $21A POKEY timer 4 IRQ vector
};
#endif

View File

@@ -66,7 +66,7 @@ struct __dcb {
unsigned char dtimlo; /* device timeout in seconds */
unsigned char dunuse; /* - unused - */
unsigned int dbyt; /* # of bytes to transfer */
union {
union {
struct {
unsigned char daux1; /* 1st command auxiliary byte */
unsigned char daux2; /* 2nd command auxiliary byte */
@@ -105,7 +105,7 @@ struct __dos2x {
unsigned char* zbufp; /* points to user filename */
unsigned char* zdrva; /* points to serveral buffers (mostly VTOC) */
unsigned char* zsba; /* points to sector buffer */
unsigned char errno; /* number of occured error */
unsigned char errno; /* number of occurred error */
};
typedef struct __dos2x dos2x_t;
@@ -120,8 +120,9 @@ struct __devhdl {
void *put; /* address of PUT BYTE routine -1 */
void *status; /* address of GET STATUS routine -1 */
void *special; /* address od SPECIAL routine -1 */
unsigned char jmp_inst; /* a "JMP" byte, should be $4C */
void (*init)(void); /* init routine (JMP INIT) */
void *reserved; /* unused */
unsigned char reserved; /* unused */
};
typedef struct __devhdl devhdl_t;
@@ -166,28 +167,28 @@ struct __os {
#ifdef OSA
unsigned char* linzbs; // = $00/$01 LINBUG RAM (WILL BE REPLACED BY MONITOR RAM)
#else
#else
unsigned char linflg; // = $00 LNBUG FLAG (0 = NOT LNBUG)
unsigned char ngflag; // = $01 MEMORY STATUS (0 = FAILURE)
#endif
#endif
unsigned char* casini; // = $02/$03 CASSETTE INIT LOCATION
unsigned char* ramlo; // = $04/$05 RAM POINTER FOR MEMORY TEST
#ifdef OSA
#ifdef OSA
unsigned char tramsz; // = $06 FLAG FOR LEFT CARTRIDGE
unsigned char tstdat; // = $07 FLAG FOR RIGHT CARTRIDGE
#else
#else
unsigned char trnsmz; // = $06 TEMPORARY REGISTER FOR RAM SIZE
unsigned char tstdat; // = $07 UNUSED (NOT TOUCHED DURING RESET/COLD START)
#endif
// Cleared upon Coldstart only
// Cleared upon Coldstart only
unsigned char warmst; // = $08 WARM START FLAG
unsigned char bootq; // = $09 SUCCESSFUL BOOT FLAG
unsigned char bootq; // = $09 SUCCESSFUL BOOT FLAG
void (*dosvec)(void); // = $0A/$0B DISK SOFTWARE START VECTOR
void (*dosini)(void); // = $0C/$0D DISK SOFTWARE INIT ADDRESS
unsigned char* appmhi; // = $0E/$0F APPLICATIONS MEMORY HI LIMIT
unsigned char* appmhi; // = $0E/$0F APPLICATIONS MEMORY HI LIMIT
// Cleared upon Coldstart or Warmstart
@@ -198,26 +199,26 @@ struct __os {
unsigned char iccomt; // = $17 COMMAND FOR VECTOR
unsigned char* dskfms; // = $18/$19 DISK FILE MANAGER POINTER
unsigned char* dskutl; // = $1A/$1B DISK UTILITIES POINTER
#ifdef OSA
#ifdef OSA
unsigned char ptimot; // = $1C PRINTER TIME OUT REGISTER
unsigned char pbpnt; // = $1D PRINT BUFFER POINTER
unsigned char pbufsz; // = $1E PRINT BUFFER SIZE
unsigned char ptemp; // = $1F TEMPORARY REGISTER
#else
#else
unsigned char abufpt[4]; // = $1C-$1F ACMI BUFFER POINTER AREA
#endif
#endif
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)
unsigned char* bufr; // = $32/$33 POINTER TO DATA BUFFER
unsigned char* bfen; // = $34/$35 NEXT BYTE PAST END OF THE DATA BUFFER LO
#ifdef OSA
#ifdef OSA
unsigned char cretry; // = $36 NUMBER OF COMMAND FRAME RETRIES
unsigned char dretry; // = $37 NUMBER OF DEVICE RETRIES
#else
#else
unsigned int ltemp; // = $36/$37 LOADER TEMPORARY
#endif
#endif
unsigned char bufrfl; // = $38 DATA BUFFER FULL FLAG
unsigned char recvdn; // = $39 RECEIVE DONE FLAG
unsigned char xmtdon; // = $3A TRANSMISSION DONE FLAG
@@ -226,22 +227,22 @@ struct __os {
unsigned char bptr; // = $3D CASSETTE BUFFER POINTER
unsigned char ftype; // = $3E CASSETTE IRG TYPE
unsigned char feof; // = $3F CASSETTE EOF FLAG (0 // = QUIET)
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_t fmszpg; // = $43-$49 DISK FILE MANAGER SYSTEM ZERO PAGE
#ifdef OSA
#ifdef OSA
unsigned char ckey; // = $4A FLAG SET WHEN GAME START PRESSED
unsigned char cassbt; // = $4B CASSETTE BOOT FLAG
#else
#else
void* zchain; // = $4A/$4B HANDLER LINKAGE CHAIN POINTER
#endif
#endif
unsigned char dstat; // = $4C DISPLAY STATUS
unsigned char atract; // = $4D ATRACT FLAG
unsigned char drkmsk; // = $4E DARK ATRACT MASK
unsigned char colrsh; // = $4F ATRACT COLOR SHIFTER (EOR'ED WITH PLAYFIELD
unsigned char tmpchr; // = $50 TEMPORARY CHARACTER
unsigned char hold1; // = $51 TEMPORARY
unsigned char lmargn; // = $52 LEFT MARGIN (NORMALLY 2, CC65 C STARTUP CODE SETS IT TO 0)
@@ -254,68 +255,68 @@ struct __os {
unsigned int oldcol; // = $5B/$5C PRIOR COLUMN
unsigned char oldchr; // = $5D DATA UNDER CURSOR
unsigned char* oldadr; // = $5E/$5F SAVED CURSOR MEMORY ADDRESS
#ifdef OSA
#ifdef OSA
unsigned char newrow; // = $60 POINT DRAW GOES TO
unsigned int newcol; // = $61/$62 COLUMN DRAW GOES TO
#else
#else
unsigned char* fkdef; // = $60/$61 FUNCTION KEY DEFINITION TABLE
unsigned char palnts; // = $62 PAL/NTSC INDICATOR (0 // = NTSC)
#endif
#endif
unsigned char logcol; // = $63 POINTS AT COLUMN IN LOGICAL LINE
unsigned char* adress; // = $64/$65 TEMPORARY ADDRESS
unsigned int mlttmp; // = $66/$67 TEMPORARY / FIRST BYTE IS USED IN OPEN AS TEMP
unsigned int savadr; // = $68/$69 SAVED ADDRESS
unsigned int mlttmp; // = $66/$67 TEMPORARY / FIRST BYTE IS USED IN OPEN AS TEMP
unsigned int savadr; // = $68/$69 SAVED ADDRESS
unsigned char ramtop; // = $6A RAM SIZE DEFINED BY POWER ON LOGIC
unsigned char bufcnt; // = $6B BUFFER COUNT
unsigned char* bufstr; // = $6C/$6D EDITOR GETCH POINTER
unsigned char bitmsk; // = $6E BIT MASK
unsigned char shfamt; // = $6F SHIFT AMOUNT FOR PIXEL JUSTIFUCATION
unsigned int rowac; // = $70/$71 DRAW WORKING ROW
unsigned int colac; // = $72/$73 DRAW WORKING COLUMN
unsigned char* endpt; // = $74/$75 END POINT
unsigned char deltar; // = $76 ROW DIFFERENCE
unsigned int deltac; // = $77/$78 COLUMN DIFFERENCE
#ifdef OSA
unsigned char rowinc; // = $79 ROWINC
#ifdef OSA
unsigned char rowinc; // = $79 ROWINC
unsigned char colinc; // = $7A COLINC
#else
#else
unsigned char* keydef; // = $79/$7A 2-BYTE KEY DEFINITION TABLE ADDRESS
#endif
#endif
unsigned char swpflg; // = $7B NON-0 1F TXT AND REGULAR RAM IS SWAPPED
unsigned char holdch; // = $7C CH IS MOVED HERE IN KGETCH BEFORE CNTL & SH
unsigned char insdat; // = $7D 1-BYTE TEMPORARY
unsigned int countr; // = $7E/$7F 2-BYTE DRAW ITERATION COUNT
unsigned char _free_1[0xD4-0x7F-1]; // USER SPACE
// Floating Point Package Page Zero Address Equates
fpreg_t fpreg[4]; // = $D4-$EB 4 REGSITERS, ACCCESS LIKE "fpreg[FPIDX_R0].fr"
unsigned char frx; // = $EC 1-BYTE TEMPORARY
fpreg_t fpreg[4]; // = $D4-$EB 4 REGSITERS, ACCCESS LIKE "fpreg[FPIDX_R0].fr"
unsigned char frx; // = $EC 1-BYTE TEMPORARY
unsigned char eexp; // = $ED VALUE OF EXP
#ifdef OS_REV2
#ifdef OS_REV2
unsigned char frsign; // = $EE ##REV2## 1-BYTE FLOATING POINT SIGN
unsigned char plycnt; // = $EF ##REV2## 1-BYTE POLYNOMIAL DEGREE
unsigned char sgnflg; // = $F0 ##REV2## 1-BYTE SIGN FLAG
unsigned char xfmflg; // = $F1 ##REV2## 1-BYTE TRANSFORM FLAG
#else
#else
unsigned char nsign; // = $EE SIGN OF #
unsigned char esign; // = $EF SIGN OF EXPONENT
unsigned char fchrflg; // = $F0 1ST CHAR FLAG
unsigned char digrt; // = $F1 # OF DIGITS RIGHT OF DECIMAL
#endif
#endif
unsigned char cix; // = $F2 CURRENT INPUT INDEX
unsigned char* inbuff; // = $F3/$F4 POINTS TO USER'S LINE INPUT BUFFER
unsigned char* inbuff; // = $F3/$F4 POINTS TO USER'S LINE INPUT BUFFER
unsigned int ztemp1; // = $F5/$F6 2-BYTE TEMPORARY
unsigned int ztemp4; // = $F7/$F8 2-BYTE TEMPORARY
unsigned int ztemp3; // = $F9/$FA 2-BYTE TEMPORARY
union {
union {
unsigned char degflg; // = $FB ##OLD## SAME AS RADFLG
unsigned char radflg; // = $FB ##OLD## 0=RADIANS, 6=DEGREES
};
fpreg_t* flptr; // = $FC/$FD 2-BYTE FLOATING POINT NUMBER POINTER
fpreg_t* fptr2; // = $FE/$FF 2-BYTE FLOATING POINT NUMBER POINTER
@@ -333,17 +334,17 @@ struct __os {
void (*vserin)(void); // = $020A/$020B POKEY SERIAL INPUT READY IRQ
void (*vseror)(void); // = $020C/$020D POKEY SERIAL OUTPUT READY IRQ
void (*vseroc)(void); // = $020E/$020F POKEY SERIAL OUTPUT COMPLETE IRQ
void (*vtimr1)(void); // = $0210/$0201 POKEY TIMER 1 IRQ
void (*vtimr2)(void); // = $0212/$0203 POKEY TIMER 2 IRQ
void (*vtimr4)(void); // = $0214/$0205 POKEY TIMER 4 IRQ
void (*vimirq)(void); // = $0216/$0207 IMMEDIATE IRQ VECTOR
unsigned int cdtmv1; // = $0218/$0210 COUNT DOWN TIMER 1
void (*vtimr1)(void); // = $0210/$0211 POKEY TIMER 1 IRQ
void (*vtimr2)(void); // = $0212/$0213 POKEY TIMER 2 IRQ
void (*vtimr4)(void); // = $0214/$0215 POKEY TIMER 4 IRQ
void (*vimirq)(void); // = $0216/$0217 IMMEDIATE IRQ VECTOR
unsigned int cdtmv1; // = $0218/$0219 COUNT DOWN TIMER 1
unsigned int cdtmv2; // = $021A/$021B COUNT DOWN TIMER 2
unsigned int cdtmv3; // = $021C/$021D COUNT DOWN TIMER 3
unsigned int cdtmv4; // = $021E/$021F COUNT DOWN TIMER 4
unsigned int cdtmv5; // = $0220/$0221 COUNT DOWN TIMER 5
void (*vvblki)(void); // = $0222/$0223 IMMEDIATE VERTICAL BLANK NMI VECTOR
void (*vvblkd)(void); // = $0224/$0224 DEFERRED VERTICAL BLANK NMI VECTOR
void (*vvblkd)(void); // = $0224/$0225 DEFERRED VERTICAL BLANK NMI VECTOR
void (*cdtma1)(void); // = $0226/$0227 COUNT DOWN TIMER 1 JSR ADDRESS
void (*cdtma2)(void); // = $0228/$0229 COUNT DOWN TIMER 2 JSR ADDRESS
unsigned char cdtmf3; // = $022A COUNT DOWN TIMER 3 FLAG
@@ -355,28 +356,28 @@ struct __os {
union {
struct {
unsigned char sdlstl; // = $0230 SAVE DISPLAY LIST LOW BYTE
unsigned char sdlsth; // = $0231 SAVE DISPLAY LIST HI BYTE
unsigned char sdlsth; // = $0231 SAVE DISPLAY LIST HI BYTE
};
void* sdlst; // = $0230/$0231 (same as above as pointer)
};
unsigned char sskctl; // = $0232 SKCTL REGISTER RAM
#ifdef OSA
#ifdef OSA
unsigned char _spare_1; // = $0233 No OS use.
#else
unsigned char lcount; // = $0233 ##1200xl## 1-byte relocating loader record
#endif
#endif
unsigned char lpenh; // = $0234 LIGHT PEN HORIZONTAL VALUE
unsigned char lpenv; // = $0235 LIGHT PEN VERTICAL VALUE
void (*brkky)(void); // = $0236/$0237 BREAK KEY VECTOR
#ifdef OSA
#ifdef OSA
unsigned char spare2[2]; // = $0238/$0239 No OS use.
#else
#else
void (*vpirq)(void); // = $0238/$0239 ##rev2## 2-byte parallel device IRQ vector
#endif
#endif
unsigned char cdevic; // = $023A COMMAND FRAME BUFFER - DEVICE
unsigned char ccomnd; // = $023B COMMAND
union {
struct {
struct {
unsigned char caux1; // = $023C COMMAND AUX BYTE 1
unsigned char caux2; // = $023D COMMAND AUX BYTE 2
};
@@ -388,15 +389,15 @@ struct __os {
unsigned char dbsect; // = $0241 NUMBER OF DISK BOOT SECTORS
unsigned char* bootad; // = $0242/$0243 ADDRESS WHERE DISK BOOT LOADER WILL BE PUT
unsigned char coldst; // = $0244 COLDSTART FLAG (1=IN MIDDLE OF COLDSTART>
#ifdef OSA
#ifdef OSA
unsigned char spare3; // = $0245 No OS use.
#else
#else
unsigned char reclen; // = $0245 ##1200xl## 1-byte relocating loader record length
#endif
#endif
unsigned char dsktim; // = $0246 DISK TIME OUT REGISTER
#ifdef OSA
#ifdef OSA
unsigned char linbuf[40]; // = $0247-$026E ##old## CHAR LINE BUFFER
#else
#else
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
@@ -408,7 +409,7 @@ struct __os {
unsigned char vsflag; // = $026C ##1200xl## 1-byte fine vertical scroll count
unsigned char keydis; // = $026D ##1200xl## 1-byte keyboard disable
unsigned char fine; // = $026E ##1200xl## 1-byte fine scrolling mode
#endif
#endif
unsigned char gprior; // = $026F GLOBAL PRIORITY CELL
unsigned char paddl0; // = $0270 1-BYTE POTENTIOMETER 0
unsigned char paddl1; // = $0271 1-BYTE POTENTIOMETER 1
@@ -434,30 +435,30 @@ struct __os {
unsigned char strig1; // = $0285 1-BYTE JOYSTICK TRIGGER 1
unsigned char strig2; // = $0286 1-BYTE JOYSTICK TRIGGER 2
unsigned char strig3; // = $0287 1-BYTE JOYSTICK TRIGGER 3
#ifdef OSA
#ifdef OSA
unsigned char cstat; // = $0288 ##old## cassette status register
#else
#else
unsigned char hibyte; // = $0288 ##1200xl## 1-byte relocating loader high byte
#endif
#endif
unsigned char wmode; // = $0289 1-byte cassette WRITE mode
unsigned char blim; // = $028A 1-byte cassette buffer limit
#ifdef OSA
unsigned char _reserved_2[5]; // = $028B-$028F RESERVED
#else
#else
unsigned char imask; // = $028B ##rev2## (not used)
void (*jveck)(void); // = $028C/$028D 2-byte jump vector
unsigned newadr; // = $028E/028F ##1200xl## 2-byte relocating address
#endif
#endif
unsigned char txtrow; // = $0290 TEXT ROWCRS
unsigned txtcol; // = $0291/$0292 TEXT COLCRS
unsigned char tindex; // = $0293 TEXT INDEX
unsigned char* txtmsc; // = $0294/$0295 FOOLS CONVRT INTO NEW MSC
unsigned char txtold[6]; // = $0296-$029B OLDROW & OLDCOL FOR TEXT (AND THEN SOME)
#ifdef OSA
#ifdef OSA
unsigned char tmpx1; // = $029C ##old## 1--byte temporary register
#else
#else
unsigned char cretry; // = $029C ##1200xl## 1-byte number of command frame retries
#endif
#endif
unsigned char hold3; // = $029D 1-byte temporary
unsigned char subtmp; // = $029E 1-byte temporary
unsigned char hold2; // = $029F 1-byte (not used)
@@ -472,41 +473,41 @@ struct __os {
unsigned tmpcol; // = $02B9/$02BA 2-byte temporary column
unsigned char scrflg; // = $02BB SET IF SCROLL OCCURS
unsigned char hold4; // = $02BC TEMP CELL USED IN DRAW ONLY
#ifdef OSA
#ifdef OSA
unsigned char hold5; // = $02BD ##old## DITTO
#else
#else
unsigned char dretry; // = $02BD ##1200xl## 1-byte number of device retries
#endif
#endif
unsigned char shflok; // = $02BE 1-byte shift/control lock flags
unsigned char botscr; // = $02BF BOTTOM OF SCREEN 24 NORM 4 SPLIT
unsigned char pcolr0; // = $02C0 1-byte player-missile 0 color/luminance
unsigned char pcolr1; // = $02C1 1-byte player-missile 1 color/luminance
unsigned char pcolr2; // = $02C2 1-byte player-missile 2 color/luminance
unsigned char pcolr3; // = $02C3 1-byte player-missile 3 color/luminance
unsigned char pcolr3; // = $02C3 1-byte player-missile 3 color/luminance
unsigned char color0; // = $02C4 1-byte playfield 0 color/luminance
unsigned char color1; // = $02C5 1-byte playfield 1 color/luminance
unsigned char color2; // = $02C6 1-byte playfield 2 color/luminance
unsigned char color3; // = $02C7 1-byte playfield 3 color/luminance
unsigned char color4; // = $02C8 1-byte background color/luminance
#ifdef OSA
#ifdef OSA
unsigned char _spare_2[23]; // = $02C9-$02DF No OS use.
#else
union {
unsigned char parmbl[6]; // = $02C9 ##rev2## 6-byte relocating loader parameter
struct {
struct {
void (*runadr)(void); // = $02C9 ##1200xl## 2-byte run address
unsigned int hiused; // = $02CB ##1200xl## 2-byte highest non-zero page address
unsigned int zhiuse; // = $02CD ##1200xl## 2-byte highest zero page address
};
};
union {
};
};
union {
unsigned char oldpar[6]; // = $02CF ##rev2## 6-byte relocating loader parameter
struct {
struct {
void (*gbytea)(void); // = $02CF ##1200xl## 2-byte GET-BYTE routine address
unsigned int loadad; // = $02D1 ##1200xl## 2-byte non-zero page load address
unsigned int zloada; // = $02D3 ##1200xl## 2-byte zero page load address
};
};
};
};
unsigned int dsctln; // = $02D5 ##1200xl## 2-byte disk sector length
unsigned int acmisr; // = $02D7 ##1200xl## 2-byte ACMI interrupt service routine
unsigned char krpdel; // = $02D9 ##1200xl## 1-byte auto-repeat delay
@@ -516,78 +517,78 @@ struct __os {
unsigned char dmasav; // = $02DD ##1200xl## 1-byte SDMCTL save/restore
unsigned char pbpnt; // = $02DE ##1200xl## 1-byte printer buffer pointer
unsigned char pbufsz; // = $02DF ##1200xl## 1-byte printer buffer size
#endif
union {
#endif
union {
unsigned char glbabs[4]; // = $02E0-$02E3 byte global variables for non-DOS users
struct {
struct {
void (*runad)(void); // = $02E0 ##map## 2-byte binary file run address
void (*initad)(void); // = $02E2 ##map## 2-byte binary file initialization address
};
};
};
};
unsigned char ramsiz; // = $02E4 RAM SIZE (HI BYTE ONLY)
void* memtop; // = $02E5 TOP OF AVAILABLE USER MEMORY
void* memlo; // = $02E7 BOTTOM OF AVAILABLE USER MEMORY
#ifdef OSA
#ifdef OSA
unsigned char _spare_3; // = $02E9 No OS use.
#else
#else
unsigned char hndlod; // = $02E9 ##1200xl## 1-byte user load flag
#endif
#endif
unsigned char dvstat[4]; // = $02EA-$02ED STATUS BUFFER
union {
union {
unsigned int cbaud; // = $02EE/$02EF 2-byte cassette baud rate
struct {
struct {
unsigned char cbaudl; // = $02EE 1-byte low cassette baud rate
unsigned char cbaudh; // = $02EF 1-byte high cassette baud rate
};
};
};
};
unsigned char crsinh; // = $02F0 CURSOR INHIBIT (00 = CURSOR ON)
unsigned char keydel; // = $02F1 KEY DELAY
unsigned char ch1; // = $02F2 1-byte prior keyboard character
unsigned char chact; // = $02F3 CHACTL REGISTER RAM
unsigned char chbas; // = $02F4 CHBAS REGISTER RAM
#ifdef OSA
#ifdef OSA
unsigned char _spare_4[5]; // = $02F5-$02F9 No OS use.
#else
#else
unsigned char newrow; // = $02F5 ##1200xl## 1-byte draw destination row
unsigned int newcol; // = $02F6/$02F7 ##1200xl## 2-byte draw destination column
unsigned char rowinc; // = $02F8 ##1200xl## 1-byte draw row increment
unsigned char colinc; // = $02F9 ##1200xl## 1-byte draw column increment
#endif
#endif
unsigned char char_; // = $02FA 1-byte internal character (naming changed due to do keyword conflict)
unsigned char atachr; // = $02FB ATASCII CHARACTER
unsigned char ch; // = $02FC GLOBAL VARIABLE FOR KEYBOARD
unsigned char fildat; // = $02FD RIGHT FILL DATA <DRAW>
unsigned char dspflg; // = $02FE DISPLAY FLAG DISPLAY CNTLS IF NON-ZERO
unsigned char ssflag; // = $02FF START/STOP FLAG FOR PAGING (CNTL 1). CLEARE
// --- Page 3 ---
dcb_t dcb; // = $0300-$030B DEVICE CONTROL BLOCK
unsigned int timer1; // = $030C/$030D INITIAL TIMER VALUE
#ifdef OSA
#ifdef OSA
unsigned char addcor; // = $030E ##old## ADDITION CORRECTION
#else
#else
unsigned char jmpers; // = $030E ##1200xl## 1-byte jumper options
#endif
#endif
unsigned char casflg; // = $030F CASSETTE MODE WHEN SET
unsigned int timer2; // = $0310/$0311 2-byte final baud rate timer value
unsigned char temp1; // = $0312 TEMPORARY STORAGE REGISTER
#ifdef OSA
#ifdef OSA
unsigned char _spare_5; // = $0313 unused
unsigned char temp2; // = $0314 ##old## TEMPORARY STORAGE REGISTER
#else
#else
unsigned char temp2; // = $0313 ##1200xl## 1-byte temporary
unsigned char ptimot; // = $0314 ##1200xl## 1-byte printer timeout
#endif
#endif
unsigned char temp3; // = $0315 TEMPORARY STORAGE REGISTER
unsigned char savio; // = $0316 SAVE SERIAL IN DATA PORT
unsigned char timflg; // = $0317 TIME OUT FLAG FOR BAUD RATE CORRECTION
unsigned char stackp; // = $0318 SIO STACK POINTER SAVE CELL
unsigned char tstat; // = $0319 TEMPORARY STATUS HOLDER
#ifdef OSA
#ifdef OSA
hatabs_t hatabs[12]; // = $031A-$033D handler address table
unsigned int zeropad; // = $033E/$033F zero padding
#else
#else
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
@@ -597,9 +598,9 @@ struct __os {
iocb_t iocb[8]; // = $0340-$03BF 8 I/O Control Blocks
unsigned char prnbuf[40]; // = $03C0-$3E7 PRINTER BUFFER
#ifdef OSA
#ifdef OSA
unsigned char _spare_6[151]; // = $03E8-$047F unused
#else
#else
unsigned char superf; // = $03E8 ##1200xl## 1-byte editor super function flag
unsigned char ckey; // = $03E9 ##1200xl## 1-byte cassette boot request flag
unsigned char cassbt; // = $03EA ##1200xl## 1-byte cassette boot flag
@@ -638,7 +639,7 @@ struct __basic {
void* starp; // = $8C/$8D ADDRESS FOR THE STRING AND ARRAY TABLE
void* runstk; // = $8E/$8F ADDRESS OF THE RUNTIME STACK
void* memtop; // = $90/$91 POINTER TO THE TOP OF BASIC MEMORY
unsigned char _internal_1[0xBA-0x91-1]; // INTERNAL DATA
unsigned int stopln; // = $BA/$BB LINE WHERE A PROGRAM WAS STOPPED

View File

@@ -95,7 +95,7 @@ struct __gtia_write {
#define PMG_SIZE_NORMAL 0x0 /* one color clock per pixel */
#define PMG_SIZE_DOUBLE 0x1 /* two color clocks per pixel */
#define PMG_SIZE_QUAD 0x2 /* four color clocks per pixel */
#define PMG_SIZE_QUAD 0x3 /* four color clocks per pixel */
/* COLPM0-COLPM3, COLPF0-COLPF3, COLBK color registers */

View File

@@ -37,13 +37,20 @@ struct freeblock {
/* Variables that describe the heap */
extern unsigned* _heaporg; /* Bottom of heap */
extern unsigned* _heapptr; /* Current top */
extern unsigned* _heapend; /* Upper limit */
extern struct freeblock* _heapfirst; /* First free block in list */
extern struct freeblock* _heaplast; /* Last free block in list */
extern unsigned* __heaporg; /* Bottom of heap */
extern unsigned* __heapptr; /* Current top */
extern unsigned* __heapend; /* Upper limit */
extern struct freeblock* __heapfirst; /* First free block in list */
extern struct freeblock* __heaplast; /* Last free block in list */
#if __CC65_STD__ == __CC65_STD_CC65__
/* define old name with one underscore for backwards compatibility */
#define _heaporg __heaporg
#define _heapptr __heapptr
#define _heapend __heapend
#define _heapfirst __heapfirst
#define _heaplast __heaplast
#endif
/* End of _heap.h */

63
include/_maria.h Normal file
View File

@@ -0,0 +1,63 @@
/*****************************************************************************/
/* */
/* _maria.h */
/* */
/* Atari 7800, Maria chip register hardware structures */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
/*
* MARIA registers
*/
struct __maria {
unsigned char bkgrnd;
unsigned char p0c1;
unsigned char p0c2;
unsigned char p0c3;
unsigned char wsync;
unsigned char p1c1;
unsigned char p1c2;
unsigned char p1c3;
unsigned char mstat;
unsigned char p2c1;
unsigned char p2c2;
unsigned char p2c3;
unsigned char dpph;
unsigned char p3c1;
unsigned char p3c2;
unsigned char p3c3;
unsigned char dppl;
unsigned char p4c1;
unsigned char p4c2;
unsigned char p4c3;
unsigned char chbase;
unsigned char p5c1;
unsigned char p5c2;
unsigned char p5c3;
unsigned char offset;
unsigned char p6c1;
unsigned char p6c2;
unsigned char p6c3;
unsigned char ctrl;
unsigned char p7c1;
unsigned char p7c2;
unsigned char p7c3;
};

View File

@@ -27,7 +27,7 @@
#ifndef __MIKEY_H
#define __MIKEY_H
/* timer structure */
/* Timer structure */
typedef struct _mikey_timer {
unsigned char reload;
unsigned char control;
@@ -39,7 +39,7 @@ typedef struct _mikey_all_timers {
struct _mikey_timer timer[8];
} _mikey_all_timers;
/* audio channel structure */
/* Audio channel structure */
typedef struct _mikey_audio {
unsigned char volume;
unsigned char feedback;
@@ -53,54 +53,212 @@ typedef struct _mikey_audio {
/* Define a structure with the mikey register offsets */
struct __mikey {
struct _mikey_timer timer0; // 0xFD00
struct _mikey_timer timer1; // 0xFD04
struct _mikey_timer timer2; // 0xFD08
struct _mikey_timer timer3; // 0xFD0C
struct _mikey_timer timer4; // 0xFD10
struct _mikey_timer timer5; // 0xFD14
struct _mikey_timer timer6; // 0xFD18
struct _mikey_timer timer7; // 0xFD1C
struct _mikey_audio channel_a; // 0xFD20
struct _mikey_audio channel_b; // 0xFD28
struct _mikey_audio channel_c; // 0xFD30
struct _mikey_audio channel_d; // 0xFD38
unsigned char attena; // 0xFD40 ?? not yet allocated?
unsigned char attenb; // 0xFD41 |
unsigned char attenc; // 0xFD42 |
unsigned char attend; // 0xFD43 |
unsigned char panning; // 0xFD44 |
unsigned char unused0[11]; // 0xFD45 - 0xFD4F not used
unsigned char mstereo; // 0xFD50 stereo control bits
unsigned char unused1[47]; // 0xFD51 - 0xFD7F not used
unsigned char intrst; // 0xFD80 interrupt poll 0
unsigned char intset; // 0xFD81 interrupt poll 1
unsigned char unused2[2]; // 0xFD82 - 0xFD83 not used
unsigned char magrdy0; // 0xFD84 mag tape channel0 ready bit
unsigned char magrdy1; // 0xFD85 mag tape channel1 ready bit
unsigned char audin; // 0xFD86 audio in
unsigned char sysctl1; // 0xFD87 control bits
unsigned char mikeyrev; // 0xFD88 mikey hardware rev
unsigned char mikeysrev; // 0xFD89 mikey software rev
unsigned char iodir; // 0xFD8A parallel i/o data dir
unsigned char iodat; // 0xFD8B parallel data
unsigned char serctl; // 0xFD8C serial control register
unsigned char serdat; // 0xFD8D serial data
unsigned char unused3[2]; // 0xFD8E - 0xFD8F not used
unsigned char sdoneack; // 0xFD90 suzy done acknowledge
unsigned char cpusleep; // 0xFD91 cpu bus request disable
unsigned char dispctl; // 0xFD92 video bus request enable, viddma
unsigned char pkbkup; // 0xFD93 magic 'P' count
unsigned char *scrbase; // 0xFD94 start address of video display
unsigned char unused4[6]; // 0xFD96 - 0xFD9B not used
unsigned char mtest0; // 0xFD9C
unsigned char mtest1; // 0xFD9D
unsigned char mtest2; // 0xFD9E
unsigned char unused5; // 0xFD9F not used
unsigned char palette[32]; // 0xFDA0 - 0xFDBF palette 32 bytes
// 0xFDC0 - 0xFDFF not used
struct _mikey_timer timer0; /* 0xFD00 */
struct _mikey_timer timer1; /* 0xFD04 */
struct _mikey_timer timer2; /* 0xFD08 */
struct _mikey_timer timer3; /* 0xFD0C */
struct _mikey_timer timer4; /* 0xFD10 */
struct _mikey_timer timer5; /* 0xFD14 */
struct _mikey_timer timer6; /* 0xFD18 */
struct _mikey_timer timer7; /* 0xFD1C */
struct _mikey_audio channel_a; /* 0xFD20 */
struct _mikey_audio channel_b; /* 0xFD28 */
struct _mikey_audio channel_c; /* 0xFD30 */
struct _mikey_audio channel_d; /* 0xFD38 */
unsigned char attena; /* 0xFD40 ?? not yet allocated? */
unsigned char attenb; /* 0xFD41 | */
unsigned char attenc; /* 0xFD42 | */
unsigned char attend; /* 0xFD43 | */
unsigned char panning; /* 0xFD44 | */
unsigned char unused0[11]; /* 0xFD45 - 0xFD4F not used */
unsigned char mstereo; /* 0xFD50 stereo control bits */
unsigned char unused1[47]; /* 0xFD51 - 0xFD7F not used */
unsigned char intrst; /* 0xFD80 interrupt poll 0 */
unsigned char intset; /* 0xFD81 interrupt poll 1 */
unsigned char unused2[2]; /* 0xFD82 - 0xFD83 not used */
unsigned char magrdy0; /* 0xFD84 mag tape channel0 ready bit */
unsigned char magrdy1; /* 0xFD85 mag tape channel1 ready bit */
unsigned char audin; /* 0xFD86 audio in */
unsigned char sysctl1; /* 0xFD87 control bits */
unsigned char mikeyrev; /* 0xFD88 mikey hardware rev */
unsigned char mikeysrev; /* 0xFD89 mikey software rev */
unsigned char iodir; /* 0xFD8A parallel i/o data dir */
unsigned char iodat; /* 0xFD8B parallel data */
unsigned char serctl; /* 0xFD8C serial control register */
unsigned char serdat; /* 0xFD8D serial data */
unsigned char unused3[2]; /* 0xFD8E - 0xFD8F not used */
unsigned char sdoneack; /* 0xFD90 suzy done acknowledge */
unsigned char cpusleep; /* 0xFD91 cpu bus request disable */
unsigned char dispctl; /* 0xFD92 video bus request enable, viddma */
unsigned char pkbkup; /* 0xFD93 magic 'P' count */
unsigned char *scrbase; /* 0xFD94 start address of video display */
unsigned char unused4[6]; /* 0xFD96 - 0xFD9B not used */
unsigned char mtest0; /* 0xFD9C */
unsigned char mtest1; /* 0xFD9D */
unsigned char mtest2; /* 0xFD9E */
unsigned char unused5; /* 0xFD9F not used */
unsigned char palette[32]; /* 0xFDA0 - 0xFDBF palette 32 bytes */
unsigned char unused6[64]; /* 0xFDC0 - 0xFDFF not used */
unsigned char bootrom[504]; /* 0xFE00 - 0xFFD8 boot rom */
unsigned char reserved; /* 0xFFD8 reserved for future hardware */
unsigned char mapctl; /* 0xFFF9 map control register */
struct {
unsigned char *nmi; /* 0xFFFA NMI vector */
unsigned char *reset; /* 0xFFFB reset vector */
unsigned char *irq; /* 0xFFFC IRQ vector */
} vectors;
};
/* TIM_CONTROLA control bit definitions */
enum {
ENABLE_INT = 0x80,
RESET_DONE = 0x40,
ENABLE_RELOAD = 0x10,
ENABLE_COUNT = 0x08
};
/* AUD_CONTROL control bit definitions */
enum {
FEEDBACK_7 = 0x80,
ENABLE_INTEGRATE = 0x20
};
/* Audio and timer clock settings for source period */
enum {
AUD_LINKING = 0x07,
AUD_64 = 0x06,
AUD_32 = 0x05,
AUD_16 = 0x04,
AUD_8 = 0x03,
AUD_4 = 0x02,
AUD_2 = 0x01,
AUD_1 = 0x00
};
/* TIM_CONTROLB control bit definitions */
enum {
TIMER_DONE = 0x08,
LAST_CLOCK = 0x04,
BORROW_IN = 0x02,
BORROW_OUT = 0x01
};
/* MPAN and MSTEREO registers bit definitions */
enum {
LEFT3_SELECT = 0x80,
LEFT2_SELECT = 0x40,
LEFT1_SELECT = 0x20,
LEFT0_SELECT = 0x10,
RIGHT3_SELECT = 0x08,
RIGHT2_SELECT = 0x04,
RIGHT1_SELECT = 0x02,
RIGHT0_SELECT = 0x01,
LEFT_ATTENMASK = 0xF0,
RIGHT_ATTENMASK = 0x0F
};
/* Interrupt Reset and Set bit definitions */
enum {
TIMER7_INT = 0x80,
TIMER6_INT = 0x40,
TIMER5_INT = 0x20,
TIMER4_INT = 0x10,
TIMER3_INT = 0x08,
TIMER2_INT = 0x04,
TIMER1_INT = 0x02,
TIMER0_INT = 0x01,
SERIAL_INT = TIMER4_INT,
VERTICAL_INT = TIMER2_INT,
HORIZONTAL_INT = TIMER0_INT
};
/* SYSCTL1 bit definitions */
enum {
POWERON = 0x02,
CART_ADDR_STROBE = 0x01
};
/* IODIR and IODAT bit definitions */
enum {
AUDIN_BIT = 0x10, /* different from AUDIN address */
READ_ENABLE = 0x10, /* same bit for AUDIN_BIT */
RESTLESS = 0x08,
NOEXP = 0x04, /* if set, redeye is not connected */
CART_ADDR_DATA = 0x02,
CART_POWER_OFF = 0x02, /* same bit for CART_ADDR_DATA */
EXTERNAL_POWER = 0x01
};
/* SERCTL bit definitions for write operations */
enum {
TXINTEN = 0x80,
RXINTEN = 0x40,
PAREN = 0x10,
RESETERR = 0x08,
TXOPEN = 0x04,
TXBRK = 0x02,
PAREVEN = 0x01
};
/* SERCTL bit definitions for read operations */
enum {
TXRDY = 0x80,
RXRDY = 0x40,
TXEMPTY = 0x20,
PARERR = 0x10,
OVERRUN = 0x08,
FRAMERR = 0x04,
RXBRK = 0x02,
PARBIT = 0x01
};
/* DISPCTL bit definitions */
enum {
DISP_COLOR = 0x08, /* must be set to 1 */
DISP_FOURBIT = 0x04, /* must be set to 1 */
DISP_FLIP = 0x02,
DMA_ENABLE = 0x01 /* must be set to 1 */
};
/* MTEST0 bit definitions */
enum {
AT_CNT16 = 0x80,
AT_TEST = 0x40,
XCLKEN = 0x20,
UART_TURBO = 0x10,
ROM_SEL = 0x08,
ROM_TEST = 0x04,
M_TEST = 0x02,
CPU_TEST = 0x01
};
/* MTEST1 bit definitions */
enum {
P_CNT16 = 0x40,
REF_CNT16 = 0x20,
VID_TRIG = 0x10,
REF_TRIG = 0x08,
VID_DMA_DIS = 0x04,
REF_FAST = 0x02,
REF_DIS = 0x01
};
/* MTEST2 bit definitions */
enum {
V_STROBE = 0x10,
V_ZERO = 0x08,
H_120 = 0x04,
H_ZERO = 0x02,
V_BLANKEF = 0x01
};
/* MAPCTL bit definitions */
enum {
TURBO_DISABLE = 0x80,
VECTOR_SPACE = 0x08,
ROM_SPACE = 0x04,
MIKEY_SPACE = 0x02,
SUZY_SPACE = 0x01
};
#endif

View File

@@ -131,7 +131,7 @@ struct __pokey_write {
#define SKCTL_KEYBOARD_SCANNING 0x02 /* Enable keyboard scanning circuit */
/* Fast pot scan
** The pot scan counter completes its sequence in two TV line times instead of
** The pot scan counter completes its sequence in two TV line times instead of
** one frame time (228 scan lines). Not as accurate as the normal pot scan
*/
#define SKCTL_FAST_POT_SCAN 0x04
@@ -204,7 +204,7 @@ struct __pokey_read {
#define SKSTAT_DATA_READ_INGORING_SHIFTREG 0x10 /* Data can be read directly from the serial input port, ignoring the shift register. */
#define SKSTAT_KEYBOARD_OVERRUN 0x20 /* Keyboard over-run; Reset BITs 7, 6 and 5 (latches) to 1, using SKREST */
#define SKSTAT_INPUT_OVERRUN 0x40 /* Serial data input over-run. Reset latches as above. */
#define SKSTAT_INPUT_FRAMEERROR 0x80 /* Serial data input frame error caused by missing or extra bits. Reset latches as above. */
#define SKSTAT_INPUT_FRAMEERROR 0x80 /* Serial data input frame error caused by missing or extra bits. Reset latches as above. */
/* KBCODE, internal keyboard codes for Atari 8-bit computers,

View File

@@ -24,75 +24,65 @@
/* */
/*****************************************************************************/
#ifndef __SUZY_H
#define __SUZY_H
/* Joypad $FCB0 */
#define JOYPAD_RIGHT 0x10
#define JOYPAD_LEFT 0x20
#define JOYPAD_DOWN 0x40
#define JOYPAD_UP 0x80
#define BUTTON_OPTION1 0x08
#define BUTTON_OPTION2 0x04
#define BUTTON_INNER 0x02
#define BUTTON_OUTER 0x01
/* JOYSTICK bit definitions */
enum {
JOYPAD_RIGHT = 0x10,
JOYPAD_LEFT = 0x20,
JOYPAD_DOWN = 0x40,
JOYPAD_UP = 0x80,
BUTTON_OPTION1 = 0x08,
BUTTON_OPTION2 = 0x04,
BUTTON_INNER = 0x02,
BUTTON_OUTER = 0x01
};
/* Switches $FCB1 */
#define BUTTON_PAUSE 0x01
/* SWITCHES bit definitions */
enum {
CART1_IO_INACTIVE = 0x04,
CART0_IO_INACTIVE = 0x02,
BUTTON_PAUSE = 0x01
};
/* SPRCTL0 bit definitions */
enum {
BPP_4 = 0xC0,
BPP_3 = 0x80,
BPP_2 = 0x40,
BPP_1 = 0x00,
HFLIP = 0x20,
VFLIP = 0x10,
TYPE_SHADOW = 0x07,
TYPE_XOR = 0x06,
TYPE_NONCOLL = 0x05,
TYPE_NORMAL = 0x04,
TYPE_BOUNDARY = 0x03,
TYPE_BSHADOW = 0x02,
TYPE_BACKNONCOLL = 0x01,
TYPE_BACKGROUND = 0x00
};
/* Hardware Math */
#define FACTOR_A *(unsigned int *) 0xFC54
#define FACTOR_B *(unsigned int *) 0xFC52
#define PRODUCT0 *(unsigned int *) 0xFC60
#define PRODUCT1 *(unsigned int *) 0xFC62
#define PRODUCT *(long *) 0xFC60
/* SPRCTL1 bit definitions */
enum {
LITERAL = 0x80,
PACKED = 0x00,
ALGO3 = 0x40,
RENONE = 0x00,
REHV = 0x10,
REHVS = 0x20,
REHVST = 0x30,
REUSEPAL = 0x08,
SKIP = 0x04,
DRAWUP = 0x02,
DRAWLEFT = 0x01
};
#define DIVIDEND0 *(unsigned int *) 0xFC60
#define DIVIDEND1 *(unsigned int *) 0xFC62
#define DIVIDEND *(long *) 0xFC60
#define DIVISOR *(unsigned int *) 0xFC56
#define QUOTIENT0 *(unsigned int *) 0xFC52
#define QUOTIENT1 *(unsigned int *) 0xFC54
#define QUOTIENT *(long *) 0xFC52
#define REMAINDER0 *(unsigned int *) 0xFC6C
#define REMAINDER1 *(unsigned int *) 0xFC6E
#define REMAINDER *(long *) 0xFC6C
/* Sprite control block (SCB) definitions */
/* Sprite control block (SCB) defines */
/* SPRCTL0 $FC80 */
#define BPP_4 0xC0
#define BPP_3 0x80
#define BPP_2 0x40
#define BPP_1 0x00
#define HFLIP 0x20
#define VFLIP 0x10
#define TYPE_SHADOW 0x07
#define TYPE_XOR 0x06
#define TYPE_NONCOLL 0x05
#define TYPE_NORMAL 0x04
#define TYPE_BOUNDARY 0x03
#define TYPE_BSHADOW 0x02
#define TYPE_BACKNONCOLL 0x01
#define TYPE_BACKGROUND 0x00
/* SPRCTL1 $FC81 */
#define LITERAL 0x80
#define PACKED 0x00
#define ALGO3 0x40
#define RENONE 0x00
#define REHV 0x10
#define REHVS 0x20
#define REHVST 0x30
#define REUSEPAL 0x08
#define SKIP 0x04
#define DRAWUP 0x02
#define DRAWLEFT 0x01
typedef struct SCB_REHVST_PAL { // SCB with all attributes
/* SCB with all attributes */
typedef struct SCB_REHVST_PAL {
unsigned char sprctl0;
unsigned char sprctl1;
unsigned char sprcoll;
@@ -107,7 +97,8 @@ typedef struct SCB_REHVST_PAL { // SCB with all attributes
unsigned char penpal[8];
} SCB_REHVST_PAL;
typedef struct SCB_REHVST { // SCB without pallette
/* SCB without pallette */
typedef struct SCB_REHVST {
unsigned char sprctl0;
unsigned char sprctl1;
unsigned char sprcoll;
@@ -121,7 +112,8 @@ typedef struct SCB_REHVST { // SCB without pallette
unsigned int tilt;
} SCB_REHVST;
typedef struct SCB_REHV { // SCB without stretch/tilt
/* SCB without stretch/tilt */
typedef struct SCB_REHV {
unsigned char sprctl0;
unsigned char sprctl1;
unsigned char sprcoll;
@@ -133,7 +125,8 @@ typedef struct SCB_REHV { // SCB without stretch/tilt
unsigned int vsize;
} SCB_REHV;
typedef struct SCB_REHV_PAL { // SCB without str/tilt, w/ penpal
/* SCB without stretch/tilt, with penpal */
typedef struct SCB_REHV_PAL {
unsigned char sprctl0;
unsigned char sprctl1;
unsigned char sprcoll;
@@ -146,7 +139,8 @@ typedef struct SCB_REHV_PAL { // SCB without str/tilt, w/ penpal
unsigned char penpal[8];
} SCB_REHV_PAL;
typedef struct SCB_REHVS { // SCB w/o tilt & penpal
/* SCB without tilt/penpal */
typedef struct SCB_REHVS {
unsigned char sprctl0;
unsigned char sprctl1;
unsigned char sprcoll;
@@ -159,7 +153,8 @@ typedef struct SCB_REHVS { // SCB w/o tilt & penpal
unsigned int stretch;
} SCB_REHVS;
typedef struct SCB_REHVS_PAL { // SCB w/o tilt w/penpal
/* SCB without tilt, with penpal */
typedef struct SCB_REHVS_PAL {
unsigned char sprctl0;
unsigned char sprctl1;
unsigned char sprcoll;
@@ -173,7 +168,8 @@ typedef struct SCB_REHVS_PAL { // SCB w/o tilt w/penpal
unsigned char penpal[8];
} SCB_REHVS_PAL;
typedef struct SCB_RENONE { // SCB w/o size/stretch/tilt/pal
/* SCB without size/stretch/tilt/penpal */
typedef struct SCB_RENONE {
unsigned char sprctl0;
unsigned char sprctl1;
unsigned char sprcoll;
@@ -183,7 +179,8 @@ typedef struct SCB_RENONE { // SCB w/o size/stretch/tilt/pal
signed int vpos;
} SCB_RENONE;
typedef struct SCB_RENONE_PAL { // SCB w/o size/str/tilt w/penpal
/* SCB without size/str/tilt, with penpal */
typedef struct SCB_RENONE_PAL {
unsigned char sprctl0;
unsigned char sprctl1;
unsigned char sprcoll;
@@ -210,30 +207,124 @@ typedef struct PENPAL_1 {
unsigned char penpal[1];
} PENPAL_1;
/* Misc system defines */
/* SPRGO bit definitions */
enum {
SPRITE_GO = 0x01, /* sprite process start bit */
EVER_ON = 0x04 /* everon detector enable */
};
/* SPRGO $FC91 */
#define EVER_ON 0x04
#define SPRITE_GO 0x01
/* SPRSYS bit definitions for write operations */
enum {
SIGNMATH = 0x80, /* signed math */
ACCUMULATE = 0x40, /* accumulate multiplication results */
NO_COLLIDE = 0x20, /* do not collide with any sprites (also SPRCOLL bit definition) */
VSTRETCH = 0x10, /* stretch v */
LEFTHAND = 0x08,
CLR_UNSAFE = 0x04, /* unsafe access reset */
SPRITESTOP = 0x02 /* request to stop sprite process */
};
/* SPRSYS (write) $FC92 */
#define SIGNMATH 0x80
#define ACCUMULATE 0x40
#define NO_COLLIDE 0x20
#define VSTRETCH 0x10
#define LEFTHAND 0x08
#define CLR_UNSAFE 0x04
#define SPRITESTOP 0x02
/* SPRSYS bit definitions for read operations */
enum {
MATHWORKING = 0x80, /* math operation in progress */
MATHWARNING = 0x40, /* accumulator overflow on multiple or divide by zero */
MATHCARRY = 0x20, /* last carry bit */
VSTRETCHING = 0x10,
LEFTHANDED = 0x08,
UNSAFE_ACCESS = 0x04, /* unsafe access performed */
SPRITETOSTOP = 0x02, /* requested to stop */
SPRITEWORKING = 0x01 /* sprite process is active */
};
/* SPRSYS (read) $FC92 */
#define MATHWORKING 0x80
#define MATHWARNING 0x40
#define MATHCARRY 0x20
#define VSTRETCHING 0x10
#define LEFTHANDED 0x08
#define UNSAFE_ACCESS 0x04
#define SPRITETOSTOP 0x02
#define SPRITEWORKING 0x01
/* Suzy hardware registers */
struct __suzy {
unsigned char *tmpadr; /* 0xFC00 Temporary address */
unsigned int tiltacc; /* 0xFC02 Tilt accumulator */
unsigned int hoff; /* 0xFC04 Offset to H edge of screen */
unsigned int voff; /* 0xFC06 Offset to V edge of screen */
unsigned char *sprbase; /* 0xFC08 Base address of sprite */
unsigned char *colbase; /* 0xFC0A Base address of collision buffer */
unsigned char *vidadr; /* 0xFC0C Current vid buffer address */
unsigned char *coladr; /* 0xFC0E Current col buffer address */
unsigned char *scbnext; /* 0xFC10 Address of next SCB */
unsigned char *sprdline; /* 0xFC12 start of sprite data line address */
unsigned int hposstrt; /* 0xFC14 start hpos */
unsigned int vposstrt; /* 0xFC16 start vpos */
unsigned int sprhsize; /* 0xFC18 sprite h size */
unsigned int sprvsize; /* 0xFC1A sprite v size */
unsigned int stretchl; /* 0xFC1C H size adder */
unsigned int tilt; /* 0xFC1E H pos adder */
unsigned int sprdoff; /* 0xFC20 offset to next sprite data line */
unsigned int sprvpos; /* 0xFC22 current vpos */
unsigned int colloff; /* 0xFC24 offset to collision depository */
unsigned int vsizeacc; /* 0xFC26 vertical size accumulator */
unsigned int hsizeoff; /* 0xFC28 horizontal size offset */
unsigned int vsizeoff; /* 0xFC2A vertical size offset */
unsigned char *scbaddr; /* 0xFC2C address of current SCB */
unsigned char *procaddr; /* 0xFC2E address of current spr data proc */
unsigned char unused0[32]; /* 0xFC30 - 0xFC4F reserved/unused */
unsigned char unused1[2]; /* 0xFC50 - 0xFC51 do not use */
unsigned char mathd; /* 0xFC52 */
unsigned char mathc; /* 0xFC53 */
unsigned char mathb; /* 0xFC54 */
unsigned char matha; /* 0xFC55 write starts a multiply operation */
unsigned char mathp; /* 0xFC56 */
unsigned char mathn; /* 0xFC57 */
unsigned char unused2[8]; /* 0xFC58 - 0xFC5F do not use */
unsigned char mathh; /* 0xFC60 */
unsigned char mathg; /* 0xFC61 */
unsigned char mathf; /* 0xFC62 */
unsigned char mathe; /* 0xFC63 write starts a divide operation */
unsigned char unused3[8]; /* 0xFC64 - 0xFC6B do not use */
unsigned char mathm; /* 0xFC6C */
unsigned char mathl; /* 0xFC6D */
unsigned char mathk; /* 0xFC6E */
unsigned char mathj; /* 0xFC6F */
unsigned char unused4[16]; /* 0xFC70 - 0xFC7F do not use */
unsigned char sprctl0; /* 0xFC80 sprite control bits 0 */
unsigned char sprctl1; /* 0xFC81 sprite control bits 1 */
unsigned char sprcoll; /* 0xFC82 sprite collision number */
unsigned char sprinit; /* 0xFC83 sprite initialization bits */
unsigned char unused5[4]; /* 0xFC84 - 0xFC87 unused */
unsigned char suzyhrev; /* 0xFC88 suzy hardware rev */
unsigned char suzysrev; /* 0xFC89 suzy software rev */
unsigned char unused6[6]; /* 0xFC8A - 0xFC8F unused */
unsigned char suzybusen; /* 0xFC90 suzy bus enable */
unsigned char sprgo; /* 0xFC91 sprite process start bit */
unsigned char sprsys; /* 0xFC92 sprite system control bits */
unsigned char unused7[29]; /* 0xFC93 - 0xFCAF unused */
unsigned char joystick; /* 0xFCB0 joystick and buttons */
unsigned char switches; /* 0xFCB1 other switches */
unsigned char cart0; /* 0xFCB2 cart0 r/w */
unsigned char cart1; /* 0xFCB3 cart1 r/w */
unsigned char unused8[8]; /* 0xFCB4 - 0xFCBF unused */
unsigned char leds; /* 0xFCC0 leds */
unsigned char unused9; /* 0xFCC1 unused */
unsigned char parstat; /* 0xFCC2 parallel port status */
unsigned char pardata; /* 0xFCC3 parallel port data */
unsigned char howie; /* 0xFCC4 howie (?) */
/* 0xFCC5 - 0xFCFF unused */
};
/* Hardware math registers */
#define FACTOR_A *(unsigned int *) 0xFC54
#define FACTOR_B *(unsigned int *) 0xFC52
#define PRODUCT0 *(unsigned int *) 0xFC60
#define PRODUCT1 *(unsigned int *) 0xFC62
#define PRODUCT *(long *) 0xFC60
#define DIVIDEND0 *(unsigned int *) 0xFC60
#define DIVIDEND1 *(unsigned int *) 0xFC62
#define DIVIDEND *(long *) 0xFC60
#define DIVISOR *(unsigned int *) 0xFC56
#define QUOTIENT0 *(unsigned int *) 0xFC52
#define QUOTIENT1 *(unsigned int *) 0xFC54
#define QUOTIENT *(long *) 0xFC52
#define REMAINDER0 *(unsigned int *) 0xFC6C
#define REMAINDER1 *(unsigned int *) 0xFC6E
#define REMAINDER *(long *) 0xFC6C
/* Deprecated definitions */
/* MAPCTL $FFF9 */
#define HIGHSPEED 0x80
@@ -242,77 +333,4 @@ typedef struct PENPAL_1 {
#define MIKEYSPACE 0x02
#define SUZYSPACE 0x01
/* Suzy Hardware Registers */
struct __suzy {
unsigned int tmpadr; // 0xFC00 Temporary address
unsigned int tiltacc; // 0xFC02 Tilt accumulator
unsigned int hoff; // 0xFC04 Offset to H edge of screen
unsigned int voff; // 0xFC06 Offset to V edge of screen
unsigned char *sprbase; // 0xFC08 Base address of sprite
unsigned char *colbase; // 0xFC0A Base address of collision buffer
unsigned char *vidadr; // 0xFC0C Current vid buffer address
unsigned char *coladr; // 0xFC0E Current col buffer address
unsigned char *scbnext; // 0xFC10 Address of next SCB
unsigned char *sprdline; // 0xFC12 start of sprite data line address
unsigned char *hposstrt; // 0xFC14 start hpos
unsigned char *vposstrt; // 0xFC16 start vpos
unsigned char *sprhsize; // 0xFC18 sprite h size
unsigned char *sprvsize; // 0xFC1A sprite v size
unsigned int stretchl; // 0xFC1C H size adder
unsigned int tilt; // 0xFC1E H pos adder
unsigned int sprdoff; // 0xFC20 offset to next sprite data line
unsigned int sprvpos; // 0xFC22 current vpos
unsigned int colloff; // 0xFC24 offset to collision depository
unsigned int vsizeacc; // 0xFC26 vertical size accumulator
unsigned int hsizeoff; // 0xFC28 horizontal size offset
unsigned int vsizeoff; // 0xFC2A vertical size offset
unsigned char *scbaddr; // 0xFC2C address of current SCB
unsigned char *procaddr; // 0xFC2E address of current spr data proc
unsigned char unused0[32]; // 0xFC30 - 0xFC4F reserved/unused
unsigned char unused1[2]; // 0xFC50 - 0xFC51 do not use
unsigned char mathd; // 0xFC52
unsigned char mathc; // 0xFC53
unsigned char mathb; // 0xFC54
unsigned char matha; // 0xFC55
unsigned char mathp; // 0xFC56
unsigned char mathn; // 0xFC57
unsigned char unused2[8]; // 0xFC58 - 0xFC5F do not use
unsigned char mathh; // 0xFC60
unsigned char mathg; // 0xFC61
unsigned char mathf; // 0xFC62
unsigned char mathe; // 0xFC63
unsigned char unused3[8]; // 0xFC64 - 0xFC6B do not use
unsigned char mathm; // 0xFC6C
unsigned char mathl; // 0xFC6D
unsigned char mathk; // 0xFC6E
unsigned char mathj; // 0xFC6F
unsigned char unused4[16]; // 0xFC70 - 0xFC7F do not use
unsigned char sprctl0; // 0xFC80 sprite control bits 0
unsigned char sprctl1; // 0xFC81 sprite control bits 1
unsigned char sprcoll; // 0xFC82 sprite collision number
unsigned char sprinit; // 0xFC83 sprite initialization bits
unsigned char unused5[4]; // 0xFC84 - 0xFC87 unused
unsigned char suzyhrev; // 0xFC88 suzy hardware rev
unsigned char suzysrev; // 0xFC89 suzy software rev
unsigned char unused6[6]; // 0xFC8A - 0xFC8F unused
unsigned char suzybusen; // 0xFC90 suzy bus enable
unsigned char sprgo; // 0xFC91 sprite process start bit
unsigned char sprsys; // 0xFC92 sprite system control bits
unsigned char unused7[29]; // 0xFC93 - 0xFCAF unused
unsigned char joystick; // 0xFCB0 joystick and buttons
unsigned char switches; // 0xFCB1 other switches
unsigned char cart0; // 0xFCB2 cart0 r/w
unsigned char cart1; // 0xFCB3 cart1 r/w
unsigned char unused8[8]; // 0xFCB4 - 0xFCBF unused
unsigned char leds; // 0xFCC0 leds
unsigned char unused9; // 0xFCC1 unused
unsigned char parstat; // 0xFCC2 parallel port status
unsigned char pardata; // 0xFCC3 parallel port data
unsigned char howie; // 0xFCC4 howie (?)
// 0xFCC5 - 0xFCFF unused
};
#endif

View File

@@ -7,7 +7,7 @@
/* */
/* */
/* (C) 2003 Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */

View File

@@ -180,7 +180,7 @@ unsigned char detect_c128 (void);
unsigned char __fastcall__ set_chameleon_speed (unsigned char speed);
/* Set the speed of the C64 Chameleon cartridge, the following inputs
* are accepted:
* are accepted:
* SPEED_SLOW : 1 Mhz mode
* SPEED_1X : 1 Mhz mode
* SPEED_2X : 2 Mhz mode
@@ -304,6 +304,36 @@ unsigned char detect_turbomaster (void);
* 0x01 : C64 Turbo Master cartridge present
*/
unsigned char __fastcall__ set_iigs_speed (unsigned char speed);
/* Set the speed of the Apple IIgs CPU.
*
* Possible values:
* SPEED_SLOW : 1 Mhz mode
* SPEED_FAST : Fast mode (2.8MHz or more, depending on the presence of
* an accelerator)
*
* Any other value will be interpreted as SPEED_FAST.
*/
unsigned char get_iigs_speed (void);
/* Get the speed of the Apple IIgs CPU.
*
* Possible return values:
* SPEED_SLOW : 1 Mhz mode
* SPEED_FAST : Fast mode (2.8MHz or more, depending on the presence of
* an accelerator)
*/
unsigned char detect_iigs (void);
/* Check whether we are running on an Apple IIgs.
*
* Possible return values:
* 0x00 : No
* 0x01 : Yes
*/
/* End of accelerator.h */
#endif

View File

@@ -41,6 +41,7 @@
# error This module may only be used when compiling for the Apple ][!
#endif
#include <time.h>
#include <apple2_filetype.h>
@@ -58,7 +59,7 @@
/* TGI color defines */
#define TGI_COLOR_BLACK 0x00
#define TGI_COLOR_GREEN 0x01
#define TGI_COLOR_VIOLET 0x02
#define TGI_COLOR_PURPLE 0x02
#define TGI_COLOR_WHITE 0x03
#define TGI_COLOR_BLACK2 0x04
#define TGI_COLOR_ORANGE 0x05
@@ -82,7 +83,77 @@
#define CH_CURS_LEFT 0x08
#define CH_CURS_RIGHT 0x15
#if !defined(__APPLE2ENH__)
/* These characters are not available on the ][+, but
* are on the //e. */
#if defined(__APPLE2ENH__) || defined(APPLE2_INCLUDE_IIE_CHARS)
#define CH_DEL 0x7F
#define CH_CURS_UP 0x0B
#define CH_CURS_DOWN 0x0A
/* These are defined to be OpenApple + NumberKey */
#define CH_F1 0xB1
#define CH_F2 0xB2
#define CH_F3 0xB3
#define CH_F4 0xB4
#define CH_F5 0xB5
#define CH_F6 0xB6
#define CH_F7 0xB7
#define CH_F8 0xB8
#define CH_F9 0xB9
#define CH_F10 0xB0
#endif
#if defined(__APPLE2ENH__)
/* MouseText-based functions for boxes and lines drawing */
void mt_chline (unsigned char length);
void mt_cvline (unsigned char length);
void mt_chlinexy (unsigned char x, unsigned char y, unsigned char length);
void mt_cvlinexy (unsigned char x, unsigned char y, unsigned char length);
#define CH_HLINE 0x5F
#define CH_VLINE 0xDF
#define CH_ULCORNER 0x5F
#define CH_URCORNER 0x20
#define CH_LLCORNER 0xD4
#define CH_LRCORNER 0xDF
#define CH_TTEE 0x5F
#define CH_BTEE 0xD4
#define CH_LTEE 0xD4
#define CH_RTEE 0xDF
#define CH_CROSS 0xD4
#define _chline(length) mt_chline(length)
#define _chlinexy(x,y,length) mt_chlinexy(x,y,length)
#define _cvline(length) mt_cvline(length)
#define _cvlinexy(x,y,length) mt_cvlinexy(x,y,length)
#else
/* Functions that don't depend on MouseText to draw boxes and lines */
void dyn_chline (unsigned char h, unsigned char length);
void dyn_cvline (unsigned char v, unsigned char length);
void dyn_chlinexy (unsigned char h, unsigned char x, unsigned char y, unsigned char length);
void dyn_cvlinexy (unsigned char v, unsigned char x, unsigned char y, unsigned char length);
#if defined(DYN_BOX_DRAW)
/* When the user defines DYN_BOX_DRAW, we'll adapt to the machine
** we run on.
*/
extern char CH_HLINE;
extern char CH_VLINE;
extern char CH_ULCORNER;
extern char CH_URCORNER;
extern char CH_LLCORNER;
extern char CH_LRCORNER;
extern char CH_TTEE;
extern char CH_BTEE;
extern char CH_LTEE;
extern char CH_RTEE;
extern char CH_CROSS;
#else
/* Otherwise, fallback to safety and don't use MouseText at all. */
#define CH_HLINE '-'
#define CH_VLINE '!'
#define CH_ULCORNER '+'
@@ -94,7 +165,14 @@
#define CH_LTEE '+'
#define CH_RTEE '+'
#define CH_CROSS '+'
#endif
#endif /* DYN_BOX_DRAW */
#define _chline(length) dyn_chline(CH_HLINE, length)
#define _chlinexy(x, y, length) dyn_chlinexy(CH_HLINE, x ,y, length)
#define _cvline(length) dyn_cvline(CH_VLINE, length)
#define _cvlinexy(x, y, length) dyn_cvlinexy(CH_VLINE, x, y, length)
#endif /* __APPLE2ENH__ */
/* Masks for joy_read */
#define JOY_UP_MASK 0x10
@@ -111,16 +189,27 @@
#define APPLE_IIIEM 0x20 /* Apple /// (emulation) */
#define APPLE_IIE 0x30 /* Apple //e */
#define APPLE_IIEENH 0x31 /* Apple //e (enhanced) */
#define APPLE_IIECARD 0x40 /* Apple //e Option Card */
#define APPLE_IIC 0x50 /* Apple //c */
#define APPLE_IIC35 0x51 /* Apple //c (3.5 ROM) */
#define APPLE_IICEXP 0x53 /* Apple //c (Mem. Exp.) */
#define APPLE_IICREV 0x54 /* Apple //c (Rev. Mem. Exp.) */
#define APPLE_IICPLUS 0x55 /* Apple //c Plus */
#define APPLE_IIECARD 0x32 /* Apple //e Option Card */
#define APPLE_IIC 0x40 /* Apple //c */
#define APPLE_IIC35 0x41 /* Apple //c (3.5 ROM) */
#define APPLE_IICEXP 0x43 /* Apple //c (Mem. Exp.) */
#define APPLE_IICREV 0x44 /* Apple //c (Rev. Mem. Exp.) */
#define APPLE_IICPLUS 0x45 /* Apple //c Plus */
#define APPLE_IIGS 0x80 /* Apple IIgs */
#define APPLE_IIGS1 0x81 /* Apple IIgs (ROM 1) */
#define APPLE_IIGS3 0x83 /* Apple IIgs (ROM 3) */
/* Return codes for get_tv() */
#define TV_NTSC 0
#define TV_PAL 1
#define TV_OTHER 2
/* Video modes */
#define VIDEOMODE_40x24 0x15
#define VIDEOMODE_80x24 0x00
#define VIDEOMODE_40COL VIDEOMODE_40x24
#define VIDEOMODE_80COL VIDEOMODE_80x24
extern unsigned char _dos_type;
/* Valid _dos_type values:
**
@@ -142,6 +231,27 @@ extern unsigned char _dos_type;
** ProDOS 8 2.4.x - 0x24
*/
/* struct stat.st_mode values */
#define S_IFDIR 0x01
#define S_IFREG 0x02
#define S_IFBLK 0xFF
#define S_IFCHR 0xFF
#define S_IFIFO 0xFF
#define S_IFLNK 0xFF
#define S_IFSOCK 0xFF
struct datetime {
struct {
unsigned day :5;
unsigned mon :4;
unsigned year :7;
} date;
struct {
unsigned char min;
unsigned char hour;
} time;
};
/*****************************************************************************/
@@ -151,27 +261,18 @@ extern unsigned char _dos_type;
/* The file stream implementation and the POSIX I/O functions will use the
** following struct to set the date and time stamp on files. This specificially
** following struct to set the date and time stamp on files. This specifically
** applies to the open and fopen functions.
*/
extern struct {
struct {
unsigned day :5;
unsigned mon :4;
unsigned year :7;
} createdate; /* Current date: 0 */
struct {
unsigned char min;
unsigned char hour;
} createtime; /* Current time: 0 */
} _datetime;
extern struct datetime _datetime;
/* The addresses of the static drivers */
#if !defined(__APPLE2ENH__)
extern void a2_auxmem_emd[];
extern void a2_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
extern void a2_stdmou_mou[]; /* Referred to by mouse_static_stddrv[] */
extern void a2_ssc_ser[];
extern void a2_ssc_ser[]; /* Referred to by ser_static_stddrv[] */
extern void a2_gs_ser[]; /* IIgs serial driver */
extern void a2_hi_tgi[]; /* Referred to by tgi_static_stddrv[] */
extern void a2_lo_tgi[];
#endif
@@ -184,6 +285,12 @@ extern void a2_lo_tgi[];
void beep (void);
/* Beep beep. */
unsigned char get_tv (void);
/* Get the machine vblank frequency. Returns one of the TV_xxx codes. */
unsigned char get_ostype (void);
/* Get the machine type. Returns one of the APPLE_xxx codes. */
@@ -207,6 +314,37 @@ void rebootafterexit (void);
#define _textcolor(color) COLOR_WHITE
#define _bgcolor(color) COLOR_BLACK
#define _bordercolor(color) COLOR_BLACK
#define _cpeekcolor() COLOR_WHITE
#define _cpeekrevers() 0
struct tm* __fastcall__ gmtime_dt (const struct datetime* dt);
/* Converts a ProDOS date/time structure to a struct tm */
time_t __fastcall__ mktime_dt (const struct datetime* dt);
/* Converts a ProDOS date/time structure to a time_t UNIX timestamp */
typedef struct DIR DIR;
unsigned int __fastcall__ dir_entry_count(DIR *dir);
/* Returns the number of active files in a ProDOS directory */
#if !defined(__APPLE2ENH__)
unsigned char __fastcall__ allow_lowercase (unsigned char onoff);
/* If onoff is 0, lowercase characters printed to the screen via STDIO and
** CONIO are forced to uppercase. If onoff is 1, lowercase characters are
** printed to the screen untouched. By default lowercase characters are
** forced to uppercase because a stock Apple ][+ doesn't support lowercase
** display. The function returns the old lowercase setting.
*/
#endif
signed char __fastcall__ videomode (unsigned mode);
/* Set the video mode, return the old mode, or -1 if 80-column hardware is not
** installed. Call with one of the VIDEOMODE_xx constants.
*/
void waitvsync (void);
/* Wait for start of next frame */

View File

@@ -46,49 +46,6 @@
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/* Characters codes */
#define CH_DEL 0x7F
#define CH_CURS_UP 0x0B
#define CH_CURS_DOWN 0x0A
#define CH_HLINE 0x5F
#define CH_VLINE 0xDF
#define CH_ULCORNER 0x5F
#define CH_URCORNER 0x20
#define CH_LLCORNER 0xD4
#define CH_LRCORNER 0xDF
#define CH_TTEE 0x5F
#define CH_BTEE 0xD4
#define CH_LTEE 0xD4
#define CH_RTEE 0xDF
#define CH_CROSS 0xD4
/* These are defined to be OpenApple + NumberKey */
#define CH_F1 0xB1
#define CH_F2 0xB2
#define CH_F3 0xB3
#define CH_F4 0xB4
#define CH_F5 0xB5
#define CH_F6 0xB6
#define CH_F7 0xB7
#define CH_F8 0xB8
#define CH_F9 0xB9
#define CH_F10 0xB0
/* Video modes */
#define VIDEOMODE_40x24 0x0011
#define VIDEOMODE_80x24 0x0012
#define VIDEOMODE_40COL VIDEOMODE_40x24
#define VIDEOMODE_80COL VIDEOMODE_80x24
/*****************************************************************************/
/* Variables */
/*****************************************************************************/
@@ -99,24 +56,12 @@
extern void a2e_auxmem_emd[];
extern void a2e_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
extern void a2e_stdmou_mou[]; /* Referred to by mouse_static_stddrv[] */
extern void a2e_ssc_ser[];
extern void a2e_ssc_ser[]; /* Referred to by ser_static_stddrv[] */
extern void a2e_gs_ser[]; /* IIgs serial driver */
extern void a2e_hi_tgi[]; /* Referred to by tgi_static_stddrv[] */
extern void a2e_lo_tgi[];
/*****************************************************************************/
/* Code */
/*****************************************************************************/
unsigned __fastcall__ videomode (unsigned mode);
/* Set the video mode, return the old mode. Call with one of the VIDEOMODE_xx
** constants.
*/
/* End of apple2enh.h */
#endif

67
include/arpa/inet.h Normal file
View File

@@ -0,0 +1,67 @@
/*****************************************************************************/
/* */
/* arpa/inet.h */
/* */
/* Endianness utilities for cc65 */
/* */
/* */
/* */
/* (C) 2023 Colin Leroy-Mira, <colin@colino.net> */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
#ifndef _ARPA_INET_H
#define _ARPA_INET_H
/*****************************************************************************/
/* Code */
/*****************************************************************************/
#if (__OPT_i__ < 200)
int __fastcall__ ntohs (int val);
int __fastcall__ htons (int val);
#else
#define ntohs(x) \
( \
__AX__=(x), \
asm("sta tmp1"), \
asm("txa"), \
asm("ldx tmp1"), \
__AX__ \
)
#define htons(x) ntohs(x)
#endif
long __fastcall__ ntohl (long val);
long __fastcall__ htonl (long val);
/* End of arpa/inet.h */
#endif

View File

@@ -42,14 +42,18 @@
#ifdef NDEBUG
# define assert(expr)
#else
extern void __fastcall__ _afailed (const char*, unsigned);
# define assert(expr) ((expr)? (void)0 : _afailed(__FILE__, __LINE__))
extern void __fastcall__ __afailed (const char*, unsigned);
# define assert(expr) ((expr)? (void)0 : __afailed(__FILE__, __LINE__))
#endif
/* TODO: Guard with #if __CC65_STD__ >= __CC65_STD_C11__ if there
** is a C11 mode.
*/
#if __CC65_STD__ > __CC65_STD_C99__
# define static_assert _Static_assert
#endif
/* End of assert.h */
#endif

View File

@@ -6,10 +6,11 @@
/* */
/* */
/* */
/* (C) 2000-2019 Mark Keates <markk@dendrite.co.uk> */
/* (C) 2000-2021 Mark Keates <markk@dendrite.co.uk> */
/* Freddy Offenga <taf_offenga@yahoo.com> */
/* Christian Groessler <chris@groessler.org> */
/* Bill Kendrick <nbs@sonic.net> */
/* et al. */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
@@ -209,7 +210,7 @@
#define KEY_CLEAR (KEY_LESSTHAN | KEY_SHIFT)
#define KEY_INSERT (KEY_GREATERTHAN | KEY_SHIFT)
#define KEY_UP (KEY_UNDERLINE | KEY_CTRL)
#define KEY_UP (KEY_DASH | KEY_CTRL)
#define KEY_DOWN (KEY_EQUALS | KEY_CTRL)
#define KEY_LEFT (KEY_PLUS | KEY_CTRL)
#define KEY_RIGHT (KEY_ASTERISK | KEY_CTRL)
@@ -219,30 +220,37 @@
/* Color register functions */
/*****************************************************************************/
extern void __fastcall__ _setcolor (unsigned char color_reg, unsigned char hue, unsigned char luminace);
extern void __fastcall__ _setcolor_low (unsigned char color_reg, unsigned char color_value);
extern unsigned char __fastcall__ _getcolor (unsigned char color_reg);
void __fastcall__ _setcolor (unsigned char color_reg, unsigned char hue, unsigned char luminance);
void __fastcall__ _setcolor_low (unsigned char color_reg, unsigned char color_value);
unsigned char __fastcall__ _getcolor (unsigned char color_reg);
/*****************************************************************************/
/* Other screen functions */
/*****************************************************************************/
extern int __fastcall__ _graphics (unsigned char mode); /* mode value same as in BASIC */
extern void __fastcall__ _scroll (signed char numlines);
void waitvsync (void); /* wait for start of next frame */
int __fastcall__ _graphics (unsigned char mode); /* mode value same as in BASIC */
void __fastcall__ _scroll (signed char numlines);
/* numlines > 0 scrolls up */
/* numlines < 0 scrolls down */
/*****************************************************************************/
/* Sound function */
/*****************************************************************************/
void __fastcall__ _sound (unsigned char voice, unsigned char frequency, unsigned char distortion, unsigned char volume);
/*****************************************************************************/
/* Misc. functions */
/*****************************************************************************/
extern unsigned char get_ostype(void); /* get ROM version */
extern unsigned char get_tv(void); /* get TV system */
extern void _save_vecs(void); /* save system vectors */
extern void _rest_vecs(void); /* restore system vectors */
extern char *_getdefdev(void); /* get default floppy device */
extern unsigned char _is_cmdline_dos(void); /* does DOS support command lines */
unsigned char get_ostype(void); /* get ROM version */
unsigned char get_tv(void); /* get TV system */
void _save_vecs(void); /* save system vectors */
void _rest_vecs(void); /* restore system vectors */
char *_getdefdev(void); /* get default floppy device */
unsigned char _is_cmdline_dos(void); /* does DOS support command lines */
/*****************************************************************************/
@@ -259,7 +267,7 @@ extern void atrst_mou[]; /* referred to by mouse_static_stddrv[]
extern void atrami_mou[];
extern void atrtrk_mou[];
extern void atrtt_mou[];
extern void atrrdev_ser[];
extern void atrrdev_ser[]; /* referred to by ser_static_stddrv[] */
extern void atr3_tgi[];
extern void atr4_tgi[];
extern void atr5_tgi[];
@@ -284,7 +292,7 @@ extern void atrxst_mou[]; /* referred to by mouse_static_stddrv[]
extern void atrxami_mou[];
extern void atrxtrk_mou[];
extern void atrxtt_mou[];
extern void atrxrdev_ser[];
extern void atrxrdev_ser[]; /* referred to by ser_static_stddrv[] */
extern void atrx3_tgi[];
extern void atrx4_tgi[];
extern void atrx5_tgi[];
@@ -390,7 +398,7 @@ extern void atrx15p2_tgi[];
#define COLOR_WHITE GTIA_COLOR_WHITE
#define COLOR_RED GTIA_COLOR_RED
#define COLOR_CYAN GTIA_COLOR_CYAN
#define COLOR_VIOLET GTIA_COLOR_VIOLET
#define COLOR_PURPLE GTIA_COLOR_VIOLET
#define COLOR_GREEN GTIA_COLOR_GREEN
#define COLOR_BLUE GTIA_COLOR_BLUE
#define COLOR_YELLOW GTIA_COLOR_YELLOW
@@ -408,7 +416,7 @@ extern void atrx15p2_tgi[];
#define TGI_COLOR_WHITE COLOR_WHITE
#define TGI_COLOR_RED COLOR_RED
#define TGI_COLOR_CYAN COLOR_CYAN
#define TGI_COLOR_VIOLET COLOR_VIOLET
#define TGI_COLOR_PURPLE COLOR_PURPLE
#define TGI_COLOR_GREEN COLOR_GREEN
#define TGI_COLOR_BLUE COLOR_BLUE
#define TGI_COLOR_YELLOW COLOR_YELLOW

View File

@@ -35,7 +35,7 @@
/* Check for errors */
/* check for errors */
#if !defined(__ATARI5200__)
# error This module may only be used when compiling for the Atari 5200!
#endif
@@ -46,14 +46,14 @@
/* the addresses of the static drivers */
extern void atr5200std_joy[]; /* referred to by joy_static_stddrv[] */
/* Masks for joy_read */
/* masks for joy_read */
#define JOY_UP_MASK 0x01
#define JOY_DOWN_MASK 0x02
#define JOY_LEFT_MASK 0x04
#define JOY_RIGHT_MASK 0x08
#define JOY_BTN_1_MASK 0x10
/* Character codes */
/* character codes */
#define CH_ULCORNER 0x0B /* '+' sign */
#define CH_URCORNER 0x0B
#define CH_LLCORNER 0x0B
@@ -65,7 +65,11 @@ extern void atr5200std_joy[]; /* referred to by joy_static_stddrv[] */
#define AT_NTSC 0
#define AT_PAL 1
/* Define hardware */
/* Define variables used by the OS*/
#include <_atari5200os.h>
#define OS (*(struct __os*)0x0000)
/* define hardware */
#include <_gtia.h>
#define GTIA_READ (*(struct __gtia_read*)0xC000)
#define GTIA_WRITE (*(struct __gtia_write*)0xC000)
@@ -89,5 +93,8 @@ extern void atr5200std_joy[]; /* referred to by joy_static_stddrv[] */
*/
#define _bordercolor(color) 0
/* End of atari5200.h */
/* wait for start of next frame */
void waitvsync (void);
/* end of atari5200.h */
#endif

67
include/atari7800.h Normal file
View File

@@ -0,0 +1,67 @@
/*****************************************************************************/
/* */
/* Atari VCS 7800 TIA & RIOT registers addresses */
/* */
/* Karri Kaksonen (karri@sipo.fi), 2022 */
/* */
/* */
/*****************************************************************************/
#ifndef _ATARI7800_H
#define _ATARI7800_H
/* Check for errors */
#if !defined(__ATARI7800__)
# error This module may only be used when compiling for the Atari 7800!
#endif
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/* Color defines */
#define COLOR_BLACK 0x00
#define COLOR_GREY 0x01
#define COLOR_LIGHTGREY 0x02
#define COLOR_WHITE 0x03
/* TGI color defines (default palette) */
#define TGI_COLOR_BLACK COLOR_BLACK
#define TGI_COLOR_GREY COLOR_GREY
#define TGI_COLOR_LIGHTGREY COLOR_LIGHTGREY
#define TGI_COLOR_WHITE COLOR_WHITE
/* Masks for joy_read */
#define JOY_RIGHT_MASK 0x80
#define JOY_LEFT_MASK 0x40
#define JOY_DOWN_MASK 0x20
#define JOY_UP_MASK 0x10
#define JOY_BTN_1_MASK 0x01
#define JOY_BTN_2_MASK 0x02
#define JOY_BTN_A_MASK JOY_BTN_1_MASK
#define JOY_BTN_B_MASK JOY_BTN_2_MASK
#define JOY_BTN_A(v) ((v) & JOY_BTN_A_MASK)
#define JOY_BTN_B(v) ((v) & JOY_BTN_B_MASK)
/* No support for dynamically loadable drivers */
#define DYN_DRV 0
unsigned char get_tv(void); /* get TV system */
#include <_tia.h>
#define TIA (*(struct __tia*)0x0000)
#include <_riot.h>
#define RIOT (*(struct __riot*)0x0280)
#include <_maria.h>
#define MARIA (*(struct __maria*)0x0020)
/* End of atari7800.h */
#endif

View File

@@ -120,6 +120,9 @@
#define JOY_RIGHT_MASK 0x02
#define JOY_BTN_1_MASK 0x20
#define JOY_FIRE_MASK JOY_BTN_1_MASK
#define JOY_FIRE(v) ((v) & JOY_FIRE_MASK)
/* No support for dynamically loadable drivers */
@@ -130,7 +133,7 @@
/* The addresses of the static drivers */
extern void atmos_pase_joy[]; /* Referred to by joy_static_stddrv[] */
extern void atmos_ijk_joy[];
extern void atmos_acia_ser[];
extern void atmos_acia_ser[]; /* Referred to by ser_static_stddrv[] */
extern void atmos_228_200_3_tgi[];
extern void atmos_240_200_2_tgi[]; /* Referred to by tgi_static_stddrv[] */
@@ -167,6 +170,20 @@ void atmos_zap (void);
/* Raygun sound effect */
/* The following #defines will cause the matching function prototypes
** in conio.h to be overlaid by macroes with the same names,
** thereby saving the function call overhead.
*/
#define _textcolor(color) COLOR_WHITE
#define _bgcolor(color) COLOR_BLACK
#define _bordercolor(color) COLOR_BLACK
#define _cpeekcolor(color) COLOR_WHITE
void waitvsync (void);
/* Wait for start of next frame */
/* End of atmos.h */
#endif

View File

@@ -60,7 +60,7 @@
#define COLOR_WHITE 0x01
#define COLOR_RED 0x02
#define COLOR_CYAN 0x03
#define COLOR_VIOLET 0x04
#define COLOR_PURPLE 0x04
#define COLOR_GREEN 0x05
#define COLOR_BLUE 0x06
#define COLOR_YELLOW 0x07
@@ -78,7 +78,7 @@
#define TGI_COLOR_WHITE COLOR_WHITE
#define TGI_COLOR_RED COLOR_RED
#define TGI_COLOR_CYAN COLOR_CYAN
#define TGI_COLOR_VIOLET COLOR_VIOLET
#define TGI_COLOR_PURPLE COLOR_PURPLE
#define TGI_COLOR_GREEN COLOR_GREEN
#define TGI_COLOR_BLUE COLOR_BLUE
#define TGI_COLOR_YELLOW COLOR_YELLOW
@@ -140,7 +140,7 @@ extern void c128_1351_mou[]; /* Referred to by mouse_static_stddrv[] */
extern void c128_joy_mou[];
extern void c128_inkwell_mou[];
extern void c128_pot_mou[];
extern void c128_swlink_ser[];
extern void c128_swlink_ser[]; /* Referred to by ser_static_stddrv[] */
extern void c128_hi_tgi[];
extern void c128_vdc_tgi[]; /* Referred to by tgi_static_stddrv[] */
extern void c128_vdc2_tgi[];

View File

@@ -66,8 +66,7 @@
#define COLOR_WHITE 0x01
#define COLOR_RED 0x02
#define COLOR_CYAN 0x03
#define COLOR_VIOLET 0x04
#define COLOR_PURPLE COLOR_VIOLET
#define COLOR_PURPLE 0x04
#define COLOR_GREEN 0x05
#define COLOR_BLUE 0x06
#define COLOR_YELLOW 0x07
@@ -85,7 +84,6 @@
#define TGI_COLOR_WHITE COLOR_WHITE
#define TGI_COLOR_RED COLOR_RED
#define TGI_COLOR_CYAN COLOR_CYAN
#define TGI_COLOR_VIOLET COLOR_VIOLET
#define TGI_COLOR_PURPLE COLOR_PURPLE
#define TGI_COLOR_GREEN COLOR_GREEN
#define TGI_COLOR_BLUE COLOR_BLUE
@@ -142,10 +140,12 @@ extern void c64_c256k_emd[];
extern void c64_dqbb_emd[];
extern void c64_georam_emd[];
extern void c64_isepic_emd[];
extern void c64_kerberos_emd[];
extern void c64_ram_emd[];
extern void c64_ramcart_emd[];
extern void c64_reu_emd[];
extern void c64_vdc_emd[];
extern void c64_rrr_emd[];
extern void dtv_himem_emd[];
extern void c64_hitjoy_joy[];
extern void c64_numpad_joy[];
@@ -155,7 +155,7 @@ extern void c64_1351_mou[]; /* Referred to by mouse_static_stddrv[]
extern void c64_joy_mou[];
extern void c64_inkwell_mou[];
extern void c64_pot_mou[];
extern void c64_swlink_ser[];
extern void c64_swlink_ser[]; /* Referred to by ser_static_stddrv[] */
extern void c64_hi_tgi[]; /* Referred to by tgi_static_stddrv[] */

View File

@@ -166,9 +166,9 @@ unsigned char get_tv (void);
unsigned char __fastcall__ kbrepeat (unsigned char mode);
/* Changes which keys have automatic repeat. */
#if !defined(__CBM610__) && !defined(__PET__)
#if !defined(__CBM610__)
void waitvsync (void);
/* Wait for the start of the next frame */
/* Wait for the start of the next video field. */
#endif
/*****************************************************************************/
@@ -191,6 +191,8 @@ unsigned char cbm_k_acptr (void);
unsigned char cbm_k_basin (void);
void __fastcall__ cbm_k_bsout (unsigned char C);
unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);
unsigned char cbm_k_chrin (void);
void __fastcall__ cbm_k_chrout (unsigned char C);
void __fastcall__ cbm_k_ciout (unsigned char C);
unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);
void cbm_k_clall (void);
@@ -208,6 +210,7 @@ void __fastcall__ cbm_k_second (unsigned char addr);
void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV,
unsigned char SA);
void __fastcall__ cbm_k_setnam (const char* Name);
void __fastcall__ cbm_k_settim (unsigned long timer);
void __fastcall__ cbm_k_talk (unsigned char dev);
void __fastcall__ cbm_k_tksa (unsigned char addr);
void cbm_k_udtim (void);
@@ -222,7 +225,7 @@ void cbm_k_untlk (void);
/* The cbm_* I/O functions below set _oserror (see errno.h),
/* The cbm_* I/O functions below set __oserror (see errno.h),
** in case of an error.
**
** error-code BASIC error
@@ -248,7 +251,7 @@ unsigned int __fastcall__ cbm_load (const char* name, unsigned char device, void
** address of the file if "data" is the null pointer (like load"name",8,1
** in BASIC).
** Returns number of bytes that were loaded if loading was successful;
** otherwise 0, "_oserror" contains an error-code, then (see table above).
** otherwise 0, "__oserror" contains an error-code, then (see table above).
*/
unsigned char __fastcall__ cbm_save (const char* name, unsigned char device,
@@ -271,7 +274,7 @@ void __fastcall__ cbm_close (unsigned char lfn);
int __fastcall__ cbm_read (unsigned char lfn, void* buffer, unsigned int size);
/* Reads up to "size" bytes from a file into "buffer".
** Returns the number of actually-read bytes, 0 if there are no bytes left.
** -1 in case of an error; then, _oserror contains an error-code (see table
** -1 in case of an error; then, __oserror contains an error-code (see table
** above). (Remember: 0 means end-of-file; -1 means error.)
*/
@@ -279,7 +282,7 @@ int __fastcall__ cbm_write (unsigned char lfn, const void* buffer,
unsigned int size);
/* Writes up to "size" bytes from "buffer" to a file.
** Returns the number of actually-written bytes, or -1 in case of an error;
** _oserror contains an error-code, then (see above table).
** __oserror contains an error-code, then (see above table).
*/
unsigned char cbm_opendir (unsigned char lfn, unsigned char device, ...);
@@ -294,7 +297,15 @@ unsigned char __fastcall__ cbm_readdir (unsigned char lfn,
/* Reads one directory line into cbm_dirent structure.
** Returns 0 if reading directory-line was successful.
** Returns non-zero if reading directory failed, or no more file-names to read.
** Returns 2 on last line. Then, l_dirent->size = the number of "blocks free."
** Returns 2 on last line. Then, l_dirent->size = the number of "blocks free",
** "blocks used", or "mb free". Return codes:
** 0 = read file-name
** 1 = couldn't read directory
** 2 = read "blocks free", "blocks used", or "mb free"
** 3 = couldn't find start of file-name
** 4 = couldn't find end of file-name
** 5 = couldn't read file-type
** 6 = premature end of file
*/
void __fastcall__ cbm_closedir (unsigned char lfn);

View File

@@ -7,7 +7,7 @@
/* */
/* */
/* (C) 1998-2003 Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
@@ -79,8 +79,7 @@
#define BCOLOR_WHITE 0x01
#define BCOLOR_RED 0x02
#define BCOLOR_CYAN 0x03
#define BCOLOR_VIOLET 0x04
#define BCOLOR_PURPLE BCOLOR_VIOLET
#define BCOLOR_PURPLE 0x04
#define BCOLOR_GREEN 0x05
#define BCOLOR_BLUE 0x06
#define BCOLOR_YELLOW 0x07
@@ -98,8 +97,7 @@
#define COLOR_WHITE (BCOLOR_WHITE | CATTR_LUMA7)
#define COLOR_RED (BCOLOR_RED | CATTR_LUMA4)
#define COLOR_CYAN (BCOLOR_CYAN | CATTR_LUMA7)
#define COLOR_VIOLET (BCOLOR_VIOLET | CATTR_LUMA7)
#define COLOR_PURPLE COLOR_VIOLET
#define COLOR_PURPLE (BCOLOR_LIGHTVIOLET | CATTR_LUMA7)
#define COLOR_GREEN (BCOLOR_GREEN | CATTR_LUMA7)
#define COLOR_BLUE (BCOLOR_BLUE | CATTR_LUMA7)
#define COLOR_YELLOW (BCOLOR_YELLOW | CATTR_LUMA7)

View File

@@ -78,8 +78,7 @@
#define COLOR_WHITE 0x01
#define COLOR_RED 0x02
#define COLOR_CYAN 0x03
#define COLOR_VIOLET 0x04
#define COLOR_PURPLE COLOR_VIOLET
#define COLOR_PURPLE 0x04
#define COLOR_GREEN 0x05
#define COLOR_BLUE 0x06
#define COLOR_YELLOW 0x07
@@ -129,7 +128,7 @@ extern void cbm510_inkwl_mou[];
extern void cbm510_joy_mou[]; /* Referred to by mouse_static_stddrv[] */
extern void cbm510_ram_emd[];
extern void cbm510_std_joy[]; /* Referred to by joy_static_stddrv[] */
extern void cbm510_std_ser[];
extern void cbm510_std_ser[]; /* Referred to by ser_static_stddrv[] */

View File

@@ -105,7 +105,7 @@
/* The addresses of the static drivers */
extern void cbm610_ram_emd[];
extern void cbm610_std_ser[];
extern void cbm610_std_ser[]; /* Referred to by ser_static_stddrv[] */

View File

@@ -8,7 +8,7 @@
/* from ASCII to screen-code mapping, so you can write directly */
/* to the screen memory. */
/* */
/* If this include is used, no additional macroes are needed. */
/* If this include is used, no additional macros are needed. */
/* */
/*****************************************************************************/

View File

@@ -59,21 +59,21 @@ unsigned long __fastcall__ udiv32by16r16 (unsigned long rhs, unsigned lhs);
*/
int __fastcall__ imul8x8r16 (signed char lhs, signed char rhs);
/* Multiplicate two signed 8 bit to yield an signed 16 bit result */
/* Multiply two signed 8 bit to yield an signed 16 bit result */
long __fastcall__ imul16x16r32 (int lhs, int rhs);
/* Multiplicate two signed 16 bit to yield a signed 32 bit result */
/* Multiply two signed 16 bit to yield a signed 32 bit result */
unsigned __fastcall__ umul8x8r16 (unsigned char lhs, unsigned char rhs);
/* Multiplicate two unsigned 8 bit to yield an unsigned 16 bit result */
/* Multiply two unsigned 8 bit to yield an unsigned 16 bit result */
unsigned long __fastcall__ umul16x8r32 (unsigned lhs, unsigned char rhs);
/* Multiplicate an unsigned 16 bit by an unsigned 8 bit number yielding a 24
/* Multiply an unsigned 16 bit by an unsigned 8 bit number yielding a 24
** bit unsigned result that is extended to 32 bits for easier handling from C.
*/
unsigned long __fastcall__ umul16x16r32 (unsigned lhs, unsigned rhs);
/* Multiplicate two unsigned 16 bit to yield an unsigned 32 bit result */
/* Multiply two unsigned 16 bit to yield an unsigned 32 bit result */
unsigned int __fastcall__ mul20 (unsigned char value);
/* Multiply an 8 bit unsigned value by 20 and return the 16 bit unsigned

View File

@@ -201,19 +201,33 @@ void __fastcall__ cputhex16 (unsigned val);
*/
#ifdef _textcolor
# define textcolor(x) _textcolor(x)
# define textcolor(color) _textcolor(color)
#endif
#ifdef _bgcolor
# define bgcolor(x) _bgcolor(x)
# define bgcolor(color) _bgcolor(color)
#endif
#ifdef _bordercolor
# define bordercolor(x) _bordercolor(x)
# define bordercolor(color) _bordercolor(color)
#endif
#ifdef _cpeekcolor
# define cpeekcolor(x) _cpeekcolor(x)
# define cpeekcolor() _cpeekcolor()
#endif
#ifdef _cpeekrevers
# define cpeekrevers() _cpeekrevers()
#endif
#ifdef _chline
# define chline(len) _chline(len)
#endif
#ifdef _cvline
# define cvline(len) _cvline(len)
#endif
#ifdef _chlinexy
# define chlinexy(x, y, len) _chlinexy(x, y, len)
#endif
#ifdef _cvlinexy
# define cvlinexy(x, y, len) _cvlinexy(x, y, len)
#endif
/* End of conio.h */
#endif

View File

@@ -70,9 +70,9 @@
#define COLOR_WHITE 15
/* Protos */
void __fastcall__ psg_outb(unsigned char b);
void __fastcall__ psg_delay(unsigned char b);
void psg_silence(void);
void __fastcall__ bios_playsound(void *a, unsigned char b);
void __fastcall__ psg_outb (unsigned char b);
void __fastcall__ psg_delay (unsigned char b);
void psg_silence (void);
void __fastcall__ bios_playsound (const void *a, unsigned char b);
#endif /* #ifndef _CVISION_H */

View File

@@ -36,10 +36,6 @@
#ifndef _CTYPE_H
#define _CTYPE_H
/* The array containing character classification data */
extern unsigned char _ctype[256];
/* Bits used to specify character classes */
#define _CT_LOWER 0x01 /* 0 - Lower case char */
#define _CT_UPPER 0x02 /* 1 - Upper case char */
@@ -61,6 +57,9 @@ extern unsigned char _ctype[256];
/* Character classification functions */
int __fastcall__ isalnum (int c);
int __fastcall__ isalpha (int c);
#if __CC65_STD__ >= __CC65_STD_CC65__
int __fastcall__ isascii (int c); /* non standard */
#endif
int __fastcall__ iscntrl (int c);
int __fastcall__ isdigit (int c);
int __fastcall__ isgraph (int c);
@@ -78,106 +77,10 @@ int __fastcall__ toupper (int c); /* Always external */
int __fastcall__ tolower (int c); /* Always external */
#if __CC65_STD__ >= __CC65_STD_CC65__
unsigned char __fastcall__ toascii (unsigned char c);
unsigned char __fastcall__ toascii (unsigned char c); /* non standard */
/* Convert a target-specific character to ASCII. */
#endif
/* When --eagerly-inline-funcs is enabled, overload most of the above
** functions by macroes. The function prototypes are available again after
** #undef'ing the macroes.
** Please note that the following macroes do NOT handle EOF correctly, as
** stated in the manual. If you need correct behaviour for EOF, don't
** use --eagerly-inline-funcs, or #undefine the following macroes.
*/
#ifdef __EAGERLY_INLINE_FUNCS__
#define isalnum(c) (__AX__ = (c), \
__asm__ ("tay"), \
__asm__ ("lda %v,y", _ctype), \
__asm__ ("and #%b", _CT_ALNUM), \
__AX__)
#define isalpha(c) (__AX__ = (c), \
__asm__ ("tay"), \
__asm__ ("lda %v,y", _ctype), \
__asm__ ("and #%b", _CT_ALPHA), \
__AX__)
#if __CC65_STD__ >= __CC65_STD_C99__
#define isblank(c) (__AX__ = (c), \
__asm__ ("tay"), \
__asm__ ("lda %v,y", _ctype), \
__asm__ ("and #%b", _CT_SPACE_TAB), \
__AX__)
#endif
#define iscntrl(c) (__AX__ = (c), \
__asm__ ("tay"), \
__asm__ ("lda %v,y", _ctype), \
__asm__ ("and #%b", _CT_CNTRL), \
__AX__)
#define isdigit(c) (__AX__ = (c), \
__asm__ ("tay"), \
__asm__ ("lda %v,y", _ctype), \
__asm__ ("and #%b", _CT_DIGIT), \
__AX__)
#define isgraph(c) (__AX__ = (c), \
__asm__ ("tay"), \
__asm__ ("lda %v,y", _ctype), \
__asm__ ("and #%b", _CT_NOT_GRAPH), \
__asm__ ("cmp #1"), \
__asm__ ("lda #1"), \
__asm__ ("sbc #1"), \
__AX__)
#define islower(c) (__AX__ = (c), \
__asm__ ("tay"), \
__asm__ ("lda %v,y", _ctype), \
__asm__ ("and #%b", _CT_LOWER), \
__AX__)
#define isprint(c) (__AX__ = (c), \
__asm__ ("tay"), \
__asm__ ("lda %v,y", _ctype), \
__asm__ ("and #%b", _CT_NOT_PRINT), \
__asm__ ("eor #%b", _CT_NOT_PRINT), \
__AX__)
#define ispunct(c) (__AX__ = (c), \
__asm__ ("tay"), \
__asm__ ("lda %v,y", _ctype), \
__asm__ ("and #%b", _CT_NOT_PUNCT), \
__asm__ ("cmp #1"), \
__asm__ ("lda #1"), \
__asm__ ("sbc #1"), \
__AX__)
#define isspace(c) (__AX__ = (c), \
__asm__ ("tay"), \
__asm__ ("lda %v,y", _ctype), \
__asm__ ("and #%b", _CT_WS), \
__AX__)
#define isupper(c) (__AX__ = (c), \
__asm__ ("tay"), \
__asm__ ("lda %v,y", _ctype), \
__asm__ ("and #%b", _CT_UPPER), \
__AX__)
#define isxdigit(c) (__AX__ = (c), \
__asm__ ("tay"), \
__asm__ ("lda %v,y", _ctype), \
__asm__ ("and #%b", _CT_XDIGIT), \
__AX__)
#endif
/* End of ctype.h */
#endif

View File

@@ -2,7 +2,8 @@
/* */
/* cx16.h */
/* */
/* CX16 system-specific definitions */
/* CX16 system-specific definitions */
/* For prerelease 43 */
/* */
/* */
/* This software is provided "as-is", without any expressed or implied */
@@ -44,7 +45,38 @@
/* Additional output character codes */
#define CH_COLOR_SWAP 0x01
#define CH_UNDERLINE 0x04
#define CH_WHITE 0x05
#define CH_BOLD 0x06
#define CH_BACKSPACE 0x08
#define CH_ITALIC 0x0B
#define CH_OUTLINE 0x0C
#define CH_FONT_ISO 0x0F
#define CH_RED 0x1C
#define CH_GREEN 0x1E
#define CH_BLUE 0x1F
#define CH_ORANGE 0x81
#define CH_FONT_PET 0x8F
#define CH_BLACK 0x90
#define CH_ATTR_CLEAR 0x92
#define CH_BROWN 0x95
#define CH_PINK 0x96
#define CH_LIGHTRED CH_PINK
#define CH_GRAY1 0x97
#define CH_GRAY2 0x98
#define CH_LIGHTGREEN 0x99
#define CH_LIGHTBLUE 0x9A
#define CH_GRAY3 0x9B
#define CH_PURPLE 0x9C
#define CH_YELLOW 0x9E
#define CH_CYAN 0x9F
#define CH_SHIFT_SPACE 0xA0
/* Additional key defines */
#define CH_SHIFT_TAB 0x18
#define CH_HELP 0x84
#define CH_F1 0x85
#define CH_F2 0x89
#define CH_F3 0x86
@@ -63,67 +95,150 @@
#define COLOR_WHITE 0x01
#define COLOR_RED 0x02
#define COLOR_CYAN 0x03
#define COLOR_VIOLET 0x04
#define COLOR_PURPLE COLOR_VIOLET
#define COLOR_PURPLE 0x04
#define COLOR_GREEN 0x05
#define COLOR_BLUE 0x06
#define COLOR_YELLOW 0x07
#define COLOR_ORANGE 0x08
#define COLOR_BROWN 0x09
#define COLOR_LIGHTRED 0x0A
#define COLOR_PINK 0x0A
#define COLOR_LIGHTRED COLOR_PINK
#define COLOR_GRAY1 0x0B
#define COLOR_GRAY2 0x0C
#define COLOR_LIGHTGREEN 0x0D
#define COLOR_LIGHTBLUE 0x0E
#define COLOR_GRAY3 0x0F
/* Masks for joy_read() */
#define JOY_BTN_1_MASK 0x80
#define JOY_BTN_2_MASK 0x40
#define JOY_BTN_3_MASK 0x20
#define JOY_BTN_4_MASK 0x10
#define JOY_UP_MASK 0x08
#define JOY_DOWN_MASK 0x04
#define JOY_LEFT_MASK 0x02
#define JOY_RIGHT_MASK 0x01
/* TGI color defines */
#define TGI_COLOR_BLACK COLOR_BLACK
#define TGI_COLOR_WHITE COLOR_WHITE
#define TGI_COLOR_RED COLOR_RED
#define TGI_COLOR_CYAN COLOR_CYAN
#define TGI_COLOR_PURPLE COLOR_PURPLE
#define TGI_COLOR_GREEN COLOR_GREEN
#define TGI_COLOR_BLUE COLOR_BLUE
#define TGI_COLOR_YELLOW COLOR_YELLOW
#define TGI_COLOR_ORANGE COLOR_ORANGE
#define TGI_COLOR_BROWN COLOR_BROWN
#define TGI_COLOR_LIGHTRED COLOR_LIGHTRED
#define TGI_COLOR_GRAY1 COLOR_GRAY1
#define TGI_COLOR_GRAY2 COLOR_GRAY2
#define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
#define TGI_COLOR_GRAY3 COLOR_GRAY3
#define JOY_BTN_A_MASK JOY_BTN_1_MASK
#define JOY_BTN_B_MASK JOY_BTN_2_MASK
#define JOY_SELECT_MASK JOY_BTN_3_MASK
#define JOY_START_MASK JOY_BTN_4_MASK
/* NES controller masks for joy_read() */
#define JOY_BTN_A(v) ((v) & JOY_BTN_A_MASK)
#define JOY_BTN_B(v) ((v) & JOY_BTN_B_MASK)
#define JOY_SELECT(v) ((v) & JOY_SELECT_MASK)
#define JOY_START(v) ((v) & JOY_START_MASK)
#define JOY_BTN_1_MASK 0x80
#define JOY_BTN_2_MASK 0x40
#define JOY_BTN_3_MASK 0x20
#define JOY_BTN_4_MASK 0x10
#define JOY_UP_MASK 0x08
#define JOY_DOWN_MASK 0x04
#define JOY_LEFT_MASK 0x02
#define JOY_RIGHT_MASK 0x01
#define JOY_FIRE2_MASK JOY_BTN_2_MASK
#define JOY_FIRE2(v) ((v) & JOY_FIRE2_MASK)
#define JOY_BTN_A_MASK JOY_BTN_1_MASK
#define JOY_BTN_B_MASK JOY_BTN_2_MASK
#define JOY_SELECT_MASK JOY_BTN_3_MASK
#define JOY_START_MASK JOY_BTN_4_MASK
#define JOY_BTN_A(v) ((v) & JOY_BTN_A_MASK)
#define JOY_BTN_B(v) ((v) & JOY_BTN_B_MASK)
#define JOY_SELECT(v) ((v) & JOY_SELECT_MASK)
#define JOY_START(v) ((v) & JOY_START_MASK)
#define JOY_FIRE2_MASK JOY_BTN_2_MASK
#define JOY_FIRE2(v) ((v) & JOY_FIRE2_MASK)
/* Additional mouse button mask */
#define MOUSE_BTN_MIDDLE 0x02
/* get_tv() return codes
** set_tv() argument codes
*/
#define TV_NONE 0
#define TV_VGA 1
#define TV_NTSC_COLOR 2
#define TV_RGB 3
#define TV_NONE2 4
#define TV_VGA2 5
#define TV_NTSC_MONO 6
#define TV_RGB2 7
enum {
TV_NONE = 0x00,
TV_VGA,
TV_NTSC_COLOR,
TV_RGB,
TV_NONE2,
TV_VGA2,
TV_NTSC_MONO,
TV_RGB2
};
/* Video mode defines */
#define VIDEOMODE_40x30 40u
#define VIDEOMODE_80x60 80u
#define VIDEOMODE_40COL VIDEOMODE_40x30
/* Video modes for videomode() */
#define VIDEOMODE_80x60 0x00
#define VIDEOMODE_80x30 0x01
#define VIDEOMODE_40x60 0x02
#define VIDEOMODE_40x30 0x03
#define VIDEOMODE_40x15 0x04
#define VIDEOMODE_20x30 0x05
#define VIDEOMODE_20x15 0x06
#define VIDEOMODE_22x23 0x07
#define VIDEOMODE_64x50 0x08
#define VIDEOMODE_64x25 0x09
#define VIDEOMODE_32x50 0x0A
#define VIDEOMODE_32x25 0x0B
#define VIDEOMODE_80COL VIDEOMODE_80x60
#define VIDEOMODE_40COL VIDEOMODE_40x30
#define VIDEOMODE_320x240 0x80
#define VIDEOMODE_SWAP (-1)
/* VERA's address increment/decrement numbers */
enum {
VERA_DEC_0 = ((0 << 1) | 1) << 3,
VERA_DEC_1 = ((1 << 1) | 1) << 3,
VERA_DEC_2 = ((2 << 1) | 1) << 3,
VERA_DEC_4 = ((3 << 1) | 1) << 3,
VERA_DEC_8 = ((4 << 1) | 1) << 3,
VERA_DEC_16 = ((5 << 1) | 1) << 3,
VERA_DEC_32 = ((6 << 1) | 1) << 3,
VERA_DEC_64 = ((7 << 1) | 1) << 3,
VERA_DEC_128 = ((8 << 1) | 1) << 3,
VERA_DEC_256 = ((9 << 1) | 1) << 3,
VERA_DEC_512 = ((10 << 1) | 1) << 3,
VERA_DEC_40 = ((11 << 1) | 1) << 3,
VERA_DEC_80 = ((12 << 1) | 1) << 3,
VERA_DEC_160 = ((13 << 1) | 1) << 3,
VERA_DEC_320 = ((14 << 1) | 1) << 3,
VERA_DEC_640 = ((15 << 1) | 1) << 3,
VERA_INC_0 = ((0 << 1) | 0) << 3,
VERA_INC_1 = ((1 << 1) | 0) << 3,
VERA_INC_2 = ((2 << 1) | 0) << 3,
VERA_INC_4 = ((3 << 1) | 0) << 3,
VERA_INC_8 = ((4 << 1) | 0) << 3,
VERA_INC_16 = ((5 << 1) | 0) << 3,
VERA_INC_32 = ((6 << 1) | 0) << 3,
VERA_INC_64 = ((7 << 1) | 0) << 3,
VERA_INC_128 = ((8 << 1) | 0) << 3,
VERA_INC_256 = ((9 << 1) | 0) << 3,
VERA_INC_512 = ((10 << 1) | 0) << 3,
VERA_INC_40 = ((11 << 1) | 0) << 3,
VERA_INC_80 = ((12 << 1) | 0) << 3,
VERA_INC_160 = ((13 << 1) | 0) << 3,
VERA_INC_320 = ((14 << 1) | 0) << 3,
VERA_INC_640 = ((15 << 1) | 0) << 3
};
/* VERA's interrupt flags */
#define VERA_IRQ_VSYNC 0b00000001
#define VERA_IRQ_RASTER 0b00000010
#define VERA_IRQ_SPR_COLL 0b00000100
#define VERA_IRQ_AUDIO_LOW 0b00001000
/* Define hardware */
/* Define hardware. */
/* Define a structure with the Video Enhanced Retro Adapter's
** external registers.
*/
#define RAM_BANK (*(unsigned char *)0x00)
#define ROM_BANK (*(unsigned char *)0x01)
#include <_6522.h>
#define VIA1 (*(volatile struct __6522 *)0x9F00)
#define VIA2 (*(volatile struct __6522 *)0x9F10)
/* A structure with the Video Enhanced Retro Adapter's external registers */
struct __vera {
unsigned short address; /* Address for data ports */
unsigned char address_hi;
@@ -132,32 +247,119 @@ struct __vera {
unsigned char control; /* Control register */
unsigned char irq_enable; /* Interrupt enable bits */
unsigned char irq_flags; /* Interrupt flags */
unsigned char irq_raster; /* Line where IRQ will occur */
union {
struct { /* Visible when DCSEL flag = 0 */
unsigned char video; /* Flags to enable video layers */
unsigned char hscale; /* Horizontal scale factor */
unsigned char vscale; /* Vertical scale factor */
unsigned char border; /* Border color (NTSC mode) */
};
struct { /* Visible when DCSEL flag = 1 */
unsigned char hstart; /* Horizontal start position */
unsigned char hstop; /* Horizontal stop position */
unsigned char vstart; /* Vertical start position */
unsigned char vstop; /* Vertical stop position */
};
struct { /* Visible when DCSEL flag = 2 */
unsigned char fxctrl;
unsigned char fxtilebase;
unsigned char fxmapbase;
unsigned char fxmult;
};
struct { /* Visible when DCSEL flag = 3 */
unsigned char fxxincrl;
unsigned char fxxincrh;
unsigned char fxyincrl;
unsigned char fxyincrh;
};
struct { /* Visible when DCSEL flag = 4 */
unsigned char fxxposl;
unsigned char fxxposh;
unsigned char fxyposl;
unsigned char fxyposh;
};
struct { /* Visible when DCSEL flag = 5 */
unsigned char fxxposs;
unsigned char fxyposs;
unsigned char fxpolyfilll;
unsigned char fxpolyfillh;
};
struct { /* Visible when DCSEL flag = 6 */
unsigned char fxcachel;
unsigned char fxcachem;
unsigned char fxcacheh;
unsigned char fxcacheu;
};
struct { /* Visible when DCSEL flag = 63 */
unsigned char dcver0;
unsigned char dcver1;
unsigned char dcver2;
unsigned char dcver3;
};
} display;
struct {
unsigned char config; /* Layer map geometry */
unsigned char mapbase; /* Map data address */
unsigned char tilebase; /* Tile address and geometry */
unsigned int hscroll; /* Smooth scroll horizontal offset */
unsigned int vscroll; /* Smooth scroll vertical offset */
} layer0;
struct {
unsigned char config;
unsigned char mapbase;
unsigned char tilebase;
unsigned int hscroll;
unsigned int vscroll;
} layer1;
struct {
unsigned char control; /* PCM format */
unsigned char rate; /* Sample rate */
unsigned char data; /* PCM output queue */
} audio; /* Pulse-Code Modulation registers */
struct {
unsigned char data;
unsigned char control;
} spi; /* SD card interface */
};
#define VERA (*(volatile struct __vera *)0x9F20)
#include <_6522.h>
#define VIA1 (*(volatile struct __6522 *)0x9F60)
#define VIA2 (*(volatile struct __6522 *)0x9F70)
/* Audio chip */
struct __ym2151 {
unsigned char reg; /* Register number for data */
union {
unsigned char data;
unsigned char status; /* Busy flag */
};
};
#define YM2151 (*(volatile struct __ym2151 *)0x9F40)
/* Define a structure with the x16emu's settings registers. */
/* A structure with the x16emu's settings registers */
struct __emul {
unsigned char debug; /* Boolean: debugging enabled */
unsigned char vera_action; /* Boolean: displaying VERA activity */
unsigned char keyboard; /* Boolean: displaying typed keys */
unsigned char echo; /* How Kernal output should be echoed to host */
unsigned char save_on_exit; /* Boolean: save SD card when quitting */
unsigned char echo; /* How to send Kernal output to host */
unsigned char save_on_exit; /* Boolean: save machine state on exit */
unsigned char gif_method; /* How GIF movie is being recorded */
unsigned char unused[0xD - 0x6];
unsigned char keymap; /* Keyboard layout number */
const char detect[2]; /* "16" if running on x16emu */
unsigned char const unused1[2];
unsigned long const cycle_count; /* Running total of CPU cycles (8 MHz.) */
unsigned char const unused2[1];
unsigned char const keymap; /* Keyboard layout number */
char const detect[2]; /* "16" if running on x16emu */
};
#define EMULATOR (*(volatile struct __emul)0x9FB0)
#define EMULATOR (*(volatile struct __emul *)0x9FB0)
/* An array window into the half Mebibyte or two Mebibytes of banked RAM */
#define BANK_RAM ((unsigned char *)0xA000)
/* The addresses of the static drivers */
extern void cx16_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
extern void cx16_std_joy[]; /* Referenced by joy_static_stddrv[] */
extern void cx16_std_mou[]; /* Referenced by mouse_static_stddrv[] */
extern void cx320p1_tgi[]; /* Referenced by tgi_static_stddrv[] */
@@ -167,6 +369,9 @@ extern void cx16_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
unsigned short get_numbanks (void);
/* Return the number of RAM banks that the machine has. */
signed char get_ostype (void);
/* Get the ROM build version.
** -1 -- custom build
@@ -174,14 +379,31 @@ signed char get_ostype (void);
** Positive -- release build
*/
unsigned char get_tv (void);
/* Return the video signal type that the machine is using.
** Return a TV_xx constant.
*/
void __fastcall__ set_tv (unsigned char type);
/* Set the video type that the machine will use.
/* Set the video signal type that the machine will use.
** Call with a TV_xx constant.
*/
unsigned char __fastcall__ videomode (unsigned char mode);
/* Set the video mode, return the old mode. Call with one of the VIDEOMODE_xx
** constants.
unsigned char __fastcall__ vera_layer_enable (unsigned char layers);
/* Display the layers that are "named" by the bit flags in layers.
** A value of 0b01 shows layer 0, a value of 0b10 shows layer 1,
** a value of 0b11 shows both layers. Return the previous value.
*/
unsigned char __fastcall__ vera_sprites_enable (unsigned char mode);
/* Enable the sprite engine when mode is non-zero (true);
** disable sprites when mode is zero. Return the previous mode.
*/
signed char __fastcall__ videomode (signed char mode);
/* Set the video mode, return the old mode.
** Return -1 if Mode isn't valid.
** Call with one of the VIDEOMODE_xx constants.
*/
unsigned char __fastcall__ vpeek (unsigned long addr);

View File

@@ -39,7 +39,7 @@
** are declared here.
**
** To use the debugger, just call DbgInit in your application. Once it has
** been called, the debugger will catch any BRK opcode. Use the BREAK macro
** been called, the debugger will catch any BRK opcode. Use the BREAK macro
** defined below to insert breakpoints into your code.
**
** There are currently a lot of things that cannot be debugged, graphical
@@ -121,4 +121,4 @@ void __fastcall__ DbgInit (unsigned unused);

View File

@@ -35,9 +35,9 @@
/* Please note: All functions in this file will set _oserror *and* return its
** value. The only exception is dio_open, which will return NULL, but _oserror
** will be set. All function will also set _oserror in case of successful
/* Please note: All functions in this file will set __oserror *and* return its
** value. The only exception is dio_open, which will return NULL, but __oserror
** will be set. All function will also set __oserror in case of successful
** execution, effectively clearing it.
*/

View File

@@ -33,6 +33,8 @@
#ifndef _DIRENT_H
#define _DIRENT_H
#include <target.h>
/*****************************************************************************/
@@ -46,31 +48,15 @@ typedef struct DIR DIR;
#if defined(__APPLE2__)
struct dirent {
char d_name[16];
unsigned d_ino;
unsigned d_blocks;
unsigned long d_size;
unsigned char d_type;
struct {
unsigned day :5;
unsigned mon :4;
unsigned year :7;
} d_cdate;
struct {
unsigned char min;
unsigned char hour;
} d_ctime;
unsigned char d_access;
unsigned d_auxtype;
struct {
unsigned day :5;
unsigned mon :4;
unsigned year :7;
} d_mdate;
struct {
unsigned char min;
unsigned char hour;
} d_mtime;
char d_name[16];
unsigned d_ino;
unsigned d_blocks;
unsigned long d_size;
unsigned char d_type;
struct datetime d_ctime;
unsigned char d_access;
unsigned d_auxtype;
struct datetime d_mtime;
};
#define _DE_ISREG(t) ((t) != 0x0F)
@@ -161,7 +147,5 @@ void __fastcall__ seekdir (DIR* dir, long offs);
void __fastcall__ rewinddir (DIR* dir);
/* End of dirent.h */
#endif

View File

@@ -82,7 +82,7 @@ unsigned char __fastcall__ em_load_driver (const char* driver);
unsigned char em_unload (void);
/* Uninstall, then unload the currently loaded driver. */
unsigned char __fastcall__ em_install (void* driver);
unsigned char __fastcall__ em_install (const void* driver);
/* Install an already loaded driver. Return an error code. */
unsigned char em_uninstall (void);

View File

@@ -45,12 +45,17 @@
/* Operating system specific error code */
extern unsigned char _oserror;
extern unsigned char __oserror;
extern int _errno;
#if __CC65_STD__ >= __CC65_STD_CC65__
/* define the name with just one underscore for backwards compatibility */
#define _oserror __oserror
#endif
extern int __errno;
/* System errors go here */
#define errno _errno
#define errno __errno
/* errno must be a macro */
@@ -83,27 +88,45 @@ extern int _errno;
int __fastcall__ _osmaperrno (unsigned char oserror);
/* Map an operating system specific error code (for example from _oserror)
int __fastcall__ __osmaperrno (unsigned char oserror);
/* Map an operating system specific error code (for example from __oserror)
** into one of the E... codes above. It is user callable.
*/
unsigned char __fastcall__ _seterrno (unsigned char code);
#if __CC65_STD__ >= __CC65_STD_CC65__
/* define the name with just one underscore for backwards compatibility */
#define _osmaperrno __osmaperrno
#endif
unsigned char __fastcall__ __seterrno (unsigned char code);
/* Set errno to a specific error code and return zero. Used by the library */
int __fastcall__ _directerrno (unsigned char code);
/* Set errno to a specific error code, clear _oserror and return -1. Used
#if __CC65_STD__ >= __CC65_STD_CC65__
/* define the name with just one underscore for backwards compatibility */
#define _seterrno __seterrno
#endif
int __fastcall__ __directerrno (unsigned char code);
/* Set errno to a specific error code, clear __oserror and return -1. Used
** by the library.
*/
int __fastcall__ _mappederrno (unsigned char code);
/* Set _oserror to the given platform specific error code. If it is a real
#if __CC65_STD__ >= __CC65_STD_CC65__
/* define the name with just one underscore for backwards compatibility */
#define _directerrno __directerrno
#endif
int __fastcall__ __mappederrno (unsigned char code);
/* Set __oserror to the given platform specific error code. If it is a real
** error code (not zero) set errno to the corresponding system error code
** and return -1. Otherwise return zero.
** Used by the library.
*/
#if __CC65_STD__ >= __CC65_STD_CC65__
/* define the name with just one underscore for backwards compatibility */
#define _mappederrno __mappederrno
#endif
/* End of errno.h */
#endif

View File

@@ -7,7 +7,7 @@
/* */
/* */
/* (C) 1998-2004 Ullrich von Bassewitz */
/* R<EFBFBD>merstra<EFBFBD>e 52 */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */

View File

@@ -145,6 +145,8 @@
/* constants for the conio implementation */
#define COLOR_BLACK 0x03
#define COLOR_GRAY2 0x02
#define COLOR_GRAY1 0x01
#define COLOR_WHITE 0x00
#define CH_HLINE 1
@@ -170,6 +172,8 @@
/* No support for dynamically loadable drivers */
#define DYN_DRV 0
#define JOY_DATA 0x4400 /* hw register to read the pad bits from */
/* Masks for joy_read */
#define JOY_UP_MASK 0x01
#define JOY_DOWN_MASK 0x02

View File

@@ -67,7 +67,6 @@
#define COLOR_WHITE WHITE
#define COLOR_RED RED
#define COLOR_CYAN CYAN
#define COLOR_VIOLET PURPLE
#define COLOR_PURPLE PURPLE
#define COLOR_GREEN GREEN
#define COLOR_BLUE BLUE
@@ -85,7 +84,6 @@
#define TGI_COLOR_WHITE COLOR_WHITE
#define TGI_COLOR_RED COLOR_RED
#define TGI_COLOR_CYAN COLOR_CYAN
#define TGI_COLOR_VIOLET COLOR_VIOLET
#define TGI_COLOR_PURPLE COLOR_PURPLE
#define TGI_COLOR_GREEN COLOR_GREEN
#define TGI_COLOR_BLUE COLOR_BLUE

View File

@@ -4,13 +4,15 @@
reassembled by Maciej 'YTM/Elysium' Witkowiak
*/
/* Here are constants which didn't fit into any other cathegory... */
/* Here are constants which didn't fit into any other category... */
#ifndef _GCONST_H
#define _GCONST_H
#define NULL 0
#define FALSE NULL
#ifndef NULL
#define NULL ((void *) 0)
#endif
#define FALSE 0
#define TRUE 0xff
#define MOUSE_SPRNUM 0
#define DISK_DRV_LGH 0x0d80

View File

@@ -43,7 +43,7 @@ void __fastcall__ BitOtherClip(void *proc1, void *proc2, char skipl,
char skipr, unsigned skiptop,
struct iconpic *myIcon);
void __fastcall__ GraphicsString(char *myGfxString);
void __fastcall__ GraphicsString(const void *myGfxString);
#ifdef __GEOS_CBM__
void SetNewMode(void);

View File

@@ -12,7 +12,7 @@
void __fastcall__ CopyString(char *dest, const char *source);
char __fastcall__ CmpString(const char *dest, const char *source);
void __fastcall__ CopyFString(char len, char *dest, const char *source);
char __fastcall__ CmpFString(char len, char *dest, const char *source);
char __fastcall__ CmpFString(char len, char *dest, const char *source);
unsigned __fastcall__ CRC(const char *buffer, unsigned len);
void* __fastcall__ ClearRam(char *dest, unsigned len);

View File

@@ -126,8 +126,8 @@ struct VLIR_info { /* VLIR information */
};
struct process { /* process info, declare table of that type */
unsigned pointer; /* (like: struct process proctab[2]=... */
unsigned jiffies; /* last entry HAVE TO BE {0,0} */
unsigned pointer; /* (like: struct process proctab[2]= ... */
unsigned jiffies; /* last entry MUST BE {0,0} */
};
struct iconpic { /* icon/encoded bitmap description */
@@ -135,7 +135,7 @@ struct iconpic { /* icon/encoded bitmap description */
char x; /* position in cards (*8 pixels) */
char y;
char width; /* in cards */
char heigth; /* in lines (pixels) */
char height; /* in lines (pixels) */
};
struct icondef { /* icon definition for DoIcons */
@@ -143,7 +143,7 @@ struct icondef { /* icon definition for DoIcons */
char x; /* position in cards (*8 pixels) */
char y;
char width; /* of icon (in cards) */
char heigth; /* of icon in lines (pixels) */
char height; /* of icon in lines (pixels) */
unsigned proc_ptr; /* pointer to function handling that icon */
};

View File

@@ -89,7 +89,7 @@ unsigned char __fastcall__ joy_load_driver (const char* driver);
unsigned char joy_unload (void);
/* Uninstall, then unload the currently loaded driver. */
unsigned char __fastcall__ joy_install (void* driver);
unsigned char __fastcall__ joy_install (const void* driver);
/* Install an already loaded driver. Return an error code. */
unsigned char joy_uninstall (void);

73
include/kim1.h Normal file
View File

@@ -0,0 +1,73 @@
/*****************************************************************************/
/* */
/* kim1.h */
/* */
/* KIM-1 system-specific definitions */
/* */
/* */
/* */
/* (C) 2022 Dave Plummer */
/* Email: davepl@davepl.com */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
#ifndef _KIM1_H
#define _KIM1_H
/* Check for errors */
#if !defined(__KIM1__)
# error This module may only be used when compiling for the KIM-1!
#endif
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/*****************************************************************************/
/* Hardware */
/*****************************************************************************/
/*****************************************************************************/
/* Code */
/*****************************************************************************/
/* Read from tape */
int __fastcall__ loadt (unsigned char);
/* Write to tape */
int __fastcall__ dumpt (unsigned char, const void*, const void*);
/* Write to 7-segment LED display. Due to hardware limitations it only
** displays briefly, so must be called repeatedly to update the
** display.
**/
void __fastcall__ scandisplay(unsigned char left, unsigned char middle, unsigned char right);
/*
** Get a keypress from the keypad. Returns $00-$0F(0-F), $10(AD), $11(DA), $12(+),
** $13(GO), $14(PC) or $15 for no keypress.
**/
int __fastcall__ getkey();
/* End of kim1.h */
#endif

View File

@@ -37,7 +37,6 @@
#define _LIMITS_H
#define CHAR_BIT 8
#define SCHAR_MIN ((signed char) 0x80)
@@ -63,7 +62,23 @@
#define ULONG_MAX 4294967295UL
#if __CC65_STD__ >= __CC65_STD_CC65__
/* These defines that are platform dependent */
/* FILENAME_MAX in stdlib.h is defined as the same value as PATH_MAX */
#if defined(__APPLE2__)
# define PATH_MAX (64+1)
#elif defined(__ATARI__)
# define PATH_MAX (63+1)
#elif defined(__CBM__)
# define PATH_MAX (255) /* should be 256+1, see libsrc/common/_cmd.s why it's not */
#elif defined(__LUNIX__)
# define PATH_MAX (80+1)
#elif defined(__TELESTRAT__)
# define PATH_MAX (50+1)
#else
# define PATH_MAX (16+1)
#endif
#endif /* __CC65_STD__ >= __CC65_STD_CC65__ */
/* End of limits.h */
#endif

View File

@@ -7,7 +7,7 @@
/* */
/* */
/* (C) 1998-2005 Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
@@ -39,9 +39,8 @@
/* NULL pointer */
#ifndef _HAVE_NULL
#define NULL 0
#define _HAVE_NULL
#ifndef NULL
#define NULL ((void *) 0)
#endif
/* Locale information constants */
@@ -82,6 +81,3 @@ char* __fastcall__ setlocale (int category, const char* locale);
/* End of locale.h */
#endif

View File

@@ -31,45 +31,34 @@
/* */
/*****************************************************************************/
#ifndef _LYNX_H
#define _LYNX_H
/* Check for errors */
#if !defined(__LYNX__)
# error This module may only be used when compiling for the Lynx game console!
#endif
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/* Color defines */
#define COLOR_BLACK 0x00
#define COLOR_RED 0x01
#define COLOR_PINK 0x02
#define COLOR_LIGHTGREY 0x03
#define COLOR_GREY 0x04
#define COLOR_DARKGREY 0x05
#define COLOR_BROWN 0x06
#define COLOR_PEACH 0x07
#define COLOR_YELLOW 0x08
#define COLOR_LIGHTGREEN 0x09
#define COLOR_GREEN 0x0A
#define COLOR_DARKBROWN 0x0B
#define COLOR_VIOLET 0x0C
/* Color definitions */
#define COLOR_TRANSPARENT 0x00
#define COLOR_BLACK 0x01
#define COLOR_RED 0x02
#define COLOR_PINK 0x03
#define COLOR_LIGHTGREY 0x04
#define COLOR_GREY 0x05
#define COLOR_DARKGREY 0x06
#define COLOR_BROWN 0x07
#define COLOR_PEACH 0x08
#define COLOR_YELLOW 0x09
#define COLOR_LIGHTGREEN 0x0A
#define COLOR_GREEN 0x0B
#define COLOR_PURPLE 0x0C
#define COLOR_BLUE 0x0D
#define COLOR_LIGHTBLUE 0x0E
#define COLOR_WHITE 0x0F
/* TGI color defines (default palette) */
#define TGI_COLOR_TRANSPARENT COLOR_TRANSPARENT
#define TGI_COLOR_BLACK COLOR_BLACK
#define TGI_COLOR_RED COLOR_RED
#define TGI_COLOR_PINK COLOR_PINK
@@ -77,16 +66,66 @@
#define TGI_COLOR_GREY COLOR_GREY
#define TGI_COLOR_DARKGREY COLOR_DARKGREY
#define TGI_COLOR_BROWN COLOR_BROWN
#define TGI_COLOR_ORANGE COLOR_BROWN
#define TGI_COLOR_PEACH COLOR_PEACH
#define TGI_COLOR_YELLOW COLOR_YELLOW
#define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN
#define TGI_COLOR_GREEN COLOR_GREEN
#define TGI_COLOR_DARKBROWN COLOR_DARKBROWN
#define TGI_COLOR_VIOLET COLOR_VIOLET
#define TGI_COLOR_PURPLE COLOR_PURPLE
#define TGI_COLOR_BLUE COLOR_BLUE
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
#define TGI_COLOR_WHITE COLOR_WHITE
/* No support for dynamically loadable drivers */
#define DYN_DRV 0
/* Addresses of static drivers */
extern void lynx_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
extern void lynx_comlynx_ser[]; /* Referred to by ser_static_stddrv[] */
extern void lynx_160_102_16_tgi[]; /* Referred to by tgi_static_stddrv[] */
/* Sound support */
void lynx_snd_init (void); /* Initialize the sound driver */
void lynx_snd_pause (void); /* Pause sound */
void lynx_snd_continue (void); /* Continue sound after pause */
void __fastcall__ lynx_snd_play (unsigned char channel, unsigned char *music); /* Play tune on channel */
void lynx_snd_stop (void); /* Stop sound on all channels */
void __fastcall__ lynx_snd_stop_channel (unsigned char channel); /* Stop sound on all channels */
unsigned char lynx_snd_active(void); /* Show which channels are active */
/* Cartridge access */
void __fastcall__ lynx_load (int file_number); /* Load a file into RAM using a zero-based index */
void __fastcall__ lynx_exec (int file_number); /* Load a file into ram and execute it */
/* EEPROM access */
unsigned __fastcall__ lynx_eeprom_read (unsigned char cell); /* Read a 16 bit word from the given address */
unsigned __fastcall__ lynx_eeprom_write (unsigned char cell, unsigned val); /* Write the word at the given address */
void __fastcall__ lynx_eeprom_erase (unsigned char cell); /* Clear the word at the given address */
unsigned __fastcall__ lynx_eeread (unsigned cell); /* Read a 16 bit word from the given address 93C46, 93C66 or 93C86 */
unsigned __fastcall__ lynx_eewrite (unsigned cell, unsigned val); /* Write the word at the given address 93C46, 93C66 or 93C86 */
/* TGI extras */
#define tgi_sprite(spr) tgi_ioctl(0, spr)
#define tgi_flip() tgi_ioctl(1, (void*)0)
#define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol))
#define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate))
#define tgi_busy() tgi_ioctl(4, (void*)0)
#define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
#define tgi_setcollisiondetection(active) tgi_ioctl(5, (void*)(active))
/* Hardware definitions */
#include <_mikey.h>
#define MIKEY (*(struct __mikey *)0xFD00)
#define _MIKEY_TIMERS (*(struct _mikey_all_timers *) 0xFD00) /* mikey_timers[8] */
#define _HBL_TIMER (*(struct _mikey_timer *) 0xFD00) /* timer0 (HBL) */
#define _VBL_TIMER (*(struct _mikey_timer *) 0xFD08) /* timer2 (VBL) */
#define _UART_TIMER (*(struct _mikey_timer *) 0xFD14) /* timer4 (UART) */
#define _VIDDMA (*(unsigned int *) 0xFD92) /* DISPCTL/VIDDMA */
#include <_suzy.h>
#define SUZY (*(volatile struct __suzy*)0xFC00)
/* Masks for joy_read */
#define JOY_UP_MASK 0x80
#define JOY_DOWN_MASK 0x40
@@ -101,118 +140,5 @@
#define JOY_BTN_A(v) ((v) & JOY_BTN_A_MASK)
#define JOY_BTN_B(v) ((v) & JOY_BTN_B_MASK)
/* No support for dynamically loadable drivers */
#define DYN_DRV 0
/*****************************************************************************/
/* Variables */
/*****************************************************************************/
/* The addresses of the static drivers */
extern void lynx_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
extern void lynx_comlynx_ser[];
extern void lynx_160_102_16_tgi[]; /* Referred to by tgi_static_stddrv[] */
/*****************************************************************************/
/* Sound support */
/*****************************************************************************/
void lynx_snd_init (void);
/* Initialize the sound driver */
void lynx_snd_pause (void);
/* Pause sound */
void lynx_snd_continue (void);
/* Continue sound after pause */
void __fastcall__ lynx_snd_play (unsigned char channel, unsigned char *music);
/* Play tune on channel */
void lynx_snd_stop (void);
/* Stop sound on all channels */
void __fastcall__ lynx_snd_stop_channel (unsigned char channel);
/* Stop sound on all channels */
unsigned char lynx_snd_active(void);
/* Show which channels are active */
/*****************************************************************************/
/* Accessing the cart */
/*****************************************************************************/
void __fastcall__ lynx_load (int fileno);
/* Load a file into ram. The first entry is fileno=0. */
void __fastcall__ lynx_exec (int fileno);
/* Load a file into ram and execute it. */
/*****************************************************************************/
/* Accessing the EEPROM */
/*****************************************************************************/
unsigned __fastcall__ lynx_eeprom_read (unsigned char cell);
/* Read a 16 bit word from the given address */
unsigned __fastcall__ lynx_eeprom_write (unsigned char cell, unsigned val);
/* Write the word at the given address */
void __fastcall__ lynx_eeprom_erase (unsigned char cell);
/* Clear the word at the given address */
unsigned __fastcall__ lynx_eeread (unsigned cell);
/* Read a 16 bit word from the given address 93C46 93C66 or 93C86*/
unsigned __fastcall__ lynx_eewrite (unsigned cell, unsigned val);
/* Write the word at the given address 93C46 93C66 or 93C86*/
/*****************************************************************************/
/* TGI extras */
/*****************************************************************************/
#define tgi_sprite(spr) tgi_ioctl(0, spr)
#define tgi_flip() tgi_ioctl(1, (void*)0)
#define tgi_setbgcolor(bgcol) tgi_ioctl(2, (void*)(bgcol))
#define tgi_setframerate(rate) tgi_ioctl(3, (void*)(rate))
#define tgi_busy() tgi_ioctl(4, (void*)0)
#define tgi_updatedisplay() tgi_ioctl(4, (void*)1)
#define tgi_setcollisiondetection(active) tgi_ioctl(5, (void*)(active))
/* Define Hardware */
#include <_mikey.h>
#define MIKEY (*(struct __mikey *)0xFD00)
#define _MIKEY_TIMERS (*(struct _mikey_all_timers *) 0xFD00) // mikey_timers[8]
#define _HBL_TIMER (*(struct _mikey_timer *) 0xFD00) // timer0 (HBL)
#define _VBL_TIMER (*(struct _mikey_timer *) 0xFD08) // timer2 (VBL)
#define _UART_TIMER (*(struct _mikey_timer *) 0xFD14) // timer4 (UART)
#define _VIDDMA (*(unsigned int *) 0xFD92) // dispctl/viddma
#include <_suzy.h>
#define SUZY (*(struct __suzy*)0xFC00)
/* End of lynx.h */
#endif

56
include/lzsa.h Normal file
View File

@@ -0,0 +1,56 @@
/*****************************************************************************/
/* */
/* lzsa.h */
/* */
/* Decompression routine for the 'lzsa' format */
/* */
/* */
/* */
/* (C) 2022 John Brandwood */
/* */
/* */
/* Boost license: */
/* Distributed under the Boost Software License, Version 1.0. */
/* Boost Software License - Version 1.0 - August 17th, 2003 */
/* */
/* Permission is hereby granted, free of charge, to any person or */
/* organization */
/* obtaining a copy of the software and accompanying documentation covered by*/
/* this license (the "Software") to use, reproduce, display, distribute, */
/* execute, and transmit the Software, and to prepare derivative works of the*/
/* Software, and to permit third-parties to whom the Software is furnished to*/
/* do so, all subject to the following: */
/* */
/* The copyright notices in the Software and this entire statement, including*/
/* the above license grant, this restriction and the following disclaimer, */
/* must be included in all copies of the Software, in whole or in part, and */
/* all derivative works of the Software, unless such copies or derivative */
/* works are solely in the form of machine-executable object code generated */
/* by a source language processor. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*/
/* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, */
/* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT */
/* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE */
/* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR */
/* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE */
/* USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*****************************************************************************/
#ifndef _LZSA_H
#define _LZSA_H
void __fastcall__ decompress_lzsa1 (const unsigned char* src, unsigned char* const dst);
/* Decompresses the source buffer into the destination buffer.
** compress with lzsa -r -f 1 input.bin output.lzsa1
*/
void __fastcall__ decompress_lzsa2 (const unsigned char* src, unsigned char* const dst);
/* Decompresses the source buffer into the destination buffer.
** compress with lzsa -r -f 2 input.bin output.lzsa2
*/
/* end of lzsa.h */
#endif

View File

@@ -7,7 +7,7 @@
/* */
/* */
/* (C) 2003-2006, Ullrich von Bassewitz */
/* R<EFBFBD>merstra<EFBFBD>e 52 */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */

View File

@@ -69,7 +69,7 @@
#define COLOR_WHITE 0x01
#define COLOR_RED 0x02
#define COLOR_CYAN 0x03
#define COLOR_VIOLET 0x04
#define COLOR_PURPLE 0x04
#define COLOR_GREEN 0x05
#define COLOR_BLUE 0x06
#define COLOR_YELLOW 0x07
@@ -82,6 +82,24 @@
#define COLOR_LIGHTBLUE 0x0E
#define COLOR_GRAY3 0x0F
/* TGI color defines (default palette) */
#define TGI_COLOR_BLACK COLOR_BLACK
#define TGI_COLOR_RED COLOR_RED
#define TGI_COLOR_PINK COLOR_LIGHTRED
#define TGI_COLOR_LIGHTGREY COLOR_GRAY1
#define TGI_COLOR_GREY COLOR_GRAY2
#define TGI_COLOR_DARKGREY COLOR_GRAY3
#define TGI_COLOR_BROWN COLOR_BROWN
#define TGI_COLOR_PEACH COLOR_CYAN
#define TGI_COLOR_YELLOW COLOR_YELLOW
#define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN
#define TGI_COLOR_GREEN COLOR_GREEN
#define TGI_COLOR_DARKBROWN COLOR_ORANGE
#define TGI_COLOR_PURPLE COLOR_PURPLE
#define TGI_COLOR_BLUE COLOR_BLUE
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
#define TGI_COLOR_WHITE COLOR_WHITE
/* Masks for joy_read */
#define JOY_UP_MASK 0x10
#define JOY_DOWN_MASK 0x20

View File

@@ -36,6 +36,24 @@
# error "This module may only be used when compiling for the Challenger 1P!"
#endif
/* Colors are not functional, display is black and white only. */
#define COLOR_BLACK 0x00
#define COLOR_WHITE 0x01
#define CH_ULCORNER 0xCC
#define CH_URCORNER 0xCD
#define CH_LLCORNER 0xCB
#define CH_LRCORNER 0xCE
#define CH_TTEE 0xD9
#define CH_BTEE 0xD7
#define CH_LTEE 0xD8
#define CH_RTEE 0xDA
#define CH_CROSS 0xDB
#define CH_HLINE 0x94
#define CH_VLINE 0x95
#define CH_ENTER 0x0D
/* The following #defines will cause the matching functions calls in conio.h
** to be overlaid by macros with the same names, saving the function call
** overhead.
@@ -43,5 +61,6 @@
#define _textcolor(color) COLOR_WHITE
#define _bgcolor(color) COLOR_BLACK
#define _bordercolor(color) COLOR_BLACK
#define _cpeekcolor(color) COLOR_WHITE
#endif

View File

@@ -56,7 +56,7 @@
#define COLOR_WHITE 0x01
#define COLOR_RED 0x02
#define COLOR_CYAN 0x03
#define COLOR_VIOLET 0x04
#define COLOR_PURPLE 0x04
#define COLOR_GREEN 0x05
#define COLOR_BLUE 0x06
#define COLOR_YELLOW 0x07

View File

@@ -7,7 +7,7 @@
/* */
/* */
/* (C) 2003 Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */

View File

@@ -7,7 +7,7 @@
/* */
/* */
/* (C) 1998-2006, Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
@@ -56,9 +56,8 @@
/* The addresses of the static drivers */
extern void plus4_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
extern void plus4_stdser_ser[];
extern void plus4_stdser_ser[]; /* Referred to by ser_static_stddrv[] */
extern void ted_hi_tgi[];
/* End of plus4.h */
#endif

266
include/rp6502.h Normal file
View File

@@ -0,0 +1,266 @@
/*****************************************************************************/
/* */
/* rp6502.h */
/* */
/* Picocomputer 6502 */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
#ifndef _RP6502_H
#define _RP6502_H
/* RP6502 VIA $FFD0-$FFDF */
#include <_6522.h>
#define VIA (*(volatile struct __6522 *)0xFFD0)
/* RP6502 RIA $FFE0-$FFF9 */
struct __RP6502
{
const unsigned char ready;
unsigned char tx;
const unsigned char rx;
const unsigned char vsync;
unsigned char rw0;
unsigned char step0;
unsigned int addr0;
unsigned char rw1;
unsigned char step1;
unsigned int addr1;
unsigned char xstack;
unsigned int errno;
unsigned char op;
unsigned char irq;
const unsigned char spin;
const unsigned char busy;
const unsigned char lda;
unsigned char a;
const unsigned char ldx;
unsigned char x;
const unsigned char rts;
unsigned int sreg;
};
#define RIA (*(volatile struct __RP6502 *)0xFFE0)
#define RIA_READY_TX_BIT 0x80
#define RIA_READY_RX_BIT 0x40
#define RIA_BUSY_BIT 0x80
/* XSTACK helpers */
void __fastcall__ ria_push_long (unsigned long val);
void __fastcall__ ria_push_int (unsigned int val);
#define ria_push_char(v) RIA.xstack = v
long ria_pop_long (void);
int ria_pop_int (void);
#define ria_pop_char() RIA.xstack
/* Set the RIA fastcall register */
void __fastcall__ ria_set_axsreg (unsigned long axsreg);
void __fastcall__ ria_set_ax (unsigned int ax);
#define ria_set_a(v) RIA.a = v
/* Run an OS operation */
int __fastcall__ ria_call_int (unsigned char op);
long __fastcall__ ria_call_long (unsigned char op);
/* These run _mappederrno() on error */
int __fastcall__ ria_call_int_errno (unsigned char op);
long __fastcall__ ria_call_long_errno (unsigned char op);
/* OS operation numbers */
#define RIA_OP_EXIT 0xFF
#define RIA_OP_ZXSTACK 0x00
#define RIA_OP_XREG 0x01
#define RIA_OP_PHI2 0x02
#define RIA_OP_CODEPAGE 0x03
#define RIA_OP_LRAND 0x04
#define RIA_OP_STDIN_OPT 0x05
#define RIA_OP_CLOCK 0x0F
#define RIA_OP_CLOCK_GETRES 0x10
#define RIA_OP_CLOCK_GETTIME 0x11
#define RIA_OP_CLOCK_SETTIME 0x12
#define RIA_OP_CLOCK_GETTIMEZONE 0x13
#define RIA_OP_OPEN 0x14
#define RIA_OP_CLOSE 0x15
#define RIA_OP_READ_XSTACK 0x16
#define RIA_OP_READ_XRAM 0x17
#define RIA_OP_WRITE_XSTACK 0x18
#define RIA_OP_WRITE_XRAM 0x19
#define RIA_OP_LSEEK 0x1A
#define RIA_OP_UNLINK 0x1B
#define RIA_OP_RENAME 0x1C
/* C API for the operating system. */
int __cdecl__ xregn (char device, char channel, unsigned char address, unsigned count,
...);
int __cdecl__ xreg (char device, char channel, unsigned char address, ...);
int phi2 (void);
int codepage (void);
long lrand (void);
int __fastcall__ stdin_opt (unsigned long ctrl_bits, unsigned char str_length);
int __fastcall__ read_xstack (void* buf, unsigned count, int fildes);
int __fastcall__ read_xram (unsigned buf, unsigned count, int fildes);
int __fastcall__ write_xstack (const void* buf, unsigned count, int fildes);
int __fastcall__ write_xram (unsigned buf, unsigned count, int fildes);
/* XREG location helpers */
#define xreg_ria_keyboard(...) xreg(0, 0, 0, __VA_ARGS__)
#define xreg_ria_mouse(...) xreg(0, 0, 1, __VA_ARGS__)
#define xreg_vga_canvas(...) xreg(1, 0, 0, __VA_ARGS__)
#define xreg_vga_mode(...) xreg(1, 0, 1, __VA_ARGS__)
/* XRAM structure helpers */
#define xram0_struct_set(addr, type, member, val) \
RIA.addr0 = (unsigned)(&((type *)0)->member) + (unsigned)addr; \
switch (sizeof(((type *)0)->member)) \
{ \
case 1: \
RIA.rw0 = val; \
break; \
case 2: \
RIA.step0 = 1; \
RIA.rw0 = val & 0xff; \
RIA.rw0 = (val >> 8) & 0xff; \
break; \
case 4: \
RIA.step0 = 1; \
RIA.rw0 = (unsigned long)val & 0xff; \
RIA.rw0 = ((unsigned long)val >> 8) & 0xff; \
RIA.rw0 = ((unsigned long)val >> 16) & 0xff; \
RIA.rw0 = ((unsigned long)val >> 24) & 0xff; \
break; \
}
#define xram1_struct_set(addr, type, member, val) \
RIA.addr1 = (unsigned)(&((type *)0)->member) + (unsigned)addr; \
switch (sizeof(((type *)0)->member)) \
{ \
case 1: \
RIA.rw1 = val; \
break; \
case 2: \
RIA.step1 = 1; \
RIA.rw1 = val & 0xff; \
RIA.rw1 = (val >> 8) & 0xff; \
break; \
case 4: \
RIA.step1 = 1; \
RIA.rw1 = (unsigned long)val & 0xff; \
RIA.rw1 = ((unsigned long)val >> 8) & 0xff; \
RIA.rw1 = ((unsigned long)val >> 16) & 0xff; \
RIA.rw1 = ((unsigned long)val >> 24) & 0xff; \
break; \
}
typedef struct
{
unsigned char x_wrap; // bool
unsigned char y_wrap; // bool
int x_pos_px;
int y_pos_px;
int width_chars;
int height_chars;
unsigned xram_data_ptr;
unsigned xram_palette_ptr;
unsigned xram_font_ptr;
} vga_mode1_config_t;
typedef struct
{
unsigned char x_wrap; // bool
unsigned char y_wrap; // bool
int x_pos_px;
int y_pos_px;
int width_tiles;
int height_tiles;
unsigned xram_data_ptr;
unsigned xram_palette_ptr;
unsigned xram_tile_ptr;
} vga_mode2_config_t;
typedef struct
{
unsigned char x_wrap; // bool
unsigned char y_wrap; // bool
int x_pos_px;
int y_pos_px;
int width_px;
int height_px;
unsigned xram_data_ptr;
unsigned xram_palette_ptr;
} vga_mode3_config_t;
typedef struct
{
int x_pos_px;
int y_pos_px;
unsigned xram_sprite_ptr;
unsigned char log_size;
unsigned char has_opacity_metadata; // bool
} vga_mode4_sprite_t;
typedef struct
{
int transform[6];
int x_pos_px;
int y_pos_px;
unsigned xram_sprite_ptr;
unsigned char log_size;
unsigned char has_opacity_metadata; // bool
} vga_mode4_asprite_t;
/* Values in __oserror are the union of these FatFs errors and errno.h */
typedef enum
{
FR_OK = 32, /* Succeeded */
FR_DISK_ERR, /* A hard error occurred in the low level disk I/O layer */
FR_INT_ERR, /* Assertion failed */
FR_NOT_READY, /* The physical drive cannot work */
FR_NO_FILE, /* Could not find the file */
FR_NO_PATH, /* Could not find the path */
FR_INVALID_NAME, /* The path name format is invalid */
FR_DENIED, /* Access denied due to prohibited access or directory full */
FR_EXIST, /* Access denied due to prohibited access */
FR_INVALID_OBJECT, /* The file/directory object is invalid */
FR_WRITE_PROTECTED, /* The physical drive is write protected */
FR_INVALID_DRIVE, /* The logical drive number is invalid */
FR_NOT_ENABLED, /* The volume has no work area */
FR_NO_FILESYSTEM, /* There is no valid FAT volume */
FR_MKFS_ABORTED, /* The f_mkfs() aborted due to any problem */
FR_TIMEOUT, /* Could not get a grant to access the volume within defined period */
FR_LOCKED, /* The operation is rejected according to the file sharing policy */
FR_NOT_ENOUGH_CORE, /* LFN working buffer could not be allocated */
FR_TOO_MANY_OPEN_FILES, /* Number of open files > FF_FS_LOCK */
FR_INVALID_PARAMETER /* Given parameter is invalid */
} FRESULT;
#endif /* _RP6502_H */

View File

@@ -123,6 +123,13 @@ struct ser_params {
unsigned char handshake; /* Type of handshake to use */
};
/* The name of the standard serial driver for a platform */
extern const char ser_stddrv[];
/* The address of the static standard serial driver for a platform */
extern const void ser_static_stddrv[];
/*****************************************************************************/
/* Code */
@@ -136,7 +143,7 @@ unsigned char __fastcall__ ser_load_driver (const char* driver);
unsigned char ser_unload (void);
/* Uninstall, then unload the currently loaded driver. */
unsigned char __fastcall__ ser_install (void* driver);
unsigned char __fastcall__ ser_install (const void* driver);
/* Install an already loaded driver. Return an error code. */
unsigned char ser_uninstall (void);
@@ -148,7 +155,7 @@ unsigned char __fastcall__ ser_open (const struct ser_params* params);
/* "Open" the port by setting the port parameters and enable interrupts. */
unsigned char ser_close (void);
/* "Close" the port. Clear buffers and and disable interrupts. */
/* "Close" the port. Clear buffers and disable interrupts. */
unsigned char __fastcall__ ser_get (char* b);
/* Get a character from the serial port. If no characters are available, the
@@ -171,6 +178,3 @@ unsigned char __fastcall__ ser_ioctl (unsigned char code, void* data);
/* End of serial.h */
#endif

View File

@@ -42,8 +42,8 @@ typedef char jmp_buf [5];
int __fastcall__ _setjmp (jmp_buf buf);
#define setjmp _setjmp /* ISO insists on a macro */
int __fastcall__ __setjmp (jmp_buf buf);
#define setjmp __setjmp /* ISO insists on a macro */
void __fastcall__ longjmp (jmp_buf buf, int retval) __attribute__((noreturn));

View File

@@ -7,7 +7,7 @@
/* */
/* */
/* (C) 2002-2005, Ullrich von Bassewitz */
/* R<EFBFBD>merstra<EFBFBD>e 52 */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
@@ -45,12 +45,12 @@ typedef unsigned char sig_atomic_t;
typedef void __fastcall__ (*__sigfunc) (int);
/* Functions that implement SIG_IGN and SIG_DFL */
void __fastcall__ _sig_ign (int);
void __fastcall__ _sig_dfl (int);
void __fastcall__ __sig_ign (int);
void __fastcall__ __sig_dfl (int);
/* Standard signal handling functions */
#define SIG_DFL _sig_dfl
#define SIG_IGN _sig_ign
#define SIG_DFL __sig_dfl
#define SIG_IGN __sig_ign
#define SIG_ERR ((__sigfunc) 0x0000)
/* Signal numbers */

136
include/sim65.h Normal file
View File

@@ -0,0 +1,136 @@
/*****************************************************************************/
/* */
/* sim65.h */
/* */
/* Definitions for the sim6502 and sim65c02 targets */
/* */
/* */
/* */
/* (C) 2025 Sidney Cadot */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
#ifndef _SIM65_H
#define _SIM65_H
/* Check that we include this file while compiling to a compatible target. */
#if !defined(__SIM6502__) && !defined(__SIM65C02__)
# error This module may only be used when compiling for the sim6502 or sim65c02 targets!
#endif
#include <stdint.h>
/* The sim65 targets (sim6502, sim65c02) have a peripheral memory aperture located at
* address range 0xFFC0 .. 0xFFDF. Currently, the following peripherals are located
* inside that memory apeture:
*
* $FFC0 .. $FFC9 "counter" peripheral
* $FFCA .. $FFCB "sim65 control" peripheral
* $FFCC .. $FFDF (currently unused)
*
* The "peripherals" structure below corresponds to the register layout of the currently
* defined peripherals in this memory range. Combined with the fact that the sim6502 and
* sim65c02 linker configuration files define the "peripherals" symbol to be fixed at
* address $FFC0, this provides easy-to-use and efficient access to the peripheral registers.
*
* After including "sim65.h", it is possible for a C program to do things like:
*
* {
* peripherals.counter.latch = 0;
* peripherals.sim65.cpu_mode = SIM65_CPU_MODE_6502X;
* peripherals.sim65.trace_mode = SIM65_TRACE_MODE_ENABLE_FULL;
* }
*
* Note that "peripherals" variable is declared volatile. This instructs a C compiler to
* forego optimizations on memory accesses to the variable. However, CC65 currently ignores
* the volatile attribute. Fortunately, it is not smart with respect to optimizing
* memory accesses, so accessing the "peripherals" fields works fine in practice.
*/
extern volatile struct {
struct {
uint8_t latch;
uint8_t select;
union {
uint8_t value [8]; /* Access value as eight separate bytes. */
uint16_t value16 [4]; /* Access value as four 16-bit words. */
uint32_t value32 [2]; /* Access value as two 32-bit long words. */
};
} counter;
struct {
uint8_t cpu_mode;
uint8_t trace_mode;
} sim65;
} peripherals;
/* Values for the peripherals.counter.select field. */
#define COUNTER_SELECT_CLOCKCYCLE_COUNTER 0x00
#define COUNTER_SELECT_INSTRUCTION_COUNTER 0x01
#define COUNTER_SELECT_IRQ_COUNTER 0x02
#define COUNTER_SELECT_NMI_COUNTER 0x03
#define COUNTER_SELECT_WALLCLOCK_TIME 0x80
#define COUNTER_SELECT_WALLCLOCK_TIME_SPLIT 0x81
/* Values for the peripherals.sim65.cpu_mode field. */
#define SIM65_CPU_MODE_6502 0x00
#define SIM65_CPU_MODE_65C02 0x01
#define SIM65_CPU_MODE_6502X 0x02
/* Bitfield values for the peripherals.sim65.trace_mode field. */
#define SIM65_TRACE_MODE_FIELD_INSTR_COUNTER 0x40
#define SIM65_TRACE_MODE_FIELD_CLOCK_COUNTER 0x20
#define SIM65_TRACE_MODE_FIELD_PC 0x10
#define SIM65_TRACE_MODE_FIELD_INSTR_BYTES 0x08
#define SIM65_TRACE_MODE_FIELD_INSTR_ASSEMBLY 0x04
#define SIM65_TRACE_MODE_FIELD_CPU_REGISTERS 0x02
#define SIM65_TRACE_MODE_FIELD_CC65_SP 0x01
/* Values for the peripherals.sim65.trace_mode field that fully disable / enable tracing. */
#define SIM65_TRACE_MODE_DISABLE 0x00
#define SIM65_TRACE_MODE_ENABLE_FULL 0x7F
/* Convenience macros to enable / disable tracing at runtime. */
#define TRACE_ON() do peripherals.sim65.trace_mode = SIM65_TRACE_MODE_ENABLE_FULL; while(0)
#define TRACE_OFF() do peripherals.sim65.trace_mode = SIM65_TRACE_MODE_DISABLE; while(0)
/* Convenience macro to query the CPU mode at runtime. */
#define GET_CPU_MODE() peripherals.sim65.cpu_mode
/* Convenience macro to set the CPU mode at runtime.
*
* Use SIM65_CPU_MODE_6502, SIM65_CPU_MODE_65C02, or SIM65_CPU_MODE_6502 as argument.
*
* Important Note:
*
* When running in a program compiled for the "sim6502" target, it is safe to switch to
* 65C02 or 6502X mode, since the runtime library will only use plain 6502 opcodes, and
* those work the same in 65C02 and 6502X mode.
*
* However, when running in a program compiled for the "sim65c02" target, it is NOT safe
* to switch to 6502 or 6502X mode, since many routines in the runtime library use
* 65C02-specific opcodes, and these will not work as expected when the CPU is switched
* to 6502 or 6502X mode. When such an instruction is encountered, the program will
* exhibit undefined behavior.
*/
#define SET_CPU_MODE(mode) do peripherals.sim65.cpu_mode = mode; while(0)
/* End of sim65.h */
#endif

View File

@@ -7,7 +7,7 @@
/* */
/* */
/* (C) 1998-2004 Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */

View File

@@ -53,9 +53,8 @@ typedef unsigned size_t;
#endif
/* NULL pointer */
#ifndef _HAVE_NULL
#define NULL 0
#define _HAVE_NULL
#ifndef NULL
#define NULL ((void *) 0)
#endif
/* offsetof macro */
@@ -65,6 +64,3 @@ typedef unsigned size_t;
/* End of stddef.h */
#endif

View File

@@ -52,15 +52,15 @@ typedef unsigned char uint8_t;
typedef unsigned uint16_t;
typedef unsigned long uint32_t;
#define INT8_MIN ((int8_t) 0x80)
#define INT8_MAX ((int8_t) 0x7F)
#define INT16_MIN ((int16_t) 0x8000)
#define INT16_MAX ((int16_t) 0x7FFF)
#define INT32_MIN ((int32_t) 0x80000000)
#define INT32_MAX ((int32_t) 0x7FFFFFFF)
#define UINT8_MAX ((uint8_t) 0xFF)
#define UINT16_MAX ((uint16_t) 0xFFFF)
#define UINT32_MAX ((uint32_t) 0xFFFFFFFF)
#define INT8_MIN -128
#define INT8_MAX 127
#define INT16_MIN (-32767 - 1)
#define INT16_MAX 32767
#define INT32_MIN (-2147483647L - 1L)
#define INT32_MAX 2147483647L
#define UINT8_MAX 255
#define UINT16_MAX 65535U
#define UINT32_MAX 4294967295UL
/* Minimum-width integer types */
typedef signed char int_least8_t;
@@ -70,15 +70,15 @@ typedef unsigned char uint_least8_t;
typedef unsigned uint_least16_t;
typedef unsigned long uint_least32_t;
#define INT_LEAST8_MIN ((int_least8_t) 0x80)
#define INT_LEAST8_MAX ((int_least8_t) 0x7F)
#define INT_LEAST16_MIN ((int_least16_t) 0x8000)
#define INT_LEAST16_MAX ((int_least16_t) 0x7FFF)
#define INT_LEAST32_MIN ((int_least32_t) 0x80000000)
#define INT_LEAST32_MAX ((int_least32_t) 0x7FFFFFFF)
#define UINT_LEAST8_MAX ((uint_least8_t) 0xFF)
#define UINT_LEAST16_MAX ((uint_least16_t) 0xFFFF)
#define UINT_LEAST32_MAX ((uint_least32_t) 0xFFFFFFFF)
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
/* Fastest minimum-width integer types */
typedef signed char int_fast8_t;
@@ -88,40 +88,40 @@ typedef unsigned char uint_fast8_t;
typedef unsigned uint_fast16_t;
typedef unsigned long uint_fast32_t;
#define INT_FAST8_MIN ((int_fast8_t) 0x80)
#define INT_FAST8_MAX ((int_fast8_t) 0x7F)
#define INT_FAST16_MIN ((int_fast16_t) 0x8000)
#define INT_FAST16_MAX ((int_fast16_t) 0x7FFF)
#define INT_FAST32_MIN ((int_fast32_t) 0x80000000)
#define INT_FAST32_MAX ((int_fast32_t) 0x7FFFFFFF)
#define UINT_FAST8_MAX ((uint_fast8_t) 0xFF)
#define UINT_FAST16_MAX ((uint_fast16_t) 0xFFFF)
#define UINT_FAST32_MAX ((uint_fast32_t) 0xFFFFFFFF)
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MIN INT16_MIN
#define INT_FAST16_MAX INT16_MAX
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST32_MAX INT32_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT16_MAX
#define UINT_FAST32_MAX UINT32_MAX
/* Integer types capable of holding object pointers */
typedef int intptr_t;
typedef unsigned uintptr_t;
#define INTPTR_MIN ((intptr_t)0x8000)
#define INTPTR_MAX ((intptr_t)0x7FFF)
#define UINTPTR_MAX ((uintptr_t) 0xFFFF)
#define INTPTR_MIN INT16_MIN
#define INTPTR_MAX INT16_MAX
#define UINTPTR_MAX UINT16_MAX
/* Greatest width integer types */
typedef long intmax_t;
typedef unsigned long uintmax_t;
#define INTMAX_MIN ((intmax_t) 0x80000000)
#define INTMAX_MAX ((intmax_t) 0x7FFFFFFF)
#define UINTMAX_MAX ((uintmax_t) 0xFFFFFFFF)
#define INTMAX_MIN INT32_MIN
#define INTMAX_MAX INT32_MAX
#define UINTMAX_MAX UINT32_MAX
/* Limits of other integer types */
#define PTRDIFF_MIN ((int) 0x8000)
#define PTRDIFF_MAX ((int) 0x7FFF)
#define PTRDIFF_MIN INT16_MIN
#define PTRDIFF_MAX INT16_MAX
#define SIG_ATOMIC_MIN ((unsigned char) 0x00)
#define SIG_ATOMIC_MAX ((unsigned char) 0xFF)
#define SIG_ATOMIC_MIN 0
#define SIG_ATOMIC_MAX UINT8_MAX
#define SIZE_MAX 0xFFFF
#define SIZE_MAX UINT16_MAX
/* Macros for minimum width integer constants */
#define INT8_C(c) c

View File

@@ -37,11 +37,20 @@
#define _STDIO_H
/* NULL pointer */
#ifndef NULL
#define NULL ((void *) 0)
#endif
#include <stddef.h>
#include <stdarg.h>
/* size_t is needed */
#ifndef _HAVE_size_t
#define _HAVE_size_t
typedef unsigned size_t;
#endif
/* stdio.h should not define va_list, so we use an equivalent type in the
compiler namespace instead */
typedef unsigned char* __va_list;
/* Types */
typedef struct _FILE FILE;
@@ -64,20 +73,28 @@ extern FILE* stderr;
#define SEEK_SET 2
#define TMP_MAX 256
/* Standard defines that are platform dependent */
/* These defines that are platform dependent */
/* FILENAME_MAX is defined as the same value as PATH_MAX in limits.h, but we
are not allowed to include limits.h here */
#if defined(__APPLE2__)
# define FILENAME_MAX (64+1)
# define FILENAME_MAX (64+1)
#elif defined(__ATARI__)
# define FILENAME_MAX (12+1)
# define FILENAME_MAX (63+1)
#elif defined(__CBM__)
# define FILENAME_MAX (255) /* should be 256+1, see libsrc/common/_cmd.s why it's not */
#elif defined(__LUNIX__)
# define FILENAME_MAX (80+1)
# define FILENAME_MAX (80+1)
#elif defined(__TELESTRAT__)
# define FILENAME_MAX (50+1)
# define FILENAME_MAX (50+1)
#elif defined(__SIM6502__)
# define FILENAME_MAX (1024+1)
#elif defined(__SIM65C02__)
# define FILENAME_MAX (1024+1)
#else
# define FILENAME_MAX (16+1)
# define FILENAME_MAX (16+1)
#endif
#define L_tmpnam FILENAME_MAX
#define L_tmpnam FILENAME_MAX
/*****************************************************************************/
@@ -117,23 +134,27 @@ int __fastcall__ rename (const char* oldname, const char* newname);
int snprintf (char* buf, size_t size, const char* format, ...);
int sprintf (char* buf, const char* format, ...);
int __fastcall__ ungetc (int c, FILE* f);
int __fastcall__ vfprintf (FILE* f, const char* format, va_list ap);
int __fastcall__ vprintf (const char* format, va_list ap);
int __fastcall__ vsnprintf (char* buf, size_t size, const char* format, va_list ap);
int __fastcall__ vsprintf (char* buf, const char* format, va_list ap);
int __fastcall__ vfprintf (FILE* f, const char* format, __va_list ap);
int __fastcall__ vprintf (const char* format, __va_list ap);
int __fastcall__ vsnprintf (char* buf, size_t size, const char* format, __va_list ap);
int __fastcall__ vsprintf (char* buf, const char* format, __va_list ap);
int scanf (const char* format, ...);
int fscanf (FILE* f, const char* format, ...);
int sscanf (const char* s, const char* format, ...);
int __fastcall__ vscanf (const char* format, va_list ap);
int __fastcall__ vsscanf (const char* s, const char* format, va_list ap);
int __fastcall__ vfscanf (FILE* f, const char* format, va_list ap);
int __fastcall__ vscanf (const char* format, __va_list ap);
int __fastcall__ vsscanf (const char* s, const char* format, __va_list ap);
int __fastcall__ vfscanf (FILE* f, const char* format, __va_list ap);
#if __CC65_STD__ == __CC65_STD_CC65__
FILE* __fastcall__ fdopen (int fd, const char* mode); /* Unix */
int __fastcall__ fileno (FILE* f); /* Unix */
#endif
void __fastcall__ _poserror (const char* msg); /* cc65 */
void __fastcall__ __poserror (const char* msg); /* cc65 */
#if __CC65_STD__ == __CC65_STD_CC65__
/* define old name with one underscore for backwards compatibility */
#define _poserror __poserror
#endif
/* Masking macros for some functions */
#define getc(f) fgetc (f) /* ANSI */

View File

@@ -44,10 +44,27 @@ typedef unsigned size_t;
#define _HAVE_size_t
#endif
/* NULL pointer */
#ifndef NULL
#define NULL ((void *) 0)
#endif
/* Standard exit codes */
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
#if __CC65_STD__ == __CC65_STD_CC65__
/* Those non-standard cc65 exit constants definitions are in addition
** to the EXIT_SUCCESS and EXIT_FAILURE constants, which should not be
** redefined
*/
#define EXIT_ASSERT 2
#define EXIT_ABORT 3
#endif
/* Return type of the div function */
typedef struct {
int rem;
@@ -80,24 +97,44 @@ int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size);
*/
#endif
void __fastcall__ _heapadd (void* mem, size_t size);
void __fastcall__ __heapadd (void* mem, size_t size);
/* Add a block to the heap */
#if __CC65_STD__ == __CC65_STD_CC65__
/* define old name with one underscore for backwards compatibility */
#define _heapadd __heapadd
#endif
size_t __fastcall__ _heapblocksize (const void* block);
size_t __fastcall__ __heapblocksize (const void* block);
/* Return the size of an allocated block */
#if __CC65_STD__ == __CC65_STD_CC65__
/* define old name with one underscore for backwards compatibility */
#define _heapblocksize __heapblocksize
#endif
size_t _heapmemavail (void);
size_t __heapmemavail (void);
/* Return the total free heap space */
#if __CC65_STD__ == __CC65_STD_CC65__
/* define old name with one underscore for backwards compatibility */
#define _heapmemavail __heapmemavail
#endif
size_t _heapmaxavail (void);
size_t __heapmaxavail (void);
/* Return the size of the largest free block on the heap */
#if __CC65_STD__ == __CC65_STD_CC65__
/* define old name with one underscore for backwards compatibility */
#define _heapmaxavail __heapmaxavail
#endif
/* Random numbers */
#define RAND_MAX 0x7FFF
int rand (void);
void __fastcall__ srand (unsigned seed);
void _randomize (void); /* Non-standard */
void __randomize (void); /* Non-standard */
#if __CC65_STD__ == __CC65_STD_CC65__
/* define old name with one underscore for backwards compatibility */
#define _randomize __randomize
#endif
/* Other standard stuff */
void abort (void) __attribute__ ((noreturn));
@@ -118,7 +155,11 @@ unsigned long __fastcall__ strtoul (const char* nptr, char** endptr, int base);
int __fastcall__ system (const char* s);
/* Non-ANSI functions */
void __fastcall__ _swap (void* p, void* q, size_t size);
void __fastcall__ __swap (void* p, void* q, size_t size);
#if __CC65_STD__ == __CC65_STD_CC65__
/* define old name with one underscore for backwards compatibility */
#define _swap __swap
#endif
#if __CC65_STD__ == __CC65_STD_CC65__
char* __fastcall__ itoa (int val, char* buf, int radix);
char* __fastcall__ utoa (unsigned val, char* buf, int radix);
@@ -131,6 +172,3 @@ int __fastcall__ putenv (char* s);
/* End of stdlib.h */
#endif

View File

@@ -36,11 +36,16 @@
#ifndef _STRING_H
#define _STRING_H
/* NULL pointer */
#ifndef NULL
#define NULL ((void *) 0)
#endif
#include <stddef.h>
/* size_t is needed */
#ifndef _HAVE_size_t
#define _HAVE_size_t
typedef unsigned size_t;
#endif
char* __fastcall__ strcat (char* dest, const char* src);
char* __fastcall__ strchr (const char* s, int c);
@@ -68,7 +73,7 @@ void* __fastcall__ memset (void* s, int c, size_t count);
/* The following is an internal function, the compiler will replace memset
** with it if the fill value is zero. Never use this one directly!
*/
void* __fastcall__ _bzero (void* ptr, size_t n);
void* __fastcall__ __bzero (void* ptr, size_t n);
/* Non standard: */
#if __CC65_STD__ == __CC65_STD_CC65__
@@ -76,18 +81,24 @@ void __fastcall__ bzero (void* ptr, size_t n); /* BSD */
char* __fastcall__ strdup (const char* s); /* SYSV/BSD */
int __fastcall__ stricmp (const char* s1, const char* s2); /* DOS/Windows */
int __fastcall__ strcasecmp (const char* s1, const char* s2); /* Same for Unix */
char* __fastcall__ strcasestr (const char* str, const char* substr);
int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count); /* DOS/Windows */
int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count); /* Same for Unix */
size_t __fastcall__ strnlen (const char* s, size_t maxlen); /* POSIX.1-2008 */
char* __fastcall__ strlwr (char* s);
char* __fastcall__ strlower (char* s);
char* __fastcall__ strupr (char* s);
char* __fastcall__ strupper (char* s);
char* __fastcall__ strqtok (char* s1, const char* s2);
char* __fastcall__ stpcpy (char* dest, const char* src);
#endif
const char* __fastcall__ _stroserror (unsigned char errcode);
const char* __fastcall__ __stroserror (unsigned char errcode);
/* Map an operating system error number to an error message. */
#if __CC65_STD__ == __CC65_STD_CC65__
/* define old name with one underscore for backwards compatibility */
#define _stroserror __stroserror
#endif
/* End of string.h */

165
include/sym1.h Normal file
View File

@@ -0,0 +1,165 @@
/*****************************************************************************/
/* */
/* sym1.h */
/* */
/* Sym-1 system-specific definitions */
/* */
/* */
/* */
/* (C) 2020 Wayne Parham */
/* EMail: wayne@parhamdata.com */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
#ifndef _SYM1_H
#define _SYM1_H
/* Check for errors */
#if !defined(__SYM1__)
# error This module may only be used when compiling for the Sym-1!
#endif
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/* Display character definitions */
#define DISP_1 0x06 // '1'
#define DISP_2 0x5B // '2'
#define DISP_3 0x4F // '3'
#define DISP_4 0x66 // '4'
#define DISP_5 0x6D // '5'
#define DISP_6 0x7C // '6'
#define DISP_7 0x07 // '7'
#define DISP_8 0x7F // '8'
#define DISP_9 0x67 // '9'
#define DISP_0 0x3F // '0'
#define DISP_A 0x77 // 'A'
#define DISP_b 0x7C // 'b'
#define DISP_C 0x39 // 'C'
#define DISP_c 0x58 // 'c'
#define DISP_d 0x5E // 'd'
#define DISP_E 0x79 // 'E'
#define DISP_e 0x7B // 'e'
#define DISP_F 0x71 // 'F'
#define DISP_G 0x7D // 'G'
#define DISP_g 0x6F // 'g'
#define DISP_H 0x76 // 'H'
#define DISP_h 0x74 // 'h'
#define DISP_I 0x06 // 'I'
#define DISP_i 0x04 // 'i'
#define DISP_J 0x1E // 'J'
#define DISP_K 0x74 // 'K'
#define DISP_L 0x38 // 'L'
#define DISP_M_1 0x33 // 'M'
#define DISP_M_2 0x27 // 2nd half
#define DISP_n 0x54 // 'n'
#define DISP_O 0x3F // 'O'
#define DISP_o 0x5C // 'o'
#define DISP_P 0x73 // 'P'
#define DISP_q 0x67 // 'q'
#define DISP_r 0x50 // 'r'
#define DISP_S 0x6D // 'S'
#define DISP_t 0x46 // 't'
#define DISP_U 0x3E // 'U'
#define DISP_u 0x1C // 'u'
#define DISP_V_1 0x64 // 'V'
#define DISP_V_2 0x52 // 2nd half
#define DISP_W_1 0x3C // 'W'
#define DISP_W_2 0x1E // 2nd half
#define DISP_Y 0x6E // 'Y'
#define DISP_Z 0x5B // 'Z'
#define DISP_SPACE 0x00 // ' '
#define DISP_PERIOD 0x80 // '.'
#define DISP_HYPHEN 0x40 // '-'
#define DISP_APOSTR 0x20 // '''
#define DISP_EQUAL 0x41 // '='
#define DISP_3_BAR 0x49 // '='
#define DISP_BOTTOM 0x08 // '_'
#define DISP_TOP 0x01 // Top segment
#define DISP_LEFT 0x30 // '|' Left side, both segments
#define DISP_RIGHT 0x06 // '|' Right side, both segments
#define DISP_DEGREE 0x63 // 'o' An 'o' character in the upper segments
#define DISP_HAT 0x23 // 'n' An 'n' character in the upper segments
#define DISP_FORK 0x62 // 'u' A 'u' character in the upper segments
#define DISP_SLASH 0x51 // '/'
#define DISP_BACKSLASH 0x34 // '\'
#define DISP_TOP_RIGHT 0x02 // Top right segment
#define DISP_TOP_LEFT 0x20 // Top left segment
#define DISP_LOW_RIGHT 0x04 // Lower right segment
#define DISP_LOW_LEFT 0x10 // Lower left segment
/*****************************************************************************/
/* Hardware */
/*****************************************************************************/
#include <_6522.h>
#define VIA1 (*(struct __6522*)0xA000) // U25
#define VIA2 (*(struct __6522*)0xA800) // U28
#define VIA3 (*(struct __6522*)0xAC00) // U29
struct _display {
unsigned char d0; // left-most seven-segment display
unsigned char d1; // second seven-segment display
unsigned char d2; // third seven-segment display
unsigned char d3; // fouth seven-segment display
unsigned char d4; // fifth seven-segment display
unsigned char d5; // sixth seven-segment display
unsigned char d6; // buffer byte to the right
};
#define DISPLAY (*(struct _display*)0xA640)
/*****************************************************************************/
/* Code */
/*****************************************************************************/
void beep (void);
/* Beep sound. */
void fdisp (void);
/* Flash display */
int __fastcall__ loadt (unsigned char);
/* Read from tape */
int __fastcall__ dumpt (unsigned char, const void*, const void*);
/* Write to tape */
/* End of sym1.h */
#endif

View File

@@ -2,15 +2,18 @@
/* */
/* stat.h */
/* */
/* Constants for the mode argument of open and creat */
/* stat(2) definition */
/* */
/* */
/* */
/* (C) 2003 Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* (C) 2023 Colin Leroy-Mira */
/* EMail: colin@colino.net */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
@@ -36,6 +39,10 @@
#ifndef _STAT_H
#define _STAT_H
#include <time.h>
#include <target.h>
#include <sys/types.h>
/*****************************************************************************/
@@ -47,6 +54,30 @@
#define S_IREAD 0x01
#define S_IWRITE 0x02
#define S_IFMT 0x03
struct stat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
off_t st_size;
struct timespec st_atim;
struct timespec st_ctim;
struct timespec st_mtim;
#ifdef __APPLE2__
unsigned char st_access;
unsigned char st_type;
unsigned int st_auxtype;
unsigned char st_storagetype;
unsigned int st_blocks;
struct datetime st_mtime;
struct datetime st_ctime;
#endif
};
/*****************************************************************************/
@@ -55,5 +86,9 @@
int __fastcall__ stat (const char* pathname, struct stat* statbuf);
/* End of stat.h */
#endif

74
include/sys/statvfs.h Normal file
View File

@@ -0,0 +1,74 @@
/*****************************************************************************/
/* */
/* statvfs.h */
/* */
/* statvfs(3) definition */
/* */
/* */
/* */
/* (C) 2023 Colin Leroy-Mira */
/* EMail: colin@colino.net */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
/* warranty. In no event will the authors be held liable for any damages */
/* arising from the use of this software. */
/* */
/* Permission is granted to anyone to use this software for any purpose, */
/* including commercial applications, and to alter it and redistribute it */
/* freely, subject to the following restrictions: */
/* */
/* 1. The origin of this software must not be misrepresented; you must not */
/* claim that you wrote the original software. If you use this software */
/* in a product, an acknowledgment in the product documentation would be */
/* appreciated but is not required. */
/* 2. Altered source versions must be plainly marked as such, and must not */
/* be misrepresented as being the original software. */
/* 3. This notice may not be removed or altered from any source */
/* distribution. */
/* */
/*****************************************************************************/
#ifndef _STATVFS_H
#define _STATVFS_H
#include <sys/types.h>
/*****************************************************************************/
/* Data */
/*****************************************************************************/
struct statvfs {
unsigned long f_bsize;
unsigned long f_frsize;
fsblkcnt_t f_blocks;
fsblkcnt_t f_bfree;
fsblkcnt_t f_bavail;
fsfilcnt_t f_files;
fsfilcnt_t f_ffree;
fsfilcnt_t f_favail;
unsigned long f_fsid;
unsigned long f_flag;
unsigned long f_namemax;
};
/*****************************************************************************/
/* Code */
/*****************************************************************************/
int __fastcall__ statvfs (const char* pathname, struct statvfs* buf);
/* End of statvfs.h */
#endif

View File

@@ -7,7 +7,7 @@
/* */
/* */
/* (C) 2003 Ullrich von Bassewitz */
/* R<EFBFBD>merstrasse 52 */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
@@ -50,6 +50,46 @@
typedef long int off_t;
#endif
#ifndef _HAVE_dev_t
#define _HAVE_dev_t
typedef unsigned long int dev_t;
#endif
#ifndef _HAVE_ino_t
#define _HAVE_ino_t
typedef unsigned long int ino_t;
#endif
#ifndef _HAVE_nlink_t
#define _HAVE_nlink_t
typedef unsigned long int nlink_t;
#endif
#ifndef _HAVE_uid_t
#define _HAVE_uid_t
typedef unsigned char uid_t;
#endif
#ifndef _HAVE_gid_t
#define _HAVE_gid_t
typedef unsigned char gid_t;
#endif
#ifndef _HAVE_mode_t
#define _HAVE_mode_t
typedef unsigned char mode_t;
#endif
#ifndef _HAVE_fsblkcnt_t
#define _HAVE_fsblkcnt_t
typedef unsigned long int fsblkcnt_t;
#endif
#ifndef _HAVE_fsfilcnt_t
#define _HAVE_fsfilcnt_t
typedef unsigned long int fsfilcnt_t;
#endif
/*****************************************************************************/
@@ -60,6 +100,3 @@ typedef long int off_t;
/* End of types.h */
#endif

View File

@@ -41,7 +41,7 @@
/*****************************************************************************/
/* Data */
/*****************************************************************************/
/*

View File

@@ -43,6 +43,8 @@
# include <atari2600.h>
#elif defined(__ATARI5200__)
# include <atari5200.h>
#elif defined(__ATARI7800__)
# include <atari7800.h>
#elif defined(__ATMOS__)
# include <atmos.h>
#elif defined(__CBM__)

View File

@@ -55,9 +55,6 @@
#define TGI_COLOR_RED 7
extern void telestrat_228_200_3_tgi[];
extern void telestrat_240_200_2_tgi[]; /* Referred to by tgi_static_stddrv[] */
/* Define hardware */
#include <_6522.h>
#define VIA (*(struct __6522*)0x300)
@@ -88,6 +85,8 @@ extern void telestrat_240_200_2_tgi[]; /* Referred to by tgi_static_stddrv[
#define CH_LTEE '+'
#define CH_RTEE '+'
#define CH_CROSS '+'
#define CH_HLINE '-'
#define CH_VLINE '|'
#define CH_CURS_UP 11
#define CH_CURS_DOWN 10
#define CH_CURS_LEFT 8
@@ -98,6 +97,21 @@ extern void telestrat_240_200_2_tgi[]; /* Referred to by tgi_static_stddrv[
#define CH_LIRA 95
#define CH_ESC 27
/* Masks for joy_read */
#define JOY_UP_MASK 0x10
#define JOY_DOWN_MASK 0x08
#define JOY_LEFT_MASK 0x02
#define JOY_RIGHT_MASK 0x01
#define JOY_BTN_1_MASK 0x04
#define JOY_FIRE_MASK JOY_BTN_1_MASK
#define JOY_FIRE(v) ((v) & JOY_FIRE_MASK)
/* The addresses of the static drivers */
extern void telestrat_joy[]; /* Referred to by joy_static_stddrv[] */
extern void telestrat_228_200_3_tgi[];
extern void telestrat_240_200_2_tgi[]; /* Referred to by tgi_static_stddrv[] */
void oups();
@@ -108,6 +122,8 @@ void explode();
void kbdclick1();
/* The following #defines will cause the matching functions calls in conio.h
** to be overlaid by macros with the same names, saving the function call
** overhead.
*/
#define _bordercolor(color) COLOR_BLACK

View File

@@ -82,7 +82,7 @@ void tgi_unload (void);
** necessary.
*/
void __fastcall__ tgi_install (void* driver);
void __fastcall__ tgi_install (const void* driver);
/* Install an already loaded driver. */
void tgi_uninstall (void);
@@ -134,7 +134,7 @@ void __fastcall__ tgi_setdrawpage (unsigned char page);
/* Set the drawable page. Will set an error if the page is not available. */
unsigned char tgi_getcolorcount (void);
/* Get the number of available colors. */
/* Get the number of available colors. Zero means 256 colors. */
unsigned char tgi_getmaxcolor (void);
/* Return the maximum supported color number (the number of colors would
@@ -216,7 +216,7 @@ void __fastcall__ tgi_arc (int x, int y, unsigned char rx, unsigned char ry,
/* Draw an ellipse arc with center at x/y and radii rx/ry using the current
** drawing color. The arc covers the angle between sa and ea (startangle and
** endangle), which must be in the range 0..360 (otherwise the function may
** bevave unextectedly).
** behave unexpectedly).
*/
void __fastcall__ tgi_pieslice (int x, int y, unsigned char rx, unsigned char ry,

View File

@@ -37,11 +37,15 @@
#define _TIME_H
/* Forward declaration for target.h */
typedef unsigned long time_t;
typedef unsigned long clock_t;
/* NULL pointer */
#ifndef _HAVE_NULL
#define NULL 0
#define _HAVE_NULL
#ifndef NULL
#define NULL ((void *) 0)
#endif
/* size_t is needed */
@@ -50,10 +54,6 @@
typedef unsigned size_t;
#endif
typedef unsigned long time_t;
typedef unsigned long clock_t;
typedef unsigned char clockid_t;
/* Structure for broken down time */
struct tm {
int tm_sec;
@@ -67,61 +67,33 @@ struct tm {
int tm_isdst;
};
/* Structure for seconds and nanoseconds */
struct timespec {
time_t tv_sec;
long tv_nsec;
};
/* Timezone representation, default is UTC */
extern struct _timezone {
char daylight; /* True if daylight savings time active */
long timezone; /* Number of seconds behind UTC */
char tzname[5]; /* Name of timezone, e.g. CET */
char dstname[5]; /* Name when daylight true, e.g. CEST */
} _tz;
#if defined(__ATARI__)
/* The clock depends on the video standard, so read it at runtime */
unsigned _clocks_per_sec (void);
# define CLK_TCK _clocks_per_sec()
# define CLOCKS_PER_SEC _clocks_per_sec()
#elif defined(__ATARI5200__)
# define CLK_TCK 60 /* POSIX */
# define CLOCKS_PER_SEC 60 /* ANSI */
#if defined(__ATARI5200__)
# define CLOCKS_PER_SEC 60
#elif defined(__ATMOS__)
# define CLK_TCK 100 /* POSIX */
# define CLOCKS_PER_SEC 100 /* ANSI */
# define CLOCKS_PER_SEC 100
#elif defined(__CBM__)
# if defined(__CBM510__) || defined(__CBM610__)
/* The 510/610 gets its clock from the AC current */
# define CLK_TCK 50 /* POSIX */
# define CLOCKS_PER_SEC 50 /* ANSI */
# define CLOCKS_PER_SEC 50
# else
# define CLK_TCK 60 /* POSIX */
# define CLOCKS_PER_SEC 60 /* ANSI */
# define CLOCKS_PER_SEC 60
# endif
#elif defined(__NES__)
# define CLK_TCK 50 /* POSIX */
# define CLOCKS_PER_SEC 50 /* ANSI */
# define CLOCKS_PER_SEC 50
#elif defined(__PCE__)
# define CLK_TCK 60 /* POSIX */
# define CLOCKS_PER_SEC 60 /* ANSI */
#elif defined(__GAMATE__)
# define CLK_TCK 135 /* POSIX */ /* FIXME */
# define CLOCKS_PER_SEC 135 /* ANSI */ /* FIXME */
#elif defined(__GEOS__)
# define CLK_TCK 1 /* POSIX */
# define CLOCKS_PER_SEC 1 /* ANSI */
#elif defined(__LYNX__)
/* The clock-rate depends on the video scan-rate;
** so, read it at run-time.
*/
extern clock_t _clk_tck (void);
# define CLK_TCK _clk_tck()
# define CLOCKS_PER_SEC _clk_tck()
# define CLOCKS_PER_SEC 60
#elif defined(__GAMATE__)
# define CLOCKS_PER_SEC 135 /* FIXME */
#elif defined(__GEOS__)
# define CLOCKS_PER_SEC 1
#elif defined (__RP6502__)
# define CLOCKS_PER_SEC 100
#elif defined(__TELESTRAT__)
# define CLOCKS_PER_SEC 10
#elif defined(__ATARI__) || defined (__LYNX__)
/* Read the clock rate at runtime */
clock_t __clocks_per_sec (void);
# define CLOCKS_PER_SEC __clocks_per_sec()
#endif
#define CLOCK_REALTIME 0
@@ -138,17 +110,34 @@ size_t __fastcall__ strftime (char* buf, size_t bufsize, const char* format, con
time_t __fastcall__ time (time_t* t);
#if __CC65_STD__ >= __CC65_STD_CC65__
typedef unsigned char clockid_t;
/* Structure for seconds and nanoseconds */
struct timespec {
time_t tv_sec;
long tv_nsec;
};
/* Timezone representation, default is UTC */
extern struct _timezone {
char daylight; /* True if daylight savings time active */
long timezone; /* Number of seconds behind UTC */
char tzname[5]; /* Name of timezone, e.g. CET */
char dstname[5]; /* Name when daylight true, e.g. CEST */
} _tz;
#define CLK_TCK CLOCKS_PER_SEC
/* POSIX function prototypes */
int __fastcall__ clock_getres (clockid_t clock_id, struct timespec *res);
int __fastcall__ clock_gettime (clockid_t clock_id, struct timespec *tp);
int __fastcall__ clock_settime (clockid_t clock_id, const struct timespec *tp);
#endif
/* End of time.h */
#endif

View File

@@ -2,12 +2,12 @@
/* */
/* vic20.h */
/* */
/* vic20 system specific definitions */
/* VIC-20 system-specific definitions */
/* */
/* */
/* */
/* (C) 1998-2004 Ullrich von Bassewitz */
/* R<EFBFBD>merstra<EFBFBD>e 52 */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
@@ -62,18 +62,43 @@
#define COLOR_WHITE 0x01
#define COLOR_RED 0x02
#define COLOR_CYAN 0x03
#define COLOR_VIOLET 0x04
#define COLOR_PURPLE 0x04
#define COLOR_GREEN 0x05
#define COLOR_BLUE 0x06
#define COLOR_YELLOW 0x07
/* Only the background and multi-color characters can have these colors. */
#define COLOR_ORANGE 0x08
#define COLOR_BROWN 0x09
#define COLOR_LIGHTRED 0x0A
#define COLOR_GRAY1 0x0B
#define COLOR_GRAY2 0x0C
#define COLOR_LIGHTORANGE 0x09
#define COLOR_PINK 0x0A
#define COLOR_LIGHTCYAN 0x0B
#define COLOR_LIGHTVIOLET 0x0C
#define COLOR_LIGHTGREEN 0x0D
#define COLOR_LIGHTBLUE 0x0E
#define COLOR_GRAY3 0x0F
#define COLOR_LIGHTYELLOW 0x0F
/* TGI color defines */
#define TGI_COLOR_BLACK COLOR_BLACK
#define TGI_COLOR_WHITE COLOR_WHITE
#define TGI_COLOR_RED COLOR_RED
#define TGI_COLOR_CYAN COLOR_CYAN
#define TGI_COLOR_PURPLE COLOR_PURPLE
#define TGI_COLOR_GREEN COLOR_GREEN
#define TGI_COLOR_BLUE COLOR_BLUE
#define TGI_COLOR_YELLOW COLOR_YELLOW
/* Only the background and multi-color graphics can have these colors. */
#define TGI_COLOR_ORANGE COLOR_ORANGE
#define TGI_COLOR_LIGHTORANGE COLOR_LIGHTORANGE
#define TGI_COLOR_PINK COLOR_PINK
#define TGI_COLOR_LIGHTCYAN COLOR_LIGHTCYAN
#define TGI_COLOR_LIGHTVIOLET COLOR_LIGHTVIOLET
#define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN
#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE
#define TGI_COLOR_LIGHTYELLOW COLOR_LIGHTYELLOW
/* tgi_ioctl() commands */
#define TGI_IOCTL_VIC20_SET_PATTERN 0x01 /* Set 8-byte pattern for tgi_bar(). */
@@ -108,5 +133,9 @@ extern void vic20_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
extern void vic20_rama_emd[];
extern void vic20_georam_emd[];
extern void vic20_hi_tgi[]; /* Referred to by tgi_static_stddrv[] */
/* End of vic20.h */
#endif

View File

@@ -114,7 +114,8 @@ int __fastcall__ uncompress (unsigned char* dest, unsigned* destLen,
*/
unsigned long __fastcall__ adler32 (unsigned long adler, const char* buf,
unsigned long __fastcall__ adler32 (unsigned long adler,
const unsigned char* buf,
unsigned len);
/*
@@ -140,7 +141,8 @@ unsigned long __fastcall__ adler32 (unsigned long adler, const char* buf,
*/
unsigned long __fastcall__ crc32 (unsigned long crc, const char* buf,
unsigned long __fastcall__ crc32 (unsigned long crc,
const unsigned char* buf,
unsigned len);
/*
Original zlib description:

44
include/zx02.h Normal file
View File

@@ -0,0 +1,44 @@
/*****************************************************************************/
/* */
/* zx02.h */
/* */
/* Decompression routine for the 'zx02' format */
/* */
/* */
/* */
/* (C) 2022 DMSC */
/* */
/* */
/* MIT license: */
/* Permission is hereby granted, free of charge, to any person obtaining a */
/* copy of this software and associated documentation files (the “Software”),*/
/* to deal in the Software without restriction, including without limitation */
/* the rights to use, copy, modify, merge, publish, distribute, sublicense, */
/* and/or sell copies of the Software, and to permit persons to whom the */
/* Software is furnished to do so, subject to the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be included */
/* in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS */
/* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN */
/* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, */
/* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR */
/* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE */
/* USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*****************************************************************************/
#ifndef _ZX02_H
#define _ZX02_H
void __fastcall__ decompress_zx02 (const unsigned char* src, unsigned char* const dst);
/* Decompresses the source buffer into the destination buffer.
** compress with zx02 input.bin output.zx02
*/
/* end of zx02.h */
#endif