mirror of
https://github.com/catseye/SixtyPical.git
synced 2026-04-27 02:18:14 +00:00
Add failing tests for add and sub on locations other than a.
This commit is contained in:
1 parent
0ec8970c76
commit
2803aa2d05
2 files changed
+83
No files matched your search
@@ -852,6 +852,32 @@ Can't `add` to a memory location that isn't writeable.
|
||||
| }
|
||||
? ForbiddenWriteError: a
|
||||
|
||||
You can `add` a byte constant to a byte memory location.
|
||||
|
||||
| byte lives
|
||||
| define main routine
|
||||
| inputs a, lives
|
||||
| outputs lives
|
||||
| trashes a, c, z, v, n
|
||||
| {
|
||||
| st off, c
|
||||
| add lives, 3
|
||||
| }
|
||||
= ok
|
||||
|
||||
`add`ing a byte constant to a byte memory location trashes `a`.
|
||||
|
||||
| byte lives
|
||||
| define main routine
|
||||
| inputs a, lives
|
||||
| outputs lives
|
||||
| trashes c, z, v, n
|
||||
| {
|
||||
| st off, c
|
||||
| add lives, 3
|
||||
| }
|
||||
? UnmeaningfulOutputError: a
|
||||
|
||||
You can `add` a word constant to a word memory location.
|
||||
|
||||
| word score
|
||||
@@ -996,6 +1022,32 @@ Can't `sub` to a memory location that isn't writeable.
|
||||
| }
|
||||
? ForbiddenWriteError: a
|
||||
|
||||
You can `sub` a byte constant from a byte memory location.
|
||||
|
||||
| byte lives
|
||||
| define main routine
|
||||
| inputs a, lives
|
||||
| outputs lives
|
||||
| trashes a, c, z, v, n
|
||||
| {
|
||||
| st on, c
|
||||
| sub lives, 3
|
||||
| }
|
||||
= ok
|
||||
|
||||
`sub`ing a byte constant from a byte memory location trashes `a`.
|
||||
|
||||
| byte lives
|
||||
| define main routine
|
||||
| inputs a, lives
|
||||
| outputs lives
|
||||
| trashes c, z, v, n
|
||||
| {
|
||||
| st on, c
|
||||
| sub lives, 3
|
||||
| }
|
||||
? UnmeaningfulOutputError: a
|
||||
|
||||
You can `sub` a word constant from a word memory location.
|
||||
|
||||
| word score
|
||||
|
||||
@@ -1025,6 +1025,37 @@ Copying to and from a vector table.
|
||||
= $0842 JMP ($0846)
|
||||
= $0845 RTS
|
||||
|
||||
### add, sub
|
||||
|
||||
Various modes of `add`.
|
||||
|
||||
| byte lives
|
||||
| word score
|
||||
| define main routine
|
||||
| inputs lives, score
|
||||
| outputs lives, score
|
||||
| trashes a, x, y, c, z, v, n
|
||||
| {
|
||||
| ld a, 0
|
||||
| ld x, 0
|
||||
| ld y, 0
|
||||
| st off, c
|
||||
| add a, 7
|
||||
| add a, lives
|
||||
| // add x, 7
|
||||
| // add y, 7
|
||||
| add lives, 2
|
||||
| add score, 1999
|
||||
| }
|
||||
= $080D CLC
|
||||
= $080E LDA $081F
|
||||
= $0811 ADC #$CF
|
||||
= $0813 STA $081F
|
||||
= $0816 LDA $0820
|
||||
= $0819 ADC #$07
|
||||
= $081B STA $0820
|
||||
= $081E RTS
|
||||
|
||||
### word operations
|
||||
|
||||
Adding a constant word to a word memory location.
|
||||
|
||||
Reference in new issue
Block a user