diff --git a/asminc/atari.inc b/asminc/atari.inc index 29159a177..4992807f8 100644 --- a/asminc/atari.inc +++ b/asminc/atari.inc @@ -44,9 +44,34 @@ CLOSE = $0C ;close STATIS = $0D ;status SPECIL = $0E ;special -; Special Entry Command Equates +; DOS IOCB command codes -; Screen Commands +RENAME = $20 ;rename disk file +DELETE = $21 ;delete disk file +LOCKFL = $23 ;lock file (set to read-only) +UNLOCK = $24 ;unlock file +POINT = $25 ;point sector +NOTE = $26 ;note sector +GETFL = $27 ;get file length +CHDIR_MYDOS = $29 ;change directory (MyDOS) +MKDIR = $2A ;make directory (MyDOS/SpartaDOS) +CHDIR_SPDOS = $2C ;change directory (SpartaDOS) +FORMAT = $FE ;format + +GETCWD = $30 ;get current directory (MyDOS/SpartaDOS) + +; Special Entry Command Equates +; DOS Commands +; Command line table, Index values for (DOSVEC),Y -- COMTAB +; Compatible with OS/A+, DOS XL and SpartaDOS + +COMTAB = 0 ;DOS entry jump vector +ZCRNAME = 3 ;file name crunch routine jump vector +BUFOFF = 10 ;next parameter buffer offset +COMFNAM = 33 ;destination buffer for crunch routine +LBUF = 63 ;command line input buffer + +; Screen IOCB Commands DRAWLN = $11 ;draw line FILLIN = $12 ;draw line with right fill @@ -710,6 +735,9 @@ FPSCR1 = $05EC ;6-byte floating point temporary ;LBFEND = $05FF ;##old## END OF LBUFF + +DOS = $0700 + ;------------------------------------------------------------------------- ; Cartridge Address Equates ;------------------------------------------------------------------------- @@ -1022,29 +1050,6 @@ STOPLN = $BA ;2-byte stopped line number ERRSAVE = $C3 ;1-byte error code PTABW = $C9 ;1-byte tab width -;------------------------------------------------------------------------- -; DOS -;------------------------------------------------------------------------- - -DOS = $0700 - -RENAME = $20 ;RENAME DISK FILE -DELETE = $21 ;DELETE DISK FILE -LOCKFL = $23 ;LOCK FILE TO READ ONLY -UNLOCK = $24 ;UNLOCK LOCKED FILE -POINT = $25 ;POINT SECTOR -NOTE = $26 ;NOTE SECTOR -FORMAT = $FE ;FORMAT - -; Command line table, Index values for (DOSVEC),Y -- COMTAB -; Compatible with OS/A+, DOS XL and SpartaDOS - -COMTAB = 0 ;DOS entry jump vector -ZCRNAME = 3 ;file name crunch routine jump vector -BUFOFF = 10 ;next parameter buffer offset -COMFNAM = 33 ;destination buffer for crunch routine -LBUF = 63 ;command line input buffer - ;------------------------------------------------------------------------- ; ATASCII CHARACTER DEFS ;------------------------------------------------------------------------- diff --git a/asminc/stdio.inc b/asminc/stdio.inc index 835a204b1..18a7541e0 100644 --- a/asminc/stdio.inc +++ b/asminc/stdio.inc @@ -41,9 +41,9 @@ _IOLBF = 1 _IONBF = 2 BUFSIZ = 256 EOF = -1 -.if .defined(__APPLE2__) .or .defined(__APPLE2ENH__) +.if .defined(__APPLE2__) FILENAME_MAX = 64+1 -.elseif .defined(__ATARI__) .or .defined(__ATARIXL__) +.elseif .defined(__ATARI__) FILENAME_MAX = 12+1 .elseif .defined(__LUNIX__) FILENAME_MAX = 80+1 diff --git a/cfg/module.cfg b/cfg/module.cfg index edc87fb17..349197eb0 100644 --- a/cfg/module.cfg +++ b/cfg/module.cfg @@ -10,7 +10,7 @@ SEGMENTS { DATA: load = COMBINED, type = rw, define = yes; BSS: load = COMBINED, type = bss, define = yes; ZEROPAGE: load = ZP, type = zp; - EXTZP: load = ZP, type = zp; + EXTZP: load = ZP, type = zp, optional = yes; } FILES { %O: format = o65; diff --git a/include/apple2.h b/include/apple2.h index 177159e46..190248b0d 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -37,7 +37,7 @@ /* Check for errors */ -#if !defined(__APPLE2__) && !defined(__APPLE2ENH__) +#if !defined(__APPLE2__) # error This module may only be used when compiling for the Apple ][! #endif @@ -142,7 +142,7 @@ extern unsigned char _filetype; /* Default 6 */ extern unsigned int _auxtype; /* Default 0 */ /* The addresses of the static drivers */ -#ifndef __APPLE2ENH__ +#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[] */ diff --git a/include/atari.h b/include/atari.h index ca1f9299c..e47d1ccea 100644 --- a/include/atari.h +++ b/include/atari.h @@ -38,7 +38,7 @@ /* Check for errors */ -#if !defined(__ATARI__) && !defined(__ATARIXL__) +#if !defined(__ATARI__) # error This module may only be used when compiling for the Atari! #endif diff --git a/include/cbm264.h b/include/cbm264.h index 9ede10f47..ff7468d30 100644 --- a/include/cbm264.h +++ b/include/cbm264.h @@ -39,7 +39,7 @@ /* Check for errors */ -#if !defined(__PLUS4__) && !defined(__C16__) +#if !defined(__C16__) # error This module may only be used when compiling for the Plus/4 or C16! #endif diff --git a/include/conio.h b/include/conio.h index 693e40035..cd6bf3651 100644 --- a/include/conio.h +++ b/include/conio.h @@ -59,11 +59,11 @@ #endif /* Include the correct machine-specific file */ -#if defined(__APPLE2__) -# include -#elif defined(__APPLE2ENH__) +#if defined(__APPLE2ENH__) # include -#elif defined(__ATARI__) || defined(__ATARIXL__) +#elif defined(__APPLE2__) +# include +#elif defined(__ATARI__) # include #elif defined(__ATMOS__) # include diff --git a/include/dirent.h b/include/dirent.h index d1d786419..b5e1be135 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -43,7 +43,7 @@ typedef struct DIR DIR; -#if defined(__APPLE2__) || defined(__APPLE2ENH__) +#if defined(__APPLE2__) struct dirent { char d_name[16]; @@ -78,7 +78,7 @@ struct dirent { #define _DE_ISLBL(t) (0) #define _DE_ISLNK(t) (0) -#elif defined(__ATARI__) || defined(__ATARIXL__) +#elif defined(__ATARI__) struct dirent { char d_name[13]; /* 8.3 + trailing 0 */ diff --git a/include/stdio.h b/include/stdio.h index b2c4fa67a..c2c735cb0 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -69,9 +69,9 @@ extern FILE* stderr; #define TMP_MAX 256 /* Standard defines that are platform dependent */ -#if defined(__APPLE2__) || defined(__APPLE2ENH__) +#if defined(__APPLE2__) # define FILENAME_MAX (64+1) -#elif defined(__ATARI__) || defined(__ATARIXL__) +#elif defined(__ATARI__) # define FILENAME_MAX (12+1) #elif defined(__LUNIX__) # define FILENAME_MAX (80+1) diff --git a/include/time.h b/include/time.h index 7ac69165b..507d7e29a 100644 --- a/include/time.h +++ b/include/time.h @@ -76,7 +76,7 @@ extern struct _timezone { -#if defined(__ATARI__) || defined(__ATARIXL__) +#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() diff --git a/libsrc/Makefile b/libsrc/Makefile index 4204f00bb..d855d1580 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -67,7 +67,8 @@ clean: else # TARGET -CFLAGS += -Osir -W error +CA65FLAGS = +CC65FLAGS = -Osir -W error EXTZP = cbm510 \ cbm610 \ @@ -178,7 +179,7 @@ $$($1_OBJS): | $$($1_OBJDIR) $$($1_DRVPAT): $$($1_OBJPAT) $$(ZPOBJ) | $$($1_DRVDIR) @echo $$(TARGET) - $$(@F) - @$$(LD) -o $$@ -t module $$^ + @$$(LD65) -o $$@ -t module $$^ $$($1_OBJDIR) $$($1_DRVDIR): @$$(call MKDIR,$$@) @@ -187,8 +188,8 @@ $(TARGET): $$($1_DRVS) $$($1_STCPAT): $$($1_DRVPAT) @echo $$(TARGET) - $$((40*24) + adc #>(SCRSIZE-1) sta ptr1+1 lda #0 ; screen code of space char sta OLDCHR - ldy #<(40*24) ; 40x24: size of default atari screen - ldx #>(40*24) + ldy #<(SCRSIZE-1) + ldx #>(SCRSIZE-1) _clr1: sta (ptr1),y dey bne _clr1 sta (ptr1),y dex bmi done - ldy ptr1+1 + dec ptr1+1 dey - sty ptr1+1 - ldy #255 jmp _clr1 done: sta COLCRS diff --git a/libsrc/atari/fdtable.s b/libsrc/atari/fdtable.s index 7e3325055..fd9f5021b 100644 --- a/libsrc/atari/fdtable.s +++ b/libsrc/atari/fdtable.s @@ -11,7 +11,6 @@ .import fdt_to_fdi .export clriocb .export fdtoiocb_down - .export findfreeiocb .export fddecusage .export newfd @@ -87,31 +86,6 @@ loop: sta ICHID,x .endproc -; find a free iocb -; no entry parameters -; return ZF = 0/1 for not found/found -; index in X if found -; all registers destroyed - -.proc findfreeiocb - - ldx #0 - ldy #$FF -loop: tya - cmp ICHID,x - beq found - txa - clc - adc #$10 - tax - cmp #$80 - bcc loop - inx ; return ZF cleared -found: rts - -.endproc ; findfreeiocb - - ; decrements usage counter for fd ; if 0 reached, it's marked as unused ; get fd index in tmp2 diff --git a/libsrc/atari/findfreeiocb.inc b/libsrc/atari/findfreeiocb.inc new file mode 100644 index 000000000..92140efd4 --- /dev/null +++ b/libsrc/atari/findfreeiocb.inc @@ -0,0 +1,23 @@ +; find a free iocb +; no entry parameters +; return ZF = 0/1 for not found/found +; index in X if found +; all registers destroyed + +.proc findfreeiocb + + ldx #0 + ldy #$FF +loop: tya + cmp ICHID,x + beq found + txa + clc + adc #$10 + tax + cmp #$80 + bcc loop + inx ; return ZF cleared +found: rts + +.endproc ; findfreeiocb diff --git a/libsrc/atari/findfreeiocb.s b/libsrc/atari/findfreeiocb.s new file mode 100644 index 000000000..a500b1f77 --- /dev/null +++ b/libsrc/atari/findfreeiocb.s @@ -0,0 +1,7 @@ +; +; Christian Groessler, June-2013 +; + + .include "atari.inc" + .export findfreeiocb + .include "findfreeiocb.inc" diff --git a/libsrc/atari/initcwd.s b/libsrc/atari/initcwd.s index 19df6a5a4..d7b574314 100644 --- a/libsrc/atari/initcwd.s +++ b/libsrc/atari/initcwd.s @@ -11,7 +11,7 @@ jsr findfreeiocb bne oserr - lda #48 + lda #GETCWD sta ICCOM,x lda #<__cwd sta ICBLL,x diff --git a/libsrc/atari/lseek.s b/libsrc/atari/lseek.s index bf934294c..889976f5b 100644 --- a/libsrc/atari/lseek.s +++ b/libsrc/atari/lseek.s @@ -68,7 +68,7 @@ iocberr:jsr incsp6 ; SEEK_CUR cur: ldx tmp3 - lda #38 ; NOTE + lda #NOTE sta ICCOM,x jsr CIOV ; read it bmi xxerr @@ -84,7 +84,7 @@ l01: lda ICAX3,x ; low byte of position ; SEEK_END end: ldx tmp3 - lda #39 ; get file size + lda #GETFL sta ICCOM,x jsr CIOV bpl l01 @@ -126,7 +126,7 @@ ret: jsr incsp6 .if 0 ; return exactly the position DOS has ldx tmp3 - lda #38 ; NOTE + lda #NOTE sta ICCOM,x jsr CIOV ; read it bmi xxerr @@ -168,7 +168,7 @@ seek: jsr ldax0sp ; get lower word of new offset sta ICAX4,x lda ptr4 sta ICAX5,x - lda #37 ;POINT + lda #POINT sta ICCOM,x jsr CIOV bpl ret @@ -201,7 +201,7 @@ chk_supp: cmp #$40 bcs supp1 ; SD-X (ver 4.xx) supports seeking on all disks ldx tmp3 ; iocb to use - lda #39 ; get file size + lda #GETFL sta ICCOM,x jsr CIOV bmi notsupp ; error code ? should be 168 (invalid command) diff --git a/libsrc/atari/syschdir.s b/libsrc/atari/syschdir.s index 9fc45edbd..16cb3a1fe 100644 --- a/libsrc/atari/syschdir.s +++ b/libsrc/atari/syschdir.s @@ -58,9 +58,9 @@ ucok1: lda __dos_type cmp #SPARTADOS beq :+ - lda #41 + lda #CHDIR_MYDOS .byte $2C ; BIT -: lda #44 +: lda #CHDIR_SPDOS sta ICCOM,x lda #0 sta ICAX1,x diff --git a/libsrc/atari/sysmkdir.s b/libsrc/atari/sysmkdir.s index de3252ced..56a068757 100644 --- a/libsrc/atari/sysmkdir.s +++ b/libsrc/atari/sysmkdir.s @@ -61,7 +61,7 @@ ucok1: sta ICBAH,y tya tax - lda #42 + lda #MKDIR sta ICCOM,x lda #8 sta ICAX1,x diff --git a/libsrc/dbg/dbg.c b/libsrc/dbg/dbg.c index 68453be6f..00ff28722 100644 --- a/libsrc/dbg/dbg.c +++ b/libsrc/dbg/dbg.c @@ -47,7 +47,7 @@ static char GetKeyUpdate (void); /* Color definitions */ -#if defined(__PLUS4__) || defined(__C16__) +#if defined(__C16__) # define COLOR_BORDER (BCOLOR_DARKBLUE | CATTR_LUMA6) # define COLOR_BACKGROUND COLOR_WHITE # define COLOR_TEXTHIGH COLOR_BLACK @@ -63,7 +63,7 @@ static char GetKeyUpdate (void); # define COLOR_FRAMEHIGH COLOR_WHITE # define COLOR_FRAMELOW COLOR_GRAY3 # else -# if defined(__APPLE2__) || defined(__APPLE2ENH__) +# if defined(__APPLE2__) # define COLOR_BORDER COLOR_BLACK # define COLOR_BACKGROUND COLOR_BLACK # define COLOR_TEXTHIGH COLOR_BLACK @@ -93,7 +93,7 @@ static char GetKeyUpdate (void); # define MAX_X 80 # define MAX_Y 25 # define DUMP_BYTES 16 -#elif defined(__APPLE2__) || defined(__APPLE2ENH__) || defined(__ATARI__) || defined(__ATARIXL__) +#elif defined(__APPLE2__) || defined(__ATARI__) # define MAX_X 40 # define MAX_Y 24 # define DUMP_BYTES 8 @@ -104,7 +104,7 @@ static char GetKeyUpdate (void); #endif /* Replacement key definitions */ -#if defined(__APPLE2__) || defined(__LYNX__) || defined(__SIM6502__) || defined (__SIM65C02__) || defined(__SUPERVISION__) +#ifndef CH_DEL # define CH_DEL ('H' - 'A' + 1) /* Ctrl+H */ #endif diff --git a/libsrc/geos-apple/Makefile.inc b/libsrc/geos-apple/Makefile.inc index 1adc1b5a4..366d35899 100644 --- a/libsrc/geos-apple/Makefile.inc +++ b/libsrc/geos-apple/Makefile.inc @@ -1 +1 @@ -AFLAGS += -I geos-apple -I geos-common +CA65FLAGS += -I geos-apple -I geos-common diff --git a/libsrc/geos-apple/targetutil/Makefile.inc b/libsrc/geos-apple/targetutil/Makefile.inc index b5b2d3671..01ae3f55c 100644 --- a/libsrc/geos-apple/targetutil/Makefile.inc +++ b/libsrc/geos-apple/targetutil/Makefile.inc @@ -9,6 +9,6 @@ DEPS += ../wrk/$(TARGET)/convert.d @$(MAKE) --no-print-directory apple2enh ../targetutil/convert.system: ../wrk/$(TARGET)/convert.o ../lib/apple2enh.lib | ../targetutil - $(LD) -o $@ -C apple2enh-system.cfg $^ + $(LD65) -o $@ -C apple2enh-system.cfg $^ $(TARGET): ../targetutil/convert.system diff --git a/libsrc/geos-cbm/Makefile.inc b/libsrc/geos-cbm/Makefile.inc index 9bf34d3fd..423ad8b54 100644 --- a/libsrc/geos-cbm/Makefile.inc +++ b/libsrc/geos-cbm/Makefile.inc @@ -1 +1 @@ -AFLAGS += -I geos-cbm -I geos-common +CA65FLAGS += -I geos-cbm -I geos-common diff --git a/libsrc/runtime/zeropage.s b/libsrc/runtime/zeropage.s index b4af44e33..2bbe7ceee 100644 --- a/libsrc/runtime/zeropage.s +++ b/libsrc/runtime/zeropage.s @@ -22,10 +22,3 @@ tmp2: .res 1 tmp3: .res 1 tmp4: .res 1 regbank: .res regbanksize ; Register bank - -; Add an empty EXTZP zeropage segment to avoid linker warnings that this -; segment does not exist (it does not exist in most builtin linker configs -; but is used when linking modules). - -.segment "EXTZP" : zeropage - diff --git a/libsrc/sim6502/exehdr.s b/libsrc/sim6502/exehdr.s index 9c895834c..865bd6553 100644 --- a/libsrc/sim6502/exehdr.s +++ b/libsrc/sim6502/exehdr.s @@ -6,8 +6,6 @@ .export __EXEHDR__ : absolute = 1 ; Linker referenced -; ------------------------------------------------------------------------ - .segment "EXEHDR" .byte .defined(__SIM65C02__) diff --git a/samples/mandelbrot.c b/samples/mandelbrot.c index 6c58cea97..0ba4ebd2c 100644 --- a/samples/mandelbrot.c +++ b/samples/mandelbrot.c @@ -28,7 +28,7 @@ #define divfp(_a,_b) ((((signed long)_a)<Info & OF_UBRA) { /* Remember the entry so we can detect loops */ - CollAppend (&C, (void*) E); + CollAppend (&C, E); /* Check the target */ if (E->JumpTo == 0 || CollIndex (&C, E->JumpTo->Owner) >= 0) { diff --git a/src/cc65/codeent.h b/src/cc65/codeent.h index 634034c6b..72ce626bb 100644 --- a/src/cc65/codeent.h +++ b/src/cc65/codeent.h @@ -219,7 +219,7 @@ INLINE int CE_IsCallTo (const CodeEntry* E, const char* Name) # define CE_IsCallTo(E, Name) ((E)->OPC == OP65_JSR && strcmp ((E)->Arg, (Name)) == 0) #endif -int CE_UseLoadFlags (const CodeEntry* E); +int CE_UseLoadFlags (CodeEntry* E); /* Return true if the instruction uses any flags that are set by a load of * a register (N and Z). */ diff --git a/src/cc65/main.c b/src/cc65/main.c index 6d9472143..a27822ed8 100644 --- a/src/cc65/main.c +++ b/src/cc65/main.c @@ -165,6 +165,7 @@ static void SetSys (const char* Sys) break; case TGT_ATARIXL: + DefineNumericMacro ("__ATARI__", 1); DefineNumericMacro ("__ATARIXL__", 1); break; @@ -185,7 +186,8 @@ static void SetSys (const char* Sys) break; case TGT_PLUS4: - cbmsys ("__PLUS4__"); + cbmsys ("__C16__"); + DefineNumericMacro ("__PLUS4__", 1); break; case TGT_CBM510: @@ -209,6 +211,7 @@ static void SetSys (const char* Sys) break; case TGT_APPLE2ENH: + DefineNumericMacro ("__APPLE2__", 1); DefineNumericMacro ("__APPLE2ENH__", 1); break; diff --git a/testcode/lib/em-test.c b/testcode/lib/em-test.c index a6feed938..c7fee6a59 100644 --- a/testcode/lib/em-test.c +++ b/testcode/lib/em-test.c @@ -16,10 +16,10 @@ #define DRIVERNAME "cbm510-ram.emd" #elif defined(__CBM610__) #define DRIVERNAME "cbm610-ram.emd" -#elif defined(__APPLE2__) -#define DRIVERNAME "a2.auxmem.emd" #elif defined(__APPLE2ENH__) #define DRIVERNAME "a2e.auxmem.emd" +#elif defined(__APPLE2__) +#define DRIVERNAME "a2.auxmem.emd" #else #define DRIVERNAME "unknown" #error "Unknown target system" diff --git a/testcode/lib/ft.c b/testcode/lib/ft.c index 586bace45..ff335240d 100644 --- a/testcode/lib/ft.c +++ b/testcode/lib/ft.c @@ -25,7 +25,7 @@ extern int getsp(void); /* is provided in getsp.s */ /* Atari's fd indirection table */ -#if defined(__ATARI__) || defined(__ATARIXL__) +#ifdef __ATARI__ extern char __fd_index[]; struct fd_t { char usage; @@ -74,7 +74,7 @@ int main(int argc,char **argv) return(0); } printf("open success -- handle = $%x, sp = %d\n",fd,csp); -#if defined(__ATARI__) || defined(__ATARIXL__) +#ifdef __ATARI__ printf("fd_index:\n "); for (i=0; i<12; i++) printf("%02X ",__fd_index[i]); printf("\nfd_table:\n"); diff --git a/testcode/lib/mul-test.c b/testcode/lib/mul-test.c index 5df713072..5db42d4ab 100644 --- a/testcode/lib/mul-test.c +++ b/testcode/lib/mul-test.c @@ -18,7 +18,7 @@ static const unsigned char small_bar[8] = { ' ', 0xa5, 0xb4, 0xb5, 0xa1, 0xb6, 0xaa, 0xa7 }; -#elif defined(__ATARI__) || defined(__ATARIXL__) +#elif defined(__ATARI__) #endif /* Screen co-ordinates for the progress meter */ @@ -39,7 +39,7 @@ static void ProgressMeter (unsigned Val) revers (revers_bar[Val]); cputc (small_bar[Val]); -#elif defined(__ATARI__) || defined(__ATARIXL__) +#elif defined(__ATARI__) #endif revers (0); diff --git a/testcode/lib/ser-test.c b/testcode/lib/ser-test.c index a3f92b633..c929189a3 100644 --- a/testcode/lib/ser-test.c +++ b/testcode/lib/ser-test.c @@ -13,10 +13,10 @@ #define DRIVERNAME "plus4-stdser.ser" #elif defined(__CBM610__) #define DRIVERNAME "cbm610-std.ser" -#elif defined(__APPLE2__) -#define DRIVERNAME "a2.ssc.ser" #elif defined(__APPLE2ENH__) #define DRIVERNAME "a2e.ssc.ser" +#elif defined(__APPLE2__) +#define DRIVERNAME "a2.ssc.ser" #else #define DRIVERNAME "unknown" #error "Unknown target system"