mirror of
https://github.com/catseye/SixtyPical.git
synced 2024-11-25 23:49:17 +00:00
Fix table access bug where index wasn't required to be initialized.
This commit is contained in:
parent
11d6c08369
commit
20c824743e
@ -8,6 +8,7 @@ History of SixtyPical
|
||||
* Initialized `byte table` values need not have all 256 bytes initialized.
|
||||
* Constraints for `vector` type come immediately after the type, not the variable.
|
||||
* `vector table` storage, and ability to copy vectors in and out of same.
|
||||
* Fixed bug where index register wasn't required to be initialized before table access.
|
||||
|
||||
0.10
|
||||
----
|
||||
|
@ -238,6 +238,7 @@ class Analyzer(object):
|
||||
raise TypeMismatchError('%s and %s in %s' %
|
||||
(src.name, dest.name, self.current_routine.name)
|
||||
)
|
||||
context.assert_meaningful(instr.index)
|
||||
elif src.type != dest.type:
|
||||
raise TypeMismatchError('%s and %s in %s' %
|
||||
(src.name, dest.name, self.current_routine.name)
|
||||
@ -250,6 +251,7 @@ class Analyzer(object):
|
||||
pass
|
||||
else:
|
||||
raise TypeMismatchError((src, dest))
|
||||
context.assert_meaningful(instr.index)
|
||||
elif src.type != dest.type:
|
||||
raise TypeMismatchError('%s and %s in %s' %
|
||||
(src.name, dest.name, self.current_routine.name)
|
||||
|
@ -240,7 +240,7 @@ Can't `st` a `word` type.
|
||||
|
||||
### tables ###
|
||||
|
||||
Storing to a table, you must use an index, and vice-versa.
|
||||
Storing to a table, you must use an index.
|
||||
|
||||
| byte one
|
||||
| byte table[256] many
|
||||
@ -294,7 +294,21 @@ Storing to a table, you must use an index, and vice-versa.
|
||||
| }
|
||||
= ok
|
||||
|
||||
Reading from a table, you must use an index, and vice-versa.
|
||||
The index must be initialized.
|
||||
|
||||
| byte one
|
||||
| byte table[256] many
|
||||
|
|
||||
| routine main
|
||||
| outputs many
|
||||
| trashes a, x, n, z
|
||||
| {
|
||||
| ld a, 0
|
||||
| st a, many + x
|
||||
| }
|
||||
? UnmeaningfulReadError: x
|
||||
|
||||
Reading from a table, you must use an index.
|
||||
|
||||
| byte one
|
||||
|
|
||||
@ -346,6 +360,31 @@ Reading from a table, you must use an index, and vice-versa.
|
||||
| }
|
||||
= ok
|
||||
|
||||
| byte table[256] many
|
||||
|
|
||||
| routine main
|
||||
| inputs many
|
||||
| outputs many
|
||||
| trashes a, x, n, z
|
||||
| {
|
||||
| ld x, 0
|
||||
| ld a, many + x
|
||||
| }
|
||||
= ok
|
||||
|
||||
The index must be initialized.
|
||||
|
||||
| byte table[256] many
|
||||
|
|
||||
| routine main
|
||||
| inputs many
|
||||
| outputs many
|
||||
| trashes a, x, n, z
|
||||
| {
|
||||
| ld a, many + x
|
||||
| }
|
||||
? UnmeaningfulReadError: x
|
||||
|
||||
Copying to and from a word table.
|
||||
|
||||
| word one
|
||||
|
Loading…
Reference in New Issue
Block a user