1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2025-02-19 20:30:45 +00:00

Able to parse, but not yet able to analyze, other table accesses.

This commit is contained in:
Chris Pressey 2018-04-18 14:21:03 +01:00
parent e565234d28
commit 0c22944afc
3 changed files with 43 additions and 5 deletions

View File

@ -442,7 +442,7 @@ class Parser(object):
elif self.scanner.token in ("shl", "shr", "inc", "dec"):
opcode = self.scanner.token
self.scanner.scan()
dest = self.locexpr()
dest = self.indexed_locexpr()
return SingleOp(self.scanner.line_number, opcode=opcode, dest=dest, src=None)
elif self.scanner.token in ("nop",):
opcode = self.scanner.token

View File

@ -474,6 +474,31 @@ The index must be initialized.
| }
? UnmeaningfulReadError: x
There are other operations you can do on tables.
| byte table[256] many
|
| routine main
| inputs many
| outputs many
| trashes a, x, c, n, z
| {
| ld x, 0
| ld a, 0
| st off, c
| add a, many + x
| sub a, many + x
| cmp a, many + x
| and a, many + x
| or a, many + x
| xor a, many + x
| shl many + x
| shr many + x
| inc many + x
| dec many + x
| }
= ok
Copying to and from a word table.
| word one

View File

@ -173,13 +173,26 @@ User-defined memory addresses of different types.
| }
= ok
Tables of different types.
Tables of different types and some operations on them.
| byte table[256] tab
| word table[256] wtab
| vector (routine trashes a) table[256] vtab
| byte table[256] many
| word table[256] wmany
| vector (routine trashes a) table[256] vmany
|
| routine main {
| ld x, 0
| ld a, 0
| st off, c
| add a, many + x
| sub a, many + x
| cmp a, many + x
| and a, many + x
| or a, many + x
| xor a, many + x
| shl many + x
| shr many + x
| inc many + x
| dec many + x
| }
= ok