1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-11-24 15:32:27 +00:00

Add two simple tests for save. Surprisingly, they both pass.

This commit is contained in:
Chris Pressey 2018-04-20 13:36:08 +01:00
parent 4d1f9d0f3c
commit 0f41857b39

View File

@ -1940,19 +1940,54 @@ initialized at the start of that loop.
### save ### ### save ###
Basic neutral test. Basic neutral test, where the `save` makes no difference.
| routine main | routine main
| inputs a, x | inputs a, x
| outputs a, x | outputs a, x
| trashes z, n | trashes z, n
| { | {
| ld a, 1
| save x {
| ld a, 2
| }
| ld a, 3
| }
= ok
A defined value that has been saved can be trashed inside the block.
It will continue to be defined outside the block.
| routine main
| inputs a
| outputs a, x
| trashes z, n
| {
| ld x, 0
| save x { | save x {
| ld a, 0 | ld a, 0
| trash x
| } | }
| } | }
= ok = ok
A trashed value that has been saved can be used inside the block.
It will continue to be trashed outside the block.
| routine main
| inputs a
| outputs a, x
| trashes z, n
| {
| ld x, 0
| trash x
| save x {
| ld a, 0
| ld x, 1
| }
| }
? UnmeaningfulOutputError: x
### copy ### ### copy ###
Can't `copy` from a memory location that isn't initialized. Can't `copy` from a memory location that isn't initialized.