APF Imagination Machine BASIC tokenized file
Dan Tobias (Talk | contribs) |
Dan Tobias (Talk | contribs) (→Tokens) |
||
Line 17: | Line 17: | ||
== Tokens == | == Tokens == | ||
− | + | The manual shows both RND and LEN assigned to position 176 (decimal), apparently a misprint; some testing with an emulator shows that RND is actually 172, and LEN 176. | |
{| class="wikitable" | {| class="wikitable" |
Revision as of 14:51, 19 January 2013
The APF Imagination Machine was a late-1970s home computer platform. It was actually a game console with an add-on available to turn it into a full-fledged computer, with keyboard and tape drive. A floppy disk drive was also available. As with most computers of the time, it came with a version of the BASIC programming language built in.
APF BASIC programs are stored in a tokenized format. Byte values with the high bit set (#128-#255) are used to store tokens, with "high bit clear" values (#0-#127) used for literal ASCII characters.
BASIC lines are separated by the carriage return (hex 0D). The first two bytes containa the line number; unlike most other BASICs which use binary integers for this, APF BASIC uses packed BCD code, where each "nybble" (half-byte) stands for one decimal digit. (Basically, if you read the hexadecimal dump of the bytes, interpret it as a decimal number with 0-9 standing for those digits and A-F never used.) Then the tokenized commands and literal characters of the program line follow.
A program in memory is preceded by a two-byte address pointing at the first free memory location after the end of the program, stored as a big-endian unsigned integer, unlike the little-endian format used for addresses in most other personal computers.
As stored on cassette with the CSAVE command, a program will be preceded by a 512-byte block taken either from bytes 0-511 or 512-1023 of memory (depending on whether memory location 41452 was set to 255 or 0 respectively), which will be placed in screen memory when the cassette is loaded (allowing the display of a title screen or instructions while the program finishes loading). Then all used memory is saved, including the program and variable values. (However, the RUN command clears variables, so if you actually want to preserve the variables loaded from tape, you need to use the GOTO command to start running the program.)
Contents |
Tokens
The manual shows both RND and LEN assigned to position 176 (decimal), apparently a misprint; some testing with an emulator shows that RND is actually 172, and LEN 176.
Hex | Dec | Token meaning |
---|---|---|
80 | 128 | GOSUB |
81 | 129 | LET |
82 | 130 | DATA |
83 | 131 | INPUT |
84 | 132 | DIM |
85 | 133 | FOR |
86 | 134 | RETURN |
87 | 135 | THEN |
88 | 136 | ON |
89 | 137 | GOTO |
8A | 138 | TO |
8B | 139 | RESTORE |
8C | 140 | IF |
8D | 141 | STEP |
8E | 142 | STOP |
8F | 143 | READ |
90 | 144 | NEXT |
91 | 145 | |
92 | 146 | END |
93 | 147 | LIST |
94 | 148 | REM |
95 | 149 | USING |
96 | 150 | CSAVE |
97 | 151 | CLOAD |
98 | 152 | POKE |
99 | 153 | PLOT |
9A | 154 | HLIN |
9B | 155 | VLIN |
9C | 156 | COLOR |
9D | 157 | SHAPE |
9E | 158 | EDIT |
9F | 159 | SAVE |
A0 | 160 | INIT |
A1 | 161 | RUN |
A2 | 162 | OPEN |
A3 | 163 | CLOSE |
A4 | 164 | MUSIC |
A5 | 165 | CALL |
A6 | 166 | DIR |
A7 | 167 | TAB |
A8 | 168 | SPC |
A9 | 169 | INT |
AA | 170 | ABS |
AB | 171 | SGN |
AC | 172 | RND |
AD | 173 | PEEK |
AE | 174 | CHR$ |
AF | 175 | ASC |
B0 | 176 | LEN |
B1 | 177 | KEY$ |
See also
- APF Imagination Machine data cassette
- APF Imagination Machine floppy disk
- APF Imagination Machine disk file system