Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF (EN)

145 Suppose we want, for example, a yellow dot on a blue background. We need to change the foreground colour from white to yellow and the background colour from black to blue. To do this, use the VDU 19 command as described earlier: VDU 19,1,3,0,0,0 This alters logical colour 1 (this means the normal foreground colour) to actual colour 3 (ie yellow). Now type VDU 19,0,4,0,0,0 This alters logical colour 0 (which is the normal background colour) to actual colour 4 (ie blue). PLOT 69, 500, 500 will now produce the desired effect.

Animation How to make a ball and move it on the screen This time we’ll write a program in steps to make a yellow ‘ball’ consisting of four dots which move on the screen on a red background. 1. Setting up MODE and colours 10 MODE 4 20 VDU 19,1,3,0,0,0 30 VDU 19,0,1,0,0,0 2. Next a ‘procedure’ for creating a ball. This procedure will be ‘called up’ whenever we want to create a ball on the screen at a point (X,Y). It is good practice to put a procedure like this at the end of a program, so we’ll give it a high line number. X and Y are the parameters for this procedure.

1000 DEF PROCBALL (X,Y) 1010 PLOT 70,X,Y 1020 PLOT 70,X,Y+4 1030 PLOT 70,X+4,Y 1040 PLOT 70,X+4,Y+4 1050 ENDPROC We use PLOT 70 rather than PLOT 69 to help the animation which follows. 3. Making the ball travel horizontally at height Y = 500. 40 REM HORIZONTAL MOVEMENT 50 FOR N = 1 TO 1000 60 PROCBALL (N,500) 70 PROCBALL (N,500)