1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-11-22 01:32:13 +00:00

Re-enable disabled test and fix it and add a few related tests.

This commit is contained in:
Chris Pressey 2015-10-19 12:22:44 +01:00
parent 04de73d04d
commit a12a44eadb
4 changed files with 40 additions and 13 deletions

View File

@ -1,6 +1,11 @@
History of SixtyPical
=====================
0.6-PRE
-------
* Added `routine` and `vector` types, and `copy` instruction.
0.5
---

View File

@ -34,15 +34,16 @@ TODO
For 0.6:
* `interrupt` routines.
* `vector` type.
* `with sei` blocks.
* `copy` instruction.
* `goto` (tail call).
* `vector` type... with declared `inputs` `outputs` `trashes`?
* `copy` instruction... that can copy a constant to a user-def mem loc.
* A more involved demo for the C64 — one that sets up an interrupt.
For 0.7:
* `word` type.
* `trash` instruction.
* zero-page memory locations.
* indirect addressing.
At some point...

View File

@ -248,7 +248,10 @@ class Parser(object):
self.scanner.scan()
name = self.scanner.token
self.scanner.scan()
# TODO: check that is has been defined
if name not in self.symbols:
raise SyntaxError('Undefined routine "%s"' % name)
if self.symbols[name].model.type != TYPE_ROUTINE:
raise SyntaxError('Illegal call of non-routine "%s"' % name)
return Instr(opcode=opcode, name=name, dest=None, src=None)
elif self.scanner.token in ("copy",):
opcode = self.scanner.token

View File

@ -163,15 +163,33 @@ Can't shadow the name of a register or a flag.
| }
? SyntaxError
> Can't call routine that hasn;t been defined.
>
> | routine main {
> | ld x, 0
> | ld y, 1
> | call up
> | call up
> | }
> ? SyntaxError
Can't call routine that hasn't been defined.
| routine main {
| ld x, 0
| ld y, 1
| call up
| call up
| }
? SyntaxError
And you can't call a non-routine.
| byte up
|
| routine main {
| ld x, 0
| ld y, 1
| call up
| }
? SyntaxError
| routine main {
| ld x, 0
| ld y, 1
| call x
| }
? SyntaxError
Can't define two routines with the same name.