Click Here To Go To The Your Computer Archive



Written By R. Watson


Cover Art
Click Here To Enlarge Loading Screen

Loading Screen
Click Here To Enlarge Opening Screen

Opening Screen
Click Here To Enlarge Screenshot

Game Screenshot

Colours

R. Watson, Athersley South, Barnsley

On BBC Micros with Basic II, the filling command PLOT 77 is available and is also pretty well-known. A lesser known relative of this command is PLOT 76, which does not draw a line, but just makes the cursor movements, which may be read using OSWORD with A=&D.

When the command PLOT 77,x,y is given, the graphics cursor travels left until the pixel at that position is a non-background pixel, i.e. a different colour to the origin. This co-ordinate is then noted, the cursor then scans right until a similar pixel is found, and a line is drawn between these two points.

When using PLOT 76, similar cursor movements are made, but without any line being drawn between points. Therefore it is possible to use this command to create your own fill routine, as I have done.

A method of obtaining new colours on the BBC which has received a lot of publicity lately is pixel "dithering". What that means is mixing two or more colours to form a pattern similar to a chess board, the idea being that from normal viewing distance a screenful of such a pattern, say with alternating red and yellow pixels, would look orange. This is what my program sets out to do.

The only things that may need explaining in the program are the OSWORD call, and the method of pixel dithering. The OSWORD call with A=&D is used to read the last two sets of graphics co-ordinates. First of all, an area must be allocated somewhere for the routine to dump its data - I have used eight locations on the zero page. After the call, the information is laid out like this - as given in the Advanced User Guide.

XY + 0 previous x,low
XY + 1 previous x,high
XY + 2 previous y,low
XY + 3 previous y,high
XY + 4 current x,low
XY + 5 current x,high
XY + 6 current y,low
XY + 7 current y,high

The pixels are dithered by using the Basic command Eor, and also swapping the colours - 0 and 1. What Eor does is give the opposite of 1 or 0, in fact reverses it, so 1 EOR 1 = 0, and 1 EOR 0 = 1.

The program therefore toggles between the colours as it moves across the screen by first using colour 0, then swapping to colour 1 for each alternate pixel.

The pixels are dithered up the screen by swapping the colours in a similar way to which numbers are swapped in a sorting routine.

How To Use The Routine

First:
Set colour 0 by ?fc = desired colour number (0-15)
Set colour 1 by ?sc = desired colour number (0-15)

Second:
Call the procedure by PROCfill(x,y), where x is the middle of shape, and y is the base of shape+4

Do not attempt to fill in any shape which does not have a black background.