Applesoft BASIC: Difference between revisions

Content deleted Content added
While we're on the subject of Differences-of-Applesoft, its GET (command) was its version of INPUT$(n) (function)
Oops, punctuation mishap! :*)
Line 39:
 
== Trivia<ref>Applesoft II Basic Programming Reference Manual, Apple Computer, Inc., 1978</ref> ==
* Despite its heritage, Applesoft lacked commands common to non-6502 Microsoft BASIC interpreters, such as INSTR (which searched for a substring in a given string), PRINT USING (which formatted numbers with commas and currency signs according to a format string), and INKEY$ (which checked for a keypress without stopping the program as Applesoft's GET, analogous to the INPUT$ function, did}), although a PEEK ___location did provide this functionality. It seems likely that memory constraints were at the root of these differences, as the Apple II ROM had only 10 kilobytes available for the interpreter, and the improved hi-res graphics support was clearly a higher priority. Microsoft's CLS command (for clearing the screen) was renamed HOME in Applesoft.
* There was a well-documented bug in Applesoft BASIC that could actually crash the interpreter if ONERR GOTO was in effect and numerous program errors occurred. Apple provided a short assembly-language routine which could be POKEd into RAM and CALLed to ameliorate the problem to an extent. Later it was discovered by an enterprising hacker that the required code was actually in the Applesoft ROM (though it was never executed) and could be called there instead: CALL -3288 or (equivalent) 62248.<ref>[http://www.txbobsc.com/scsc/scdocumentor/ Disassembled ROM]</ref>
* Applesoft could be extended by two means: the ampersand (&amp;) command and the USR() function. These were two functions that called machine-language functions stored in memory. Routines that needed to be as fast or required direct access to arbitrary functions or data in memory could thus be called from a higher-level interpreted BASIC program. Additionally, these lower-level functions could read the data immediately following the "&" or "USR" command, allowing a BASIC program to pass parameters to the functions.