diff --git a/HISTORY.md b/HISTORY.md index 49a97e0..aa05e7e 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,10 +6,12 @@ History of SixtyPical * Each table has a specified size now (although, bounds checking is not performed.) * Initialized `byte table` values need not have all 256 bytes initialized. -* Constraints for `vector` type come immediately after the type, not the variable. -* `vector table` storage, and ability to copy vectors in and out of same. +* Syntax for types has changed. `routine` (with constraints) is a type, while + `vector` is now a type constructor (taking `routine`s only) and `table` is + also a type constructor. This permits a new `vector table` type. * Added `typedef`, allowing the user to define type aliases for readability. * Added `define name routine {...}` syntax; `routine name {...}` is now legacy. +* Ability to copy vectors and routines into vector tables, and vectors out of same. * Removed the evaluator. The reference implementation only analyzes and compiles. * Fixed bug where index register wasn't required to be initialized before table access. * Fixed bug where trampolines for indirect calls weren't including a final `RTS`. diff --git a/README.md b/README.md index e4b9906..021c5b9 100644 --- a/README.md +++ b/README.md @@ -39,12 +39,6 @@ Documentation TODO ---- -### Demo game - -Finish the little demo "game" where you can move a block around the screen with -the joystick (i.e. bring it up to par with the original demo game that was written -for SixtyPical) - ### `low` and `high` address operators To turn `word` type into `byte`. diff --git a/doc/SixtyPical.md b/doc/SixtyPical.md index 9a6b29b..88d26d5 100644 --- a/doc/SixtyPical.md +++ b/doc/SixtyPical.md @@ -15,20 +15,28 @@ the language. Types ----- -There are six *primitive types* in SixtyPical: +There are five *primitive types* in SixtyPical: * bit (2 possible values) * byte (256 possible values) * word (65536 possible values) * routine (code stored somewhere in memory, read-only) -* vector (address of a routine) * pointer (address of a byte in a buffer) -There are also two *type constructors*: +There are also three *type constructors*: -* T table (up to 256 entries, each holding a value of type T, where T is - either `byte` or `word`) +* T table[N] (N is a power of 2, 1 ≤ N ≤ 256; each entry holds a value + of type T, where T is `byte`, `word`, or `vector`) * buffer[N] (N entries; each entry is a byte; N is a power of 2, ≤ 64K) +* vector T (address of a value of type T; T must be a routine type) + +### User-defined ### + +A program may define its own types using the `typedef` feature. Typedefs +must occur before everything else in the program. A typedef takes a +type expression and an identifier which has not previously been used in +the program. It associates that identifer with that type. This is merely +a type alias; two types with different names will compare as equal. Memory locations ---------------- @@ -111,11 +119,11 @@ and `trashes` lists like a routine (see below), and it may only hold addresses of routines which are compatible. (Meaning, the routine's inputs (resp. outputs, trashes) must be a subset of the vector's inputs (resp. outputs, trashes.)) - vector actor_logic - inputs a, score - outputs x - trashes y - @ $c000 + vector routine + inputs a, score + outputs x + trashes y + actor_logic @ $c000 Note that in the code of a routine, if a memory location is named by a user-defined symbol, it is an address in memory, and can be read and written.