This is some BBC BASIC information I’m putting in one place so I can find it easily.
Let me know if you would like me to add any other information here.
Documentation
BBC Micro Bot Editor
PLOT Quick Reference
Foreground colour PLOT commands.
(Generally absolute co-ordinates except for circle which is relative co-ordinates so we can specify the radius)
PLOT Code |
Result |
|
PLOT 4 |
MOVE |
|
PLOT 5 |
DRAW line |
|
PLOT 69 |
Plot Single Pixel |
|
PLOT 85 |
Filled Triangle |
|
PLOT 101 |
Filled Rectangle |
(Graphics Extension ROM only) |
PLOT 145 |
Circle Outline |
(Graphics Extension ROM only) |
PLOT 153 |
Filled Circle |
(Graphics Extension ROM only) |
PLOT 197 |
Ellipse Outline |
(Graphics Extension ROM only) |
PLOT 205 |
Filled Fllipse |
(Graphics Extension ROM only) |
Physical Colour Values
Physical Colour Value |
Colour |
0 |
black |
1 |
red |
2 |
green |
3 |
yellow |
4 |
blue |
5 |
magenta |
6 |
cyan |
7 |
white |
8 |
flashing black-white |
9 |
flashing red-cyan |
10 |
flashing green-magenta |
11 |
flashing yellow-blue |
12 |
flashing blue-yellow |
13 |
flashing magenta-green |
14 |
flashing cyan-red |
15 |
flashing white-black |
Misc
Set Palette
VDU 19,logical,physical,0,0,0
Wait for VSYNC
*FX 19
Hide Flashing Cursor
In graphics mode:
VDU 23;8202;0;0;0;
or sometimes just
VDU 5
In Teletext mode (MODE 7)
VDU 23,1,0;0;0;0;
Define UDG Character
VDU 23,character,row0,row1,row2,row3,row4,row5,row6,row7
e.g.
VDU 23,230,1,2,4,8,16,32,64,128
PRINT CHR$(230)
Graphics Modes
Mode |
Graphics Resolution |
Display |
Text |
0 |
640x256 2 colour display |
80x32 text |
|
1 |
320x256 4 colour display |
40x32 text |
|
2 |
160x256 16 colour display |
20x32 text |
|
3 |
|
2 colour text only |
80x25 text |
4 |
320x256 2 colour display |
40x32 text |
|
5 |
160x256 4 colour display |
20x32 text |
|
6 |
|
2 colour text only |
40x25 text |
7 |
|
Teletext display |
40x25 text |
GCOL Modes
Value |
Behaviour |
Description |
0 |
Plot |
Overwrites the existing screen colour with the new one |
1 |
Or |
Performs a bitwise OR of the screen pixel’s logical colour and the new colour |
2 |
And |
Performs a bitwise AND of the screen pixel’s logical colour and the new colour |
3 |
Xor |
Performs a bitwise XOR of the screen pixel’s logical colour and the new colour |
4 |
Inverse |
Inverts the colour of any pixels drawn |
Standard Plot Commands
Value |
Meaning |
0 |
move relative to last point |
1 |
draw line relative in the current graphics foreground colour |
2 |
draw line relative in the logical inverse colour |
3 |
draw line relative in current graphics background colour |
4 |
move to absolute position |
5 |
draw line absolute in the current graphics foreground colour |
6 |
draw line absolute in logical inverse colour |
7 |
draw line absolute in current graphics background colour |
Higher values of K have other effects which are related to the effects given by the values 0 to 7
Value |
Meaning |
8-15 |
as 0-7 but with the last point in the line omitted in inverting actions’ - eg using G C0L4 |
16-23 |
as 0-7 but with a dotted line |
24-31 |
as 0-7 but with a dotted line and without the last point on the line |
32-63 |
are reserved for the Graphics Extension ROM |
64-71 |
as 0-7 but only a single point is plotted 72-79 reserved |
80-87 |
as 0-7 but plot and fill a triangle. When filling solid triangles with colour the computer fills the triangle between the coordinates given and the last TWO points visited. |
Graphics Extension ROM
Graphics Extension ROM - Drawing Commands
Geometry |
PLOT codes |
Rectangle Fills |
&60 - &67 (96 - 103) |
Parallelograms |
&70 - &77 (112 - 119) |
Filled Circles |
&98 - &9F (152 - 159) |
Circle Outlines |
&90 - &97 (144 - 151) |
Ellipse Outlines |
&C0 - &C7 (192 - 199) |
Ellipse Fills |
&C8 - &CF (200 - 207) |
Arcs |
&A0 - &A7 (160 - 167) |
Sectors |
&B0 - &B7 (176 - 183) |
Segments |
&A8 - &AF (168 - 175) |
Graphics Extension ROM - Pattern Fills
There are four default patterns set up for you which depend on the mode you
are in:
MODE 0 and MODE 4 |
|
GCOL 16,0 |
3 parts black 1 part white (cross hatch) |
GCOL 32,0 |
1 part black 1 part white (cross hatch) |
GCOL 48,0 |
1 part black 3 parts white (cross hatch) |
GCOL 64,0 |
1 part black 1 part white (diagonal stripes) |
MODE 1 and MODE 5 |
|
GCOL 16,0 |
3 parts red 1 part yellow (cross hatch) |
GCOL 32,0 |
1 part red 1 part yellow (cross hatch) |
GCOL 48,0 |
1 part red 3 parts yellow (cross hatch) |
GCOL 64,0 |
1 part white 1 part yellow (cross hatch) |
MODE 2 |
|
GCOL 16,0 |
1 part red 1 part yellow (cross hatch) |
GCOL 32,0 |
1 part red 1 part magenta (cross hatch) |
GCOL 48,0 |
1 part yellow 1 part green (cross hatch) |
GCOL 64,0 |
1 part yellow 1 part white (cross hatch) |
The second parameter which has been set to 0, has no effect on the pattern
produced. It is used instead to determine whether it is the foreground or
background colour which is being set. Values 0-127 apply to the foreground
colour and 128-255 to the background.
Graphics Extension ROM - Move Screen Area Plot Codes
Decimal |
Hex |
Description |
184 |
B8 |
Move only, relative |
185 |
B9 |
Move rectangle relative |
186 |
BA |
Copy rectangle relative |
187 |
BB |
Copy rectangle relative |
188 |
BC |
Move only, absolute |
189 |
BD |
Move rectangle absolute |
190 |
BE |
Copy rectangle absolute |
191 |
BF |
Copy rectangle absolute |
VDU Code Summary
Decimal |
Hex |
Parameter Byte Count |
Description |
0 |
0 |
0 |
does nothing |
1 |
1 |
1 |
send next character to printer only |
2 |
2 |
0 |
enable printer |
3 |
3 |
0 |
disable printer |
4 |
4 |
0 |
write text at text cursor |
5 |
5 |
0 |
write text at graphics cursor |
6 |
6 |
0 |
enable VDU drivers |
7 |
7 |
0 |
make a short beep |
8 |
8 |
0 |
backspace cursor one character |
9 |
9 |
0 |
forwardspace cursor one character |
10 |
A |
0 |
move cursor down one line |
11 |
B |
0 |
move cursor up one line |
12 |
C |
0 |
clear text area |
13 |
D |
0 |
move cursor to start of current line |
14 |
E |
0 |
page mode on |
15 |
F |
0 |
page mode off |
16 |
10 |
0 |
clear graphics area |
17 |
11 |
1 |
define text colour |
18 |
12 |
2 |
define graphics colour |
19 |
13 |
5 |
define logical colour |
20 |
14 |
0 |
restore default logical colours |
21 |
15 |
0 |
disable VDU drivers or delete current line |
22 |
16 |
1 |
select screen mode |
23 |
17 |
9 |
re-program display character |
24 |
18 |
8 |
define graphics window |
25 |
19 |
5 |
PLOT K,x,y |
26 |
1A |
0 |
restore default windows |
27 |
1B |
0 |
does nothing |
28 |
1C |
4 |
define text window |
29 |
1D |
4 |
define graphics origin |
30 |
1E |
0 |
home text cursor to top left |
31 |
1F |
2 |
move text cursor to x,y |
127 |
7F |
0 |
Backspace and delete |
Emulators
Useful Sites