mirror of
https://github.com/catseye/SixtyPical.git
synced 2024-06-02 18:41:35 +00:00
Add some initial failing tests.
This commit is contained in:
parent
ab33331924
commit
aa5b06980c
|
@ -517,8 +517,9 @@ Copying to and from a word table.
|
|||
? TypeMismatchError
|
||||
|
||||
You can also copy a literal word to a word table.
|
||||
(Even if the table has fewer than 256 entries.)
|
||||
|
||||
| word table[256] many
|
||||
| word table[32] many
|
||||
|
|
||||
| routine main
|
||||
| inputs many
|
||||
|
@ -530,6 +531,77 @@ You can also copy a literal word to a word table.
|
|||
| }
|
||||
= ok
|
||||
|
||||
#### tables: range checking ####
|
||||
|
||||
A table may not have more than 256 entries.
|
||||
|
||||
| word table[512] many
|
||||
|
|
||||
| routine main
|
||||
| inputs many
|
||||
| outputs many
|
||||
| trashes a, x, n, z
|
||||
| {
|
||||
| ld x, 0
|
||||
| copy 9999, many + x
|
||||
| }
|
||||
? zzzzz
|
||||
|
||||
The number of entries in a table must be a power of two.
|
||||
|
||||
| word table[48] many
|
||||
|
|
||||
| routine main
|
||||
| inputs many
|
||||
| outputs many
|
||||
| trashes a, x, n, z
|
||||
| {
|
||||
| ld x, 0
|
||||
| copy 9999, many + x
|
||||
| }
|
||||
? zzzz
|
||||
|
||||
If a table has fewer than 256 entries, it cannot be read or written
|
||||
beyond the maximum number of entries it has.
|
||||
|
||||
| byte table[32] many
|
||||
|
|
||||
| routine main
|
||||
| inputs many
|
||||
| outputs many
|
||||
| trashes a, x, n, z
|
||||
| {
|
||||
| ld x, 31
|
||||
| ld a, many + x
|
||||
| st a, many + x
|
||||
| }
|
||||
= ok
|
||||
|
||||
| byte table[32] many
|
||||
|
|
||||
| routine main
|
||||
| inputs many
|
||||
| outputs many
|
||||
| trashes a, x, n, z
|
||||
| {
|
||||
| ld x, 32
|
||||
| ld a, many + x
|
||||
| }
|
||||
? RangeError
|
||||
|
||||
| byte table[32] many
|
||||
|
|
||||
| routine main
|
||||
| inputs many
|
||||
| outputs many
|
||||
| trashes a, x, n, z
|
||||
| {
|
||||
| ld x, 32
|
||||
| ld a, 0
|
||||
| st a, many + x
|
||||
| }
|
||||
? RangeError
|
||||
|
||||
### add ###
|
||||
|
||||
Can't `add` from or to a memory location that isn't initialized.
|
||||
|
|
Loading…
Reference in New Issue
Block a user