From c8dd88efad29864da56aa3663318f810dcf88c36 Mon Sep 17 00:00:00 2001 From: greg-king5 Date: Mon, 18 Dec 2017 17:09:06 -0500 Subject: [PATCH 01/37] Added missing "break;" statements to a "switch" statement. --- src/common/xsprintf.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/common/xsprintf.c b/src/common/xsprintf.c index d50ad7a68..a7d26d5ef 100644 --- a/src/common/xsprintf.c +++ b/src/common/xsprintf.c @@ -352,14 +352,14 @@ static void StoreOffset (PrintfCtrl* P) /* Store the current output offset (%n format spec) */ { switch (P->LengthMod) { - case lmChar: *va_arg (P->ap, int*) = P->BufFill; - case lmShort: *va_arg (P->ap, int*) = P->BufFill; - case lmInt: *va_arg (P->ap, int*) = P->BufFill; - case lmLong: *va_arg (P->ap, long*) = P->BufFill; - case lmIntMax: *va_arg (P->ap, intmax_t*) = P->BufFill; - case lmSizeT: *va_arg (P->ap, size_t*) = P->BufFill; - case lmPtrDiffT: *va_arg (P->ap, ptrdiff_t*) = P->BufFill; - default: FAIL ("Invalid size modifier for %n format spec in xvsnprintf"); + case lmChar: *va_arg (P->ap, int*) = P->BufFill; break; + case lmShort: *va_arg (P->ap, int*) = P->BufFill; break; + case lmInt: *va_arg (P->ap, int*) = P->BufFill; break; + case lmLong: *va_arg (P->ap, long*) = P->BufFill; break; + case lmIntMax: *va_arg (P->ap, intmax_t*) = P->BufFill; break; + case lmSizeT: *va_arg (P->ap, size_t*) = P->BufFill; break; + case lmPtrDiffT: *va_arg (P->ap, ptrdiff_t*) = P->BufFill; break; + default: FAIL ("Invalid size modifier for %n format spec. in xvsnprintf()"); } } From 0543ecabe2624e0ec73df1e090f386c6d96a3a1e Mon Sep 17 00:00:00 2001 From: mrdudz Date: Thu, 28 Dec 2017 01:58:03 +0100 Subject: [PATCH 02/37] added peek functions for soft80 --- libsrc/c64/extra/soft80.s | 19 ++++ libsrc/c64/extra/soft80mono.s | 19 ++++ libsrc/c64/soft80_cpeekc.s | 168 +++++++++++++++++++++++++++++ libsrc/c64/soft80_cpeekcolor.s | 19 ++++ libsrc/c64/soft80_cpeekrevers.s | 10 ++ libsrc/c64/soft80_cpeeks.s | 71 ++++++++++++ libsrc/c64/soft80mono_cpeekcolor.s | 17 +++ 7 files changed, 323 insertions(+) create mode 100644 libsrc/c64/soft80_cpeekc.s create mode 100644 libsrc/c64/soft80_cpeekcolor.s create mode 100644 libsrc/c64/soft80_cpeekrevers.s create mode 100644 libsrc/c64/soft80_cpeeks.s create mode 100644 libsrc/c64/soft80mono_cpeekcolor.s diff --git a/libsrc/c64/extra/soft80.s b/libsrc/c64/extra/soft80.s index d445c85c0..0ea28cfaf 100644 --- a/libsrc/c64/extra/soft80.s +++ b/libsrc/c64/extra/soft80.s @@ -15,6 +15,22 @@ .export _textcolor := soft80_textcolor ; color.s .export _bgcolor := soft80_bgcolor ; color.s + ; soft80_cpeekc.s + .import soft80_cpeekc + .export _cpeekc := soft80_cpeekc ; cpeekc.s + + ; soft80_cpeekcolor.s + .import soft80_cpeekcolor + .export _cpeekcolor := soft80_cpeekcolor ; cpeekcolor.s + + ; soft80_cpeekrevers.s + .import soft80_cpeekrevers + .export _cpeekrevers := soft80_cpeekrevers ; cpeekrevers.s + + ; soft80_cpeeks.s + .import soft80_cpeeks + .export _cpeeks := soft80_cpeeks ; cpeeks.s + ; soft80_cputc.s .import soft80_cputc .import soft80_cputcxy @@ -50,3 +66,6 @@ ; Chars used by chline () and cvline () .exportzp chlinechar = CH_HLINE .exportzp cvlinechar = CH_VLINE + + .import return1 + .export _doesclrscrafterexit := return1 diff --git a/libsrc/c64/extra/soft80mono.s b/libsrc/c64/extra/soft80mono.s index 6fd2c687c..700cbcb6c 100644 --- a/libsrc/c64/extra/soft80mono.s +++ b/libsrc/c64/extra/soft80mono.s @@ -18,6 +18,22 @@ .export _textcolor := soft80mono_textcolor ; color.s .export _bgcolor := soft80mono_bgcolor ; color.s + ; soft80mono_cpeekc.s + .import soft80_cpeekc + .export _cpeekc := soft80_cpeekc ; cpeekc.s + + ; soft80mono_cpeekcolor.s + .import soft80mono_cpeekcolor + .export _cpeekcolor := soft80mono_cpeekcolor ; cpeekcolor.s + + ; soft80mono_cpeekrevers.s + .import soft80_cpeekrevers + .export _cpeekrevers := soft80_cpeekrevers ; cpeekrevers.s + + ; soft80mono_cpeeks.s + .import soft80_cpeeks + .export _cpeeks := soft80_cpeeks ; cpeeks.s + ; soft80mono_cputc.s .import soft80mono_cputc .import soft80mono_cputcxy @@ -53,3 +69,6 @@ ; Chars used by chline () and cvline () .exportzp chlinechar = CH_HLINE .exportzp cvlinechar = CH_VLINE + + .import return1 + .export _doesclrscrafterexit := return1 diff --git a/libsrc/c64/soft80_cpeekc.s b/libsrc/c64/soft80_cpeekc.s new file mode 100644 index 000000000..2801ade97 --- /dev/null +++ b/libsrc/c64/soft80_cpeekc.s @@ -0,0 +1,168 @@ + + .export soft80_cpeekc, soft80_cpeekchar + + .include "c64.inc" + .include "soft80.inc" + + .macpack longbranch + + .segment "CODE" + +soft80_cpeekc: + jsr soft80_cpeekchar + ldx #0 + rts + +soft80_cpeekchar: + + sei + ;;dec $01 ;; assumed = $36 + ;;dec $01 ;; assumed = $36 + lda #$34 + sta $01 + + lda CURS_X + and #$01 + + jne @l1a + + ; test non-inverted character (left side) + + ldx #0 +@l2aa: + ldy #0 + +;; stx $d020 + + .repeat 8,line +;; jsr readdirect + lda (SCREEN_PTR),y + and #$f0 +; sta $e100,y + cmp soft80_hi_charset+(line*$80),x +; cmp #0 + bne @l2b + .if (line < 7) + iny + .endif + .endrepeat + + +@backok: +;inc $d020 +; inc $01 +; inc $01 + lda #$36 + sta $01 + cli + txa ; return char in A + ; sec +; sbc #$20 + ldx #$00 ; revers flag +;inc $d020 + rts +@l2b: +;jmp * + inx + cpx #$80 + jne @l2aa + + ; test inverted character (left side) + + ldx #0 +@l2aa2: + ldy #0 + +;; stx $d020 + + .repeat 8,line +;; jsr readdirect + lda (SCREEN_PTR),y + and #$f0 + eor #$f0 + cmp soft80_hi_charset+(line*$80),x +; cmp #0 + bne @l2b2 + .if (line < 7) + iny + .endif + .endrepeat + +@backokrevers: +;inc $d020 +; inc $01 +; inc $01 + lda #$36 + sta $01 + cli + txa ; return char in A + ; sec +; sbc #$20 + ldx #$01 ; revers flag +;inc $d020 + rts + +@l2b2: + inx + cpx #$80 + jne @l2aa2 + +@backerr: +;inc $d020 + ;; inc $01 +;; inc $01 + lda #$36 + sta $01 + cli + ldx #0 + txa + + rts + + ; test non-inverted character (right side) + +@l1a: + ldx #0 +@l1aa: + ldy #0 + .repeat 8,line +;; jsr readdirect + lda (SCREEN_PTR),y + and #$0f + eor soft80_lo_charset+(line*$80),x + bne @l2bb + .if line < 7 + iny + .endif + .endrepeat + jmp @backok +@l2bb: + inx + cpx #$80 + bne @l1aa + + ; test inverted character (right side) + + ldx #0 +@l1aa2: + ldy #0 + .repeat 8,line +;; jsr readdirect + lda (SCREEN_PTR),y + and #$0f + eor #$0f + eor soft80_lo_charset+(line*$80),x + bne @l2bb2 + .if line < 7 + iny + .endif + .endrepeat + jmp @backokrevers +@l2bb2: + inx + cpx #$80 + bne @l1aa2 + + + jmp @backerr + diff --git a/libsrc/c64/soft80_cpeekcolor.s b/libsrc/c64/soft80_cpeekcolor.s new file mode 100644 index 000000000..c8f1c6e43 --- /dev/null +++ b/libsrc/c64/soft80_cpeekcolor.s @@ -0,0 +1,19 @@ +; +; 2017-12-27, Groepaz +; +; unsigned char cpeekcolor (void); +; + + .export soft80_cpeekcolor + + .include "c64.inc" + .include "soft80.inc" + + .segment "CODE" + +soft80_cpeekcolor: + ldy #0 + lda (CRAM_PTR),y + and #$0f + ldx #0 + rts diff --git a/libsrc/c64/soft80_cpeekrevers.s b/libsrc/c64/soft80_cpeekrevers.s new file mode 100644 index 000000000..6fc0c166a --- /dev/null +++ b/libsrc/c64/soft80_cpeekrevers.s @@ -0,0 +1,10 @@ + + .import soft80_cpeekchar + + .export soft80_cpeekrevers + +soft80_cpeekrevers: + jsr soft80_cpeekchar + txa + ldx #0 + rts diff --git a/libsrc/c64/soft80_cpeeks.s b/libsrc/c64/soft80_cpeeks.s new file mode 100644 index 000000000..837afef1e --- /dev/null +++ b/libsrc/c64/soft80_cpeeks.s @@ -0,0 +1,71 @@ +; +; 2017-12-27, groepaz +; +; void cpeeks (char* s, unsigned length); +; + .export soft80_cpeeks + .import soft80_cpeekc, soft80_kplot, popax + + .importzp ptr1, ptr2 + + .include "c64.inc" + .include "soft80.inc" + +soft80_cpeeks: + eor #<$FFFF ; counting a word upward is faster + sta ptr2 ; so, we use -(length + 1) + txa + eor #>$FFFF + sta ptr2+1 + + jsr popax + sta ptr1 + stx ptr1+1 + + ; save current cursor position + lda CURS_X + pha + lda CURS_Y + pha + + ; get the string +@lp: + jsr soft80_cpeekc + ldy #0 + sta (ptr1),y + + ; advance cursor position + ldy CURS_X + ldx CURS_Y + iny + cpy #charsperline + bne @sk2 + ldy #0 + inx +@sk2: + sty CURS_X + stx CURS_Y + clc + jsr soft80_kplot + + inc ptr1 + bne @sk + inc ptr1+1 +@sk: + inc ptr2 + bne @lp + inc ptr2+1 + bne @lp + + ; terminate the string + lda #0 + ldy #0 + sta (ptr1),y + + ; restore the cursor position + pla + tax ; CURS_Y + pla + tay ; CURS_X + clc + jmp soft80_kplot diff --git a/libsrc/c64/soft80mono_cpeekcolor.s b/libsrc/c64/soft80mono_cpeekcolor.s new file mode 100644 index 000000000..a03875a74 --- /dev/null +++ b/libsrc/c64/soft80mono_cpeekcolor.s @@ -0,0 +1,17 @@ +; +; 2017-12-27, Groepaz +; +; unsigned char cpeekcolor (void); +; + + .export soft80mono_cpeekcolor + + .include "c64.inc" + .include "soft80.inc" + + .segment "CODE" + +soft80mono_cpeekcolor: + lda CHARCOLOR + ldx #0 + rts From 142ba126348839e6a01bf160b61628a30ac4ba94 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Thu, 28 Dec 2017 01:58:58 +0100 Subject: [PATCH 03/37] updated testprog --- testcode/lib/cpeek-test.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/testcode/lib/cpeek-test.c b/testcode/lib/cpeek-test.c index 5f3bfc524..ffcdb8bf1 100644 --- a/testcode/lib/cpeek-test.c +++ b/testcode/lib/cpeek-test.c @@ -113,6 +113,17 @@ static unsigned char testCPeekC (char ch) return 1; } + /* toggle revers mode every few chars so cpeekc gets tested for both */ + revers ((ch >> 3) & 1); + + /* output additional space every now and then, that way not only even or only + odd half of the character cell will be tested */ +#if defined(__C64__) + if ((width == 80) && ((ch % 17) == 0)) { + cputc(' '); + } +#endif + /* Output the char to the screen. */ cputc (ch); @@ -141,8 +152,8 @@ static unsigned char testCPeekC (char ch) */ ch2_c = peekChWithoutTranslation (); if ((ch2_c != ch2_b) -#if defined(__C128__) - /* VDC memory is not accessable */ +#if defined(__C128__) || defined(__C64__) + /* VDC memory is not accessable, soft80 has no "videoram" */ && (width == 40) #endif ){ @@ -230,7 +241,7 @@ int main (void) int ret = 0; clrscr (); - revers (1); + revers (0); textcolor(1); bgcolor(0); screensize (&width, &i); @@ -261,7 +272,7 @@ int main (void) #if defined (__CBM610__) || defined (__PET__) cprintf("\n\rno COLOR_RAM\n\r"); -#elif defined (__C128__) +#elif defined (__C128__) || defined (__C64__) if (width == 40) { cprintf("\n\rCOLOR_RAM at $%04x\n\r", COLOR_RAM); } else { From f207a60365c7a226f907b3218f73e3163be1223d Mon Sep 17 00:00:00 2001 From: mrdudz Date: Thu, 28 Dec 2017 02:26:23 +0100 Subject: [PATCH 04/37] some cleanup --- libsrc/c64/soft80_cpeekc.s | 57 +++++++++------------------------ libsrc/c64/soft80_cpeekrevers.s | 5 +++ 2 files changed, 20 insertions(+), 42 deletions(-) diff --git a/libsrc/c64/soft80_cpeekc.s b/libsrc/c64/soft80_cpeekc.s index 2801ade97..63ad635e7 100644 --- a/libsrc/c64/soft80_cpeekc.s +++ b/libsrc/c64/soft80_cpeekc.s @@ -1,3 +1,8 @@ +; +; 2017-12-28, Groepaz +; +; char cpeekc (void); +; .export soft80_cpeekc, soft80_cpeekchar @@ -16,8 +21,6 @@ soft80_cpeekc: soft80_cpeekchar: sei - ;;dec $01 ;; assumed = $36 - ;;dec $01 ;; assumed = $36 lda #$34 sta $01 @@ -32,105 +35,77 @@ soft80_cpeekchar: @l2aa: ldy #0 -;; stx $d020 - .repeat 8,line -;; jsr readdirect lda (SCREEN_PTR),y and #$f0 -; sta $e100,y cmp soft80_hi_charset+(line*$80),x -; cmp #0 bne @l2b .if (line < 7) iny .endif .endrepeat - @backok: -;inc $d020 -; inc $01 -; inc $01 lda #$36 sta $01 cli txa ; return char in A - ; sec -; sbc #$20 ldx #$00 ; revers flag -;inc $d020 rts @l2b: -;jmp * inx cpx #$80 jne @l2aa ; test inverted character (left side) - + ldx #0 @l2aa2: ldy #0 -;; stx $d020 - .repeat 8,line -;; jsr readdirect lda (SCREEN_PTR),y and #$f0 eor #$f0 cmp soft80_hi_charset+(line*$80),x -; cmp #0 bne @l2b2 .if (line < 7) iny .endif .endrepeat - + @backokrevers: -;inc $d020 -; inc $01 -; inc $01 lda #$36 sta $01 cli txa ; return char in A - ; sec -; sbc #$20 ldx #$01 ; revers flag -;inc $d020 rts - + @l2b2: inx cpx #$80 jne @l2aa2 - + @backerr: -;inc $d020 - ;; inc $01 -;; inc $01 lda #$36 sta $01 cli ldx #0 txa - rts ; test non-inverted character (right side) - + @l1a: ldx #0 @l1aa: ldy #0 .repeat 8,line -;; jsr readdirect lda (SCREEN_PTR),y and #$0f eor soft80_lo_charset+(line*$80),x - bne @l2bb + bne @l2bb .if line < 7 iny .endif @@ -140,19 +115,18 @@ soft80_cpeekchar: inx cpx #$80 bne @l1aa - + ; test inverted character (right side) - + ldx #0 @l1aa2: ldy #0 .repeat 8,line -;; jsr readdirect lda (SCREEN_PTR),y and #$0f eor #$0f eor soft80_lo_charset+(line*$80),x - bne @l2bb2 + bne @l2bb2 .if line < 7 iny .endif @@ -162,7 +136,6 @@ soft80_cpeekchar: inx cpx #$80 bne @l1aa2 - - + jmp @backerr diff --git a/libsrc/c64/soft80_cpeekrevers.s b/libsrc/c64/soft80_cpeekrevers.s index 6fc0c166a..779636ed5 100644 --- a/libsrc/c64/soft80_cpeekrevers.s +++ b/libsrc/c64/soft80_cpeekrevers.s @@ -1,3 +1,8 @@ +; +; 2017-12-28, Groepaz +; +; unsigned char cpeekrevers (void); +; .import soft80_cpeekchar From 30c6018887060df7286ac6d411182c4996da96a2 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Thu, 28 Dec 2017 04:54:18 +0100 Subject: [PATCH 05/37] Implementation of getfirstdevice/getnextdevice for Atari. --- libsrc/atari/getdevice.s | 78 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 libsrc/atari/getdevice.s diff --git a/libsrc/atari/getdevice.s b/libsrc/atari/getdevice.s new file mode 100644 index 000000000..e0e700436 --- /dev/null +++ b/libsrc/atari/getdevice.s @@ -0,0 +1,78 @@ +; +; Oliver Schmidt, 2012-09-04 +; Christian Groessler, 2017-12-28 +; +; unsigned char getfirstdevice (void); +; unsigned char __fastcall__ getnextdevice (unsigned char device); +; + + .include "atari.inc" + .export _getfirstdevice + .export _getnextdevice + +MAX_DIO_DEVICES = 8 + +;------------------------------------------------------------------------------ +; _getfirstdevice + +_getfirstdevice: + lda #$FF + ; Fall through + +;------------------------------------------------------------------------------ +; _getnextdevice + +_getnextdevice: + tax +next: inx + cpx #MAX_DIO_DEVICES + beq none + + jsr check_device + bmi next + +done: txa + ldx #$00 + rts + +none: ldx #255 ; INVALID_DEVICE (see include/device.h) + bne done ; jump always + +;------------------------------------------------------------------------------ +; check_device - checks if a disk device is present +; input: X - device id (0 = D1, 1 = D2, ...) +; output: NF - 0/1 for detected/not detected +; X register preserved + +check_device: + txa + pha + lda #SIO_STAT + sta DCOMND ; set command into DCB + lda #%01000000 ; direction value, "receive data" + sta DSTATS ; set data flow directon + lda #15 + sta DTIMLO ; value got from DOS source + lda #4 + sta DAUX1 ; set sector # (dummy: 4) + sta DBYTLO ; # of bytes to transfer + lda #0 + sta DAUX2 + sta DBYTHI + lda #>DVSTAT + sta DBUFHI + lda # Date: Thu, 28 Dec 2017 17:52:27 +0100 Subject: [PATCH 06/37] convert to petscii --- libsrc/c64/soft80_cpeekc.s | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libsrc/c64/soft80_cpeekc.s b/libsrc/c64/soft80_cpeekc.s index 63ad635e7..576d50fc1 100644 --- a/libsrc/c64/soft80_cpeekc.s +++ b/libsrc/c64/soft80_cpeekc.s @@ -15,6 +15,13 @@ soft80_cpeekc: jsr soft80_cpeekchar + ; 0-1F -> A0-BF + ; 20-7F -> 20-7F + cmp #$20 + bcs @sk + ;clc + adc #$a0 +@sk: ldx #0 rts From b08839cac4ba6386b2227782131f1f264dbe5719 Mon Sep 17 00:00:00 2001 From: bauen1 Date: Sun, 31 Dec 2017 15:49:17 +0100 Subject: [PATCH 07/37] Added libray to none target --- doc/customizing.sgml | 41 +++++++++++++++++++---------------------- libsrc/Makefile | 3 ++- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/doc/customizing.sgml b/doc/customizing.sgml index e502f2e9d..d8f6ef6be 100644 --- a/doc/customizing.sgml +++ b/doc/customizing.sgml @@ -302,23 +302,20 @@ also forcing a BRK instruction into the CPU. Custom Run-Time Library Creation

The next step in customizing the cc65 toolset is creating a run-time -library for the targeted hardware. The easiest way to do this is to -modify a standard library from the cc65 distribution. In this example, -there is no console I/O, mouse, joystick, etc. in the system, so it is -most appropriate to use the simplest library as the base, which is for -the Watara Supervision and is named "supervision.lib" in the -lib directory of the distribution. +library for the targeted hardware. The recommended way to do this is to +modify the platform-independent standard library of the cc65 distribution. +It is named "none.lib" in the lib directory of the distribution. -The only modification required is to replace the crt0 module in -the supervision.lib library with custom startup code. This is simply -done by first copying the library and giving it a new name, compiling -the startup code with ca65, and finally using the ar65 archiver to -replace the module in the new library. The steps are shown below: +When using "none.lib" we need to supply our own crt0 +module with custom startup code. This is simply done by first copying the +the library and giving it a new name, compiling the startup code with ca65, +and finally using the ar65 archiver to add the module to the new library. +The steps are shown below: -$ copy "C:\Program Files\cc65\lib\supervision.lib" sbc.lib -$ ca65 crt0.s -$ ar65 a sbc.lib crt0.o + cp /usr/local/share/cc65/lib/none.lib sbc.lib + ca65 crt0.s + ar65 a sbc.lib crt0.o Interrupt Service Routine Definition

@@ -706,14 +703,14 @@ that can be used as the initialization data for the Xilinx Block RAM used for code storage: -$ cc65 -t none -O --cpu 65sc02 main.c -$ ca65 --cpu 65sc02 main.s -$ ca65 --cpu 65sc02 rs232_tx.s -$ ca65 --cpu 65sc02 interrupt.s -$ ca65 --cpu 65sc02 vectors.s -$ ca65 --cpu 65sc02 wait.s -$ ld65 -C sbc.cfg -m main.map interrupt.o vectors.o wait.o rs232_tx.o - main.o sbc.lib + cc65 -t none -O --cpu 65sc02 main.c + ca65 --cpu 65sc02 main.s + ca65 --cpu 65sc02 rs232_tx.s + ca65 --cpu 65sc02 interrupt.s + ca65 --cpu 65sc02 vectors.s + ca65 --cpu 65sc02 wait.s + ld65 -C sbc.cfg -m main.map interrupt.o vectors.o wait.o + rs232_tx.o main.o sbc.lib During the C-level code compilation phase (cc65), assumptions diff --git a/libsrc/Makefile b/libsrc/Makefile index 0583b6761..2ac0c78f0 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -32,7 +32,8 @@ TARGETS = apple2 \ sim6502 \ sim65c02 \ supervision \ - telestrat + telestrat \ + none DRVTYPES = emd \ joy \ From d9ba279e8935e61181249fd088af33b9c021fb70 Mon Sep 17 00:00:00 2001 From: bauen1 Date: Mon, 1 Jan 2018 01:34:53 +0100 Subject: [PATCH 08/37] Fixed a typo in doc/customizing.sqml --- doc/customizing.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/customizing.sgml b/doc/customizing.sgml index d8f6ef6be..1ae49f3c0 100644 --- a/doc/customizing.sgml +++ b/doc/customizing.sgml @@ -306,7 +306,7 @@ library for the targeted hardware. The recommended way to do this is to modify the platform-independent standard library of the cc65 distribution. It is named "none.lib" in the lib directory of the distribution. -When using "none.lib" we need to supply our own crt0 +When using "none.lib" we need to supply our own crt0 module with custom startup code. This is simply done by first copying the the library and giving it a new name, compiling the startup code with ca65, and finally using the ar65 archiver to add the module to the new library. From 4abe12c729330dda3822b0356dbdf0737829d097 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Mon, 1 Jan 2018 14:01:25 +0100 Subject: [PATCH 09/37] fix spelling --- testcode/lib/cpeek-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcode/lib/cpeek-test.c b/testcode/lib/cpeek-test.c index ffcdb8bf1..aef4cb4e3 100644 --- a/testcode/lib/cpeek-test.c +++ b/testcode/lib/cpeek-test.c @@ -153,7 +153,7 @@ static unsigned char testCPeekC (char ch) ch2_c = peekChWithoutTranslation (); if ((ch2_c != ch2_b) #if defined(__C128__) || defined(__C64__) - /* VDC memory is not accessable, soft80 has no "videoram" */ + /* VDC memory is not accessible, soft80 has no "videoram" */ && (width == 40) #endif ){ From 040134e7750f81a6a3b54856c4a1bf38d9244b5c Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Tue, 2 Jan 2018 13:48:30 +0100 Subject: [PATCH 10/37] Fixed typo. --- testcode/lib/cpeek-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcode/lib/cpeek-test.c b/testcode/lib/cpeek-test.c index aef4cb4e3..1777bce4a 100644 --- a/testcode/lib/cpeek-test.c +++ b/testcode/lib/cpeek-test.c @@ -209,7 +209,7 @@ static unsigned char testCPeekCol (char ch) ch2_c = peekColWithoutTranslation (); if ((ch2_c != ch2_b) #if defined(__C128__) - /* VDC memory is not accessable */ + /* VDC memory is not accessible */ && (width == 40) #endif ){ From 26350714ee3a78771061b77b6d20a472f1e40585 Mon Sep 17 00:00:00 2001 From: bauen1 Date: Tue, 2 Jan 2018 15:15:27 +0100 Subject: [PATCH 11/37] Renamed none.lib to no-platform.lib --- doc/customizing.sgml | 9 ++++----- libsrc/Makefile | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/doc/customizing.sgml b/doc/customizing.sgml index 1ae49f3c0..29c525e00 100644 --- a/doc/customizing.sgml +++ b/doc/customizing.sgml @@ -81,7 +81,6 @@ SEGMENTS { ZEROPAGE: load = ZP, type = zp, define = yes; DATA: load = ROM, type = rw, define = yes, run = RAM; BSS: load = RAM, type = bss, define = yes; - HEAP: load = RAM, type = bss, optional = yes; STARTUP: load = ROM, type = ro; ONCE: load = ROM, type = ro, optional = yes; CODE: load = ROM, type = ro; @@ -95,7 +94,6 @@ The meaning of each of these segments is as follows.

ZEROPAGE: Data in page 0, defined by ZP as starting at $0 with length $100

DATA: Initialized data that can be modified by the program, stored in RAM

BSS: Uninitialized data stored in RAM (used for variable storage) -

HEAP: Uninitialized C-level heap storage in RAM, optional

STARTUP: The program initialization code, stored in ROM

ONCE: The code run once to initialize the system, stored in ROM

CODE: The program code, stored in ROM @@ -304,16 +302,17 @@ also forcing a BRK instruction into the CPU. The next step in customizing the cc65 toolset is creating a run-time library for the targeted hardware. The recommended way to do this is to modify the platform-independent standard library of the cc65 distribution. -It is named "none.lib" in the lib directory of the distribution. +It is named "no-platform.lib" in the lib directory of the +cc65 distribution. -When using "none.lib" we need to supply our own crt0 +When using "no-platform.lib" we need to supply our own crt0 module with custom startup code. This is simply done by first copying the the library and giving it a new name, compiling the startup code with ca65, and finally using the ar65 archiver to add the module to the new library. The steps are shown below: - cp /usr/local/share/cc65/lib/none.lib sbc.lib + cp /usr/local/share/cc65/lib/no-platform.lib sbc.lib ca65 crt0.s ar65 a sbc.lib crt0.o diff --git a/libsrc/Makefile b/libsrc/Makefile index 2ac0c78f0..c742ad0c7 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -33,7 +33,7 @@ TARGETS = apple2 \ sim65c02 \ supervision \ telestrat \ - none + no-platform DRVTYPES = emd \ joy \ From 72bb32fcda47e24b584e13666ab675d19d9d4a8b Mon Sep 17 00:00:00 2001 From: bauen1 Date: Tue, 2 Jan 2018 15:32:27 +0100 Subject: [PATCH 12/37] Revert "Renamed none.lib to no-platform.lib" This reverts commit 26350714ee3a78771061b77b6d20a472f1e40585. It breaks the build --- doc/customizing.sgml | 7 +++---- libsrc/Makefile | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/customizing.sgml b/doc/customizing.sgml index 29c525e00..5eb73b648 100644 --- a/doc/customizing.sgml +++ b/doc/customizing.sgml @@ -302,17 +302,16 @@ also forcing a BRK instruction into the CPU. The next step in customizing the cc65 toolset is creating a run-time library for the targeted hardware. The recommended way to do this is to modify the platform-independent standard library of the cc65 distribution. -It is named "no-platform.lib" in the lib directory of the -cc65 distribution. +It is named "none.lib" in the lib directory of the distribution. -When using "no-platform.lib" we need to supply our own crt0 +When using "none.lib" we need to supply our own crt0 module with custom startup code. This is simply done by first copying the the library and giving it a new name, compiling the startup code with ca65, and finally using the ar65 archiver to add the module to the new library. The steps are shown below: - cp /usr/local/share/cc65/lib/no-platform.lib sbc.lib + cp /usr/local/share/cc65/lib/none.lib sbc.lib ca65 crt0.s ar65 a sbc.lib crt0.o diff --git a/libsrc/Makefile b/libsrc/Makefile index c742ad0c7..2ac0c78f0 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -33,7 +33,7 @@ TARGETS = apple2 \ sim65c02 \ supervision \ telestrat \ - no-platform + none DRVTYPES = emd \ joy \ From 14909f12fed0a2f5687ca4152116404234308d09 Mon Sep 17 00:00:00 2001 From: bauen1 Date: Thu, 4 Jan 2018 11:17:20 +0100 Subject: [PATCH 13/37] Implemented the requested changes. Moved none to its alphabetic place in the Makefile Reverted all changes to doc/customizing.sgml --- doc/customizing.sgml | 43 ++++++++++++++++++++++++------------------- libsrc/Makefile | 4 ++-- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/doc/customizing.sgml b/doc/customizing.sgml index 5eb73b648..e502f2e9d 100644 --- a/doc/customizing.sgml +++ b/doc/customizing.sgml @@ -81,6 +81,7 @@ SEGMENTS { ZEROPAGE: load = ZP, type = zp, define = yes; DATA: load = ROM, type = rw, define = yes, run = RAM; BSS: load = RAM, type = bss, define = yes; + HEAP: load = RAM, type = bss, optional = yes; STARTUP: load = ROM, type = ro; ONCE: load = ROM, type = ro, optional = yes; CODE: load = ROM, type = ro; @@ -94,6 +95,7 @@ The meaning of each of these segments is as follows.

ZEROPAGE: Data in page 0, defined by ZP as starting at $0 with length $100

DATA: Initialized data that can be modified by the program, stored in RAM

BSS: Uninitialized data stored in RAM (used for variable storage) +

HEAP: Uninitialized C-level heap storage in RAM, optional

STARTUP: The program initialization code, stored in ROM

ONCE: The code run once to initialize the system, stored in ROM

CODE: The program code, stored in ROM @@ -300,20 +302,23 @@ also forcing a BRK instruction into the CPU. Custom Run-Time Library Creation

The next step in customizing the cc65 toolset is creating a run-time -library for the targeted hardware. The recommended way to do this is to -modify the platform-independent standard library of the cc65 distribution. -It is named "none.lib" in the lib directory of the distribution. +library for the targeted hardware. The easiest way to do this is to +modify a standard library from the cc65 distribution. In this example, +there is no console I/O, mouse, joystick, etc. in the system, so it is +most appropriate to use the simplest library as the base, which is for +the Watara Supervision and is named "supervision.lib" in the +lib directory of the distribution. -When using "none.lib" we need to supply our own crt0 -module with custom startup code. This is simply done by first copying the -the library and giving it a new name, compiling the startup code with ca65, -and finally using the ar65 archiver to add the module to the new library. -The steps are shown below: +The only modification required is to replace the crt0 module in +the supervision.lib library with custom startup code. This is simply +done by first copying the library and giving it a new name, compiling +the startup code with ca65, and finally using the ar65 archiver to +replace the module in the new library. The steps are shown below: - cp /usr/local/share/cc65/lib/none.lib sbc.lib - ca65 crt0.s - ar65 a sbc.lib crt0.o +$ copy "C:\Program Files\cc65\lib\supervision.lib" sbc.lib +$ ca65 crt0.s +$ ar65 a sbc.lib crt0.o Interrupt Service Routine Definition

@@ -701,14 +706,14 @@ that can be used as the initialization data for the Xilinx Block RAM used for code storage: - cc65 -t none -O --cpu 65sc02 main.c - ca65 --cpu 65sc02 main.s - ca65 --cpu 65sc02 rs232_tx.s - ca65 --cpu 65sc02 interrupt.s - ca65 --cpu 65sc02 vectors.s - ca65 --cpu 65sc02 wait.s - ld65 -C sbc.cfg -m main.map interrupt.o vectors.o wait.o - rs232_tx.o main.o sbc.lib +$ cc65 -t none -O --cpu 65sc02 main.c +$ ca65 --cpu 65sc02 main.s +$ ca65 --cpu 65sc02 rs232_tx.s +$ ca65 --cpu 65sc02 interrupt.s +$ ca65 --cpu 65sc02 vectors.s +$ ca65 --cpu 65sc02 wait.s +$ ld65 -C sbc.cfg -m main.map interrupt.o vectors.o wait.o rs232_tx.o + main.o sbc.lib During the C-level code compilation phase (cc65), assumptions diff --git a/libsrc/Makefile b/libsrc/Makefile index 2ac0c78f0..0d0cd320b 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -27,13 +27,13 @@ TARGETS = apple2 \ gamate \ lynx \ nes \ + none \ osic1p \ pce \ sim6502 \ sim65c02 \ supervision \ - telestrat \ - none + telestrat DRVTYPES = emd \ joy \ From 98b2b2544db2390978c0532040a7922ed7d55bc2 Mon Sep 17 00:00:00 2001 From: bauen1 Date: Thu, 4 Jan 2018 12:07:35 +0100 Subject: [PATCH 14/37] Added crt0 to none.lib --- cfg/none.cfg | 1 + libsrc/none/crt0.s | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 libsrc/none/crt0.s diff --git a/cfg/none.cfg b/cfg/none.cfg index 6742da7c8..44bbcdfec 100644 --- a/cfg/none.cfg +++ b/cfg/none.cfg @@ -7,6 +7,7 @@ MEMORY { } SEGMENTS { ZEROPAGE: load = ZP, type = zp; + STARTUP: load = MAIN, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes; ONCE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = rw; diff --git a/libsrc/none/crt0.s b/libsrc/none/crt0.s new file mode 100644 index 000000000..fb26fb2af --- /dev/null +++ b/libsrc/none/crt0.s @@ -0,0 +1,25 @@ + .export _exit + .export __STARTUP__ : absolute = 1 ; Mark as startup + .import zerobss, _main + .import initlib, donelib + .import __MAIN_START__, __MAIN_SIZE__ ; Linker generated + .import __STACKSIZE__ ; Linker generated + + .include "zeropage.inc" + + .segment "STARTUP" + + cld + ldx #$FF + txs + lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) + ldx #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) + sta sp + stx sp+1 + jsr zerobss + jsr initlib + jsr _main +_exit: pha + jsr donelib + pla + brk From 884dfcf3c15672fc7caa9b0b709d49b3f2672ca6 Mon Sep 17 00:00:00 2001 From: bauen1 Date: Thu, 4 Jan 2018 12:22:42 +0100 Subject: [PATCH 15/37] Fixed none.lib missing symbols --- cfg/none.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg/none.cfg b/cfg/none.cfg index 44bbcdfec..cb8dbd400 100644 --- a/cfg/none.cfg +++ b/cfg/none.cfg @@ -3,7 +3,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0000, size = $0001F; - MAIN: file = %O, start = %S, size = $10000 - __STACKSIZE__; + MAIN: file = %O, start = %S, size = $10000 - __STACKSIZE__, define = yes; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; From 4759d3956e50d18b85c1a650777d0b6bd0bda90f Mon Sep 17 00:00:00 2001 From: bauen1 Date: Thu, 4 Jan 2018 13:54:00 +0100 Subject: [PATCH 16/37] Removed initialization of the stack from none.lib --- libsrc/none/crt0.s | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libsrc/none/crt0.s b/libsrc/none/crt0.s index fb26fb2af..7858ad839 100644 --- a/libsrc/none/crt0.s +++ b/libsrc/none/crt0.s @@ -9,9 +9,6 @@ .segment "STARTUP" - cld - ldx #$FF - txs lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) sta sp @@ -22,4 +19,4 @@ _exit: pha jsr donelib pla - brk + rts From 60c68b11113f40da67b5ddae379c0b571d4f2bc7 Mon Sep 17 00:00:00 2001 From: bauen1 Date: Thu, 4 Jan 2018 17:11:44 +0100 Subject: [PATCH 17/37] cl65 now links against none.lib when using --target none --- src/cl65/main.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/cl65/main.c b/src/cl65/main.c index 565f20b45..5a2103b24 100644 --- a/src/cl65/main.c +++ b/src/cl65/main.c @@ -380,19 +380,14 @@ static void CmdPrint (CmdDesc* Cmd, FILE* F) static void SetTargetFiles (void) /* Set the target system files */ { - /* Determine the names of the target specific library file */ - if (Target != TGT_NONE) { + /* Get a pointer to the system name and its length */ + const char* TargetName = GetTargetName (Target); + unsigned TargetNameLen = strlen (TargetName); - /* Get a pointer to the system name and its length */ - const char* TargetName = GetTargetName (Target); - unsigned TargetNameLen = strlen (TargetName); - - /* Set the library file */ - TargetLib = xmalloc (TargetNameLen + 4 + 1); - memcpy (TargetLib, TargetName, TargetNameLen); - strcpy (TargetLib + TargetNameLen, ".lib"); - - } + /* Set the library file */ + TargetLib = xmalloc (TargetNameLen + 4 + 1); + memcpy (TargetLib, TargetName, TargetNameLen); + strcpy (TargetLib + TargetNameLen, ".lib"); } From ef993f2fcf0fde941a40e0fd6022596b6558e0a9 Mon Sep 17 00:00:00 2001 From: bauen1 Date: Thu, 4 Jan 2018 21:29:58 +0100 Subject: [PATCH 18/37] none.cfg consistency changes --- cfg/none.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg/none.cfg b/cfg/none.cfg index cb8dbd400..f82e9707f 100644 --- a/cfg/none.cfg +++ b/cfg/none.cfg @@ -3,7 +3,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = $0000, size = $0001F; - MAIN: file = %O, start = %S, size = $10000 - __STACKSIZE__, define = yes; + MAIN: file = %O, define = yes, start = %S, size = $10000 - __STACKSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; From cea833208454a9667eebc2361df56cfd4184822c Mon Sep 17 00:00:00 2001 From: bauen1 Date: Thu, 4 Jan 2018 22:01:44 +0100 Subject: [PATCH 19/37] Fixed none.cfg --- cfg/none.cfg | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cfg/none.cfg b/cfg/none.cfg index f82e9707f..26f5379cd 100644 --- a/cfg/none.cfg +++ b/cfg/none.cfg @@ -1,9 +1,14 @@ +FEATURES { + STARTADDRESS: default = $1000; +} SYMBOLS { - __STACKSIZE__: type = weak, value = $0800; # 2k stack + __STACKSIZE__: type = weak, value = $0800; # 2k stack + __STACKSTART__: type = weak, value = $8000; + __ZPSTART__: type = weak, value = $0080; } MEMORY { - ZP: file = "", define = yes, start = $0000, size = $0001F; - MAIN: file = %O, define = yes, start = %S, size = $10000 - __STACKSIZE__; + ZP: file = "", define = yes, start = __ZPSTART__, size = $001F; + MAIN: file = %O, define = yes, start = %S, size = __STACKSTART__ - __STACKSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; From 45482b4fb1fdf69d149cbdd5aa7aafdbc816020d Mon Sep 17 00:00:00 2001 From: bauen1 Date: Thu, 4 Jan 2018 22:14:01 +0100 Subject: [PATCH 20/37] Fixed none/crt0.s to respect none.cfg --- libsrc/none/crt0.s | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libsrc/none/crt0.s b/libsrc/none/crt0.s index 7858ad839..a90f60d26 100644 --- a/libsrc/none/crt0.s +++ b/libsrc/none/crt0.s @@ -2,15 +2,14 @@ .export __STARTUP__ : absolute = 1 ; Mark as startup .import zerobss, _main .import initlib, donelib - .import __MAIN_START__, __MAIN_SIZE__ ; Linker generated - .import __STACKSIZE__ ; Linker generated + .import __STACKSTART__, __STACKSIZE__ ; Linker generated .include "zeropage.inc" .segment "STARTUP" - lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) - ldx #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) + lda #<__STACKSTART__ + lda #>__STACKSTART__ sta sp stx sp+1 jsr zerobss From aa34aed7dd87984dda900f3b171a87da3d361095 Mon Sep 17 00:00:00 2001 From: bauen1 Date: Thu, 4 Jan 2018 22:27:39 +0100 Subject: [PATCH 21/37] Fixed unused import and export of none.cfg and none/crt0.s --- cfg/none.cfg | 2 +- libsrc/none/crt0.s | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cfg/none.cfg b/cfg/none.cfg index 26f5379cd..cedd2d839 100644 --- a/cfg/none.cfg +++ b/cfg/none.cfg @@ -8,7 +8,7 @@ SYMBOLS { } MEMORY { ZP: file = "", define = yes, start = __ZPSTART__, size = $001F; - MAIN: file = %O, define = yes, start = %S, size = __STACKSTART__ - __STACKSIZE__; + MAIN: file = %O, start = %S, size = __STACKSTART__ - __STACKSIZE__ - %S; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; diff --git a/libsrc/none/crt0.s b/libsrc/none/crt0.s index a90f60d26..288d0dc29 100644 --- a/libsrc/none/crt0.s +++ b/libsrc/none/crt0.s @@ -2,7 +2,7 @@ .export __STARTUP__ : absolute = 1 ; Mark as startup .import zerobss, _main .import initlib, donelib - .import __STACKSTART__, __STACKSIZE__ ; Linker generated + .import __STACKSTART__ ; Linker generated .include "zeropage.inc" From 94077404f9ecd6fd6d4354509bfbd3f34a1a63a5 Mon Sep 17 00:00:00 2001 From: bauen1 Date: Fri, 5 Jan 2018 10:39:23 +0100 Subject: [PATCH 22/37] Added ctype.s to none.lib as suggested by oliverschmidt --- libsrc/none/ctype.s | 159 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 libsrc/none/ctype.s diff --git a/libsrc/none/ctype.s b/libsrc/none/ctype.s new file mode 100644 index 000000000..35968f982 --- /dev/null +++ b/libsrc/none/ctype.s @@ -0,0 +1,159 @@ +; +; Ullrich von Bassewitz, 2003-10-10 +; +; Character specification table. +; + + .include "ctype.inc" + +; The tables are readonly, put them into the rodata segment + +.rodata + +; The following 256 byte wide table specifies attributes for the isxxx type +; of functions. Doing it by a table means some overhead in space, but it +; has major advantages: +; +; * It is fast. If it weren't for the slow parameter passing of cc65, one +; could even define macros for the isxxx functions (this is usually +; done on other platforms). +; +; * It is highly portable. The only unportable part is the table itself, +; all real code goes into the common library. +; +; * We save some code in the isxxx functions. + + +__ctype: + .byte CT_CTRL ; 0/00 ___ctrl_@___ + .byte CT_CTRL ; 1/01 ___ctrl_A___ + .byte CT_CTRL ; 2/02 ___ctrl_B___ + .byte CT_CTRL ; 3/03 ___ctrl_C___ + .byte CT_CTRL ; 4/04 ___ctrl_D___ + .byte CT_CTRL ; 5/05 ___ctrl_E___ + .byte CT_CTRL ; 6/06 ___ctrl_F___ + .byte CT_CTRL ; 7/07 ___ctrl_G___ + .byte CT_CTRL ; 8/08 ___ctrl_H___ + .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB + ; 9/09 ___ctrl_I___ + .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___ + .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___ + .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___ + .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___ + .byte CT_CTRL ; 14/0e ___ctrl_N___ + .byte CT_CTRL ; 15/0f ___ctrl_O___ + .byte CT_CTRL ; 16/10 ___ctrl_P___ + .byte CT_CTRL ; 17/11 ___ctrl_Q___ + .byte CT_CTRL ; 18/12 ___ctrl_R___ + .byte CT_CTRL ; 19/13 ___ctrl_S___ + .byte CT_CTRL ; 20/14 ___ctrl_T___ + .byte CT_CTRL ; 21/15 ___ctrl_U___ + .byte CT_CTRL ; 22/16 ___ctrl_V___ + .byte CT_CTRL ; 23/17 ___ctrl_W___ + .byte CT_CTRL ; 24/18 ___ctrl_X___ + .byte CT_CTRL ; 25/19 ___ctrl_Y___ + .byte CT_CTRL ; 26/1a ___ctrl_Z___ + .byte CT_CTRL ; 27/1b ___ctrl_[___ + .byte CT_CTRL ; 28/1c ___ctrl_\___ + .byte CT_CTRL ; 29/1d ___ctrl_]___ + .byte CT_CTRL ; 30/1e ___ctrl_^___ + .byte CT_CTRL ; 31/1f ___ctrl_____ + .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___ + .byte CT_NONE ; 33/21 _____!_____ + .byte CT_NONE ; 34/22 _____"_____ + .byte CT_NONE ; 35/23 _____#_____ + .byte CT_NONE ; 36/24 _____$_____ + .byte CT_NONE ; 37/25 _____%_____ + .byte CT_NONE ; 38/26 _____&_____ + .byte CT_NONE ; 39/27 _____'_____ + .byte CT_NONE ; 40/28 _____(_____ + .byte CT_NONE ; 41/29 _____)_____ + .byte CT_NONE ; 42/2a _____*_____ + .byte CT_NONE ; 43/2b _____+_____ + .byte CT_NONE ; 44/2c _____,_____ + .byte CT_NONE ; 45/2d _____-_____ + .byte CT_NONE ; 46/2e _____._____ + .byte CT_NONE ; 47/2f _____/_____ + .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____ + .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____ + .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____ + .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____ + .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____ + .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____ + .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____ + .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____ + .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____ + .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____ + .byte CT_NONE ; 58/3a _____:_____ + .byte CT_NONE ; 59/3b _____;_____ + .byte CT_NONE ; 60/3c _____<_____ + .byte CT_NONE ; 61/3d _____=_____ + .byte CT_NONE ; 62/3e _____>_____ + .byte CT_NONE ; 63/3f _____?_____ + + .byte CT_NONE ; 64/40 _____@_____ + .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____ + .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____ + .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____ + .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____ + .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____ + .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____ + .byte CT_UPPER ; 71/47 _____G_____ + .byte CT_UPPER ; 72/48 _____H_____ + .byte CT_UPPER ; 73/49 _____I_____ + .byte CT_UPPER ; 74/4a _____J_____ + .byte CT_UPPER ; 75/4b _____K_____ + .byte CT_UPPER ; 76/4c _____L_____ + .byte CT_UPPER ; 77/4d _____M_____ + .byte CT_UPPER ; 78/4e _____N_____ + .byte CT_UPPER ; 79/4f _____O_____ + .byte CT_UPPER ; 80/50 _____P_____ + .byte CT_UPPER ; 81/51 _____Q_____ + .byte CT_UPPER ; 82/52 _____R_____ + .byte CT_UPPER ; 83/53 _____S_____ + .byte CT_UPPER ; 84/54 _____T_____ + .byte CT_UPPER ; 85/55 _____U_____ + .byte CT_UPPER ; 86/56 _____V_____ + .byte CT_UPPER ; 87/57 _____W_____ + .byte CT_UPPER ; 88/58 _____X_____ + .byte CT_UPPER ; 89/59 _____Y_____ + .byte CT_UPPER ; 90/5a _____Z_____ + .byte CT_NONE ; 91/5b _____[_____ + .byte CT_NONE ; 92/5c _____\_____ + .byte CT_NONE ; 93/5d _____]_____ + .byte CT_NONE ; 94/5e _____^_____ + .byte CT_NONE ; 95/5f _UNDERLINE_ + .byte CT_NONE ; 96/60 ___grave___ + .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____ + .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____ + .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____ + .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____ + .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____ + .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____ + .byte CT_LOWER ; 103/67 _____g_____ + .byte CT_LOWER ; 104/68 _____h_____ + .byte CT_LOWER ; 105/69 _____i_____ + .byte CT_LOWER ; 106/6a _____j_____ + .byte CT_LOWER ; 107/6b _____k_____ + .byte CT_LOWER ; 108/6c _____l_____ + .byte CT_LOWER ; 109/6d _____m_____ + .byte CT_LOWER ; 110/6e _____n_____ + .byte CT_LOWER ; 111/6f _____o_____ + .byte CT_LOWER ; 112/70 _____p_____ + .byte CT_LOWER ; 113/71 _____q_____ + .byte CT_LOWER ; 114/72 _____r_____ + .byte CT_LOWER ; 115/73 _____s_____ + .byte CT_LOWER ; 116/74 _____t_____ + .byte CT_LOWER ; 117/75 _____u_____ + .byte CT_LOWER ; 118/76 _____v_____ + .byte CT_LOWER ; 119/77 _____w_____ + .byte CT_LOWER ; 120/78 _____x_____ + .byte CT_LOWER ; 121/79 _____y_____ + .byte CT_LOWER ; 122/7a _____z_____ + .byte CT_NONE ; 123/7b _____{_____ + .byte CT_NONE ; 124/7c _____|_____ + .byte CT_NONE ; 125/7d _____}_____ + .byte CT_NONE ; 126/7e _____~_____ + .byte CT_OTHER_WS ; 127/7f ____DEL____ + + .res 128, CT_NONE ; 128-255 From e7aabce8e9724ed6493abfac1329f9c8a4634a54 Mon Sep 17 00:00:00 2001 From: prandeamus Date: Sun, 7 Jan 2018 18:57:48 +0000 Subject: [PATCH 23/37] Complain if unsupported flags are provided after -O --- src/cc65/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cc65/main.c b/src/cc65/main.c index d3d298876..f8361f41c 100644 --- a/src/cc65/main.c +++ b/src/cc65/main.c @@ -986,6 +986,9 @@ int main (int argc, char* argv[]) case 's': IS_Set (&InlineStdFuncs, 1); break; + default: + UnknownOption (Arg); + break; } } break; From da22c90d33fcd4466f770f54755dbb886530f6ee Mon Sep 17 00:00:00 2001 From: Greg King Date: Tue, 9 Jan 2018 04:48:39 -0500 Subject: [PATCH 24/37] Shrank Telestrat initcwd.s by 3 bytes. Changing when a loop test is done allowed the removal of an extra STA instruction. --- libsrc/telestrat/initcwd.s | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/libsrc/telestrat/initcwd.s b/libsrc/telestrat/initcwd.s index f359ebeb4..dc3c53257 100644 --- a/libsrc/telestrat/initcwd.s +++ b/libsrc/telestrat/initcwd.s @@ -10,22 +10,19 @@ initcwd: - ldx #PWD_PTR BRK_TELEMON XVARS - + sta ptr1 sty ptr1+1 - + ldy #$00 - -loop: +loop: lda (ptr1),y - beq done sta __cwd,y + beq done iny bne loop - -done: - sta __cwd,y + +done: rts From c67e90dd19497286f02e02f9c0d2641a509ddaa6 Mon Sep 17 00:00:00 2001 From: Greg King Date: Mon, 8 Jan 2018 12:47:00 -0500 Subject: [PATCH 25/37] Changed the type of a compiler variable that holds either integers or pointers. The change allows cc65 to be compiled on 64-bit Windows, without getting warnings. That OS is actually 32 bits with 64-bit pointers. Its pointers are "long long" instead of "long". The change uses type-names that are configured for the actual pointer width. --- src/cc65/codegen.c | 19 ++++++++++--------- src/cc65/codegen.h | 13 +++++++------ src/cc65/expr.c | 10 +++++----- src/cc65/exprdesc.c | 3 +-- src/cc65/exprdesc.h | 3 ++- src/common/inttypes.h | 21 ++++++++++----------- 6 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/cc65/codegen.c b/src/cc65/codegen.c index dfc06fccc..9e5102728 100644 --- a/src/cc65/codegen.c +++ b/src/cc65/codegen.c @@ -40,6 +40,7 @@ /* common */ #include "check.h" #include "cpu.h" +#include "inttypes.h" #include "strbuf.h" #include "xmalloc.h" #include "xsprintf.h" @@ -92,7 +93,7 @@ static void CheckLocalOffs (unsigned Offs) -static const char* GetLabelName (unsigned Flags, unsigned long Label, long Offs) +static const char* GetLabelName (unsigned Flags, uintptr_t Label, long Offs) { static char Buf [256]; /* Label name */ @@ -119,7 +120,7 @@ static const char* GetLabelName (unsigned Flags, unsigned long Label, long Offs) case CF_ABSOLUTE: /* Absolute address */ - xsprintf (Buf, sizeof (Buf), "$%04X", (int)((Label+Offs) & 0xFFFF)); + xsprintf (Buf, sizeof (Buf), "$%04X", (unsigned)((Label+Offs) & 0xFFFF)); break; case CF_REGVAR: @@ -729,7 +730,7 @@ void g_getimmed (unsigned Flags, unsigned long Val, long Offs) -void g_getstatic (unsigned flags, unsigned long label, long offs) +void g_getstatic (unsigned flags, uintptr_t label, long offs) /* Fetch an static memory cell into the primary register */ { /* Create the correct label name */ @@ -1008,7 +1009,7 @@ void g_leavariadic (int Offs) -void g_putstatic (unsigned flags, unsigned long label, long offs) +void g_putstatic (unsigned flags, uintptr_t label, long offs) /* Store the primary register into the specified static memory cell */ { /* Create the correct label name */ @@ -1584,7 +1585,7 @@ void g_addlocal (unsigned flags, int offs) -void g_addstatic (unsigned flags, unsigned long label, long offs) +void g_addstatic (unsigned flags, uintptr_t label, long offs) /* Add a static variable to ax */ { unsigned L; @@ -1634,7 +1635,7 @@ void g_addstatic (unsigned flags, unsigned long label, long offs) -void g_addeqstatic (unsigned flags, unsigned long label, long offs, +void g_addeqstatic (unsigned flags, uintptr_t label, long offs, unsigned long val) /* Emit += for a static variable */ { @@ -1857,7 +1858,7 @@ void g_addeqind (unsigned flags, unsigned offs, unsigned long val) -void g_subeqstatic (unsigned flags, unsigned long label, long offs, +void g_subeqstatic (unsigned flags, uintptr_t label, long offs, unsigned long val) /* Emit -= for a static variable */ { @@ -2093,7 +2094,7 @@ void g_addaddr_local (unsigned flags attribute ((unused)), int offs) -void g_addaddr_static (unsigned flags, unsigned long label, long offs) +void g_addaddr_static (unsigned flags, uintptr_t label, long offs) /* Add the address of a static variable to ax */ { /* Create the correct label name */ @@ -4276,7 +4277,7 @@ void g_initstatic (unsigned InitLabel, unsigned VarLabel, unsigned Size) g_getimmed (CF_STATIC, InitLabel, 0); AddCodeLine ("jsr pushax"); g_getimmed (CF_INT | CF_UNSIGNED | CF_CONST, Size, 0); - AddCodeLine ("jsr %s", GetLabelName (CF_EXTERNAL, (unsigned long) "memcpy", 0)); + AddCodeLine ("jsr %s", GetLabelName (CF_EXTERNAL, (uintptr_t) "memcpy", 0)); } } diff --git a/src/cc65/codegen.h b/src/cc65/codegen.h index 4ad375618..bbad0f125 100644 --- a/src/cc65/codegen.h +++ b/src/cc65/codegen.h @@ -40,6 +40,7 @@ /* common */ #include "coll.h" +#include "inttypes.h" /* cc65 */ #include "segments.h" @@ -266,7 +267,7 @@ void g_restore_regvars (int StackOffs, int RegOffs, unsigned Bytes); void g_getimmed (unsigned Flags, unsigned long Val, long Offs); /* Load a constant into the primary register */ -void g_getstatic (unsigned Flags, unsigned long Label, long Offs); +void g_getstatic (unsigned Flags, uintptr_t Label, long Offs); /* Fetch an static memory cell into the primary register */ void g_getlocal (unsigned Flags, int Offs); @@ -293,7 +294,7 @@ void g_leavariadic (int Offs); -void g_putstatic (unsigned flags, unsigned long label, long offs); +void g_putstatic (unsigned flags, uintptr_t label, long offs); /* Store the primary register into the specified static memory cell */ void g_putlocal (unsigned Flags, int Offs, long Val); @@ -315,7 +316,7 @@ void g_putind (unsigned flags, unsigned offs); void g_addlocal (unsigned flags, int offs); /* Add a local variable to ax */ -void g_addstatic (unsigned flags, unsigned long label, long offs); +void g_addstatic (unsigned flags, uintptr_t label, long offs); /* Add a static variable to ax */ @@ -326,7 +327,7 @@ void g_addstatic (unsigned flags, unsigned long label, long offs); -void g_addeqstatic (unsigned flags, unsigned long label, long offs, +void g_addeqstatic (unsigned flags, uintptr_t label, long offs, unsigned long val); /* Emit += for a static variable */ @@ -336,7 +337,7 @@ void g_addeqlocal (unsigned flags, int offs, unsigned long val); void g_addeqind (unsigned flags, unsigned offs, unsigned long val); /* Emit += for the location with address in ax */ -void g_subeqstatic (unsigned flags, unsigned long label, long offs, +void g_subeqstatic (unsigned flags, uintptr_t label, long offs, unsigned long val); /* Emit -= for a static variable */ @@ -357,7 +358,7 @@ void g_subeqind (unsigned flags, unsigned offs, unsigned long val); void g_addaddr_local (unsigned flags, int offs); /* Add the address of a local variable to ax */ -void g_addaddr_static (unsigned flags, unsigned long label, long offs); +void g_addaddr_static (unsigned flags, uintptr_t label, long offs); /* Add the address of a static variable to ax */ diff --git a/src/cc65/expr.c b/src/cc65/expr.c index dfd5366bb..43971caae 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -1,7 +1,7 @@ /* expr.c ** ** 1998-06-21, Ullrich von Bassewitz -** 2015-06-26, Greg King +** 2017-12-05, Greg King */ @@ -731,7 +731,7 @@ static void Primary (ExprDesc* E) } else if ((Sym->Flags & SC_FUNC) == SC_FUNC) { /* Function */ E->Flags = E_LOC_GLOBAL | E_RTYPE_LVAL; - E->Name = (unsigned long) Sym->Name; + E->Name = (uintptr_t) Sym->Name; } else if ((Sym->Flags & SC_AUTO) == SC_AUTO) { /* Local variable. If this is a parameter for a variadic ** function, we have to add some address calculations, and the @@ -754,7 +754,7 @@ static void Primary (ExprDesc* E) /* Static variable */ if (Sym->Flags & (SC_EXTERN | SC_STORAGE)) { E->Flags = E_LOC_GLOBAL | E_RTYPE_LVAL; - E->Name = (unsigned long) Sym->Name; + E->Name = (uintptr_t) Sym->Name; } else { E->Flags = E_LOC_STATIC | E_RTYPE_LVAL; E->Name = Sym->V.Label; @@ -798,7 +798,7 @@ static void Primary (ExprDesc* E) Sym = AddGlobalSym (Ident, GetImplicitFuncType(), SC_EXTERN | SC_REF | SC_FUNC); E->Type = Sym->Type; E->Flags = E_LOC_GLOBAL | E_RTYPE_RVAL; - E->Name = (unsigned long) Sym->Name; + E->Name = (uintptr_t) Sym->Name; } else { /* Undeclared Variable */ Sym = AddLocalSym (Ident, type_int, SC_AUTO | SC_REF, 0); @@ -1308,7 +1308,7 @@ static void hie11 (ExprDesc *Expr) ** Since we don't have a name, invent one. */ ED_MakeConstAbs (Expr, 0, GetImplicitFuncType ()); - Expr->Name = (long) IllegalFunc; + Expr->Name = (uintptr_t) IllegalFunc; } /* Call the function */ FunctionCall (Expr); diff --git a/src/cc65/exprdesc.c b/src/cc65/exprdesc.c index 405c277a0..46377ac6b 100644 --- a/src/cc65/exprdesc.c +++ b/src/cc65/exprdesc.c @@ -44,7 +44,6 @@ #include "exprdesc.h" #include "stackptr.h" #include "symentry.h" -#include "exprdesc.h" @@ -361,7 +360,7 @@ void PrintExprDesc (FILE* F, ExprDesc* E) if (Sep != '(') { fputc (')', F); } - fprintf (F, "\nName: 0x%08lX\n", E->Name); + fprintf (F, "\nName: 0x%08lX\n", (unsigned long)E->Name); } diff --git a/src/cc65/exprdesc.h b/src/cc65/exprdesc.h index 99a17313e..e86534902 100644 --- a/src/cc65/exprdesc.h +++ b/src/cc65/exprdesc.h @@ -43,6 +43,7 @@ /* common */ #include "fp.h" #include "inline.h" +#include "inttypes.h" /* cc65 */ #include "asmcode.h" @@ -98,7 +99,7 @@ struct ExprDesc { struct SymEntry* Sym; /* Symbol table entry if known */ Type* Type; /* Type array of expression */ unsigned Flags; - unsigned long Name; /* Name or label number */ + uintptr_t Name; /* Name pointer or label number */ long IVal; /* Integer value if expression constant */ Double FVal; /* Floating point value */ struct Literal* LVal; /* Literal value */ diff --git a/src/common/inttypes.h b/src/common/inttypes.h index 0d9cb75fc..29ac778ef 100644 --- a/src/common/inttypes.h +++ b/src/common/inttypes.h @@ -38,29 +38,28 @@ -/* If we have stdint.h, include it, otherwise try some quesswork on types. +/* If we have , include it; otherwise, adapt types from . ** gcc and msvc don't define __STDC_VERSION__ without special flags, so check -** for them explicitly. Undefined symbols are replaced by zero, so a check for -** defined(__GNUC__) or defined(_MSC_VER) is not necessary. +** for them explicitly. Undefined symbols are replaced by zero; so, checks for +** defined(__GNUC__) and defined(_MSC_VER) aren't necessary. */ #if (__STDC_VERSION__ >= 199901) || (__GNUC__ >= 3) || (_MSC_VER >= 1600) #include #else -/* Assume long is the largest type available, and assume that pointers can be -** safely converted into this type and back. +/* Assume that ptrdiff_t and size_t are wide enough to hold pointers. +** Assume that they are the widest type. */ -typedef long intptr_t; -typedef unsigned long uintptr_t; -typedef long intmax_t; -typedef unsigned long uintmax_t; - +#include +typedef ptrdiff_t intptr_t; +typedef size_t uintptr_t; +typedef ptrdiff_t intmax_t; +typedef size_t uintmax_t; #endif /* End of inttypes.h */ - #endif From f0708db792504dc0639d170a51d72b9379f64624 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Thu, 11 Jan 2018 13:15:19 +0100 Subject: [PATCH 26/37] crt0.s ("none" target): fix initialization of sp variable. --- libsrc/none/crt0.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/none/crt0.s b/libsrc/none/crt0.s index 288d0dc29..596fbcd46 100644 --- a/libsrc/none/crt0.s +++ b/libsrc/none/crt0.s @@ -9,7 +9,7 @@ .segment "STARTUP" lda #<__STACKSTART__ - lda #>__STACKSTART__ + ldx #>__STACKSTART__ sta sp stx sp+1 jsr zerobss From c23f264fe456c27ecef382d6d1e3e579eb40c7cd Mon Sep 17 00:00:00 2001 From: prandeamus Date: Sat, 13 Jan 2018 18:30:53 +0000 Subject: [PATCH 27/37] Call ParaVirtHooks on JMP (indirect) --- src/sim65/6502.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sim65/6502.c b/src/sim65/6502.c index 1febef657..bf8033f40 100644 --- a/src/sim65/6502.c +++ b/src/sim65/6502.c @@ -1266,6 +1266,8 @@ static void OPC_6502_6C (void) Cycles = 6; Regs.PC = MemReadWord(Lo); } + + ParaVirtHooks (&Regs); } From 009f56afb6b26e12b18aeb8e38cf9521590d5ebf Mon Sep 17 00:00:00 2001 From: prandeamus Date: Sat, 13 Jan 2018 22:42:39 +0000 Subject: [PATCH 28/37] 65C02 version too. --- src/sim65/6502.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sim65/6502.c b/src/sim65/6502.c index bf8033f40..e1d313f93 100644 --- a/src/sim65/6502.c +++ b/src/sim65/6502.c @@ -1278,6 +1278,8 @@ static void OPC_65C02_6C (void) /* 6502 bug fixed here */ Cycles = 5; Regs.PC = MemReadWord (MemReadWord (Regs.PC+1)); + + ParaVirtHooks (&Regs); } From 1a95be9c3a28c0f5423f39564d968effd48351cb Mon Sep 17 00:00:00 2001 From: prandeamus Date: Sun, 14 Jan 2018 19:42:29 +0000 Subject: [PATCH 29/37] 65C02 JMP (ind,x) opcode 7C --- src/sim65/6502.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sim65/6502.c b/src/sim65/6502.c index e1d313f93..0d0adbf8b 100644 --- a/src/sim65/6502.c +++ b/src/sim65/6502.c @@ -1434,6 +1434,8 @@ static void OPC_65SC02_7C (void) PC = Regs.PC; Adr = MemReadWord (PC+1); Regs.PC = MemReadWord(Adr+Regs.XR); + + ParaVirtHooks (&Regs); } From 811424cc1b28d4f19882b6b7c59afffbae0f12d6 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 18 Jan 2018 12:37:21 +0100 Subject: [PATCH 30/37] Added recently published ProDOS version. --- include/apple2.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/apple2.h b/include/apple2.h index 421b5db6c..31e56a95a 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -134,6 +134,7 @@ extern unsigned char _dos_type; ** ProDOS 8 2.0.1 - 0x21 ** ProDOS 8 2.0.2 - 0x22 ** ProDOS 8 2.0.3 - 0x23 +** ProDOS 8 2.4.x - 0x24 */ From 2ef6514e47629357da7cd336de8489e8f1e548c4 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Fri, 19 Jan 2018 15:18:43 +0100 Subject: [PATCH 31/37] atari5200: put default display list into its own memory area This avoids 1K boundary crossing of the display list. Fix for issue #560. --- cfg/atari5200.cfg | 15 +++++++++------ libsrc/atari5200/conioscreen.s | 5 ++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cfg/atari5200.cfg b/cfg/atari5200.cfg index 3db8765d6..14d5faa98 100644 --- a/cfg/atari5200.cfg +++ b/cfg/atari5200.cfg @@ -1,16 +1,18 @@ SYMBOLS { __CARTSIZE__: type = weak, value = $4000; # possible values: $4000 and $8000 + __DLISTSIZE__: type = weak, value = $0000; __CART_ENTRY__: type = import; __STACKSIZE__: type = weak, value = $0400; # 4 pages stack __RESERVED_MEMORY__: type = export, value = $01E0; # space for 20x24 screen buffer (default display list is in ROM) } MEMORY { - ZP: file = "", start = $001D, size = $00E3, define = yes; - RAM: file = "", start = $021C, size = $4000 - __STACKSIZE__ - __RESERVED_MEMORY__ - $021C, define = yes; - ROM: file = %O, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - $18, define = yes, fill = yes, fillval = $FF; - CARTNAME: file = %O, start = $BFE8, size = $0014 fill = yes, fillval = $40; - CARTYEAR: file = %O, start = $BFFC, size = $0002 fill = yes, fillval = $59; - CARTENTRY: file = %O, start = $BFFE, size = $0002; + ZP: file = "", start = $001D, size = $00E3, define = yes; + RAM: file = "", start = $021C, size = $4000 - __STACKSIZE__ - __RESERVED_MEMORY__ - $021C, define = yes; + ROM: file = %O, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - __DLISTSIZE__ - $18, define = yes, fill = yes, fillval = $FF; + DLIST: file = %O, start = $BFE8 - __DLISTSIZE__, size = __DLISTSIZE__; + CARTNAME: file = %O, start = $BFE8, size = $0014 fill = yes, fillval = $40; + CARTYEAR: file = %O, start = $BFFC, size = $0002 fill = yes, fillval = $59; + CARTENTRY: file = %O, start = $BFFE, size = $0002; } SEGMENTS { ZEROPAGE: load = ZP, type = zp, optional = yes; @@ -22,6 +24,7 @@ SEGMENTS { RODATA: load = ROM, type = ro, optional = yes; DATA: load = ROM, run = RAM, type = rw, define = yes, optional = yes; BSS: load = RAM, type = bss, define = yes, optional = yes; + DLIST: load = DLIST, type = ro, define = yes, optional = yes; CARTNAME: load = CARTNAME, type = ro, define = yes; CARTYEAR: load = CARTYEAR, type = ro, define = yes; CARTENTRY: load = CARTENTRY, type = ro, define = yes; diff --git a/libsrc/atari5200/conioscreen.s b/libsrc/atari5200/conioscreen.s index 2e86001c2..4bd6d51e2 100644 --- a/libsrc/atari5200/conioscreen.s +++ b/libsrc/atari5200/conioscreen.s @@ -58,7 +58,7 @@ clrscr: sta (SAVMSC),y rts - .segment "RODATA" + .segment "DLIST" ; display list for 20x24 text mode @@ -78,6 +78,9 @@ dlist: .repeat 3 ; end of display list +.export __DLISTSIZE__ +__DLISTSIZE__ = * - dlist + .assert ((* >> 10) = (dlist >> 10)), error, "Display list crosses 1K boundary" .end From 643152fb38d576d0115a7ec01895e8f92fe6730e Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Sun, 21 Jan 2018 15:40:22 +0100 Subject: [PATCH 32/37] Fix last change, put display list at beginning of ROM. --- cfg/atari5200.cfg | 12 +++++------- libsrc/atari5200/conioscreen.s | 3 --- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/cfg/atari5200.cfg b/cfg/atari5200.cfg index 14d5faa98..b1f863d21 100644 --- a/cfg/atari5200.cfg +++ b/cfg/atari5200.cfg @@ -1,6 +1,5 @@ SYMBOLS { __CARTSIZE__: type = weak, value = $4000; # possible values: $4000 and $8000 - __DLISTSIZE__: type = weak, value = $0000; __CART_ENTRY__: type = import; __STACKSIZE__: type = weak, value = $0400; # 4 pages stack __RESERVED_MEMORY__: type = export, value = $01E0; # space for 20x24 screen buffer (default display list is in ROM) @@ -8,8 +7,7 @@ SYMBOLS { MEMORY { ZP: file = "", start = $001D, size = $00E3, define = yes; RAM: file = "", start = $021C, size = $4000 - __STACKSIZE__ - __RESERVED_MEMORY__ - $021C, define = yes; - ROM: file = %O, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - __DLISTSIZE__ - $18, define = yes, fill = yes, fillval = $FF; - DLIST: file = %O, start = $BFE8 - __DLISTSIZE__, size = __DLISTSIZE__; + ROM: file = %O, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - $18, define = yes, fill = yes, fillval = $FF; CARTNAME: file = %O, start = $BFE8, size = $0014 fill = yes, fillval = $40; CARTYEAR: file = %O, start = $BFFC, size = $0002 fill = yes, fillval = $59; CARTENTRY: file = %O, start = $BFFE, size = $0002; @@ -17,6 +15,7 @@ MEMORY { SEGMENTS { ZEROPAGE: load = ZP, type = zp, optional = yes; EXTZP: load = ZP, type = zp, optional = yes; + DLIST: load = ROM , type = ro, define = yes, optional = yes; STARTUP: load = ROM, type = ro, define = yes, optional = yes; LOWCODE: load = ROM, type = ro, define = yes, optional = yes; ONCE: load = ROM, type = ro, optional = yes; @@ -24,10 +23,9 @@ SEGMENTS { RODATA: load = ROM, type = ro, optional = yes; DATA: load = ROM, run = RAM, type = rw, define = yes, optional = yes; BSS: load = RAM, type = bss, define = yes, optional = yes; - DLIST: load = DLIST, type = ro, define = yes, optional = yes; - CARTNAME: load = CARTNAME, type = ro, define = yes; - CARTYEAR: load = CARTYEAR, type = ro, define = yes; - CARTENTRY: load = CARTENTRY, type = ro, define = yes; + CARTNAME: load = CARTNAME, type = ro; + CARTYEAR: load = CARTYEAR, type = ro; + CARTENTRY: load = CARTENTRY, type = ro; } FEATURES { CONDES: type = constructor, diff --git a/libsrc/atari5200/conioscreen.s b/libsrc/atari5200/conioscreen.s index 4bd6d51e2..30c0e0788 100644 --- a/libsrc/atari5200/conioscreen.s +++ b/libsrc/atari5200/conioscreen.s @@ -78,9 +78,6 @@ dlist: .repeat 3 ; end of display list -.export __DLISTSIZE__ -__DLISTSIZE__ = * - dlist - .assert ((* >> 10) = (dlist >> 10)), error, "Display list crosses 1K boundary" .end From 356c73f2cff0131fc9e04d160bdd6a6b923c7108 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Sun, 21 Jan 2018 15:42:12 +0100 Subject: [PATCH 33/37] atari5200.cfg: fix formatting --- cfg/atari5200.cfg | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cfg/atari5200.cfg b/cfg/atari5200.cfg index b1f863d21..e8f6d44a5 100644 --- a/cfg/atari5200.cfg +++ b/cfg/atari5200.cfg @@ -5,12 +5,12 @@ SYMBOLS { __RESERVED_MEMORY__: type = export, value = $01E0; # space for 20x24 screen buffer (default display list is in ROM) } MEMORY { - ZP: file = "", start = $001D, size = $00E3, define = yes; - RAM: file = "", start = $021C, size = $4000 - __STACKSIZE__ - __RESERVED_MEMORY__ - $021C, define = yes; - ROM: file = %O, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - $18, define = yes, fill = yes, fillval = $FF; - CARTNAME: file = %O, start = $BFE8, size = $0014 fill = yes, fillval = $40; - CARTYEAR: file = %O, start = $BFFC, size = $0002 fill = yes, fillval = $59; - CARTENTRY: file = %O, start = $BFFE, size = $0002; + ZP: file = "", start = $001D, size = $00E3, define = yes; + RAM: file = "", start = $021C, size = $4000 - __STACKSIZE__ - __RESERVED_MEMORY__ - $021C, define = yes; + ROM: file = %O, start = $C000 - __CARTSIZE__, size = __CARTSIZE__ - $18, define = yes, fill = yes, fillval = $FF; + CARTNAME: file = %O, start = $BFE8, size = $0014 fill = yes, fillval = $40; + CARTYEAR: file = %O, start = $BFFC, size = $0002 fill = yes, fillval = $59; + CARTENTRY: file = %O, start = $BFFE, size = $0002; } SEGMENTS { ZEROPAGE: load = ZP, type = zp, optional = yes; From 855aceaba8f78f66cf5134ae707b4cee11c6e9e9 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 29 Jan 2018 17:46:36 +0100 Subject: [PATCH 34/37] Added Apple II linker configs for programs including a hires screen. The Apple II hires screen buffer is located at $2000 (and can't be moved). The usual way to get along with this is to load the cc65 program above the hires screen buffer at $4000. However, that means that it becomes difficult to make good use of the memory below the hires screen buffer. The simplest approach is to add that memory to the heap. But there are programs containing just lots of code and not much data. One could think of moving the code to the area below the hires screen after loading (like it is done with the code for the language card). But if the program is really large (and already contains code to be moved to the language card) it won't just fit into memory in the first place. The alternative is to load the program at the usual $803 and have it "cover" the hires screen buffer. Of course the part of the program that actually "covers" the hires screen buffer mustn't contain anything necessary for the program. The downside of this approach is that the program file on disk contains 8kB that can't be used by the program. But instead of just containing zeros the program can as well contain a hires screen picture that can be displayed right after startup. Now the user can have code loaded below the hires screen buffer by setting the code-name to LOWCODE. However, he needs to explicitly do so. Otherwise the memory below the hires screen is totally wasted. Trivia: Allowing to do this hires screen buffer "covering" was the very reason to change tgi_init() to not clear the hires screen anymore. --- cfg/apple2-hgr.cfg | 52 +++++++++++++++++++++++++++++++++ cfg/apple2enh-hgr.cfg | 52 +++++++++++++++++++++++++++++++++ testcode/lib/apple2/hgrtest.c | 26 +++++++++++++++++ testcode/lib/apple2/werner.pic | Bin 0 -> 8184 bytes testcode/lib/apple2/werner.s | 2 ++ 5 files changed, 132 insertions(+) create mode 100644 cfg/apple2-hgr.cfg create mode 100644 cfg/apple2enh-hgr.cfg create mode 100644 testcode/lib/apple2/hgrtest.c create mode 100644 testcode/lib/apple2/werner.pic create mode 100644 testcode/lib/apple2/werner.s diff --git a/cfg/apple2-hgr.cfg b/cfg/apple2-hgr.cfg new file mode 100644 index 000000000..540578b25 --- /dev/null +++ b/cfg/apple2-hgr.cfg @@ -0,0 +1,52 @@ +# Configuration for programs including a hires screen (with 6KB LOWCODE) + +FEATURES { + STARTADDRESS: default = $0803; +} +SYMBOLS { + __EXEHDR__: type = import; + __STACKSIZE__: type = weak, value = $0800; # 2k stack + __HIMEM__: type = weak, value = $9600; # Presumed RAM end + __LCADDR__: type = weak, value = $D400; # Behind quit code + __LCSIZE__: type = weak, value = $0C00; # Rest of bank two + __MAIN_START__: type = export, value = %S; + __MAIN_LAST__: type = export, value = __HIGH_LAST__; +} +MEMORY { + ZP: file = "", define = yes, start = $0080, size = $001A; + HEADER: file = %O, start = %S - 4, size = $0004; + LOW: file = %O, fill = yes, start = %S, size = $2000 - %S; + HGR: file = %O, fill = yes, start = $2000, size = $2000; + HIGH: file = %O, define = yes, start = $4000, size = __HIMEM__ - $4000; + BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; + LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; +} +SEGMENTS { + ZEROPAGE: load = ZP, type = zp; + EXEHDR: load = HEADER, type = ro; + STARTUP: load = LOW, type = ro; + LOWCODE: load = LOW, type = ro, optional = yes; + HGR: load = HGR, type = rw, optional = yes; + CODE: load = HIGH, type = ro; + RODATA: load = HIGH, type = ro; + DATA: load = HIGH, type = rw; + INIT: load = HIGH, type = rw; + ONCE: load = HIGH, type = ro, define = yes; + LC: load = HIGH, run = LC, type = ro, optional = yes; + BSS: load = BSS, type = bss, define = yes; +} +FEATURES { + CONDES: type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__, + segment = ONCE; + 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/apple2enh-hgr.cfg b/cfg/apple2enh-hgr.cfg new file mode 100644 index 000000000..540578b25 --- /dev/null +++ b/cfg/apple2enh-hgr.cfg @@ -0,0 +1,52 @@ +# Configuration for programs including a hires screen (with 6KB LOWCODE) + +FEATURES { + STARTADDRESS: default = $0803; +} +SYMBOLS { + __EXEHDR__: type = import; + __STACKSIZE__: type = weak, value = $0800; # 2k stack + __HIMEM__: type = weak, value = $9600; # Presumed RAM end + __LCADDR__: type = weak, value = $D400; # Behind quit code + __LCSIZE__: type = weak, value = $0C00; # Rest of bank two + __MAIN_START__: type = export, value = %S; + __MAIN_LAST__: type = export, value = __HIGH_LAST__; +} +MEMORY { + ZP: file = "", define = yes, start = $0080, size = $001A; + HEADER: file = %O, start = %S - 4, size = $0004; + LOW: file = %O, fill = yes, start = %S, size = $2000 - %S; + HGR: file = %O, fill = yes, start = $2000, size = $2000; + HIGH: file = %O, define = yes, start = $4000, size = __HIMEM__ - $4000; + BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; + LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; +} +SEGMENTS { + ZEROPAGE: load = ZP, type = zp; + EXEHDR: load = HEADER, type = ro; + STARTUP: load = LOW, type = ro; + LOWCODE: load = LOW, type = ro, optional = yes; + HGR: load = HGR, type = rw, optional = yes; + CODE: load = HIGH, type = ro; + RODATA: load = HIGH, type = ro; + DATA: load = HIGH, type = rw; + INIT: load = HIGH, type = rw; + ONCE: load = HIGH, type = ro, define = yes; + LC: load = HIGH, run = LC, type = ro, optional = yes; + BSS: load = BSS, type = bss, define = yes; +} +FEATURES { + CONDES: type = constructor, + label = __CONSTRUCTOR_TABLE__, + count = __CONSTRUCTOR_COUNT__, + segment = ONCE; + 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/testcode/lib/apple2/hgrtest.c b/testcode/lib/apple2/hgrtest.c new file mode 100644 index 000000000..7323cbb73 --- /dev/null +++ b/testcode/lib/apple2/hgrtest.c @@ -0,0 +1,26 @@ +// cl65 -t apple2 -C apple2-hgr.cfg hgrtest.c werner.s + +#include +#include + +#pragma code-name (push, "LOWCODE") + +void say (const char* text) +{ + tgi_setcolor (TGI_COLOR_BLACK); + tgi_outtextxy (41, 33, text); +} + +#pragma code-name (pop) + +void main (void) +{ + tgi_install (a2_hi_tgi); + tgi_init (); + cgetc (); + + say ("Hi Dude !"); + cgetc (); + + tgi_uninstall (); +} diff --git a/testcode/lib/apple2/werner.pic b/testcode/lib/apple2/werner.pic new file mode 100644 index 0000000000000000000000000000000000000000..2405e2409470d0de0e017194f6f81e9b058511e1 GIT binary patch literal 8184 zcmbVQ-EQN?6{bLRnG3JkyL#cDaS#*>wCGw!fZ7|{9vcRt1%j9hBn7&_%9NmXl?z9t zSIClzC?35=Zrdm6gXE@9kVoiuh9YOQB1cV*1aUNT=A1b{-^>{j{dy81<}8T%K{mC_ z9uwV?@SMF*&I?K={U9-zofR2fM$@~e__8CrCvo@qM4lX<#Ks_+dnAeCe$dI+`^|qT zQO5!6zAQPP3{~F@=9BLf zQ_AiFbUxxAuR@VwKPxZEClbYYY;!6&AcomR;yT@0UMXPxSF+oOw>0hrKVn33*ed#Y z`M2fI_z=yiE=(N7DJ7E>(ta-!s6Voln9vp44P`RQz6E~=hW zH42i&G|z%l5(6YzJMo}=O_Y}6OkQn2$7Mw@e=e`G!yq?PwHmFTg6M|6;y_@oT5>(~ zQ6qN~YL2G1pQpGviEGLcO)u$Dz-g>TkneCLa2u9>u+YC#bODspyyGPfH&k709ZSBDBOd{3GT);6I|> zhf9{*P74?`N3vc%C>}FewEbo;BlKo5y|^|zH{|Ce^Ov(xngBGA-cBKg#NUa=CH|3+ zHTkgr7ktnGV^#$9vm}phQpbirK6^&8r|_StEwh@x@npTtTbZ_BP3kyE)dgqAY)aDG zt@C6O7w0cNgRbd1q6>r_ zD@-Skwm8B2F3B%P&lvyT1S$S$`pAAgu(c%zd{#?}f^_oA!i`|MV9h$tE?qtJnNw)D zn)a`{s|OrxqqG#`zYb8^*cf|QspoXFkRHG0?FV@#>%7wT3quChHxl7i{7beYBk3I5 zm+CrigRw_pI9GgEh9<2a8+lC;TJr2e{lBq+<-wFVil6q8f;L*fl{25{Wr=^&F0J3} z<@P}_Jn#^_b^@aE{Cy|>j^wp<1yD`iTdZ|cmeybHriuelx*W`++qkniLHGEmx<+(I z0=~*A(gT|t`ZoL{ z=q})vxsE7~-l{57!;eh;DAN@U`FA7>oAYs)lqi-g;rHdl=3n1Q6#fN0KIQF)&2PYe zXv{`t`|^I>*~YMHBI7xyWFZEfE%@Je;3SWPKUE;VYV^MvS}BR}l<&6SAJ_!2;wbuR zE)0n)5$0n?IprRT>e8d8UE2R9)H$7wvVRu7*=b5tZNxG!{&=tlsU2u&rxOgi_uKGa z2Zh~wnM_0P-aM%`#E*J8lHh9+#9Ie`+X-g0jBES#>^YYT&kBkUtwlY`pA2_U=a}&y zq(}A`Xz^>UCjFYB#{XYriGTBwMl_uv{kQ;sv=krWDkHa$I}KyzbgxTECg<>b!Vs;$&U7`UlTr#RArOTkt=Bo=(2^N&2P4ywU%rwGk_LcyIVg zXTY`C!r5!;r?vB^;+S%lAZMds zP^DxwWIhqFgvNqz{&|>AE^WN#ytTGz|Js21Xl*U!(n-GMakgQp^Xy{|`3&ixvI__Nra=`VVg*YJrCR z*u+bcY^5v~ybZS#lBpDfyS)|vsL{whOa_#Xo-qJJ1ghRgwSE)r+@2kpJq_!?D&h7B zng4Vf{^LnM2L6vqiKby%{|5fQ|4}d!S}9UVA5r?Q5Vh|bx#u*x<%FJ=DQeoK^$TMv zUW0YR;o!rqxhWdsWfOzX@G_G@>b1OHD;c9(ydgxq!VM8?`6pJ{Ex@)&#I;PU_wNP6 zue|?5Fi&cyMDO_POxk|kpK|#F*>gJHUT-a4pGK1vswb6@8@Nb&Ro!r};T9;rD!=3Tp3E6M4rw;p=lg%e z;jKvPH+wnlr!P&MRQ$#hc3`0)<2{RY5fpaQ^c(W_29d95=eTk zd*k84uWRQ<_9^)pUX@d7!@r>mO`N_?cfu%WrcG7g^4co-HT^3AV-_1v+j}+HbT-6Vfy;l-AVBs2mYx}RdsQdK>0MRx| zOEGV7wf)^EHpZM8r9(5|zYj+E)T{Xo`!xXB|1?!)Sk1W6h$=Cjv*rD}AUaLo-_mrv z&nJvf;#cytesi}$X4Cj{TS|igc3{b|ECP26{ue0GQY7dBZ$C!yfwtCfrdr5s-j`G2 z^|ldEDhuzbh`s^5weuR-l_A&2lv0Ojm)39S60l5&t`x914CDt?6G$2s!+4Rou@kbu|b7 VhJ3ty9*hckkxri4g4MRT{{gd9*mnQ` literal 0 HcmV?d00001 diff --git a/testcode/lib/apple2/werner.s b/testcode/lib/apple2/werner.s new file mode 100644 index 000000000..6456ade13 --- /dev/null +++ b/testcode/lib/apple2/werner.s @@ -0,0 +1,2 @@ +.segment "HGR" +.incbin "werner.pic" From 80b09ba9fc42f65b84f91ea2d170325abe84fac1 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Wed, 31 Jan 2018 08:54:48 +0100 Subject: [PATCH 35/37] Significantly simplified recently added linker config files. I just forgot about the 'start' segment attribute - which makes the scenario at hand dead easy. --- cfg/apple2-hgr.cfg | 34 +++++++++++++++------------------- cfg/apple2enh-hgr.cfg | 34 +++++++++++++++------------------- 2 files changed, 30 insertions(+), 38 deletions(-) diff --git a/cfg/apple2-hgr.cfg b/cfg/apple2-hgr.cfg index 540578b25..536491c67 100644 --- a/cfg/apple2-hgr.cfg +++ b/cfg/apple2-hgr.cfg @@ -4,35 +4,31 @@ FEATURES { STARTADDRESS: default = $0803; } SYMBOLS { - __EXEHDR__: type = import; - __STACKSIZE__: type = weak, value = $0800; # 2k stack - __HIMEM__: type = weak, value = $9600; # Presumed RAM end - __LCADDR__: type = weak, value = $D400; # Behind quit code - __LCSIZE__: type = weak, value = $0C00; # Rest of bank two - __MAIN_START__: type = export, value = %S; - __MAIN_LAST__: type = export, value = __HIGH_LAST__; + __EXEHDR__: type = import; + __STACKSIZE__: type = weak, value = $0800; # 2k stack + __HIMEM__: type = weak, value = $9600; # Presumed RAM end + __LCADDR__: type = weak, value = $D400; # Behind quit code + __LCSIZE__: type = weak, value = $0C00; # Rest of bank two } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; HEADER: file = %O, start = %S - 4, size = $0004; - LOW: file = %O, fill = yes, start = %S, size = $2000 - %S; - HGR: file = %O, fill = yes, start = $2000, size = $2000; - HIGH: file = %O, define = yes, start = $4000, size = __HIMEM__ - $4000; + MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; EXEHDR: load = HEADER, type = ro; - STARTUP: load = LOW, type = ro; - LOWCODE: load = LOW, type = ro, optional = yes; - HGR: load = HGR, type = rw, optional = yes; - CODE: load = HIGH, type = ro; - RODATA: load = HIGH, type = ro; - DATA: load = HIGH, type = rw; - INIT: load = HIGH, type = rw; - ONCE: load = HIGH, type = ro, define = yes; - LC: load = HIGH, run = LC, type = ro, optional = yes; + STARTUP: load = MAIN, type = ro; + LOWCODE: load = MAIN, type = ro, optional = yes; + HGR: load = MAIN, type = rw, optional = yes, start = $2000; + CODE: load = MAIN, type = ro start = $4000; + RODATA: load = MAIN, type = ro; + DATA: load = MAIN, type = rw; + INIT: load = MAIN, type = rw; + ONCE: load = MAIN, type = ro, define = yes; + LC: load = MAIN, run = LC, type = ro, optional = yes; BSS: load = BSS, type = bss, define = yes; } FEATURES { diff --git a/cfg/apple2enh-hgr.cfg b/cfg/apple2enh-hgr.cfg index 540578b25..536491c67 100644 --- a/cfg/apple2enh-hgr.cfg +++ b/cfg/apple2enh-hgr.cfg @@ -4,35 +4,31 @@ FEATURES { STARTADDRESS: default = $0803; } SYMBOLS { - __EXEHDR__: type = import; - __STACKSIZE__: type = weak, value = $0800; # 2k stack - __HIMEM__: type = weak, value = $9600; # Presumed RAM end - __LCADDR__: type = weak, value = $D400; # Behind quit code - __LCSIZE__: type = weak, value = $0C00; # Rest of bank two - __MAIN_START__: type = export, value = %S; - __MAIN_LAST__: type = export, value = __HIGH_LAST__; + __EXEHDR__: type = import; + __STACKSIZE__: type = weak, value = $0800; # 2k stack + __HIMEM__: type = weak, value = $9600; # Presumed RAM end + __LCADDR__: type = weak, value = $D400; # Behind quit code + __LCSIZE__: type = weak, value = $0C00; # Rest of bank two } MEMORY { ZP: file = "", define = yes, start = $0080, size = $001A; HEADER: file = %O, start = %S - 4, size = $0004; - LOW: file = %O, fill = yes, start = %S, size = $2000 - %S; - HGR: file = %O, fill = yes, start = $2000, size = $2000; - HIGH: file = %O, define = yes, start = $4000, size = __HIMEM__ - $4000; + MAIN: file = %O, define = yes, start = %S, size = __HIMEM__ - %S; BSS: file = "", start = __ONCE_RUN__, size = __HIMEM__ - __STACKSIZE__ - __ONCE_RUN__; LC: file = "", define = yes, start = __LCADDR__, size = __LCSIZE__; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; EXEHDR: load = HEADER, type = ro; - STARTUP: load = LOW, type = ro; - LOWCODE: load = LOW, type = ro, optional = yes; - HGR: load = HGR, type = rw, optional = yes; - CODE: load = HIGH, type = ro; - RODATA: load = HIGH, type = ro; - DATA: load = HIGH, type = rw; - INIT: load = HIGH, type = rw; - ONCE: load = HIGH, type = ro, define = yes; - LC: load = HIGH, run = LC, type = ro, optional = yes; + STARTUP: load = MAIN, type = ro; + LOWCODE: load = MAIN, type = ro, optional = yes; + HGR: load = MAIN, type = rw, optional = yes, start = $2000; + CODE: load = MAIN, type = ro start = $4000; + RODATA: load = MAIN, type = ro; + DATA: load = MAIN, type = rw; + INIT: load = MAIN, type = rw; + ONCE: load = MAIN, type = ro, define = yes; + LC: load = MAIN, run = LC, type = ro, optional = yes; BSS: load = BSS, type = bss, define = yes; } FEATURES { From 38049d22ba54945e33d3b392fd4bb46b4b14773e Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Wed, 31 Jan 2018 14:53:31 +0100 Subject: [PATCH 36/37] Provide symbole for RAM memory area. The RAM memory area symbols are referred by the startup code. The 64k and 128k variant say "for assembler" so it may be not necessary to do that there. However given the "limited" state of documentation for the target I don't assign too much value to those statements. Additionally it's unclear to me why two variants provide symbols for the ROM memory. --- cfg/supervision-128k.cfg | 4 ++-- cfg/supervision-16k.cfg | 6 +++--- cfg/supervision-64k.cfg | 4 ++-- cfg/supervision.cfg | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cfg/supervision-128k.cfg b/cfg/supervision-128k.cfg index 0304e2c02..a03ab0e1b 100644 --- a/cfg/supervision-128k.cfg +++ b/cfg/supervision-128k.cfg @@ -2,13 +2,13 @@ # for assembler # ld65 config file -# ld65 --config supervision.cfg -o .bin .o +# ld65 --config supervision-128k.cfg -o .bin .o SYMBOLS { __STACKSIZE__: type = weak, value = $0100; # 1 page stack } MEMORY { - RAM: file = "", start = $0000, size = $2000 - __STACKSIZE__; + RAM: file = "", start = $0000, size = $2000 - __STACKSIZE__, define = yes; VRAM: file = "", start = $4000, size = $2000; BANKROM1: file = %O, start = $8000, size = $4000, fill = yes, fillval = $FF; BANKROM2: file = %O, start = $8000, size = $4000, fill = yes, fillval = $FF; diff --git a/cfg/supervision-16k.cfg b/cfg/supervision-16k.cfg index 86c8fface..e0b54be23 100644 --- a/cfg/supervision-16k.cfg +++ b/cfg/supervision-16k.cfg @@ -1,7 +1,7 @@ # supervision 16kbyte cartridge # ld65 config file -# ld65 --config supervision16.cfg -o .bin .o +# ld65 --config supervision-16k.cfg -o .bin .o SYMBOLS { __STACKSIZE__: type = weak, value = $0100; # 1 page stack @@ -9,9 +9,9 @@ SYMBOLS { MEMORY { ZP: file = "", start = $0000, size = $0100; CPUSTACK: file = "", start = $0100, size = $0100; - RAM: file = "", start = $0200, size = $1E00 - __STACKSIZE__; + RAM: file = "", start = $0200, size = $1E00 - __STACKSIZE__, define = yes; VRAM: file = "", start = $4000, size = $2000; - ROM: file = %O, start = $C000, size = $4000, fill = yes, fillval = $ff, define=yes; + ROM: file = %O, start = $C000, size = $4000, fill = yes, fillval = $FF, define = yes; } SEGMENTS { ZEROPAGE: load = ZP, type = zp, define = yes; diff --git a/cfg/supervision-64k.cfg b/cfg/supervision-64k.cfg index 8a7665c30..9d5f15e45 100644 --- a/cfg/supervision-64k.cfg +++ b/cfg/supervision-64k.cfg @@ -2,13 +2,13 @@ # for assembler # ld65 config file -# ld65 --config supervision.cfg -o .bin .o +# ld65 --config supervision-64k.cfg -o .bin .o SYMBOLS { __STACKSIZE__: type = weak, value = $0100; # 1 page stack } MEMORY { - RAM: file = "", start = $0000, size = $2000 - __STACKSIZE__; + RAM: file = "", start = $0000, size = $2000 - __STACKSIZE__, define = yes; VRAM: file = "", start = $4000, size = $2000; BANKROM1: file = %O, start = $8000, size = $4000, fill = yes, fillval = $FF; BANKROM2: file = %O, start = $8000, size = $4000, fill = yes, fillval = $FF; diff --git a/cfg/supervision.cfg b/cfg/supervision.cfg index 2d20e3461..d9f189f2b 100644 --- a/cfg/supervision.cfg +++ b/cfg/supervision.cfg @@ -8,7 +8,7 @@ SYMBOLS { MEMORY { ZP: file = "", start = $0000, size = $0100; CPUSTACK: file = "", start = $0100, size = $0100; - RAM: file = "", start = $0200, size = $1E00 - __STACKSIZE__; + RAM: file = "", start = $0200, size = $1E00 - __STACKSIZE__, define = yes; VRAM: file = "", start = $4000, size = $2000; ROM: file = %O, start = $8000, size = $8000, fill = yes, fillval = $FF, define = yes; } From 19ed94fe25fb834bb002ece6a0201173fc709027 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Wed, 31 Jan 2018 15:06:37 +0100 Subject: [PATCH 37/37] Adjust alternative ProDOS 8 I/O buffer allocation module to linker configs. The Apple II linker configs don't define symbols for the STARTP segment anymore. There refer to the load/start address in the same way the executable file header does. --- libsrc/apple2/extra/iobuf-0800.s | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsrc/apple2/extra/iobuf-0800.s b/libsrc/apple2/extra/iobuf-0800.s index 0ad7a751f..7ed832ed3 100644 --- a/libsrc/apple2/extra/iobuf-0800.s +++ b/libsrc/apple2/extra/iobuf-0800.s @@ -7,7 +7,7 @@ .constructor initiobuf .export iobuf_alloc, iobuf_free - .import __STARTUP_RUN__ + .import __MAIN_START__ .import incsp2, popax .include "zeropage.inc" @@ -18,7 +18,7 @@ initiobuf: ; Convert end address highbyte to table index - lda #>__STARTUP_RUN__ + lda #>__MAIN_START__ sec sbc #>$0800 lsr