(controller.tal) Print debugger on start button

This commit is contained in:
neauoire 2022-02-10 19:29:50 -08:00
parent ed22793a69
commit c982eb988b
2 changed files with 30 additions and 26 deletions

View File

@ -16,8 +16,11 @@
%8MOD { #07 AND } %8MOD2 { #0007 AND2 } %8MOD { #07 AND } %8MOD2 { #0007 AND2 }
%10MOD { #0f AND } %10MOD2 { #000f AND2 } %10MOD { #0f AND } %10MOD2 { #000f AND2 }
%DEBUG { ;print-hex/byte JSR2 #0a18 DEO } %HALT { #010f DEO }
%DEBUG2 { ;print-hex JSR2 #0a18 DEO } %EMIT { #18 DEO }
%DEBUG { ;print/byte JSR2 #0a EMIT }
%DEBUG2 { ;print/short JSR2 #0a EMIT }
%RTN { JMP2r } %RTN { JMP2r }
( devices ) ( devices )
@ -49,15 +52,11 @@
BRK BRK
@print-hex ( value* -- ) @print ( short* -- )
SWP ,&byte JSR &short ( short* -- ) SWP ,&byte JSR
&byte ( byte -- ) &byte ( byte -- ) DUP #04 SFT ,&char JSR
STHk #04 SFT ,&parse JSR #18 DEO &char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD EMIT
STHr #0f AND ,&parse JSR #18 DEO
RTN
&parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 + RTN
&above #57 + RTN
RTN RTN

View File

@ -8,11 +8,13 @@
%RTN { JMP2r } %RTN { JMP2r }
%TOS { #00 SWP } %TOS { #00 SWP }
%LTS2 { #8000 ++ SWP2 #8000 ++ >> } %LTS2 { #8000 ++ SWP2 #8000 ++ >> }
%AUTO-NONE { #00 .Screen/auto DEO }
%AUTO-X { #01 .Screen/auto DEO }
( devices ) ( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller [ &vector $2 &button $1 &key $1 ] |80 @Controller [ &vector $2 &button $1 &key $1 ]
( variables ) ( variables )
@ -55,13 +57,16 @@
( vectors ) ( vectors )
;on-button .Controller/vector DEO2 ;on-button .Controller/vector DEO2
;draw-controller JSR2 ,draw-controller JSR
BRK BRK
@on-button ( -> ) @on-button ( -> )
;draw-controller JSR2 ,draw-controller JSR
( print stack on start button )
.Controller/button DEI #08 = JMP BRK #010e DEO
BRK BRK
@ -120,7 +125,9 @@ BRK
.center/x LDZ2 #0010 -- .Screen/x DEO2 .center/x LDZ2 #0010 -- .Screen/x DEO2
.center/y LDZ2 #0010 -- .Screen/y DEO2 .center/y LDZ2 #0010 -- .Screen/y DEO2
AUTO-X
.Controller/button DEI2 #03 ;draw-short JSR2 .Controller/button DEI2 #03 ;draw-short JSR2
AUTO-NONE
RTN RTN
@ -128,18 +135,16 @@ RTN
@draw-short ( short* color -- ) @draw-short ( short* color -- )
STH SWP STH SWP STHkr ,draw-byte JSR STHr
DUP #04 SFT TOS #30 SFT2 ;font-hex ++ .Screen/addr DEO2
( draw ) STHkr .Screen/sprite DEO @draw-byte ( byte color -- )
#0f AND TOS #30 SFT2 ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2 STH DUP #04 SFT STHkr ,draw-hex JSR STHr
( draw ) STHkr .Screen/sprite DEO
DUP #04 SFT TOS #30 SFT2 ;font-hex ++ .Screen/addr DEO2 @draw-hex ( char color -- )
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHkr .Screen/sprite DEO #00 ROT #0f AND #30 SFT2 ;font-hex ++ .Screen/addr DEO2
#0f AND TOS #30 SFT2 ;font-hex ++ .Screen/addr DEO2 .Screen/sprite DEO
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHr .Screen/sprite DEO
RTN RTN