uxn/projects/examples/devices/console.tal

38 lines
601 B
Tal
Raw Normal View History

2021-04-21 12:09:18 -04:00
( dev/console )
2021-02-20 18:00:34 -05:00
2022-01-01 18:20:48 -05:00
%HALT { #010f DEO }
%EMIT { #18 DEO }
%DEBUG { ;print-hex/byte JSR2 #0a EMIT }
%DEBUG2 { ;print-hex JSR2 #0a EMIT }
2021-04-21 12:48:04 -04:00
( init )
2021-04-21 12:48:04 -04:00
|0100 ( -> )
2021-02-20 18:00:34 -05:00
2021-07-28 18:41:07 -04:00
;hello-word
2021-08-08 13:21:58 -04:00
&while
2022-01-01 18:20:48 -05:00
( send ) LDAk EMIT
#20 EMIT
DUP2 ;print-hex JSR2
#20 EMIT
LDAk ;print-hex/byte JSR2
#0a EMIT
2021-08-17 22:40:07 -04:00
INC2 LDAk ,&while JCN
2021-05-17 18:13:46 -04:00
POP2
2022-01-01 18:20:48 -05:00
( stop ) HALT
2021-07-28 18:41:07 -04:00
2021-05-13 11:47:18 -04:00
BRK
2021-02-20 18:00:34 -05:00
2022-01-01 18:20:48 -05:00
@print-hex ( value* -- )
SWP ,&byte JSR
&byte ( byte -- )
STHk #04 SFT ,&parse JSR #18 DEO
STHr #0f AND ,&parse JSR #18 DEO
JMP2r
&parse ( byte -- char ) DUP #09 GTH ,&above JCN #30 ADD JMP2r
&above #57 ADD JMP2r
JMP2r
2021-08-30 17:53:01 -04:00
@hello-word "Hello 20 "Uxn!