BBC BASIC (Z80)
Table of Contents
- Introduction
- Before You Start
- System Requirements
- Configuration
- Running BBC BASIC (Z80)
- General Information
- Introduction
- Line numbers
- Statement Separators
- Expression Priority
- Order of Evaluation
- Examples
- Variables
- Specification
- Numeric Variables
- Real Variables
- Integer Variables
- Byte variables
- Static Variables
- Boolean Variables
- Numeric Accuracy
- String Variables
- Arrays
- Array arithmetic
- Initialising arrays
- Program flow control
- Introduction
- Program structure limitations
- Leaving program loops
- REPEAT ... UNTIL loops
- Changing the loop variable
- Using the EXIT statement
- Moving the loop into a procedure
- Local arrays
- Indirection
- Introduction
- The ? operator
- Byte Access
- Query as a Byte Variable
- The ! operator
- The | operator
- The $ operator
- Use as binary (dyadic) operators
- Power of Indirection Operators
- The ^ operator
- Operators and Special Symbols
- Keywords
- Debugging
- Error handling
- Default error handling
- Reasons for trapping errors
- To make your program more 'friendly'
- To ensure the error message is visible
- To allow cleanup operations to take place
- To allow execution to continue
- Error trapping commands
- ON ERROR or ON ERROR LOCAL?
- Error reporting
- Error trapping examples
- Procedures and functions
- Introduction
- Names
- Function 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
- Recursive functions/procedures
- Passing arrays to functions and procedures
- Using parameters for output
- Returning arrays from procedures and functions
- Assembler
- Introduction
- Instruction mnemonics
- Statements
- Labels
- Comments
- Constants
- Define Byte - DEFB
- Define Word - DEFW
- Define Message - DEFM
- 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
- Syntax
- Symbols
- ABS
- ACS
- ADVAL
- AND
- ASC
- ASN
- ATN
- AUTO
- BGET#
- BPUT#
- BY
- CALL
- Parameter Table
- Parameter Formats
- CASE
- CHAIN
- CHR$
- CIRCLE
- CLEAR
- CLOSE#
- CLG
- CLS
- COLOUR
- COS
- COUNT
- DATA
- DEF
- DEG
- DELETE
- DIM
- Dimensioning arrays
- Reserving an area of memory
- Reserving a temporary area of memory
- DIM as a function
- DIV
- DRAW
- EDIT
- ELLIPSE
- ELSE
- END
- ENDCASE
- ENDIF
- ENDPROC
- ENDWHILE
- ENVELOPE
- EOF#
- EOR
- ERL
- ERR
- ERROR
- EVAL
- EXIT
- EXP
- EXT#
- FALSE
- FILL
- FN
- FOR
- GCOL
- GET/GET$
- Reading from an I/O port
- Reading from a file
- GOSUB
- GOTO
- HIMEM
- IF
- Single-line IF statement
- Multi-line IF statement
- INKEY/INKEY$
- INPUT
- INPUT LINE
- INPUT#
- INSTR
- INT
- LEFT$
- LEN
- LET
- LINE
- LIST
- LIST IF
- Limitations
- LISTO
- Bit Settings
- LN
- LOAD
- LOCAL
- LOCAL DATA
- LOG
- LOMEM
- MID$
- MOD
- MODE
- MOUSE
- MOUSE ON n
- MOUSE OFF
- MOUSE TO x,y
- MOUSE RECTANGLE l,b,w,h
- MOVE
- NEW
- NEXT
- NOT
- OF
- OFF
- OLD
- ON
- Limitations
- Enabling the text cursor
- ON ERROR
- ON ERROR LOCAL
- OPENIN
- OPENOUT
- OPENUP
- OPT
- Code Assembled Starting at P%
- Code Assembled Starting at O%
- OR
- ORIGIN
- OSCLI
- OTHERWISE
- PAGE
- PI
- PLOT
- 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
- QUIT
- RAD
- READ
- READ#
- RECTANGLE
- REM
- RENUMBER
- REPEAT
- REPORT/REPORT$
- RESTORE
- RESTORE DATA
- RESTORE ERROR
- RESTORE LOCAL
- RETURN
- RIGHT$
- RND
- RUN
- SAVE
- SGN
- SIN
- SOUND
- SPC
- SQR
- STEP
- STOP
- STR$
- STRING$
- SUM and SUMLEN
- SUM
- SUMLEN
- SWAP
- SYS
- TAB
- TAN
- THEN
- TIME
- TINT
- TO
- TOP
- TRACE
- TRUE
- UNTIL
- USR
- VAL
- VDU
- VPOS
- WAIT
- WHEN
- WHILE
- WIDTH
- BBC BASIC (Z80) Files
- Introduction
- The Structure of Files
- Basics
- Serial (Sequential) Files
- Random Access Files
- Indexed Files
- Files in BBC BASIC (Z80)
- Introduction
- How Data is Read/Written
- How Data is Stored
- Numeric Data
- How Strings are Stored
- How Files are Referred To
- File Buffering
- File Commands
- Introduction
- Filenames
- Organisation of Examples
- Program File Manipulation
- SAVE
- LOAD
- CHAIN
- MERGE
- *ERA
- *REN
- *DIR
- 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
- Operating System Interface
- Introduction
- File Specifiers
- Symbols
- Accessing Star Commands
- Syntax
- Case Conversion
- Special Characters
- Resident Star Commands
- *BYE
- *CPM
- *DIR
- *DRIVE
- *ERA
- *LOAD
- *OPT
- *REN
- *RESET
- *SAVE
- *TYPE
- Table of ASCII Codes
- Mathematical Functions
- Error Messages and Codes
- Summary
- Trappable - Program
- Trappable - Operating System
- Untrappable - Error Code 0
- Details
- Accuracy lost
- Bad arguments
- Bad call
- Bad command
- Bad DIM
- Bad EXIT
- Bad FOR variable
- Bad hex or binary
- Bad name
- Bad program
- Bad string
- Bad subscript
- Bad use of array
- Can't match FOR
- Channel
- Close error
- DATA not LOCAL
- DIM space
- Directory full
- Disk full
- Division by zero
- Escape
- Exponent range
- Failed at nnn
- File exists
- File not found
- LINE space
- Log range
- Missing ,
- Missing "
- Missing )
- Missing #
- Missing ENDCASE
- Missing ENDIF
- Missing TO
- Mistake
- Multiple label
- -ve root
- No GOSUB
- No room
- No such FN/PROC
- No such line
- No such variable
- Not in a FN
- Not in a FN/PROC
- Not in a FOR looop
- Not in a PROC
- Not in a REPEAT loop
- Not in a WHILE looop
- Number too big
- OF not last
- ON ERROR not LOCAL
- ON range
- ON syntax
- Out of DATA
- Out of range
- RENUMBER space
- Silly
- String too long
- Syntax error
- Too many open files
- Type mismatch
- Unknown error
- Format of Program and Variables in Memory
- Memory Map
- 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
- Byte Variables
- Real Variables
- String Variables
- Fixed Strings
- Array storage
© Doug Mounter and Richard Russell