APF Imagination Machine BASIC tokenized file
Dan Tobias (Talk | contribs) (→Software) |
Dan Tobias (Talk | contribs) |
||
(One intermediate revision by one user not shown) | |||
Line 2: | Line 2: | ||
|subcat=Source code | |subcat=Source code | ||
|subcat2=Tokenized BASIC | |subcat2=Tokenized BASIC | ||
+ | |wikidata={{wikidata|Q28600209}} | ||
|released=1978 | |released=1978 | ||
}} | }} | ||
Line 150: | Line 151: | ||
* [http://tech.groups.yahoo.com/group/apf_consoles_and_computers/ Yahoo group devoted to APF] | * [http://tech.groups.yahoo.com/group/apf_consoles_and_computers/ Yahoo group devoted to APF] | ||
* [https://archive.org/details/APF_Imagination_Machine_1980_APF_Electronics 2-page brochure] | * [https://archive.org/details/APF_Imagination_Machine_1980_APF_Electronics 2-page brochure] | ||
+ | * [http://floppydays.libsyn.com/floppy-days-episode-22-the-apf-imagination-machine Floppy Days podcast episode 22: APF Imagination Machine] | ||
[[Category:APF]] | [[Category:APF]] |
Latest revision as of 21:51, 13 July 2019
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. The token meanings actually get printed out when you use BASIC commands such as PRINT CHR$(137), which causes "GOTO" to be shown (but not executed!).
BASIC lines are separated by the carriage return (hex 0D). The first two bytes contain 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 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.)
On disk, saved BASIC program files appear to be type "S", whatever that means. (The other file type is "I", which is what data files opened by a program are.)
Contents |
[edit] 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$ |
[edit] See also
- APF Imagination Machine data cassette
- APF Imagination Machine floppy disk
- APF Imagination Machine disk file system
[edit] Documentation
[edit] Software
- APF Imagination Machine emulator for Windows (Zipped download)
- APF gaming console cartridges (in-browser emulation)