Home » Personal collection » Acorn hard disk » misc » misc3 » shipwren/+P1

shipwren/+P1

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/+P1
Read OK:
File size: 1633 bytes
Load address: 0000
Exec address: 0000
Duplicates

There is 1 duplicate copy of this file in the archive:

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. 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 128:COLOUR 0:CLS

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 memory 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.

     Having decided which graphics mode you are going to use, 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.
     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 quality graphics, and at such a speed?
     There are, in fact, two possible solutions, both of which involve dea;ing with an area of memory known as screen memory. This is, however, very complicated, and will take an entire article to cover... No prizes for guessing what the subject will be next time!
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 0d 62 79  20 44 6f 6d 69 6e 69 63  |NIQUE.by Dominic|
00000020  20 46 6f 72 64 0d 50 61  72 74 20 32 3a 20 47 72  | Ford.Part 2: Gr|
00000030  61 70 68 69 63 73 0d 0d  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 0d 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 0d 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 0d  |ailable on the .|
00000100  65 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 0d 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 0d 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 59 6f 75 20 73 65  | program. You se|
000001b0  6c 65 63 74 20 67 72 61  70 68 69 63 73 20 6d 6f  |lect graphics mo|
000001c0  64 65 73 20 62 79 20 75  73 69 6e 67 20 74 68 65  |des by using the|
000001d0  20 0d 4d 4f 44 45 20 78  20 63 6f 6d 6d 61 6e 64  | .MODE x command|
000001e0  2e 20 44 65 74 61 69 6c  73 20 6f 66 20 74 68 65  |. Details of the|
000001f0  20 73 65 76 65 6e 20 64  69 66 66 65 72 65 6e 74  | seven different|
00000200  20 61 76 61 69 6c 61 62  6c 65 20 6d 6f 64 65 73  | available modes|
00000210  20 61 72 65 20 0d 67 69  76 65 6e 20 62 65 6c 6f  | are .given belo|
00000220  77 3a 0d 0d 78 20 43 6f  6c 6f 75 72 73 20 47 72  |w:..x Colours Gr|
00000230  61 70 68 69 63 73 3f 20  52 65 73 2f 47 20 20 20  |aphics? Res/G   |
00000240  52 65 73 2f 54 20 20 4d  65 6d 6f 72 79 0d 30 20  |Res/T  Memory.0 |
00000250  20 20 32 20 20 20 20 20  20 59 65 73 20 20 20 20  |  2      Yes    |
00000260  20 20 36 34 30 78 32 35  36 20 38 30 78 33 32 20  |  640x256 80x32 |
00000270  20 20 32 30 4b 0d 31 20  20 20 34 20 20 20 20 20  |  20K.1   4     |
00000280  20 59 65 73 20 20 20 20  20 20 33 32 30 78 32 35  | Yes      320x25|
00000290  36 20 34 30 78 33 32 20  20 20 32 30 4b 0d 32 20  |6 40x32   20K.2 |
000002a0  20 20 31 36 20 20 20 20  20 59 65 73 20 20 20 20  |  16     Yes    |
000002b0  20 20 31 36 30 78 32 35  36 20 32 30 78 33 32 20  |  160x256 20x32 |
000002c0  20 20 32 30 4b 0d 33 20  20 20 32 20 20 20 20 20  |  20K.3   2     |
000002d0  20 4e 6f 20 20 20 20 20  20 20 4e 2f 41 20 20 20  | No       N/A   |
000002e0  20 20 38 30 78 32 35 20  20 20 31 36 4b 0d 34 20  |  80x25   16K.4 |
000002f0  20 20 32 20 20 20 20 20  20 59 65 73 20 20 20 20  |  2      Yes    |
00000300  20 20 33 32 30 78 32 35  36 20 34 30 78 33 32 20  |  320x256 40x32 |
00000310  20 20 31 30 4b 0d 35 20  20 20 34 20 20 20 20 20  |  10K.5   4     |
00000320  20 59 65 73 20 20 20 20  20 20 31 36 30 78 32 35  | Yes      160x25|
00000330  36 20 32 30 78 33 32 20  20 20 31 30 4b 0d 36 20  |6 20x32   10K.6 |
00000340  20 20 32 20 20 20 20 20  20 4e 6f 20 20 20 20 20  |  2      No     |
00000350  20 20 4e 2f 41 20 20 20  20 20 34 30 78 32 35 20  |  N/A     40x25 |
00000360  20 20 38 4b 0d 37 20 20  20 31 36 20 20 20 20 20  |  8K.7   16     |
00000370  4e 6f 20 20 20 20 20 20  20 4e 2f 41 20 20 20 20  |No       N/A    |
00000380  20 34 30 78 32 35 20 20  20 31 4b 20 3c 2d 20 42  | 40x25   1K <- B|
00000390  42 43 20 4f 4e 4c 59 21  0d 0d 4b 45 59 3a 0d 0d  |BC ONLY!..KEY:..|
000003a0  78 3a 20 4d 4f 44 45 20  6e 75 6d 62 65 72 2e 0d  |x: MODE number..|
000003b0  0d 43 6f 6c 6f 75 72 73  3a 20 54 68 65 20 6d 61  |.Colours: The ma|
000003c0  78 69 6d 75 6d 20 6e 75  6d 62 65 72 20 6f 66 20  |ximum number of |
000003d0  64 69 66 66 65 72 65 6e  74 20 63 6f 6c 6f 75 72  |different colour|
000003e0  73 20 77 68 69 63 68 20  6d 61 79 20 62 65 20 0d  |s which may be .|
000003f0  75 73 65 64 20 6f 6e 20  73 63 72 65 65 6e 20 61  |used on screen a|
00000400  74 20 61 6e 79 20 6f 6e  65 20 74 69 6d 65 2e 0d  |t any one time..|
00000410  0d 47 72 61 70 68 69 63  73 3f 3a 20 44 6f 65 73  |.Graphics?: Does|
00000420  20 74 68 69 73 20 67 72  61 70 68 69 63 73 20 6d  | this graphics m|
00000430  6f 64 65 20 61 6c 6c 6f  77 20 74 68 65 20 75 73  |ode allow the us|
00000440  65 20 6f 66 20 74 68 65  20 67 72 61 70 68 69 63  |e of the graphic|
00000450  73 20 63 6f 6d 6d 61 6e  64 73 20 28 69 65 2e 20  |s commands (ie. |
00000460  4d 4f 56 45 2c 20 44 52  41 57 2c 20 65 74 63 2e  |MOVE, DRAW, etc.|
00000470  29 3f 20 4d 6f 64 65 73  20 33 20 26 20 36 20 64  |)? Modes 3 & 6 d|
00000480  6f 20 6e 6f 74 20 61 6c  6c 6f 77 20 74 68 65 73  |o not allow thes|
00000490  65 20 63 6f 6d 6d 61 6e  64 73 2c 20 61 73 20 74  |e commands, as t|
000004a0  68 65 72 65 20 61 72 65  20 74 68 69 6e 20 68 6f  |here are thin ho|
000004b0  72 69 7a 6f 6e 74 61 6c  20 73 74 72 69 70 65 73  |rizontal stripes|
000004c0  20 69 6e 20 62 65 74 77  65 65 6e 20 74 68 65 20  | in between the |
000004d0  72 6f 77 73 20 6f 66 20  63 68 61 72 61 63 74 65  |rows of characte|
000004e0  72 73 2c 20 69 6e 20 77  68 69 63 68 20 6e 6f 74  |rs, in which not|
000004f0  68 69 6e 67 20 63 61 6e  20 62 65 20 64 69 73 70  |hing can be disp|
00000500  6c 61 79 65 64 2e 20 54  68 75 73 2c 20 61 6e 79  |layed. Thus, any|
00000510  20 67 72 61 70 68 69 63  73 20 64 72 61 77 6e 20  | graphics drawn |
00000520  69 6e 20 74 68 65 73 65  20 6d 6f 64 65 73 20 77  |in these modes w|
00000530  6f 75 6c 64 20 68 61 76  65 20 62 6c 61 63 6b 20  |ould have black |
00000540  68 6f 72 69 7a 6f 6e 74  61 6c 20 73 74 72 69 70  |horizontal strip|
00000550  65 73 20 61 63 72 6f 73  73 20 74 68 65 6d 2c 20  |es across them, |
00000560  61 6e 64 20 77 6f 75 6c  64 20 6c 6f 6f 6b 20 72  |and would look r|
00000570  61 74 68 65 72 20 73 69  6c 6c 79 21 20 54 6f 20  |ather silly! To |
00000580  73 65 65 20 77 68 61 74  20 49 20 6d 65 61 6e 2c  |see what I mean,|
00000590  20 74 75 72 6e 20 6f 6e  20 79 6f 75 72 20 63 6f  | turn on your co|
000005a0  6d 70 75 74 65 72 20 61  6e 64 20 74 79 70 65 3a  |mputer and type:|
000005b0  20 4d 4f 44 45 20 36 3a  43 4f 4c 4f 55 52 20 31  | MODE 6:COLOUR 1|
000005c0  32 38 3a 43 4f 4c 4f 55  52 20 30 3a 43 4c 53 0d  |28:COLOUR 0:CLS.|
000005d0  0d 52 65 73 2f 47 3a 20  54 68 65 20 72 65 73 6f  |.Res/G: The reso|
000005e0  6c 75 74 69 6f 6e 20 6f  66 20 74 68 65 20 73 63  |lution of the sc|
000005f0  72 65 65 6e 20 69 6e 20  74 68 69 73 20 6d 6f 64  |reen in this mod|
00000600  65 20 28 69 65 2e 20 74  68 65 20 6e 75 6d 62 65  |e (ie. the numbe|
00000610  72 20 6f 66 20 70 69 78  65 6c 73 20 61 63 72 6f  |r of pixels acro|
00000620  73 73 20 61 6e 64 20 64  6f 77 6e 20 74 68 65 20  |ss and down the |
00000630  73 63 72 65 65 6e 2e 20  47 65 6e 65 72 61 6c 6c  |screen. Generall|
00000640  79 2c 20 74 68 65 20 68  69 67 68 65 72 20 74 68  |y, the higher th|
00000650  65 20 76 61 6c 75 65 2c  20 74 68 65 20 73 6d 6f  |e value, the smo|
00000660  6f 74 68 65 72 20 79 6f  75 72 20 67 72 61 70 68  |other your graph|
00000670  69 63 73 20 77 69 6c 6c  20 6c 6f 6f 6b 2e 20 4e  |ics will look. N|
00000680  6f 74 65 20 74 68 61 74  20 74 68 69 73 20 69 73  |ote that this is|
00000690  20 6e 6f 74 20 74 68 65  20 73 61 6d 65 20 61 73  | not the same as|
000006a0  20 74 68 65 20 70 61 72  61 6d 65 74 65 72 73 20  | the parameters |
000006b0  74 61 6b 65 6e 20 62 79  20 74 68 65 20 4d 4f 56  |taken by the MOV|
000006c0  45 20 61 6e 64 20 44 52  41 57 20 63 6f 6d 6d 61  |E and DRAW comma|
000006d0  6e 64 73 20 2d 20 74 68  65 73 65 20 61 6c 77 61  |nds - these alwa|
000006e0  79 73 20 73 63 61 6c 65  20 74 68 65 20 6e 75 6d  |ys scale the num|
000006f0  62 65 72 20 6f 66 20 70  69 78 65 6c 73 20 61 63  |ber of pixels ac|
00000700  72 6f 73 73 20 74 68 65  20 73 63 72 65 65 6e 20  |ross the screen |
00000710  74 6f 20 31 32 38 30 20  61 6e 64 20 64 6f 77 6e  |to 1280 and down|
00000720  20 74 68 65 20 73 63 72  65 65 6e 20 74 6f 20 31  | the screen to 1|
00000730  30 32 34 2c 20 73 6f 20  74 68 61 74 20 28 31 32  |024, so that (12|
00000740  38 30 2c 31 30 32 34 29  20 77 69 6c 6c 20 61 6c  |80,1024) will al|
00000750  77 61 79 73 20 62 65 20  74 68 65 20 74 6f 70 2d  |ways be the top-|
00000760  72 69 67 68 74 20 63 6f  72 6e 65 72 20 6f 66 20  |right corner of |
00000770  74 68 65 20 73 63 72 65  65 6e 2c 20 61 6e 64 20  |the screen, and |
00000780  28 30 2c 30 29 20 74 68  65 20 62 6f 74 74 6f 6d  |(0,0) the bottom|
00000790  20 6c 65 66 74 2e 0d 0d  52 65 73 2f 54 3a 20 54  | left...Res/T: T|
000007a0  68 65 20 6e 75 6d 62 65  72 20 6f 66 20 63 68 61  |he number of cha|
000007b0  72 61 63 74 65 72 73 20  77 68 69 63 68 20 66 69  |racters which fi|
000007c0  74 20 61 63 72 6f 73 73  20 74 68 65 20 73 63 72  |t across the scr|
000007d0  65 65 6e 20 69 6e 20 74  68 69 73 20 6d 6f 64 65  |een in this mode|
000007e0  20 77 68 65 6e 20 75 73  69 6e 67 20 74 65 78 74  | when using text|
000007f0  2e 0d 0d 4d 65 6d 6f 72  79 3a 20 54 68 65 20 61  |...Memory: The a|
00000800  6d 6f 75 6e 74 20 6f 66  20 6d 65 6d 6f 72 79 20  |mount of memory |
00000810  75 73 65 64 20 62 79 20  74 68 65 20 67 72 61 70  |used by the grap|
00000820  68 69 63 73 20 6d 6f 64  65 2e 20 49 66 20 79 6f  |hics mode. If yo|
00000830  75 20 61 72 65 20 77 72  69 74 69 6e 67 20 61 20  |u are writing a |
00000840  6c 6f 6e 67 20 70 72 6f  67 72 61 6d 2c 20 74 68  |long program, th|
00000850  69 73 20 69 73 20 61 6e  20 69 6d 70 6f 72 74 61  |is is an importa|
00000860  6e 74 20 63 6f 6e 73 69  64 65 72 61 74 69 6f 6e  |nt consideration|
00000870  2c 20 61 73 20 79 6f 75  20 6d 61 79 20 6e 6f 74  |, as you may not|
00000880  20 68 61 76 65 20 72 6f  6f 6d 20 66 6f 72 20 74  | have room for t|
00000890  68 65 20 70 72 6f 67 72  61 6d 20 61 66 74 65 72  |he program after|
000008a0  20 73 75 62 74 72 61 63  74 69 6e 67 20 32 30 4b  | subtracting 20K|
000008b0  20 66 72 6f 6d 20 74 68  65 20 63 6f 6d 70 75 74  | from the comput|
000008c0  65 72 27 73 20 33 32 4b  20 52 41 4d 20 66 6f 72  |er's 32K RAM for|
000008d0  20 61 20 4d 4f 44 45 20  32 20 73 63 72 65 65 6e  | a MODE 2 screen|
000008e0  2e 0d 0d 20 20 20 20 20  48 61 76 69 6e 67 20 64  |...     Having d|
000008f0  65 63 69 64 65 64 20 77  68 69 63 68 20 67 72 61  |ecided which gra|
00000900  70 68 69 63 73 20 6d 6f  64 65 20 79 6f 75 20 61  |phics mode you a|
00000910  72 65 20 67 6f 69 6e 67  20 74 6f 20 75 73 65 2c  |re going to use,|
00000920  20 79 6f 75 20 0d 6d 75  73 74 20 64 65 63 69 64  | you .must decid|
00000930  65 20 68 6f 77 20 79 6f  75 20 61 72 65 20 67 6f  |e how you are go|
00000940  69 6e 67 20 74 6f 20 67  65 74 20 79 6f 75 72 20  |ing to get your |
00000950  67 72 61 70 68 69 63 73  20 6f 6e 74 6f 20 74 68  |graphics onto th|
00000960  65 20 73 63 72 65 65 6e  2e 20 0d 54 68 65 72 65  |e screen. .There|
00000970  20 61 72 65 20 6d 61 6e  79 20 6d 65 74 68 6f 64  | are many method|
00000980  73 20 66 6f 72 20 70 72  6f 64 75 63 69 6e 67 20  |s for producing |
00000990  67 72 61 70 68 69 63 73  2c 20 61 6e 64 20 77 68  |graphics, and wh|
000009a0  69 63 68 20 79 6f 75 20  0d 63 68 6f 6f 73 65 20  |ich you .choose |
000009b0  64 65 70 65 6e 64 73 20  75 70 6f 6e 20 77 68 61  |depends upon wha|
000009c0  74 20 79 6f 75 20 77 61  6e 74 20 74 68 65 20 67  |t you want the g|
000009d0  72 61 70 68 69 63 73 20  66 6f 72 2c 20 61 6e 64  |raphics for, and|
000009e0  20 77 68 61 74 20 79 6f  75 20 0d 77 61 6e 74 20  | what you .want |
000009f0  74 68 65 6d 20 74 6f 20  64 6f 20 28 61 6e 64 2c  |them to do (and,|
00000a00  20 6f 66 20 63 6f 75 72  73 65 2c 20 79 6f 75 72  | of course, your|
00000a10  20 70 72 6f 67 72 61 6d  6d 69 6e 67 20 61 62 69  | programming abi|
00000a20  6c 69 74 79 29 2e 20 54  68 65 20 0d 6d 6f 73 74  |lity). The .most|
00000a30  20 6f 62 76 69 6f 75 73  20 69 73 20 74 68 65 20  | obvious is the |
00000a40  50 52 49 4e 54 20 63 6f  6d 6d 61 6e 64 2e 20 54  |PRINT command. T|
00000a50  68 69 73 20 69 73 20 61  20 71 75 69 63 6b 2c 20  |his is a quick, |
00000a60  65 61 73 79 20 77 61 79  20 6f 66 20 0d 70 75 74  |easy way of .put|
00000a70  74 69 6e 67 20 74 65 78  74 20 6f 6e 74 6f 20 74  |ting text onto t|
00000a80  68 65 20 73 63 72 65 65  6e 2e 20 57 68 65 6e 20  |he screen. When |
00000a90  75 73 65 64 20 77 69 74  68 20 74 68 65 20 43 4f  |used with the CO|
00000aa0  4c 4f 55 52 20 63 6f 6d  6d 61 6e 64 20 0d 61 6e  |LOUR command .an|
00000ab0  64 20 74 68 65 20 54 41  42 28 78 2c 79 29 2c 20  |d the TAB(x,y), |
00000ac0  6d 61 6e 79 20 69 6e 74  65 72 65 73 74 69 6e 67  |many interesting|
00000ad0  20 65 66 66 65 63 74 73  20 63 61 6e 20 62 65 20  | effects can be |
00000ae0  61 63 68 69 65 76 65 64  2e 20 0d 54 68 65 73 65  |achieved. .These|
00000af0  20 61 72 65 2c 20 68 6f  77 65 76 65 72 2c 20 67  | are, however, g|
00000b00  72 65 61 74 6c 79 20 6c  69 6d 69 74 65 64 20 62  |reatly limited b|
00000b10  79 20 74 68 65 20 66 61  63 74 20 74 68 61 74 20  |y the fact that |
00000b20  6f 6e 6c 79 20 6c 65 74  74 65 72 73 20 0d 63 61  |only letters .ca|
00000b30  6e 20 62 65 20 64 69 73  70 6c 61 79 65 64 20 6f  |n be displayed o|
00000b40  6e 20 74 68 65 20 73 63  72 65 65 6e 2e 20 54 68  |n the screen. Th|
00000b50  69 73 20 6c 69 6d 69 74  61 74 69 6f 6e 20 6d 61  |is limitation ma|
00000b60  79 20 62 65 20 6f 76 65  72 63 6f 6d 65 20 75 73  |y be overcome us|
00000b70  69 6e 67 20 0d 75 73 65  72 20 64 65 66 69 6e 65  |ing .user define|
00000b80  64 20 63 68 61 72 61 63  74 65 72 73 20 28 73 65  |d characters (se|
00000b90  65 20 74 68 65 20 47 72  61 70 68 69 63 73 20 63  |e the Graphics c|
00000ba0  68 61 70 74 65 72 20 6f  66 20 74 68 65 20 55 73  |hapter of the Us|
00000bb0  65 72 20 4d 61 6e 75 61  6c 20 0d 66 6f 72 20 64  |er Manual .for d|
00000bc0  65 74 61 69 6c 73 29 2e  20 45 76 65 6e 20 75 73  |etails). Even us|
00000bd0  69 6e 67 20 74 68 65 73  65 20 63 68 61 72 61 63  |ing these charac|
00000be0  74 65 72 73 2c 20 68 6f  77 65 76 65 72 2c 20 74  |ters, however, t|
00000bf0  68 65 72 65 20 61 72 65  20 73 65 72 69 6f 75 73  |here are serious|
00000c00  20 0d 6c 69 6d 69 74 61  74 69 6f 6e 73 2e 20 54  | .limitations. T|
00000c10  68 65 79 20 63 61 6e 20  6f 6e 6c 79 20 75 73 65  |hey can only use|
00000c20  20 6f 6e 65 20 63 6f 6c  6f 75 72 20 70 65 72 20  | one colour per |
00000c30  63 68 61 72 61 63 74 65  72 2c 20 61 6e 64 20 73  |character, and s|
00000c40  6f 20 65 76 65 6e 20 0d  69 66 20 79 6f 75 20 6d  |o even .if you m|
00000c50  61 6b 65 20 64 69 66 66  65 72 65 6e 74 20 63 68  |ake different ch|
00000c60  61 72 61 63 74 65 72 73  20 64 69 66 66 65 72 65  |aracters differe|
00000c70  6e 74 20 63 6f 6c 6f 75  72 73 2c 20 79 6f 75 72  |nt colours, your|
00000c80  20 73 63 72 65 65 6e 20  77 69 6c 6c 20 0d 73 74  | screen will .st|
00000c90  69 6c 6c 20 61 70 70 65  61 72 20 72 61 74 68 65  |ill appear rathe|
00000ca0  72 20 64 75 6c 6c 2e 20  41 6c 73 6f 2c 20 74 68  |r dull. Also, th|
00000cb0  65 79 20 61 72 65 20 64  69 66 66 69 63 75 6c 74  |ey are difficult|
00000cc0  20 74 6f 20 75 73 65 20  77 68 65 6e 20 0d 64 65  | to use when .de|
00000cd0  61 6c 69 6e 67 20 77 69  74 68 20 6c 61 72 67 65  |aling with large|
00000ce0  20 61 72 65 61 73 20 6f  66 20 74 68 65 20 73 63  | areas of the sc|
00000cf0  72 65 65 6e 2e 20 0d 20  20 20 20 20 54 68 69 73  |reen. .     This|
00000d00  20 69 73 20 77 68 65 72  65 20 4d 4f 56 45 2c 20  | is where MOVE, |
00000d10  44 52 41 57 20 61 6e 64  20 50 4c 4f 54 20 61 72  |DRAW and PLOT ar|
00000d20  65 20 75 73 65 66 75 6c  2e 20 55 73 69 6e 67 20  |e useful. Using |
00000d30  74 68 65 73 65 20 0d 63  6f 6d 6d 61 6e 64 73 2c  |these .commands,|
00000d40  20 6c 69 6e 65 73 20 63  61 6e 20 62 65 20 64 72  | lines can be dr|
00000d50  61 77 6e 20 61 63 72 6f  73 73 20 74 68 65 20 73  |awn across the s|
00000d60  63 72 65 65 6e 2c 20 61  6e 64 2c 20 75 73 69 6e  |creen, and, usin|
00000d70  67 20 50 4c 4f 54 2c 20  0d 74 72 69 61 6e 67 6c  |g PLOT, .triangl|
00000d80  65 73 20 63 61 6e 20 62  65 20 64 72 61 77 6e 2e  |es can be drawn.|
00000d90  20 54 68 65 73 65 20 63  6f 6d 6d 61 6e 64 73 20  | These commands |
00000da0  61 72 65 20 63 6f 76 65  72 65 64 20 69 6e 20 74  |are covered in t|
00000db0  68 65 20 0d 47 72 61 70  68 69 63 73 20 63 68 61  |he .Graphics cha|
00000dc0  70 74 65 72 20 6f 66 20  74 68 65 20 75 73 65 72  |pter of the user|
00000dd0  20 6d 61 6e 75 61 6c 2e  20 54 68 65 20 6f 74 68  | manual. The oth|
00000de0  65 72 20 6d 61 6a 6f 72  20 61 64 76 61 6e 74 61  |er major advanta|
00000df0  67 65 20 6f 66 20 0d 74  68 65 73 65 20 67 72 61  |ge of .these gra|
00000e00  70 68 69 63 73 20 63 6f  6d 6d 61 6e 64 73 20 69  |phics commands i|
00000e10  73 20 74 68 61 74 20 74  68 65 79 20 63 61 6e 20  |s that they can |
00000e20  62 65 20 75 73 65 64 20  6e 6f 74 20 6a 75 73 74  |be used not just|
00000e30  20 74 6f 20 73 65 74 20  0d 74 68 65 20 63 6f 6c  | to set .the col|
00000e40  6f 75 72 20 6f 66 20 61  6e 20 61 72 65 61 2c 20  |our of an area, |
00000e50  62 75 74 20 61 6c 73 6f  20 74 6f 20 69 6e 76 65  |but also to inve|
00000e60  72 74 20 69 74 2e 20 54  68 65 20 47 43 4f 4c 20  |rt it. The GCOL |
00000e70  63 6f 6d 6d 61 6e 64 2c  20 0d 77 68 69 63 68 20  |command, .which |
00000e80  73 65 6c 65 63 74 73 20  74 68 65 20 63 6f 6c 6f  |selects the colo|
00000e90  75 72 20 69 6e 20 77 68  69 63 68 20 67 72 61 70  |ur in which grap|
00000ea0  68 69 63 73 20 61 72 65  20 64 69 73 70 6c 61 79  |hics are display|
00000eb0  65 64 2c 20 74 61 6b 65  73 20 0d 74 77 6f 20 70  |ed, takes .two p|
00000ec0  61 72 61 6d 65 74 65 72  73 3a 0d 0d 47 43 4f 4c  |arameters:..GCOL|
00000ed0  20 78 2c 63 0d 0d 63 20  69 73 20 74 68 65 20 6e  | x,c..c is the n|
00000ee0  65 77 20 63 6f 6c 6f 75  72 20 69 6e 20 77 68 69  |ew colour in whi|
00000ef0  63 68 20 67 72 61 70 68  69 63 73 20 73 68 6f 75  |ch graphics shou|
00000f00  6c 64 20 62 65 20 64 72  61 77 6e 2e 0d 78 20 73  |ld be drawn..x s|
00000f10  65 6c 65 63 74 73 20 68  6f 77 20 74 68 69 73 20  |elects how this |
00000f20  63 6f 6c 6f 75 72 20 73  68 6f 75 6c 64 20 62 65  |colour should be|
00000f30  20 61 70 70 6c 79 65 64  3a 0d 0d 78 3d 30 20 6d  | applyed:..x=0 m|
00000f40  65 61 6e 73 20 74 6f 20  73 65 74 20 65 76 65 72  |eans to set ever|
00000f50  79 20 70 69 78 65 6c 20  74 6f 20 74 68 61 74 20  |y pixel to that |
00000f60  63 6f 6c 6f 75 72 2c 20  72 65 67 61 72 64 6c 65  |colour, regardle|
00000f70  73 73 20 6f 66 20 69 74  73 20 0d 70 72 65 76 69  |ss of its .previ|
00000f80  6f 75 73 20 63 6f 6c 6f  75 72 2e 0d 78 3d 31 20  |ous colour..x=1 |
00000f90  6d 65 61 6e 73 20 74 6f  20 6d 69 78 20 74 68 65  |means to mix the|
00000fa0  20 6c 69 67 68 74 20 66  72 6f 6d 20 74 68 65 20  | light from the |
00000fb0  70 69 78 65 6c 20 61 6c  72 65 61 64 79 20 6f 6e  |pixel already on|
00000fc0  20 74 68 65 20 73 63 72  65 65 6e 20 0d 77 69 74  | the screen .wit|
00000fd0  68 20 74 68 61 74 20 6f  66 20 74 68 65 20 6e 65  |h that of the ne|
00000fe0  77 20 63 6f 6c 6f 75 72  2e 20 46 6f 72 20 65 78  |w colour. For ex|
00000ff0  61 6d 70 6c 65 2c 20 69  66 20 61 20 72 65 64 20  |ample, if a red |
00001000  70 69 78 65 6c 20 69 73  20 73 65 74 20 0d 74 6f  |pixel is set .to|
00001010  20 62 6c 75 65 2c 20 74  68 65 20 72 65 64 20 61  | blue, the red a|
00001020  6e 64 20 62 6c 75 65 20  6d 69 78 20 74 6f 20 66  |nd blue mix to f|
00001030  6f 72 6d 20 70 75 72 70  6c 65 2e 0d 78 3d 32 20  |orm purple..x=2 |
00001040  6d 65 61 6e 73 20 74 68  61 74 20 74 68 65 20 6c  |means that the l|
00001050  69 67 68 74 20 66 72 6f  6d 20 74 68 65 20 70 69  |ight from the pi|
00001060  78 65 6c 73 20 69 73 20  66 69 6c 74 65 72 65 64  |xels is filtered|
00001070  20 77 69 74 68 20 74 68  65 20 6e 65 77 20 0d 63  | with the new .c|
00001080  6f 6c 6f 75 72 2e 20 49  66 20 61 20 72 65 64 20  |olour. If a red |
00001090  70 69 78 65 6c 20 69 73  20 73 65 74 20 74 6f 20  |pixel is set to |
000010a0  62 6c 75 65 20 6e 6f 77  2c 20 69 74 20 69 73 20  |blue now, it is |
000010b0  61 73 20 69 66 20 61 20  62 6c 75 65 20 0d 66 69  |as if a blue .fi|
000010c0  6c 74 65 72 20 68 61 73  20 62 65 65 6e 20 70 6c  |lter has been pl|
000010d0  61 63 65 64 20 69 6e 20  66 72 6f 6e 74 20 6f 66  |aced in front of|
000010e0  20 74 68 65 20 72 65 64  20 6c 69 67 68 74 2c 20  | the red light, |
000010f0  61 6e 64 20 74 68 65 20  0d 72 65 73 75 6c 74 61  |and the .resulta|
00001100  6e 74 20 63 6f 6c 6f 75  72 20 69 73 20 62 6c 61  |nt colour is bla|
00001110  63 6b 20 28 72 65 64 20  6c 69 67 68 74 20 63 6f  |ck (red light co|
00001120  6e 74 61 69 6e 73 20 6e  6f 20 62 6c 75 65 20 63  |ntains no blue c|
00001130  6f 6d 70 6f 6e 65 6e 74  29 2e 0d 78 3d 33 20 6d  |omponent)..x=3 m|
00001140  65 61 6e 73 20 74 6f 20  69 6e 76 65 72 74 20 74  |eans to invert t|
00001150  68 65 20 6f 6c 64 20 63  6f 6c 6f 75 72 20 77 69  |he old colour wi|
00001160  74 68 20 74 68 65 20 6e  65 77 20 63 6f 6c 6f 75  |th the new colou|
00001170  72 2e 0d 78 3d 34 20 6d  65 61 6e 73 20 74 6f 20  |r..x=4 means to |
00001180  73 65 74 20 74 68 65 20  70 69 78 65 6c 73 20 77  |set the pixels w|
00001190  69 74 68 20 74 68 65 20  69 6e 76 65 72 73 65 20  |ith the inverse |
000011a0  6f 66 20 74 68 65 20 6e  65 77 20 63 6f 6c 6f 75  |of the new colou|
000011b0  72 20 0d 28 72 65 67 61  72 64 6c 65 73 73 20 6f  |r .(regardless o|
000011c0  66 20 74 68 65 20 6f 6c  64 20 63 6f 6c 6f 75 72  |f the old colour|
000011d0  29 2e 0d 0d 20 20 20 20  20 41 74 20 66 69 72 73  |)...     At firs|
000011e0  74 20 73 69 67 68 74 2c  20 69 74 20 6d 61 79 20  |t sight, it may |
000011f0  73 65 65 6d 20 74 68 61  74 20 75 73 65 72 20 64  |seem that user d|
00001200  65 66 69 6e 65 64 20 63  68 61 72 61 63 74 65 72  |efined character|
00001210  73 20 73 65 72 76 65 20  6e 6f 20 70 75 72 70 6f  |s serve no purpo|
00001220  73 65 20 6f 6e 63 65 20  61 20 70 72 6f 67 72 61  |se once a progra|
00001230  6d 6d 65 72 20 68 61 73  20 6c 65 61 72 6e 74 20  |mmer has learnt |
00001240  61 62 6f 75 74 20 74 68  65 20 6d 6f 72 65 20 66  |about the more f|
00001250  6c 65 78 69 62 6c 65 20  67 72 61 70 68 69 63 73  |lexible graphics|
00001260  20 63 6f 6d 6d 61 6e 64  73 2c 20 62 75 74 20 74  | commands, but t|
00001270  68 69 73 20 69 73 20 6e  6f 74 20 74 68 65 20 63  |his is not the c|
00001280  61 73 65 2e 20 49 66 20  79 6f 75 20 74 72 79 20  |ase. If you try |
00001290  74 6f 20 70 72 6f 64 75  63 65 20 64 65 74 61 69  |to produce detai|
000012a0  6c 65 64 20 67 72 61 70  68 69 63 73 20 75 73 69  |led graphics usi|
000012b0  6e 67 20 4d 4f 56 45 20  61 6e 64 20 44 52 41 57  |ng MOVE and DRAW|
000012c0  2c 20 79 6f 75 20 77 69  6c 6c 20 66 69 6e 64 20  |, you will find |
000012d0  74 68 61 74 20 79 6f 75  72 20 70 72 6f 67 72 61  |that your progra|
000012e0  6d 20 63 72 61 77 6c 73  20 61 6c 6f 6e 67 20 61  |m crawls along a|
000012f0  74 20 61 6e 20 75 6e 61  63 63 65 70 74 61 62 6c  |t an unacceptabl|
00001300  65 20 72 61 74 65 2e 20  55 73 65 72 20 64 65 66  |e rate. User def|
00001310  69 6e 65 64 20 63 68 61  72 61 63 74 65 72 73 2c  |ined characters,|
00001320  20 6f 6e 20 74 68 65 20  6f 74 68 65 72 20 68 61  | on the other ha|
00001330  6e 64 2c 20 63 61 6e 20  70 72 6f 64 75 63 65 20  |nd, can produce |
00001340  64 65 74 61 69 6c 20 71  75 69 63 6b 6c 79 2c 20  |detail quickly, |
00001350  65 73 70 65 63 69 61 6c  6c 79 20 69 66 20 74 68  |especially if th|
00001360  65 20 70 61 74 74 65 72  6e 20 72 65 70 65 61 74  |e pattern repeat|
00001370  73 2c 20 73 6f 20 74 68  61 74 20 6f 6e 65 20 63  |s, so that one c|
00001380  68 61 72 61 63 74 65 72  20 64 65 66 69 6e 69 74  |haracter definit|
00001390  69 6f 6e 20 63 61 6e 20  62 65 20 75 73 65 64 20  |ion can be used |
000013a0  72 65 70 65 61 74 65 64  6c 79 20 69 6e 20 73 65  |repeatedly in se|
000013b0  76 65 72 61 6c 20 61 72  65 61 73 20 6f 66 20 74  |veral areas of t|
000013c0  68 65 20 73 63 72 65 65  6e 2e 0d 20 20 20 20 20  |he screen..     |
000013d0  53 6f 2c 20 69 74 20 73  65 65 6d 73 20 74 68 61  |So, it seems tha|
000013e0  74 20 70 72 6f 67 72 61  6d 6d 65 72 73 20 61 72  |t programmers ar|
000013f0  65 20 66 61 63 65 64 20  77 69 74 68 20 61 20 64  |e faced with a d|
00001400  69 66 66 69 63 75 6c 74  20 70 72 6f 62 6c 65 6d  |ifficult problem|
00001410  2e 20 54 68 65 79 20 63  61 6e 20 75 73 65 20 67  |. They can use g|
00001420  72 61 70 68 69 63 73 20  63 6f 6d 6d 61 6e 64 73  |raphics commands|
00001430  20 61 6e 64 20 67 65 74  20 63 6f 6c 6f 75 72 2c  | and get colour,|
00001440  20 6f 72 20 74 68 65 79  20 63 61 6e 20 75 73 65  | or they can use|
00001450  20 75 73 65 72 20 64 65  66 69 6e 65 64 20 63 68  | user defined ch|
00001460  61 72 61 63 74 65 72 73  20 61 6e 64 20 67 65 74  |aracters and get|
00001470  20 64 65 74 61 69 6c 2c  20 62 75 74 20 77 68 61  | detail, but wha|
00001480  74 20 69 66 20 74 68 65  79 20 77 61 6e 74 20 62  |t if they want b|
00001490  6f 74 68 20 61 74 20 74  68 65 20 73 61 6d 65 20  |oth at the same |
000014a0  74 69 6d 65 3f 20 54 68  65 72 65 20 6d 75 73 74  |time? There must|
000014b0  20 62 65 20 61 20 73 6f  6c 75 74 69 6f 6e 20 2d  | be a solution -|
000014c0  20 68 6f 77 20 65 6c 73  65 20 77 6f 75 6c 64 20  | how else would |
000014d0  67 61 6d 65 73 20 6c 69  6b 65 20 43 69 74 61 64  |games like Citad|
000014e0  65 6c 20 6d 61 6e 61 67  65 20 74 6f 20 70 72 6f  |el manage to pro|
000014f0  64 75 63 65 20 73 75 63  68 20 64 65 74 61 69 6c  |duce such detail|
00001500  65 64 20 71 75 61 6c 69  74 79 20 67 72 61 70 68  |ed quality graph|
00001510  69 63 73 2c 20 61 6e 64  20 61 74 20 73 75 63 68  |ics, and at such|
00001520  20 61 20 73 70 65 65 64  3f 0d 20 20 20 20 20 54  | a speed?.     T|
00001530  68 65 72 65 20 61 72 65  2c 20 69 6e 20 66 61 63  |here are, in fac|
00001540  74 2c 20 74 77 6f 20 70  6f 73 73 69 62 6c 65 20  |t, two possible |
00001550  73 6f 6c 75 74 69 6f 6e  73 2c 20 62 6f 74 68 20  |solutions, both |
00001560  6f 66 20 77 68 69 63 68  20 69 6e 76 6f 6c 76 65  |of which involve|
00001570  20 64 65 61 3b 69 6e 67  20 77 69 74 68 20 61 6e  | dea;ing with an|
00001580  20 61 72 65 61 20 6f 66  20 6d 65 6d 6f 72 79 20  | area of memory |
00001590  6b 6e 6f 77 6e 20 61 73  20 73 63 72 65 65 6e 20  |known as screen |
000015a0  6d 65 6d 6f 72 79 2e 20  54 68 69 73 20 69 73 2c  |memory. This is,|
000015b0  20 68 6f 77 65 76 65 72  2c 20 76 65 72 79 20 63  | however, very c|
000015c0  6f 6d 70 6c 69 63 61 74  65 64 2c 20 61 6e 64 20  |omplicated, and |
000015d0  77 69 6c 6c 20 74 61 6b  65 20 61 6e 20 65 6e 74  |will take an ent|
000015e0  69 72 65 20 61 72 74 69  63 6c 65 20 74 6f 20 63  |ire article to c|
000015f0  6f 76 65 72 2e 2e 2e 20  4e 6f 20 70 72 69 7a 65  |over... No prize|
00001600  73 20 66 6f 72 20 67 75  65 73 73 69 6e 67 20 77  |s for guessing w|
00001610  68 61 74 20 74 68 65 20  73 75 62 6a 65 63 74 20  |hat the subject |
00001620  77 69 6c 6c 20 62 65 20  6e 65 78 74 20 74 69 6d  |will be next tim|
00001630  65 21 0d                                          |e!.|
00001633