mirror of
https://github.com/catseye/SixtyPical.git
synced 2024-06-07 06:29:32 +00:00
Rudimentarily document for
; add failing test cases for it.
This commit is contained in:
parent
42864bf125
commit
d88757c32b
|
@ -531,6 +531,22 @@ The sense of the test can be inverted with `not`.
|
|||
}
|
||||
} until not z
|
||||
|
||||
### for ###
|
||||
|
||||
for <dest-memory-location> (up|down) to <literal-byte> {
|
||||
<block>
|
||||
}
|
||||
|
||||
Executes the block repeatedly, incrementing or decrementing the
|
||||
dest-memory-location at the end of the block, until the value of
|
||||
the dest-memory-location has gone past the literal-byte.
|
||||
|
||||
The block is always executed as least once.
|
||||
|
||||
* It is illegal if any memory location is uninitialized at the exit of
|
||||
the loop when that memory location is initialized at the start of
|
||||
the loop.
|
||||
|
||||
Grammar
|
||||
-------
|
||||
|
||||
|
|
|
@ -1755,6 +1755,40 @@ If the range isn't known to be larger than the final value, you can't go down to
|
|||
| }
|
||||
? RangeExceededError
|
||||
|
||||
You can initialize something inside the loop that was uninitialized outside.
|
||||
|
||||
| routine main
|
||||
| outputs x, y, n, z
|
||||
| trashes c
|
||||
| {
|
||||
| ld x, 0
|
||||
| for x up to 15 {
|
||||
| ld y, 15
|
||||
| }
|
||||
| }
|
||||
= ok
|
||||
|
||||
But you can't UNinitialize something at the end of the loop that you need
|
||||
initialized at the start of that loop.
|
||||
|
||||
| routine foo
|
||||
| trashes y
|
||||
| {
|
||||
| }
|
||||
|
|
||||
| routine main
|
||||
| outputs x, y, n, z
|
||||
| trashes c
|
||||
| {
|
||||
| ld x, 0
|
||||
| ld y, 15
|
||||
| for x up to 15 {
|
||||
| inc y
|
||||
| call foo
|
||||
| }
|
||||
| }
|
||||
? UnmeaningfulReadError: y
|
||||
|
||||
### copy ###
|
||||
|
||||
Can't `copy` from a memory location that isn't initialized.
|
||||
|
|
Loading…
Reference in New Issue
Block a user