mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-01 03:52:39 +00:00
46 lines
878 B
Tal
46 lines
878 B
Tal
|
|
||
|
( uxnasm subleq.tal subleq.rom && uxncli subleq.rom )
|
||
|
|
||
|
%EMIT { #18 DEO }
|
||
|
%HALT { #0101 #0e DEO2 }
|
||
|
%RTN { JMP2r }
|
||
|
%GET { #10 SFT2 ;program ADD2 LDA2 }
|
||
|
%SET { #10 SFT2 ;program ADD2 STA2 }
|
||
|
|
||
|
|0000 @a $2 @b $2 @c $2
|
||
|
|0100
|
||
|
|
||
|
( pointer ) #0000
|
||
|
&while
|
||
|
,eval JSR
|
||
|
DUP2 #8000 LTH2 ,&while JCN
|
||
|
POP2
|
||
|
HALT
|
||
|
|
||
|
BRK
|
||
|
|
||
|
@eval ( ip* -- ip* )
|
||
|
|
||
|
DUP2 GET .a STZ2
|
||
|
INC2 DUP2 GET .b STZ2
|
||
|
INC2 DUP2 GET .c STZ2
|
||
|
INC2
|
||
|
( I/O )
|
||
|
.a LDZ2 #ffff NEQ2 ,&noin JCN
|
||
|
( nothing. ) ,&end JMP2 &noin
|
||
|
.b LDZ2 #ffff NEQ2 ,&noout JCN
|
||
|
.a LDZ2 GET NIP EMIT ,&end JMP &noout
|
||
|
( SUBLEQ )
|
||
|
.b LDZ2 GET .a LDZ2 GET SUB2 .b LDZ2 SET
|
||
|
( SET )
|
||
|
.b LDZ2 GET #0001 SUB2 #8000 LTH2 ,&end JCN
|
||
|
POP2 .c LDZ2 &end
|
||
|
|
||
|
RTN
|
||
|
|
||
|
@program ( hello world )
|
||
|
000f 0011 ffff 0011 ffff ffff 0010 0001
|
||
|
ffff 0010 0003 ffff 000f 000f 0000 0000
|
||
|
ffff 0048 0065 006c 006c 006f 002c 0020
|
||
|
0077 006f 0072 006c 0064 0021 000a 0000
|