6502 BBC BASIC

From BeebWiki
Revision as of 00:32, 31 January 2016 by Jgharston (talk | contribs) ('Branch out of range' assembler error.)
Jump to: navigation, search


BASIC 1, 1981

This is the original version of BASIC fitted in early versions of the BBC Model A and B.

Bugs

  • ELSE leaves a byte on the hardware stack with ON ... GOTO
  • INSTR(a$, b$) when LENa$ < LENb$ leaves a$ on the software stack
  • EVAL() does not tokenise its parameter as a function, so EVAL("TIME") is tokenised as the command token
  • unary minus after ABS does not work correctly, -ABS1 gives the wrong result
  • LN can lose accuracy with very small numbers
  • Changing MODE does not reset COUNT to zero
  • DIM space X does not check for X being negative
  • Assembler gets confused by ASC":"
  • Assembler OPT b1=0 (OPT 0/1) does not suppress 'Branch out of range' if label is defined
  • SAVE expects a constant string, so A$+B$ confuses the interpreter
  •  ? and ! as formal parameters corrupt the stack
  • Binary version number is &00 instead of &01
  • LISTO reduces list indent after a loop closing keyword
  • RENUMBER interprets character &8D in strings and comments as a line number marker
  • If a FN is used in a FOR command, the software stack is corrupted
  • RESTORE <line> where <line> has a comma but no DATA command treats that line as data

BASIC 2, 1982

This is the standard pre-Master version of BASIC, supplied with the BBC model B and B+.

Bugfixes

  • ELSE no longer leaves a byte on the hardware stack with ON ... GOTO
  • INSTR(a$, b$) no longer leaves a string on the software stack
  • EVAL() correctly tokenises its parameter
  • unary minus after ABS works correctly
  • LN of very small numbers works
  • Changing MODE resets COUNT to zero

Additions

  • OSCLI added
  • OPENIN added to open a file for input
  • OPENUP replaces pevious OPENIN token to open a file for update
  • SIN, COS, LN and LOG recoded for accuracy
  • @% defaults to &A0A for 10 figures of precision
  • INPUT "prompt";var accepted
  • Fatal errors introduced. If ERR is zero, ON ERROR is ignored and program returns to command prompt.
  • New error "Missing #" (ERR=45) for file I/O keywords
  • DIM space X gives an error if X<-1
  • Assembler handles ASC":" correctly
  • Assembler does offset assembly to O% with OPT 4+n
  • Assembler contains pseudo-ops EQUB, EQUW, EQUD and EQUS
  • String garbage collection if new string is at end of heap

Bugs

  • SAVE expects a constant string, so A$+B$ confuses the interpreter
  •  ? and ! as formal parameters corrupt the stack
  • Binary version number is &01 instead of &02
  • LISTO reduces list indent after a loop closing keyword
  • RENUMBER interprets character &8D in strings and comments as a line number marker
  • If a FN is used in a FOR command, the software stack is corrupted
  • RESTORE <line> where <line> has a comma but no DATA command treats that line as data
  • Assembler OPT b1=0 (OPT 0/1) does not suppress 'Branch out of range' if label is defined

BASIC 3, HIBASIC 3, 1983

As HIBASIC, supplied with the 6502 Second Processor.

Bugfixes

  • SAVE A$+B$ works
  •  ? and ! as formal parameters works
  • Binary version number now agrees with BASIC version

Additions

  • Tokeniser accepts COLOR as well as COLOUR
  • Random number generator recoded for speed

Bugs

  • LISTO reduces list indent after a loop closing keyword
  • RENUMBER interprets character &8D in strings and comments as a line number marker
  • If a FN is used in a FOR command, the software stack is corrupted
  • RESTORE <line> where <line> has a comma but no DATA command treats that line as data

BASIC 4, HIBASIC 4, 1984

Supplied with the BBC Master 128 in the MOS 3.20 system ROM.

Bugfixes

  • LISTO reduces list indent with the closing keyword instead of after the closing keyword
  • RENUMBER no longer confused by character &8D in strings and comments
  • Generalised recusion allowed within FOR loops
  • RESTORE <line> where <line> has a comma but no DATA command restores to the following line
  • Assembler OPT b1=0 (OPT 0/1/4/5) suppresses 'Branch out of range' if label is defined

Additions

  • *BASIC @ will tokenise program stored in memory
  • Trailing spaces are stripped from BASIC lines on input
  • Leading spaces on BASIC lines are ignored when LISTing with LISTO option non-zero
  • LIST IF implemented
  • LIST recognises quotes in REMs, so quoted embedded top-bit-set characters as not listed as tokens
  • EXT#handle=value implemented, calling OSARGS 3
  • TIME$ implemented, calling OSWORD 14 and OSWORD 15
  • AUTO no longer prints a space after the line number
  • EDIT command implemented, which calls *EDIT command
  • VDU list may be terminated with | to emit 9 zeros
  • Random number rewritten for RND(1) and RND(>1)
  • ON ... PROC implemented
  • Some formatting of assembler listing provided
  • Assembler includes new 65C02/65C12 opcodes
  • Assembler mnemonics that may take A as a parameter
  • Assembler accepts A, X, Y registers in lower case
  • Assembler accepts EQUB, EQUW, EQUD, EQUS in lower case
  • Assembler Mnemonic 'STZ' added as an alternative to 'CLR'

BASIC 4 128K, 1984

BASIC 128 is BASIC 4 running in main RAM using up to four banks of sideways RAM for program and data space and shadow screen memory for display.

BASIC 40, 1986

Supplied in the Master Compact in the MOS 5.00 system ROM.

Bugs

  • MOD fails

BASIC 41, 1986

Bugfixes

  • Bug in MOD fixed

BASIC 4.30, HIBASIC 4.30

Additions

  • Has a service entry to handle *BASIC and *HIBASIC commands.

BASIC 4.32, HIBASIC 4.32

Supplied in the Master 128 MOS 3.50 system ROM.

Bugfixes

Additions

Need to confirm and rationalise the following

  • Updated Trigonomentry routines
  • Automatically tokenising an ASCII program via use of *BASIC @ where is the address of the ASCII program
  • Updated: Conversion of Integer to Floating-Point
    • Small optimisations to increase speed
    • The normalisation routine no longer tests for zero; therefore, the zero test had to be added to this routine
    • The Floating-Point exponent Overflow byte (&2F) is no longer zeroed (as the normalisation routine now does this) except when the normalisation routine is not used (i.e. when the Integer value is a 1-byte value)
  • Updated: Normalisation of Floating-Point Numbers
    • The exponent overflow byte (&2F) is now zeroed on exit
    • Optimised: Removed test for Floating-Point value = zero, as the zero test only needs to be done in certain cases, and the routines that require the zero test will now carry out the test themselves
    • Optimised for speed
  • Updated: Convert Floating-Point to Integer routine
    • This routine has been completely rewritten in BASIC4r32 - however, it still follows the same logic as the previous version. The re-write has speeded up the routine execution time.
  • Comparision operators now internally use the Accumulator (A) to store equality, rather than the Y register (as in BASIC 4).
  • Changes to '+' (plus) operator: Prioritise Floating-Point addition (test Float values prior to testing for String values (BASIC 4 prioritised Strings)).
  • Changes to '-' (minus) operator
    • Prioritise Floating-Point subtraction (test Float values prior to testing for String values (BASIC 4 prioritised Strings) - there was no need to prioritise strings, as string subtraction produces 'Type Mismatch' error).
    • Optimised handling of mismatched values (Floating-Point and Integer)
    • Optimised: Use Floating-Point Addition routine, where the second Float value has been complemented instead of the Floating-Point subtraction routine.
  • Changes to '*' (multiply) operator
    • Prioritise Floating-Point multiplication (test Float values prior to testing for String values (BASIC 4 prioritised Strings) - there was no need to prioritise strings, as string multiplication produces 'Type Mismatch' error).
    • Optimised handling of mismatched values (Floating-Point and Integer)

BASIC 5

Also known as Advanced BASIC. Runs on the 6502 Second Processor.


Additions

References

Master Operating System, Atherton