diff --git a/eg/atari2600/build.sh b/eg/atari2600/build.sh index 1430812..be05acf 100755 --- a/eg/atari2600/build.sh +++ b/eg/atari2600/build.sh @@ -6,4 +6,5 @@ if [ "x$COMPARE" != "x" ]; then dcc6502 -o 0xf000 -m 200 smiley.bin > smiley.bin.disasm.txt dcc6502 -o 0xf000 -m 200 smiley-60p.bin > smiley-60p.bin.disasm.txt paste smiley.bin.disasm.txt smiley-60p.bin.disasm.txt | pr -t -e24 + #diff -ru smiley.bin.disasm.txt smiley-60p.bin.disasm.txt fi diff --git a/tests/SixtyPical Analysis.md b/tests/SixtyPical Analysis.md index 82ad7ec..2b279a9 100644 --- a/tests/SixtyPical Analysis.md +++ b/tests/SixtyPical Analysis.md @@ -1669,6 +1669,18 @@ The body of `repeat forever` can be empty. | } = ok +While `repeat` is most often used with `z`, it can also be used with `n`. + + | routine main + | outputs y, n, z + | { + | ld y, 15 + | repeat { + | dec y + | } until n + | } + = ok + ### for ### Basic "open-faced for" loop. We'll start with the "upto" variant. diff --git a/tests/SixtyPical Compilation.md b/tests/SixtyPical Compilation.md index 629237d..489bebe 100644 --- a/tests/SixtyPical Compilation.md +++ b/tests/SixtyPical Compilation.md @@ -357,7 +357,7 @@ Compiling `if` without `else`. = $0813 LDY #$01 = $0815 RTS -Compiling `repeat`. +Compiling `repeat ... until z`. | routine main | trashes a, y, z, n, c @@ -376,7 +376,7 @@ Compiling `repeat`. = $0813 BNE $080F = $0815 RTS -Compiling `repeat until not`. +Compiling `repeat ... until not z`. | routine main | trashes a, y, z, n, c @@ -395,6 +395,40 @@ Compiling `repeat until not`. = $0813 BEQ $080F = $0815 RTS +Compiling `repeat ... until n`. + + | routine main + | trashes a, y, z, n, c + | { + | ld y, 65 + | repeat { + | ld a, y + | dec y + | } until n + | } + = $080D LDY #$41 + = $080F TYA + = $0810 DEY + = $0811 BPL $080F + = $0813 RTS + +Compiling `repeat ... until not n`. + + | routine main + | trashes a, y, z, n, c + | { + | ld y, 65 + | repeat { + | ld a, y + | inc y + | } until not n + | } + = $080D LDY #$41 + = $080F TYA + = $0810 INY + = $0811 BMI $080F + = $0813 RTS + Compiling `repeat forever`. | routine main