1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-06-07 06:29:32 +00:00

Add some failing tests for looping on the n flag.

This commit is contained in:
Chris Pressey 2018-03-29 13:33:06 +01:00
parent 6e8dc97826
commit b9fb26320c
3 changed files with 49 additions and 2 deletions

View File

@ -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

View File

@ -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.

View File

@ -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