8-Bit Software

The BBC and Master Computer Public Domain Library

Back to 8BS Or Back to Disassembly


BASIC ROM Routines
Page Last Altered:


MENU:   Introduction/News   Routines listed in
 Address order
  Routines listed
 by Category
  BASIC ROM documentation
 by Christopher Dewhurst
  BASIC4r32




BASIC IV Routines (Listed by Category)

BASIC Keywords:

Keywords that perform no function by themselves, as the keyword is activated by another
Keyword (they cause the rest of the program line to be skipped) : DATA, DEF

Keywords that have no function (they cause the program line to be skipped): REM

Keywords that only have meaning in relation with other Keywords: ERROR (ON), ELSE (IF), THEN (IF)

A   

ABS

ACS

ADVAL

AND

ASC

ASN

ATN

AUTO

 
B   

BGET

BPUT
 
C   

CALL

CHAIN

CHR$

CLEAR

CLG

CLS

CLOSE

COLOUR

COS

COUNT

 
D   

DEG

DELETE

DIM

DIV

DRAW

 
E   
EDIT

END

ENDPROC

ENVELOPE

EOF

EOR

ERL

ERR

EVAL

EXP

= EXT

EXT =
 
F   

FALSE

FN

FOR

 
G   

GCOL

GET

GET$

GOSUB

GOTO

 
H   

=HIMEM

HIMEM=

 
I   

IF

INKEY

INKEY$

INPUT

INPUT#

INSTR(

INT

 
L   

LEFT$(

LEN

LET

LIST
LISTO

LN

LOAD

LOCAL

LOG

=LOMEM

LOMEM=

 
M   

MID$(

MOD

MODE

MOVE

 
N   

NEW

NEXT

NOT

 
O   

OLD

ON

OPENIN

OPENOUT

OPENUP

OR OSCLI
 
P   

=PAGE

PAGE=

PI

PLOT

POINT(

POS

PRINT

PRINT#

(PRINT) quote (')

(PRINT) SPC

(PRINT) TAB(

PROC

=PTR

PTR =
 
R   

RAD

READ

RENUMBER

REPEAT

REPORT

RESTORE

RETURN

RIGHT$(

RND

RUN

 
S   
SAVE

SGN

SIN

SOUND

SPC

SQR

STOP

STR$

STRING$

 
T   

TAB(

TAN

=TIME

TIME=

=TIME$

TIME$=

TOP

TRACE

TRUE

 
U   

UNTIL

USR

 
V   

VAL

VPOS

VDU

 
W   

WIDTH



BASIC Language Functionality (Non-Keyword):

'?' and '!' address peek/poke operators

'$' address peek/poke operator

'!' and '?' address modifier operators

'+' Operator
'-' Operator

'*'-Command

'*' Operator
'/' Operator

'=' Return from a Function Call (FN)

'=' and other relational operators
'<' Operator
'<=' Operator
'<>' Operator
'>' Operator
'>=' Operator

'[' Begin Assembly

'^' Operator (raise to Power)

String Operations:
'+' Operator
'=' and other relational operators
'<' Operator
'<=' Operator
'<>' Operator
'>' Operator
'>=' Operator
Compare String values

Extract String

Load SWA with String Value

Push String to Stack

Pop String from Stack

Set String variable

String Addition

Integer Operations:
'+' Operator
'-' Operator
'*' Operator
'/' Operator
'=' and other relational operators
'<' Operator
'<=' Operator
'<>' Operator
'>' Operator
'>=' Operator
'^' Operator (raise to Power)

Check if Integer and Convert if Float

Compare Integer values
Compliment Result

Convert Floating-Point to Integer

Convert Integer to Floating-Point

Extract Hex Integer

Get Integer result of expression

Get Integer result of expression and check for closing bracket

Get Result of expression from BASIC Text pointer A & convert to Integer

Get Integer value at PTR B

Integer Compliment
Integer Addition

Integer Division

Integer Subtraction
Integer Multiplication
Integer Positive

Integer Reverse Order Complement

IWA = 8-bit or 16-bit Integer

Load Integer from Zero Page Address

Load IWA with Integer from Address
Load IWA with 1-byte Integer value
Pop Integer from BASIC Stack
Pop Integer from BASIC Stack (Zp)
Push Integer to BASIC Stack
Save Integer to Address
Save Integer to Zero Page Address

Set Numeric variable


Floating-Point Operations:
'+' Operator
'-' Operator
'*' Operator
'/' Operator
'=' and other relational operators
'<' Operator
'<=' Operator
'<>' Operator
'>' Operator
'>=' Operator
'^' Operator (raise to Power)

Clear FWA

Clear FWB

Compare Float values
Compliment Result

Convert Floating-Point to Integer

Convert Integer to Floating-Point

Copy FWA to FWB

Copy FWB to FWA

Evaluate continued-fraction expansions Series

Floating-point addition

Floating-Point Addition Entry Point

Floating-Point Compliment

Floating-Point Constant Table

Floating-Point Division

Floating-Point Division Entry Point

Floating-Point Multiplication

Floating-Point Multiply Entry Point

Floating-Point Reciple

Floating-point Sign

Floating-Point Subtract Entry Point

Get & Check Float value

Load FWA with Float Variable (ain)

Multiply FWA Mantissa by 10

Normalise FWA#1

Normalise FWA#2

Pack FWA to Variable

Pop Float from Stack (to &4A,&4B)

Push FWA to Stack

Raise FWA to the power of the integer value in A

Round FWA Mantissa to 4 bytes

Set FWA to 1-byte value

Set Numeric variable

Split FWA (into Integer/Fractional part)

Store FWA to Temporary Variable

Unpack FP Variable to FWA

Unpack FP Variable to FWB


BASIC Language Internal Routines - Initialise & Error handler:
BASIC Error handler

BASIC ROM header

BASIC ROM Startup Initialisations

BASIC ROM Startup initialisations (part 2)

Initialise Page 7 & reset Variable pointers, etc...

Reset ON ERROR code pointer

BASIC Language Internal Routines - Tokenisation & lookup & Program Line number handling:

BASIC Execution Address List

BASIC Keyword List

Check & skip end of program line

Check for End of Statement

Check for Variable name character or digit (in A)

Check Program can be read correctly

Detokenise the requested Line Number and Set IWA to the Line Number value

Get Line Number & find Program Address of the Line Number

Increment [and read] pointer (&37, &38)

Next non-space Char PTRB

Next non-space Char PTRA

Remove Line Number (specified in the IWA) from the Program

Tokenise Command Line and Insert Line into Program

Replace untokenised ASCII value with a 1-byte token

Search for Program Line

Tokenise Command Line

Tokenise Line Number


BASIC Language Internal Routines - Data/Variable/Array handling:

Allocate space for new variable

Check for '=', evaluate expression & check end of statement

Check for Stack clash with Heap

Create new variable name in Variable Pointer table

Evaluate expression and check for closing bracket

Evaluate Variable/Value/BASIC Function/Open Bracket

Evaluate variable name & Create if new variable

Evaluate Variable name and return value address

Extract next field

Get address of specified Array element

Get Address of Variable

Load Variable

Pack FWA to Variable

Read byte from I/O processor memory location (at the address contained in the IWA)>

Set Variable to value from the BASIC Stack

Store FWA to Temporary Variable

Unpack FP Variable to FWB


BASIC Language Internal Routines - Input & Display:
Display current Line number to screen [for TRACE]
Output ASCII character or BASIC Token (in ASCII text) to the screen
Output character to the screen
Print Line Number on screen

Prompt for command line and execute the entered command(s)

Start new output line


BASIC Language Internal Routines - ASCII-Numeric conversion:

Ascnum (ASCII String to Binary Number)

ASCNUM: Extract Number at PTRB

ASCNUM: Handle Exponental values & complete number conversion

Floating-point divide by 10
Floating-point multiply by 10

Multiply FWA Mantissa by 10

NUMASC (convert Numeric value to ASCII value)


BASIC Language Internal Routines - Subroutine Handling (PROC/FN):

'=' Return from a Function Call (FN)

Add subroutine name to FN/PROC variable lookup table

Call Subroutine

Create Lookup Table reference for Subroutine Name

Load Variable & Push its value to the BASIC Stack

Lookup Subroutine Name in FN/PROC Variable Lookup Table


Miscellaneous:
Assemble Assembly instruction/statement
Calculate next Random Number Seed value
Execute next command line / program statement
Expression Handler
Get Filename and set parameter block Filename and Load address
Load/Save named file
Signature