Fix table access bug where index wasn't required to be initialized.
Chris Pressey
5 years ago
7 | 7 |
* Initialized `byte table` values need not have all 256 bytes initialized.
|
8 | 8 |
* Constraints for `vector` type come immediately after the type, not the variable.
|
9 | 9 |
* `vector table` storage, and ability to copy vectors in and out of same.
|
|
10 |
* Fixed bug where index register wasn't required to be initialized before table access.
|
10 | 11 |
|
11 | 12 |
0.10
|
12 | 13 |
----
|
237 | 237 |
raise TypeMismatchError('%s and %s in %s' %
|
238 | 238 |
(src.name, dest.name, self.current_routine.name)
|
239 | 239 |
)
|
|
240 |
context.assert_meaningful(instr.index)
|
240 | 241 |
elif src.type != dest.type:
|
241 | 242 |
raise TypeMismatchError('%s and %s in %s' %
|
242 | 243 |
(src.name, dest.name, self.current_routine.name)
|
|
249 | 250 |
pass
|
250 | 251 |
else:
|
251 | 252 |
raise TypeMismatchError((src, dest))
|
|
253 |
context.assert_meaningful(instr.index)
|
252 | 254 |
elif src.type != dest.type:
|
253 | 255 |
raise TypeMismatchError('%s and %s in %s' %
|
254 | 256 |
(src.name, dest.name, self.current_routine.name)
|
239 | 239 |
|
240 | 240 |
### tables ###
|
241 | 241 |
|
242 | |
Storing to a table, you must use an index, and vice-versa.
|
|
242 |
Storing to a table, you must use an index.
|
243 | 243 |
|
244 | 244 |
| byte one
|
245 | 245 |
| byte table[256] many
|
|
293 | 293 |
| }
|
294 | 294 |
= ok
|
295 | 295 |
|
296 | |
Reading from a table, you must use an index, and vice-versa.
|
|
296 |
The index must be initialized.
|
|
297 |
|
|
298 |
| byte one
|
|
299 |
| byte table[256] many
|
|
300 |
|
|
|
301 |
| routine main
|
|
302 |
| outputs many
|
|
303 |
| trashes a, x, n, z
|
|
304 |
| {
|
|
305 |
| ld a, 0
|
|
306 |
| st a, many + x
|
|
307 |
| }
|
|
308 |
? UnmeaningfulReadError: x
|
|
309 |
|
|
310 |
Reading from a table, you must use an index.
|
297 | 311 |
|
298 | 312 |
| byte one
|
299 | 313 |
|
|
|
344 | 358 |
| ld a, many + x
|
345 | 359 |
| }
|
346 | 360 |
= ok
|
|
361 |
|
|
362 |
| byte table[256] many
|
|
363 |
|
|
|
364 |
| routine main
|
|
365 |
| inputs many
|
|
366 |
| outputs many
|
|
367 |
| trashes a, x, n, z
|
|
368 |
| {
|
|
369 |
| ld x, 0
|
|
370 |
| ld a, many + x
|
|
371 |
| }
|
|
372 |
= ok
|
|
373 |
|
|
374 |
The index must be initialized.
|
|
375 |
|
|
376 |
| byte table[256] many
|
|
377 |
|
|
|
378 |
| routine main
|
|
379 |
| inputs many
|
|
380 |
| outputs many
|
|
381 |
| trashes a, x, n, z
|
|
382 |
| {
|
|
383 |
| ld a, many + x
|
|
384 |
| }
|
|
385 |
? UnmeaningfulReadError: x
|
347 | 386 |
|
348 | 387 |
Copying to and from a word table.
|
349 | 388 |
|