R. T. RUSSELL
BBC BASIC (86) Manual
Table of Contents
- Introduction
- Before You Start
- Variants of BBCBASIC(86)
- Naming Conventions
 
 - Technicalities
 
 - Running BBC BASIC (86)
 
 - General Information
- Introduction
- Control Codes and Functions
- Generation
 - What Happens to Control Codes?
 - Special Control Codes
 
 - Line Numbers
 - Statement Separators
 
 - Editing
- Introduction
 - Copy Key Editing
- The Copy Key
 - The Back-space Key
 
 - The Line Editor - EDIT
 - The Screen Editor - *EDIT
 
 - Expression Priority
- Order of Evaluation
 - Examples
 
 - Variables
- Specification
 - Numeric Variables
- Real Variables
 - Integer Variables
 - Static Variables
 - Boolean Variables
 - Numeric Accuracy
 
 - String Variables and Garbage
- Strings
 - Garbage Generation
 - Memory Allocation
 
 - Arrays
 
 - Program Flow Control
- Introduction
 - Loop Operation Errors
 - Program Structure Limitations
 - Leaving Program Loops
- REPEAT...UNTIL Loops
 - Changing the Loop Variable
 - Popping the Inner Variable
 
 - Local Variables
 - Stack Pointer
 
 - Indirection
- Introduction
 - Query
- Byte Access
 - Query as a Byte Variable
 
 - Exclamation
 - Dollar
 - Use as Binary Operators
 - Power of Indirection Operators
 
 - Operators and Special Symbols
 - Keywords
 - Error Handling
- Introduction
- Types of Errors
 - Trapping Errors
 - Reasons for Trapping Errors
 
 - Error Trapping Commands
- ON ERROR
 - ON ERROR LOCAL
 - ON ERROR or ON ERROR LOCAL?
 
 - Error Reporting
- ERR
 - ERL
 - REPORT
 
 - Error Trapping Examples
 
 - Procedures and Functions
- Introduction
 - Names
 - Functions and Procedure Definitions
- Starting a Definition
 - The Function/Procedure Body
 - Ending a Definition
 - Single Line Functions/Procedures
 - Extending the Language
 
 - Passing Parameters
- Formal and Actual Parameters
 
 - Local Variables
- Re-entrant Functions/Procedures
 
 
 
 - Graphics and Colours
- Introduction
 - Display Modes
- Available Modes
 - Graphics Coordinates
 
 - Colours
- Introduction
 - Text Colours
- Two Colour Graphics Mode
 - Four Colour Graphics Modes
 - Sixteen Colour Graphics Modes
 - Text Only Modes
 
 - Graphics Colours
- Setting The Colours
 - Two Colour Graphics
 - Four Colour Graphics
 - Sixteen Colour Graphics
 
 
 - The Palette
- Logical Colours
 - Physical Colours
 - Palettes Available
 - Setting the Palette
 - Colours Available
 - Normal Palette
- Normal Palette - CGA Modes
 - Normal Palette - EGA/VGA Colour Modes
 - Normal Palette - Text Only Modes
 
 - Enhanced Palette
- Enhanced Palette - Graphics Modes
 - Enhanced Palette - Text Only Modes
 - Enhanced Palette - VGA
 
 - Border Colour
 - Default Colour Setting
 
 - Drawing on The Screen
- Introduction
- Screen Dimensions
 - The Graphics Area
 
 - DRAW
 - MOVE
 - PLOT
- Basic Modes
 - Enhanced Modes
 - Horizontal Line Fill to Non-background
 - Triangle Plot and Fill
 - Horizontal Line Fill to Background Right
 - Rectangle Plot and Fill
 - Horizontal Line Fill to Foreground
 - Parallelogram Plot and Fill
 - Horizontal Line Fill to Non-foreground Right
 - Flood Fill to Non-background
 - Flood Fill to Foreground
 - Draw Circle
 - Draw Solid Disc
 - Draw Relative
 - Logical Inverse Colour
 - POINT
 
 
 - Windows
- Introduction
 - Text Window
- Define Text Window
 - Clear Text Window
 
 - Graphics Window
- Define Graphics Window
 - Clear Graphics Window
 - Changing the Graphics Origin
 - Resetting Text and Graphics Windows
 - Positioning The Cursor
 
 
 - User Defined Characters
- Defining a Character
 - Character Dot Pattern
- Double Height Characters
 
 - Text Positioning
- Text at Graphics Cursor
 - Text at Text Cursor
 
 - Current Character
 
 
 - Assembler
- Introduction
- BIGBASIC
 - Statements
 - Labels
 - Comments
 
 - Language Syntax
- Differences from The Intel Syntax
- Jumps and Calls
 - Memory Operands
 - String Operations
 - Segment Override
 - Byte/Word Ambiguities
 - Based-Indexed Operands
 - Indexed Memory Operands
 
 - Word and String Constants
- Define Byte - DB
 - Define Word - DW
 - Define Double Word - DD
 
 
 - Reserving Memory
- The Program Counter
 - Using DIM to Reserve Memory
 - Moving HIMEM to Reserve Memory
 - Length of Reserved Memory
 - Initial Setting of the Program Counter
 
 - The Assembly Process
- OPT
 - Assembly at a Different Address
 - OPT Summary
- Code Assembled Starting at P%
 - Code Assembled Starting at O%
 
 - How the Assembler Works
 - Saving and Loading Machine Code Programs
- *SAVE
 - *LOAD
 
 
 - Conditional Assembly and Macros
- Introduction
 - Conditional Assembly
 - Macros
 
 
 - Statements and Functions
- Introduction
- BIGBASIC
 - Single Key Entry
 - Syntax
- Symbols
 
 
 - ABS
 - ACS
 - ADVAL
- Positive Argument (1 to 4)
 - Zero Argument
 - Negative Argument (-6)
 
 - AND
 - ASC
 - ASN
 - ATN
 - AUTO
 - BGET#
 - BPUT#
 - CALL
- Operating System Interface
 - Parameter Table
 - Parameter Formats
- Example
 
 
 - CHAIN
 - CHR$
 - CLEAR
 - CLOSE#
 - CLG
 - CLS
 - COLOUR
- Two Colour Graphics Mode
 - Four Colour Graphics Modes
 - Sixteen Colour Graphics Modes
 - Text Only Modes
 
 - COS
 - COUNT
 - DATA
 - DEF
 - DEG
 - DELETE
 - DIM
- Dimensioning Arrays
 - Reserving an Area of Memory
 
 - DIV
 - DRAW
 - EDIT
 - ELSE
 - END
 - ENDPROC
 - ENVELOPE
 - EOF#
 - EOR
 - ERL
 - ERR
 - EVAL
 - EXP
 - EXT#
 - FALSE
 - FN
 - FOR
 - GCOL
- Two Colour Graphics
 - Four Colour Graphics
 - Sixteen Colour Graphics
 
 - GET/GET$
 - GOSUB
 - GOTO
 - HIMEM
 - IF
 - INKEY/INKEY$
 - INPUT
 - INPUT LINE
 - INPUT#
 - INSTR
 - INT
 - LEFT$
 - LEN
 - LET
 - LIST
 - LIST IF
- Limitations
 
 - LISTO
- Bit Settings
 
 - LN
 - LOAD
 - LOCAL
 - LOG
 - LOMEM
 - MID$
 - MOD
 - MODE
- Available Modes
 
 - MOVE
 - NEW
 - NEXT
 - NOT
 - OLD
 - ON
- Limitations
 
 - ON ERROR
 - ON ERROR LOCAL
 - OPENIN
 - OPENOUT
 - OPENUP
 - OPT
- Code Assembled Starting at P%
 - Code Assembled Starting at O%
 
 - OR
 - OSCLI
 - PAGE
 - PI
 - PLOT
- Basic Modes
 - Enhanced Modes
 - Horizontal Line Fill to Non-background
 - Triangle Plot and Fill
 - Horizontal Line Fill to Background Right
 - Rectangle Plot and Fill
 - Horizontal Line Fill to Foreground
 - Parallelogram Plot and Fill
 - Horizontal Line Fill to Non-foreground Right
 - Flood Fill to Non-background
 - Flood Fill to Foreground
 - Draw Circle
 - Draw Solid Disc
 - Draw Relative
 - Logical Inverse Colour
 
 - POINT
 - POS
 - PRINT
- General Information
 - Print Format Control
- STR$ Format Control - SS
 - Format Selection - NN
 - Number of Digits - PP
 - Zone Width - WW
 - Changing the Print Control Variable
 
 - Examples
 
 - PRINT#
 - PROC
 - PTR#
 - PUT
 - RAD
 - READ
 - REM
 - RENUMBER
 - REPEAT
 - REPORT
 - RESTORE
 - RETURN
 - RIGHT$
 - RND
 - RUN
 - SAVE
 - SGN
 - SIN
 - SOUND
- Channel
 - Loudness
 - Pitch
 - Duration
 - Examples
 
 - SPC
 - SQR
 - STEP
 - STOP
 - STR$
 - STRING$
 - TAB
 - TAN
 - THEN
 - TIME
 - TIME$
 - TO
 - TOP
 - TRACE
 - TRUE
 - UNTIL
 - USR
- Operating System Interface
 
 - VAL
 - VDU
- BBC Micro VDU Emulation
 
 - VPOS
 - WIDTH
 
 - VDU Emulation
- Introduction
 - VDU Code Summary
 - Description of VDU Codes
- VDU 0
 - VDU 1
 - VDU 2
 - VDU 3
 - VDU 4
 - VDU 5
 - VDU 6
 - VDU 7
 - VDU 8
 - VDU 9
 - VDU 10
 - VDU 11
 - VDU 12
 - VDU 13
 - VDU 14
 - VDU 15
 - VDU 16
 - VDU 17
 - VDU 18
 - VDU 19
- Physical Colours
 - Palettes Available
 - Setting the Palette
 - Colours Available
 - Normal Palette - CGA Modes
 - Normal Palette - EGA/VGA Colour Modes
 - Normal Palette - Text Only Modes
 - Enhanced Palette
 - Enhanced Palette - VGA
 - Border Colour
 
 - VDU 20
 - VDU 21
 - VDU 22
 - VDU 23
- Enable/Disable Cursor
 - Programming the 6845 CRT Controller
 
 - VDU 24
 - VDU 25
 - VDU 26
 - VDU 27
 - VDU 28
 - VDU 29
 - VDU 30
 - VDU 31
 - VDU 127
 
 
 - Operating System Interface
- Introduction
- File Specifiers
 - Symbols
 
 - Accessing Star Commands
- Syntax
 - Non Resident Star Commands
 - Similarly Named Star Commands
 - Errors in Star Commands
 - Case Conversion
 - Special Characters
 
 - Additional OS Interfaces
- Current Character - OSBYTE Call
 - Character Dot Pattern - OSWORD Call
 - OSRDCH, OSWRCH, OSKEY and OSCLI Calls
 
 - Resident Star Commands
- *BYE
 - *CHDIR
 - *DELETE
 - *DIR
 - *DRIVE
 - *EDIT
 - *EGA
 - *ERASE
 - *ESC
 - *EXEC
 - *FX
 - *HELP
 - *KEY
 - *LOAD
 - *LOCK
 - *MKDIR
 - *OPT
 - *QUIT
 - *RMDIR
 - *RENAME
 - *RUN
 - *SAVE
 - *SPOOL
 - *SPOOLON
 - *TV
 - *TYPE
 - *UNLOCK
 - *|
 
 - BBC Micro Star Commands
- *ACCESS
 - *BACKUP
 - *BUILD
 - *CODE
 - *COMPACT
 - *COPY
 - *DESTROY
 - *DIR
 - *DISK
 - *DUMP
 - *ENABLE
 - *INFO
 - *KEYS
 - *LIB
 - *LINE
 - *LIST
 - *MOTOR
 - *ROM
 - *TAPE
 - *TITLE
 - *TV
 - *WIPE
 
 
 - BBCBASIC(86) Disk Files
- Introduction
 - The Structure of Files
- Basics
 - Serial (Sequential) Files
 - Random Access Files
 - Indexed Files
 
 - Files in BBCBASIC(86)
- Introduction
 - How Data is Read/Written
 - How Data is Stored
- Numeric Data
 - How Strings are Stored
 
 - How Files are Referred To
 
 - BBCBASIC(86) File Access
- File Buffering
 - Precautions
 - Networking - Shared Files
 
 - Disk File Commands
- Introduction
 - Filenames
 - Organisation of Examples
 - Program File Manipulation
- SAVE
 - LOAD
 - CHAIN
 - MERGE
 - *DEL/*ERA
 - *REN
 - *DIR
 - UNLIST
 - CRUNCH
 
 - Disk Data Files
- Introduction
 - Opening Files
 - File Opening Functions
 - OPENOUT
 - OPENIN
 - OPENUP
 - CLOSE#
 - INPUT#
 - PRINT#
 - EXT#
 - PTR#
 - EOF#
 - BGET#
 - BPUT#
 
 
 - Serial Files
- Introduction
 - Character Data Files
- Ex 1 - Writing Serial Character Data
 - Ex 2 - Reading Serial Character Data
 - Ex 3 - Writing 'AT END' of Character Files
 
 - Mixed Numeric/Character Data Files
- Ex 4 - Writing a Mixed Data File
 - Ex 5 - Reading a Mixed Data File
 - Ex 6 - Writing 'AT END' of Mixed Files
 
 - Compatible Data Files
- Ex 7 - Writing a Compatible Data File
 - Ex 8 - Reading a Compatible Data File
 
 
 - Random (Relative) FIles
- Introduction
 - Designing the File
- Record Structure
 - Accessing The Records
 
 - Ex 9 - Simple Random Access File
 - Ex 10 - Simple Random Access Database
 - Ex 11 - Random Access Inventory Program
 
 - Indexed Data Files
- Deficiencies of Random Access Files
 - The Address Book Program
- File Organisation
 - Program Organisation
 - The Index
 
 - Ex 12 (the LAST)
 
 - The Binary Chop
- Explanation
 
 
 
- Table of ASCII Codes
 - Mathematical Functions
 - Error Messages and Codes
- Summary
- Trappable - Program
 - Trappable - Operating System
 - Untrappable - Error Code 0
 
 - Details
- Access denied
 - Accuracy lost
 - Arguments
 - Array
 - Bad call
 - Bad command
 - Bad DIM
 - Bad directory
 - Bad drive
 - Bad HEX
 - Bad key
 - Bad MODE
 - Bad name
 - Bad program
 - Bad string
 - Can't match FOR
 - Channel
 - Device fault
 - DIM space
 - Disk fault
 - Disk full
 - Disk read only
 - Division by zero
 - Escape
 - Exp range
 - Failed at nnn
 - File exists
 - File not found
 - FOR variable
 - LINE space
 - Log range
 - Missing ,
 - Missing "
 - Missing )
 - Missing #
 - Mistake
 - Multiple label
 - -ve root
 - No GOSUB
 - No FN
 - No FOR
 - No PROC
 - No REPEAT
 - No room
 - No such FN/PROC
 - No such line
 - No such variable
 - No TO
 - Not LOCAL
 - ON range
 - ON syntax
 - Out of DATA
 - Out of range
 - RENUMBER space
 - Silly
 - Size needed
 - String too long
 - Subscript
 - Syntax error
 - Too big
 - Too many open files
 - Type mismatch
 - Wrap
 
 
 - Format of Program and Variables in Memory
- Memory Map
- BBCBASIC(86) Work Space
- Workspace RAM
 
 - The Memory Map
 
 - Memory Management
- Limiting the Number of Variables
 - String Management
- Garbage Generation
 - Memory Allocation for String Variables
 
 
 - Program Storage in Memory
- Line Length
 - Line Number
 - Statements
 - Line Terminator
 
 - Variable Storage in Memory
- Integer Variables
 - Real Variables
 - String Variables
 - Fixed Strings
 
 
 - Utility Routines
- Introduction
 - Program and Data Format Conversion
- Transferring the Files
- Preparation
 - Transferring the Comms Program
 - Transferring a File
 
 - Converting the Files Using FCONVERT.BBC
- Program Files
 - Data Files
 
 
 - Serial I/O
 - Direct Memory Access
 
 - BBCRUN/BIGRUN
- Introduction
 - Additional Facilities
- User Defined Characters
 - Command Line Parameters
 
 - Using BBCRUN
- Files Needed
 - Running BBCRUN (BIGRUN)
- Interactive Mode
 - Command Line Mode
 
 
 
 - BIGBASIC
- Introduction
 - General Information
- Memory Used
 - Stack
 - Variables and Arrays
 - Indirection
 - BIGRUN
 
 - Assembler
- Introduction
 - Program Counter
 - Calling Assembler Code Routines
 - Segment Registers
 - OSWORD Parameter Block
 
 - Keywords
- CALL
- Parameter Table
 - Parameter Formats
 
 - EVAL
 - HIMEM
 - LOMEM and PAGE
 - TOP
 - USR
 
 - Operating System Interface
- *LOAD and *SAVE
 
 - Data Structure Format
- Integers and Reals
 - Strings
 
 
 - Teletext MODE7
- Introduction
 - Installing MODE7.COM
 - Functionality
- Character Set
 - Reveal/Conceal
 - Double Height Characters
 
 
 
© Richard Russell