Able to parse, but not yet able to analyze, other table accesses.
Chris Pressey
5 years ago
441 | 441 |
elif self.scanner.token in ("shl", "shr", "inc", "dec"):
|
442 | 442 |
opcode = self.scanner.token
|
443 | 443 |
self.scanner.scan()
|
444 | |
dest = self.locexpr()
|
|
444 |
dest = self.indexed_locexpr()
|
445 | 445 |
return SingleOp(self.scanner.line_number, opcode=opcode, dest=dest, src=None)
|
446 | 446 |
elif self.scanner.token in ("nop",):
|
447 | 447 |
opcode = self.scanner.token
|
472 | 472 |
| ld a, many + x
|
473 | 473 |
| }
|
474 | 474 |
? UnmeaningfulReadError: x
|
|
475 |
|
|
476 |
There are other operations you can do on tables.
|
|
477 |
|
|
478 |
| byte table[256] many
|
|
479 |
|
|
|
480 |
| routine main
|
|
481 |
| inputs many
|
|
482 |
| outputs many
|
|
483 |
| trashes a, x, c, n, z
|
|
484 |
| {
|
|
485 |
| ld x, 0
|
|
486 |
| ld a, 0
|
|
487 |
| st off, c
|
|
488 |
| add a, many + x
|
|
489 |
| sub a, many + x
|
|
490 |
| cmp a, many + x
|
|
491 |
| and a, many + x
|
|
492 |
| or a, many + x
|
|
493 |
| xor a, many + x
|
|
494 |
| shl many + x
|
|
495 |
| shr many + x
|
|
496 |
| inc many + x
|
|
497 |
| dec many + x
|
|
498 |
| }
|
|
499 |
= ok
|
475 | 500 |
|
476 | 501 |
Copying to and from a word table.
|
477 | 502 |
|
172 | 172 |
| }
|
173 | 173 |
= ok
|
174 | 174 |
|
175 | |
Tables of different types.
|
176 | |
|
177 | |
| byte table[256] tab
|
178 | |
| word table[256] wtab
|
179 | |
| vector (routine trashes a) table[256] vtab
|
180 | |
|
|
181 | |
| routine main {
|
|
175 |
Tables of different types and some operations on them.
|
|
176 |
|
|
177 |
| byte table[256] many
|
|
178 |
| word table[256] wmany
|
|
179 |
| vector (routine trashes a) table[256] vmany
|
|
180 |
|
|
|
181 |
| routine main {
|
|
182 |
| ld x, 0
|
|
183 |
| ld a, 0
|
|
184 |
| st off, c
|
|
185 |
| add a, many + x
|
|
186 |
| sub a, many + x
|
|
187 |
| cmp a, many + x
|
|
188 |
| and a, many + x
|
|
189 |
| or a, many + x
|
|
190 |
| xor a, many + x
|
|
191 |
| shl many + x
|
|
192 |
| shr many + x
|
|
193 |
| inc many + x
|
|
194 |
| dec many + x
|
182 | 195 |
| }
|
183 | 196 |
= ok
|
184 | 197 |
|