started sprite output debugging

This commit is contained in:
Luxferre
2022-07-29 23:42:27 +03:00
parent b05209ea0c
commit a15a2c15b8
2 changed files with 32 additions and 8 deletions
+3 -1
View File
@@ -56,9 +56,11 @@
( decrement )
%DEC { #01 SUB }
( get the bit of a specific number )
( get the bit or the nibble of a specific number )
( val bitnum -- bit )
%GETBIT { SFT #01 AND }
( val* bitnum -- bit )
%GETBIT2 { SFT2 #0001 AND2 NIP }
( val* nibnum -- nibble )
%GETNIBBLE { #20 SFT SFT2 #000f AND2 NIP }
+29 -7
View File
@@ -6,7 +6,7 @@
BRK
@on-frame
#0b ;line4 JSR2
LIT 'O ;drawc JSR2
;&adv KP-A JMPKEY
;&back KP-B JMPKEY
BRK
@@ -21,8 +21,8 @@ BRK
( sprite and text drawing routines )
( subtract #20 from the ASCII code and you get the offset from the nanofont label )
%CHAR-TO-NF { #20 SUB ;nanofont ADD }
( subtract #20 from the ASCII code and get the absolute offset from the nanofont label )
%CHAR-TO-NF { #20 SUB BTS ;nanofont ADD2 }
( 4x1 scanline output from the nibble )
( x y nibble -- x y )
@@ -46,15 +46,37 @@ BRK
JMP2r
( 4x4 sprite output from the memory )
( addr* x y -- )
( x y addr* -- x y )
@sprite4
( get sprite contents )
SWP2 LDA2 ( x y sprval* -- )
LDA2 ( x y sprval* -- )
SWP2 OVR2 ( sprval* x y sprval* -- )
#04 ( sprval* x y sprval* counter -- )
&lp
DEC ( first effective counter value is 3 )
DUP SWP2 ROT ( sprval* x y counter sprval* counter -- )
GETNIBBLE ( sprval* x y counter nibble -- )
SWP ( sprval* x y nibble counter -- )
DBGBYTE
STH ( sprval* x y nibble -- ) ( stash counter into return stack )
;line4 JSR2 ( sprval* x y -- )
INC ( increment y coord )
STHr ( sprval* x y counter -- ) ( restore counter from return stack )
DBGBYTE
DUP ,&lp JCN
POP SWP2 POP2 ( sprval* x y counter -- x y )
#04 SUB ( restore y coord )
JMP2r
( nanofont character sprite output )
( x y char -- x y )
@drawc
CHAR-TO-NF DBGSHORT ;sprite4 JSR2
JMP2r
( same as drawc but auto increment x coord )
@putc
;drawc JSR2
SWP #04 ADD SWP
JMP2r
@draw-str ( s* -> )