APF Imagination Machine BASIC tokenized file

From Just Solve the File Format Problem
Revision as of 13:51, 19 January 2013 by Dan Tobias (Talk | contribs)

Jump to: navigation, search
File Format
Name APF Imagination Machine BASIC tokenized file
Ontology
Released 1978

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 were stored in a tokenized format. Byte values with the high bit set (#128-#255) were used to store tokens, with "high bit clear" values (#0-#127) used for literal ASCII characters.

BASIC lines were separated by the carriage return (hex 0D). In memory and perhaps on tape, they started with a two-byte address of the next program line in memory (big-endian, unlike the little-endian format used for addresses in most other personal computers); this part was apparently skipped in the disk format. The next two bytes contained the line number; unlike most other BASICs which used binary integers for this, APF BASIC used packed BCD code, where each "nybble" (half-byte) stood 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 followed.

Contents

Tokens

Blank values indicate either that the token is unused or is used for something unknown. The manual shows both RND and LEN assigned to position 176 (decimal), apparently a misprint; 172 is skipped there, and is probably actually one of these.

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 PRINT
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 or LEN?
AD 173 PEEK
AE 174 CHR$
AF 175 ASC
B0 176 RND or LEN?
B1 177 KEY$

See also

Documentation

Software

Other links and references

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox