]> git.sur5r.net Git - cc65/commitdiff
fixed more flaws found by greg :)
authormrdudz <mrdudz@users.noreply.github.com>
Sat, 19 Sep 2015 13:37:39 +0000 (15:37 +0200)
committermrdudz <mrdudz@users.noreply.github.com>
Sat, 19 Sep 2015 13:37:39 +0000 (15:37 +0200)
14 files changed:
asminc/pce.inc
cfg/pce.cfg
libsrc/pce/clock.s
libsrc/pce/clrscr.s
libsrc/pce/color.s
libsrc/pce/conio.s
libsrc/pce/cputc.s
libsrc/pce/crt0.s
libsrc/pce/extzp.inc [new file with mode: 0644]
libsrc/pce/extzp.s [new file with mode: 0644]
libsrc/pce/gotoxy.s
libsrc/pce/kplot.s
libsrc/pce/revers.s
libsrc/pce/waitvblank.s

index 3e82c38cc04429abe33b8262cfdedfdc8d23b2c5..623ab4da8736050387d7f56f8400f134360f9b12 100644 (file)
@@ -2,15 +2,6 @@
 ; PCE definitions. By Groepaz/Hitmem.
 ;
 
-; FIXME: optimize zeropage usage
-CURS_X          = $30
-CURS_Y          = $31
-SCREEN_PTR      = $32           ;2
-CHARCOLOR       = $34
-RVS             = $35
-BGCOLOR         = $36
-tickcount       = $37           ;4
-
 ; FIXME: screen dimensions my change according to selected video mode
 screenrows      = (224/8)
 charsperline    = 61
index adb420f32bf70285f3ad12e8f7bcda21c11fe468..2c660435a7f691aac7fc8de8121edf021d4f70c1 100644 (file)
@@ -6,7 +6,7 @@ SYMBOLS {
 
 MEMORY {
         # FIXME: is this correct? the first 3? bytes cant be used?
-        ZP:  start = $03, size = $1A, type = rw, define = yes;
+        ZP: start = $03, size = $fd, type = rw, define = yes;
 
         # reset-bank and hardware vectors
         ROM0: start = $e000, size = $1ff6, file = %O ,fill = yes, define = yes;
@@ -25,6 +25,8 @@ SEGMENTS {
         BSS:     load = RAM, type = bss, define = yes;
         VECTORS: load = ROMV, type = rw, define = yes;
         ZEROPAGE: load = ZP, type = zp, define = yes;
+        EXTZP: load = ZP, type = zp, define = yes, optional = yes;
+        APPZP: load = ZP, type = zp, define = yes, optional = yes;
 }
 
 FEATURES {
index 6b14232fecd5c3fc0755f2f824213d8ffa127644..d92ebe89f5d751e60a1de2f46205c8d201516255 100644 (file)
@@ -3,6 +3,7 @@
 ;
 
         .include        "pce.inc"
+        .include        "extzp.inc"
 
         .export         _clock
         .importzp       sreg
index eae2b27a2df79776b2ee1c8c148cfbe32d4da89d..f198be714340609073f34d51006e996e611f8cd9 100644 (file)
@@ -1,6 +1,8 @@
 
         .include        "pce.inc"
+        .include        "extzp.inc"
 
+        .import PLOT
         .export _clrscr
 _clrscr:
 
@@ -23,7 +25,11 @@ colloop:
         dey
         bne     rowloop
 
-        rts
+; Go to the home position.
+
+        stz     CURS_X
+        stz     CURS_Y
+        jmp     PLOT
 
 ;-------------------------------------------------------------------------------
 ; force the init constructor to be imported
index 36c85b6b5afda48b20c75fcbe3a38dc28d3cff58..0ff991a2e38519d240ac95d179070a0a1a45fb40 100644 (file)
@@ -7,7 +7,8 @@
 
         .export     _textcolor, _bgcolor, _bordercolor
 
-        .include    "pce.inc"
+        .include        "pce.inc"
+        .include        "extzp.inc"
 
 _textcolor:
         ldx     CHARCOLOR       ; get old value
@@ -33,9 +34,10 @@ _bgcolor:
 
 _bordercolor:
         lda     #0
-        txa
+        tax
         rts
 
+        .rodata
         .export colors
 
 colors:
index a8565a6ae1ac23a20cab440204204f354cd7d672..bcfc600a723a7f36911cf5d008b455cee13a3c3a 100644 (file)
@@ -1,4 +1,5 @@
         .include        "pce.inc"
+        .include        "extzp.inc"
 
         .import vce_init
         .import psg_init
index d31e137698552f266ae436ff5a4a5cb602a5592a..8d1cec8eb501a592e3c159dddf058102fcff2ece 100644 (file)
@@ -12,6 +12,7 @@
         .importzp       tmp3,tmp4
 
         .include        "pce.inc"
+        .include        "extzp.inc"
 
 _cputcxy:
         pha                     ; Save C
index f89119c467491564b127498d1d0fa215148f2744..4f886ca5a462ca07a2e0108993e9b4781cb60991 100644 (file)
@@ -26,6 +26,7 @@
         .import         __BSS_SIZE__
 
         .include        "pce.inc"
+        .include        "extzp.inc"
 
         .importzp       sp
         .importzp       ptr1,ptr2
@@ -77,7 +78,7 @@ start:
         tii     $2000, $2001, $1FFF
 
         ; Initialize hardware
-        stz     TIMER_COUNT     ; Timer off
+        stz     TIMER_CTRL      ; Timer off
         lda     #$07
         sta     IRQ_MASK        ; Interrupts off
         stz     IRQ_STATUS      ; Acknowledge timer
diff --git a/libsrc/pce/extzp.inc b/libsrc/pce/extzp.inc
new file mode 100644 (file)
index 0000000..2869c3a
--- /dev/null
@@ -0,0 +1,17 @@
+;
+; extzp.inc for the PC-Engine
+;
+; Groepaz/Hitmen, 2015-11-19
+;
+; Assembler include file that imports the runtime zero page locations used
+; by the PC-Engine runtime, ready for usage in asm code.
+;
+
+
+        .global         CURS_X: zp
+        .global         CURS_Y: zp
+        .global         SCREEN_PTR: zp
+        .global         CHARCOLOR: zp
+        .global         RVS: zp
+        .global         BGCOLOR: zp
+        .global         tickcount: zp
diff --git a/libsrc/pce/extzp.s b/libsrc/pce/extzp.s
new file mode 100644 (file)
index 0000000..516c309
--- /dev/null
@@ -0,0 +1,17 @@
+;
+; Groepaz/Hitmen, 2015-11-19
+;
+; zeropage locations for exclusive use by the library
+;
+
+        .include "extzp.inc"
+
+        .segment "EXTZP" : zeropage
+
+CURS_X:         .res 1
+CURS_Y:         .res 1
+SCREEN_PTR:     .res 2
+CHARCOLOR:      .res 1
+RVS:            .res 1
+BGCOLOR:        .res 1
+tickcount:      .res 4
index c7cda83f3425ca013735ffd33cdabd04730bb6dd..fb61646d1bf084033fd8dc053690c6de1c74e3cb 100644 (file)
@@ -6,6 +6,7 @@
         .import         popa, plot
 
         .include        "pce.inc"
+        .include        "extzp.inc"
 
 _gotoxy:
         sta     CURS_Y          ; Set Y
index 24ae8fab740289019a454169124c1f714b5abdf3..6c81e41522fbb6463d599cb25efcce8d4b9d293c 100644 (file)
@@ -2,6 +2,7 @@
         .export         PLOT
 
         .include        "pce.inc"
+        .include        "extzp.inc"
 
 PLOT:
         bcs     @getpos
index 1773de2b0b6daee4b0fd79220683a4e76130f9c7..17a74508c03e39638618da1d8b93b5de849f455d 100644 (file)
@@ -1,5 +1,6 @@
 
-        .include "pce.inc"
+        .include        "pce.inc"
+        .include        "extzp.inc"
 
         .export _revers
 
index b4e31f45ab6afb33c0198dd232e687ade4938f48..d60a9ddea5a18f2e2d5db7ccc024a8140e2390e0 100644 (file)
@@ -3,6 +3,7 @@
 ;
 
         .include        "pce.inc"
+        .include        "extzp.inc"
 
         .export         _waitvblank