0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-30 01:33:01 +00:00
uxn/projects/software/hexes.tal
2021-06-28 14:42:36 -07:00

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