git @ Cat's Eye Technologies SixtyPical / 20c8247
Fix table access bug where index wasn't required to be initialized. Chris Pressey 3 years ago
3 changed file(s) with 44 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
77 * Initialized `byte table` values need not have all 256 bytes initialized.
88 * Constraints for `vector` type come immediately after the type, not the variable.
99 * `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.
1011
1112 0.10
1213 ----
237237 raise TypeMismatchError('%s and %s in %s' %
238238 (src.name, dest.name, self.current_routine.name)
239239 )
240 context.assert_meaningful(instr.index)
240241 elif src.type != dest.type:
241242 raise TypeMismatchError('%s and %s in %s' %
242243 (src.name, dest.name, self.current_routine.name)
249250 pass
250251 else:
251252 raise TypeMismatchError((src, dest))
253 context.assert_meaningful(instr.index)
252254 elif src.type != dest.type:
253255 raise TypeMismatchError('%s and %s in %s' %
254256 (src.name, dest.name, self.current_routine.name)
239239
240240 ### tables ###
241241
242 Storing to a table, you must use an index, and vice-versa.
242 Storing to a table, you must use an index.
243243
244244 | byte one
245245 | byte table[256] many
293293 | }
294294 = ok
295295
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.
297311
298312 | byte one
299313 |
344358 | ld a, many + x
345359 | }
346360 = 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
347386
348387 Copying to and from a word table.
349388