uxn

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

commit 6e810a080d05371191b52894d5a38758e5ab83b7
parent 9970b650943de2a91f8c49d8342476587019d996
Author: neauoire <aliceffekt@gmail.com>
Date:   Sat, 11 Dec 2021 10:47:14 -0800

(subleq.tal) Added new exercise

Diffstat:
Aprojects/examples/exercises/subleq.tal | 45+++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+), 0 deletions(-)

diff --git a/projects/examples/exercises/subleq.tal b/projects/examples/exercises/subleq.tal @@ -0,0 +1,45 @@ + +( 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