Warning: Unknown: Unable to allocate memory for pool. in Unknown on line 0

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/index.php on line 54

Warning: Cannot modify header information - headers already sent in /usr/local/www/mediawiki/includes/WebStart.php on line 63

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/WebStart.php on line 94

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/WebStart.php on line 97

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/WebStart.php on line 100

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/WebStart.php on line 103

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/Defines.php on line 187

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/WebStart.php on line 115

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/WebStart.php on line 134

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/LocalSettings.php on line 137

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/LocalSettings.php on line 139

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/LocalSettings.php on line 144

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/LocalSettings.php on line 145

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/LocalSettings.php on line 153

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/WebStart.php on line 150

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/WebStart.php on line 157

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/Setup.php on line 381

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/Setup.php on line 382

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/Setup.php on line 383

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/Setup.php on line 384

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/languages/Language.php on line 20

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: include_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/Skin.php on line 153

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/skins/Vector.deps.php on line 11

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/Skin.php on line 155

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: Cannot modify header information - headers already sent in /usr/local/www/mediawiki/includes/WebResponse.php on line 38

Warning: Cannot modify header information - headers already sent in /usr/local/www/mediawiki/includes/WebResponse.php on line 38

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: include(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/resourceloader/ResourceLoader.php on line 201

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require_once(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/json/FormatJson.php on line 12

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007
Applesoft BASIC tokenized file - Just Solve the File Format Problem

Applesoft BASIC tokenized file

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search

Warning: require(): Unable to allocate memory for pool. in /usr/local/www/mediawiki/includes/AutoLoader.php on line 1007
 
(13 intermediate revisions by one user not shown)
Line 3: Line 3:
 
|subcat2=Tokenized BASIC
 
|subcat2=Tokenized BASIC
 
|released=1977
 
|released=1977
 +
|wikidata={{wikidata|Q28600391}}
 
}}
 
}}
  
'''Applesoft BASIC''' was licensed from Microsoft (with some changes by Apple) and originally made available to be loaded from tape or disk. Apple models starting with the Apple II+ (the first new model after the Apple II) had Applesoft BASIC in ROM instead of the older [[Apple Integer BASIC tokenized file|Integer BASIC]]. An Applesoft I language was first released in 1977, followed by Applesoft II Floating Point BASIC in 1978, which is the most-used version. The later Apple III BASIC was based on Applesoft.
+
'''Applesoft BASIC''' was licensed from Microsoft (with some changes by Apple) and originally made available to be loaded from tape or disk. Apple models starting with the Apple II+ (the first new model after the Apple II) had Applesoft BASIC in ROM instead of the older [[Apple Integer BASIC tokenized file|Integer BASIC]]. An Applesoft I language was first released in 1977, followed by Applesoft II Floating Point BASIC in 1978, which is the most-used version. The later Apple III Business BASIC was based on Applesoft.
  
 
There were some notorious bugs in Applesoft, such as an implementation of '''ONERR GOTO''' which messed up the program stack, requiring some devious peeks, pokes, and calls to get around it. Unfortunately, the fact that the language was stored in ROM (except for users of really old Apples who loaded it from disk or tape) made it difficult to update with bug fixes (unlike today's software that pesters you to install new updates practically every time you start your computer), and they couldn't fix it in newer machines either, since that would break all the old programs that expected the bug. So Apple users were stuck with the bugs for the whole life of that platform.
 
There were some notorious bugs in Applesoft, such as an implementation of '''ONERR GOTO''' which messed up the program stack, requiring some devious peeks, pokes, and calls to get around it. Unfortunately, the fact that the language was stored in ROM (except for users of really old Apples who loaded it from disk or tape) made it difficult to update with bug fixes (unlike today's software that pesters you to install new updates practically every time you start your computer), and they couldn't fix it in newer machines either, since that would break all the old programs that expected the bug. So Apple users were stuck with the bugs for the whole life of that platform.
Line 13: Line 14:
 
Similar to a number of other BASIC tokenizations (but distinct from Integer BASIC tokenization), Applesoft programs preserved ASCII characters unchanged in the 7-bit range (bytes with high bit clear) and used the "high bit set" byte values (#128-#255) to store tokens. BASIC lines were separated by the null byte (00), and started with a two-byte address of the next program line in memory, then a two-byte [[Endianness|little-endian]] integer giving the line number, then the tokenized commands and literal characters of the program line.
 
Similar to a number of other BASIC tokenizations (but distinct from Integer BASIC tokenization), Applesoft programs preserved ASCII characters unchanged in the 7-bit range (bytes with high bit clear) and used the "high bit set" byte values (#128-#255) to store tokens. BASIC lines were separated by the null byte (00), and started with a two-byte address of the next program line in memory, then a two-byte [[Endianness|little-endian]] integer giving the line number, then the tokenized commands and literal characters of the program line.
  
The token list reveals what is probably the most obscure command in Applesoft BASIC (or maybe any BASIC at all), '''SHLOAD'''. Urban Dictionary [http://www.urbandictionary.com/define.php?term=shload defines] this as a synonym for "shitload", but Applesoft uses it as a command to load a shape table from cassette. Yes, cassette... to do the same from disk required [http://support.apple.com/kb/TA40711?viewlocale=en_US some messy PEEKs and POKEs]. Well, doing just about ''anything'' on an Apple II ended up requiring PEEKs and POKEs and CALLs... if you were a serious Apple programmer, you probably had some of those [http://beagle.applearchives.com/posters.htm Beagle Bros. charts] listing them.
+
The token list reveals what is probably the most obscure command in Applesoft BASIC (or maybe any BASIC at all), '''SHLOAD'''. Urban Dictionary [http://www.urbandictionary.com/define.php?term=shload defines] this as a synonym for "shitload", but Applesoft uses it as a command to load a shape table from cassette. Yes, cassette... to do the same from disk required [http://support.apple.com/kb/TA40711?viewlocale=en_US some messy PEEKs and POKEs]. Well, doing just about ''anything'' on an Apple II ended up requiring PEEKs and POKEs and CALLs... if you were a serious Apple programmer, you probably had some of those [https://beagle.applearchives.com/posters/ Beagle Bros. charts] listing them.
 +
 
 +
Microsoft released a compiler for Applesoft called TASC (The AppleSoft Compiler).
  
 
== Tokens ==
 
== Tokens ==
Line 284: Line 287:
 
* [http://www.callapple.org/tag/applesoft-tokens/ Description of tokenization and program/data memory usage]
 
* [http://www.callapple.org/tag/applesoft-tokens/ Description of tokenization and program/data memory usage]
 
* [http://mirrors.apple2.org.za/apple.cabi.net/Languages.Programming/BASIC.keywords.tokens.txt List of tokens]
 
* [http://mirrors.apple2.org.za/apple.cabi.net/Languages.Programming/BASIC.keywords.tokens.txt List of tokens]
 +
* [http://archive.org/details/DTCA2DOC-045_applesoft_internal Applesoft BASIC Internal Structure]
 +
 +
== Manuals ==
 +
* [https://archive.org/details/Apple_II_Extended_Precision_Floating_Point_BASIC_Language_Reference_Manual 1977 Applesoft manual]
 +
* [https://archive.org/details/Applesoft_Reference_Manual_1978-_bluebook 1978 Applesoft II "blue book" manual]
 +
* [https://archive.org/details/Applesoft_BASIC_Programming_Reference_Manual_Apple_Computer 1978 Applesoft II green-covered manual]
 +
* [https://archive.org/details/TASC_The_AppleSoft_Compiler_Manual TASC (The Applesoft Compiler) manual]
 +
* [https://archive.org/details/Apple_III_Business_BASIC_Reference_Manual_Volume_1 Apple III Business BASIC Manual Volume 1]
 +
* [https://archive.org/details/Apple_III_Business_BASIC_Reference_Manual_Volume_2 Apple III Business BASIC Manual Volume 2]
  
 
== Tools ==
 
== Tools ==
 
* [http://www.a2-web.com/a2emul.html Links to Applesoft emulators]
 
* [http://www.a2-web.com/a2emul.html Links to Applesoft emulators]
 +
* [http://jsmess.textfiles.com/messloader.html?module=apple2 JSMESS in-browser Apple II emulator]
 +
* [http://jsmess.textfiles.com/messloader.html?module=apple2e JSMESS in-browser Apple IIe emulator]
 +
* [http://jsmess.textfiles.com/messloader.html?module=apple2c JSMESS in-browser Apple IIc emulator]
 +
* [http://www.calormen.com/jsbasic/ Applesoft BASIC emulator in JavaScript]
 +
 +
== Other links ==
 +
* [http://www.txbobsc.com/scsc/scdocumentor/ Documented disassembled code from Applesoft ROMs]
 +
* [http://www.pagetable.com/?p=774 1978 source to Microsoft 6502 BASIC] (ancestral to Applesoft; token list embedded is not quite the same)
 +
  
 
[[Category:Apple II series]]
 
[[Category:Apple II series]]
 
[[Category:Microsoft]]
 
[[Category:Microsoft]]

Latest revision as of 16:21, 9 September 2024

File Format
Name Applesoft BASIC tokenized file
Ontology
Wikidata ID Q28600391
Released 1977

Applesoft BASIC was licensed from Microsoft (with some changes by Apple) and originally made available to be loaded from tape or disk. Apple models starting with the Apple II+ (the first new model after the Apple II) had Applesoft BASIC in ROM instead of the older Integer BASIC. An Applesoft I language was first released in 1977, followed by Applesoft II Floating Point BASIC in 1978, which is the most-used version. The later Apple III Business BASIC was based on Applesoft.

There were some notorious bugs in Applesoft, such as an implementation of ONERR GOTO which messed up the program stack, requiring some devious peeks, pokes, and calls to get around it. Unfortunately, the fact that the language was stored in ROM (except for users of really old Apples who loaded it from disk or tape) made it difficult to update with bug fixes (unlike today's software that pesters you to install new updates practically every time you start your computer), and they couldn't fix it in newer machines either, since that would break all the old programs that expected the bug. So Apple users were stuck with the bugs for the whole life of that platform.

Applesoft BASIC programs were stored in a tokenized format, in files which were designated in Apple DOS directories as type "A".

Similar to a number of other BASIC tokenizations (but distinct from Integer BASIC tokenization), Applesoft programs preserved ASCII characters unchanged in the 7-bit range (bytes with high bit clear) and used the "high bit set" byte values (#128-#255) to store tokens. BASIC lines were separated by the null byte (00), and started with a two-byte address of the next program line in memory, then a two-byte little-endian integer giving the line number, then the tokenized commands and literal characters of the program line.

The token list reveals what is probably the most obscure command in Applesoft BASIC (or maybe any BASIC at all), SHLOAD. Urban Dictionary defines this as a synonym for "shitload", but Applesoft uses it as a command to load a shape table from cassette. Yes, cassette... to do the same from disk required some messy PEEKs and POKEs. Well, doing just about anything on an Apple II ended up requiring PEEKs and POKEs and CALLs... if you were a serious Apple programmer, you probably had some of those Beagle Bros. charts listing them.

Microsoft released a compiler for Applesoft called TASC (The AppleSoft Compiler).

Contents

[edit] Tokens

Blank values indicate either that the token is unused or is used for something unknown.

Hex Dec Token meaning
80 128 END
81 129 FOR
82 130 NEXT
83 131 DATA
84 132 INPUT
85 133 DEL
86 134 DIM
87 135 READ
88 136 GR
89 137 TEXT
8A 138 PR #
8B 139 IN #
8C 140 CALL
8D 141 PLOT
8E 142 HLIN
8F 143 VLIN
90 144 HGR2
91 145 HGR
92 146 HCOLOR=
93 147 HPLOT
94 148 DRAW
95 149 XDRAW
96 150 HTAB
97 151 HOME
98 152 ROT=
99 153 SCALE=
9A 154 SHLOAD
9B 155 TRACE
9C 156 NOTRACE
9D 157 NORMAL
9E 158 INVERSE
9F 159 FLASH
A0 160 COLOR=
A1 161 POP
A2 162 VTAB
A3 163 HIMEM:
A4 164 LOMEM:
A5 165 ONERR
A6 166 RESUME
A7 167 RECALL
A8 168 STORE
A9 169 SPEED=
AA 170 LET
AB 171 GOTO
AC 172 RUN
AD 173 IF
AE 174 RESTORE
AF 175 &
B0 176 GOSUB
B1 177 RETURN
B2 178 REM
B3 179 STOP
B4 180 ON
B5 181 WAIT
B6 182 LOAD
B7 183 SAVE
B8 184 DEF FN
B9 185 POKE
BA 186 PRINT
BB 187 CONT
BC 188 LIST
BD 189 CLEAR
BE 190 GET
BF 191 NEW
C0 192 TAB
C1 193 TO
C2 194 FN
C3 195 SPC(
C4 196 THEN
C5 197 AT
C6 198 NOT
C7 199 STEP
C8 200 +
C9 201 -
CA 202 *
CB 203 /
CC 204 ;
CD 205 AND
CE 206 OR
CF 207 >
D0 208 =
D1 209 <
D2 210 SGN
D3 211 INT
D4 212 ABS
D5 213 USR
D6 214 FRE
D7 215 SCRN (
D8 216 PDL
D9 217 POS
DA 218 SQR
DB 219 RND
DC 220 LOG
DD 221 EXP
DE 222 COS
DF 223 SIN
E0 224 TAN
E1 225 ATN
E2 226 PEEK
E3 227 LEN
E4 228 STR$
E5 229 VAL
E6 230 ASC
E7 231 CHR$
E8 232 LEFT$
E9 233 RIGHT$
EA 234 MID$
EB 235
EC 236
ED 237
EE 238
EF 239
E0 240
F1 241
F2 242
F3 243
F4 244
F5 245
F6 246
F7 247
F8 248
F9 249
FA 250
FB 251
FC 252
FD 253
FE 254
FF 255

[edit] Format documentation

[edit] Manuals

[edit] Tools

[edit] Other links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox

Warning: Cannot modify header information - headers already sent in /usr/local/www/mediawiki/includes/WebResponse.php on line 38

Warning: Cannot modify header information - headers already sent in /usr/local/www/mediawiki/includes/WebResponse.php on line 38

Warning: Cannot modify header information - headers already sent in /usr/local/www/mediawiki/includes/WebResponse.php on line 38