14 | 14 |
Types
|
15 | 15 |
-----
|
16 | 16 |
|
17 | |
There are six *primitive types* in SixtyPical:
|
|
17 |
There are five *primitive types* in SixtyPical:
|
18 | 18 |
|
19 | 19 |
* bit (2 possible values)
|
20 | 20 |
* byte (256 possible values)
|
21 | 21 |
* word (65536 possible values)
|
22 | 22 |
* routine (code stored somewhere in memory, read-only)
|
23 | |
* vector (address of a routine)
|
24 | 23 |
* pointer (address of a byte in a buffer)
|
25 | 24 |
|
26 | |
There are also two *type constructors*:
|
27 | |
|
28 | |
* T table (up to 256 entries, each holding a value of type T, where T is
|
29 | |
either `byte` or `word`)
|
|
25 |
There are also three *type constructors*:
|
|
26 |
|
|
27 |
* T table[N] (N is a power of 2, 1 ≤ N ≤ 256; each entry holds a value
|
|
28 |
of type T, where T is `byte`, `word`, or `vector`)
|
30 | 29 |
* buffer[N] (N entries; each entry is a byte; N is a power of 2, ≤ 64K)
|
|
30 |
* vector T (address of a value of type T; T must be a routine type)
|
|
31 |
|
|
32 |
### User-defined ###
|
|
33 |
|
|
34 |
A program may define its own types using the `typedef` feature. Typedefs
|
|
35 |
must occur before everything else in the program. A typedef takes a
|
|
36 |
type expression and an identifier which has not previously been used in
|
|
37 |
the program. It associates that identifer with that type. This is merely
|
|
38 |
a type alias; two types with different names will compare as equal.
|
31 | 39 |
|
32 | 40 |
Memory locations
|
33 | 41 |
----------------
|
|
110 | 118 |
of routines which are compatible. (Meaning, the routine's inputs (resp. outputs,
|
111 | 119 |
trashes) must be a subset of the vector's inputs (resp. outputs, trashes.))
|
112 | 120 |
|
113 | |
vector actor_logic
|
114 | |
inputs a, score
|
115 | |
outputs x
|
116 | |
trashes y
|
117 | |
@ $c000
|
|
121 |
vector routine
|
|
122 |
inputs a, score
|
|
123 |
outputs x
|
|
124 |
trashes y
|
|
125 |
actor_logic @ $c000
|
118 | 126 |
|
119 | 127 |
Note that in the code of a routine, if a memory location is named by a
|
120 | 128 |
user-defined symbol, it is an address in memory, and can be read and written.
|