RISCOS.com

www.riscos.com Technical Support:
BBC BASIC Reference Manual

 


BBC BASIC Reference Manual


Part 1 - Overview 1
1. About this Manual
Intended readership
Structure of the manual
Conventions used in this manual
2. About BBC BASIC
What is BASIC VI?
Why use BASIC VI?
The BASIC interpreter
Window managed programs
Part 2 - Programming techniques 9
3. Command mode
Entering BASIC
Leaving BASIC
Command mode
4. Simple programming
Entering a program
Altering a program
Deleting whole programs
Numbering lines in a program
Listing long programs
Comments
Multiple statements
Saving and recalling programs
5. Variables and expressions
Types of variables
6. Numeric variables
Integers and floating point numbers
Special integer variables
Arithmetic operators
7. Bases
Hexadecimal numbers
Binary numbers and bits
Shift operators
AND, OR and EOR
TRUE and FALSE
8. String variables
Assigning values to string variables
Joining strings together
Splitting strings
How characters are represented
Converting between strings and numbers
9. Arrays
The DIM statement
Two dimensional arrays
Finding the size of an array
Operating on whole arrays
Array operations
10. Outputting text
Print formatting
The text cursor
Defining your own characters
11. Inputting data
Inputting data from the keyboard
Including data as part of a program
Programming the keyboard
Using the mouse in programs
Programming function keys
12. Control statements
IF... THEN... ELSE
Operators
IF... THEN... ELSE... ENDIF
FOR... NEXT
REPEAT... UNTIL
WHILE... ENDWHILE
CASE... OF... WHEN... OTHERWISE... ENDCASE
GOTO
GOSUB... RETURN
ON... GOTO/GOSUB
For example:
13. Procedures and functions
Defining and calling procedures
Parameters and local variables
ON... PROC
Recursive procedures
Functions
Function and procedure libraries
14. Data and command files
Data files
Writing or reading single bytes
Writing or reading ASCII strings
Command files
15. Screen modes
Changing screen modes
Shadow modes
Text size
Graphics resolution
Colour modes
Changing colours
Changing the colour palette
256-colour modes
Using the screen under the Wimp
16. Simple graphics
The graphics screen
The point command
The line command
Rectangle and rectangle fill
Circle and circle fill
Ellipse and ellipse fill
Graphics colours
The graphics cursor
Relative coordinates and BY
Printing text at the graphics cursor
17. Complex graphics
Plotting simple lines
Ellipses
Arcs
Sectors
Segments
18. Graphic patterns
Default patterns
Plotting using pattern fills
Defining your own patterns
Native mode patterns
BBC Master mode patterns
Giant patterns
Simple patterns
Flood-fills
Copying and moving
19. Viewports
Text viewports
Graphics viewports
20. Sprites
Loading a user sprite
Plotting a user sprite
21. Teletext mode
Coloured text
Making text flash
Double-height text
Changing the background colour
Teletext graphics
22. Sound
Activating the sound system
Selecting sound channels
Allocating a wave-form to each voice
Setting the stereo position
Creating a note
Synchronising the channels
Finding the value of the current beat
Finding the current tempo
Executing a sound on a beat
23. Accessing memory locations
Reserving a block of memory
The '?' indirection operator
The '!' indirection operator
The '|' indirection operator
The '$' indirection operator
24. Error handling and debugging
Generating errors
External errors
Local error handling
Debugging
25. VDU control
26. Editing BASIC files
Editing BASIC files under RISC OS 3
Editing BASIC files under RISC OS 2
Part 3 - Keywords
27. Keywords
ABS
ACS
ADVAL
AND
APPEND
ASC
ASN
ATN
AUTO
BEAT
BEATS
BGET #
BPUT #
BY
CALL
VARIND
STOREA
STSTORE
LVBLNK
CREATE
EXPR
MATCH
TOKENADDR
FSTA
FLDA
FADD/FMUL
FSUB/FDIV
FLOAT
FIX
FSQRT
CASE
CHAIN
CHR$
CIRCLE
CLEAR
CLG
CLOSE #
CLS
COLOUR (COLOR)
COS
COUNT
CRUNCH
DATA
DEF
DEG
DELETE
DIM
DIV
DRAW
EDIT
ELLIPSE
ELSE
END
ENDCASE
ENDIF
ENDPROC
ENDWHILE
EOF #
EOR
ERL
ERR
ERROR
EVAL
EXP
EXT#
FALSE
FILL
FN
FOR
GCOL
GET
GET$#
GET$
GOSUB
GOTO
HELP
HIMEM
IF
INKEY
INKEY$
INPUT
INPUT LINE
INPUT#
INSTALL
INSTR
INT
LEFT$
LEN
LET
LIBRARY
LINE
LINE INPUT
LIST
LISTO
LN
LOAD
LOCAL
LOG
LOMEM
LVAR
MID$
MOD
MODE
MOUSE
MOVE
NEW
NEXT
NOT
OF
OFF
OLD
ON
ON ERROR
OPENIN
OPENOUT
OPENUP
OR
ORIGIN
OSCLI
OTHERWISE
PAGE
PI
PLOT
POINT
POINT
POS
PRINT
PRINT#
PROC
PTR#
QUIT
RAD
READ
RECTANGLE
REM
RENUMBER
REPEAT
REPORT
REPORT$
RESTORE
RESTORE ERROR
RETURN
RIGHT$
RND
RUN
SAVE
SGN
SIN
SOUND
SPC
SQR
STEREO
STOP
STR$
STRING$
SUM
SUMLEN
SWAP
SYS
TAB
TAN
TEMPO
TEXTLOAD
TEXTSAVE
THEN
TIME
TIME$
TINT
TOP
TRACE
TRUE
TWIN
UNTIL
USR
VAL
VDU
VOICES
VPOS
WAIT
WHEN
WHILE
WIDTH
BBC/Master compatible calls
Formatting numbers
Part 4 - Appendixes
28. Appendix A - Numeric implementation
Numeric types
Effects of storage size
What is floating point arithmetic?
Implementation
29. Appendix B - Minimum abbreviations
30. Appendix C - Error messages
31. Appendix D - Inkey values
32. Appendix E - Colour modes
33. Appendix F - Plot codes
34. Appendix G - VDU commands
35. Appendix H - *FX commands
36. Appendix I - BBC BASIC's history
BASIC II improvements
BASIC III improvements
BASIC IV improvements
BASIC V version 1.04 improvements
BASIC V version 1.05 improvements
BASIC VI version 1.05 improvements
37. Appendix J - ARM assembler
Using the BASIC assembler
Saving machine code to file
Executing a machine code program
Format of assembly language statements
Registers
Condition codes
The instruction set

This edition Copyright © 3QD Developments Ltd 2015
Last Edit: Tue,03 Nov 2015