[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applesoft BASIC Frequently Asked Questions (FAQ)



Nathan Mates wrote:
> 
> Archive-name: apple2/applesoft
> Posting-Frequency: monthly
> Last-modified: August 30 1997
> Version: 0.26
> URL: http://www.visi.com/~nathan/a2/faq/asoft.html
> 
>                             The Applesoft BASIC FAQ
> 
>   NOTE: this FAQ is in beta form, and is still being written. Expect a few
>   minor continuing changes in its layout, content, and correctness. Most info
>   should be correct-- I'd like to be notified of any problems noted in the FAQ.
> 
>    This document attempts to give a detailed and correct set of answers
>    about Applesoft BASIC, an interpreted programming language for the
>    Apple II series of computers. It is also intended as a reference for
>    commands and the like; it may at once time in the future include
>    tutorials, but does not do so now.
> 
>    DOS 3.3 and ProDOS command line commands are not included in this FAQ;
>    they have a FAQ of their own at
>    http://www.visi.com/~nathan/a2/faq/dos.html. I do cover some disk I/O
>    from within Applesoft programs, however, in this FAQ.
> 
>    Copyright (c) 1997 by Nathan Mates (email: nathan@visi.com), all
>    rights reserved. This document can be freely copied so long as 1) it
>    is not sold, 2) any sections reposted elsewhere from it are credited
>    back to this FAQ with the FAQ's copyright info and official WWW
>    location (http://www.visi.com/~nathan/a2/faq/asoft.html) left in
>    place.
> 
>    This FAQ may not be sold, bundled on disks or CD-ROMs, reprinted in
>    magazines, books, periodicals, or the like without prior consent from
>    the maintainer, Nathan Mates. Exceptions are explicitly granted for
>    Joe Kohn's Shareware Solutions II newsletter, and Jim Maricondo's
>    Golden Orchard CD-ROM collection. Email me for permission otherwise.
> 
>    Further, please do NOT make a copy of this FAQ and post it on the web;
>    I'm continually updating and fixing sections of it. A html link is
>    fine.
> 
>    Disclaimer: I've tried to make this FAQ as accurate as possible, but
>    there's the chance that it's not perfect. I apologize in advance for
>    any slipups. Until I am confident that all information is 100%
>    accurate, you are advised that you are following all info at your own
>    risk. I will fix any problems found with this FAQ, but will not be
>    held liable for the results of problems.
> 
>    Last-modified: August 30 1997
>    Version: 0.26
> 
> Table of Contents
> 
>    Section 1: General Intro to this FAQ and Applesoft Environment
>           1.1 Statement of purpose
>           1.2 Conventions and the like used by this FAQ
>           1.3 Determining which OS is running
>           1.4 Immediate mode vs. Deferred execution
>           1.5 Entering and running programs
> 
>    Section 2: General language reference
>           2.1 Numeric Expressions and Assignments
>           2.2 String Expressions and Assignments
>           2.3 Flow of control
>           2.4 Variable names & conventions
>           2.5 Memory Management/Use
> 
>    Section 3: Input/Output to Text and Graphics screens
>           3.1 'PRINT' and text formatting
>           3.2 Mousetext and special text output
>           3.3 Text input from the keyboard
>           3.4 Low Resolution (Lores) Graphics
>           3.5 High Resolution (Hires) Graphics
>           3.6 Hires 'Shapes' [Not done yet]
>           3.7 Double High Resolution (Double Hires) Graphics
> 
>    Section 4: Miscellaneous tasks
>           4.1 Sound Generation
>           4.2 Reading paddles/joysticks
>           4.3 Program comments
>           4.4 Internal data storage
>           4.5 Error Handling
>           4.6 Random numbers
> 
>    Section 5: Disk Input/Output
>           5.1 General Intro and simple commands
>           5.2 Binary files
>           5.3 Text File I/O
> 
>    Section 6: Applesoft command reference by name
>           ABS, AND, ASC, AT, ATN, CALL, CHR$, CLEAR, COLOR=, CONT, COS,
>           DATA, DEF, DEL, DIM, DRAW, END, EXP, FLASH, FN, FOR, FRE, GET,
>           GOSUB, GOTO, GR, HCOLOR=, HGR, HGR2, HIMEM:, HLIN, HOME, HPLOT,
>           HTAB, IF, IN#, INPUT, INT, INVERSE, LEFT$, LEN, LET, LIST,
>           LOAD, LOG, LOMEM:, MID$, NEW, NEXT, NORMAL, NOT, NOTRACE, ON,
>           ONERR, OR, PDL, PEEK, PLOT, POKE, POP, POS, PRINT, PR#, READ,
>           RECALL, REM, RESTORE, RESUME, RETURN, RIGHT$, RND, ROT=, RUN,
>           SAVE, SCALE=, SCRN, SGN, SHLOAD, SIN, SPC, SPEED=, SQR, STEP,
>           STOP, STORE, STR$, TAB, TAN, TEXT, THEN, TO, TRACE, USR, VAL,
>           VLIN, VTAB, WAIT, XDRAW, &
> 
>    Error codes and messages
>           7.1 Applesoft Error codes
>           7.2 DOS 3.3 Error codes
>           7.3 ProDOS Error codes
> 
>      _________________________________________________________________
> 
>    Sections planned to add to this FAQ:
> 
>    Error code
>    Fun tricks: Loading at alternate addresses, optimizing for size/speed
>    Peeks, Pokes, Calls, ROM, memory reference [I don't trust any out
>    there to be correct, given the number of holes that have been poked in
>    existing ones]
> 
>      _________________________________________________________________
> 
> Section 1: General Intro to this FAQ and Applesoft Environment
> 
>   1.1: Statement of Purpose
> 
>    This document is not (yet?) a tutorial, instructions on how to
>    program, or the like. It is assumed that the reader has at least a
>    basic introduction to programming, such as variables, flow of
>    execution, as well as a general understanding of either DOS 3.3 or
>    ProDOS for the Apple II.
> 
>    With the proliferation of Applesoft BASIC addons in the 70s, 80s and
>    90s, this FAQ does not attempt to cover any of them, though it may
>    make reference to a few of them from time to time. The only "variants"
>    to Applesoft that will be commented on in this FAQ are (1) the version
>    built into the ROM of all Apples since the ][+, (2) the ROM version
>    running under DOS 3.3 and 100% compatible clones, (3) the ROM version
>    running in conjunction with ProDOS's BASIC.SYSTEM. Most of the time,
>    these versions are nearly identical, so Applesoft information should
>    be regarded as applying to all 3 unless otherwise specified.
> 
>    A few versions of Applesoft, namely the ones loaded from cassette and
>    disk on systems without Applesoft in ROM, lack a few features. Those
>    differences may be noted from time to time, but those notations may
>    not be complete yet.
> 
>    About the only change in the ROM versions of Applesoft was the
>    inclusion of lowercase support starting with the //c and then
>    spreading to the enhanced //e, GS and IIc+. With that, Applesoft could
>    be entered in lowercase, but everything except for strings which
>    remained untouched would be uppercased. Also, the //c, IIc+ and GS
>    have no cassette port, so the cassette functions were removed. Support
>    for double lo-res was added instead.
> 
>   1.2 Conventions and the like used by this FAQ:
> 
>    Applesoft commands and the like are shown in uppercase and usually
>    within single quotes ('). For example, 'PRINT "HELLO, WORLD"' is the
>    way for the computer to announce to the world that it's alive, and
>    also a simple test of Applesoft. All Applesoft keywords are noted in
>    uppercase, and should be a hypertext link to the fuller description in
>    this FAQ. Optional parts of commands are noted in brackets '[]'. Words
>    in lowercase are usually intended to represent variables, expressions,
>    line numbers, etc.
> 
>   1.3 Determining which OS is running, etc.
> 
>    First, make sure you are at the Applesoft ']' prompt. Type 'CATALOG'
>    (case sensitive, even if you're running on a //c, enhanced //e, GS or
>    the like) and hit return. If you got a '?SYNTAX ERROR' and a beep
>    despite typing it correctly, you're likely not running under any
>    operating system. If you get a disk listing of files, you're under DOS
>    3.x or ProDOS. A DOS 3.x (3.2, 3.2.1 and 3.3, though 3.3 is by far the
>    most common) catalog would tend to look like
> 
> DISK VOLUME 254
> 
> *A 003 HELLO
> *I 003 APPLESOFT
> *B 006 LOADER.OBJ0
> 
>    [Snip...]
> 
>    while a ProDOS would tend to look like (in 40-column mode, these would
>    be wrapped to two lines)
> 
>  BINSCII.TXT       TXT       12   20-AUG-96  20-AUG-96  3:14    5645
> 
>    Alternatively, you can type 'cat' (ProDOS is not case sensitive; also
>    this command does not exist in DOS 3.3 in any capitalization
>    sequence). If you get a disk catalog (and only 40 columns wide), this
>    is ProDOS. A '?SYNTAX ERROR' is a sign of DOS 3.3.
> 
>   1.4 Immediate mode vs. Deferred execution
> 
>    Most Applesoft statements can be typed at the ']' prompt, and they
>    will be executed immediately. You can set variables, do math, draw
>    graphics, and a fair number of other things directly. However, stuff
>    like inputting from the user, most text disk input/output and the like
>    can only be done from within a running program; an '?ILLEGAL DIRECT
>    ERROR' will be generated by commands not runnable from the prompt. If
>    you prepend a 'POKE 51,0' to a command, this will trick BASIC into
>    thinking your program is running and not complain about immediate
>    mode. DOS commands may be much harder to fool.
> 
>    Multiple commands can be entered on one line of immediate or deferred
>    mode by placing a colon (':') between them. For example, 'A=5: B=6'
>    sets the values of both variables. [Exception: the 'HIMEM: memaddr'
>    and 'LOMEM: memaddr' statements must have the colon as part of their
>    actual syntax]
> 
>   1.5 Entering and running programs
> 
>    From immediate mode, if a line starts with a line number, it goes into
>    the current program and is not immediately executed. Valid line
>    numbers are 0 through 63999; lines are always kept in sorted order. As
>    there are no such things as named subroutines or the like, choices for
>    line numbering are somewhat important. It is usually a good idea to
>    use a spacing of 5 or 10 between line numbers to make inserting code
>    later on much easier-- renumbering programs can be a headache. The DOS
>    3.3 System Master disk came with a renumber program on it ('RUN
>    RENUMBER' to install it and get some information on how to use it),
>    but unfortunately ProDOS's BASIC.SYSTEM doesn't have that
>    functionality, though the disk bundled with Apple's "BASIC Programming
>    with ProDOS" book has a similar program.
> 
>    If a line does not start with a line number, it is immediately
>    executed, should it be a command that can be run from the prompt.
>    [GOTO, GET, INPUT, and a few others won't work from the prompt.] Any
>    errors detected will be noted. However, errors (even syntactic) are
>    not caught within lines you enter into the current program-- they're
>    only caught at runtime.
> 
>    Due to the size of the input buffer, a single line of the program is
>    limited to 255 characters. [Applesoft will start beeping when you get
>    to 248 characters]. There are several strategies for getting around
>    this. (1) When typing a line, use '?' instead of 'PRINT'-- it'll be
>    expanded to the full 'PRINT' when parsed. (2) Use no unneeded spaces--
>    only type them if they're in the middle of a string (" ") or a DATA
>    statement. They are not needed to separate terms in mathematical
>    expressions, etc. (3) Split the line into several lines.
> 
>    When parsing lines without spaces, Applesoft looks for reserved words
>    first and separates them automatically, unless they're in the middle
>    of strings. For example, the following (nonsense) line of code
>    '10IFPRINT"HINPUT TETHEN"GOTOHLIN56=5' will appear as '10 IF PRINT
>    "HINPUT TETHEN" GOTO HLIN 56 = 5'
> 
>    The command 'NEW' clears out any Applesoft program in memory and
>    clears the contents of all variables; it is not easily undoable. 'RUN'
>    starts the current program after clearing the contents of all
>    variables, starting at the lowest numbered line, and continues until
>    'STOP', 'END', flow of execution reaches the end of the code, or an
>    unhandled error is encoutered. Altenatively, you can use 'RUN linenum'
>    to clear all variables and start the program at line #linenum. You can
>    also do 'POKE 51,0: GOTO n' to start a program at line n without
>    losing the contents of the current variables.
> 
>    To delete a single line of code, you can type simply the line number
>    and press return-- that 'replaces' it with an empty line.
> 
>    There is minimal text mode support for line editing. When you 'LIST' a
>    program, you can press the 'esc'[ape] key and then use the diamond of
>    I/J/K/M (capitalization not important on an enhanced //e, //c, IIc+
>    and GS; may be necessary on an unenhanced //e) or the arrow keys (//e,
>    //c, GS and IIc+ only) to move around the screen and the spacebar to
>    move out of the movement mode. [The ][+ also exits escape mode with
>    the right or left arrows.] Once out of movement mode, the right arrow
>    can be used to "type" whatever character the cursor is on. This is
>    very handy for fixing part of a line, inserting or deleting sections.
> 
>    When 'LIST'ing off a program, you'll notice that the default list has
>    quite a lot of padding on the right and left margins, which may make
>    it hard to "retype" a line without running afoul of the 255 character
>    limit. However, if you type a 'POKE 33,33' before 'LIST 'ing, (or you
>    can use 'POKE 33,72' if you're in 80-column mode), you'll signify to
>    Applesoft that you don't want the big margins, which'll help.
>    [Unenhanced //es must have an even screen width in 80-column mode;
>    'POKE 33,73' will work fine on an enhanced //e, //c, IIc+ and GS]
> 
>    The 'TEXT' command will restore the screen to the normal margins.
> 
>      _________________________________________________________________
> 
> Section 2: General language reference
> 
>   2.1 Numeric Expressions and Assignments:
> 
>    All variables can be set by '[LET] varb = expression'. The 'LET' is
>    totally optional, and is usually omitted as being redundant.
> 
>    For integer and floating point (real) math, normal arithmatic
>    precedence and operations are followed. Thus, 'A=5+2*3' will set A to
>    11, not 21, as that expression with (redundant) parentheses is
>    'A=5+(2*3)'. Exponentiation can be performed with the '^' operator
>    ('A=2^3' sets A to 8), but there is no remainder (modulus) operator
>    like in other languages.
> 
>    The '=' operator behaves as an assignment the first time it's
>    encountered in an assignment, and equality at all other times. Thus,
>    'A=B=C' sets A to 1 (true) if B is equal to C, 0 otherwise. This is
>    significantly different from a number of other languages. However, 'IF
>    A=B THEN x' does not set the value of A to B. The "not equals" test is
>    '<>' or '><'.
> 
>    Integers are automatically promoted to reals when needed. To do the
>    reverse, use 'varb=INT(expr)'. That converts the value to the highest
>    integer less than or equal to the expression. Integer values have a
>    fixed range of -32767 to 32767, so trying to convert from outside that
>    range will result in an error.
> 
>    Boolean operators are also available-- integers and reals are treated
>    as true or 1 if not zero, and false or 0 if zero. Thus, 'A%=5.0 AND 2'
>    is true. The only boolean operations available are 'NOT', 'AND' and
>    'OR'
> 
>    Bitwise operations are not directly supported, even on integers.
> 
>    Operators have the following precedence; things within the same
>    precedence level are evaluated left to right:
>      * Highest precedence: () [parentheses]
>      * ^ [exponentiation]
>      * - [unary minus]
>      * * [multiplication], / [division]
>      * + [addition], - [subtraction]
>      * = [equal], <> or >< [not equal], < [less than], > [greater than],
>        <= or =< [less than or equal], >= or => [greater than or equal]
>      * NOT [logical complement]
>      * AND [logical AND]
>      * Lowest precedence: OR [logical OR]
> 
>    Applesoft is somewhat concerned about variable types-- if you try and
>    directly assign a string to a number or vice versa, it'll stop and
>    complain. There are single-character conversions such as
>    'varb$=CHR$(varb2)' and 'varb=ASC(varb2$)'. Also, for string to number
>    coverstions, there is 'var$=STR$(expr)' (converts number to string
>    form) and 'val=VAL(expr$)' (converts first number found in string to
>    numeric value)
> 
>   2.2 String expressions and Assignments
> 
>    Strings have their own sets of operations-- the '+' operator acts to
>    concatenate strings, so 'A$=B$+C$' sets A$ to the full text of B$
>    followed immediately by the full text of C$, no spaces in between.
>    [Also assuming that the resulting size of A$ is under the limit of 255
>    characters per string, otherwise there'd be an error.] You can also
>    use '=', '<>' and the rest of the arithmatic comparisons on strings.
>    Note that string comparisons are case sensitive, and normal ASCII
>    order is used. The end of a string is considered to be less than any
>    character, in case of comparing strings of unequal length.
> 
>    The individual characters in a string are not immediately accessible,
>    but can be gotten without too much trouble. 'LEN(expr$)' is the length
>    in characters of a string (can be a single string or any expression of
>    string type); 'LEFT$(varb$,n)' returns the n leftmost characters in
>    the variable, if n is greater than the length of the string, it
>    returns the entire string. Similarly 'RIGHT$(varb$,n)' is the n
>    rightmost characters. 'MID$(varb$,start[,len])' starts 'start'
>    characters into the string, and returns the "len" characters after
>    that, or the rest of the string if len is not specified. If "start" is
>    greater than the length of the string, the null string is returned.
> 
>   2.3 Flow of control
> 
>    Applesoft programs when 'RUN' start at the lowst numbered program line
>    with no variables set and proceed sequentially through the program.
>    Variables' contents are retained after the program exits until the
>    program's code is changed. While Applesoft does not have while loops,
>    named subroutines or the like, you can do all of them with what
>    Applesoft does have to offer.
> 
>    The most basic flow of control statement is the 'IF x THEN y' clause.
>    Expression x is evaluated, and if true, then the rest of the line is
>    parsed. If x is false, then control skips to the next line of code. No
>    parentheses are needed around the x clause, but they don't really
>    hurt. There is no else clause in the language, but it is easy to get
>    around that-- put a GOTO at the end of the IF line to skip the next
>    line(s) of code, where the "else" clause is.
> 
>    'IF x THEN GOTO n' can also be written as 'IF x GOTO n' or 'IF x THEN
>    n', but this abbreviation can only be done for 'THEN GOTO', no other
>    statements.
> 
>    'GOTO n' transfers control to line n, if it exists. [And an error if
>    it doesn't.] 'GOSUB n' goes to a subroutine, and 'RETURN' goes back to
>    the site of the most recent GOSUB. GOSUBs can be nested up to about 12
>    or 16 deep, so recursion should be avoided if possible. The 'POP'
>    statement cancels the last return address, and continues on to the
>    next statement. [Essentially changing the last GOSUB to a GOTO.]
> 
>    GOSUBs should be balanced by RETURN or POP, as there is only a limited
>    amount of space to store return addresses. If you try and RETURN or
>    POP more times than you've GOSUB'd, you'll get an error.
> 
>    'FOR varb = start TO end [STEP increment]' sets up a loop. You can
>    only loop over reals; the increment defaults to 1 unless specified.
>    The loop stops when 'varb' is greater than 'end' if 'increment' is
>    positive, or less than 'end' if 'increment' is negative. The counter
>    variable 'increment' can be zero, in which case this is an infinite
>    loop. It is legal to modify the loop variable in the middle of a loop.
>    The contents of a FOR loop are always executed at least once, since it
>    only exits from the NEXT statement.
> 
>    In addition, the start, end and increment parameters are evaluated
>    only once, at the start of the loop, so any changes to them will not
>    be reflected.
> 
>    NEXT [varb][,varb2[,varb3]]' adds the step to the looping variable and
>    goes back to the top of the FOR..NEXT loop if it should continue. The
>    specification of the variable is optional-- if omitted, Applesoft will
>    use the innermost active loop to deal with. Crossing loops such as
>    'FOR I=1 TO 5: FOR J=1 TO 3: NEXT I: NEXT J' will cause errors, and
>    generally are a bad idea. However, if specified with the innermost
>    loop variable to the left separated by commas, it is doable: 'FOR I=1
>    TO 5: FOR J=1 TO 3: NEXT J,I'
> 
>    Loops should be terminated with a 'NEXT', not a GOTO, since there is a
>    limited amount of space for tracking active loops, and the loop is
>    still active. One recommended solution is to change the loop variable
>    to a terminal value, do the 'NEXT' and then do whatever you want.
> 
>    'END' will stop execution of the currently running program and cleanly
>    exit to the Applesoft prompt. Contents of variables are still set and
>    can be read. 'STOP' halts the currently running program with a
>    message; you can use 'CONT' from the prompt to attempt to restart
>    where you left off. In either case, a 'POKE 51,0: GOTO n' will attempt
>    to jump to a specified line in the code. [The 'POKE 51,0' tricks
>    Applesoft into thinking a program is running; INPUTs and other
>    deferred mode only commands won't work from the prompt without that.]
> 
>   2.4 Variable names & conventions
> 
>    All variables are identified by their first two characters and an
>    optional extension denoting the variable type. The first character
>    must be a letter, A-Z. The second can be blank (giving essentially a
>    single-letter variable name), A-Z, or 0-9. All continuing characters
>    ([A-Z0-9]) past the first two are ignored-- NA is the same as NAME.
>    The total variable name has a maximum of 238 characters. [Applesoft's
>    236 character per line limit will restrict what you could do with such
>    long names.]
> 
>    After the variable name, a character can be used to override the
>    default type of floating point [range of approx +/- 1.7*10^38 to
>    +/-2.29388*10^-39] variable. Use '$' to specify a string (255
>    characters maximum), or '%' for an integer (16 bits, with range -32767
>    to 32767). These three types are independent-- assigning to NM% will
>    not affect NM$ or NM. Also, all variables are assumed to be 0 (real
>    and integers) or an empty string if they are accessed before a value
>    is written to them.
> 
>    When you type in your program, keywords are parsed before your
>    variable names, so do not use a keyword at anywhere in the variable
>    name. 'FORMATION=5' parses as 'FOR M AT I ON =5' which won't work when
>    run.
> 
>    To extend these basic types, you can make arrays. To do this, do a
>    'DIM varname(size [, size [,size...]])' before using the array, where
>    size is an integer size greater than zero. Unlike C, DIM A(10) gives
>    you eleven places: A(0), A(1), A(2)... A(10). The values in each
>    position in the array can be set or read by giving the array variable
>    name, and the subscript in parentheses; this subscript can be
>    specified on the fly. For example 'DIM A(10): FOR X=1 TO 10: A(X)=X:
>    NEXT'. The subscript is converted to an integer value on accessing, as
>    the above example shows.
> 
>    The size does not need to be a constant in the code-- you can do
>    'A%=50: DIM B(A%)'. Arrays can be of integer, real, or string type.
>    The presence of an array does not affect the basic (nonarray)
>    variable: A(x) for all x is independent from A.
> 
>    If an array is referenced before being DIM'd, Applesoft assigns the
>    array a size of 11 (0-10), and it cannot be redimensioned.
> 
>    You can make multidimensional arrays by specifying them in the DIM; a
>    3x3x3 integer array can be created by doing 'DIM B%(2,2,2)'. Please
>    note the section on Applesoft's memory management, as trying to
>    allocate too much memory for an array can overflow Applesoft's pool of
>    at most 35K.
> 
>   2.5 Memory Management/Use:
> 
>    Applesoft BASIC is rather poor in its memory management, mostly at the
>    cost of backwards compatability-- a standard (no machine-language
>    assistance) program that runs on a //e will run on any other Apple II
>    with at least 64K. The downside is that no memory past the first 64K
>    is recognized or usable. The operating system and other reserved
>    blocks of memory (text screen, system globals, etc) leave only 35K
>    ($800-$9600) available for both your program and all variables. The
>    Hires graphics screens will use 8K each from that 35K; lores uses the
>    text screen at no memory penalty.
> 
>    Space is used for storing variable names and their contents in
>    memory-- an integer will use 2 bytes for the actual data, and 2-3 for
>    the name. Beyond the name overhead, array Integer variables use 2
>    bytes of memory each, reals 5.
> 
>    Strings are dynamically allocated, and use their length plus 1 in
>    bytes. If a lot of string manipulations are done, the space used by
>    the old versions of the strings are not recycled-- they remain in
>    memory. Thus, periodic garbage collections can be necessary. The FRE()
>    statement was built into Applesoft to both report on memory management
>    and perform garbage collection. 'FRE(x)' (parameter ignored, though 0
>    or 1 is customary) will report how much memory is free--
>    'AVAIL=FRE(1)' sets the result to a variable and does the garbage
>    collection. If the free memory is greater than 32K, it will be
>    returned as a number less than zero; add 65536 to that to get the real
>    number.
> 
>    This memory operation may take many seconds to perform, leaving a user
>    to wonder what is happening. If this happens, it may be to your
>    advantage to do more FRE(0)'s in your code, thus doing more (hopefully
>    smaller) compactions. Alternatively, under ProDOS's BASIC.SYSTEM,
>    'PRINT CHR$(4)"FRE"' is a much faster version. [There were several
>    addon machine language packages for faster FREs under DOS 3.3, but
>    that's outside of the scope of this FAQ.]
> 
>    To reserve off some space for your own purposes, you can use the
>    'HIMEM:' and 'LOMEM:' statements. The two define the top and bottom of
>    the memory pool Applesoft uses for variable storage. To read the
>    current value of lomem, use 'PEEK(106)*256+PEEK(105)', himem can be
>    read by 'PEEK (116)*256+PEEK(115)'. Normally, lomem is the top of your
>    basic program, and himem is the highest available address under the OS
>    and its buffers; you should not lower the lomem or raise the himem
>    unless you are darn sure what you're doing. Also, it's usually a good
>    plan to change the himem or lomem at the start of your program before
>    using any variables.
> 
>    ProDOS's BASIC.SYSTEM grabs space on the fly for things, so moving
>    HIMEM under ProDOS may be a risky job. In all cases, it must be a
>    multiple of 256 under ProDOS.
> 
>      _________________________________________________________________
> 
> Section 3: Input/Output to Text and Graphics screens
> 
>   3.1 The 'PRINT' command and text formatting
> 
>    PRINT (can be abbreviated as '?' when typing, but will be expanded
>    when LISTed) will print string constants ('PRINT "HELLO"'), numeric
>    constants and expressions ('PRINT 2+2'), strings ('PRINT NAME$'),
>    reals ('PRINT FOO'), or integers ('PRINT SP%'). It can also print
>    several of these at once if semicolons (';') or commas are between the
>    sections: 'PRINT "The Answer:"; 2+2'. Semicolons are not really needed
>    before the start of a string constant or after them-- 'PRINT
>    D$"CLOSE"' is perfectly legal.
> 
>    If a semicolon is present at the end of a PRINT statement, the
>    'default' of a concluding carriage return is surpressed. 'PRINT's are
>    not really buffered-- they appear as soon as ready, even if the
>    trailing carriage return is surpressed. If a PRINT exists by itself,
>    it will print a 'carriage return' and go to the left edge of the next
>    screen row, scrolling if necessary. The 'SPEED=n' command (x=0..255,
>    255 is default of no delay, 0 is rather glacial) can be used to insert
>    a pause after each and every character outputted.
> 
>    A comma present separating items jumps to the next 'tab' stop, which
>    are located 16 columns apart at columns 1, 17, 33, etc. The second tab
>    stop exists only if column 16 for that line is empty (i.e. filled with
>    spaces), and the third only if columns 24-32 are empty.
> 
>    For floating-point values, scientific notation is used for values with