handle loop

This commit is contained in:
Travis Shears 2024-07-12 16:34:25 +02:00
parent 2ec5691e28
commit 555114bdb0
2 changed files with 46 additions and 12 deletions

View file

@ -1,25 +1,44 @@
%EMIT { #18 DEO }
%NL { #0a EMIT }
|0100 |0100
#63 #ff STZ ( set num to 99 )
@l
beer-count print-num ( print num )
;bottles-of-beer print ;bottles-of-beer print
;on-the-wall print ;on-the-wall print
( incrment num ) NL
beer-count print-num
;bottles-of-beer print ;bottles-of-beer print
NL
;take-one-down print
NL
beer-count #01 SUB #ff STZ
beer-count #00 EQU ?{ l }
;end print
BRK BRK
@beer-count #ff LDZ JMP2r
@bottles-of-beer "bottles_of_beer 00
%SP { 20 }
@bottles-of-beer "99_bottles_of_beer 00
@on-the-wall "on_the_wall 00 @on-the-wall "on_the_wall 00
@take-one-down "take_one_down,_pass_it_around 00 @take-one-down "take_one_down,_pass_it_around 00
@end "no_more_bottles_of_beer 00
@print ( str* -: ) @print ( str* -: )
( LDAk LIT "_ NEQk ?print/space )
LDAk DUP #5f NEQ LDAk DUP #5f NEQ
?{ POP #20 } ?{ POP #20 }
#18 DEO EMIT
INC2 LDAk ?print INC2 LDAk ?print
( print newline ) #20 EMIT
#0a #18 DEO
POP2 JMP2r POP2 JMP2r
@print-num ( two digit int -: )
DUP
#0a DIV ( 25 02 )
SWP DUP ( 02 25 25 )
#0a DIV ( 02 25 02 )
#0a MUL ( 02 25 20 )
SUB ( 02 05 )
#30 ADD SWP #30 ADD
EMIT EMIT
#20 EMIT ( print space )
JMP2r

15
README.md Normal file
View file

@ -0,0 +1,15 @@
These are my UXN experiments
# Dev
## Edit file
```shell
$ ../uxn/bin/uxnemu ../left.rom 99_bottles.tal
```
## Step through debugger
```shell
$ echo 99_bottles.rom | entr -r ../uxn/bin/uxnemu ../beetbug.rom ./99_bottles.rom
```