M build.sh => build.sh +3 -3
@@ 19,7 19,7 @@ case "$*" in *--save*) cp $dst $roms_dir ;; esac
# hello.tal -> hello.rom -> hello.tal
$asm etc/hello.tal bin/hello.rom
-$emu $dst bin/hello.rom bin/hello.dis.tal > etc/hello-dis.tal
-$asm etc/hello-dis.tal bin/hello.rom
-$emu $dst bin/hello.rom bin/hello.dis.tal > etc/hello-dis.tal
+$emu $dst bin/hello.rom bin/hello.dis.tal # > etc/hello-dis.tal
+# $asm etc/hello-dis.tal bin/hello.rom
+# $emu $dst bin/hello.rom bin/hello.dis.tal > etc/hello-dis.tal
M src/uxnrea.tal => src/uxnrea.tal +24 -0
@@ 255,6 255,11 @@ JMP2r
LIT "@ emit
INC2k INC2 pstr
+ .addr LDZ2 find-definition DUP2 #ffff EQU2 ?&no-def
+ #20 emit
+ INC2k INC2 pstr
+ &no-def POP2
+
.addr LDZ2 find-sublabel #ffff NEQ2 ?&no-lb
emit-lb
#09 emit
@@ 364,6 369,7 @@ JMP2r
,&t STR2
;sym .symlen LDZ2 ADD2k NIP2 SWP2
&l
+ INC2k INC2 LDA LIT "( EQU ?&no-found
LDA2k [ LIT2 &t $2 ] NEQ2 ?&no-found
NIP2 JMP2r
&no-found
@@ 379,6 385,7 @@ JMP2r
,&t STR2
;sym .symlen LDZ2 ADD2k NIP2 SWP2
&l
+ INC2k INC2 LDA LIT "( EQU ?&no-found
LDA2k [ LIT2 &t $2 ] NEQ2 ?&no-found
INC2k INC2 [ LIT "/ ] cndx #ffff EQU2 ?&no-found
NIP2 JMP2r
@@ 395,6 402,7 @@ JMP2r
,&t STR2
;sym .symlen LDZ2 ADD2k NIP2 SWP2
&l
+ INC2k INC2 LDA LIT "( EQU ?&no-found
LDA2k [ LIT2 &t $2 ] NEQ2 ?&no-found
INC2k INC2 [ LIT "/ ] cndx #ffff NEQ2 ?&no-found
NIP2 JMP2r
@@ 406,6 414,22 @@ JMP2r
JMP2r
+@find-definition ( addr* -- <label*> )
+
+ ,&t STR2
+ ;sym .symlen LDZ2 ADD2k NIP2 SWP2
+ &l
+ INC2k INC2 LDA LIT "( NEQ ?&no-found
+ LDA2k [ LIT2 &t $2 ] NEQ2 ?&no-found
+ NIP2 JMP2r
+ &no-found
+ INC2 INC2 scap INC2 GTH2k ?&l
+ &end
+ POP2 POP2
+ #ffff
+
+JMP2r
+
(
@|stdlib )