git @ Cat's Eye Technologies SixtyPical / 0e9a887
Update the spec re what literal integers in the code mean. Chris Pressey 4 years ago
1 changed file(s) with 18 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
1313 Types
1414 -----
1515
16 There are seven *types* in SixtyPical:
16 There are five *primitive types* in SixtyPical:
1717
1818 * bit (2 possible values)
1919 * byte (256 possible values)
20 * byte table (256 entries, each holding a byte)
2120 * word (65536 possible values)
22 * word table (256 entries, each holding a word)
2321 * routine (code stored somewhere in memory, read-only)
2422 * vector (address of a routine)
23
24 There is also one *type constructor*:
25
26 * X table (256 entries, each holding a value of type X)
27
28 This constructor can only be applied to bytes or words.
2529
2630 Memory locations
2731 ----------------
110114 trashes y
111115 @ $c000
112116
113 > TODO: need to confirm this, but, the rule is:
114 >
115 > * If it is NAMED, it is a memory address.
116 > * If it is a LITERAL INTEGER, it is an immediate value.
117 >
118 > However, this really needs a review, deep in the code, for how this is implemented.
117 Note that in the code of a routine, if a memory location is named by a
118 user-defined symbol, it is an address in memory, and can be read and written.
119 But if it is named by a literal integer, either decimal or hexadecimal, it
120 is a constant and can only be read (and when read always yields that constant
121 value. So, for instance, to read the value at `screen` above, in the code,
122 you would need to reference the symbol `screen`; attempting to read 1024
123 would not work.
124
125 This is actually useful, at least at this point, as you can rely on the fact
126 that literal integers in the code are always immediate values. (But this
127 may change at some point.)
119128
120129 Routines
121130 --------