From 859604407b76364c129e106833fda674ab44ef92 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sat, 19 Sep 2015 15:37:39 +0200 Subject: [PATCH] fixed more flaws found by greg :) --- asminc/pce.inc | 9 --------- cfg/pce.cfg | 4 +++- libsrc/pce/clock.s | 1 + libsrc/pce/clrscr.s | 8 +++++++- libsrc/pce/color.s | 6 ++++-- libsrc/pce/conio.s | 1 + libsrc/pce/cputc.s | 1 + libsrc/pce/crt0.s | 3 ++- libsrc/pce/extzp.inc | 17 +++++++++++++++++ libsrc/pce/extzp.s | 17 +++++++++++++++++ libsrc/pce/gotoxy.s | 1 + libsrc/pce/kplot.s | 1 + libsrc/pce/revers.s | 3 ++- libsrc/pce/waitvblank.s | 1 + 14 files changed, 58 insertions(+), 15 deletions(-) create mode 100644 libsrc/pce/extzp.inc create mode 100644 libsrc/pce/extzp.s diff --git a/asminc/pce.inc b/asminc/pce.inc index 3e82c38cc..623ab4da8 100644 --- a/asminc/pce.inc +++ b/asminc/pce.inc @@ -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 diff --git a/cfg/pce.cfg b/cfg/pce.cfg index adb420f32..2c660435a 100644 --- a/cfg/pce.cfg +++ b/cfg/pce.cfg @@ -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 { diff --git a/libsrc/pce/clock.s b/libsrc/pce/clock.s index 6b14232fe..d92ebe89f 100644 --- a/libsrc/pce/clock.s +++ b/libsrc/pce/clock.s @@ -3,6 +3,7 @@ ; .include "pce.inc" + .include "extzp.inc" .export _clock .importzp sreg diff --git a/libsrc/pce/clrscr.s b/libsrc/pce/clrscr.s index eae2b27a2..f198be714 100644 --- a/libsrc/pce/clrscr.s +++ b/libsrc/pce/clrscr.s @@ -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 diff --git a/libsrc/pce/color.s b/libsrc/pce/color.s index 36c85b6b5..0ff991a2e 100644 --- a/libsrc/pce/color.s +++ b/libsrc/pce/color.s @@ -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: diff --git a/libsrc/pce/conio.s b/libsrc/pce/conio.s index a8565a6ae..bcfc600a7 100644 --- a/libsrc/pce/conio.s +++ b/libsrc/pce/conio.s @@ -1,4 +1,5 @@ .include "pce.inc" + .include "extzp.inc" .import vce_init .import psg_init diff --git a/libsrc/pce/cputc.s b/libsrc/pce/cputc.s index d31e13769..8d1cec8eb 100644 --- a/libsrc/pce/cputc.s +++ b/libsrc/pce/cputc.s @@ -12,6 +12,7 @@ .importzp tmp3,tmp4 .include "pce.inc" + .include "extzp.inc" _cputcxy: pha ; Save C diff --git a/libsrc/pce/crt0.s b/libsrc/pce/crt0.s index f89119c46..4f886ca5a 100644 --- a/libsrc/pce/crt0.s +++ b/libsrc/pce/crt0.s @@ -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 index 000000000..2869c3a06 --- /dev/null +++ b/libsrc/pce/extzp.inc @@ -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 index 000000000..516c30954 --- /dev/null +++ b/libsrc/pce/extzp.s @@ -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 diff --git a/libsrc/pce/gotoxy.s b/libsrc/pce/gotoxy.s index c7cda83f3..fb61646d1 100644 --- a/libsrc/pce/gotoxy.s +++ b/libsrc/pce/gotoxy.s @@ -6,6 +6,7 @@ .import popa, plot .include "pce.inc" + .include "extzp.inc" _gotoxy: sta CURS_Y ; Set Y diff --git a/libsrc/pce/kplot.s b/libsrc/pce/kplot.s index 24ae8fab7..6c81e4152 100644 --- a/libsrc/pce/kplot.s +++ b/libsrc/pce/kplot.s @@ -2,6 +2,7 @@ .export PLOT .include "pce.inc" + .include "extzp.inc" PLOT: bcs @getpos diff --git a/libsrc/pce/revers.s b/libsrc/pce/revers.s index 1773de2b0..17a74508c 100644 --- a/libsrc/pce/revers.s +++ b/libsrc/pce/revers.s @@ -1,5 +1,6 @@ - .include "pce.inc" + .include "pce.inc" + .include "extzp.inc" .export _revers diff --git a/libsrc/pce/waitvblank.s b/libsrc/pce/waitvblank.s index b4e31f45a..d60a9ddea 100644 --- a/libsrc/pce/waitvblank.s +++ b/libsrc/pce/waitvblank.s @@ -3,6 +3,7 @@ ; .include "pce.inc" + .include "extzp.inc" .export _waitvblank -- 2.39.2