Home » Personal collection » Acorn hard disk » misc » misc3 » shipwren/+PTB1
shipwren/+PTB1
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Personal collection » Acorn hard disk » misc » misc3 |
Filename: | shipwren/+PTB1 |
Read OK: | ✔ |
File size: | 2881 bytes |
Load address: | 0000 |
Exec address: | 0000 |
Duplicates
There is 1 duplicate copy of this file in the archive:
- Personal collection » Acorn ADFS disks » Archimedes » Unlabelled_disk_2.ADF » +PTB1
- Personal collection » Acorn hard disk » misc » misc3 » shipwren/+PTB1
File contents
PROGRAMMING TECHNIQUE by Dominic Ford Part 2: Graphics The most important decision which you must make when you are writing the graphics routines for a program is which graphics mode to use. There is seven different display types available on the Electron, and an eighth is available on the BBC. Each display type has its own characteristics, and you must choose which is most suitable for your particular program. Some graphics modes, for example, allow you to have many different colours on screen, but poor detail, while others allow you to have very great detail but few colours. You select graphics modes by using the MODE x command. Details of the seven different available modes are given below: x Colours Graphics? Res/G Res/T Memory 0 2 Yes 640x256 80x32 20K 1 4 Yes 320x256 40x32 20K 2 16 Yes 160x256 20x32 20K 3 2 No N/A 80x25 16K 4 2 Yes 320x256 40x32 10K 5 4 Yes 160x256 20x32 10K 6 2 No N/A 40x25 8K 7 16 No N/A 40x25 1K <- BBC ONLY! KEY: x: MODE number. Colours: The maximum number of different colours which may be used on screen at any one time. Graphics?: Does this graphics mode allow the use of the graphics commands (ie. MOVE, DRAW, etc.)? Modes 3 & 6 do not allow these commands, as there are thin horizontal stripes in between the rows of characters, in which nothing can be displayed. Thus, any graphics drawn in these modes would have black horizontal stripes across them, and would look rather silly! To see what I mean, turn on your computer and type: MODE 6:COLOUR 129:COLOUR 0:CLS The background should be entirely white, but there are horizontal stripes where the screen can be no colour except black. Res/G: The resolution of the screen in this mode (ie. the number of pixels across and down the screen. Generally, the higher the value, the smoother your graphics will look. Note that this is not the same as the parameters taken by the MOVE and DRAW commands - these always scale the number of pixels across the screen to 1280 and down the screen to 1024, so that (1280,1024) will always be the top-right corner of the screen, and (0,0) the bottom left. Res/T: The number of characters which fit across the screen in this mode when using text. Memory: The amount of the computer's 32K of memory which is used by the graphics mode. If you are writing a long program, this is an important consideration, as you may not have room for the program after subtracting 20K from the computer's 32K RAM for a MODE 2 screen. If this is the case, you must use a mode which uses less memory, such as mode 5. My advice in choosing which mode to use would be to try, if at all possible, to use one of the 20K modes. The detail of MODE 1, and the colours of MODE 2, are both far superior to the quality of MODE 5. If you are an efficient programmer, you should find that it is perfectly possible to fit a reasonably lengthed program into memory at the same time as 20K of screen. Shipwrecked, for example, used MODE 2 for its graphics, as does Shipwrecked II on this issue. Fitting a program into memory as well as a large screen memory is fairly easy when you are using a tape or DFS filing system, but this can prove difficult with ADFS, because 4K of the memory normally used to store programs is taken away for the ADFS to use, leaving you only a mere 4.5K free for programs. Assuming that once you have loaded the program you do not intend to use the disk again, there is a way around this. If you switch over to a tape filing system, the ADFS memory becomes redundant and can be reclaimed for BASIC use. Once you have done this, of course, you cannot access disks without resetting the computer, so load and save options in your program are restricted to tape only. This technique will be explained in greater depth in a later article on memory management. After you have decided which mode to use, and so you know how many colours are available, you must decide what colours these are going to be. In MODE 2, where you have 16 colours, you have access to all of the colours available, and so this choice does not affect you. In 4 colour modes, on the other hand, you only initially have access to black, red, yellow and white. These are a warm selection of colours, but you might want a colder selection in your program, or just simply a set of colours which go well with your screen design. To do this you use the command: VDU 19,logical colour number,actual colour number,0,0,0 The logical colour number is the number that you use with the colour command to select that particular colour. In a four colour mode this must be between 0 and 3, and in a two colour mode this must be either 0 or 1. The actual colour number is the number of the colour which you want to assign to that logical colour. The actual colour numbers are given below: 0-Black 8-Flashing black/white 1-Red 9-Flashing red/cyan 2-Green 10-Flashing grenn/magenta 3-Yellow 11-Flashing yellow/blue 4-Blue 12-Flashing blue/yellow 5-Magenta (purple) 13-Flashing magenta/green 6-Cyan (light blue) 14-Flashing cyan/red 7-White 15-Flashing white/black Looking at the table above, you might wonder what the difference is between flashing black/white and flashing white/black. If you look at them both seperately, there is little difference, but if you look at them together, you see that when one is black the other is white, and vice versa. So, for example, if you put a logo on the screen with the logo in colour 8 and the background in colour 15, the screen flashes between white on black and black on white. To demonstrate this, turn on your Electron and type: MODE 6:VDU 19,1,8,0,0,0:VDU 19,0,15,0,0,0 You can take this further. Four is the maximum number of colours allowed on screen at any one time. Therefore for different screens you can have different selections of colours. The main menu screen might be in warm colours, and then subsequent menu screens in colder colours. The changing of these logical colours is called "Palette Switching". You can go even further and create simply animation using palette switching; an effect which is called "Colour Cycling". If, for example, you put a row of colour 3 above a row of colour 2, with a row of colour 1 below that, and colour 0 at the base. Initially, you set all logical colours to black. Then, if you set logical colour 0 to white, the base appears. Now set logical colour 1 to white as well, the bar moves up the screen. Repeat this with colours 2 and 3, and you have a simple animation. This is even more powerful in MODE 2, where you can go through 16 rows up. This is demonstrated at the end of the tutorial. Having decided which graphics mode you are going to use, and which colours to have on the screen, you must decide how you are going to get your graphics onto the screen. There are many methods for producing graphics, and which you choose depends upon what you want the graphics for, and what you want them to do (and, of course, your programming ability). The most obvious is the PRINT command. This is a quick, easy way of putting text onto the screen. When used with the COLOUR command and the TAB(x,y), many interesting effects can be achieved. These are, however, greatly limited by the fact that only letters can be displayed on the screen. This limitation may be overcome using user defined characters (see the Graphics chapter of the User Manual for details). Even using these characters, however, there are serious limitations. They can only use one colour per character, and so even if you make different characters different colours, your screen will still appear rather dull. Also, they are difficult to use when dealing with large areas of the screen. This is where MOVE, DRAW and PLOT are useful. Using these commands, lines can be drawn across the screen, and, using PLOT, triangles can be drawn. These commands are covered in the Graphics chapter of the user manual. The other major advantage of these graphics commands is that they can be used not just to set the colour of an area, but also to invert it. The GCOL command, which selects the colour in which graphics are displayed, takes two parameters: GCOL x,c c is the new colour in which graphics should be drawn. x selects how this colour should be applyed: x=0 means to set every pixel to that colour, regardless of its previous colour. x=1 means to mix the light from the pixel already on the screen with that of the new colour. For example, if a red pixel is set to blue, the red and blue mix to form purple. x=2 means that the light from the pixels is filtered with the new colour. If a red pixel is set to blue now, it is as if a blue filter has been placed in front of the red light, and the resultant colour is black (red light contains no blue component). x=3 means to invert the old colour with the new colour. x=4 means to set the pixels with the inverse of the new colour (regardless of the old colour). At first sight, it may seem that user defined characters serve no purpose once a programmer has learnt about the more flexible graphics commands, but this is not the case. If you try to produce detailed graphics using MOVE and DRAW, you will find that your program crawls along at an unacceptable rate. User defined characters, on the other hand, can produce detail quickly, especially if the pattern repeats, so that one character definition can be used repeatedly in several areas of the screen. This is demonstrated at the end of the tutorial. So, it seems that programmers are faced with a difficult problem. They can use graphics commands and get colour, or they can use user defined characters and get detail, but what if they want both at the same time? There must be a solution - how else would games like Citadel manage to produce such detailed colourful graphics, and at such a speed? There are, in fact, two possible solutions, both of which involve dealing with an area of memory known as screen memory. This is, however, very complicated, and will be discussed further in the next article.
00000000 50 52 4f 47 52 41 4d 4d 49 4e 47 20 54 45 43 48 |PROGRAMMING TECH| 00000010 4e 49 51 55 45 0a 62 79 20 44 6f 6d 69 6e 69 63 |NIQUE.by Dominic| 00000020 20 46 6f 72 64 0a 50 61 72 74 20 32 3a 20 47 72 | Ford.Part 2: Gr| 00000030 61 70 68 69 63 73 0a 0a 20 20 20 20 20 54 68 65 |aphics.. The| 00000040 20 6d 6f 73 74 20 69 6d 70 6f 72 74 61 6e 74 20 | most important | 00000050 64 65 63 69 73 69 6f 6e 20 77 68 69 63 68 20 79 |decision which y| 00000060 6f 75 20 6d 75 73 74 20 6d 61 6b 65 20 77 68 65 |ou must make whe| 00000070 6e 20 79 6f 75 20 61 72 65 20 0a 77 72 69 74 69 |n you are .writi| 00000080 6e 67 20 74 68 65 20 67 72 61 70 68 69 63 73 20 |ng the graphics | 00000090 72 6f 75 74 69 6e 65 73 20 66 6f 72 20 61 20 70 |routines for a p| 000000a0 72 6f 67 72 61 6d 20 69 73 20 77 68 69 63 68 20 |rogram is which | 000000b0 67 72 61 70 68 69 63 73 20 6d 6f 64 65 20 0a 74 |graphics mode .t| 000000c0 6f 20 75 73 65 2e 20 54 68 65 72 65 20 69 73 20 |o use. There is | 000000d0 73 65 76 65 6e 20 64 69 66 66 65 72 65 6e 74 20 |seven different | 000000e0 64 69 73 70 6c 61 79 20 74 79 70 65 73 20 61 76 |display types av| 000000f0 61 69 6c 61 62 6c 65 20 6f 6e 20 74 68 65 20 0a |ailable on the .| 00000100 45 6c 65 63 74 72 6f 6e 2c 20 61 6e 64 20 61 6e |Electron, and an| 00000110 20 65 69 67 68 74 68 20 69 73 20 61 76 61 69 6c | eighth is avail| 00000120 61 62 6c 65 20 6f 6e 20 74 68 65 20 42 42 43 2e |able on the BBC.| 00000130 20 45 61 63 68 20 64 69 73 70 6c 61 79 20 74 79 | Each display ty| 00000140 70 65 20 0a 68 61 73 20 69 74 73 20 6f 77 6e 20 |pe .has its own | 00000150 63 68 61 72 61 63 74 65 72 69 73 74 69 63 73 2c |characteristics,| 00000160 20 61 6e 64 20 79 6f 75 20 6d 75 73 74 20 63 68 | and you must ch| 00000170 6f 6f 73 65 20 77 68 69 63 68 20 69 73 20 6d 6f |oose which is mo| 00000180 73 74 20 73 75 69 74 61 62 6c 65 20 0a 66 6f 72 |st suitable .for| 00000190 20 79 6f 75 72 20 70 61 72 74 69 63 75 6c 61 72 | your particular| 000001a0 20 70 72 6f 67 72 61 6d 2e 20 53 6f 6d 65 20 67 | program. Some g| 000001b0 72 61 70 68 69 63 73 20 6d 6f 64 65 73 2c 20 66 |raphics modes, f| 000001c0 6f 72 20 65 78 61 6d 70 6c 65 2c 20 61 6c 6c 6f |or example, allo| 000001d0 77 20 0a 79 6f 75 20 74 6f 20 68 61 76 65 20 6d |w .you to have m| 000001e0 61 6e 79 20 64 69 66 66 65 72 65 6e 74 20 63 6f |any different co| 000001f0 6c 6f 75 72 73 20 6f 6e 20 73 63 72 65 65 6e 2c |lours on screen,| 00000200 20 62 75 74 20 70 6f 6f 72 20 64 65 74 61 69 6c | but poor detail| 00000210 2c 20 77 68 69 6c 65 20 0a 6f 74 68 65 72 73 20 |, while .others | 00000220 61 6c 6c 6f 77 20 79 6f 75 20 74 6f 20 68 61 76 |allow you to hav| 00000230 65 20 76 65 72 79 20 67 72 65 61 74 20 64 65 74 |e very great det| 00000240 61 69 6c 20 62 75 74 20 66 65 77 20 63 6f 6c 6f |ail but few colo| 00000250 75 72 73 2e 20 59 6f 75 20 73 65 6c 65 63 74 20 |urs. You select | 00000260 0a 67 72 61 70 68 69 63 73 20 6d 6f 64 65 73 20 |.graphics modes | 00000270 62 79 20 75 73 69 6e 67 20 74 68 65 20 4d 4f 44 |by using the MOD| 00000280 45 20 78 20 63 6f 6d 6d 61 6e 64 2e 20 44 65 74 |E x command. Det| 00000290 61 69 6c 73 20 6f 66 20 74 68 65 20 73 65 76 65 |ails of the seve| 000002a0 6e 20 0a 64 69 66 66 65 72 65 6e 74 20 61 76 61 |n .different ava| 000002b0 69 6c 61 62 6c 65 20 6d 6f 64 65 73 20 61 72 65 |ilable modes are| 000002c0 20 67 69 76 65 6e 20 62 65 6c 6f 77 3a 0a 0a 78 | given below:..x| 000002d0 20 43 6f 6c 6f 75 72 73 20 47 72 61 70 68 69 63 | Colours Graphic| 000002e0 73 3f 20 52 65 73 2f 47 20 20 20 52 65 73 2f 54 |s? Res/G Res/T| 000002f0 20 20 4d 65 6d 6f 72 79 0a 30 20 20 20 32 20 20 | Memory.0 2 | 00000300 20 20 20 20 59 65 73 20 20 20 20 20 20 36 34 30 | Yes 640| 00000310 78 32 35 36 20 38 30 78 33 32 20 20 20 32 30 4b |x256 80x32 20K| 00000320 0a 31 20 20 20 34 20 20 20 20 20 20 59 65 73 20 |.1 4 Yes | 00000330 20 20 20 20 20 33 32 30 78 32 35 36 20 34 30 78 | 320x256 40x| 00000340 33 32 20 20 20 32 30 4b 0a 32 20 20 20 31 36 20 |32 20K.2 16 | 00000350 20 20 20 20 59 65 73 20 20 20 20 20 20 31 36 30 | Yes 160| 00000360 78 32 35 36 20 32 30 78 33 32 20 20 20 32 30 4b |x256 20x32 20K| 00000370 0a 33 20 20 20 32 20 20 20 20 20 20 4e 6f 20 20 |.3 2 No | 00000380 20 20 20 20 20 4e 2f 41 20 20 20 20 20 38 30 78 | N/A 80x| 00000390 32 35 20 20 20 31 36 4b 0a 34 20 20 20 32 20 20 |25 16K.4 2 | 000003a0 20 20 20 20 59 65 73 20 20 20 20 20 20 33 32 30 | Yes 320| 000003b0 78 32 35 36 20 34 30 78 33 32 20 20 20 31 30 4b |x256 40x32 10K| 000003c0 0a 35 20 20 20 34 20 20 20 20 20 20 59 65 73 20 |.5 4 Yes | 000003d0 20 20 20 20 20 31 36 30 78 32 35 36 20 32 30 78 | 160x256 20x| 000003e0 33 32 20 20 20 31 30 4b 0a 36 20 20 20 32 20 20 |32 10K.6 2 | 000003f0 20 20 20 20 4e 6f 20 20 20 20 20 20 20 4e 2f 41 | No N/A| 00000400 20 20 20 20 20 34 30 78 32 35 20 20 20 38 4b 0a | 40x25 8K.| 00000410 37 20 20 20 31 36 20 20 20 20 20 4e 6f 20 20 20 |7 16 No | 00000420 20 20 20 20 4e 2f 41 20 20 20 20 20 34 30 78 32 | N/A 40x2| 00000430 35 20 20 20 31 4b 20 3c 2d 20 42 42 43 20 4f 4e |5 1K <- BBC ON| 00000440 4c 59 21 0a 0a 4b 45 59 3a 0a 0a 78 3a 20 4d 4f |LY!..KEY:..x: MO| 00000450 44 45 20 6e 75 6d 62 65 72 2e 0a 0a 43 6f 6c 6f |DE number...Colo| 00000460 75 72 73 3a 20 54 68 65 20 6d 61 78 69 6d 75 6d |urs: The maximum| 00000470 20 6e 75 6d 62 65 72 20 6f 66 20 64 69 66 66 65 | number of diffe| 00000480 72 65 6e 74 20 63 6f 6c 6f 75 72 73 20 77 68 69 |rent colours whi| 00000490 63 68 20 6d 61 79 20 62 65 20 0a 75 73 65 64 20 |ch may be .used | 000004a0 6f 6e 20 73 63 72 65 65 6e 20 61 74 20 61 6e 79 |on screen at any| 000004b0 20 6f 6e 65 20 74 69 6d 65 2e 0a 0a 47 72 61 70 | one time...Grap| 000004c0 68 69 63 73 3f 3a 20 44 6f 65 73 20 74 68 69 73 |hics?: Does this| 000004d0 20 67 72 61 70 68 69 63 73 20 6d 6f 64 65 20 61 | graphics mode a| 000004e0 6c 6c 6f 77 20 74 68 65 20 75 73 65 20 6f 66 20 |llow the use of | 000004f0 74 68 65 20 67 72 61 70 68 69 63 73 20 0a 63 6f |the graphics .co| 00000500 6d 6d 61 6e 64 73 20 28 69 65 2e 20 4d 4f 56 45 |mmands (ie. MOVE| 00000510 2c 20 44 52 41 57 2c 20 65 74 63 2e 29 3f 20 4d |, DRAW, etc.)? M| 00000520 6f 64 65 73 20 33 20 26 20 36 20 64 6f 20 6e 6f |odes 3 & 6 do no| 00000530 74 20 61 6c 6c 6f 77 20 74 68 65 73 65 20 0a 63 |t allow these .c| 00000540 6f 6d 6d 61 6e 64 73 2c 20 61 73 20 74 68 65 72 |ommands, as ther| 00000550 65 20 61 72 65 20 74 68 69 6e 20 68 6f 72 69 7a |e are thin horiz| 00000560 6f 6e 74 61 6c 20 73 74 72 69 70 65 73 20 69 6e |ontal stripes in| 00000570 20 62 65 74 77 65 65 6e 20 74 68 65 20 72 6f 77 | between the row| 00000580 73 20 0a 6f 66 20 63 68 61 72 61 63 74 65 72 73 |s .of characters| 00000590 2c 20 69 6e 20 77 68 69 63 68 20 6e 6f 74 68 69 |, in which nothi| 000005a0 6e 67 20 63 61 6e 20 62 65 20 64 69 73 70 6c 61 |ng can be displa| 000005b0 79 65 64 2e 20 54 68 75 73 2c 20 61 6e 79 20 67 |yed. Thus, any g| 000005c0 72 61 70 68 69 63 73 20 0a 64 72 61 77 6e 20 69 |raphics .drawn i| 000005d0 6e 20 74 68 65 73 65 20 6d 6f 64 65 73 20 77 6f |n these modes wo| 000005e0 75 6c 64 20 68 61 76 65 20 62 6c 61 63 6b 20 68 |uld have black h| 000005f0 6f 72 69 7a 6f 6e 74 61 6c 20 73 74 72 69 70 65 |orizontal stripe| 00000600 73 20 61 63 72 6f 73 73 20 74 68 65 6d 2c 20 0a |s across them, .| 00000610 61 6e 64 20 77 6f 75 6c 64 20 6c 6f 6f 6b 20 72 |and would look r| 00000620 61 74 68 65 72 20 73 69 6c 6c 79 21 20 54 6f 20 |ather silly! To | 00000630 73 65 65 20 77 68 61 74 20 49 20 6d 65 61 6e 2c |see what I mean,| 00000640 20 74 75 72 6e 20 6f 6e 20 79 6f 75 72 20 63 6f | turn on your co| 00000650 6d 70 75 74 65 72 20 0a 61 6e 64 20 74 79 70 65 |mputer .and type| 00000660 3a 20 4d 4f 44 45 20 36 3a 43 4f 4c 4f 55 52 20 |: MODE 6:COLOUR | 00000670 31 32 39 3a 43 4f 4c 4f 55 52 20 30 3a 43 4c 53 |129:COLOUR 0:CLS| 00000680 0a 54 68 65 20 62 61 63 6b 67 72 6f 75 6e 64 20 |.The background | 00000690 73 68 6f 75 6c 64 20 62 65 20 65 6e 74 69 72 65 |should be entire| 000006a0 6c 79 20 77 68 69 74 65 2c 20 62 75 74 20 74 68 |ly white, but th| 000006b0 65 72 65 20 61 72 65 20 68 6f 72 69 7a 6f 6e 74 |ere are horizont| 000006c0 61 6c 20 0a 73 74 72 69 70 65 73 20 77 68 65 72 |al .stripes wher| 000006d0 65 20 74 68 65 20 73 63 72 65 65 6e 20 63 61 6e |e the screen can| 000006e0 20 62 65 20 6e 6f 20 63 6f 6c 6f 75 72 20 65 78 | be no colour ex| 000006f0 63 65 70 74 20 62 6c 61 63 6b 2e 0a 0a 52 65 73 |cept black...Res| 00000700 2f 47 3a 20 54 68 65 20 72 65 73 6f 6c 75 74 69 |/G: The resoluti| 00000710 6f 6e 20 6f 66 20 74 68 65 20 73 63 72 65 65 6e |on of the screen| 00000720 20 69 6e 20 74 68 69 73 20 6d 6f 64 65 20 28 69 | in this mode (i| 00000730 65 2e 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 |e. the number of| 00000740 20 0a 70 69 78 65 6c 73 20 61 63 72 6f 73 73 20 | .pixels across | 00000750 61 6e 64 20 64 6f 77 6e 20 74 68 65 20 73 63 72 |and down the scr| 00000760 65 65 6e 2e 20 47 65 6e 65 72 61 6c 6c 79 2c 20 |een. Generally, | 00000770 74 68 65 20 68 69 67 68 65 72 20 74 68 65 20 76 |the higher the v| 00000780 61 6c 75 65 2c 20 0a 74 68 65 20 73 6d 6f 6f 74 |alue, .the smoot| 00000790 68 65 72 20 79 6f 75 72 20 67 72 61 70 68 69 63 |her your graphic| 000007a0 73 20 77 69 6c 6c 20 6c 6f 6f 6b 2e 20 4e 6f 74 |s will look. Not| 000007b0 65 20 74 68 61 74 20 74 68 69 73 20 69 73 20 6e |e that this is n| 000007c0 6f 74 20 74 68 65 20 73 61 6d 65 20 0a 61 73 20 |ot the same .as | 000007d0 74 68 65 20 70 61 72 61 6d 65 74 65 72 73 20 74 |the parameters t| 000007e0 61 6b 65 6e 20 62 79 20 74 68 65 20 4d 4f 56 45 |aken by the MOVE| 000007f0 20 61 6e 64 20 44 52 41 57 20 63 6f 6d 6d 61 6e | and DRAW comman| 00000800 64 73 20 2d 20 74 68 65 73 65 20 61 6c 77 61 79 |ds - these alway| 00000810 73 20 0a 73 63 61 6c 65 20 74 68 65 20 6e 75 6d |s .scale the num| 00000820 62 65 72 20 6f 66 20 70 69 78 65 6c 73 20 61 63 |ber of pixels ac| 00000830 72 6f 73 73 20 74 68 65 20 73 63 72 65 65 6e 20 |ross the screen | 00000840 74 6f 20 31 32 38 30 20 61 6e 64 20 64 6f 77 6e |to 1280 and down| 00000850 20 74 68 65 20 73 63 72 65 65 6e 20 0a 74 6f 20 | the screen .to | 00000860 31 30 32 34 2c 20 73 6f 20 74 68 61 74 20 28 31 |1024, so that (1| 00000870 32 38 30 2c 31 30 32 34 29 20 77 69 6c 6c 20 61 |280,1024) will a| 00000880 6c 77 61 79 73 20 62 65 20 74 68 65 20 74 6f 70 |lways be the top| 00000890 2d 72 69 67 68 74 20 63 6f 72 6e 65 72 20 6f 66 |-right corner of| 000008a0 20 74 68 65 20 0a 73 63 72 65 65 6e 2c 20 61 6e | the .screen, an| 000008b0 64 20 28 30 2c 30 29 20 74 68 65 20 62 6f 74 74 |d (0,0) the bott| 000008c0 6f 6d 20 6c 65 66 74 2e 0a 0a 52 65 73 2f 54 3a |om left...Res/T:| 000008d0 20 54 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 63 | The number of c| 000008e0 68 61 72 61 63 74 65 72 73 20 77 68 69 63 68 20 |haracters which | 000008f0 66 69 74 20 61 63 72 6f 73 73 20 74 68 65 20 73 |fit across the s| 00000900 63 72 65 65 6e 20 69 6e 20 74 68 69 73 20 0a 6d |creen in this .m| 00000910 6f 64 65 20 77 68 65 6e 20 75 73 69 6e 67 20 74 |ode when using t| 00000920 65 78 74 2e 0a 0a 4d 65 6d 6f 72 79 3a 20 54 68 |ext...Memory: Th| 00000930 65 20 61 6d 6f 75 6e 74 20 6f 66 20 74 68 65 20 |e amount of the | 00000940 63 6f 6d 70 75 74 65 72 27 73 20 33 32 4b 20 6f |computer's 32K o| 00000950 66 20 6d 65 6d 6f 72 79 20 77 68 69 63 68 20 69 |f memory which i| 00000960 73 20 75 73 65 64 20 62 79 20 0a 74 68 65 20 67 |s used by .the g| 00000970 72 61 70 68 69 63 73 20 6d 6f 64 65 2e 20 49 66 |raphics mode. If| 00000980 20 79 6f 75 20 61 72 65 20 77 72 69 74 69 6e 67 | you are writing| 00000990 20 61 20 6c 6f 6e 67 20 70 72 6f 67 72 61 6d 2c | a long program,| 000009a0 20 74 68 69 73 20 69 73 20 61 6e 20 69 6d 70 6f | this is an impo| 000009b0 72 74 61 6e 74 20 0a 63 6f 6e 73 69 64 65 72 61 |rtant .considera| 000009c0 74 69 6f 6e 2c 20 61 73 20 79 6f 75 20 6d 61 79 |tion, as you may| 000009d0 20 6e 6f 74 20 68 61 76 65 20 72 6f 6f 6d 20 66 | not have room f| 000009e0 6f 72 20 74 68 65 20 70 72 6f 67 72 61 6d 20 61 |or the program a| 000009f0 66 74 65 72 20 0a 73 75 62 74 72 61 63 74 69 6e |fter .subtractin| 00000a00 67 20 32 30 4b 20 66 72 6f 6d 20 74 68 65 20 63 |g 20K from the c| 00000a10 6f 6d 70 75 74 65 72 27 73 20 33 32 4b 20 52 41 |omputer's 32K RA| 00000a20 4d 20 66 6f 72 20 61 20 4d 4f 44 45 20 32 20 73 |M for a MODE 2 s| 00000a30 63 72 65 65 6e 2e 20 49 66 20 74 68 69 73 20 0a |creen. If this .| 00000a40 69 73 20 74 68 65 20 63 61 73 65 2c 20 79 6f 75 |is the case, you| 00000a50 20 6d 75 73 74 20 75 73 65 20 61 20 6d 6f 64 65 | must use a mode| 00000a60 20 77 68 69 63 68 20 75 73 65 73 20 6c 65 73 73 | which uses less| 00000a70 20 6d 65 6d 6f 72 79 2c 20 73 75 63 68 20 61 73 | memory, such as| 00000a80 20 6d 6f 64 65 20 35 2e 0a 0a 20 20 20 20 20 4d | mode 5... M| 00000a90 79 20 61 64 76 69 63 65 20 69 6e 20 63 68 6f 6f |y advice in choo| 00000aa0 73 69 6e 67 20 77 68 69 63 68 20 6d 6f 64 65 20 |sing which mode | 00000ab0 74 6f 20 75 73 65 20 77 6f 75 6c 64 20 62 65 20 |to use would be | 00000ac0 74 6f 20 74 72 79 2c 20 69 66 20 61 74 20 0a 61 |to try, if at .a| 00000ad0 6c 6c 20 70 6f 73 73 69 62 6c 65 2c 20 74 6f 20 |ll possible, to | 00000ae0 75 73 65 20 6f 6e 65 20 6f 66 20 74 68 65 20 32 |use one of the 2| 00000af0 30 4b 20 6d 6f 64 65 73 2e 20 54 68 65 20 64 65 |0K modes. The de| 00000b00 74 61 69 6c 20 6f 66 20 4d 4f 44 45 20 31 2c 20 |tail of MODE 1, | 00000b10 61 6e 64 20 0a 74 68 65 20 63 6f 6c 6f 75 72 73 |and .the colours| 00000b20 20 6f 66 20 4d 4f 44 45 20 32 2c 20 61 72 65 20 | of MODE 2, are | 00000b30 62 6f 74 68 20 66 61 72 20 73 75 70 65 72 69 6f |both far superio| 00000b40 72 20 74 6f 20 74 68 65 20 71 75 61 6c 69 74 79 |r to the quality| 00000b50 20 6f 66 20 4d 4f 44 45 20 35 2e 20 0a 49 66 20 | of MODE 5. .If | 00000b60 79 6f 75 20 61 72 65 20 61 6e 20 65 66 66 69 63 |you are an effic| 00000b70 69 65 6e 74 20 70 72 6f 67 72 61 6d 6d 65 72 2c |ient programmer,| 00000b80 20 79 6f 75 20 73 68 6f 75 6c 64 20 66 69 6e 64 | you should find| 00000b90 20 74 68 61 74 20 69 74 20 69 73 20 70 65 72 66 | that it is perf| 00000ba0 65 63 74 6c 79 20 0a 70 6f 73 73 69 62 6c 65 20 |ectly .possible | 00000bb0 74 6f 20 66 69 74 20 61 20 72 65 61 73 6f 6e 61 |to fit a reasona| 00000bc0 62 6c 79 20 6c 65 6e 67 74 68 65 64 20 70 72 6f |bly lengthed pro| 00000bd0 67 72 61 6d 20 69 6e 74 6f 20 6d 65 6d 6f 72 79 |gram into memory| 00000be0 20 61 74 20 74 68 65 20 73 61 6d 65 20 0a 74 69 | at the same .ti| 00000bf0 6d 65 20 61 73 20 32 30 4b 20 6f 66 20 73 63 72 |me as 20K of scr| 00000c00 65 65 6e 2e 20 53 68 69 70 77 72 65 63 6b 65 64 |een. Shipwrecked| 00000c10 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 75 |, for example, u| 00000c20 73 65 64 20 4d 4f 44 45 20 32 20 66 6f 72 20 69 |sed MODE 2 for i| 00000c30 74 73 20 0a 67 72 61 70 68 69 63 73 2c 20 61 73 |ts .graphics, as| 00000c40 20 64 6f 65 73 20 53 68 69 70 77 72 65 63 6b 65 | does Shipwrecke| 00000c50 64 20 49 49 20 6f 6e 20 74 68 69 73 20 69 73 73 |d II on this iss| 00000c60 75 65 2e 0a 20 20 20 20 20 46 69 74 74 69 6e 67 |ue.. Fitting| 00000c70 20 61 20 70 72 6f 67 72 61 6d 20 69 6e 74 6f 20 | a program into | 00000c80 6d 65 6d 6f 72 79 20 61 73 20 77 65 6c 6c 20 61 |memory as well a| 00000c90 73 20 61 20 6c 61 72 67 65 20 73 63 72 65 65 6e |s a large screen| 00000ca0 20 6d 65 6d 6f 72 79 20 69 73 20 0a 66 61 69 72 | memory is .fair| 00000cb0 6c 79 20 65 61 73 79 20 77 68 65 6e 20 79 6f 75 |ly easy when you| 00000cc0 20 61 72 65 20 75 73 69 6e 67 20 61 20 74 61 70 | are using a tap| 00000cd0 65 20 6f 72 20 44 46 53 20 66 69 6c 69 6e 67 20 |e or DFS filing | 00000ce0 73 79 73 74 65 6d 2c 20 62 75 74 20 74 68 69 73 |system, but this| 00000cf0 20 0a 63 61 6e 20 70 72 6f 76 65 20 64 69 66 66 | .can prove diff| 00000d00 69 63 75 6c 74 20 77 69 74 68 20 41 44 46 53 2c |icult with ADFS,| 00000d10 20 62 65 63 61 75 73 65 20 34 4b 20 6f 66 20 74 | because 4K of t| 00000d20 68 65 20 6d 65 6d 6f 72 79 20 6e 6f 72 6d 61 6c |he memory normal| 00000d30 6c 79 20 75 73 65 64 20 0a 74 6f 20 73 74 6f 72 |ly used .to stor| 00000d40 65 20 70 72 6f 67 72 61 6d 73 20 69 73 20 74 61 |e programs is ta| 00000d50 6b 65 6e 20 61 77 61 79 20 66 6f 72 20 74 68 65 |ken away for the| 00000d60 20 41 44 46 53 20 74 6f 20 75 73 65 2c 20 6c 65 | ADFS to use, le| 00000d70 61 76 69 6e 67 20 79 6f 75 20 6f 6e 6c 79 20 61 |aving you only a| 00000d80 20 0a 6d 65 72 65 20 34 2e 35 4b 20 66 72 65 65 | .mere 4.5K free| 00000d90 20 66 6f 72 20 70 72 6f 67 72 61 6d 73 2e 20 41 | for programs. A| 00000da0 73 73 75 6d 69 6e 67 20 74 68 61 74 20 6f 6e 63 |ssuming that onc| 00000db0 65 20 79 6f 75 20 68 61 76 65 20 6c 6f 61 64 65 |e you have loade| 00000dc0 64 20 74 68 65 20 0a 70 72 6f 67 72 61 6d 20 79 |d the .program y| 00000dd0 6f 75 20 64 6f 20 6e 6f 74 20 69 6e 74 65 6e 64 |ou do not intend| 00000de0 20 74 6f 20 75 73 65 20 74 68 65 20 64 69 73 6b | to use the disk| 00000df0 20 61 67 61 69 6e 2c 20 74 68 65 72 65 20 69 73 | again, there is| 00000e00 20 61 20 77 61 79 20 61 72 6f 75 6e 64 20 0a 74 | a way around .t| 00000e10 68 69 73 2e 20 49 66 20 79 6f 75 20 73 77 69 74 |his. If you swit| 00000e20 63 68 20 6f 76 65 72 20 74 6f 20 61 20 74 61 70 |ch over to a tap| 00000e30 65 20 66 69 6c 69 6e 67 20 73 79 73 74 65 6d 2c |e filing system,| 00000e40 20 74 68 65 20 41 44 46 53 20 6d 65 6d 6f 72 79 | the ADFS memory| 00000e50 20 62 65 63 6f 6d 65 73 20 0a 72 65 64 75 6e 64 | becomes .redund| 00000e60 61 6e 74 20 61 6e 64 20 63 61 6e 20 62 65 20 72 |ant and can be r| 00000e70 65 63 6c 61 69 6d 65 64 20 66 6f 72 20 42 41 53 |eclaimed for BAS| 00000e80 49 43 20 75 73 65 2e 20 4f 6e 63 65 20 79 6f 75 |IC use. Once you| 00000e90 20 68 61 76 65 20 64 6f 6e 65 20 74 68 69 73 2c | have done this,| 00000ea0 20 6f 66 20 0a 63 6f 75 72 73 65 2c 20 79 6f 75 | of .course, you| 00000eb0 20 63 61 6e 6e 6f 74 20 61 63 63 65 73 73 20 64 | cannot access d| 00000ec0 69 73 6b 73 20 77 69 74 68 6f 75 74 20 72 65 73 |isks without res| 00000ed0 65 74 74 69 6e 67 20 74 68 65 20 63 6f 6d 70 75 |etting the compu| 00000ee0 74 65 72 2c 20 73 6f 20 6c 6f 61 64 20 0a 61 6e |ter, so load .an| 00000ef0 64 20 73 61 76 65 20 6f 70 74 69 6f 6e 73 20 69 |d save options i| 00000f00 6e 20 79 6f 75 72 20 70 72 6f 67 72 61 6d 20 61 |n your program a| 00000f10 72 65 20 72 65 73 74 72 69 63 74 65 64 20 74 6f |re restricted to| 00000f20 20 74 61 70 65 20 6f 6e 6c 79 2e 20 54 68 69 73 | tape only. This| 00000f30 20 0a 74 65 63 68 6e 69 71 75 65 20 77 69 6c 6c | .technique will| 00000f40 20 62 65 20 65 78 70 6c 61 69 6e 65 64 20 69 6e | be explained in| 00000f50 20 67 72 65 61 74 65 72 20 64 65 70 74 68 20 69 | greater depth i| 00000f60 6e 20 61 20 6c 61 74 65 72 20 61 72 74 69 63 6c |n a later articl| 00000f70 65 20 6f 6e 20 0a 6d 65 6d 6f 72 79 20 6d 61 6e |e on .memory man| 00000f80 61 67 65 6d 65 6e 74 2e 0a 0a 20 20 20 20 20 41 |agement... A| 00000f90 66 74 65 72 20 79 6f 75 20 68 61 76 65 20 64 65 |fter you have de| 00000fa0 63 69 64 65 64 20 77 68 69 63 68 20 6d 6f 64 65 |cided which mode| 00000fb0 20 74 6f 20 75 73 65 2c 20 61 6e 64 20 73 6f 20 | to use, and so | 00000fc0 79 6f 75 20 6b 6e 6f 77 20 68 6f 77 20 0a 6d 61 |you know how .ma| 00000fd0 6e 79 20 63 6f 6c 6f 75 72 73 20 61 72 65 20 61 |ny colours are a| 00000fe0 76 61 69 6c 61 62 6c 65 2c 20 79 6f 75 20 6d 75 |vailable, you mu| 00000ff0 73 74 20 64 65 63 69 64 65 20 77 68 61 74 20 63 |st decide what c| 00001000 6f 6c 6f 75 72 73 20 74 68 65 73 65 20 61 72 65 |olours these are| 00001010 20 0a 67 6f 69 6e 67 20 74 6f 20 62 65 2e 20 49 | .going to be. I| 00001020 6e 20 4d 4f 44 45 20 32 2c 20 77 68 65 72 65 20 |n MODE 2, where | 00001030 79 6f 75 20 68 61 76 65 20 31 36 20 63 6f 6c 6f |you have 16 colo| 00001040 75 72 73 2c 20 79 6f 75 20 68 61 76 65 20 61 63 |urs, you have ac| 00001050 63 65 73 73 20 0a 74 6f 20 61 6c 6c 20 6f 66 20 |cess .to all of | 00001060 74 68 65 20 63 6f 6c 6f 75 72 73 20 61 76 61 69 |the colours avai| 00001070 6c 61 62 6c 65 2c 20 61 6e 64 20 73 6f 20 74 68 |lable, and so th| 00001080 69 73 20 63 68 6f 69 63 65 20 64 6f 65 73 20 6e |is choice does n| 00001090 6f 74 20 61 66 66 65 63 74 20 0a 79 6f 75 2e 20 |ot affect .you. | 000010a0 49 6e 20 34 20 63 6f 6c 6f 75 72 20 6d 6f 64 65 |In 4 colour mode| 000010b0 73 2c 20 6f 6e 20 74 68 65 20 6f 74 68 65 72 20 |s, on the other | 000010c0 68 61 6e 64 2c 20 79 6f 75 20 6f 6e 6c 79 20 69 |hand, you only i| 000010d0 6e 69 74 69 61 6c 6c 79 20 68 61 76 65 20 0a 61 |nitially have .a| 000010e0 63 63 65 73 73 20 74 6f 20 62 6c 61 63 6b 2c 20 |ccess to black, | 000010f0 72 65 64 2c 20 79 65 6c 6c 6f 77 20 61 6e 64 20 |red, yellow and | 00001100 77 68 69 74 65 2e 20 54 68 65 73 65 20 61 72 65 |white. These are| 00001110 20 61 20 77 61 72 6d 20 73 65 6c 65 63 74 69 6f | a warm selectio| 00001120 6e 20 0a 6f 66 20 63 6f 6c 6f 75 72 73 2c 20 62 |n .of colours, b| 00001130 75 74 20 79 6f 75 20 6d 69 67 68 74 20 77 61 6e |ut you might wan| 00001140 74 20 61 20 63 6f 6c 64 65 72 20 73 65 6c 65 63 |t a colder selec| 00001150 74 69 6f 6e 20 69 6e 20 79 6f 75 72 20 70 72 6f |tion in your pro| 00001160 67 72 61 6d 2c 20 0a 6f 72 20 6a 75 73 74 20 73 |gram, .or just s| 00001170 69 6d 70 6c 79 20 61 20 73 65 74 20 6f 66 20 63 |imply a set of c| 00001180 6f 6c 6f 75 72 73 20 77 68 69 63 68 20 67 6f 20 |olours which go | 00001190 77 65 6c 6c 20 77 69 74 68 20 79 6f 75 72 20 73 |well with your s| 000011a0 63 72 65 65 6e 20 64 65 73 69 67 6e 2e 20 0a 54 |creen design. .T| 000011b0 6f 20 64 6f 20 74 68 69 73 20 79 6f 75 20 75 73 |o do this you us| 000011c0 65 20 74 68 65 20 63 6f 6d 6d 61 6e 64 3a 0a 0a |e the command:..| 000011d0 56 44 55 20 31 39 2c 6c 6f 67 69 63 61 6c 20 63 |VDU 19,logical c| 000011e0 6f 6c 6f 75 72 20 6e 75 6d 62 65 72 2c 61 63 74 |olour number,act| 000011f0 75 61 6c 20 63 6f 6c 6f 75 72 20 6e 75 6d 62 65 |ual colour numbe| 00001200 72 2c 30 2c 30 2c 30 0a 0a 20 20 20 20 20 54 68 |r,0,0,0.. Th| 00001210 65 20 6c 6f 67 69 63 61 6c 20 63 6f 6c 6f 75 72 |e logical colour| 00001220 20 6e 75 6d 62 65 72 20 69 73 20 74 68 65 20 6e | number is the n| 00001230 75 6d 62 65 72 20 74 68 61 74 20 79 6f 75 20 75 |umber that you u| 00001240 73 65 20 77 69 74 68 20 74 68 65 20 0a 63 6f 6c |se with the .col| 00001250 6f 75 72 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 73 |our command to s| 00001260 65 6c 65 63 74 20 74 68 61 74 20 70 61 72 74 69 |elect that parti| 00001270 63 75 6c 61 72 20 63 6f 6c 6f 75 72 2e 20 49 6e |cular colour. In| 00001280 20 61 20 66 6f 75 72 20 63 6f 6c 6f 75 72 20 0a | a four colour .| 00001290 6d 6f 64 65 20 74 68 69 73 20 6d 75 73 74 20 62 |mode this must b| 000012a0 65 20 62 65 74 77 65 65 6e 20 30 20 61 6e 64 20 |e between 0 and | 000012b0 33 2c 20 61 6e 64 20 69 6e 20 61 20 74 77 6f 20 |3, and in a two | 000012c0 63 6f 6c 6f 75 72 20 6d 6f 64 65 20 74 68 69 73 |colour mode this| 000012d0 20 0a 6d 75 73 74 20 62 65 20 65 69 74 68 65 72 | .must be either| 000012e0 20 30 20 6f 72 20 31 2e 20 54 68 65 20 61 63 74 | 0 or 1. The act| 000012f0 75 61 6c 20 63 6f 6c 6f 75 72 20 6e 75 6d 62 65 |ual colour numbe| 00001300 72 20 69 73 20 74 68 65 20 6e 75 6d 62 65 72 20 |r is the number | 00001310 6f 66 20 0a 74 68 65 20 63 6f 6c 6f 75 72 20 77 |of .the colour w| 00001320 68 69 63 68 20 79 6f 75 20 77 61 6e 74 20 74 6f |hich you want to| 00001330 20 61 73 73 69 67 6e 20 74 6f 20 74 68 61 74 20 | assign to that | 00001340 6c 6f 67 69 63 61 6c 20 63 6f 6c 6f 75 72 2e 20 |logical colour. | 00001350 54 68 65 20 0a 61 63 74 75 61 6c 20 63 6f 6c 6f |The .actual colo| 00001360 75 72 20 6e 75 6d 62 65 72 73 20 61 72 65 20 67 |ur numbers are g| 00001370 69 76 65 6e 20 62 65 6c 6f 77 3a 0a 0a 30 2d 42 |iven below:..0-B| 00001380 6c 61 63 6b 20 20 20 20 20 20 20 20 20 20 20 20 |lack | 00001390 20 20 20 38 2d 46 6c 61 73 68 69 6e 67 20 62 6c | 8-Flashing bl| 000013a0 61 63 6b 2f 77 68 69 74 65 0a 31 2d 52 65 64 20 |ack/white.1-Red | 000013b0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 000013c0 39 2d 46 6c 61 73 68 69 6e 67 20 72 65 64 2f 63 |9-Flashing red/c| 000013d0 79 61 6e 0a 32 2d 47 72 65 65 6e 20 20 20 20 20 |yan.2-Green | 000013e0 20 20 20 20 20 20 20 20 20 31 30 2d 46 6c 61 73 | 10-Flas| 000013f0 68 69 6e 67 20 67 72 65 6e 6e 2f 6d 61 67 65 6e |hing grenn/magen| 00001400 74 61 0a 33 2d 59 65 6c 6c 6f 77 20 20 20 20 20 |ta.3-Yellow | 00001410 20 20 20 20 20 20 20 20 31 31 2d 46 6c 61 73 68 | 11-Flash| 00001420 69 6e 67 20 79 65 6c 6c 6f 77 2f 62 6c 75 65 0a |ing yellow/blue.| 00001430 34 2d 42 6c 75 65 20 20 20 20 20 20 20 20 20 20 |4-Blue | 00001440 20 20 20 20 20 31 32 2d 46 6c 61 73 68 69 6e 67 | 12-Flashing| 00001450 20 62 6c 75 65 2f 79 65 6c 6c 6f 77 0a 35 2d 4d | blue/yellow.5-M| 00001460 61 67 65 6e 74 61 20 28 70 75 72 70 6c 65 29 20 |agenta (purple) | 00001470 20 20 31 33 2d 46 6c 61 73 68 69 6e 67 20 6d 61 | 13-Flashing ma| 00001480 67 65 6e 74 61 2f 67 72 65 65 6e 0a 36 2d 43 79 |genta/green.6-Cy| 00001490 61 6e 20 28 6c 69 67 68 74 20 62 6c 75 65 29 20 |an (light blue) | 000014a0 20 31 34 2d 46 6c 61 73 68 69 6e 67 20 63 79 61 | 14-Flashing cya| 000014b0 6e 2f 72 65 64 0a 37 2d 57 68 69 74 65 20 20 20 |n/red.7-White | 000014c0 20 20 20 20 20 20 20 20 20 20 20 31 35 2d 46 6c | 15-Fl| 000014d0 61 73 68 69 6e 67 20 77 68 69 74 65 2f 62 6c 61 |ashing white/bla| 000014e0 63 6b 0a 0a 20 20 20 20 20 4c 6f 6f 6b 69 6e 67 |ck.. Looking| 000014f0 20 61 74 20 74 68 65 20 74 61 62 6c 65 20 61 62 | at the table ab| 00001500 6f 76 65 2c 20 79 6f 75 20 6d 69 67 68 74 20 77 |ove, you might w| 00001510 6f 6e 64 65 72 20 77 68 61 74 20 74 68 65 20 64 |onder what the d| 00001520 69 66 66 65 72 65 6e 63 65 20 0a 69 73 20 62 65 |ifference .is be| 00001530 74 77 65 65 6e 20 66 6c 61 73 68 69 6e 67 20 62 |tween flashing b| 00001540 6c 61 63 6b 2f 77 68 69 74 65 20 61 6e 64 20 66 |lack/white and f| 00001550 6c 61 73 68 69 6e 67 20 77 68 69 74 65 2f 62 6c |lashing white/bl| 00001560 61 63 6b 2e 20 49 66 20 79 6f 75 20 6c 6f 6f 6b |ack. If you look| 00001570 20 0a 61 74 20 74 68 65 6d 20 62 6f 74 68 20 73 | .at them both s| 00001580 65 70 65 72 61 74 65 6c 79 2c 20 74 68 65 72 65 |eperately, there| 00001590 20 69 73 20 6c 69 74 74 6c 65 20 64 69 66 66 65 | is little diffe| 000015a0 72 65 6e 63 65 2c 20 62 75 74 20 69 66 20 79 6f |rence, but if yo| 000015b0 75 20 6c 6f 6f 6b 20 0a 61 74 20 74 68 65 6d 20 |u look .at them | 000015c0 74 6f 67 65 74 68 65 72 2c 20 79 6f 75 20 73 65 |together, you se| 000015d0 65 20 74 68 61 74 20 77 68 65 6e 20 6f 6e 65 20 |e that when one | 000015e0 69 73 20 62 6c 61 63 6b 20 74 68 65 20 6f 74 68 |is black the oth| 000015f0 65 72 20 69 73 20 77 68 69 74 65 2c 20 0a 61 6e |er is white, .an| 00001600 64 20 76 69 63 65 20 76 65 72 73 61 2e 20 53 6f |d vice versa. So| 00001610 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 69 |, for example, i| 00001620 66 20 79 6f 75 20 70 75 74 20 61 20 6c 6f 67 6f |f you put a logo| 00001630 20 6f 6e 20 74 68 65 20 73 63 72 65 65 6e 20 0a | on the screen .| 00001640 77 69 74 68 20 74 68 65 20 6c 6f 67 6f 20 69 6e |with the logo in| 00001650 20 63 6f 6c 6f 75 72 20 38 20 61 6e 64 20 74 68 | colour 8 and th| 00001660 65 20 62 61 63 6b 67 72 6f 75 6e 64 20 69 6e 20 |e background in | 00001670 63 6f 6c 6f 75 72 20 31 35 2c 20 74 68 65 20 0a |colour 15, the .| 00001680 73 63 72 65 65 6e 20 66 6c 61 73 68 65 73 20 62 |screen flashes b| 00001690 65 74 77 65 65 6e 20 77 68 69 74 65 20 6f 6e 20 |etween white on | 000016a0 62 6c 61 63 6b 20 61 6e 64 20 62 6c 61 63 6b 20 |black and black | 000016b0 6f 6e 20 77 68 69 74 65 2e 20 54 6f 20 0a 64 65 |on white. To .de| 000016c0 6d 6f 6e 73 74 72 61 74 65 20 74 68 69 73 2c 20 |monstrate this, | 000016d0 74 75 72 6e 20 6f 6e 20 79 6f 75 72 20 45 6c 65 |turn on your Ele| 000016e0 63 74 72 6f 6e 20 61 6e 64 20 74 79 70 65 3a 0a |ctron and type:.| 000016f0 0a 4d 4f 44 45 20 36 3a 56 44 55 20 31 39 2c 31 |.MODE 6:VDU 19,1| 00001700 2c 38 2c 30 2c 30 2c 30 3a 56 44 55 20 31 39 2c |,8,0,0,0:VDU 19,| 00001710 30 2c 31 35 2c 30 2c 30 2c 30 0a 0a 20 20 20 20 |0,15,0,0,0.. | 00001720 20 59 6f 75 20 63 61 6e 20 74 61 6b 65 20 74 68 | You can take th| 00001730 69 73 20 66 75 72 74 68 65 72 2e 20 46 6f 75 72 |is further. Four| 00001740 20 69 73 20 74 68 65 20 6d 61 78 69 6d 75 6d 20 | is the maximum | 00001750 6e 75 6d 62 65 72 20 6f 66 20 63 6f 6c 6f 75 72 |number of colour| 00001760 73 20 0a 61 6c 6c 6f 77 65 64 20 6f 6e 20 73 63 |s .allowed on sc| 00001770 72 65 65 6e 20 61 74 20 61 6e 79 20 6f 6e 65 20 |reen at any one | 00001780 74 69 6d 65 2e 20 54 68 65 72 65 66 6f 72 65 20 |time. Therefore | 00001790 66 6f 72 20 64 69 66 66 65 72 65 6e 74 20 73 63 |for different sc| 000017a0 72 65 65 6e 73 20 0a 79 6f 75 20 63 61 6e 20 68 |reens .you can h| 000017b0 61 76 65 20 64 69 66 66 65 72 65 6e 74 20 73 65 |ave different se| 000017c0 6c 65 63 74 69 6f 6e 73 20 6f 66 20 63 6f 6c 6f |lections of colo| 000017d0 75 72 73 2e 20 54 68 65 20 6d 61 69 6e 20 6d 65 |urs. The main me| 000017e0 6e 75 20 73 63 72 65 65 6e 20 0a 6d 69 67 68 74 |nu screen .might| 000017f0 20 62 65 20 69 6e 20 77 61 72 6d 20 63 6f 6c 6f | be in warm colo| 00001800 75 72 73 2c 20 61 6e 64 20 74 68 65 6e 20 73 75 |urs, and then su| 00001810 62 73 65 71 75 65 6e 74 20 6d 65 6e 75 20 73 63 |bsequent menu sc| 00001820 72 65 65 6e 73 20 69 6e 20 63 6f 6c 64 65 72 20 |reens in colder | 00001830 0a 63 6f 6c 6f 75 72 73 2e 20 54 68 65 20 63 68 |.colours. The ch| 00001840 61 6e 67 69 6e 67 20 6f 66 20 74 68 65 73 65 20 |anging of these | 00001850 6c 6f 67 69 63 61 6c 20 63 6f 6c 6f 75 72 73 20 |logical colours | 00001860 69 73 20 63 61 6c 6c 65 64 20 22 50 61 6c 65 74 |is called "Palet| 00001870 74 65 20 0a 53 77 69 74 63 68 69 6e 67 22 2e 20 |te .Switching". | 00001880 59 6f 75 20 63 61 6e 20 67 6f 20 65 76 65 6e 20 |You can go even | 00001890 66 75 72 74 68 65 72 20 61 6e 64 20 63 72 65 61 |further and crea| 000018a0 74 65 20 73 69 6d 70 6c 79 20 61 6e 69 6d 61 74 |te simply animat| 000018b0 69 6f 6e 20 0a 75 73 69 6e 67 20 70 61 6c 65 74 |ion .using palet| 000018c0 74 65 20 73 77 69 74 63 68 69 6e 67 3b 20 61 6e |te switching; an| 000018d0 20 65 66 66 65 63 74 20 77 68 69 63 68 20 69 73 | effect which is| 000018e0 20 63 61 6c 6c 65 64 20 22 43 6f 6c 6f 75 72 20 | called "Colour | 000018f0 43 79 63 6c 69 6e 67 22 2e 20 0a 49 66 2c 20 66 |Cycling". .If, f| 00001900 6f 72 20 65 78 61 6d 70 6c 65 2c 20 79 6f 75 20 |or example, you | 00001910 70 75 74 20 61 20 72 6f 77 20 6f 66 20 63 6f 6c |put a row of col| 00001920 6f 75 72 20 33 20 61 62 6f 76 65 20 61 20 72 6f |our 3 above a ro| 00001930 77 20 6f 66 20 63 6f 6c 6f 75 72 20 32 2c 20 0a |w of colour 2, .| 00001940 77 69 74 68 20 61 20 72 6f 77 20 6f 66 20 63 6f |with a row of co| 00001950 6c 6f 75 72 20 31 20 62 65 6c 6f 77 20 74 68 61 |lour 1 below tha| 00001960 74 2c 20 61 6e 64 20 63 6f 6c 6f 75 72 20 30 20 |t, and colour 0 | 00001970 61 74 20 74 68 65 20 62 61 73 65 2e 20 0a 49 6e |at the base. .In| 00001980 69 74 69 61 6c 6c 79 2c 20 79 6f 75 20 73 65 74 |itially, you set| 00001990 20 61 6c 6c 20 6c 6f 67 69 63 61 6c 20 63 6f 6c | all logical col| 000019a0 6f 75 72 73 20 74 6f 20 62 6c 61 63 6b 2e 20 54 |ours to black. T| 000019b0 68 65 6e 2c 20 69 66 20 79 6f 75 20 0a 73 65 74 |hen, if you .set| 000019c0 20 6c 6f 67 69 63 61 6c 20 63 6f 6c 6f 75 72 20 | logical colour | 000019d0 30 20 74 6f 20 77 68 69 74 65 2c 20 74 68 65 20 |0 to white, the | 000019e0 62 61 73 65 20 61 70 70 65 61 72 73 2e 20 4e 6f |base appears. No| 000019f0 77 20 73 65 74 20 6c 6f 67 69 63 61 6c 20 0a 63 |w set logical .c| 00001a00 6f 6c 6f 75 72 20 31 20 74 6f 20 77 68 69 74 65 |olour 1 to white| 00001a10 20 61 73 20 77 65 6c 6c 2c 20 74 68 65 20 62 61 | as well, the ba| 00001a20 72 20 6d 6f 76 65 73 20 75 70 20 74 68 65 20 73 |r moves up the s| 00001a30 63 72 65 65 6e 2e 20 52 65 70 65 61 74 20 0a 74 |creen. Repeat .t| 00001a40 68 69 73 20 77 69 74 68 20 63 6f 6c 6f 75 72 73 |his with colours| 00001a50 20 32 20 61 6e 64 20 33 2c 20 61 6e 64 20 79 6f | 2 and 3, and yo| 00001a60 75 20 68 61 76 65 20 61 20 73 69 6d 70 6c 65 20 |u have a simple | 00001a70 61 6e 69 6d 61 74 69 6f 6e 2e 20 54 68 69 73 20 |animation. This | 00001a80 0a 69 73 20 65 76 65 6e 20 6d 6f 72 65 20 70 6f |.is even more po| 00001a90 77 65 72 66 75 6c 20 69 6e 20 4d 4f 44 45 20 32 |werful in MODE 2| 00001aa0 2c 20 77 68 65 72 65 20 79 6f 75 20 63 61 6e 20 |, where you can | 00001ab0 67 6f 20 74 68 72 6f 75 67 68 20 31 36 20 72 6f |go through 16 ro| 00001ac0 77 73 20 0a 75 70 2e 20 54 68 69 73 20 69 73 20 |ws .up. This is | 00001ad0 64 65 6d 6f 6e 73 74 72 61 74 65 64 20 61 74 20 |demonstrated at | 00001ae0 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 74 |the end of the t| 00001af0 75 74 6f 72 69 61 6c 2e 0a 20 20 20 20 20 48 61 |utorial.. Ha| 00001b00 76 69 6e 67 20 64 65 63 69 64 65 64 20 77 68 69 |ving decided whi| 00001b10 63 68 20 67 72 61 70 68 69 63 73 20 6d 6f 64 65 |ch graphics mode| 00001b20 20 79 6f 75 20 61 72 65 20 67 6f 69 6e 67 20 74 | you are going t| 00001b30 6f 20 75 73 65 2c 20 61 6e 64 20 0a 77 68 69 63 |o use, and .whic| 00001b40 68 20 63 6f 6c 6f 75 72 73 20 74 6f 20 68 61 76 |h colours to hav| 00001b50 65 20 6f 6e 20 74 68 65 20 73 63 72 65 65 6e 2c |e on the screen,| 00001b60 20 79 6f 75 20 0a 6d 75 73 74 20 64 65 63 69 64 | you .must decid| 00001b70 65 20 68 6f 77 20 79 6f 75 20 61 72 65 20 67 6f |e how you are go| 00001b80 69 6e 67 20 74 6f 20 67 65 74 20 79 6f 75 72 20 |ing to get your | 00001b90 67 72 61 70 68 69 63 73 20 6f 6e 74 6f 20 74 68 |graphics onto th| 00001ba0 65 20 73 63 72 65 65 6e 2e 20 0a 54 68 65 72 65 |e screen. .There| 00001bb0 20 61 72 65 20 6d 61 6e 79 20 6d 65 74 68 6f 64 | are many method| 00001bc0 73 20 66 6f 72 20 70 72 6f 64 75 63 69 6e 67 20 |s for producing | 00001bd0 67 72 61 70 68 69 63 73 2c 20 61 6e 64 20 77 68 |graphics, and wh| 00001be0 69 63 68 20 79 6f 75 20 0a 63 68 6f 6f 73 65 20 |ich you .choose | 00001bf0 64 65 70 65 6e 64 73 20 75 70 6f 6e 20 77 68 61 |depends upon wha| 00001c00 74 20 79 6f 75 20 77 61 6e 74 20 74 68 65 20 67 |t you want the g| 00001c10 72 61 70 68 69 63 73 20 66 6f 72 2c 20 61 6e 64 |raphics for, and| 00001c20 20 77 68 61 74 20 79 6f 75 20 0a 77 61 6e 74 20 | what you .want | 00001c30 74 68 65 6d 20 74 6f 20 64 6f 20 28 61 6e 64 2c |them to do (and,| 00001c40 20 6f 66 20 63 6f 75 72 73 65 2c 20 79 6f 75 72 | of course, your| 00001c50 20 70 72 6f 67 72 61 6d 6d 69 6e 67 20 61 62 69 | programming abi| 00001c60 6c 69 74 79 29 2e 20 54 68 65 20 0a 6d 6f 73 74 |lity). The .most| 00001c70 20 6f 62 76 69 6f 75 73 20 69 73 20 74 68 65 20 | obvious is the | 00001c80 50 52 49 4e 54 20 63 6f 6d 6d 61 6e 64 2e 20 54 |PRINT command. T| 00001c90 68 69 73 20 69 73 20 61 20 71 75 69 63 6b 2c 20 |his is a quick, | 00001ca0 65 61 73 79 20 77 61 79 20 6f 66 20 0a 70 75 74 |easy way of .put| 00001cb0 74 69 6e 67 20 74 65 78 74 20 6f 6e 74 6f 20 74 |ting text onto t| 00001cc0 68 65 20 73 63 72 65 65 6e 2e 20 57 68 65 6e 20 |he screen. When | 00001cd0 75 73 65 64 20 77 69 74 68 20 74 68 65 20 43 4f |used with the CO| 00001ce0 4c 4f 55 52 20 63 6f 6d 6d 61 6e 64 20 0a 61 6e |LOUR command .an| 00001cf0 64 20 74 68 65 20 54 41 42 28 78 2c 79 29 2c 20 |d the TAB(x,y), | 00001d00 6d 61 6e 79 20 69 6e 74 65 72 65 73 74 69 6e 67 |many interesting| 00001d10 20 65 66 66 65 63 74 73 20 63 61 6e 20 62 65 20 | effects can be | 00001d20 61 63 68 69 65 76 65 64 2e 20 0a 54 68 65 73 65 |achieved. .These| 00001d30 20 61 72 65 2c 20 68 6f 77 65 76 65 72 2c 20 67 | are, however, g| 00001d40 72 65 61 74 6c 79 20 6c 69 6d 69 74 65 64 20 62 |reatly limited b| 00001d50 79 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 |y the fact that | 00001d60 6f 6e 6c 79 20 6c 65 74 74 65 72 73 20 0a 63 61 |only letters .ca| 00001d70 6e 20 62 65 20 64 69 73 70 6c 61 79 65 64 20 6f |n be displayed o| 00001d80 6e 20 74 68 65 20 73 63 72 65 65 6e 2e 20 54 68 |n the screen. Th| 00001d90 69 73 20 6c 69 6d 69 74 61 74 69 6f 6e 20 6d 61 |is limitation ma| 00001da0 79 20 62 65 20 6f 76 65 72 63 6f 6d 65 20 75 73 |y be overcome us| 00001db0 69 6e 67 20 0a 75 73 65 72 20 64 65 66 69 6e 65 |ing .user define| 00001dc0 64 20 63 68 61 72 61 63 74 65 72 73 20 28 73 65 |d characters (se| 00001dd0 65 20 74 68 65 20 47 72 61 70 68 69 63 73 20 63 |e the Graphics c| 00001de0 68 61 70 74 65 72 20 6f 66 20 74 68 65 20 55 73 |hapter of the Us| 00001df0 65 72 20 4d 61 6e 75 61 6c 20 0a 66 6f 72 20 64 |er Manual .for d| 00001e00 65 74 61 69 6c 73 29 2e 20 45 76 65 6e 20 75 73 |etails). Even us| 00001e10 69 6e 67 20 74 68 65 73 65 20 63 68 61 72 61 63 |ing these charac| 00001e20 74 65 72 73 2c 20 68 6f 77 65 76 65 72 2c 20 74 |ters, however, t| 00001e30 68 65 72 65 20 61 72 65 20 73 65 72 69 6f 75 73 |here are serious| 00001e40 20 0a 6c 69 6d 69 74 61 74 69 6f 6e 73 2e 20 54 | .limitations. T| 00001e50 68 65 79 20 63 61 6e 20 6f 6e 6c 79 20 75 73 65 |hey can only use| 00001e60 20 6f 6e 65 20 63 6f 6c 6f 75 72 20 70 65 72 20 | one colour per | 00001e70 63 68 61 72 61 63 74 65 72 2c 20 61 6e 64 20 73 |character, and s| 00001e80 6f 20 65 76 65 6e 20 0a 69 66 20 79 6f 75 20 6d |o even .if you m| 00001e90 61 6b 65 20 64 69 66 66 65 72 65 6e 74 20 63 68 |ake different ch| 00001ea0 61 72 61 63 74 65 72 73 20 64 69 66 66 65 72 65 |aracters differe| 00001eb0 6e 74 20 63 6f 6c 6f 75 72 73 2c 20 79 6f 75 72 |nt colours, your| 00001ec0 20 73 63 72 65 65 6e 20 77 69 6c 6c 20 0a 73 74 | screen will .st| 00001ed0 69 6c 6c 20 61 70 70 65 61 72 20 72 61 74 68 65 |ill appear rathe| 00001ee0 72 20 64 75 6c 6c 2e 20 41 6c 73 6f 2c 20 74 68 |r dull. Also, th| 00001ef0 65 79 20 61 72 65 20 64 69 66 66 69 63 75 6c 74 |ey are difficult| 00001f00 20 74 6f 20 75 73 65 20 77 68 65 6e 20 0a 64 65 | to use when .de| 00001f10 61 6c 69 6e 67 20 77 69 74 68 20 6c 61 72 67 65 |aling with large| 00001f20 20 61 72 65 61 73 20 6f 66 20 74 68 65 20 73 63 | areas of the sc| 00001f30 72 65 65 6e 2e 20 0a 20 20 20 20 20 54 68 69 73 |reen. . This| 00001f40 20 69 73 20 77 68 65 72 65 20 4d 4f 56 45 2c 20 | is where MOVE, | 00001f50 44 52 41 57 20 61 6e 64 20 50 4c 4f 54 20 61 72 |DRAW and PLOT ar| 00001f60 65 20 75 73 65 66 75 6c 2e 20 55 73 69 6e 67 20 |e useful. Using | 00001f70 74 68 65 73 65 20 0a 63 6f 6d 6d 61 6e 64 73 2c |these .commands,| 00001f80 20 6c 69 6e 65 73 20 63 61 6e 20 62 65 20 64 72 | lines can be dr| 00001f90 61 77 6e 20 61 63 72 6f 73 73 20 74 68 65 20 73 |awn across the s| 00001fa0 63 72 65 65 6e 2c 20 61 6e 64 2c 20 75 73 69 6e |creen, and, usin| 00001fb0 67 20 50 4c 4f 54 2c 20 0a 74 72 69 61 6e 67 6c |g PLOT, .triangl| 00001fc0 65 73 20 63 61 6e 20 62 65 20 64 72 61 77 6e 2e |es can be drawn.| 00001fd0 20 54 68 65 73 65 20 63 6f 6d 6d 61 6e 64 73 20 | These commands | 00001fe0 61 72 65 20 63 6f 76 65 72 65 64 20 69 6e 20 74 |are covered in t| 00001ff0 68 65 20 0a 47 72 61 70 68 69 63 73 20 63 68 61 |he .Graphics cha| 00002000 70 74 65 72 20 6f 66 20 74 68 65 20 75 73 65 72 |pter of the user| 00002010 20 6d 61 6e 75 61 6c 2e 20 54 68 65 20 6f 74 68 | manual. The oth| 00002020 65 72 20 6d 61 6a 6f 72 20 61 64 76 61 6e 74 61 |er major advanta| 00002030 67 65 20 6f 66 20 0a 74 68 65 73 65 20 67 72 61 |ge of .these gra| 00002040 70 68 69 63 73 20 63 6f 6d 6d 61 6e 64 73 20 69 |phics commands i| 00002050 73 20 74 68 61 74 20 74 68 65 79 20 63 61 6e 20 |s that they can | 00002060 62 65 20 75 73 65 64 20 6e 6f 74 20 6a 75 73 74 |be used not just| 00002070 20 74 6f 20 73 65 74 20 0a 74 68 65 20 63 6f 6c | to set .the col| 00002080 6f 75 72 20 6f 66 20 61 6e 20 61 72 65 61 2c 20 |our of an area, | 00002090 62 75 74 20 61 6c 73 6f 20 74 6f 20 69 6e 76 65 |but also to inve| 000020a0 72 74 20 69 74 2e 20 54 68 65 20 47 43 4f 4c 20 |rt it. The GCOL | 000020b0 63 6f 6d 6d 61 6e 64 2c 20 0a 77 68 69 63 68 20 |command, .which | 000020c0 73 65 6c 65 63 74 73 20 74 68 65 20 63 6f 6c 6f |selects the colo| 000020d0 75 72 20 69 6e 20 77 68 69 63 68 20 67 72 61 70 |ur in which grap| 000020e0 68 69 63 73 20 61 72 65 20 64 69 73 70 6c 61 79 |hics are display| 000020f0 65 64 2c 20 74 61 6b 65 73 20 0a 74 77 6f 20 70 |ed, takes .two p| 00002100 61 72 61 6d 65 74 65 72 73 3a 0a 0a 47 43 4f 4c |arameters:..GCOL| 00002110 20 78 2c 63 0a 0a 63 20 69 73 20 74 68 65 20 6e | x,c..c is the n| 00002120 65 77 20 63 6f 6c 6f 75 72 20 69 6e 20 77 68 69 |ew colour in whi| 00002130 63 68 20 67 72 61 70 68 69 63 73 20 73 68 6f 75 |ch graphics shou| 00002140 6c 64 20 62 65 20 64 72 61 77 6e 2e 0a 78 20 73 |ld be drawn..x s| 00002150 65 6c 65 63 74 73 20 68 6f 77 20 74 68 69 73 20 |elects how this | 00002160 63 6f 6c 6f 75 72 20 73 68 6f 75 6c 64 20 62 65 |colour should be| 00002170 20 61 70 70 6c 79 65 64 3a 0a 0a 78 3d 30 20 6d | applyed:..x=0 m| 00002180 65 61 6e 73 20 74 6f 20 73 65 74 20 65 76 65 72 |eans to set ever| 00002190 79 20 70 69 78 65 6c 20 74 6f 20 74 68 61 74 20 |y pixel to that | 000021a0 63 6f 6c 6f 75 72 2c 20 72 65 67 61 72 64 6c 65 |colour, regardle| 000021b0 73 73 20 6f 66 20 69 74 73 20 0a 70 72 65 76 69 |ss of its .previ| 000021c0 6f 75 73 20 63 6f 6c 6f 75 72 2e 0a 78 3d 31 20 |ous colour..x=1 | 000021d0 6d 65 61 6e 73 20 74 6f 20 6d 69 78 20 74 68 65 |means to mix the| 000021e0 20 6c 69 67 68 74 20 66 72 6f 6d 20 74 68 65 20 | light from the | 000021f0 70 69 78 65 6c 20 61 6c 72 65 61 64 79 20 6f 6e |pixel already on| 00002200 20 74 68 65 20 73 63 72 65 65 6e 20 0a 77 69 74 | the screen .wit| 00002210 68 20 74 68 61 74 20 6f 66 20 74 68 65 20 6e 65 |h that of the ne| 00002220 77 20 63 6f 6c 6f 75 72 2e 20 46 6f 72 20 65 78 |w colour. For ex| 00002230 61 6d 70 6c 65 2c 20 69 66 20 61 20 72 65 64 20 |ample, if a red | 00002240 70 69 78 65 6c 20 69 73 20 73 65 74 20 0a 74 6f |pixel is set .to| 00002250 20 62 6c 75 65 2c 20 74 68 65 20 72 65 64 20 61 | blue, the red a| 00002260 6e 64 20 62 6c 75 65 20 6d 69 78 20 74 6f 20 66 |nd blue mix to f| 00002270 6f 72 6d 20 70 75 72 70 6c 65 2e 0a 78 3d 32 20 |orm purple..x=2 | 00002280 6d 65 61 6e 73 20 74 68 61 74 20 74 68 65 20 6c |means that the l| 00002290 69 67 68 74 20 66 72 6f 6d 20 74 68 65 20 70 69 |ight from the pi| 000022a0 78 65 6c 73 20 69 73 20 66 69 6c 74 65 72 65 64 |xels is filtered| 000022b0 20 77 69 74 68 20 74 68 65 20 6e 65 77 20 0a 63 | with the new .c| 000022c0 6f 6c 6f 75 72 2e 20 49 66 20 61 20 72 65 64 20 |olour. If a red | 000022d0 70 69 78 65 6c 20 69 73 20 73 65 74 20 74 6f 20 |pixel is set to | 000022e0 62 6c 75 65 20 6e 6f 77 2c 20 69 74 20 69 73 20 |blue now, it is | 000022f0 61 73 20 69 66 20 61 20 62 6c 75 65 20 0a 66 69 |as if a blue .fi| 00002300 6c 74 65 72 20 68 61 73 20 62 65 65 6e 20 70 6c |lter has been pl| 00002310 61 63 65 64 20 69 6e 20 66 72 6f 6e 74 20 6f 66 |aced in front of| 00002320 20 74 68 65 20 72 65 64 20 6c 69 67 68 74 2c 20 | the red light, | 00002330 61 6e 64 20 74 68 65 20 0a 72 65 73 75 6c 74 61 |and the .resulta| 00002340 6e 74 20 63 6f 6c 6f 75 72 20 69 73 20 62 6c 61 |nt colour is bla| 00002350 63 6b 20 28 72 65 64 20 6c 69 67 68 74 20 63 6f |ck (red light co| 00002360 6e 74 61 69 6e 73 20 6e 6f 20 62 6c 75 65 20 63 |ntains no blue c| 00002370 6f 6d 70 6f 6e 65 6e 74 29 2e 0a 78 3d 33 20 6d |omponent)..x=3 m| 00002380 65 61 6e 73 20 74 6f 20 69 6e 76 65 72 74 20 74 |eans to invert t| 00002390 68 65 20 6f 6c 64 20 63 6f 6c 6f 75 72 20 77 69 |he old colour wi| 000023a0 74 68 20 74 68 65 20 6e 65 77 20 63 6f 6c 6f 75 |th the new colou| 000023b0 72 2e 0a 78 3d 34 20 6d 65 61 6e 73 20 74 6f 20 |r..x=4 means to | 000023c0 73 65 74 20 74 68 65 20 70 69 78 65 6c 73 20 77 |set the pixels w| 000023d0 69 74 68 20 74 68 65 20 69 6e 76 65 72 73 65 20 |ith the inverse | 000023e0 6f 66 20 74 68 65 20 6e 65 77 20 63 6f 6c 6f 75 |of the new colou| 000023f0 72 20 0a 28 72 65 67 61 72 64 6c 65 73 73 20 6f |r .(regardless o| 00002400 66 20 74 68 65 20 6f 6c 64 20 63 6f 6c 6f 75 72 |f the old colour| 00002410 29 2e 0a 0a 20 20 20 20 20 41 74 20 66 69 72 73 |)... At firs| 00002420 74 20 73 69 67 68 74 2c 20 69 74 20 6d 61 79 20 |t sight, it may | 00002430 73 65 65 6d 20 74 68 61 74 20 75 73 65 72 20 64 |seem that user d| 00002440 65 66 69 6e 65 64 20 63 68 61 72 61 63 74 65 72 |efined character| 00002450 73 20 73 65 72 76 65 20 0a 6e 6f 20 70 75 72 70 |s serve .no purp| 00002460 6f 73 65 20 6f 6e 63 65 20 61 20 70 72 6f 67 72 |ose once a progr| 00002470 61 6d 6d 65 72 20 68 61 73 20 6c 65 61 72 6e 74 |ammer has learnt| 00002480 20 61 62 6f 75 74 20 74 68 65 20 6d 6f 72 65 20 | about the more | 00002490 66 6c 65 78 69 62 6c 65 20 0a 67 72 61 70 68 69 |flexible .graphi| 000024a0 63 73 20 63 6f 6d 6d 61 6e 64 73 2c 20 62 75 74 |cs commands, but| 000024b0 20 74 68 69 73 20 69 73 20 6e 6f 74 20 74 68 65 | this is not the| 000024c0 20 63 61 73 65 2e 20 49 66 20 79 6f 75 20 74 72 | case. If you tr| 000024d0 79 20 74 6f 20 70 72 6f 64 75 63 65 20 0a 64 65 |y to produce .de| 000024e0 74 61 69 6c 65 64 20 67 72 61 70 68 69 63 73 20 |tailed graphics | 000024f0 75 73 69 6e 67 20 4d 4f 56 45 20 61 6e 64 20 44 |using MOVE and D| 00002500 52 41 57 2c 20 79 6f 75 20 77 69 6c 6c 20 66 69 |RAW, you will fi| 00002510 6e 64 20 74 68 61 74 20 79 6f 75 72 20 0a 70 72 |nd that your .pr| 00002520 6f 67 72 61 6d 20 63 72 61 77 6c 73 20 61 6c 6f |ogram crawls alo| 00002530 6e 67 20 61 74 20 61 6e 20 75 6e 61 63 63 65 70 |ng at an unaccep| 00002540 74 61 62 6c 65 20 72 61 74 65 2e 20 55 73 65 72 |table rate. User| 00002550 20 64 65 66 69 6e 65 64 20 63 68 61 72 61 63 74 | defined charact| 00002560 65 72 73 2c 20 0a 6f 6e 20 74 68 65 20 6f 74 68 |ers, .on the oth| 00002570 65 72 20 68 61 6e 64 2c 20 63 61 6e 20 70 72 6f |er hand, can pro| 00002580 64 75 63 65 20 64 65 74 61 69 6c 20 71 75 69 63 |duce detail quic| 00002590 6b 6c 79 2c 20 65 73 70 65 63 69 61 6c 6c 79 20 |kly, especially | 000025a0 69 66 20 74 68 65 20 0a 70 61 74 74 65 72 6e 20 |if the .pattern | 000025b0 72 65 70 65 61 74 73 2c 20 73 6f 20 74 68 61 74 |repeats, so that| 000025c0 20 6f 6e 65 20 63 68 61 72 61 63 74 65 72 20 64 | one character d| 000025d0 65 66 69 6e 69 74 69 6f 6e 20 63 61 6e 20 62 65 |efinition can be| 000025e0 20 75 73 65 64 20 0a 72 65 70 65 61 74 65 64 6c | used .repeatedl| 000025f0 79 20 69 6e 20 73 65 76 65 72 61 6c 20 61 72 65 |y in several are| 00002600 61 73 20 6f 66 20 74 68 65 20 73 63 72 65 65 6e |as of the screen| 00002610 2e 20 54 68 69 73 20 69 73 20 64 65 6d 6f 6e 73 |. This is demons| 00002620 74 72 61 74 65 64 20 61 74 20 0a 74 68 65 20 65 |trated at .the e| 00002630 6e 64 20 6f 66 20 74 68 65 20 74 75 74 6f 72 69 |nd of the tutori| 00002640 61 6c 2e 0a 20 20 20 20 20 53 6f 2c 20 69 74 20 |al.. So, it | 00002650 73 65 65 6d 73 20 74 68 61 74 20 70 72 6f 67 72 |seems that progr| 00002660 61 6d 6d 65 72 73 20 61 72 65 20 66 61 63 65 64 |ammers are faced| 00002670 20 77 69 74 68 20 61 20 64 69 66 66 69 63 75 6c | with a difficul| 00002680 74 20 0a 70 72 6f 62 6c 65 6d 2e 20 54 68 65 79 |t .problem. They| 00002690 20 63 61 6e 20 75 73 65 20 67 72 61 70 68 69 63 | can use graphic| 000026a0 73 20 63 6f 6d 6d 61 6e 64 73 20 61 6e 64 20 67 |s commands and g| 000026b0 65 74 20 63 6f 6c 6f 75 72 2c 20 6f 72 20 74 68 |et colour, or th| 000026c0 65 79 20 0a 63 61 6e 20 75 73 65 20 75 73 65 72 |ey .can use user| 000026d0 20 64 65 66 69 6e 65 64 20 63 68 61 72 61 63 74 | defined charact| 000026e0 65 72 73 20 61 6e 64 20 67 65 74 20 64 65 74 61 |ers and get deta| 000026f0 69 6c 2c 20 62 75 74 20 77 68 61 74 20 69 66 20 |il, but what if | 00002700 74 68 65 79 20 0a 77 61 6e 74 20 62 6f 74 68 20 |they .want both | 00002710 61 74 20 74 68 65 20 73 61 6d 65 20 74 69 6d 65 |at the same time| 00002720 3f 20 54 68 65 72 65 20 6d 75 73 74 20 62 65 20 |? There must be | 00002730 61 20 73 6f 6c 75 74 69 6f 6e 20 2d 20 68 6f 77 |a solution - how| 00002740 20 65 6c 73 65 20 0a 77 6f 75 6c 64 20 67 61 6d | else .would gam| 00002750 65 73 20 6c 69 6b 65 20 43 69 74 61 64 65 6c 20 |es like Citadel | 00002760 6d 61 6e 61 67 65 20 74 6f 20 70 72 6f 64 75 63 |manage to produc| 00002770 65 20 73 75 63 68 20 64 65 74 61 69 6c 65 64 20 |e such detailed | 00002780 0a 63 6f 6c 6f 75 72 66 75 6c 20 67 72 61 70 68 |.colourful graph| 00002790 69 63 73 2c 20 61 6e 64 20 61 74 20 73 75 63 68 |ics, and at such| 000027a0 20 61 20 73 70 65 65 64 3f 0a 20 20 20 20 20 54 | a speed?. T| 000027b0 68 65 72 65 20 61 72 65 2c 20 69 6e 20 66 61 63 |here are, in fac| 000027c0 74 2c 20 74 77 6f 20 70 6f 73 73 69 62 6c 65 20 |t, two possible | 000027d0 73 6f 6c 75 74 69 6f 6e 73 2c 20 62 6f 74 68 20 |solutions, both | 000027e0 6f 66 20 77 68 69 63 68 20 0a 69 6e 76 6f 6c 76 |of which .involv| 000027f0 65 20 64 65 61 6c 69 6e 67 20 77 69 74 68 20 61 |e dealing with a| 00002800 6e 20 61 72 65 61 20 6f 66 20 6d 65 6d 6f 72 79 |n area of memory| 00002810 20 6b 6e 6f 77 6e 20 61 73 20 73 63 72 65 65 6e | known as screen| 00002820 20 6d 65 6d 6f 72 79 2e 20 0a 54 68 69 73 20 69 | memory. .This i| 00002830 73 2c 20 68 6f 77 65 76 65 72 2c 20 76 65 72 79 |s, however, very| 00002840 20 63 6f 6d 70 6c 69 63 61 74 65 64 2c 20 61 6e | complicated, an| 00002850 64 20 77 69 6c 6c 20 62 65 20 64 69 73 63 75 73 |d will be discus| 00002860 73 65 64 20 66 75 72 74 68 65 72 20 0a 69 6e 20 |sed further .in | 00002870 74 68 65 20 6e 65 78 74 20 61 72 74 69 63 6c 65 |the next article| 00002880 2e |.| 00002881