uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit c982eb988b746f1e29a33381896e943978ab1f85
parent ed22793a69232afcfa777a1f06ed140ce1e0e1a3
Author: neauoire <aliceffekt@gmail.com>
Date:   Thu, 10 Feb 2022 19:29:50 -0800

(controller.tal) Print debugger on start button

Diffstat:
Mprojects/examples/blank.tal | 21++++++++++-----------
Mprojects/examples/devices/controller.tal | 35++++++++++++++++++++---------------
2 files changed, 30 insertions(+), 26 deletions(-)

diff --git a/projects/examples/blank.tal b/projects/examples/blank.tal @@ -16,8 +16,11 @@ %8MOD { #07 AND } %8MOD2 { #0007 AND2 } %10MOD { #0f AND } %10MOD2 { #000f AND2 } -%DEBUG { ;print-hex/byte JSR2 #0a18 DEO } -%DEBUG2 { ;print-hex JSR2 #0a18 DEO } +%HALT { #010f DEO } +%EMIT { #18 DEO } +%DEBUG { ;print/byte JSR2 #0a EMIT } +%DEBUG2 { ;print/short JSR2 #0a EMIT } + %RTN { JMP2r } ( devices ) @@ -49,15 +52,11 @@ BRK -@print-hex ( value* -- ) - - SWP ,&byte JSR - &byte ( byte -- ) - STHk #04 SFT ,&parse JSR #18 DEO - STHr #0f AND ,&parse JSR #18 DEO - RTN - &parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 + RTN - &above #57 + RTN +@print ( short* -- ) + + &short ( short* -- ) SWP ,&byte JSR + &byte ( byte -- ) DUP #04 SFT ,&char JSR + &char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD EMIT RTN diff --git a/projects/examples/devices/controller.tal b/projects/examples/devices/controller.tal @@ -8,11 +8,13 @@ %RTN { JMP2r } %TOS { #00 SWP } %LTS2 { #8000 ++ SWP2 #8000 ++ >> } +%AUTO-NONE { #00 .Screen/auto DEO } +%AUTO-X { #01 .Screen/auto DEO } ( devices ) |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 ] ( variables ) @@ -55,13 +57,16 @@ ( vectors ) ;on-button .Controller/vector DEO2 - ;draw-controller JSR2 + ,draw-controller JSR BRK @on-button ( -> ) - ;draw-controller JSR2 + ,draw-controller JSR + + ( print stack on start button ) + .Controller/button DEI #08 = JMP BRK #010e DEO BRK @@ -120,7 +125,9 @@ BRK .center/x LDZ2 #0010 -- .Screen/x DEO2 .center/y LDZ2 #0010 -- .Screen/y DEO2 + AUTO-X .Controller/button DEI2 #03 ;draw-short JSR2 + AUTO-NONE RTN @@ -128,18 +135,16 @@ RTN @draw-short ( short* color -- ) - STH SWP - DUP #04 SFT TOS #30 SFT2 ;font-hex ++ .Screen/addr DEO2 - ( draw ) STHkr .Screen/sprite DEO - #0f AND TOS #30 SFT2 ;font-hex ++ .Screen/addr DEO2 - .Screen/x DEI2 #0008 ++ .Screen/x DEO2 - ( draw ) STHkr .Screen/sprite DEO - DUP #04 SFT TOS #30 SFT2 ;font-hex ++ .Screen/addr DEO2 - .Screen/x DEI2 #0008 ++ .Screen/x DEO2 - ( draw ) STHkr .Screen/sprite DEO - #0f AND TOS #30 SFT2 ;font-hex ++ .Screen/addr DEO2 - .Screen/x DEI2 #0008 ++ .Screen/x DEO2 - ( draw ) STHr .Screen/sprite DEO + STH SWP STHkr ,draw-byte JSR STHr + +@draw-byte ( byte color -- ) + + STH DUP #04 SFT STHkr ,draw-hex JSR STHr + +@draw-hex ( char color -- ) + + #00 ROT #0f AND #30 SFT2 ;font-hex ++ .Screen/addr DEO2 + .Screen/sprite DEO RTN