From dc207514ddc8236903b883c4e4cfaee62255c917 Mon Sep 17 00:00:00 2001 From: izydorst Date: Mon, 23 Dec 2002 22:14:14 +0000 Subject: [PATCH] support for .zeropage segment in GEOS git-svn-id: svn://svn.cc65.org/cc65/trunk@1834 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/geos/conio/cclear.s | 2 +- libsrc/geos/conio/cgetc.s | 2 +- libsrc/geos/conio/chline.s | 2 +- libsrc/geos/conio/cpputs.s | 2 +- libsrc/geos/conio/cputc.s | 2 +- libsrc/geos/conio/cursor.s | 14 ++++- libsrc/geos/conio/cvline.s | 2 +- libsrc/geos/conio/gotoxy.s | 2 +- libsrc/geos/conio/where.s | 3 +- libsrc/geos/devel/crt0.s | 46 +++------------ libsrc/geos/devel/cvthead.s | 110 ------------------------------------ libsrc/geos/inc/cursor.inc | 13 ----- src/ld65/cfg/geos.cfg | 6 +- 13 files changed, 33 insertions(+), 173 deletions(-) delete mode 100644 libsrc/geos/devel/cvthead.s delete mode 100644 libsrc/geos/inc/cursor.inc diff --git a/libsrc/geos/conio/cclear.s b/libsrc/geos/conio/cclear.s index ec68e7a26..216f120ff 100644 --- a/libsrc/geos/conio/cclear.s +++ b/libsrc/geos/conio/cclear.s @@ -8,10 +8,10 @@ .include "../inc/jumptab.inc" .include "../inc/geossym.inc" - .include "../inc/cursor.inc" .export _cclearxy, _cclear .import popa, _gotoxy, fixcursor + .importzp cursor_x, cursor_y, cursor_c _cclearxy: pha ; Save the length diff --git a/libsrc/geos/conio/cgetc.s b/libsrc/geos/conio/cgetc.s index cc6b5d5a1..05de86826 100644 --- a/libsrc/geos/conio/cgetc.s +++ b/libsrc/geos/conio/cgetc.s @@ -9,10 +9,10 @@ .export _cgetc .import update_cursor + .importzp cursor_x, cursor_y, cursor_flag .include "../inc/jumptab.inc" .include "../inc/geossym.inc" - .include "../inc/cursor.inc" _cgetc: ; show cursor if needed diff --git a/libsrc/geos/conio/chline.s b/libsrc/geos/conio/chline.s index ea431fe3e..b02fc115d 100644 --- a/libsrc/geos/conio/chline.s +++ b/libsrc/geos/conio/chline.s @@ -8,10 +8,10 @@ .include "../inc/jumptab.inc" .include "../inc/geossym.inc" - .include "../inc/cursor.inc" .export _chlinexy, _chline .import popa, _gotoxy, fixcursor + .importzp cursor_x, cursor_y, cursor_c _chlinexy: pha ; Save the length diff --git a/libsrc/geos/conio/cpputs.s b/libsrc/geos/conio/cpputs.s index 6fc142b4a..98781a4fb 100644 --- a/libsrc/geos/conio/cpputs.s +++ b/libsrc/geos/conio/cpputs.s @@ -15,11 +15,11 @@ .import _gotoxy .import popa + .importzp cursor_x, cursor_y .include "../inc/const.inc" .include "../inc/geossym.inc" .include "../inc/jumptab.inc" - .include "../inc/cursor.inc" _cpputsxy: sta r0L ; Save s for later diff --git a/libsrc/geos/conio/cputc.s b/libsrc/geos/conio/cputc.s index aa0c92155..5a9f306cc 100644 --- a/libsrc/geos/conio/cputc.s +++ b/libsrc/geos/conio/cputc.s @@ -13,11 +13,11 @@ .import _gotoxy, fixcursor .import popa .import xsize,ysize + .importzp cursor_x, cursor_y, cursor_c, cursor_r .include "../inc/const.inc" .include "../inc/geossym.inc" .include "../inc/jumptab.inc" - .include "../inc/cursor.inc" _cputcxy: pha ; Save C diff --git a/libsrc/geos/conio/cursor.s b/libsrc/geos/conio/cursor.s index 55f89c61b..24f14a80d 100644 --- a/libsrc/geos/conio/cursor.s +++ b/libsrc/geos/conio/cursor.s @@ -2,15 +2,16 @@ ; ; Maciej 'YTM/Elysium' Witkowiak ; -; 27.10.2001 +; 27.10.2001, 23.12.2002 ; unsigned char cursor (unsigned char onoff); + .exportzp cursor_x, cursor_y, cursor_flag + .exportzp cursor_c, cursor_r .export _cursor .import update_cursor .include "../inc/jumptab.inc" .include "../inc/geossym.inc" - .include "../inc/cursor.inc" _cursor: @@ -26,3 +27,12 @@ _cursor: jsr update_cursor ; place it on screen L1: pla rts + +.zeropage + +cursor_x: .res 2 ; Cursor column (word) +cursor_y: .res 1 ; Cursor row +cursor_flag: .res 1 ; Cursor on/off (0-off) + +cursor_c: .res 1 ; Cursor column (0-39/79) +cursor_r: .res 1 ; Cursor row (0-24) diff --git a/libsrc/geos/conio/cvline.s b/libsrc/geos/conio/cvline.s index e104dfecf..57c1c6617 100644 --- a/libsrc/geos/conio/cvline.s +++ b/libsrc/geos/conio/cvline.s @@ -8,10 +8,10 @@ .include "../inc/jumptab.inc" .include "../inc/geossym.inc" - .include "../inc/cursor.inc" .export _cvlinexy, _cvline .import popa, _gotoxy, fixcursor + .importzp cursor_x, cursor_y, cursor_r _cvlinexy: pha ; Save the length diff --git a/libsrc/geos/conio/gotoxy.s b/libsrc/geos/conio/gotoxy.s index d3da47db9..1a0261168 100644 --- a/libsrc/geos/conio/gotoxy.s +++ b/libsrc/geos/conio/gotoxy.s @@ -11,9 +11,9 @@ .export _gotox, _gotoy, _gotoxy, fixcursor .import popa + .importzp cursor_x, cursor_y, cursor_c, cursor_r .include "../inc/jumptab.inc" - .include "../inc/cursor.inc" _gotox: sta cursor_c jmp fixcursor diff --git a/libsrc/geos/conio/where.s b/libsrc/geos/conio/where.s index 14cd07981..fbe3bcebf 100644 --- a/libsrc/geos/conio/where.s +++ b/libsrc/geos/conio/where.s @@ -9,10 +9,9 @@ ; unsigned char wherey (void); .export _wherex, _wherey - .importzp tmp1, tmp2 + .importzp cursor_c, cursor_r .include "../inc/jumptab.inc" - .include "../inc/cursor.inc" _wherex: lda cursor_c rts diff --git a/libsrc/geos/devel/crt0.s b/libsrc/geos/devel/crt0.s index 0418dbab0..fe8e42627 100644 --- a/libsrc/geos/devel/crt0.s +++ b/libsrc/geos/devel/crt0.s @@ -3,43 +3,16 @@ ; (.cvt header must be the *first* one) ; Maciej 'YTM/Elysium' Witkowiak -; 26.10.99, 10.3.2000, 15.8.2001 +; 26.10.99, 10.3.2000, 15.8.2001, 23.12.2002 -; no __hinit - - .export _exit + .import __RAM_START__, __RAM_SIZE__ ; Linker generated .import initlib, donelib .import pushax .import _main + .import _MainLoop, _EnterDeskTop .import zerobss - -; ------------------------------------------------------------------------ -; Define and export the ZP variables for the C64 runtime - - .exportzp sp, sreg, regsave, regbank - .exportzp ptr1, ptr2, ptr3, ptr4 - .exportzp tmp1, tmp2, tmp3, tmp4 - -sp = $72 ; stack pointer -sreg = $74 ; secondary register/high 16 bit for longs -regsave = $76 ; slot to save/restore (E)AX into -ptr1 = $7A ; -ptr2 = $7C -ptr3 = $7E -ptr4 = $70 -tmp1 = $fb -tmp2 = $fc -tmp3 = $fd -tmp4 = $fe - -regbank = $a3 ; 6 bytes hopefully not used by Kernal - -; ------------------------------------------------------------------------ - -; .org $0400-508 ; $0400 - length of .cvt header -; .include "cvthead.s" - - .reloc + .importzp sp + .export _exit ; ------------------------------------------------------------------------ ; Create an empty LOWCODE segment to avoid linker warnings @@ -57,9 +30,9 @@ regbank = $a3 ; 6 bytes hopefully not used by Kernal ; Setup stack - lda #<$6000 + lda #<(__RAM_START__ + __RAM_SIZE__) sta sp - lda #>$6000 + lda #>(__RAM_START__ + __RAM_SIZE__) sta sp+1 ; Set argument stack ptr ; Call module constructors @@ -76,12 +49,11 @@ regbank = $a3 ; 6 bytes hopefully not used by Kernal cli ldy #4 ; Argument size jsr _main ; call the users code - jmp $c1c3 ; jump to GEOS MainLoop + jmp _MainLoop ; jump to GEOS MainLoop ; Call module destructors. This is also the _exit entry which must be called ; explicitly by the code. _exit: jsr donelib ; Run module destructors - jmp $c22c ; EnterDeskTop - + jmp _EnterDeskTop ; return control to the system diff --git a/libsrc/geos/devel/cvthead.s b/libsrc/geos/devel/cvthead.s deleted file mode 100644 index a7b2f564d..000000000 --- a/libsrc/geos/devel/cvthead.s +++ /dev/null @@ -1,110 +0,0 @@ - -; NOTE THAT EASIER AND SAFER WAY OF GETTING HEADER IS TO GENERATE IT !!! - -; Maciej 'YTM/Alliance' Witkowiak -; 28.02.2000 - -; This is .cvt header for GEOS files, it is recognized by Convert v2.5 for GEOS -; and Star Commander (when copying GEOS files to/from .d64 images) -; This is only an example, and you should customize file header values (such as -; Author, Class, Date, filename) either here for all GEOS apps or manually later -; in GEOS environment using specialized apps or disk editor - -; currently only SEQUENTIAL structure is supported, no overlays - -; defineable values are marked with ';**' in comment line, please be careful with -; string lengths - - -; .org $0400-508 ; $0400 - length of .cvt header - - .segment "HEADER" - - .include "../inc/const.inc" - -ProgType = APPLICATION ;** may be one of: - ; APPLICATION - ; ASSEMBLY - ; DESK_ACC (unusable, unless you will fix end address in header before run) - ; PRINTER (unusable, unless you change $0400 to $7900 here and in crt0.s) - ; INPUT_DEVICE (like above but change $0400 to $fe80, you have $017a bytes) - ; AUTO_EXEC (you need to fit in $0400-$4fff area) - ; INPUT_128 (like INPUT_DEVICE but change $0400 to $fd80, you have $017a bytes) - - .byte USR | $80 ; DOS filetype - .word 0 ; T&S, will be fixed by converter - - .byte "filename" ;** DOS filename (16 chars with $a0 padding) - .byte $a0,$a0,$a0,$a0,$a0,$a0,$a0,$a0 - - .word 0 ; header T&S - - .byte SEQUENTIAL ; GEOS structure - .byte ProgType ; GEOS filetype - .byte 00 ;** year 2000=00 or 100? - .byte 02 ;** month - .byte 28 ;** day - .byte 18 ;** hour - .byte 58 ;** minute - - .word 0 ; size in blocks, will be fixed by converter - - .byte "PRG formatted GEOS file V1.0" - ; converter stamp - .res $c4 ; some bytes are left - - .byte 3, 21, 63 | $80 ; icon picture header, 63 bytes follow - - ;** hey, uberhacker! edit icon here!!! ;-)) - .byte %11111111, %11111111, %11111111 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %10000000, %00000000, %00000001 - .byte %11111111, %11111111, %11111111 - - .byte USR | $80 ;again DOS type - .byte ProgType ;again GEOS type - .byte SEQUENTIAL ;structure - .word $0400 ;ProgStart - .word $0400-1 ;ProgEnd (needs proper value for DESK_ACC) - .word $0400 ;ProgExec - - .byte "Filename" ;**GEOS class (12 chars) - .byte $20,$20,$20,$20 ; padding with spaces to 12 - - .byte "V1.0",0 ;**version - .word 0 - - .byte %01000000 ;**40/80 columns capability -; B7 B6 -; 0 0 - runs under GEOS128 but only in 40 column mode -; 0 1 - runs under GEOS128 in both 40/80 column modes -; 1 0 - does not run under GEOS128 -; 1 1 - runs under GEOS128 but only in 80 column mode - - - .byte "Author" ;**author's name (63 chars) - .byte 0 ; +terminator - .res (63-7) ; padding to 63 - - .byte "Compiled with cc65" ;**note (95 chars) - .byte 0 ; +terminator - .res (95-18) ; padding to 95 - - ; end of header, code follows diff --git a/libsrc/geos/inc/cursor.inc b/libsrc/geos/inc/cursor.inc deleted file mode 100644 index 3695d590e..000000000 --- a/libsrc/geos/inc/cursor.inc +++ /dev/null @@ -1,13 +0,0 @@ - -; -; Maciej 'YTM/Elysium' Witkowiak -; -; 27.10.2001 -; 06.03.2002 - -cursor_x = $D3 ; Cursor column (word) -cursor_y = $D5 ; Cursor row -cursor_flag = $D6 ; Cursor on/off (0-off) - -cursor_c = $D7 ; Cursor column (0-39/79) -cursor_r = $D8 ; Cursor row (0-24) diff --git a/src/ld65/cfg/geos.cfg b/src/ld65/cfg/geos.cfg index ab65df243..690f73f87 100644 --- a/src/ld65/cfg/geos.cfg +++ b/src/ld65/cfg/geos.cfg @@ -1,6 +1,7 @@ MEMORY { + ZP: start = $58, size = $28, type = rw, define = yes; HEADER: start = $204, size = 508, file = %O; - RAM: start = $400, size = $5C00, file = %O; + RAM: start = $400, size = $5C00, define = yes, file = %O; } SEGMENTS { HEADER: load = HEADER, type = ro; @@ -10,6 +11,7 @@ SEGMENTS { RODATA: load = RAM, type = ro; DATA: load = RAM, type = rw; BSS: load = RAM, type = bss, define = yes; + ZEROPAGE: load = ZP, type = zp; } FEATURES { CONDES: segment = RODATA, @@ -22,5 +24,5 @@ FEATURES { count = __DESTRUCTOR_COUNT__; } SYMBOLS { - __STACKSIZE__ = $800; # 2K stack + __STACKSIZE__ = $400; # 1K stack } -- 2.39.5