138 MODES 128-135 do not use any of main memory, and are the ‘shadow screen’ equivalents of MODES 0-7 . See chapter 42 for more details. How to draw lines In Appendix E you will find a graphics planning sheet which shows the way the screen can be thought of as a piece of graph paper, with each point having a horizontal (X) and a vertical (Y) value. The ‘origin’ is point 0,0 and is at the bottom left of the screen. Top right is 1279,1023. How to draw a square in the centre of the screen 1. First set up a screen mode which can support graphics.
Use the MOVE statement to move the graphics ‘cursor’ from its home position (0,0) to a point where we can start drawing (say 400 units along and 400 units up). 100 MODE 5 110 MOVE 400,400 2. Draw a line horizontally to point 800,400. The DRAW command draws a line from the last point ‘plotted’ to a point defined in the DRAW statement. 120 DRAW 800,400 3. Finish the box with three more DRAW statements 130 DRAW 800,800 140 DRAW 400,800 150 DRAW 400,400 Changing the colour of the square Run the program. The normal colour in MODE 5 is white. Add the following line: 105 GCOL 0,1 This changes the lines to ‘logical’ colour 1, which in MODE 5 is red. MODE 5 only has four colours.
When the machine is switched on they are black, red, yellow and white. However, logical colours can be changed by using one of the VDU commands (see later). So, if you know what you are doing, you can select any four colours in MODE5 . How to fill in with colour PLOT 85,X,Y (see the BASIC keywords chapter) draws and then fills in a triangle drawn from the last two plotted points to the point defined by X and Y. The colour is the current graphics foreground colour. Add the following line: 160 PLOT 85,800,800