mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-12-17 22:10:14 +00:00
31 lines
497 B
Tal
31 lines
497 B
Tal
( hexes
|
|
|
|
A small utility that prints incoming console messages as hex values. )
|
|
|
|
%RTN { JMP2r }
|
|
|
|
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 ]
|
|
|
|
( init )
|
|
|
|
|0100 ( -> )
|
|
|
|
;on-message .Console/vector DEO2
|
|
|
|
BRK
|
|
|
|
@on-message ( -> )
|
|
|
|
.Console/read DEI ,print-hex JSR
|
|
|
|
BRK
|
|
|
|
@print-hex ( value -- )
|
|
|
|
STHk #04 SFT ,&parse JSR .Console/write DEO
|
|
STHr #0f AND ,&parse JSR .Console/write DEO
|
|
RTN
|
|
&parse ( value -- char )
|
|
DUP #09 GTH ,&above JCN #30 ADD RTN &above #09 SUB #60 ADD RTN
|
|
|
|
RTN
|