From 5ed1fac0d678c0261679382cc1d172f01e4b6339 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Tue, 4 Jun 2013 23:39:00 +0200 Subject: [PATCH 01/15] Use unique variables for cc65 toolchain. Originally I used the usual variables (like $(CC) and $(CFLAGS) ) but after all this doesn't make sense as any predefined values and/or user defined settings can only be wrong. --- libsrc/Makefile | 29 ++++++++++++----------- libsrc/apple2/targetutil/Makefile.inc | 2 +- libsrc/atari/Makefile.inc | 2 +- libsrc/geos-apple/Makefile.inc | 2 +- libsrc/geos-apple/targetutil/Makefile.inc | 2 +- libsrc/geos-cbm/Makefile.inc | 2 +- 6 files changed, 20 insertions(+), 19 deletions(-) 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) - $$( Date: Fri, 7 Jun 2013 23:13:46 +0200 Subject: [PATCH 02/15] Added support for 'prefix'. If the variable 'prefix' is defined then the builtin search paths are set to $(prefix)/lib/cc65/... allowing to build binaries intended for installation. Note that the library build still works with these binaries as it generally overrides the builtin search paths by setting the CC65_HOME env var. --- src/Makefile | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Makefile b/src/Makefile index 8c4c6861e..3d0463147 100644 --- a/src/Makefile +++ b/src/Makefile @@ -12,11 +12,19 @@ PROGS = ar65 \ sim65 \ sp65 -CA65_INC := $(abspath ../asminc) -CC65_INC := $(abspath ../include) -LD65_LIB := $(abspath ../lib) -LD65_OBJ := $(abspath ../lib) -LD65_CFG := $(abspath ../cfg) +ifdef prefix + CA65_INC = $(prefix)/lib/cc65/asminc + CC65_INC = $(prefix)/lib/cc65/include + LD65_LIB = $(prefix)/lib/cc65/lib + LD65_OBJ = $(prefix)/lib/cc65/lib + LD65_CFG = $(prefix)/lib/cc65/cfg +else + CA65_INC := $(abspath ../asminc) + CC65_INC := $(abspath ../include) + LD65_LIB := $(abspath ../lib) + LD65_OBJ := $(abspath ../lib) + LD65_CFG := $(abspath ../cfg) +endif CFLAGS += -MMD -MP -O -std=c89 -I common \ -Wall -Wextra -Wno-char-subscripts -Werror \ From 56e330a4d7b8f88937186c115dd409515e1e5ddd Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Sat, 8 Jun 2013 00:35:07 +0200 Subject: [PATCH 03/15] Use symbolic names for all CIO commands. --- asminc/atari.inc | 55 ++++++++++++++++++++++------------------- libsrc/atari/initcwd.s | 2 +- libsrc/atari/lseek.s | 10 ++++---- libsrc/atari/syschdir.s | 4 +-- libsrc/atari/sysmkdir.s | 2 +- 5 files changed, 39 insertions(+), 34 deletions(-) diff --git a/asminc/atari.inc b/asminc/atari.inc index 29159a177..9de8e3daa 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/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 From a14d4c803d703898157c502d6ee25ac489adf9c3 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Sat, 8 Jun 2013 00:35:07 +0200 Subject: [PATCH 04/15] remove TABs --- asminc/atari.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/asminc/atari.inc b/asminc/atari.inc index 9de8e3daa..4992807f8 100644 --- a/asminc/atari.inc +++ b/asminc/atari.inc @@ -52,13 +52,13 @@ 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) +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) +GETCWD = $30 ;get current directory (MyDOS/SpartaDOS) ; Special Entry Command Equates ; DOS Commands From 92ad74a49fa826fa9c47f5e66c61a39016fa24c2 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 13 Jun 2013 15:26:17 +0200 Subject: [PATCH 05/15] Avoid GCC "unconst" warning. --- src/cc65/codeent.c | 4 ++-- src/cc65/codeent.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cc65/codeent.c b/src/cc65/codeent.c index 7372af338..21eef8fe5 100644 --- a/src/cc65/codeent.c +++ b/src/cc65/codeent.c @@ -412,7 +412,7 @@ int CE_IsKnownImm (const CodeEntry* E, unsigned long Num) -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). */ @@ -427,7 +427,7 @@ int CE_UseLoadFlags (const CodeEntry* E) while (E->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). */ From 83280e1ee2155eb1f08faba22ac320d417110094 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 17 Jun 2013 21:34:08 +0200 Subject: [PATCH 06/15] Have __APPLE2ENH__ imply __APPLE2__ and __ATARIXL__ imply __ATARI__. --- asminc/stdio.inc | 4 ++-- include/apple2.h | 4 ++-- include/atari.h | 2 +- include/conio.h | 8 ++++---- include/dirent.h | 4 ++-- include/stdio.h | 4 ++-- include/time.h | 2 +- libsrc/dbg/dbg.c | 4 ++-- samples/mandelbrot.c | 2 +- samples/sieve.c | 2 +- src/ca65/main.c | 2 ++ src/cc65/main.c | 2 ++ testcode/lib/em-test.c | 4 ++-- testcode/lib/ft.c | 4 ++-- testcode/lib/mul-test.c | 4 ++-- testcode/lib/ser-test.c | 4 ++-- 16 files changed, 30 insertions(+), 26 deletions(-) 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/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/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/dbg/dbg.c b/libsrc/dbg/dbg.c index 68453be6f..34c686e09 100644 --- a/libsrc/dbg/dbg.c +++ b/libsrc/dbg/dbg.c @@ -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 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)< Date: Mon, 17 Jun 2013 21:41:25 +0200 Subject: [PATCH 07/15] Avoid macro redefinition of CH_DEL for apple2enh. I'm wondering why MS VC++ didn't complain about this... --- libsrc/dbg/dbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/dbg/dbg.c b/libsrc/dbg/dbg.c index 34c686e09..ccc905122 100644 --- a/libsrc/dbg/dbg.c +++ b/libsrc/dbg/dbg.c @@ -104,7 +104,7 @@ static char GetKeyUpdate (void); #endif /* Replacement key definitions */ -#if defined(__APPLE2__) || defined(__LYNX__) || defined(__SIM6502__) || defined (__SIM65C02__) || defined(__SUPERVISION__) +#if (defined(__APPLE2__) && !defined(__APPLE2ENH__)) || defined(__LYNX__) || defined(__SIM6502__) || defined (__SIM65C02__) || defined(__SUPERVISION__) # define CH_DEL ('H' - 'A' + 1) /* Ctrl+H */ #endif From 93bd9a8e51c22c2b91a25602586531dfb9fd683e Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Tue, 18 Jun 2013 19:06:46 +0200 Subject: [PATCH 08/15] Simply define CH_DEL exactly then when there none yet. --- libsrc/dbg/dbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/dbg/dbg.c b/libsrc/dbg/dbg.c index ccc905122..c0c2da971 100644 --- a/libsrc/dbg/dbg.c +++ b/libsrc/dbg/dbg.c @@ -104,7 +104,7 @@ static char GetKeyUpdate (void); #endif /* Replacement key definitions */ -#if (defined(__APPLE2__) && !defined(__APPLE2ENH__)) || defined(__LYNX__) || defined(__SIM6502__) || defined (__SIM65C02__) || defined(__SUPERVISION__) +#ifndef CH_DEL # define CH_DEL ('H' - 'A' + 1) /* Ctrl+H */ #endif From e3fb1b3d3d761866e06433e20a75a4ef9d380d1f Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Fri, 21 Jun 2013 01:53:13 +0200 Subject: [PATCH 09/15] Fix writing one byte beyond screen buffer. --- libsrc/atari/clrscr.s | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libsrc/atari/clrscr.s b/libsrc/atari/clrscr.s index 58fb63137..483cd047e 100644 --- a/libsrc/atari/clrscr.s +++ b/libsrc/atari/clrscr.s @@ -9,26 +9,26 @@ .importzp ptr1 .import setcursor +SCRSIZE = 960 ; 40x24: size of default atari screen + _clrscr:lda SAVMSC ; screen memory sta ptr1 lda SAVMSC+1 clc - adc #>(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 From 578d2fe25d95285de4293dc0d53abadbacd1df1c Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 21 Jun 2013 13:35:35 +0300 Subject: [PATCH 10/15] Fixed comment. --- samples/multidemo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/multidemo.c b/samples/multidemo.c index 6585b2057..367ce39e1 100644 --- a/samples/multidemo.c +++ b/samples/multidemo.c @@ -57,7 +57,7 @@ void log (char *msg) /* In a real-world overlay program one would probably not use a #pragma but - * rather place the all the code of certain source files into the overlay by + * rather place all the code of certain source files into the overlay by * compiling them with --code-name OVERLAY1. */ #pragma code-name (push, "OVERLAY1"); From c4c67b9205f6ef2abdd8ed80a88c33606bd9ec12 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 21 Jun 2013 12:36:37 +0200 Subject: [PATCH 11/15] Fixed comment. --- samples/overlaydemo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/overlaydemo.c b/samples/overlaydemo.c index 8e67d771c..a3fb132e1 100644 --- a/samples/overlaydemo.c +++ b/samples/overlaydemo.c @@ -33,7 +33,7 @@ void log (char *msg) /* In a real-world overlay program one would probably not use a #pragma but - * rather place the all the code of certain source files into the overlay by + * rather place all the code of certain source files into the overlay by * compiling them with --code-name OVERLAY1. */ #pragma code-name (push, "OVERLAY1"); From 1bd902787b3d486938a839363a4f1397c73d0265 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Tue, 25 Jun 2013 01:12:11 +0200 Subject: [PATCH 12/15] move findfreeiocb function into its own object file --- libsrc/atari/fdtable.s | 26 -------------------------- libsrc/atari/findfreeiocb.inc | 23 +++++++++++++++++++++++ libsrc/atari/findfreeiocb.s | 7 +++++++ 3 files changed, 30 insertions(+), 26 deletions(-) create mode 100644 libsrc/atari/findfreeiocb.inc create mode 100644 libsrc/atari/findfreeiocb.s 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" From 460cea425f29fe83f1eb3915d2913e0393466f26 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 27 Jun 2013 13:04:52 +0200 Subject: [PATCH 13/15] No delimiter comment between includes and first segment. --- libsrc/sim6502/exehdr.s | 2 -- 1 file changed, 2 deletions(-) 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__) From 3af758ced542b6f7bc1973664bc82ef6c053079b Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 27 Jun 2013 23:09:54 +0200 Subject: [PATCH 14/15] Have __PLUS4__ imply __C16__. --- include/cbm264.h | 2 +- libsrc/dbg/dbg.c | 2 +- src/ca65/main.c | 3 ++- src/cc65/main.c | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) 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/libsrc/dbg/dbg.c b/libsrc/dbg/dbg.c index c0c2da971..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 diff --git a/src/ca65/main.c b/src/ca65/main.c index c862dcaad..4b2f9d178 100644 --- a/src/ca65/main.c +++ b/src/ca65/main.c @@ -230,7 +230,8 @@ static void SetSys (const char* Sys) break; case TGT_PLUS4: - CBMSystem ("__PLUS4__"); + CBMSystem ("__C16__"); + NewSymbol ("__PLUS4__", 1); break; case TGT_CBM510: diff --git a/src/cc65/main.c b/src/cc65/main.c index cadad83d0..a27822ed8 100644 --- a/src/cc65/main.c +++ b/src/cc65/main.c @@ -186,7 +186,8 @@ static void SetSys (const char* Sys) break; case TGT_PLUS4: - cbmsys ("__PLUS4__"); + cbmsys ("__C16__"); + DefineNumericMacro ("__PLUS4__", 1); break; case TGT_CBM510: From 5edcd639e0f3f933550739daf59f520dd0fafd6d Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 28 Jun 2013 00:30:24 +0200 Subject: [PATCH 15/15] Made EXTZP segment option for modules. This allows to remove the "add empty EXTZP segement to avoid warnings" approach. --- cfg/module.cfg | 2 +- libsrc/runtime/zeropage.s | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) 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/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 -