From 98c47d187728980b61363f3b34c5008d1d2f78e6 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Tue, 28 May 2013 21:56:37 +0200 Subject: [PATCH] Introduced target 'atarixl'. The target 'atarixl' is to be used for Atari XL (and better) machines. It will disable the OS ROM and enable the Shadow RAM available on those machine. Note: This commit is only the inital step towards for this goal that just replicates the target 'atari' as a starting point! --- asminc/stdio.inc | 2 +- cfg/atarixl-overlay.cfg | 61 ++++++++++++++++++++++++++++++++++++ cfg/atarixl.cfg | 42 +++++++++++++++++++++++++ include/atari.h | 2 +- include/conio.h | 2 +- include/dirent.h | 2 +- include/stdio.h | 2 +- include/time.h | 2 +- libsrc/Makefile | 7 ++++- libsrc/dbg/dbg.c | 2 +- src/ca65/main.c | 4 +++ src/cc65/main.c | 4 +++ src/common/target.c | 2 ++ src/common/target.h | 1 + testcode/lib/clock.c | 3 -- testcode/lib/div-test.c | 4 +-- testcode/lib/ft.c | 9 +++--- testcode/lib/mul-test.c | 12 +++---- testcode/lib/strnicmp-test.c | 10 +----- 19 files changed, 138 insertions(+), 35 deletions(-) create mode 100644 cfg/atarixl-overlay.cfg create mode 100644 cfg/atarixl.cfg diff --git a/asminc/stdio.inc b/asminc/stdio.inc index fc75238cf..835a204b1 100644 --- a/asminc/stdio.inc +++ b/asminc/stdio.inc @@ -43,7 +43,7 @@ BUFSIZ = 256 EOF = -1 .if .defined(__APPLE2__) .or .defined(__APPLE2ENH__) FILENAME_MAX = 64+1 -.elseif .defined(__ATARI__) +.elseif .defined(__ATARI__) .or .defined(__ATARIXL__) FILENAME_MAX = 12+1 .elseif .defined(__LUNIX__) FILENAME_MAX = 80+1 diff --git a/cfg/atarixl-overlay.cfg b/cfg/atarixl-overlay.cfg new file mode 100644 index 000000000..02becd29b --- /dev/null +++ b/cfg/atarixl-overlay.cfg @@ -0,0 +1,61 @@ +FEATURES { + STARTADDRESS: default = $2E00; +} +SYMBOLS { + __STACKSIZE__: type = weak, value = $0800; # 2k stack + __OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay + __RESERVED_MEMORY__: type = weak, value = $0000; +} +MEMORY { + ZP: file = "", define = yes, start = $0082, size = $007E; + HEADER: file = %O, start = $0000, size = $0006; + RAM: file = %O, start = %S + __OVERLAYSIZE__, size = $BC20 - __STACKSIZE__ - __OVERLAYSIZE__ - %S; + TRAILER: file = %O, start = $0000, size = $0006; + OVL1: file = "%O.1", start = %S, size = __OVERLAYSIZE__; + OVL2: file = "%O.2", start = %S, size = __OVERLAYSIZE__; + OVL3: file = "%O.3", start = %S, size = __OVERLAYSIZE__; + OVL4: file = "%O.4", start = %S, size = __OVERLAYSIZE__; + OVL5: file = "%O.5", start = %S, size = __OVERLAYSIZE__; + OVL6: file = "%O.6", start = %S, size = __OVERLAYSIZE__; + OVL7: file = "%O.7", start = %S, size = __OVERLAYSIZE__; + OVL8: file = "%O.8", start = %S, size = __OVERLAYSIZE__; + OVL9: file = "%O.9", start = %S, size = __OVERLAYSIZE__; +} +SEGMENTS { + EXEHDR: load = HEADER, type = ro; + STARTUP: load = RAM, type = ro, define = yes; + LOWCODE: load = RAM, type = ro, define = yes, optional = yes; + INIT: load = RAM, type = ro, optional = yes; + CODE: load = RAM, type = ro, define = yes; + RODATA: load = RAM, type = ro; + DATA: load = RAM, type = rw; + ZPSAVE: load = RAM, type = bss, define = yes; + BSS: load = RAM, type = bss, define = yes; + ZEROPAGE: load = ZP, type = zp; + EXTZP: load = ZP, type = zp, optional = yes; + AUTOSTRT: load = TRAILER, type = ro; + OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes; + OVERLAY2: load = OVL2, type = ro, define = yes, optional = yes; + OVERLAY3: load = OVL3, type = ro, define = yes, optional = yes; + OVERLAY4: load = OVL4, type = ro, define = yes, optional = yes; + OVERLAY5: load = OVL5, type = ro, define = yes, optional = yes; + OVERLAY6: load = OVL6, type = ro, define = yes, optional = yes; + OVERLAY7: load = OVL7, type = ro, define = yes, optional = yes; + OVERLAY8: load = OVL8, type = ro, define = yes, optional = yes; + OVERLAY9: load = OVL9, type = ro, define = yes, optional = yes; +} +FEATURES { + CONDES: type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__, + segment = INIT; + CONDES: type = destructor, + label = __DESTRUCTOR_TABLE__, + count = __DESTRUCTOR_COUNT__, + segment = RODATA; + CONDES: type = interruptor, + label = __INTERRUPTOR_TABLE__, + count = __INTERRUPTOR_COUNT__, + segment = RODATA, + import = __CALLIRQ__; +} diff --git a/cfg/atarixl.cfg b/cfg/atarixl.cfg new file mode 100644 index 000000000..975d16213 --- /dev/null +++ b/cfg/atarixl.cfg @@ -0,0 +1,42 @@ +FEATURES { + STARTADDRESS: default = $2E00; +} +SYMBOLS { + __STACKSIZE__: type = weak, value = $0800; # 2k stack + __RESERVED_MEMORY__: type = weak, value = $0000; +} +MEMORY { + ZP: file = "", define = yes, start = $0082, size = $007E; + HEADER: file = %O, start = $0000, size = $0006; + RAM: file = %O, start = %S, size = $BC20 - __STACKSIZE__ - %S; + TRAILER: file = %O, start = $0000, size = $0006; +} +SEGMENTS { + EXEHDR: load = HEADER, type = ro; + STARTUP: load = RAM, type = ro, define = yes; + LOWCODE: load = RAM, type = ro, define = yes, optional = yes; + INIT: load = RAM, type = ro, optional = yes; + CODE: load = RAM, type = ro, define = yes; + RODATA: load = RAM, type = ro; + DATA: load = RAM, type = rw; + ZPSAVE: load = RAM, type = bss, define = yes; + BSS: load = RAM, type = bss, define = yes; + ZEROPAGE: load = ZP, type = zp; + EXTZP: load = ZP, type = zp, optional = yes; + AUTOSTRT: load = TRAILER, type = ro; +} +FEATURES { + CONDES: type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__, + segment = INIT; + CONDES: type = destructor, + label = __DESTRUCTOR_TABLE__, + count = __DESTRUCTOR_COUNT__, + segment = RODATA; + CONDES: type = interruptor, + label = __INTERRUPTOR_TABLE__, + count = __INTERRUPTOR_COUNT__, + segment = RODATA, + import = __CALLIRQ__; +} diff --git a/include/atari.h b/include/atari.h index b6714e715..3c0898c2f 100644 --- a/include/atari.h +++ b/include/atari.h @@ -38,7 +38,7 @@ /* Check for errors */ -#if !defined(__ATARI__) +#if !defined(__ATARI__) && !defined(__ATARIXL__) # error This module may only be used when compiling for the Atari! #endif diff --git a/include/conio.h b/include/conio.h index ab446ad42..693e40035 100644 --- a/include/conio.h +++ b/include/conio.h @@ -63,7 +63,7 @@ # include #elif defined(__APPLE2ENH__) # include -#elif defined(__ATARI__) +#elif defined(__ATARI__) || defined(__ATARIXL__) # include #elif defined(__ATMOS__) # include diff --git a/include/dirent.h b/include/dirent.h index 993036a1b..d1d786419 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -78,7 +78,7 @@ struct dirent { #define _DE_ISLBL(t) (0) #define _DE_ISLNK(t) (0) -#elif defined(__ATARI__) +#elif defined(__ATARI__) || defined(__ATARIXL__) struct dirent { char d_name[13]; /* 8.3 + trailing 0 */ diff --git a/include/stdio.h b/include/stdio.h index 6f2f9c3f8..b2c4fa67a 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -71,7 +71,7 @@ extern FILE* stderr; /* Standard defines that are platform dependent */ #if defined(__APPLE2__) || defined(__APPLE2ENH__) # define FILENAME_MAX (64+1) -#elif defined(__ATARI__) +#elif defined(__ATARI__) || defined(__ATARIXL__) # define FILENAME_MAX (12+1) #elif defined(__LUNIX__) # define FILENAME_MAX (80+1) diff --git a/include/time.h b/include/time.h index 507d7e29a..7ac69165b 100644 --- a/include/time.h +++ b/include/time.h @@ -76,7 +76,7 @@ extern struct _timezone { -#if defined(__ATARI__) +#if defined(__ATARI__) || defined(__ATARIXL__) /* 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 a91cc73f4..5cdc1f659 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -13,6 +13,7 @@ GEOS = geos-apple \ TARGETS = apple2 \ apple2enh \ atari \ + atarixl \ atmos \ $(CBMS) \ $(GEOS) \ @@ -93,9 +94,13 @@ GEOSDIRS = common \ system ifeq ($(TARGET),apple2enh) + SRCDIR = apple2 OBJPFX = a2 DRVPFX = a2e - SRCDIR = apple2 +else ifeq ($(TARGET),atarixl) + SRCDIR = atari + OBJPFX = atr + DRVPFX = atrx else ifeq ($(TARGET),sim65c02) SRCDIR = sim6502 else diff --git a/libsrc/dbg/dbg.c b/libsrc/dbg/dbg.c index 3d7b8dd91..68453be6f 100644 --- a/libsrc/dbg/dbg.c +++ b/libsrc/dbg/dbg.c @@ -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__) +#elif defined(__APPLE2__) || defined(__APPLE2ENH__) || defined(__ATARI__) || defined(__ATARIXL__) # define MAX_X 40 # define MAX_Y 24 # define DUMP_BYTES 8 diff --git a/src/ca65/main.c b/src/ca65/main.c index b3e855e98..1f98e46ae 100644 --- a/src/ca65/main.c +++ b/src/ca65/main.c @@ -208,6 +208,10 @@ static void SetSys (const char* Sys) NewSymbol ("__ATARI__", 1); break; + case TGT_ATARIXL: + NewSymbol ("__ATARIXL__", 1); + break; + case TGT_C16: CBMSystem ("__C16__"); break; diff --git a/src/cc65/main.c b/src/cc65/main.c index a9d94ba9d..6d9472143 100644 --- a/src/cc65/main.c +++ b/src/cc65/main.c @@ -164,6 +164,10 @@ static void SetSys (const char* Sys) DefineNumericMacro ("__ATARI__", 1); break; + case TGT_ATARIXL: + DefineNumericMacro ("__ATARIXL__", 1); + break; + case TGT_C16: cbmsys ("__C16__"); break; diff --git a/src/common/target.c b/src/common/target.c index c4d1d1dde..a4287ee56 100644 --- a/src/common/target.c +++ b/src/common/target.c @@ -125,6 +125,7 @@ static const TargetEntry TargetMap[] = { { "apple2", TGT_APPLE2 }, { "apple2enh", TGT_APPLE2ENH }, { "atari", TGT_ATARI }, + { "atarixl", TGT_ATARIXL }, { "atmos", TGT_ATMOS }, { "bbc", TGT_BBC }, { "c128", TGT_C128 }, @@ -156,6 +157,7 @@ static const TargetProperties PropertyTable[TGT_COUNT] = { { "none", CPU_6502, BINFMT_BINARY, CTNone }, { "module", CPU_6502, BINFMT_O65, CTNone }, { "atari", CPU_6502, BINFMT_BINARY, CTAtari }, + { "atarixl", CPU_6502, BINFMT_BINARY, CTAtari }, { "vic20", CPU_6502, BINFMT_BINARY, CTPET }, { "c16", CPU_6502, BINFMT_BINARY, CTPET }, { "c64", CPU_6502, BINFMT_BINARY, CTPET }, diff --git a/src/common/target.h b/src/common/target.h index 4b5eec385..e1675ad65 100644 --- a/src/common/target.h +++ b/src/common/target.h @@ -55,6 +55,7 @@ typedef enum { TGT_NONE, TGT_MODULE, TGT_ATARI, + TGT_ATARIXL, TGT_VIC20, TGT_C16, TGT_C64, diff --git a/testcode/lib/clock.c b/testcode/lib/clock.c index 7991058cd..a4d046d52 100644 --- a/testcode/lib/clock.c +++ b/testcode/lib/clock.c @@ -16,11 +16,8 @@ int main(void) printf("clocks per second: %d\n", CLOCKS_PER_SEC); printf("current clock: %ld\n", clock()); -#ifdef __ATARI__ - /* Atari DOS 2.x clears the screen after program termination, so wait... */ printf("hit to exit..."); cgetc(); -#endif printf("\n"); return(0); } diff --git a/testcode/lib/div-test.c b/testcode/lib/div-test.c index ce290ad38..2d5c2541e 100644 --- a/testcode/lib/div-test.c +++ b/testcode/lib/div-test.c @@ -31,10 +31,8 @@ int main(void) { test(-40, -3); if (t) printf("\nThe div() function made a wrong result!\n"); -#ifdef __ATARI__ - /* Atari DOS 2 clears the screen after program-termination, so wait. */ + printf("\nTap a key, to exit. "); getchar(); -#endif return (int)t; } diff --git a/testcode/lib/ft.c b/testcode/lib/ft.c index efbab3627..586bace45 100644 --- a/testcode/lib/ft.c +++ b/testcode/lib/ft.c @@ -24,7 +24,8 @@ extern int getsp(void); /* is provided in getsp.s */ -#ifdef __ATARI__ /* Atari's fd indirection table */ +/* Atari's fd indirection table */ +#if defined(__ATARI__) || defined(__ATARIXL__) extern char __fd_index[]; struct fd_t { char usage; @@ -33,7 +34,7 @@ struct fd_t { char flag; }; extern struct fd_t __fd_table[]; -#endif /* #ifdef __ATARI__ */ +#endif int main(int argc,char **argv) { @@ -73,7 +74,7 @@ int main(int argc,char **argv) return(0); } printf("open success -- handle = $%x, sp = %d\n",fd,csp); -#ifdef __ATARI__ +#if defined(__ATARI__) || defined(__ATARIXL__) printf("fd_index:\n "); for (i=0; i<12; i++) printf("%02X ",__fd_index[i]); printf("\nfd_table:\n"); @@ -83,7 +84,7 @@ int main(int argc,char **argv) __fd_table[i].iocb, __fd_table[i].dev); } -#endif /* #ifdef __ATARI__ */ +#endif lr = read(fd,buf,16); /* read first 16 bytes */ csp = getsp(); if (lr == -1) { diff --git a/testcode/lib/mul-test.c b/testcode/lib/mul-test.c index 1ce626894..5df713072 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__) +#elif defined(__ATARI__) || defined(__ATARIXL__) #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__) +#elif defined(__ATARI__) || defined(__ATARIXL__) #endif revers (0); @@ -162,12 +162,8 @@ Done: " %u.%03u seconds.\n", Days, Hours, Minu, Sec, Milli); #endif -#ifdef __ATARI__ - if (_dos_type != SPARTADOS && _dos_type != OSADOS) { - cprintf ("\rTap a key, to exit. "); - cgetc(); - } -#endif + cprintf ("\rTap a key, to exit. "); + cgetc(); return 0; } diff --git a/testcode/lib/strnicmp-test.c b/testcode/lib/strnicmp-test.c index 45c2ce270..b2d942a97 100644 --- a/testcode/lib/strnicmp-test.c +++ b/testcode/lib/strnicmp-test.c @@ -1,10 +1,7 @@ #include #include #include -#ifdef __ATARI__ -#include #include -#endif static int do_test(const char *s1, const char *s2, size_t n) { @@ -70,11 +67,6 @@ int main(void) else printf("OK (%d)\n", ret); -#ifdef __ATARI__ - if (_dos_type != 1) { - cgetc(); - } -#endif - + cgetc(); return 0; } -- 2.39.5