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

Spec and tests for initial values of locations.

This commit is contained in:
Chris Pressey 2016-06-16 11:02:13 -05:00
parent 2a86793246
commit 6cf8b5fe1e
3 changed files with 28 additions and 4 deletions

View File

@ -44,7 +44,8 @@ TODO
For 0.7: For 0.7:
* always analyze before executing or compiling, unless told not to * initialized `byte` memory locations
* initialized `byte table` memory locations
* `word` type. * `word` type.
* `word table` type. * `word table` type.
@ -53,8 +54,13 @@ For 0.8:
* zero-page memory locations. * zero-page memory locations.
* indirect addressing. * indirect addressing.
For 0.9
* save registers on stack or in memory (the preserves them = not trashed)
At some point... At some point...
* always analyze before executing or compiling, unless told not to
* `trash` instruction. * `trash` instruction.
* `interrupt` routines. * `interrupt` routines.
* 6502-mnemonic aliases (`sec`, `clc`) * 6502-mnemonic aliases (`sec`, `clc`)
@ -62,3 +68,5 @@ At some point...
* have `copy` instruction able to copy a constant to a user-def mem loc, etc. * have `copy` instruction able to copy a constant to a user-def mem loc, etc.
* add absolute addressing in shl/shr, absolute-indexed for add, sub, etc. * add absolute addressing in shl/shr, absolute-indexed for add, sub, etc.
* check and disallow recursion. * check and disallow recursion.
* automatic tail-call optimization (could be tricky, w/constraints?)
* re-order routines and optimize tail-calls to fallthroughs

View File

@ -1,7 +1,7 @@
SixtyPical SixtyPical
========== ==========
This document describes the SixtyPical programming language version 0.6, This document describes the SixtyPical programming language version 0.7-PRE,
both its execution aspect and its static analysis aspect (even though both its execution aspect and its static analysis aspect (even though
these are, technically speaking, separate concepts.) these are, technically speaking, separate concepts.)
@ -79,10 +79,16 @@ name.
byte pos byte pos
A location in memory may be given explicitly on a user-defined memory location. An address in memory may be given explicitly on a user-defined memory location.
byte table screen @ 1024 byte table screen @ 1024
Or, a user-defined memory location may be given an initial value. But in this
case, an explicit address in memory cannot be given.
byte pos = 0
byte table scores = [1, 3, 8, 17, 26, 100]
A user-defined vector memory location is decorated with READS and WRITES lists A user-defined vector memory location is decorated with READS and WRITES lists
like a routine (see below), and it may only hold addresses of routines which like a routine (see below), and it may only hold addresses of routines which
are compatible. (Meaning, the routine's inputs (resp. outputs, trashes) are compatible. (Meaning, the routine's inputs (resp. outputs, trashes)

View File

@ -123,7 +123,7 @@ Repeat with not
| } | }
= ok = ok
Extern memory locations Extern memory locations.
| byte screen @ 1024 | byte screen @ 1024
| |
@ -133,6 +133,16 @@ Extern memory locations
| } | }
= ok = ok
Initialized memory locations.
| byte lives = 3
|
| routine main {
| ld a, lives
| st a, lives
| }
= ok
Can't access an undeclared memory location. Can't access an undeclared memory location.
| routine main { | routine main {