From c896fcfda3680d2bd882a6954a6a3b31973575a7 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Thu, 15 Aug 2013 22:04:18 -0700 Subject: [PATCH] More styling --- index.htm | 1 + reference.htm | 120 +++++++++++++++++++++++++++++++++++++------------- 2 files changed, 90 insertions(+), 31 deletions(-) diff --git a/index.htm b/index.htm index 790f250..bee1403 100644 --- a/index.htm +++ b/index.htm @@ -1,6 +1,7 @@ Applesoft BASIC in JavaScript + diff --git a/reference.htm b/reference.htm index 1ab103b..0428f55 100644 --- a/reference.htm +++ b/reference.htm @@ -1,5 +1,6 @@ Applesoft BASIC Reference +

Applesoft BASIC Quick Reference

+

This is intended as a quick reference for the Applesoft BASIC in JavaScript by Joshua Bell.

@@ -33,13 +38,14 @@ This is intended as a quick reference for the Applesoft BASI
  • Beagle Bros. Peeks, Pokes & Pointers Chart (Colors, ASCII values, etc)
  • More Beagle Bros. Posters - including Apple Commands Chart, in PDF format +
  • - - +
    -

    Statements

    +

    Statements

    +

    Variable Control

    CLEAR
    Clear all variables @@ -47,6 +53,9 @@ This is intended as a quick reference for the Applesoft BASI
    DIM var( size [ , size2 ...] ) [ , var2( size [ , size2 ...] ) ... ]
    Allocate array
    DEF FN f(var ) = expr
    Define function of a single variable [1]
    +
    + +

    Flow Control

    GOTO
    Go to line number @@ -61,11 +70,17 @@ This is intended as a quick reference for the Applesoft BASI
    END
    Terminate program
    STOP
    Break, as if an error occurred
    +
    + +

    Error Handling

    ONERR GOTO line
    Set error hook
    RESUME
    Retry line that caused ONERR GOTO
    +
    + +

    Input/Output

    PRINT expr [ [;,] expr2 ... ] [;]
    Output text @@ -79,18 +94,27 @@ This is intended as a quick reference for the Applesoft BASI
    NORMAL
    Set output mode to white-on-black
    TEXT
    Set display to text mode
    +
    + +

    Miscellaneous

    REM [ comment ]
    Begin a comment; rest of line is skipped
    TRACE
    Turn on trace mode (line numbers printed)
    NOTRACE
    Turn off trace mode
    +
    + +

    Inline Data

    DATA value [, value2 ... ]
    Define inline data
    READ var [, var2 ... ]
    Read the next DATA value
    RESTORE
    Restore the DATA pointer to the first value
    +
    + +

    Lo-Res Graphics

    GR
    Set display to lores mode, clear screen @@ -99,6 +123,9 @@ This is intended as a quick reference for the Applesoft BASI
    HLIN expr, expr AT expr
    Plot horizontal line (x1, x2 at y)
    VLIN expr, expr AT expr
    Plot vertical line (y1, y2 at x)
    +
    + +

    Hi-Res Graphics

    HGR
    Set display to hires mode, clear screen @@ -106,6 +133,9 @@ This is intended as a quick reference for the Applesoft BASI
    HPLOT [TO] expr, expr [ TO expr, expr ] ...
    Plot hires point/line (x=0...279, y=0...191)
    HCOLOR= expr
    Set hires color (0...7)
    +
    + +

    Hi-Res Shape Tables - NOT IMPLEMENTED

    ROT= expr
    Set hires shape table rotation (0...63) @@ -113,6 +143,9 @@ This is intended as a quick reference for the Applesoft BASI
    DRAW expr [ AT expr, expr ]
    Draw hires shape table shape in color
    XDRAW expr [ AT expr, expr ]
    Draw hires shape table shape with XOR
    +
    + +

    Interpreter and Program State - NOT IMPLEMENTED

    CONT
    Continue from a STOP @@ -121,6 +154,9 @@ This is intended as a quick reference for the Applesoft BASI
    NEW
    Clear program and variables
    RUN [ expr ]
    Start program execution at line
    +
    + +

    Native Platform Interaction - NOT IMPLEMENTED

    HIMEM: expr
    Set upper address of variable memory @@ -128,6 +164,9 @@ This is intended as a quick reference for the Applesoft BASI
    LOMEM: expr
    Set lower address of variable memory
    WAIT expr, expr [, expr]
    Wait until memory location masked by second argument equals third argument (or zero)
    +
    + +

    Cassette Tape - NOT IMPLEMENTED

    LOAD
    Load program from cassette @@ -136,7 +175,10 @@ This is intended as a quick reference for the Applesoft BASI
    STORE
    Save variables to cassette
    SHLOAD
    Load hires shape table from cassette
    -

    Compatibility Shims

    +
    + +
    +

    Compatibility Shims

    SPEED= expr
    Set character output delay - has no effect
    POKE expr, expr
    Set memory location to value @@ -174,7 +216,10 @@ This is intended as a quick reference for the Applesoft BASI
    +
    +
    +

    Functions

    @@ -244,9 +289,11 @@ This is intended as a quick reference for the
    Applesoft BASI +
    +
    -

    Operators

    +

    Operators

    Comparison Operators

    @@ -276,7 +323,9 @@ This is intended as a quick reference for the
    Applesoft BASI
    +
    String Concatenation
    +
    +

    Error Codes

    @@ -302,11 +351,11 @@ This is intended as a quick reference for the
    Applesoft BASI
    254
    Re-enter
    255
    Break +
    - - +
    -

    DOS 3.3 / ProDOS Quick Reference

    +

    DOS 3.3 / ProDOS Quick Reference

    See also

    @@ -354,7 +403,9 @@ This is intended as a quick reference for the
    Applesoft BASI
    14
    Program too large - Not generated
    15
    Not direct command - Not generated +
    +

    Input and Output

    @@ -401,7 +452,7 @@ The page attempts to emulate the display of an Apple II system with

    -When printing characters, CHR$ functions as expected for values +When printing characters, CHR$() functions as expected for values from 32-126 (printable ASCII). Control characters have the typical Apple II meanings:

    @@ -439,11 +490,13 @@ If 80-column firmware is active, the following additional codes are available: The text window can be changed and cursor finely controlled with POKE 32,n ... POKE 37,n

    +
    +

    Process and Grammars

    -

    For the even geekier in the audience...

    +

    For the even geekier in the audience...

    Compilation is done by splitting the input into tokens which are then consumed by a recursive descent parser which outputs a JavaScript @@ -466,16 +519,16 @@ object representing the program.

    from the comma-delimited, optionally-quoted values in the source.

    -
      -
    • [x] zero or one occurences of x -
    • {x} zero or more occurences of x -
    • x | y one of either x or y -
    • (x) grouping construct -
    +
    +
    [x]
    zero or one occurences of x +
    {x}
    zero or more occurences of x +
    x|y
    one of either x or y +
    (x)
    grouping construct +

    Overall program parsing is done with a recursive descent parser.

    -
    +
         Program                  = Line { Line }
         Line                     = line-number Statement { separator Statement }
         Statement                = data-declaration | remark | Command | EmptyStatement
    @@ -487,21 +540,22 @@ Most statements compile into a function call to a library of Applesoft routines.
     with a standard recursive descent parser. The parser generates JavaScript expressions for each expression,
     which are used as arguments for the library calls.

    -
    +
         Expression               = OrExpression
    -    OrExpression             = AndExpression [ 'OR' AndExpression ... ]
    -    AndExpression            = RelationalExpression [ 'AND' RelationalExpression ... ]
    -    RelationalExpression     = AdditiveExpression [ ( '=' | '<' | '>' | '<=' | '=<' | '>=' | '=>' | '<>' | '><' ) AdditiveExpression ... ]
    -    AdditiveExpression       = MultiplicativeExpression [ ( '+' | '-' ) MultiplicativeExpression ... ]
    -    MultiplicativeExpression = PowerExpression [ ( '*' | '/' ) PowerExpression ... ]
    +    OrExpression             = AndExpression { 'OR' AndExpression  }
    +    AndExpression            = RelationalExpression { 'AND' RelationalExpression }
    +    RelationalExpression     = AdditiveExpression { RelOp AdditiveExpression }
    +    RelOp                    = '=' | '<' | '>' | '<=' | '=<' | '>=' | '=>' | '<>' | '><'
    +    AdditiveExpression       = MultiplicativeExpression { ( '+' | '-' ) MultiplicativeExpression }
    +    MultiplicativeExpression = PowerExpression { ( '*' | '/' ) PowerExpression }
         PowerExpression          = UnaryExpression [ '^' UnaryExpression ]
         UnaryExpression          = ( '+' | '-' | 'NOT' ) UnaryExpression
                                   | FinalExpression
         FinalExpression          = number-literal
                                   | string-literal
                                   | 'FN' user_function_name '(' Expression ')'
    -                              | reserved '(' Expression [, Expression ...] ')'
    -                              | identifier [ '(' Expression [, Expression ...] ')' ]
    +                              | reserved '(' Expression { ',' Expression } ')'
    +                              | identifier [ '(' Expression { ',' Expression } ')' ]
                                   | '(' Expression ')'
     
    @@ -509,9 +563,11 @@ which are used as arguments for the library calls.

    Since Applesoft supports re-entrant error handling and synchronous input, the output of the compiler is an array of statement-functions plus a driver function which implements the logic for walking over the array.

    +

    +
    -

    Extensions beyond Standard Applesoft

    +

    Extensions beyond Standard Applesoft

    • @@ -521,12 +577,14 @@ function which implements the logic for walking over the array.

    • [2] == is supported for equality comparisons, in addition to =
    • - [3] When printing characters, CHR$ values greater than 255 generate glyphs that might be useful for certain maze games. + [3] When printing characters, CHR$() values greater than 255 generate glyphs that might be useful for certain maze games.
    • - [4] HSCRN(x, y) is added to allow reading the - hires screen. On a real Apple this required a machine-language routine (or a shape table and XDRAW). + [4] HSCRN(x,y) is added to allow reading the + hires screen. On a real Apple this required a machine-language routine (or a shape table and XDRAW).
    +
    +