Home » Personal collection » Acorn ADFS disks » Archimedes » Unlabelled_disk_2.ADF » PT3
PT3
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 ADFS disks » Archimedes » Unlabelled_disk_2.ADF |
Filename: | PT3 |
Read OK: | ✔ |
File size: | 6ACF bytes |
Load address: | FFFFFF48 |
Exec address: | 41ED4547 |
Duplicates
There is 1 duplicate copy of this file in the archive:
- Personal collection » Acorn ADFS disks » Archimedes » Unlabelled_disk_2.ADF » PT3
- Personal collection » Acorn hard disk » misc » misc3 » shipwren/PT3
File contents
Programming Technique Part 3: Graphics - Screen Memory Written by Dominic Ford At the end of the last article, you could program graphics in colour using the built in MOVE and DRAW commands in BASIC, and could program fast, detailed graphics in black and white using user defined characters. But there was a problem if we wanted graphics in both colour and detail, as by both methods the production of such graphics would be incredibly slow. There is a solution to this problem, which involves taking advantage of the way in which the computer's video system operates. The colour of each pixel on your monitor is determined the data sent to the monitor by your computer - thats fairly obvious. But if you have drawn a very complex set of shapes on the computer screen, perhaps using a BASIC program which took several hours to calculate and draw the result you see on the screen, how does the computer remember the colour of every pixel on the screen, and know what data to send to your monitor? The answer is simple: within your computer's memory there is an area set aside to store the colour of every pixel on the screen, and when the monitor requests the colour of a particular pixel, the computer simply reads the colour of the pixel from this area of memory. This area of memory is called "Screen Memory". It can be considered as a sort of giant table, holding data for the colours of all of the pixels in a huge matrix of memory locations. But of what use is this to the programmer you might be wondering. The answer is that when you use user defined characters, MOVE and DRAW commands, or any other method of putting anything on the screen, the computer simply alters a few values in this giant table. But the computer takes time to process your MOVE and DRAW commands to work out which values in the table to alter. If you could bypass this stage, and set the values in this giant table yourself without using the computer's general purpose graphics commands, you can get exactly the result that you want, and much faster than you would achieve if you were doing the operation through the computer's commands. These have to process the parameters which you give, and then calculate where abouts in the giant table you want to alter, before they can actually do any useful work. Thus a lot of computer time is wasted in performing calculations, which can actually be skipped if the programmer is careful. There are two possible ways of achieving this idea, both of which are useful in different situations: 1. Save screen memory to disc. This idea is fairly simple to understand. You, as the programmer, write a program to plot the artwork for your program onto the screen, taking however many hours it may take to complete all of the calculations required to plot the graphics. You run this program once on your computer, so that your masterpiece is stored in the screen memory of your computer (ie. is on the monitor of your computer). You than transfer the entire contents of the screen memory on your computer to floppy disc. Then, in the final program which you want the user to operate, you include a command to load this data back from floppy disc into the screen memory of their computer. In a matter of a couple of seconds, graphics which took possible hours to calculate will appear on their screen. This is a technique which I have used in several of my programs. The main menu of Shipwrecked II: Jupiter 3, where you select Play, Instructions, Game Complete or Cheat with the starfield backdrop was done in this way - the screen took nearly an hour for my computer to calculate, but I was able to make it appear in seconds on your screen. I should also mention the title screen to Shipwreck with the animated sea, not to mention the endless EUG title screens I have done in this way - the Christmas EUG 35 screen with the swirly blue background (credited erroneously to Robert Sprowson) took two whole days to plot! In order to achieve this, you simply need to understand two BASIC commands: *SAVE Filename nnnn mmmm *LOAD Filename nnnn These load and save areas of the computer's memory to floppy disc or cassette with the filename givan in place of the work Filename, starting at memory location nnnn, and continuing until memory location mmmm (where nnnn and mmmm are both in hexidecimal - base 16). Don't worry if you don't entirely understand this - it is not necessary to entirely understand the workings of these commands, or of hexidecimal to use them to store and retrieve screen memory. All you need to do is substitute nnnn and mmmm for the addresses of the start and finish of screen memory. The location of these within your computer varies depeding upon which graphics mode you are using (which you selected using the MODE command - see previous tutorial if you are unsure of what this is), but is always constant for any particular mode. the values for the different modes are given below: Mode nnnn mmmm NOTES: 0 3000 7FFF 1 3000 7FFF - nnnn and mmmm values given to the left are 2 3000 7FFF all in hexidecimal. Therefore they can be 3 4000 7FFF substituted directly into the *LOAD and *SAVE 4 5800 7FFF commands with no conversion required. 5 5800 7FFF 6 6000 7FFF - Values are not valid for the BBC model A in 7 7C00 7FFF modes 4,5,6 or 7. Examples: Suppose you are in mode 2, and want to store the screen to a floppy. From the table above, nnnn is 3000 and mmmm is 7FFF for mode 2. Therefore, to save the screen under the filename "Screen", you would type: *SAVE Screen 3000 7FFF Now, if you want to restore the screen again, and put your graphics back on the screen again, you would use *LOAD. Notice that this time only a value for nnnn is required, and not for mmmm: *LOAD Screen 3000 You can try this out now, if you switch on your Electron, and insert a work disc into your floppy drive. If you use ADFS, you may need to use *MOUNT to select the floppy disc, and be able to write to it. Now enter mode 2 by typing: MODE 2 Now type some text on the screen which will represent the graphics which you want to save. When you have finished, save the contents of screen memory to floppy disk as shown above, by typing: *SAVE Screen 3000 7FFF When the disk drive has finished, clear the text off the screen by typing: CLS The text which you typed onto the screen has now been wiped from the computer's memory, but should still be stored on the floppy disc. We can show that this is so by typing: *LOAD Screen 3000 Your text should now reappear on the screen. You can repeat this with any kind of complex graphics on screen, and it will still work. The same can be done in any other graphics mode, simply by changing the values of nnnn and mmmm to those given in the table above. For example in mode 5 you would use: *SAVE Screen 5800 7FFF followed by: *LOAD Screen 5800 7FFF There are, however, a few precautionary points which should be mentioned about this technique of saving screen memory: - As you probably realise, in four colour modes, the four colours you can use can be changed from the default black, red, yellow and white by using VDU 19 to change the palette. The colours in the palette are not saved when this technique is used, and must be restored by repeating the VDU 19 commands again. If you define the palette to, for example, black, blue, cyan and white, and create a picture which looks good in this colour scheme, you must remember that unless you define the palette to these four colours before performing *LOAD to restore the picture, it may appear rather odd when reloaded, as it will appear in black, red, yellow and white - the default colour scheme. - The exact reason why this happens is rather complicated, but if you allow the cursor to go down off the bottom line of the screen, and allow the screen to scroll up one line, this technique stops working until you perform a MODE command, or clear the screen using CLS. Basically what happens is that the computer does not physically move every line of text on the screen up one line, but instead makes a note that every line in screen memory is stored one line lower than it should be. When you reload from disk, this note is lost, and the computer draws every line lower than it should be. Each time that CLS or MODE is executed, screen memory is cleared and reinitiated, so that every line is stored in memory where you would expect it to be. Simply remember not to allow the screen to scroll between clearing it, and saving the contents of screen memory to disc. - The files created when you save the contents of screen memory to disk are fairly large - so large, in fact, that you can often only fit around 15 such files onto each disk that you use (the exact number depends upon what modes the images are in). Therefore this technique is not feasable for a large number of images. Each screen in a game like Shipwrecked cannot be stored in this way - if I had stored every screen of the game like this, it would have required six floppy disks to store the data for the game! This means that saved screens must be reserved for the purposes of title screens only. Earlier in the article, I mentioned several examples of screens which I have done for EUG using saved screens using this technique. These included the title screens for both Shipwrecked games, and also several EUG title screens. You may have noticed that these were actually animated (see the starfield in Jupiter 3 and the EUG 35 title). This was achieved by palette switching as used in the previous article. If you look again at the programming technique demonstration from this article (on EUG 36), and select option 5, the same effect will appear on your screen. The same principal was applied in both animated screens mentioned above - the only difference is that in these title screens the pattern on screen which is being palette switched is rather more complex. Shipwreck's title screen (with the animated water scene) was also created in this way, except that for this screen there was also a machine code program altering the contents of screen memory as well, to enhance the effect. So, we have a technique which allows us to store a small number of very detailed screens on floppy, and recall then at very great speed. But what if we want to use this method for a large number of screens? And what if we want a situation like a game, where the user can move sprites on the screen around. This can also be done by altering the values in screen memory directly, but in a different way... 2. Editing screen memory The basic idea is this: in any program, you only usually require a certain, small number of little 'blocks' to make up a whole picture. In a word processor, for example, you only need the letters of the alphabet to appear on the screen. These letters are small blocks of graphics which appear on your screen (called characters). Because only these 26 blocks are required, the word processor does not need to store every letter as all of the pixels which make it up (ie. as a bitmap), but just as a code for that particular letter. When the word processor wants to display a letter on the screen, it looks up the letter code, and then copies the graphic data for what that letter looks like onto the screen. Therefore, the graphic data for what colour all of the pixels should be for that particular letter (which might take several bytes) need only be stored once, and that letter can be stored in your script in just one byte, for the letter code. Thus, the memory taken up by your script is reduced dramatically. The same principal can be used in graphics. Look at two brick walls in an arcade adventure such as Shipwrecked - can you see the difference between them? If they are the same, surely you only need to store the graphic data for a brick wall once, and then copy it onto the screen whenever you want a brick wall. In Shipwrecked, for example, the graphic data to describe what a brick wall looks like took 128 bytes. Yet every time I wanted that brick wall (which was over a hundred times) I could simply use one byte to say "Put a brick wall here!". The easiest way to use this block idea, as you may already have realised, is using user defined characters. You redefine the letters of the alphabet as different pictures, and then use the standard BASIC PRINT command to output these pictures to the screen, as and when they are required. But, as we already realised in the last article, this only allows you to use one colour in each character. Even so, this is a reasonable technique if you don't mind the lack of colour. Many commercial games actually never addressed this problem, and had graphics which lacked colour somewhat. Even Dizzy (for those who have never heard of it, a great arcade adventure of the 1980s, which caused quite a cult following at the time on the Spectrum and C64, but never quite reached the Elk) did not have more than one colour (other than black) per block. Different blocks were, however, different colours - trees were green and the ground was red - but there was never any overlap between the two colour areas. There is, however, a way of creating an effect just like user defined characters, but in full colour, and the principal is very similar to that used before in saving screen memory. Basically, you design you small block on the screen, using whatever technique you like to draw it, and then save the small part of screen memory which contains your design. This time, however, you will not save it to floppy disc, but to another area of memory. You can then copy this block back to screen memory whenever and wherever you want it. If you want it, say, in the fifth row down, and twelve characters along, you can calculate where abouts this corresponds to in screen memory, and copy the block to this location. As the block is stored in your computer's RAM, as opposed to on floppy, this transfer can be done by machine code at very great speed (taking only a small fraction of a second). For those programmers who are not familiar with machine code, a module is included with this tutorial allowing you to do this. The program code for this module is actually taken directly from Shipwrecked. If you are not familiar with machine code, then you can probably skip the next section on how to directly access screen memory, as it is impossible to achieve any speed by accessing screen memory directly in BASIC - your program will crawl along incredibly slowly. You could still use such a technique in preparing a screen which you intend to save to floppy using the technique described before with *SAVE and *LOAD. Firstly, it is important to know how screen memory is laid out in memory. The exact position of each character within the memory of your computer varies from one graphics mode to another, but the basic principals are the same: - The screen area is divided up into characters. These are blocks of eight pixels by eight pixels, and are the same size as the rectangular block of space taken up by one letter when you print text to the screen. Screen memory is divided up into blocks, with each the characters being defined by one of these blocks. - The screen is stored row by row, with the top row first and the bottom row last. - Within each of these rows, characters are stored one by one, from left to right. - In all modes, screen memory ends at &7FFF (ie. at the end of RAM) Footnote: By convention, memory addresses are specified in hexidecimal. I use the standard Acorn '&' prefix to indicate hexidecimal values. Those used to dealing with PCs are any other computers may be used to the American convention of using a dollar prefix in its place. It should be noted that the Elk expects & and will not accept $. Example: Suppose I want to draw a blob in character square (6,7), in mode 1. What is the address of this square? (given that each character takes 16 bytes of screen memory to define in mode 1 - we'll come to how to calculate this in a minute). Well - looking at the table earlier, screen memory starts at &3000 in mode 1. We want to find the start of row 7 in screen memory. This row has 7 rows of characters above it, and which will be stored before it. Each of these rows consists of 40 characters, which take up 16 bytes each. Therefore the total memory taken up by these rows is 7 * 40 * 16 = 4480 bytes. [Each character is 16 bytes, each row consists of 40 of these characters, therefore we multiply by 40, and as there are 7 of these complete rows, we multiply by 7 to get the value for seven of these rows] Now we have that the starting address of row 7 is at: &3000 + 4480 = &4180 Now that we have found where abouts in memory this row starts, we need to locate character 6. This should be fairly easy - we know that characters are stored from left to right, so just add on the memory required to store six characters to the left of the one we want, i.e. 16 * 6 = 96 bytes [Six characters, each taking 16 bytes to store]. Therefore the address of character (6,7) will be: &4180 + 96 = &41E0 Answer: Character (6,7) is stored from &41E0 to &41EF Just to check the answer is correct, type this simple loop: 10 MODE 1 20 FOR ad=&41E0 TO &41EF 30 ?ad=255 40 NEXT And yes, a white splodge does appear in square (6,7). This whole procedure can actually be refined down, and expressed as a simple formula: Address = Base + ( y * No. characters per line + x ) * Memory per character Where: Address= The memory location of the start of the character you want. Base = Start of screen memory in current graphics mode. (x,y) = Co-ordinate of square you want to access (same as PRINT TAB) Since the number of characters per line, the number of bytes per character, and the base address of screen memory are all constant for any particular graphics mode, the values for the graphics mode you are using can be substituted into the equation in your program. For mode 1, for example, you would use: Address = &3000 + (40 * y + x) * 16 Before continuing, one note should be borne in mind. You may remember that a while back I mentioned that when you type text which overflows off the bottom of the screen, the computer makes a note that each line is stored in memory one line lower than it should be, but does not actually move anything around in screen memory. The same effect can cause problems with direct access to screen memory as well. The simple rule for beginners is, NEVER attempt to use direct screen memory access when there is even the slightest possibility that the screen might have been allowed to scroll up at all (e.g. after using INPUT to get input from the user - how do you know that they didn't type so much that it went of the bottom of the screen?) If you know what you are doing, this rule can be ignored, and high-speed scrolling can be achieved as a result, but that is not for the beginner! I can tell you from first hand experience, that creating scrolling in Jupiter 3 by this technique was a nightmare - especially when the operating system calls you need to make to achieve this are completely different on the BBC to the Elk, so you need to find out which platform you are operating on, and then make the relavant calls for that platform! Now that you can locate a the memory occupied by a character in screen memory, you need to know how the bytes within this block are laid out, so that you can have pixel by pixel control over your monitor screen. This is also required if you are to be able to calculate the amount of memory taken up by each character's definition in a particular mode. The graphics modes can be divided into three categories: monochrome modes (ie. two colours), four colour modes, and sixteen colour modes. All of the Elk's modes fall into these three groupings. Which of these colours each pixel of the screen is depends upon the status of a number of binary bits. These have two states, 0 or 1. Now, in a monochrome mode, one bit is sufficient to define the colour of one pixel (bits have two states, 0 or 1, and the pixels have two states, colour 0 or colour 1). In a four colour mode, on the other hand, one bit will not be sufficient, as four different states are required. Two bits will be enough to store the colour of one pixel, however: Bit 1 state Bit 2 state Colour 0 0 0 0 1 1 1 0 2 1 1 3 Those familiar with binary will spot the pattern straight away - simply convert the binary value of the two bits into decimal, and you have the logical colour number. A very similar pattern applies to MODE 2 - the Elk's 16 colour mode. Each pixel requires 4 bits to store its colour (2^4=16). Once again, the colour of the pixel is the logical colour whose number is given when the four bits are put together to form a binary value: Bit 1 state Bit 2 state Bit 3 state Bit 4 state Colour Default 0 0 0 0 0 BLK 0 0 0 1 1 RED 0 0 1 0 2 GRN 0 0 1 1 3 YEL 0 1 0 0 4 BLE 0 1 0 1 5 MGT 0 1 1 0 6 CYN 0 1 1 1 7 WHT 1 0 0 0 8 BLK/WHT 1 0 0 1 9 RED/CYN 1 0 1 0 10 GRN/MGT 1 0 1 1 11 YEL/BLE 1 1 0 0 12 BLE/YEL 1 1 0 1 13 MGT/GRN 1 1 1 0 14 CYN/RED 1 1 1 1 15 WHT/BLK [Default: Default setting of this logical colour when MODE 2 is first entered] So... the Electron has modes where the definition of the colour of a certain pixel can take 1, 2 or 4 bits. As each byte of the electron's memory consists of 8 seperate bits, this means that in monochrome modes we can fit 8 pixels into each byte (8/1=8). In four colour modes (where each pixel requires two bits) we can fit 4 pixels into each byte (8/2=4). Finally in MODE 2 (the sixteen colour mode where each pixel requires 4 bits) we can fit two pixels into each byte. Let's now look at how each is laid out in more depth: MONOCHROME MODES: These are laid out in the simplest way, as eight pixels fit into each byte. The character, remember, consists of an 8 by 8 square of pixels. The data is stored in the same way as user defined characters are defined using VDU23. The first byte of the definition defines the top row of eight pixels; the second defines the second row down, etc. Thus the entire character can be defined in eight bytes, and this is the number of bytes of the Elk's memory which is used by each character. Note - the most significant bit of each byte defines the left-most pixel of the row, and the least significant bit defines the right-most pixel (just as with VDU 23 definitions) FOUR COLOUR MODES: This time each byte can only hold four pixels. Once again, each byte holds a number of pixels which are in a horizontal line. This time, as before, the first eight bytes run down in a vertical line. This time, though, not all of the pixels in the character are being defined, and only the left most 4 pixels. The right-most four pixels are defined in a second downward vertical sweep. Thus the total memory allocation for each character is sixteen bytes. The layout is shown more clearly using a diagram. This shows the eight by eight block of pixels in a character, and each has the offset of the memory location where this pixel is stored from the start of the character definition. Offsets are given in hexidecimal: PIXEL-BY PIXEL LAYOUT MEMORY FLOW 00008888 0 8 11119999 � � 2222AAAA � � 3333BBBB � � 4444CCCC � � 5555DDDD � � 6666EEEE \ / \ / 7777FFFF 7 F Each of these sixteen bytes, as already discussed, contains four pixel definitions. But within the byte's eight bits, they are not laid out as you might at first imagine. If we call the four pixels A, B, C and D (A is left-most, D is right-most), the lay out is: [MOST SIGNIFICANT] A1 B1 C1 D1 A0 B0 C0 D0 [LEAST SIGNIFICANT] Where: A1: Most significant bit of A's definition � Two bit definition A0: Least significant bit of A's definition � of pixel A. The same pattern holds for B, C and D. Example: Let's suppose we want to set the colour of the left-most pixel in a byte of a four colour mode to be colour 3. We would use: ?address=(?address AND &77) OR &88 Explanation - The (?address AND &77) bit clears the two bits defining the pixel that we want to change. The OR &88 then sets the two bits that we want set. This way we ensure that when we are going way from colour 1 to colour 2, the least significant bit of the definition is cleared as well as the most significant bit being set. It is important to notice the pattern in these bits - each pixel requires a two bit definition, but these two bits are not next to each other in the byte - instead all of the high-bytes are stored together, and all of the low-bytes are stored together. SIXTEEN COLOUR MODES The pattern for sixteen colour modes is similar to that found in four colour modes, except that each byte can only store two pixels (each occupies four bits). As with previous cases, the pixels are stored in a number of vertical sweeps starting at the left of the character, and moving to the right. This time, though, four vertical sweeps are required to cover the entire character, not two as with four colour modes: PIXEL-BY PIXEL LAYOUT MEMORY FLOW 00880088 0 8 10 18 11991199 � � � � 22AA22AA � � � � 33BB33BB � � � � 44CC44CC � � � � 55DD55DD � � � � 66EE66EE \ / \ / \ / \ / 77FF77FF 7 F 17 1F NB: Offsets given in hexadecimal. Values in right half of left diagram should have &10 added to them (only least significant character given) The pattern of the layout of the pixel data in each of the bytes is also similar to that for the four colour modes (the two pixels are A and B, and each comprises of four bits 0-3, where 0 is least significant and 3 is most significant). [MOST SIGNIFICANT] A3 B3 A2 B2 A1 B1 A0 B0 [LEAST SIGNIFICANT] Notice that once again bits defining the pixels A and B are not stored together, but those defining the least/most significant bits are stored together.
00000000 50 72 6f 67 72 61 6d 6d 69 6e 67 20 54 65 63 68 |Programming Tech| 00000010 6e 69 71 75 65 0d 50 61 72 74 20 33 3a 20 47 72 |nique.Part 3: Gr| 00000020 61 70 68 69 63 73 20 2d 20 53 63 72 65 65 6e 20 |aphics - Screen | 00000030 4d 65 6d 6f 72 79 0d 0d 57 72 69 74 74 65 6e 20 |Memory..Written | 00000040 62 79 20 44 6f 6d 69 6e 69 63 20 46 6f 72 64 0d |by Dominic Ford.| 00000050 0d 41 74 20 74 68 65 20 65 6e 64 20 6f 66 20 74 |.At the end of t| 00000060 68 65 20 6c 61 73 74 20 61 72 74 69 63 6c 65 2c |he last article,| 00000070 20 79 6f 75 20 63 6f 75 6c 64 20 70 72 6f 67 72 | you could progr| 00000080 61 6d 20 67 72 61 70 68 69 63 73 20 69 6e 20 63 |am graphics in c| 00000090 6f 6c 6f 75 72 20 75 73 69 6e 67 0d 74 68 65 20 |olour using.the | 000000a0 62 75 69 6c 74 20 69 6e 20 4d 4f 56 45 20 61 6e |built in MOVE an| 000000b0 64 20 44 52 41 57 20 63 6f 6d 6d 61 6e 64 73 20 |d DRAW commands | 000000c0 69 6e 20 42 41 53 49 43 2c 20 61 6e 64 20 63 6f |in BASIC, and co| 000000d0 75 6c 64 20 70 72 6f 67 72 61 6d 20 66 61 73 74 |uld program fast| 000000e0 2c 0d 64 65 74 61 69 6c 65 64 20 67 72 61 70 68 |,.detailed graph| 000000f0 69 63 73 20 69 6e 20 62 6c 61 63 6b 20 61 6e 64 |ics in black and| 00000100 20 77 68 69 74 65 20 75 73 69 6e 67 20 75 73 65 | white using use| 00000110 72 20 64 65 66 69 6e 65 64 20 63 68 61 72 61 63 |r defined charac| 00000120 74 65 72 73 2e 20 42 75 74 0d 74 68 65 72 65 20 |ters. But.there | 00000130 77 61 73 20 61 20 70 72 6f 62 6c 65 6d 20 69 66 |was a problem if| 00000140 20 77 65 20 77 61 6e 74 65 64 20 67 72 61 70 68 | we wanted graph| 00000150 69 63 73 20 69 6e 20 62 6f 74 68 20 63 6f 6c 6f |ics in both colo| 00000160 75 72 20 61 6e 64 20 64 65 74 61 69 6c 2c 20 61 |ur and detail, a| 00000170 73 0d 62 79 20 62 6f 74 68 20 6d 65 74 68 6f 64 |s.by both method| 00000180 73 20 74 68 65 20 70 72 6f 64 75 63 74 69 6f 6e |s the production| 00000190 20 6f 66 20 73 75 63 68 20 67 72 61 70 68 69 63 | of such graphic| 000001a0 73 20 77 6f 75 6c 64 20 62 65 20 69 6e 63 72 65 |s would be incre| 000001b0 64 69 62 6c 79 20 73 6c 6f 77 2e 0d 0d 54 68 65 |dibly slow...The| 000001c0 72 65 20 69 73 20 61 20 73 6f 6c 75 74 69 6f 6e |re is a solution| 000001d0 20 74 6f 20 74 68 69 73 20 70 72 6f 62 6c 65 6d | to this problem| 000001e0 2c 20 77 68 69 63 68 20 69 6e 76 6f 6c 76 65 73 |, which involves| 000001f0 20 74 61 6b 69 6e 67 20 61 64 76 61 6e 74 61 67 | taking advantag| 00000200 65 20 6f 66 20 74 68 65 0d 77 61 79 20 69 6e 20 |e of the.way in | 00000210 77 68 69 63 68 20 74 68 65 20 63 6f 6d 70 75 74 |which the comput| 00000220 65 72 27 73 20 76 69 64 65 6f 20 73 79 73 74 65 |er's video syste| 00000230 6d 20 6f 70 65 72 61 74 65 73 2e 20 54 68 65 20 |m operates. The | 00000240 63 6f 6c 6f 75 72 20 6f 66 20 65 61 63 68 20 70 |colour of each p| 00000250 69 78 65 6c 0d 6f 6e 20 79 6f 75 72 20 6d 6f 6e |ixel.on your mon| 00000260 69 74 6f 72 20 69 73 20 64 65 74 65 72 6d 69 6e |itor is determin| 00000270 65 64 20 74 68 65 20 64 61 74 61 20 73 65 6e 74 |ed the data sent| 00000280 20 74 6f 20 74 68 65 20 6d 6f 6e 69 74 6f 72 20 | to the monitor | 00000290 62 79 20 79 6f 75 72 20 63 6f 6d 70 75 74 65 72 |by your computer| 000002a0 20 2d 0d 74 68 61 74 73 20 66 61 69 72 6c 79 20 | -.thats fairly | 000002b0 6f 62 76 69 6f 75 73 2e 20 42 75 74 20 69 66 20 |obvious. But if | 000002c0 79 6f 75 20 68 61 76 65 20 64 72 61 77 6e 20 61 |you have drawn a| 000002d0 20 76 65 72 79 20 63 6f 6d 70 6c 65 78 20 73 65 | very complex se| 000002e0 74 20 6f 66 20 73 68 61 70 65 73 20 6f 6e 0d 74 |t of shapes on.t| 000002f0 68 65 20 63 6f 6d 70 75 74 65 72 20 73 63 72 65 |he computer scre| 00000300 65 6e 2c 20 70 65 72 68 61 70 73 20 75 73 69 6e |en, perhaps usin| 00000310 67 20 61 20 42 41 53 49 43 20 70 72 6f 67 72 61 |g a BASIC progra| 00000320 6d 20 77 68 69 63 68 20 74 6f 6f 6b 20 73 65 76 |m which took sev| 00000330 65 72 61 6c 20 68 6f 75 72 73 0d 74 6f 20 63 61 |eral hours.to ca| 00000340 6c 63 75 6c 61 74 65 20 61 6e 64 20 64 72 61 77 |lculate and draw| 00000350 20 74 68 65 20 72 65 73 75 6c 74 20 79 6f 75 20 | the result you | 00000360 73 65 65 20 6f 6e 20 74 68 65 20 73 63 72 65 65 |see on the scree| 00000370 6e 2c 20 68 6f 77 20 64 6f 65 73 20 74 68 65 20 |n, how does the | 00000380 0d 63 6f 6d 70 75 74 65 72 20 72 65 6d 65 6d 62 |.computer rememb| 00000390 65 72 20 74 68 65 20 63 6f 6c 6f 75 72 20 6f 66 |er the colour of| 000003a0 20 65 76 65 72 79 20 70 69 78 65 6c 20 6f 6e 20 | every pixel on | 000003b0 74 68 65 20 73 63 72 65 65 6e 2c 20 61 6e 64 20 |the screen, and | 000003c0 6b 6e 6f 77 20 77 68 61 74 0d 64 61 74 61 20 74 |know what.data t| 000003d0 6f 20 73 65 6e 64 20 74 6f 20 79 6f 75 72 20 6d |o send to your m| 000003e0 6f 6e 69 74 6f 72 3f 20 54 68 65 20 61 6e 73 77 |onitor? The answ| 000003f0 65 72 20 69 73 20 73 69 6d 70 6c 65 3a 20 77 69 |er is simple: wi| 00000400 74 68 69 6e 20 79 6f 75 72 20 63 6f 6d 70 75 74 |thin your comput| 00000410 65 72 27 73 0d 6d 65 6d 6f 72 79 20 74 68 65 72 |er's.memory ther| 00000420 65 20 69 73 20 61 6e 20 61 72 65 61 20 73 65 74 |e is an area set| 00000430 20 61 73 69 64 65 20 74 6f 20 73 74 6f 72 65 20 | aside to store | 00000440 74 68 65 20 63 6f 6c 6f 75 72 20 6f 66 20 65 76 |the colour of ev| 00000450 65 72 79 20 70 69 78 65 6c 20 6f 6e 20 74 68 65 |ery pixel on the| 00000460 0d 73 63 72 65 65 6e 2c 20 61 6e 64 20 77 68 65 |.screen, and whe| 00000470 6e 20 74 68 65 20 6d 6f 6e 69 74 6f 72 20 72 65 |n the monitor re| 00000480 71 75 65 73 74 73 20 74 68 65 20 63 6f 6c 6f 75 |quests the colou| 00000490 72 20 6f 66 20 61 20 70 61 72 74 69 63 75 6c 61 |r of a particula| 000004a0 72 20 70 69 78 65 6c 2c 20 74 68 65 0d 63 6f 6d |r pixel, the.com| 000004b0 70 75 74 65 72 20 73 69 6d 70 6c 79 20 72 65 61 |puter simply rea| 000004c0 64 73 20 74 68 65 20 63 6f 6c 6f 75 72 20 6f 66 |ds the colour of| 000004d0 20 74 68 65 20 70 69 78 65 6c 20 66 72 6f 6d 20 | the pixel from | 000004e0 74 68 69 73 20 61 72 65 61 20 6f 66 20 6d 65 6d |this area of mem| 000004f0 6f 72 79 2e 0d 54 68 69 73 20 61 72 65 61 20 6f |ory..This area o| 00000500 66 20 6d 65 6d 6f 72 79 20 69 73 20 63 61 6c 6c |f memory is call| 00000510 65 64 20 22 53 63 72 65 65 6e 20 4d 65 6d 6f 72 |ed "Screen Memor| 00000520 79 22 2e 20 49 74 20 63 61 6e 20 62 65 20 63 6f |y". It can be co| 00000530 6e 73 69 64 65 72 65 64 20 61 73 20 61 0d 73 6f |nsidered as a.so| 00000540 72 74 20 6f 66 20 67 69 61 6e 74 20 74 61 62 6c |rt of giant tabl| 00000550 65 2c 20 68 6f 6c 64 69 6e 67 20 64 61 74 61 20 |e, holding data | 00000560 66 6f 72 20 74 68 65 20 63 6f 6c 6f 75 72 73 20 |for the colours | 00000570 6f 66 20 61 6c 6c 20 6f 66 20 74 68 65 20 70 69 |of all of the pi| 00000580 78 65 6c 73 20 69 6e 0d 61 20 68 75 67 65 20 6d |xels in.a huge m| 00000590 61 74 72 69 78 20 6f 66 20 6d 65 6d 6f 72 79 20 |atrix of memory | 000005a0 6c 6f 63 61 74 69 6f 6e 73 2e 0d 0d 42 75 74 20 |locations...But | 000005b0 6f 66 20 77 68 61 74 20 75 73 65 20 69 73 20 74 |of what use is t| 000005c0 68 69 73 20 74 6f 20 74 68 65 20 70 72 6f 67 72 |his to the progr| 000005d0 61 6d 6d 65 72 20 79 6f 75 20 6d 69 67 68 74 20 |ammer you might | 000005e0 62 65 20 77 6f 6e 64 65 72 69 6e 67 2e 20 54 68 |be wondering. Th| 000005f0 65 0d 61 6e 73 77 65 72 20 69 73 20 74 68 61 74 |e.answer is that| 00000600 20 77 68 65 6e 20 79 6f 75 20 75 73 65 20 75 73 | when you use us| 00000610 65 72 20 64 65 66 69 6e 65 64 20 63 68 61 72 61 |er defined chara| 00000620 63 74 65 72 73 2c 20 4d 4f 56 45 20 61 6e 64 20 |cters, MOVE and | 00000630 44 52 41 57 20 63 6f 6d 6d 61 6e 64 73 2c 0d 6f |DRAW commands,.o| 00000640 72 20 61 6e 79 20 6f 74 68 65 72 20 6d 65 74 68 |r any other meth| 00000650 6f 64 20 6f 66 20 70 75 74 74 69 6e 67 20 61 6e |od of putting an| 00000660 79 74 68 69 6e 67 20 6f 6e 20 74 68 65 20 73 63 |ything on the sc| 00000670 72 65 65 6e 2c 20 74 68 65 20 63 6f 6d 70 75 74 |reen, the comput| 00000680 65 72 20 73 69 6d 70 6c 79 0d 61 6c 74 65 72 73 |er simply.alters| 00000690 20 61 20 66 65 77 20 76 61 6c 75 65 73 20 69 6e | a few values in| 000006a0 20 74 68 69 73 20 67 69 61 6e 74 20 74 61 62 6c | this giant tabl| 000006b0 65 2e 20 42 75 74 20 74 68 65 20 63 6f 6d 70 75 |e. But the compu| 000006c0 74 65 72 20 74 61 6b 65 73 20 74 69 6d 65 20 74 |ter takes time t| 000006d0 6f 0d 70 72 6f 63 65 73 73 20 79 6f 75 72 20 4d |o.process your M| 000006e0 4f 56 45 20 61 6e 64 20 44 52 41 57 20 63 6f 6d |OVE and DRAW com| 000006f0 6d 61 6e 64 73 20 74 6f 20 77 6f 72 6b 20 6f 75 |mands to work ou| 00000700 74 20 77 68 69 63 68 20 76 61 6c 75 65 73 20 69 |t which values i| 00000710 6e 20 74 68 65 20 74 61 62 6c 65 0d 74 6f 20 61 |n the table.to a| 00000720 6c 74 65 72 2e 20 49 66 20 79 6f 75 20 63 6f 75 |lter. If you cou| 00000730 6c 64 20 62 79 70 61 73 73 20 74 68 69 73 20 73 |ld bypass this s| 00000740 74 61 67 65 2c 20 61 6e 64 20 73 65 74 20 74 68 |tage, and set th| 00000750 65 20 76 61 6c 75 65 73 20 69 6e 20 74 68 69 73 |e values in this| 00000760 20 67 69 61 6e 74 0d 74 61 62 6c 65 20 79 6f 75 | giant.table you| 00000770 72 73 65 6c 66 20 77 69 74 68 6f 75 74 20 75 73 |rself without us| 00000780 69 6e 67 20 74 68 65 20 63 6f 6d 70 75 74 65 72 |ing the computer| 00000790 27 73 20 67 65 6e 65 72 61 6c 20 70 75 72 70 6f |'s general purpo| 000007a0 73 65 20 67 72 61 70 68 69 63 73 0d 63 6f 6d 6d |se graphics.comm| 000007b0 61 6e 64 73 2c 20 79 6f 75 20 63 61 6e 20 67 65 |ands, you can ge| 000007c0 74 20 65 78 61 63 74 6c 79 20 74 68 65 20 72 65 |t exactly the re| 000007d0 73 75 6c 74 20 74 68 61 74 20 79 6f 75 20 77 61 |sult that you wa| 000007e0 6e 74 2c 20 61 6e 64 20 6d 75 63 68 20 66 61 73 |nt, and much fas| 000007f0 74 65 72 0d 74 68 61 6e 20 79 6f 75 20 77 6f 75 |ter.than you wou| 00000800 6c 64 20 61 63 68 69 65 76 65 20 69 66 20 79 6f |ld achieve if yo| 00000810 75 20 77 65 72 65 20 64 6f 69 6e 67 20 74 68 65 |u were doing the| 00000820 20 6f 70 65 72 61 74 69 6f 6e 20 74 68 72 6f 75 | operation throu| 00000830 67 68 20 74 68 65 0d 63 6f 6d 70 75 74 65 72 27 |gh the.computer'| 00000840 73 20 63 6f 6d 6d 61 6e 64 73 2e 20 54 68 65 73 |s commands. Thes| 00000850 65 20 68 61 76 65 20 74 6f 20 70 72 6f 63 65 73 |e have to proces| 00000860 73 20 74 68 65 20 70 61 72 61 6d 65 74 65 72 73 |s the parameters| 00000870 20 77 68 69 63 68 20 79 6f 75 20 67 69 76 65 2c | which you give,| 00000880 0d 61 6e 64 20 74 68 65 6e 20 63 61 6c 63 75 6c |.and then calcul| 00000890 61 74 65 20 77 68 65 72 65 20 61 62 6f 75 74 73 |ate where abouts| 000008a0 20 69 6e 20 74 68 65 20 67 69 61 6e 74 20 74 61 | in the giant ta| 000008b0 62 6c 65 20 79 6f 75 20 77 61 6e 74 20 74 6f 20 |ble you want to | 000008c0 61 6c 74 65 72 2c 0d 62 65 66 6f 72 65 20 74 68 |alter,.before th| 000008d0 65 79 20 63 61 6e 20 61 63 74 75 61 6c 6c 79 20 |ey can actually | 000008e0 64 6f 20 61 6e 79 20 75 73 65 66 75 6c 20 77 6f |do any useful wo| 000008f0 72 6b 2e 20 54 68 75 73 20 61 20 6c 6f 74 20 6f |rk. Thus a lot o| 00000900 66 20 63 6f 6d 70 75 74 65 72 20 74 69 6d 65 0d |f computer time.| 00000910 69 73 20 77 61 73 74 65 64 20 69 6e 20 70 65 72 |is wasted in per| 00000920 66 6f 72 6d 69 6e 67 20 63 61 6c 63 75 6c 61 74 |forming calculat| 00000930 69 6f 6e 73 2c 20 77 68 69 63 68 20 63 61 6e 20 |ions, which can | 00000940 61 63 74 75 61 6c 6c 79 20 62 65 20 73 6b 69 70 |actually be skip| 00000950 70 65 64 20 69 66 20 74 68 65 0d 70 72 6f 67 72 |ped if the.progr| 00000960 61 6d 6d 65 72 20 69 73 20 63 61 72 65 66 75 6c |ammer is careful| 00000970 2e 0d 0d 54 68 65 72 65 20 61 72 65 20 74 77 6f |...There are two| 00000980 20 70 6f 73 73 69 62 6c 65 20 77 61 79 73 20 6f | possible ways o| 00000990 66 20 61 63 68 69 65 76 69 6e 67 20 74 68 69 73 |f achieving this| 000009a0 20 69 64 65 61 2c 20 62 6f 74 68 20 6f 66 20 77 | idea, both of w| 000009b0 68 69 63 68 20 61 72 65 20 75 73 65 66 75 6c 0d |hich are useful.| 000009c0 69 6e 20 64 69 66 66 65 72 65 6e 74 20 73 69 74 |in different sit| 000009d0 75 61 74 69 6f 6e 73 3a 0d 0d 31 2e 20 53 61 76 |uations:..1. Sav| 000009e0 65 20 73 63 72 65 65 6e 20 6d 65 6d 6f 72 79 20 |e screen memory | 000009f0 74 6f 20 64 69 73 63 2e 0d 0d 54 68 69 73 20 69 |to disc...This i| 00000a00 64 65 61 20 69 73 20 66 61 69 72 6c 79 20 73 69 |dea is fairly si| 00000a10 6d 70 6c 65 20 74 6f 20 75 6e 64 65 72 73 74 61 |mple to understa| 00000a20 6e 64 2e 20 59 6f 75 2c 20 61 73 20 74 68 65 20 |nd. You, as the | 00000a30 70 72 6f 67 72 61 6d 6d 65 72 2c 20 77 72 69 74 |programmer, writ| 00000a40 65 20 61 0d 70 72 6f 67 72 61 6d 20 74 6f 20 70 |e a.program to p| 00000a50 6c 6f 74 20 74 68 65 20 61 72 74 77 6f 72 6b 20 |lot the artwork | 00000a60 66 6f 72 20 79 6f 75 72 20 70 72 6f 67 72 61 6d |for your program| 00000a70 20 6f 6e 74 6f 20 74 68 65 20 73 63 72 65 65 6e | onto the screen| 00000a80 2c 20 74 61 6b 69 6e 67 0d 68 6f 77 65 76 65 72 |, taking.however| 00000a90 20 6d 61 6e 79 20 68 6f 75 72 73 20 69 74 20 6d | many hours it m| 00000aa0 61 79 20 74 61 6b 65 20 74 6f 20 63 6f 6d 70 6c |ay take to compl| 00000ab0 65 74 65 20 61 6c 6c 20 6f 66 20 74 68 65 20 63 |ete all of the c| 00000ac0 61 6c 63 75 6c 61 74 69 6f 6e 73 0d 72 65 71 75 |alculations.requ| 00000ad0 69 72 65 64 20 74 6f 20 70 6c 6f 74 20 74 68 65 |ired to plot the| 00000ae0 20 67 72 61 70 68 69 63 73 2e 20 59 6f 75 20 72 | graphics. You r| 00000af0 75 6e 20 74 68 69 73 20 70 72 6f 67 72 61 6d 20 |un this program | 00000b00 6f 6e 63 65 20 6f 6e 20 79 6f 75 72 20 63 6f 6d |once on your com| 00000b10 70 75 74 65 72 2c 0d 73 6f 20 74 68 61 74 20 79 |puter,.so that y| 00000b20 6f 75 72 20 6d 61 73 74 65 72 70 69 65 63 65 20 |our masterpiece | 00000b30 69 73 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 |is stored in the| 00000b40 20 73 63 72 65 65 6e 20 6d 65 6d 6f 72 79 20 6f | screen memory o| 00000b50 66 20 79 6f 75 72 20 63 6f 6d 70 75 74 65 72 0d |f your computer.| 00000b60 28 69 65 2e 20 69 73 20 6f 6e 20 74 68 65 20 6d |(ie. is on the m| 00000b70 6f 6e 69 74 6f 72 20 6f 66 20 79 6f 75 72 20 63 |onitor of your c| 00000b80 6f 6d 70 75 74 65 72 29 2e 20 59 6f 75 20 74 68 |omputer). You th| 00000b90 61 6e 20 74 72 61 6e 73 66 65 72 20 74 68 65 20 |an transfer the | 00000ba0 65 6e 74 69 72 65 0d 63 6f 6e 74 65 6e 74 73 20 |entire.contents | 00000bb0 6f 66 20 74 68 65 20 73 63 72 65 65 6e 20 6d 65 |of the screen me| 00000bc0 6d 6f 72 79 20 6f 6e 20 79 6f 75 72 20 63 6f 6d |mory on your com| 00000bd0 70 75 74 65 72 20 74 6f 20 66 6c 6f 70 70 79 20 |puter to floppy | 00000be0 64 69 73 63 2e 0d 0d 54 68 65 6e 2c 20 69 6e 20 |disc...Then, in | 00000bf0 74 68 65 20 66 69 6e 61 6c 20 70 72 6f 67 72 61 |the final progra| 00000c00 6d 20 77 68 69 63 68 20 79 6f 75 20 77 61 6e 74 |m which you want| 00000c10 20 74 68 65 20 75 73 65 72 20 74 6f 20 6f 70 65 | the user to ope| 00000c20 72 61 74 65 2c 20 79 6f 75 20 69 6e 63 6c 75 64 |rate, you includ| 00000c30 65 0d 61 20 63 6f 6d 6d 61 6e 64 20 74 6f 20 6c |e.a command to l| 00000c40 6f 61 64 20 74 68 69 73 20 64 61 74 61 20 62 61 |oad this data ba| 00000c50 63 6b 20 66 72 6f 6d 20 66 6c 6f 70 70 79 20 64 |ck from floppy d| 00000c60 69 73 63 20 69 6e 74 6f 20 74 68 65 20 73 63 72 |isc into the scr| 00000c70 65 65 6e 20 6d 65 6d 6f 72 79 0d 6f 66 20 74 68 |een memory.of th| 00000c80 65 69 72 20 63 6f 6d 70 75 74 65 72 2e 20 49 6e |eir computer. In| 00000c90 20 61 20 6d 61 74 74 65 72 20 6f 66 20 61 20 63 | a matter of a c| 00000ca0 6f 75 70 6c 65 20 6f 66 20 73 65 63 6f 6e 64 73 |ouple of seconds| 00000cb0 2c 20 67 72 61 70 68 69 63 73 20 77 68 69 63 68 |, graphics which| 00000cc0 20 74 6f 6f 6b 0d 70 6f 73 73 69 62 6c 65 20 68 | took.possible h| 00000cd0 6f 75 72 73 20 74 6f 20 63 61 6c 63 75 6c 61 74 |ours to calculat| 00000ce0 65 20 77 69 6c 6c 20 61 70 70 65 61 72 20 6f 6e |e will appear on| 00000cf0 20 74 68 65 69 72 20 73 63 72 65 65 6e 2e 20 54 | their screen. T| 00000d00 68 69 73 20 69 73 20 61 0d 74 65 63 68 6e 69 71 |his is a.techniq| 00000d10 75 65 20 77 68 69 63 68 20 49 20 68 61 76 65 20 |ue which I have | 00000d20 75 73 65 64 20 69 6e 20 73 65 76 65 72 61 6c 20 |used in several | 00000d30 6f 66 20 6d 79 20 70 72 6f 67 72 61 6d 73 2e 20 |of my programs. | 00000d40 54 68 65 20 6d 61 69 6e 20 6d 65 6e 75 20 6f 66 |The main menu of| 00000d50 0d 53 68 69 70 77 72 65 63 6b 65 64 20 49 49 3a |.Shipwrecked II:| 00000d60 20 4a 75 70 69 74 65 72 20 33 2c 20 77 68 65 72 | Jupiter 3, wher| 00000d70 65 20 79 6f 75 20 73 65 6c 65 63 74 20 50 6c 61 |e you select Pla| 00000d80 79 2c 20 49 6e 73 74 72 75 63 74 69 6f 6e 73 2c |y, Instructions,| 00000d90 20 47 61 6d 65 0d 43 6f 6d 70 6c 65 74 65 20 6f | Game.Complete o| 00000da0 72 20 43 68 65 61 74 20 77 69 74 68 20 74 68 65 |r Cheat with the| 00000db0 20 73 74 61 72 66 69 65 6c 64 20 62 61 63 6b 64 | starfield backd| 00000dc0 72 6f 70 20 77 61 73 20 64 6f 6e 65 20 69 6e 20 |rop was done in | 00000dd0 74 68 69 73 20 77 61 79 20 2d 20 74 68 65 0d 73 |this way - the.s| 00000de0 63 72 65 65 6e 20 74 6f 6f 6b 20 6e 65 61 72 6c |creen took nearl| 00000df0 79 20 61 6e 20 68 6f 75 72 20 66 6f 72 20 6d 79 |y an hour for my| 00000e00 20 63 6f 6d 70 75 74 65 72 20 74 6f 20 63 61 6c | computer to cal| 00000e10 63 75 6c 61 74 65 2c 20 62 75 74 20 49 20 77 61 |culate, but I wa| 00000e20 73 20 61 62 6c 65 0d 74 6f 20 6d 61 6b 65 20 69 |s able.to make i| 00000e30 74 20 61 70 70 65 61 72 20 69 6e 20 73 65 63 6f |t appear in seco| 00000e40 6e 64 73 20 6f 6e 20 79 6f 75 72 20 73 63 72 65 |nds on your scre| 00000e50 65 6e 2e 20 49 20 73 68 6f 75 6c 64 20 61 6c 73 |en. I should als| 00000e60 6f 20 6d 65 6e 74 69 6f 6e 20 74 68 65 20 74 69 |o mention the ti| 00000e70 74 6c 65 0d 73 63 72 65 65 6e 20 74 6f 20 53 68 |tle.screen to Sh| 00000e80 69 70 77 72 65 63 6b 20 77 69 74 68 20 74 68 65 |ipwreck with the| 00000e90 20 61 6e 69 6d 61 74 65 64 20 73 65 61 2c 20 6e | animated sea, n| 00000ea0 6f 74 20 74 6f 20 6d 65 6e 74 69 6f 6e 20 74 68 |ot to mention th| 00000eb0 65 20 65 6e 64 6c 65 73 73 20 45 55 47 0d 74 69 |e endless EUG.ti| 00000ec0 74 6c 65 20 73 63 72 65 65 6e 73 20 49 20 68 61 |tle screens I ha| 00000ed0 76 65 20 64 6f 6e 65 20 69 6e 20 74 68 69 73 20 |ve done in this | 00000ee0 77 61 79 20 2d 20 74 68 65 20 43 68 72 69 73 74 |way - the Christ| 00000ef0 6d 61 73 20 45 55 47 20 33 35 20 73 63 72 65 65 |mas EUG 35 scree| 00000f00 6e 20 77 69 74 68 0d 74 68 65 20 73 77 69 72 6c |n with.the swirl| 00000f10 79 20 62 6c 75 65 20 62 61 63 6b 67 72 6f 75 6e |y blue backgroun| 00000f20 64 20 28 63 72 65 64 69 74 65 64 20 65 72 72 6f |d (credited erro| 00000f30 6e 65 6f 75 73 6c 79 20 74 6f 20 52 6f 62 65 72 |neously to Rober| 00000f40 74 20 53 70 72 6f 77 73 6f 6e 29 20 74 6f 6f 6b |t Sprowson) took| 00000f50 0d 74 77 6f 20 77 68 6f 6c 65 20 64 61 79 73 20 |.two whole days | 00000f60 74 6f 20 70 6c 6f 74 21 0d 0d 49 6e 20 6f 72 64 |to plot!..In ord| 00000f70 65 72 20 74 6f 20 61 63 68 69 65 76 65 20 74 68 |er to achieve th| 00000f80 69 73 2c 20 79 6f 75 20 73 69 6d 70 6c 79 20 6e |is, you simply n| 00000f90 65 65 64 20 74 6f 20 75 6e 64 65 72 73 74 61 6e |eed to understan| 00000fa0 64 20 74 77 6f 20 42 41 53 49 43 20 63 6f 6d 6d |d two BASIC comm| 00000fb0 61 6e 64 73 3a 0d 0d 2a 53 41 56 45 20 46 69 6c |ands:..*SAVE Fil| 00000fc0 65 6e 61 6d 65 20 6e 6e 6e 6e 20 6d 6d 6d 6d 0d |ename nnnn mmmm.| 00000fd0 2a 4c 4f 41 44 20 46 69 6c 65 6e 61 6d 65 20 6e |*LOAD Filename n| 00000fe0 6e 6e 6e 0d 0d 54 68 65 73 65 20 6c 6f 61 64 20 |nnn..These load | 00000ff0 61 6e 64 20 73 61 76 65 20 61 72 65 61 73 20 6f |and save areas o| 00001000 66 20 74 68 65 20 63 6f 6d 70 75 74 65 72 27 73 |f the computer's| 00001010 20 6d 65 6d 6f 72 79 20 74 6f 20 66 6c 6f 70 70 | memory to flopp| 00001020 79 20 64 69 73 63 20 6f 72 20 63 61 73 73 65 74 |y disc or casset| 00001030 74 65 0d 77 69 74 68 20 74 68 65 20 66 69 6c 65 |te.with the file| 00001040 6e 61 6d 65 20 67 69 76 61 6e 20 69 6e 20 70 6c |name givan in pl| 00001050 61 63 65 20 6f 66 20 74 68 65 20 77 6f 72 6b 20 |ace of the work | 00001060 46 69 6c 65 6e 61 6d 65 2c 20 73 74 61 72 74 69 |Filename, starti| 00001070 6e 67 20 61 74 20 6d 65 6d 6f 72 79 0d 6c 6f 63 |ng at memory.loc| 00001080 61 74 69 6f 6e 20 6e 6e 6e 6e 2c 20 61 6e 64 20 |ation nnnn, and | 00001090 63 6f 6e 74 69 6e 75 69 6e 67 20 75 6e 74 69 6c |continuing until| 000010a0 20 6d 65 6d 6f 72 79 20 6c 6f 63 61 74 69 6f 6e | memory location| 000010b0 20 6d 6d 6d 6d 20 28 77 68 65 72 65 20 6e 6e 6e | mmmm (where nnn| 000010c0 6e 20 61 6e 64 20 6d 6d 6d 6d 0d 61 72 65 20 62 |n and mmmm.are b| 000010d0 6f 74 68 20 69 6e 20 68 65 78 69 64 65 63 69 6d |oth in hexidecim| 000010e0 61 6c 20 2d 20 62 61 73 65 20 31 36 29 2e 20 44 |al - base 16). D| 000010f0 6f 6e 27 74 20 77 6f 72 72 79 20 69 66 20 79 6f |on't worry if yo| 00001100 75 20 64 6f 6e 27 74 20 65 6e 74 69 72 65 6c 79 |u don't entirely| 00001110 0d 75 6e 64 65 72 73 74 61 6e 64 20 74 68 69 73 |.understand this| 00001120 20 2d 20 69 74 20 69 73 20 6e 6f 74 20 6e 65 63 | - it is not nec| 00001130 65 73 73 61 72 79 20 74 6f 20 65 6e 74 69 72 65 |essary to entire| 00001140 6c 79 20 75 6e 64 65 72 73 74 61 6e 64 20 74 68 |ly understand th| 00001150 65 20 77 6f 72 6b 69 6e 67 73 0d 6f 66 20 74 68 |e workings.of th| 00001160 65 73 65 20 63 6f 6d 6d 61 6e 64 73 2c 20 6f 72 |ese commands, or| 00001170 20 6f 66 20 68 65 78 69 64 65 63 69 6d 61 6c 20 | of hexidecimal | 00001180 74 6f 20 75 73 65 20 74 68 65 6d 20 74 6f 20 73 |to use them to s| 00001190 74 6f 72 65 20 61 6e 64 20 72 65 74 72 69 65 76 |tore and retriev| 000011a0 65 0d 73 63 72 65 65 6e 20 6d 65 6d 6f 72 79 2e |e.screen memory.| 000011b0 20 41 6c 6c 20 79 6f 75 20 6e 65 65 64 20 74 6f | All you need to| 000011c0 20 64 6f 20 69 73 20 73 75 62 73 74 69 74 75 74 | do is substitut| 000011d0 65 20 6e 6e 6e 6e 20 61 6e 64 20 6d 6d 6d 6d 20 |e nnnn and mmmm | 000011e0 66 6f 72 20 74 68 65 0d 61 64 64 72 65 73 73 65 |for the.addresse| 000011f0 73 20 6f 66 20 74 68 65 20 73 74 61 72 74 20 61 |s of the start a| 00001200 6e 64 20 66 69 6e 69 73 68 20 6f 66 20 73 63 72 |nd finish of scr| 00001210 65 65 6e 20 6d 65 6d 6f 72 79 2e 20 54 68 65 20 |een memory. The | 00001220 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 73 |location of thes| 00001230 65 0d 77 69 74 68 69 6e 20 79 6f 75 72 20 63 6f |e.within your co| 00001240 6d 70 75 74 65 72 20 76 61 72 69 65 73 20 64 65 |mputer varies de| 00001250 70 65 64 69 6e 67 20 75 70 6f 6e 20 77 68 69 63 |peding upon whic| 00001260 68 20 67 72 61 70 68 69 63 73 20 6d 6f 64 65 20 |h graphics mode | 00001270 79 6f 75 20 61 72 65 20 75 73 69 6e 67 0d 28 77 |you are using.(w| 00001280 68 69 63 68 20 79 6f 75 20 73 65 6c 65 63 74 65 |hich you selecte| 00001290 64 20 75 73 69 6e 67 20 74 68 65 20 4d 4f 44 45 |d using the MODE| 000012a0 20 63 6f 6d 6d 61 6e 64 20 2d 20 73 65 65 20 70 | command - see p| 000012b0 72 65 76 69 6f 75 73 20 74 75 74 6f 72 69 61 6c |revious tutorial| 000012c0 20 69 66 20 79 6f 75 0d 61 72 65 20 75 6e 73 75 | if you.are unsu| 000012d0 72 65 20 6f 66 20 77 68 61 74 20 74 68 69 73 20 |re of what this | 000012e0 69 73 29 2c 20 62 75 74 20 69 73 20 61 6c 77 61 |is), but is alwa| 000012f0 79 73 20 63 6f 6e 73 74 61 6e 74 20 66 6f 72 20 |ys constant for | 00001300 61 6e 79 20 70 61 72 74 69 63 75 6c 61 72 0d 6d |any particular.m| 00001310 6f 64 65 2e 20 74 68 65 20 76 61 6c 75 65 73 20 |ode. the values | 00001320 66 6f 72 20 74 68 65 20 64 69 66 66 65 72 65 6e |for the differen| 00001330 74 20 6d 6f 64 65 73 20 61 72 65 20 67 69 76 65 |t modes are give| 00001340 6e 20 62 65 6c 6f 77 3a 0d 0d 4d 6f 64 65 20 20 |n below:..Mode | 00001350 20 20 20 20 20 20 20 20 20 20 6e 6e 6e 6e 20 20 | nnnn | 00001360 20 20 6d 6d 6d 6d 20 20 20 4e 4f 54 45 53 3a 0d | mmmm NOTES:.| 00001370 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |0 | 00001380 33 30 30 30 20 20 20 20 37 46 46 46 0d 31 20 20 |3000 7FFF.1 | 00001390 20 20 20 20 20 20 20 20 20 20 20 20 20 33 30 30 | 300| 000013a0 30 20 20 20 20 37 46 46 46 20 20 20 2d 20 6e 6e |0 7FFF - nn| 000013b0 6e 6e 20 61 6e 64 20 6d 6d 6d 6d 20 76 61 6c 75 |nn and mmmm valu| 000013c0 65 73 20 67 69 76 65 6e 20 74 6f 20 74 68 65 20 |es given to the | 000013d0 6c 65 66 74 20 61 72 65 0d 32 20 20 20 20 20 20 |left are.2 | 000013e0 20 20 20 20 20 20 20 20 20 33 30 30 30 20 20 20 | 3000 | 000013f0 20 37 46 46 46 20 20 20 61 6c 6c 20 69 6e 20 68 | 7FFF all in h| 00001400 65 78 69 64 65 63 69 6d 61 6c 2e 20 54 68 65 72 |exidecimal. Ther| 00001410 65 66 6f 72 65 20 74 68 65 79 20 63 61 6e 20 62 |efore they can b| 00001420 65 0d 33 20 20 20 20 20 20 20 20 20 20 20 20 20 |e.3 | 00001430 20 20 34 30 30 30 20 20 20 20 37 46 46 46 20 20 | 4000 7FFF | 00001440 20 73 75 62 73 74 69 74 75 74 65 64 20 64 69 72 | substituted dir| 00001450 65 63 74 6c 79 20 69 6e 74 6f 20 74 68 65 20 2a |ectly into the *| 00001460 4c 4f 41 44 20 61 6e 64 20 2a 53 41 56 45 0d 34 |LOAD and *SAVE.4| 00001470 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 | 5| 00001480 38 30 30 20 20 20 20 37 46 46 46 20 20 20 63 6f |800 7FFF co| 00001490 6d 6d 61 6e 64 73 20 77 69 74 68 20 6e 6f 20 63 |mmands with no c| 000014a0 6f 6e 76 65 72 73 69 6f 6e 20 72 65 71 75 69 72 |onversion requir| 000014b0 65 64 2e 0d 35 20 20 20 20 20 20 20 20 20 20 20 |ed..5 | 000014c0 20 20 20 20 35 38 30 30 20 20 20 20 37 46 46 46 | 5800 7FFF| 000014d0 0d 36 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |.6 | 000014e0 20 36 30 30 30 20 20 20 20 37 46 46 46 20 20 20 | 6000 7FFF | 000014f0 2d 20 56 61 6c 75 65 73 20 61 72 65 20 6e 6f 74 |- Values are not| 00001500 20 76 61 6c 69 64 20 66 6f 72 20 74 68 65 20 42 | valid for the B| 00001510 42 43 20 6d 6f 64 65 6c 20 41 20 69 6e 0d 37 20 |BC model A in.7 | 00001520 20 20 20 20 20 20 20 20 20 20 20 20 20 20 37 43 | 7C| 00001530 30 30 20 20 20 20 37 46 46 46 20 20 20 6d 6f 64 |00 7FFF mod| 00001540 65 73 20 34 2c 35 2c 36 20 6f 72 20 37 2e 0d 0d |es 4,5,6 or 7...| 00001550 45 78 61 6d 70 6c 65 73 3a 0d 0d 53 75 70 70 6f |Examples:..Suppo| 00001560 73 65 20 79 6f 75 20 61 72 65 20 69 6e 20 6d 6f |se you are in mo| 00001570 64 65 20 32 2c 20 61 6e 64 20 77 61 6e 74 20 74 |de 2, and want t| 00001580 6f 20 73 74 6f 72 65 20 74 68 65 20 73 63 72 65 |o store the scre| 00001590 65 6e 20 74 6f 20 61 20 66 6c 6f 70 70 79 2e 20 |en to a floppy. | 000015a0 46 72 6f 6d 0d 74 68 65 20 74 61 62 6c 65 20 61 |From.the table a| 000015b0 62 6f 76 65 2c 20 6e 6e 6e 6e 20 69 73 20 33 30 |bove, nnnn is 30| 000015c0 30 30 20 61 6e 64 20 6d 6d 6d 6d 20 69 73 20 37 |00 and mmmm is 7| 000015d0 46 46 46 20 66 6f 72 20 6d 6f 64 65 20 32 2e 20 |FFF for mode 2. | 000015e0 54 68 65 72 65 66 6f 72 65 2c 20 74 6f 0d 73 61 |Therefore, to.sa| 000015f0 76 65 20 74 68 65 20 73 63 72 65 65 6e 20 75 6e |ve the screen un| 00001600 64 65 72 20 74 68 65 20 66 69 6c 65 6e 61 6d 65 |der the filename| 00001610 20 22 53 63 72 65 65 6e 22 2c 20 79 6f 75 20 77 | "Screen", you w| 00001620 6f 75 6c 64 20 74 79 70 65 3a 0d 0d 2a 53 41 56 |ould type:..*SAV| 00001630 45 20 53 63 72 65 65 6e 20 33 30 30 30 20 37 46 |E Screen 3000 7F| 00001640 46 46 0d 0d 4e 6f 77 2c 20 69 66 20 79 6f 75 20 |FF..Now, if you | 00001650 77 61 6e 74 20 74 6f 20 72 65 73 74 6f 72 65 20 |want to restore | 00001660 74 68 65 20 73 63 72 65 65 6e 20 61 67 61 69 6e |the screen again| 00001670 2c 20 61 6e 64 20 70 75 74 20 79 6f 75 72 20 67 |, and put your g| 00001680 72 61 70 68 69 63 73 20 62 61 63 6b 0d 6f 6e 20 |raphics back.on | 00001690 74 68 65 20 73 63 72 65 65 6e 20 61 67 61 69 6e |the screen again| 000016a0 2c 20 79 6f 75 20 77 6f 75 6c 64 20 75 73 65 20 |, you would use | 000016b0 2a 4c 4f 41 44 2e 20 4e 6f 74 69 63 65 20 74 68 |*LOAD. Notice th| 000016c0 61 74 20 74 68 69 73 20 74 69 6d 65 20 6f 6e 6c |at this time onl| 000016d0 79 20 61 0d 76 61 6c 75 65 20 66 6f 72 20 6e 6e |y a.value for nn| 000016e0 6e 6e 20 69 73 20 72 65 71 75 69 72 65 64 2c 20 |nn is required, | 000016f0 61 6e 64 20 6e 6f 74 20 66 6f 72 20 6d 6d 6d 6d |and not for mmmm| 00001700 3a 0d 0d 2a 4c 4f 41 44 20 53 63 72 65 65 6e 20 |:..*LOAD Screen | 00001710 33 30 30 30 0d 0d 59 6f 75 20 63 61 6e 20 74 72 |3000..You can tr| 00001720 79 20 74 68 69 73 20 6f 75 74 20 6e 6f 77 2c 20 |y this out now, | 00001730 69 66 20 79 6f 75 20 73 77 69 74 63 68 20 6f 6e |if you switch on| 00001740 20 79 6f 75 72 20 45 6c 65 63 74 72 6f 6e 2c 20 | your Electron, | 00001750 61 6e 64 20 69 6e 73 65 72 74 20 61 20 77 6f 72 |and insert a wor| 00001760 6b 0d 64 69 73 63 20 69 6e 74 6f 20 79 6f 75 72 |k.disc into your| 00001770 20 66 6c 6f 70 70 79 20 64 72 69 76 65 2e 20 49 | floppy drive. I| 00001780 66 20 79 6f 75 20 75 73 65 20 41 44 46 53 2c 20 |f you use ADFS, | 00001790 79 6f 75 20 6d 61 79 20 6e 65 65 64 20 74 6f 20 |you may need to | 000017a0 75 73 65 20 2a 4d 4f 55 4e 54 0d 74 6f 20 73 65 |use *MOUNT.to se| 000017b0 6c 65 63 74 20 74 68 65 20 66 6c 6f 70 70 79 20 |lect the floppy | 000017c0 64 69 73 63 2c 20 61 6e 64 20 62 65 20 61 62 6c |disc, and be abl| 000017d0 65 20 74 6f 20 77 72 69 74 65 20 74 6f 20 69 74 |e to write to it| 000017e0 2e 20 4e 6f 77 20 65 6e 74 65 72 20 6d 6f 64 65 |. Now enter mode| 000017f0 20 32 0d 62 79 20 74 79 70 69 6e 67 3a 0d 0d 4d | 2.by typing:..M| 00001800 4f 44 45 20 32 0d 0d 4e 6f 77 20 74 79 70 65 20 |ODE 2..Now type | 00001810 73 6f 6d 65 20 74 65 78 74 20 6f 6e 20 74 68 65 |some text on the| 00001820 20 73 63 72 65 65 6e 20 77 68 69 63 68 20 77 69 | screen which wi| 00001830 6c 6c 20 72 65 70 72 65 73 65 6e 74 20 74 68 65 |ll represent the| 00001840 20 67 72 61 70 68 69 63 73 20 77 68 69 63 68 0d | graphics which.| 00001850 79 6f 75 20 77 61 6e 74 20 74 6f 20 73 61 76 65 |you want to save| 00001860 2e 20 57 68 65 6e 20 79 6f 75 20 68 61 76 65 20 |. When you have | 00001870 66 69 6e 69 73 68 65 64 2c 20 73 61 76 65 20 74 |finished, save t| 00001880 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 73 |he contents of s| 00001890 63 72 65 65 6e 20 6d 65 6d 6f 72 79 0d 74 6f 20 |creen memory.to | 000018a0 66 6c 6f 70 70 79 20 64 69 73 6b 20 61 73 20 73 |floppy disk as s| 000018b0 68 6f 77 6e 20 61 62 6f 76 65 2c 20 62 79 20 74 |hown above, by t| 000018c0 79 70 69 6e 67 3a 0d 0d 2a 53 41 56 45 20 53 63 |yping:..*SAVE Sc| 000018d0 72 65 65 6e 20 33 30 30 30 20 37 46 46 46 0d 0d |reen 3000 7FFF..| 000018e0 57 68 65 6e 20 74 68 65 20 64 69 73 6b 20 64 72 |When the disk dr| 000018f0 69 76 65 20 68 61 73 20 66 69 6e 69 73 68 65 64 |ive has finished| 00001900 2c 20 63 6c 65 61 72 20 74 68 65 20 74 65 78 74 |, clear the text| 00001910 20 6f 66 66 20 74 68 65 20 73 63 72 65 65 6e 20 | off the screen | 00001920 62 79 20 74 79 70 69 6e 67 3a 0d 0d 43 4c 53 0d |by typing:..CLS.| 00001930 0d 54 68 65 20 74 65 78 74 20 77 68 69 63 68 20 |.The text which | 00001940 79 6f 75 20 74 79 70 65 64 20 6f 6e 74 6f 20 74 |you typed onto t| 00001950 68 65 20 73 63 72 65 65 6e 20 68 61 73 20 6e 6f |he screen has no| 00001960 77 20 62 65 65 6e 20 77 69 70 65 64 20 66 72 6f |w been wiped fro| 00001970 6d 20 74 68 65 0d 63 6f 6d 70 75 74 65 72 27 73 |m the.computer's| 00001980 20 6d 65 6d 6f 72 79 2c 20 62 75 74 20 73 68 6f | memory, but sho| 00001990 75 6c 64 20 73 74 69 6c 6c 20 62 65 20 73 74 6f |uld still be sto| 000019a0 72 65 64 20 6f 6e 20 74 68 65 20 66 6c 6f 70 70 |red on the flopp| 000019b0 79 20 64 69 73 63 2e 20 57 65 20 63 61 6e 0d 73 |y disc. We can.s| 000019c0 68 6f 77 20 74 68 61 74 20 74 68 69 73 20 69 73 |how that this is| 000019d0 20 73 6f 20 62 79 20 74 79 70 69 6e 67 3a 0d 0d | so by typing:..| 000019e0 2a 4c 4f 41 44 20 53 63 72 65 65 6e 20 33 30 30 |*LOAD Screen 300| 000019f0 30 0d 0d 59 6f 75 72 20 74 65 78 74 20 73 68 6f |0..Your text sho| 00001a00 75 6c 64 20 6e 6f 77 20 72 65 61 70 70 65 61 72 |uld now reappear| 00001a10 20 6f 6e 20 74 68 65 20 73 63 72 65 65 6e 2e 20 | on the screen. | 00001a20 59 6f 75 20 63 61 6e 20 72 65 70 65 61 74 20 74 |You can repeat t| 00001a30 68 69 73 20 77 69 74 68 20 61 6e 79 0d 6b 69 6e |his with any.kin| 00001a40 64 20 6f 66 20 63 6f 6d 70 6c 65 78 20 67 72 61 |d of complex gra| 00001a50 70 68 69 63 73 20 6f 6e 20 73 63 72 65 65 6e 2c |phics on screen,| 00001a60 20 61 6e 64 20 69 74 20 77 69 6c 6c 20 73 74 69 | and it will sti| 00001a70 6c 6c 20 77 6f 72 6b 2e 20 54 68 65 20 73 61 6d |ll work. The sam| 00001a80 65 20 63 61 6e 0d 62 65 20 64 6f 6e 65 20 69 6e |e can.be done in| 00001a90 20 61 6e 79 20 6f 74 68 65 72 20 67 72 61 70 68 | any other graph| 00001aa0 69 63 73 20 6d 6f 64 65 2c 20 73 69 6d 70 6c 79 |ics mode, simply| 00001ab0 20 62 79 20 63 68 61 6e 67 69 6e 67 20 74 68 65 | by changing the| 00001ac0 20 76 61 6c 75 65 73 20 6f 66 20 6e 6e 6e 6e 0d | values of nnnn.| 00001ad0 61 6e 64 20 6d 6d 6d 6d 20 74 6f 20 74 68 6f 73 |and mmmm to thos| 00001ae0 65 20 67 69 76 65 6e 20 69 6e 20 74 68 65 20 74 |e given in the t| 00001af0 61 62 6c 65 20 61 62 6f 76 65 2e 20 46 6f 72 20 |able above. For | 00001b00 65 78 61 6d 70 6c 65 20 69 6e 20 6d 6f 64 65 20 |example in mode | 00001b10 35 20 79 6f 75 0d 77 6f 75 6c 64 20 75 73 65 3a |5 you.would use:| 00001b20 0d 0d 2a 53 41 56 45 20 53 63 72 65 65 6e 20 35 |..*SAVE Screen 5| 00001b30 38 30 30 20 37 46 46 46 0d 0d 66 6f 6c 6c 6f 77 |800 7FFF..follow| 00001b40 65 64 20 62 79 3a 0d 0d 2a 4c 4f 41 44 20 53 63 |ed by:..*LOAD Sc| 00001b50 72 65 65 6e 20 35 38 30 30 20 37 46 46 46 0d 0d |reen 5800 7FFF..| 00001b60 54 68 65 72 65 20 61 72 65 2c 20 68 6f 77 65 76 |There are, howev| 00001b70 65 72 2c 20 61 20 66 65 77 20 70 72 65 63 61 75 |er, a few precau| 00001b80 74 69 6f 6e 61 72 79 20 70 6f 69 6e 74 73 20 77 |tionary points w| 00001b90 68 69 63 68 20 73 68 6f 75 6c 64 20 62 65 20 6d |hich should be m| 00001ba0 65 6e 74 69 6f 6e 65 64 0d 61 62 6f 75 74 20 74 |entioned.about t| 00001bb0 68 69 73 20 74 65 63 68 6e 69 71 75 65 20 6f 66 |his technique of| 00001bc0 20 73 61 76 69 6e 67 20 73 63 72 65 65 6e 20 6d | saving screen m| 00001bd0 65 6d 6f 72 79 3a 0d 0d 2d 20 41 73 20 79 6f 75 |emory:..- As you| 00001be0 20 70 72 6f 62 61 62 6c 79 20 72 65 61 6c 69 73 | probably realis| 00001bf0 65 2c 20 69 6e 20 66 6f 75 72 20 63 6f 6c 6f 75 |e, in four colou| 00001c00 72 20 6d 6f 64 65 73 2c 20 74 68 65 20 66 6f 75 |r modes, the fou| 00001c10 72 20 63 6f 6c 6f 75 72 73 20 79 6f 75 0d 63 61 |r colours you.ca| 00001c20 6e 20 75 73 65 20 63 61 6e 20 62 65 20 63 68 61 |n use can be cha| 00001c30 6e 67 65 64 20 66 72 6f 6d 20 74 68 65 20 64 65 |nged from the de| 00001c40 66 61 75 6c 74 20 62 6c 61 63 6b 2c 20 72 65 64 |fault black, red| 00001c50 2c 20 79 65 6c 6c 6f 77 20 61 6e 64 20 77 68 69 |, yellow and whi| 00001c60 74 65 20 62 79 0d 75 73 69 6e 67 20 56 44 55 20 |te by.using VDU | 00001c70 31 39 20 74 6f 20 63 68 61 6e 67 65 20 74 68 65 |19 to change the| 00001c80 20 70 61 6c 65 74 74 65 2e 20 54 68 65 20 63 6f | palette. The co| 00001c90 6c 6f 75 72 73 20 69 6e 20 74 68 65 20 70 61 6c |lours in the pal| 00001ca0 65 74 74 65 20 61 72 65 20 6e 6f 74 0d 73 61 76 |ette are not.sav| 00001cb0 65 64 20 77 68 65 6e 20 74 68 69 73 20 74 65 63 |ed when this tec| 00001cc0 68 6e 69 71 75 65 20 69 73 20 75 73 65 64 2c 20 |hnique is used, | 00001cd0 61 6e 64 20 6d 75 73 74 20 62 65 20 72 65 73 74 |and must be rest| 00001ce0 6f 72 65 64 20 62 79 20 72 65 70 65 61 74 69 6e |ored by repeatin| 00001cf0 67 20 74 68 65 0d 56 44 55 20 31 39 20 63 6f 6d |g the.VDU 19 com| 00001d00 6d 61 6e 64 73 20 61 67 61 69 6e 2e 20 49 66 20 |mands again. If | 00001d10 79 6f 75 20 64 65 66 69 6e 65 20 74 68 65 20 70 |you define the p| 00001d20 61 6c 65 74 74 65 20 74 6f 2c 20 66 6f 72 20 65 |alette to, for e| 00001d30 78 61 6d 70 6c 65 2c 20 62 6c 61 63 6b 2c 0d 62 |xample, black,.b| 00001d40 6c 75 65 2c 20 63 79 61 6e 20 61 6e 64 20 77 68 |lue, cyan and wh| 00001d50 69 74 65 2c 20 61 6e 64 20 63 72 65 61 74 65 20 |ite, and create | 00001d60 61 20 70 69 63 74 75 72 65 20 77 68 69 63 68 20 |a picture which | 00001d70 6c 6f 6f 6b 73 20 67 6f 6f 64 20 69 6e 20 74 68 |looks good in th| 00001d80 69 73 20 63 6f 6c 6f 75 72 0d 73 63 68 65 6d 65 |is colour.scheme| 00001d90 2c 20 79 6f 75 20 6d 75 73 74 20 72 65 6d 65 6d |, you must remem| 00001da0 62 65 72 20 74 68 61 74 20 75 6e 6c 65 73 73 20 |ber that unless | 00001db0 79 6f 75 20 64 65 66 69 6e 65 20 74 68 65 20 70 |you define the p| 00001dc0 61 6c 65 74 74 65 20 74 6f 20 74 68 65 73 65 20 |alette to these | 00001dd0 66 6f 75 72 0d 63 6f 6c 6f 75 72 73 20 62 65 66 |four.colours bef| 00001de0 6f 72 65 20 70 65 72 66 6f 72 6d 69 6e 67 20 2a |ore performing *| 00001df0 4c 4f 41 44 20 74 6f 20 72 65 73 74 6f 72 65 20 |LOAD to restore | 00001e00 74 68 65 20 70 69 63 74 75 72 65 2c 20 69 74 20 |the picture, it | 00001e10 6d 61 79 20 61 70 70 65 61 72 0d 72 61 74 68 65 |may appear.rathe| 00001e20 72 20 6f 64 64 20 77 68 65 6e 20 72 65 6c 6f 61 |r odd when reloa| 00001e30 64 65 64 2c 20 61 73 20 69 74 20 77 69 6c 6c 20 |ded, as it will | 00001e40 61 70 70 65 61 72 20 69 6e 20 62 6c 61 63 6b 2c |appear in black,| 00001e50 20 72 65 64 2c 20 79 65 6c 6c 6f 77 20 61 6e 64 | red, yellow and| 00001e60 0d 77 68 69 74 65 20 2d 20 74 68 65 20 64 65 66 |.white - the def| 00001e70 61 75 6c 74 20 63 6f 6c 6f 75 72 20 73 63 68 65 |ault colour sche| 00001e80 6d 65 2e 0d 0d 2d 20 54 68 65 20 65 78 61 63 74 |me...- The exact| 00001e90 20 72 65 61 73 6f 6e 20 77 68 79 20 74 68 69 73 | reason why this| 00001ea0 20 68 61 70 70 65 6e 73 20 69 73 20 72 61 74 68 | happens is rath| 00001eb0 65 72 20 63 6f 6d 70 6c 69 63 61 74 65 64 2c 20 |er complicated, | 00001ec0 62 75 74 20 69 66 20 79 6f 75 20 61 6c 6c 6f 77 |but if you allow| 00001ed0 0d 74 68 65 20 63 75 72 73 6f 72 20 74 6f 20 67 |.the cursor to g| 00001ee0 6f 20 64 6f 77 6e 20 6f 66 66 20 74 68 65 20 62 |o down off the b| 00001ef0 6f 74 74 6f 6d 20 6c 69 6e 65 20 6f 66 20 74 68 |ottom line of th| 00001f00 65 20 73 63 72 65 65 6e 2c 20 61 6e 64 20 61 6c |e screen, and al| 00001f10 6c 6f 77 20 74 68 65 20 73 63 72 65 65 6e 0d 74 |low the screen.t| 00001f20 6f 20 73 63 72 6f 6c 6c 20 75 70 20 6f 6e 65 20 |o scroll up one | 00001f30 6c 69 6e 65 2c 20 74 68 69 73 20 74 65 63 68 6e |line, this techn| 00001f40 69 71 75 65 20 73 74 6f 70 73 20 77 6f 72 6b 69 |ique stops worki| 00001f50 6e 67 20 75 6e 74 69 6c 20 79 6f 75 20 70 65 72 |ng until you per| 00001f60 66 6f 72 6d 20 61 0d 4d 4f 44 45 20 63 6f 6d 6d |form a.MODE comm| 00001f70 61 6e 64 2c 20 6f 72 20 63 6c 65 61 72 20 74 68 |and, or clear th| 00001f80 65 20 73 63 72 65 65 6e 20 75 73 69 6e 67 20 43 |e screen using C| 00001f90 4c 53 2e 20 42 61 73 69 63 61 6c 6c 79 20 77 68 |LS. Basically wh| 00001fa0 61 74 20 68 61 70 70 65 6e 73 20 69 73 20 74 68 |at happens is th| 00001fb0 61 74 0d 74 68 65 20 63 6f 6d 70 75 74 65 72 20 |at.the computer | 00001fc0 64 6f 65 73 20 6e 6f 74 20 70 68 79 73 69 63 61 |does not physica| 00001fd0 6c 6c 79 20 6d 6f 76 65 20 65 76 65 72 79 20 6c |lly move every l| 00001fe0 69 6e 65 20 6f 66 20 74 65 78 74 20 6f 6e 20 74 |ine of text on t| 00001ff0 68 65 20 73 63 72 65 65 6e 20 75 70 0d 6f 6e 65 |he screen up.one| 00002000 20 6c 69 6e 65 2c 20 62 75 74 20 69 6e 73 74 65 | line, but inste| 00002010 61 64 20 6d 61 6b 65 73 20 61 20 6e 6f 74 65 20 |ad makes a note | 00002020 74 68 61 74 20 65 76 65 72 79 20 6c 69 6e 65 20 |that every line | 00002030 69 6e 20 73 63 72 65 65 6e 20 6d 65 6d 6f 72 79 |in screen memory| 00002040 20 69 73 20 73 74 6f 72 65 64 0d 6f 6e 65 20 6c | is stored.one l| 00002050 69 6e 65 20 6c 6f 77 65 72 20 74 68 61 6e 20 69 |ine lower than i| 00002060 74 20 73 68 6f 75 6c 64 20 62 65 2e 20 57 68 65 |t should be. Whe| 00002070 6e 20 79 6f 75 20 72 65 6c 6f 61 64 20 66 72 6f |n you reload fro| 00002080 6d 20 64 69 73 6b 2c 20 74 68 69 73 20 6e 6f 74 |m disk, this not| 00002090 65 20 69 73 0d 6c 6f 73 74 2c 20 61 6e 64 20 74 |e is.lost, and t| 000020a0 68 65 20 63 6f 6d 70 75 74 65 72 20 64 72 61 77 |he computer draw| 000020b0 73 20 65 76 65 72 79 20 6c 69 6e 65 20 6c 6f 77 |s every line low| 000020c0 65 72 20 74 68 61 6e 20 69 74 20 73 68 6f 75 6c |er than it shoul| 000020d0 64 20 62 65 2e 20 45 61 63 68 20 74 69 6d 65 0d |d be. Each time.| 000020e0 74 68 61 74 20 43 4c 53 20 6f 72 20 4d 4f 44 45 |that CLS or MODE| 000020f0 20 69 73 20 65 78 65 63 75 74 65 64 2c 20 73 63 | is executed, sc| 00002100 72 65 65 6e 20 6d 65 6d 6f 72 79 20 69 73 20 63 |reen memory is c| 00002110 6c 65 61 72 65 64 20 61 6e 64 20 72 65 69 6e 69 |leared and reini| 00002120 74 69 61 74 65 64 2c 20 73 6f 0d 74 68 61 74 20 |tiated, so.that | 00002130 65 76 65 72 79 20 6c 69 6e 65 20 69 73 20 73 74 |every line is st| 00002140 6f 72 65 64 20 69 6e 20 6d 65 6d 6f 72 79 20 77 |ored in memory w| 00002150 68 65 72 65 20 79 6f 75 20 77 6f 75 6c 64 20 65 |here you would e| 00002160 78 70 65 63 74 20 69 74 20 74 6f 20 62 65 2e 20 |xpect it to be. | 00002170 53 69 6d 70 6c 79 0d 72 65 6d 65 6d 62 65 72 20 |Simply.remember | 00002180 6e 6f 74 20 74 6f 20 61 6c 6c 6f 77 20 74 68 65 |not to allow the| 00002190 20 73 63 72 65 65 6e 20 74 6f 20 73 63 72 6f 6c | screen to scrol| 000021a0 6c 20 62 65 74 77 65 65 6e 20 63 6c 65 61 72 69 |l between cleari| 000021b0 6e 67 20 69 74 2c 20 61 6e 64 20 73 61 76 69 6e |ng it, and savin| 000021c0 67 0d 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f |g.the contents o| 000021d0 66 20 73 63 72 65 65 6e 20 6d 65 6d 6f 72 79 20 |f screen memory | 000021e0 74 6f 20 64 69 73 63 2e 0d 0d 2d 20 54 68 65 20 |to disc...- The | 000021f0 66 69 6c 65 73 20 63 72 65 61 74 65 64 20 77 68 |files created wh| 00002200 65 6e 20 79 6f 75 20 73 61 76 65 20 74 68 65 20 |en you save the | 00002210 63 6f 6e 74 65 6e 74 73 20 6f 66 20 73 63 72 65 |contents of scre| 00002220 65 6e 20 6d 65 6d 6f 72 79 20 74 6f 20 64 69 73 |en memory to dis| 00002230 6b 0d 61 72 65 20 66 61 69 72 6c 79 20 6c 61 72 |k.are fairly lar| 00002240 67 65 20 2d 20 73 6f 20 6c 61 72 67 65 2c 20 69 |ge - so large, i| 00002250 6e 20 66 61 63 74 2c 20 74 68 61 74 20 79 6f 75 |n fact, that you| 00002260 20 63 61 6e 20 6f 66 74 65 6e 20 6f 6e 6c 79 20 | can often only | 00002270 66 69 74 20 61 72 6f 75 6e 64 0d 31 35 20 73 75 |fit around.15 su| 00002280 63 68 20 66 69 6c 65 73 20 6f 6e 74 6f 20 65 61 |ch files onto ea| 00002290 63 68 20 64 69 73 6b 20 74 68 61 74 20 79 6f 75 |ch disk that you| 000022a0 20 75 73 65 20 28 74 68 65 20 65 78 61 63 74 20 | use (the exact | 000022b0 6e 75 6d 62 65 72 20 64 65 70 65 6e 64 73 20 75 |number depends u| 000022c0 70 6f 6e 0d 77 68 61 74 20 6d 6f 64 65 73 20 74 |pon.what modes t| 000022d0 68 65 20 69 6d 61 67 65 73 20 61 72 65 20 69 6e |he images are in| 000022e0 29 2e 20 54 68 65 72 65 66 6f 72 65 20 74 68 69 |). Therefore thi| 000022f0 73 20 74 65 63 68 6e 69 71 75 65 20 69 73 20 6e |s technique is n| 00002300 6f 74 20 66 65 61 73 61 62 6c 65 0d 66 6f 72 20 |ot feasable.for | 00002310 61 20 6c 61 72 67 65 20 6e 75 6d 62 65 72 20 6f |a large number o| 00002320 66 20 69 6d 61 67 65 73 2e 20 45 61 63 68 20 73 |f images. Each s| 00002330 63 72 65 65 6e 20 69 6e 20 61 20 67 61 6d 65 20 |creen in a game | 00002340 6c 69 6b 65 20 53 68 69 70 77 72 65 63 6b 65 64 |like Shipwrecked| 00002350 20 63 61 6e 6e 6f 74 0d 62 65 20 73 74 6f 72 65 | cannot.be store| 00002360 64 20 69 6e 20 74 68 69 73 20 77 61 79 20 2d 20 |d in this way - | 00002370 69 66 20 49 20 68 61 64 20 73 74 6f 72 65 64 20 |if I had stored | 00002380 65 76 65 72 79 20 73 63 72 65 65 6e 20 6f 66 20 |every screen of | 00002390 74 68 65 20 67 61 6d 65 20 6c 69 6b 65 20 74 68 |the game like th| 000023a0 69 73 2c 0d 69 74 20 77 6f 75 6c 64 20 68 61 76 |is,.it would hav| 000023b0 65 20 72 65 71 75 69 72 65 64 20 73 69 78 20 66 |e required six f| 000023c0 6c 6f 70 70 79 20 64 69 73 6b 73 20 74 6f 20 73 |loppy disks to s| 000023d0 74 6f 72 65 20 74 68 65 20 64 61 74 61 20 66 6f |tore the data fo| 000023e0 72 20 74 68 65 20 67 61 6d 65 21 0d 54 68 69 73 |r the game!.This| 000023f0 20 6d 65 61 6e 73 20 74 68 61 74 20 73 61 76 65 | means that save| 00002400 64 20 73 63 72 65 65 6e 73 20 6d 75 73 74 20 62 |d screens must b| 00002410 65 20 72 65 73 65 72 76 65 64 20 66 6f 72 20 74 |e reserved for t| 00002420 68 65 20 70 75 72 70 6f 73 65 73 20 6f 66 20 74 |he purposes of t| 00002430 69 74 6c 65 0d 73 63 72 65 65 6e 73 20 6f 6e 6c |itle.screens onl| 00002440 79 2e 0d 0d 45 61 72 6c 69 65 72 20 69 6e 20 74 |y...Earlier in t| 00002450 68 65 20 61 72 74 69 63 6c 65 2c 20 49 20 6d 65 |he article, I me| 00002460 6e 74 69 6f 6e 65 64 20 73 65 76 65 72 61 6c 20 |ntioned several | 00002470 65 78 61 6d 70 6c 65 73 20 6f 66 20 73 63 72 65 |examples of scre| 00002480 65 6e 73 20 77 68 69 63 68 20 49 20 68 61 76 65 |ens which I have| 00002490 0d 64 6f 6e 65 20 66 6f 72 20 45 55 47 20 75 73 |.done for EUG us| 000024a0 69 6e 67 20 73 61 76 65 64 20 73 63 72 65 65 6e |ing saved screen| 000024b0 73 20 75 73 69 6e 67 20 74 68 69 73 20 74 65 63 |s using this tec| 000024c0 68 6e 69 71 75 65 2e 20 54 68 65 73 65 20 69 6e |hnique. These in| 000024d0 63 6c 75 64 65 64 20 74 68 65 0d 74 69 74 6c 65 |cluded the.title| 000024e0 20 73 63 72 65 65 6e 73 20 66 6f 72 20 62 6f 74 | screens for bot| 000024f0 68 20 53 68 69 70 77 72 65 63 6b 65 64 20 67 61 |h Shipwrecked ga| 00002500 6d 65 73 2c 20 61 6e 64 20 61 6c 73 6f 20 73 65 |mes, and also se| 00002510 76 65 72 61 6c 20 45 55 47 20 74 69 74 6c 65 0d |veral EUG title.| 00002520 73 63 72 65 65 6e 73 2e 20 59 6f 75 20 6d 61 79 |screens. You may| 00002530 20 68 61 76 65 20 6e 6f 74 69 63 65 64 20 74 68 | have noticed th| 00002540 61 74 20 74 68 65 73 65 20 77 65 72 65 20 61 63 |at these were ac| 00002550 74 75 61 6c 6c 79 20 61 6e 69 6d 61 74 65 64 20 |tually animated | 00002560 28 73 65 65 20 74 68 65 0d 73 74 61 72 66 69 65 |(see the.starfie| 00002570 6c 64 20 69 6e 20 4a 75 70 69 74 65 72 20 33 20 |ld in Jupiter 3 | 00002580 61 6e 64 20 74 68 65 20 45 55 47 20 33 35 20 74 |and the EUG 35 t| 00002590 69 74 6c 65 29 2e 20 54 68 69 73 20 77 61 73 20 |itle). This was | 000025a0 61 63 68 69 65 76 65 64 20 62 79 20 70 61 6c 65 |achieved by pale| 000025b0 74 74 65 0d 73 77 69 74 63 68 69 6e 67 20 61 73 |tte.switching as| 000025c0 20 75 73 65 64 20 69 6e 20 74 68 65 20 70 72 65 | used in the pre| 000025d0 76 69 6f 75 73 20 61 72 74 69 63 6c 65 2e 20 49 |vious article. I| 000025e0 66 20 79 6f 75 20 6c 6f 6f 6b 20 61 67 61 69 6e |f you look again| 000025f0 20 61 74 20 74 68 65 0d 70 72 6f 67 72 61 6d 6d | at the.programm| 00002600 69 6e 67 20 74 65 63 68 6e 69 71 75 65 20 64 65 |ing technique de| 00002610 6d 6f 6e 73 74 72 61 74 69 6f 6e 20 66 72 6f 6d |monstration from| 00002620 20 74 68 69 73 20 61 72 74 69 63 6c 65 20 28 6f | this article (o| 00002630 6e 20 45 55 47 20 33 36 29 2c 20 61 6e 64 0d 73 |n EUG 36), and.s| 00002640 65 6c 65 63 74 20 6f 70 74 69 6f 6e 20 35 2c 20 |elect option 5, | 00002650 74 68 65 20 73 61 6d 65 20 65 66 66 65 63 74 20 |the same effect | 00002660 77 69 6c 6c 20 61 70 70 65 61 72 20 6f 6e 20 79 |will appear on y| 00002670 6f 75 72 20 73 63 72 65 65 6e 2e 20 54 68 65 20 |our screen. The | 00002680 73 61 6d 65 0d 70 72 69 6e 63 69 70 61 6c 20 77 |same.principal w| 00002690 61 73 20 61 70 70 6c 69 65 64 20 69 6e 20 62 6f |as applied in bo| 000026a0 74 68 20 61 6e 69 6d 61 74 65 64 20 73 63 72 65 |th animated scre| 000026b0 65 6e 73 20 6d 65 6e 74 69 6f 6e 65 64 20 61 62 |ens mentioned ab| 000026c0 6f 76 65 20 2d 20 74 68 65 20 6f 6e 6c 79 0d 64 |ove - the only.d| 000026d0 69 66 66 65 72 65 6e 63 65 20 69 73 20 74 68 61 |ifference is tha| 000026e0 74 20 69 6e 20 74 68 65 73 65 20 74 69 74 6c 65 |t in these title| 000026f0 20 73 63 72 65 65 6e 73 20 74 68 65 20 70 61 74 | screens the pat| 00002700 74 65 72 6e 20 6f 6e 20 73 63 72 65 65 6e 20 77 |tern on screen w| 00002710 68 69 63 68 20 69 73 0d 62 65 69 6e 67 20 70 61 |hich is.being pa| 00002720 6c 65 74 74 65 20 73 77 69 74 63 68 65 64 20 69 |lette switched i| 00002730 73 20 72 61 74 68 65 72 20 6d 6f 72 65 20 63 6f |s rather more co| 00002740 6d 70 6c 65 78 2e 20 53 68 69 70 77 72 65 63 6b |mplex. Shipwreck| 00002750 27 73 20 74 69 74 6c 65 20 73 63 72 65 65 6e 0d |'s title screen.| 00002760 28 77 69 74 68 20 74 68 65 20 61 6e 69 6d 61 74 |(with the animat| 00002770 65 64 20 77 61 74 65 72 20 73 63 65 6e 65 29 20 |ed water scene) | 00002780 77 61 73 20 61 6c 73 6f 20 63 72 65 61 74 65 64 |was also created| 00002790 20 69 6e 20 74 68 69 73 20 77 61 79 2c 20 65 78 | in this way, ex| 000027a0 63 65 70 74 20 74 68 61 74 0d 66 6f 72 20 74 68 |cept that.for th| 000027b0 69 73 20 73 63 72 65 65 6e 20 74 68 65 72 65 20 |is screen there | 000027c0 77 61 73 20 61 6c 73 6f 20 61 20 6d 61 63 68 69 |was also a machi| 000027d0 6e 65 20 63 6f 64 65 20 70 72 6f 67 72 61 6d 20 |ne code program | 000027e0 61 6c 74 65 72 69 6e 67 20 74 68 65 20 63 6f 6e |altering the con| 000027f0 74 65 6e 74 73 0d 6f 66 20 73 63 72 65 65 6e 20 |tents.of screen | 00002800 6d 65 6d 6f 72 79 20 61 73 20 77 65 6c 6c 2c 20 |memory as well, | 00002810 74 6f 20 65 6e 68 61 6e 63 65 20 74 68 65 20 65 |to enhance the e| 00002820 66 66 65 63 74 2e 0d 0d 53 6f 2c 20 77 65 20 68 |ffect...So, we h| 00002830 61 76 65 20 61 20 74 65 63 68 6e 69 71 75 65 20 |ave a technique | 00002840 77 68 69 63 68 20 61 6c 6c 6f 77 73 20 75 73 20 |which allows us | 00002850 74 6f 20 73 74 6f 72 65 20 61 20 73 6d 61 6c 6c |to store a small| 00002860 20 6e 75 6d 62 65 72 20 6f 66 20 76 65 72 79 0d | number of very.| 00002870 64 65 74 61 69 6c 65 64 20 73 63 72 65 65 6e 73 |detailed screens| 00002880 20 6f 6e 20 66 6c 6f 70 70 79 2c 20 61 6e 64 20 | on floppy, and | 00002890 72 65 63 61 6c 6c 20 74 68 65 6e 20 61 74 20 76 |recall then at v| 000028a0 65 72 79 20 67 72 65 61 74 20 73 70 65 65 64 2e |ery great speed.| 000028b0 20 42 75 74 20 77 68 61 74 20 69 66 0d 77 65 20 | But what if.we | 000028c0 77 61 6e 74 20 74 6f 20 75 73 65 20 74 68 69 73 |want to use this| 000028d0 20 6d 65 74 68 6f 64 20 66 6f 72 20 61 20 6c 61 | method for a la| 000028e0 72 67 65 20 6e 75 6d 62 65 72 20 6f 66 20 73 63 |rge number of sc| 000028f0 72 65 65 6e 73 3f 20 41 6e 64 20 77 68 61 74 20 |reens? And what | 00002900 69 66 20 77 65 0d 77 61 6e 74 20 61 20 73 69 74 |if we.want a sit| 00002910 75 61 74 69 6f 6e 20 6c 69 6b 65 20 61 20 67 61 |uation like a ga| 00002920 6d 65 2c 20 77 68 65 72 65 20 74 68 65 20 75 73 |me, where the us| 00002930 65 72 20 63 61 6e 20 6d 6f 76 65 20 73 70 72 69 |er can move spri| 00002940 74 65 73 20 6f 6e 20 74 68 65 20 73 63 72 65 65 |tes on the scree| 00002950 6e 0d 61 72 6f 75 6e 64 2e 20 54 68 69 73 20 63 |n.around. This c| 00002960 61 6e 20 61 6c 73 6f 20 62 65 20 64 6f 6e 65 20 |an also be done | 00002970 62 79 20 61 6c 74 65 72 69 6e 67 20 74 68 65 20 |by altering the | 00002980 76 61 6c 75 65 73 20 69 6e 20 73 63 72 65 65 6e |values in screen| 00002990 20 6d 65 6d 6f 72 79 0d 64 69 72 65 63 74 6c 79 | memory.directly| 000029a0 2c 20 62 75 74 20 69 6e 20 61 20 64 69 66 66 65 |, but in a diffe| 000029b0 72 65 6e 74 20 77 61 79 2e 2e 2e 0d 0d 32 2e 20 |rent way.....2. | 000029c0 45 64 69 74 69 6e 67 20 73 63 72 65 65 6e 20 6d |Editing screen m| 000029d0 65 6d 6f 72 79 0d 0d 54 68 65 20 62 61 73 69 63 |emory..The basic| 000029e0 20 69 64 65 61 20 69 73 20 74 68 69 73 3a 20 69 | idea is this: i| 000029f0 6e 20 61 6e 79 20 70 72 6f 67 72 61 6d 2c 20 79 |n any program, y| 00002a00 6f 75 20 6f 6e 6c 79 20 75 73 75 61 6c 6c 79 20 |ou only usually | 00002a10 72 65 71 75 69 72 65 20 61 20 63 65 72 74 61 69 |require a certai| 00002a20 6e 2c 0d 73 6d 61 6c 6c 20 6e 75 6d 62 65 72 20 |n,.small number | 00002a30 6f 66 20 6c 69 74 74 6c 65 20 27 62 6c 6f 63 6b |of little 'block| 00002a40 73 27 20 74 6f 20 6d 61 6b 65 20 75 70 20 61 20 |s' to make up a | 00002a50 77 68 6f 6c 65 20 70 69 63 74 75 72 65 2e 20 49 |whole picture. I| 00002a60 6e 20 61 20 77 6f 72 64 0d 70 72 6f 63 65 73 73 |n a word.process| 00002a70 6f 72 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c |or, for example,| 00002a80 20 79 6f 75 20 6f 6e 6c 79 20 6e 65 65 64 20 74 | you only need t| 00002a90 68 65 20 6c 65 74 74 65 72 73 20 6f 66 20 74 68 |he letters of th| 00002aa0 65 20 61 6c 70 68 61 62 65 74 20 74 6f 20 61 70 |e alphabet to ap| 00002ab0 70 65 61 72 0d 6f 6e 20 74 68 65 20 73 63 72 65 |pear.on the scre| 00002ac0 65 6e 2e 20 54 68 65 73 65 20 6c 65 74 74 65 72 |en. These letter| 00002ad0 73 20 61 72 65 20 73 6d 61 6c 6c 20 62 6c 6f 63 |s are small bloc| 00002ae0 6b 73 20 6f 66 20 67 72 61 70 68 69 63 73 20 77 |ks of graphics w| 00002af0 68 69 63 68 20 61 70 70 65 61 72 20 6f 6e 0d 79 |hich appear on.y| 00002b00 6f 75 72 20 73 63 72 65 65 6e 20 28 63 61 6c 6c |our screen (call| 00002b10 65 64 20 63 68 61 72 61 63 74 65 72 73 29 2e 20 |ed characters). | 00002b20 42 65 63 61 75 73 65 20 6f 6e 6c 79 20 74 68 65 |Because only the| 00002b30 73 65 20 32 36 20 62 6c 6f 63 6b 73 20 61 72 65 |se 26 blocks are| 00002b40 20 72 65 71 75 69 72 65 64 2c 0d 74 68 65 20 77 | required,.the w| 00002b50 6f 72 64 20 70 72 6f 63 65 73 73 6f 72 20 64 6f |ord processor do| 00002b60 65 73 20 6e 6f 74 20 6e 65 65 64 20 74 6f 20 73 |es not need to s| 00002b70 74 6f 72 65 20 65 76 65 72 79 20 6c 65 74 74 65 |tore every lette| 00002b80 72 20 61 73 20 61 6c 6c 20 6f 66 20 74 68 65 20 |r as all of the | 00002b90 70 69 78 65 6c 73 0d 77 68 69 63 68 20 6d 61 6b |pixels.which mak| 00002ba0 65 20 69 74 20 75 70 20 28 69 65 2e 20 61 73 20 |e it up (ie. as | 00002bb0 61 20 62 69 74 6d 61 70 29 2c 20 62 75 74 20 6a |a bitmap), but j| 00002bc0 75 73 74 20 61 73 20 61 20 63 6f 64 65 20 66 6f |ust as a code fo| 00002bd0 72 20 74 68 61 74 20 70 61 72 74 69 63 75 6c 61 |r that particula| 00002be0 72 0d 6c 65 74 74 65 72 2e 20 57 68 65 6e 20 74 |r.letter. When t| 00002bf0 68 65 20 77 6f 72 64 20 70 72 6f 63 65 73 73 6f |he word processo| 00002c00 72 20 77 61 6e 74 73 20 74 6f 20 64 69 73 70 6c |r wants to displ| 00002c10 61 79 20 61 20 6c 65 74 74 65 72 20 6f 6e 20 74 |ay a letter on t| 00002c20 68 65 20 73 63 72 65 65 6e 2c 20 69 74 0d 6c 6f |he screen, it.lo| 00002c30 6f 6b 73 20 75 70 20 74 68 65 20 6c 65 74 74 65 |oks up the lette| 00002c40 72 20 63 6f 64 65 2c 20 61 6e 64 20 74 68 65 6e |r code, and then| 00002c50 20 63 6f 70 69 65 73 20 74 68 65 20 67 72 61 70 | copies the grap| 00002c60 68 69 63 20 64 61 74 61 20 66 6f 72 20 77 68 61 |hic data for wha| 00002c70 74 20 74 68 61 74 0d 6c 65 74 74 65 72 20 6c 6f |t that.letter lo| 00002c80 6f 6b 73 20 6c 69 6b 65 20 6f 6e 74 6f 20 74 68 |oks like onto th| 00002c90 65 20 73 63 72 65 65 6e 2e 20 54 68 65 72 65 66 |e screen. Theref| 00002ca0 6f 72 65 2c 20 74 68 65 20 67 72 61 70 68 69 63 |ore, the graphic| 00002cb0 20 64 61 74 61 20 66 6f 72 20 77 68 61 74 0d 63 | data for what.c| 00002cc0 6f 6c 6f 75 72 20 61 6c 6c 20 6f 66 20 74 68 65 |olour all of the| 00002cd0 20 70 69 78 65 6c 73 20 73 68 6f 75 6c 64 20 62 | pixels should b| 00002ce0 65 20 66 6f 72 20 74 68 61 74 20 70 61 72 74 69 |e for that parti| 00002cf0 63 75 6c 61 72 20 6c 65 74 74 65 72 20 28 77 68 |cular letter (wh| 00002d00 69 63 68 20 6d 69 67 68 74 0d 74 61 6b 65 20 73 |ich might.take s| 00002d10 65 76 65 72 61 6c 20 62 79 74 65 73 29 20 6e 65 |everal bytes) ne| 00002d20 65 64 20 6f 6e 6c 79 20 62 65 20 73 74 6f 72 65 |ed only be store| 00002d30 64 20 6f 6e 63 65 2c 20 61 6e 64 20 74 68 61 74 |d once, and that| 00002d40 20 6c 65 74 74 65 72 20 63 61 6e 20 62 65 20 73 | letter can be s| 00002d50 74 6f 72 65 64 0d 69 6e 20 79 6f 75 72 20 73 63 |tored.in your sc| 00002d60 72 69 70 74 20 69 6e 20 6a 75 73 74 20 6f 6e 65 |ript in just one| 00002d70 20 62 79 74 65 2c 20 66 6f 72 20 74 68 65 20 6c | byte, for the l| 00002d80 65 74 74 65 72 20 63 6f 64 65 2e 20 54 68 75 73 |etter code. Thus| 00002d90 2c 20 74 68 65 20 6d 65 6d 6f 72 79 0d 74 61 6b |, the memory.tak| 00002da0 65 6e 20 75 70 20 62 79 20 79 6f 75 72 20 73 63 |en up by your sc| 00002db0 72 69 70 74 20 69 73 20 72 65 64 75 63 65 64 20 |ript is reduced | 00002dc0 64 72 61 6d 61 74 69 63 61 6c 6c 79 2e 0d 0d 54 |dramatically...T| 00002dd0 68 65 20 73 61 6d 65 20 70 72 69 6e 63 69 70 61 |he same principa| 00002de0 6c 20 63 61 6e 20 62 65 20 75 73 65 64 20 69 6e |l can be used in| 00002df0 20 67 72 61 70 68 69 63 73 2e 20 4c 6f 6f 6b 20 | graphics. Look | 00002e00 61 74 20 74 77 6f 20 62 72 69 63 6b 20 77 61 6c |at two brick wal| 00002e10 6c 73 20 69 6e 0d 61 6e 20 61 72 63 61 64 65 20 |ls in.an arcade | 00002e20 61 64 76 65 6e 74 75 72 65 20 73 75 63 68 20 61 |adventure such a| 00002e30 73 20 53 68 69 70 77 72 65 63 6b 65 64 20 2d 20 |s Shipwrecked - | 00002e40 63 61 6e 20 79 6f 75 20 73 65 65 20 74 68 65 20 |can you see the | 00002e50 64 69 66 66 65 72 65 6e 63 65 0d 62 65 74 77 65 |difference.betwe| 00002e60 65 6e 20 74 68 65 6d 3f 20 49 66 20 74 68 65 79 |en them? If they| 00002e70 20 61 72 65 20 74 68 65 20 73 61 6d 65 2c 20 73 | are the same, s| 00002e80 75 72 65 6c 79 20 79 6f 75 20 6f 6e 6c 79 20 6e |urely you only n| 00002e90 65 65 64 20 74 6f 20 73 74 6f 72 65 20 74 68 65 |eed to store the| 00002ea0 0d 67 72 61 70 68 69 63 20 64 61 74 61 20 66 6f |.graphic data fo| 00002eb0 72 20 61 20 62 72 69 63 6b 20 77 61 6c 6c 20 6f |r a brick wall o| 00002ec0 6e 63 65 2c 20 61 6e 64 20 74 68 65 6e 20 63 6f |nce, and then co| 00002ed0 70 79 20 69 74 20 6f 6e 74 6f 20 74 68 65 20 73 |py it onto the s| 00002ee0 63 72 65 65 6e 0d 77 68 65 6e 65 76 65 72 20 79 |creen.whenever y| 00002ef0 6f 75 20 77 61 6e 74 20 61 20 62 72 69 63 6b 20 |ou want a brick | 00002f00 77 61 6c 6c 2e 20 49 6e 20 53 68 69 70 77 72 65 |wall. In Shipwre| 00002f10 63 6b 65 64 2c 20 66 6f 72 20 65 78 61 6d 70 6c |cked, for exampl| 00002f20 65 2c 20 74 68 65 20 67 72 61 70 68 69 63 0d 64 |e, the graphic.d| 00002f30 61 74 61 20 74 6f 20 64 65 73 63 72 69 62 65 20 |ata to describe | 00002f40 77 68 61 74 20 61 20 62 72 69 63 6b 20 77 61 6c |what a brick wal| 00002f50 6c 20 6c 6f 6f 6b 73 20 6c 69 6b 65 20 74 6f 6f |l looks like too| 00002f60 6b 20 31 32 38 20 62 79 74 65 73 2e 20 59 65 74 |k 128 bytes. Yet| 00002f70 20 65 76 65 72 79 0d 74 69 6d 65 20 49 20 77 61 | every.time I wa| 00002f80 6e 74 65 64 20 74 68 61 74 20 62 72 69 63 6b 20 |nted that brick | 00002f90 77 61 6c 6c 20 28 77 68 69 63 68 20 77 61 73 20 |wall (which was | 00002fa0 6f 76 65 72 20 61 20 68 75 6e 64 72 65 64 20 74 |over a hundred t| 00002fb0 69 6d 65 73 29 20 49 20 63 6f 75 6c 64 0d 73 69 |imes) I could.si| 00002fc0 6d 70 6c 79 20 75 73 65 20 6f 6e 65 20 62 79 74 |mply use one byt| 00002fd0 65 20 74 6f 20 73 61 79 20 22 50 75 74 20 61 20 |e to say "Put a | 00002fe0 62 72 69 63 6b 20 77 61 6c 6c 20 68 65 72 65 21 |brick wall here!| 00002ff0 22 2e 0d 0d 54 68 65 20 65 61 73 69 65 73 74 20 |"...The easiest | 00003000 77 61 79 20 74 6f 20 75 73 65 20 74 68 69 73 20 |way to use this | 00003010 62 6c 6f 63 6b 20 69 64 65 61 2c 20 61 73 20 79 |block idea, as y| 00003020 6f 75 20 6d 61 79 20 61 6c 72 65 61 64 79 20 68 |ou may already h| 00003030 61 76 65 20 72 65 61 6c 69 73 65 64 2c 0d 69 73 |ave realised,.is| 00003040 20 75 73 69 6e 67 20 75 73 65 72 20 64 65 66 69 | using user defi| 00003050 6e 65 64 20 63 68 61 72 61 63 74 65 72 73 2e 20 |ned characters. | 00003060 59 6f 75 20 72 65 64 65 66 69 6e 65 20 74 68 65 |You redefine the| 00003070 20 6c 65 74 74 65 72 73 20 6f 66 20 74 68 65 20 | letters of the | 00003080 61 6c 70 68 61 62 65 74 0d 61 73 20 64 69 66 66 |alphabet.as diff| 00003090 65 72 65 6e 74 20 70 69 63 74 75 72 65 73 2c 20 |erent pictures, | 000030a0 61 6e 64 20 74 68 65 6e 20 75 73 65 20 74 68 65 |and then use the| 000030b0 20 73 74 61 6e 64 61 72 64 20 42 41 53 49 43 20 | standard BASIC | 000030c0 50 52 49 4e 54 20 63 6f 6d 6d 61 6e 64 20 74 6f |PRINT command to| 000030d0 0d 6f 75 74 70 75 74 20 74 68 65 73 65 20 70 69 |.output these pi| 000030e0 63 74 75 72 65 73 20 74 6f 20 74 68 65 20 73 63 |ctures to the sc| 000030f0 72 65 65 6e 2c 20 61 73 20 61 6e 64 20 77 68 65 |reen, as and whe| 00003100 6e 20 74 68 65 79 20 61 72 65 20 72 65 71 75 69 |n they are requi| 00003110 72 65 64 2e 20 42 75 74 2c 0d 61 73 20 77 65 20 |red. But,.as we | 00003120 61 6c 72 65 61 64 79 20 72 65 61 6c 69 73 65 64 |already realised| 00003130 20 69 6e 20 74 68 65 20 6c 61 73 74 20 61 72 74 | in the last art| 00003140 69 63 6c 65 2c 20 74 68 69 73 20 6f 6e 6c 79 20 |icle, this only | 00003150 61 6c 6c 6f 77 73 20 79 6f 75 20 74 6f 20 75 73 |allows you to us| 00003160 65 0d 6f 6e 65 20 63 6f 6c 6f 75 72 20 69 6e 20 |e.one colour in | 00003170 65 61 63 68 20 63 68 61 72 61 63 74 65 72 2e 20 |each character. | 00003180 45 76 65 6e 20 73 6f 2c 20 74 68 69 73 20 69 73 |Even so, this is| 00003190 20 61 20 72 65 61 73 6f 6e 61 62 6c 65 20 74 65 | a reasonable te| 000031a0 63 68 6e 69 71 75 65 20 69 66 0d 79 6f 75 20 64 |chnique if.you d| 000031b0 6f 6e 27 74 20 6d 69 6e 64 20 74 68 65 20 6c 61 |on't mind the la| 000031c0 63 6b 20 6f 66 20 63 6f 6c 6f 75 72 2e 20 4d 61 |ck of colour. Ma| 000031d0 6e 79 20 63 6f 6d 6d 65 72 63 69 61 6c 20 67 61 |ny commercial ga| 000031e0 6d 65 73 20 61 63 74 75 61 6c 6c 79 20 6e 65 76 |mes actually nev| 000031f0 65 72 0d 61 64 64 72 65 73 73 65 64 20 74 68 69 |er.addressed thi| 00003200 73 20 70 72 6f 62 6c 65 6d 2c 20 61 6e 64 20 68 |s problem, and h| 00003210 61 64 20 67 72 61 70 68 69 63 73 20 77 68 69 63 |ad graphics whic| 00003220 68 20 6c 61 63 6b 65 64 20 63 6f 6c 6f 75 72 20 |h lacked colour | 00003230 73 6f 6d 65 77 68 61 74 2e 0d 45 76 65 6e 20 44 |somewhat..Even D| 00003240 69 7a 7a 79 20 28 66 6f 72 20 74 68 6f 73 65 20 |izzy (for those | 00003250 77 68 6f 20 68 61 76 65 20 6e 65 76 65 72 20 68 |who have never h| 00003260 65 61 72 64 20 6f 66 20 69 74 2c 20 61 20 67 72 |eard of it, a gr| 00003270 65 61 74 20 61 72 63 61 64 65 20 61 64 76 65 6e |eat arcade adven| 00003280 74 75 72 65 0d 6f 66 20 74 68 65 20 31 39 38 30 |ture.of the 1980| 00003290 73 2c 20 77 68 69 63 68 20 63 61 75 73 65 64 20 |s, which caused | 000032a0 71 75 69 74 65 20 61 20 63 75 6c 74 20 66 6f 6c |quite a cult fol| 000032b0 6c 6f 77 69 6e 67 20 61 74 20 74 68 65 20 74 69 |lowing at the ti| 000032c0 6d 65 20 6f 6e 20 74 68 65 0d 53 70 65 63 74 72 |me on the.Spectr| 000032d0 75 6d 20 61 6e 64 20 43 36 34 2c 20 62 75 74 20 |um and C64, but | 000032e0 6e 65 76 65 72 20 71 75 69 74 65 20 72 65 61 63 |never quite reac| 000032f0 68 65 64 20 74 68 65 20 45 6c 6b 29 20 64 69 64 |hed the Elk) did| 00003300 20 6e 6f 74 20 68 61 76 65 20 6d 6f 72 65 20 74 | not have more t| 00003310 68 61 6e 0d 6f 6e 65 20 63 6f 6c 6f 75 72 20 28 |han.one colour (| 00003320 6f 74 68 65 72 20 74 68 61 6e 20 62 6c 61 63 6b |other than black| 00003330 29 20 70 65 72 20 62 6c 6f 63 6b 2e 20 44 69 66 |) per block. Dif| 00003340 66 65 72 65 6e 74 20 62 6c 6f 63 6b 73 20 77 65 |ferent blocks we| 00003350 72 65 2c 20 68 6f 77 65 76 65 72 2c 0d 64 69 66 |re, however,.dif| 00003360 66 65 72 65 6e 74 20 63 6f 6c 6f 75 72 73 20 2d |ferent colours -| 00003370 20 74 72 65 65 73 20 77 65 72 65 20 67 72 65 65 | trees were gree| 00003380 6e 20 61 6e 64 20 74 68 65 20 67 72 6f 75 6e 64 |n and the ground| 00003390 20 77 61 73 20 72 65 64 20 2d 20 62 75 74 20 74 | was red - but t| 000033a0 68 65 72 65 0d 77 61 73 20 6e 65 76 65 72 20 61 |here.was never a| 000033b0 6e 79 20 6f 76 65 72 6c 61 70 20 62 65 74 77 65 |ny overlap betwe| 000033c0 65 6e 20 74 68 65 20 74 77 6f 20 63 6f 6c 6f 75 |en the two colou| 000033d0 72 20 61 72 65 61 73 2e 0d 0d 54 68 65 72 65 20 |r areas...There | 000033e0 69 73 2c 20 68 6f 77 65 76 65 72 2c 20 61 20 77 |is, however, a w| 000033f0 61 79 20 6f 66 20 63 72 65 61 74 69 6e 67 20 61 |ay of creating a| 00003400 6e 20 65 66 66 65 63 74 20 6a 75 73 74 20 6c 69 |n effect just li| 00003410 6b 65 20 75 73 65 72 20 64 65 66 69 6e 65 64 0d |ke user defined.| 00003420 63 68 61 72 61 63 74 65 72 73 2c 20 62 75 74 20 |characters, but | 00003430 69 6e 20 66 75 6c 6c 20 63 6f 6c 6f 75 72 2c 20 |in full colour, | 00003440 61 6e 64 20 74 68 65 20 70 72 69 6e 63 69 70 61 |and the principa| 00003450 6c 20 69 73 20 76 65 72 79 20 73 69 6d 69 6c 61 |l is very simila| 00003460 72 20 74 6f 0d 74 68 61 74 20 75 73 65 64 20 62 |r to.that used b| 00003470 65 66 6f 72 65 20 69 6e 20 73 61 76 69 6e 67 20 |efore in saving | 00003480 73 63 72 65 65 6e 20 6d 65 6d 6f 72 79 2e 20 42 |screen memory. B| 00003490 61 73 69 63 61 6c 6c 79 2c 20 79 6f 75 20 64 65 |asically, you de| 000034a0 73 69 67 6e 20 79 6f 75 20 73 6d 61 6c 6c 0d 62 |sign you small.b| 000034b0 6c 6f 63 6b 20 6f 6e 20 74 68 65 20 73 63 72 65 |lock on the scre| 000034c0 65 6e 2c 20 75 73 69 6e 67 20 77 68 61 74 65 76 |en, using whatev| 000034d0 65 72 20 74 65 63 68 6e 69 71 75 65 20 79 6f 75 |er technique you| 000034e0 20 6c 69 6b 65 20 74 6f 20 64 72 61 77 20 69 74 | like to draw it| 000034f0 2c 20 61 6e 64 20 74 68 65 6e 0d 73 61 76 65 20 |, and then.save | 00003500 74 68 65 20 73 6d 61 6c 6c 20 70 61 72 74 20 6f |the small part o| 00003510 66 20 73 63 72 65 65 6e 20 6d 65 6d 6f 72 79 20 |f screen memory | 00003520 77 68 69 63 68 20 63 6f 6e 74 61 69 6e 73 20 79 |which contains y| 00003530 6f 75 72 20 64 65 73 69 67 6e 2e 20 54 68 69 73 |our design. This| 00003540 20 74 69 6d 65 2c 0d 68 6f 77 65 76 65 72 2c 20 | time,.however, | 00003550 79 6f 75 20 77 69 6c 6c 20 6e 6f 74 20 73 61 76 |you will not sav| 00003560 65 20 69 74 20 74 6f 20 66 6c 6f 70 70 79 20 64 |e it to floppy d| 00003570 69 73 63 2c 20 62 75 74 20 74 6f 20 61 6e 6f 74 |isc, but to anot| 00003580 68 65 72 20 61 72 65 61 20 6f 66 20 6d 65 6d 6f |her area of memo| 00003590 72 79 2e 0d 59 6f 75 20 63 61 6e 20 74 68 65 6e |ry..You can then| 000035a0 20 63 6f 70 79 20 74 68 69 73 20 62 6c 6f 63 6b | copy this block| 000035b0 20 62 61 63 6b 20 74 6f 20 73 63 72 65 65 6e 20 | back to screen | 000035c0 6d 65 6d 6f 72 79 20 77 68 65 6e 65 76 65 72 20 |memory whenever | 000035d0 61 6e 64 20 77 68 65 72 65 76 65 72 20 79 6f 75 |and wherever you| 000035e0 0d 77 61 6e 74 20 69 74 2e 20 49 66 20 79 6f 75 |.want it. If you| 000035f0 20 77 61 6e 74 20 69 74 2c 20 73 61 79 2c 20 69 | want it, say, i| 00003600 6e 20 74 68 65 20 66 69 66 74 68 20 72 6f 77 20 |n the fifth row | 00003610 64 6f 77 6e 2c 20 61 6e 64 20 74 77 65 6c 76 65 |down, and twelve| 00003620 20 63 68 61 72 61 63 74 65 72 73 0d 61 6c 6f 6e | characters.alon| 00003630 67 2c 20 79 6f 75 20 63 61 6e 20 63 61 6c 63 75 |g, you can calcu| 00003640 6c 61 74 65 20 77 68 65 72 65 20 61 62 6f 75 74 |late where about| 00003650 73 20 74 68 69 73 20 63 6f 72 72 65 73 70 6f 6e |s this correspon| 00003660 64 73 20 74 6f 20 69 6e 20 73 63 72 65 65 6e 20 |ds to in screen | 00003670 6d 65 6d 6f 72 79 2c 0d 61 6e 64 20 63 6f 70 79 |memory,.and copy| 00003680 20 74 68 65 20 62 6c 6f 63 6b 20 74 6f 20 74 68 | the block to th| 00003690 69 73 20 6c 6f 63 61 74 69 6f 6e 2e 20 41 73 20 |is location. As | 000036a0 74 68 65 20 62 6c 6f 63 6b 20 69 73 20 73 74 6f |the block is sto| 000036b0 72 65 64 20 69 6e 20 79 6f 75 72 0d 63 6f 6d 70 |red in your.comp| 000036c0 75 74 65 72 27 73 20 52 41 4d 2c 20 61 73 20 6f |uter's RAM, as o| 000036d0 70 70 6f 73 65 64 20 74 6f 20 6f 6e 20 66 6c 6f |pposed to on flo| 000036e0 70 70 79 2c 20 74 68 69 73 20 74 72 61 6e 73 66 |ppy, this transf| 000036f0 65 72 20 63 61 6e 20 62 65 20 64 6f 6e 65 20 62 |er can be done b| 00003700 79 0d 6d 61 63 68 69 6e 65 20 63 6f 64 65 20 61 |y.machine code a| 00003710 74 20 76 65 72 79 20 67 72 65 61 74 20 73 70 65 |t very great spe| 00003720 65 64 20 28 74 61 6b 69 6e 67 20 6f 6e 6c 79 20 |ed (taking only | 00003730 61 20 73 6d 61 6c 6c 20 66 72 61 63 74 69 6f 6e |a small fraction| 00003740 20 6f 66 20 61 20 73 65 63 6f 6e 64 29 2e 0d 46 | of a second)..F| 00003750 6f 72 20 74 68 6f 73 65 20 70 72 6f 67 72 61 6d |or those program| 00003760 6d 65 72 73 20 77 68 6f 20 61 72 65 20 6e 6f 74 |mers who are not| 00003770 20 66 61 6d 69 6c 69 61 72 20 77 69 74 68 20 6d | familiar with m| 00003780 61 63 68 69 6e 65 20 63 6f 64 65 2c 20 61 20 6d |achine code, a m| 00003790 6f 64 75 6c 65 0d 69 73 20 69 6e 63 6c 75 64 65 |odule.is include| 000037a0 64 20 77 69 74 68 20 74 68 69 73 20 74 75 74 6f |d with this tuto| 000037b0 72 69 61 6c 20 61 6c 6c 6f 77 69 6e 67 20 79 6f |rial allowing yo| 000037c0 75 20 74 6f 20 64 6f 20 74 68 69 73 2e 20 54 68 |u to do this. Th| 000037d0 65 20 70 72 6f 67 72 61 6d 20 63 6f 64 65 0d 66 |e program code.f| 000037e0 6f 72 20 74 68 69 73 20 6d 6f 64 75 6c 65 20 69 |or this module i| 000037f0 73 20 61 63 74 75 61 6c 6c 79 20 74 61 6b 65 6e |s actually taken| 00003800 20 64 69 72 65 63 74 6c 79 20 66 72 6f 6d 20 53 | directly from S| 00003810 68 69 70 77 72 65 63 6b 65 64 2e 0d 0d 49 66 20 |hipwrecked...If | 00003820 79 6f 75 20 61 72 65 20 6e 6f 74 20 66 61 6d 69 |you are not fami| 00003830 6c 69 61 72 20 77 69 74 68 20 6d 61 63 68 69 6e |liar with machin| 00003840 65 20 63 6f 64 65 2c 20 74 68 65 6e 20 79 6f 75 |e code, then you| 00003850 20 63 61 6e 20 70 72 6f 62 61 62 6c 79 20 73 6b | can probably sk| 00003860 69 70 20 74 68 65 20 6e 65 78 74 0d 73 65 63 74 |ip the next.sect| 00003870 69 6f 6e 20 6f 6e 20 68 6f 77 20 74 6f 20 64 69 |ion on how to di| 00003880 72 65 63 74 6c 79 20 61 63 63 65 73 73 20 73 63 |rectly access sc| 00003890 72 65 65 6e 20 6d 65 6d 6f 72 79 2c 20 61 73 20 |reen memory, as | 000038a0 69 74 20 69 73 20 69 6d 70 6f 73 73 69 62 6c 65 |it is impossible| 000038b0 0d 74 6f 20 61 63 68 69 65 76 65 20 61 6e 79 20 |.to achieve any | 000038c0 73 70 65 65 64 20 62 79 20 61 63 63 65 73 73 69 |speed by accessi| 000038d0 6e 67 20 73 63 72 65 65 6e 20 6d 65 6d 6f 72 79 |ng screen memory| 000038e0 20 64 69 72 65 63 74 6c 79 20 69 6e 20 42 41 53 | directly in BAS| 000038f0 49 43 20 2d 20 79 6f 75 72 0d 70 72 6f 67 72 61 |IC - your.progra| 00003900 6d 20 77 69 6c 6c 20 63 72 61 77 6c 20 61 6c 6f |m will crawl alo| 00003910 6e 67 20 69 6e 63 72 65 64 69 62 6c 79 20 73 6c |ng incredibly sl| 00003920 6f 77 6c 79 2e 20 59 6f 75 20 63 6f 75 6c 64 20 |owly. You could | 00003930 73 74 69 6c 6c 20 75 73 65 20 73 75 63 68 20 61 |still use such a| 00003940 0d 74 65 63 68 6e 69 71 75 65 20 69 6e 20 70 72 |.technique in pr| 00003950 65 70 61 72 69 6e 67 20 61 20 73 63 72 65 65 6e |eparing a screen| 00003960 20 77 68 69 63 68 20 79 6f 75 20 69 6e 74 65 6e | which you inten| 00003970 64 20 74 6f 20 73 61 76 65 20 74 6f 20 66 6c 6f |d to save to flo| 00003980 70 70 79 20 75 73 69 6e 67 0d 74 68 65 20 74 65 |ppy using.the te| 00003990 63 68 6e 69 71 75 65 20 64 65 73 63 72 69 62 65 |chnique describe| 000039a0 64 20 62 65 66 6f 72 65 20 77 69 74 68 20 2a 53 |d before with *S| 000039b0 41 56 45 20 61 6e 64 20 2a 4c 4f 41 44 2e 0d 0d |AVE and *LOAD...| 000039c0 46 69 72 73 74 6c 79 2c 20 69 74 20 69 73 20 69 |Firstly, it is i| 000039d0 6d 70 6f 72 74 61 6e 74 20 74 6f 20 6b 6e 6f 77 |mportant to know| 000039e0 20 68 6f 77 20 73 63 72 65 65 6e 20 6d 65 6d 6f | how screen memo| 000039f0 72 79 20 69 73 20 6c 61 69 64 20 6f 75 74 20 69 |ry is laid out i| 00003a00 6e 20 6d 65 6d 6f 72 79 2e 0d 54 68 65 20 65 78 |n memory..The ex| 00003a10 61 63 74 20 70 6f 73 69 74 69 6f 6e 20 6f 66 20 |act position of | 00003a20 65 61 63 68 20 63 68 61 72 61 63 74 65 72 20 77 |each character w| 00003a30 69 74 68 69 6e 20 74 68 65 20 6d 65 6d 6f 72 79 |ithin the memory| 00003a40 20 6f 66 20 79 6f 75 72 20 63 6f 6d 70 75 74 65 | of your compute| 00003a50 72 0d 76 61 72 69 65 73 20 66 72 6f 6d 20 6f 6e |r.varies from on| 00003a60 65 20 67 72 61 70 68 69 63 73 20 6d 6f 64 65 20 |e graphics mode | 00003a70 74 6f 20 61 6e 6f 74 68 65 72 2c 20 62 75 74 20 |to another, but | 00003a80 74 68 65 20 62 61 73 69 63 20 70 72 69 6e 63 69 |the basic princi| 00003a90 70 61 6c 73 20 61 72 65 20 74 68 65 0d 73 61 6d |pals are the.sam| 00003aa0 65 3a 0d 0d 2d 20 54 68 65 20 73 63 72 65 65 6e |e:..- The screen| 00003ab0 20 61 72 65 61 20 69 73 20 64 69 76 69 64 65 64 | area is divided| 00003ac0 20 75 70 20 69 6e 74 6f 20 63 68 61 72 61 63 74 | up into charact| 00003ad0 65 72 73 2e 20 54 68 65 73 65 20 61 72 65 20 62 |ers. These are b| 00003ae0 6c 6f 63 6b 73 20 6f 66 20 65 69 67 68 74 20 0d |locks of eight .| 00003af0 20 20 70 69 78 65 6c 73 20 62 79 20 65 69 67 68 | pixels by eigh| 00003b00 74 20 70 69 78 65 6c 73 2c 20 61 6e 64 20 61 72 |t pixels, and ar| 00003b10 65 20 74 68 65 20 73 61 6d 65 20 73 69 7a 65 20 |e the same size | 00003b20 61 73 20 74 68 65 20 72 65 63 74 61 6e 67 75 6c |as the rectangul| 00003b30 61 72 20 62 6c 6f 63 6b 0d 20 20 6f 66 20 73 70 |ar block. of sp| 00003b40 61 63 65 20 74 61 6b 65 6e 20 75 70 20 62 79 20 |ace taken up by | 00003b50 6f 6e 65 20 6c 65 74 74 65 72 20 77 68 65 6e 20 |one letter when | 00003b60 79 6f 75 20 70 72 69 6e 74 20 74 65 78 74 20 74 |you print text t| 00003b70 6f 20 74 68 65 20 73 63 72 65 65 6e 2e 20 53 63 |o the screen. Sc| 00003b80 72 65 65 6e 0d 20 20 6d 65 6d 6f 72 79 20 69 73 |reen. memory is| 00003b90 20 64 69 76 69 64 65 64 20 75 70 20 69 6e 74 6f | divided up into| 00003ba0 20 62 6c 6f 63 6b 73 2c 20 77 69 74 68 20 65 61 | blocks, with ea| 00003bb0 63 68 20 74 68 65 20 63 68 61 72 61 63 74 65 72 |ch the character| 00003bc0 73 20 62 65 69 6e 67 20 64 65 66 69 6e 65 64 0d |s being defined.| 00003bd0 20 20 62 79 20 6f 6e 65 20 6f 66 20 74 68 65 73 | by one of thes| 00003be0 65 20 62 6c 6f 63 6b 73 2e 0d 2d 20 54 68 65 20 |e blocks..- The | 00003bf0 73 63 72 65 65 6e 20 69 73 20 73 74 6f 72 65 64 |screen is stored| 00003c00 20 72 6f 77 20 62 79 20 72 6f 77 2c 20 77 69 74 | row by row, wit| 00003c10 68 20 74 68 65 20 74 6f 70 20 72 6f 77 20 66 69 |h the top row fi| 00003c20 72 73 74 20 61 6e 64 20 74 68 65 20 62 6f 74 74 |rst and the bott| 00003c30 6f 6d 0d 20 20 72 6f 77 20 6c 61 73 74 2e 0d 2d |om. row last..-| 00003c40 20 57 69 74 68 69 6e 20 65 61 63 68 20 6f 66 20 | Within each of | 00003c50 74 68 65 73 65 20 72 6f 77 73 2c 20 63 68 61 72 |these rows, char| 00003c60 61 63 74 65 72 73 20 61 72 65 20 73 74 6f 72 65 |acters are store| 00003c70 64 20 6f 6e 65 20 62 79 20 6f 6e 65 2c 20 66 72 |d one by one, fr| 00003c80 6f 6d 20 6c 65 66 74 20 74 6f 0d 20 20 72 69 67 |om left to. rig| 00003c90 68 74 2e 0d 2d 20 49 6e 20 61 6c 6c 20 6d 6f 64 |ht..- In all mod| 00003ca0 65 73 2c 20 73 63 72 65 65 6e 20 6d 65 6d 6f 72 |es, screen memor| 00003cb0 79 20 65 6e 64 73 20 61 74 20 26 37 46 46 46 20 |y ends at &7FFF | 00003cc0 28 69 65 2e 20 61 74 20 74 68 65 20 65 6e 64 20 |(ie. at the end | 00003cd0 6f 66 20 52 41 4d 29 0d 0d 46 6f 6f 74 6e 6f 74 |of RAM)..Footnot| 00003ce0 65 3a 20 42 79 20 63 6f 6e 76 65 6e 74 69 6f 6e |e: By convention| 00003cf0 2c 20 6d 65 6d 6f 72 79 20 61 64 64 72 65 73 73 |, memory address| 00003d00 65 73 20 61 72 65 20 73 70 65 63 69 66 69 65 64 |es are specified| 00003d10 20 69 6e 20 68 65 78 69 64 65 63 69 6d 61 6c 2e | in hexidecimal.| 00003d20 20 49 0d 20 20 20 20 20 20 20 20 20 20 75 73 65 | I. use| 00003d30 20 74 68 65 20 73 74 61 6e 64 61 72 64 20 41 63 | the standard Ac| 00003d40 6f 72 6e 20 27 26 27 20 70 72 65 66 69 78 20 74 |orn '&' prefix t| 00003d50 6f 20 69 6e 64 69 63 61 74 65 20 68 65 78 69 64 |o indicate hexid| 00003d60 65 63 69 6d 61 6c 20 76 61 6c 75 65 73 2e 0d 20 |ecimal values.. | 00003d70 20 20 20 20 20 20 20 20 20 54 68 6f 73 65 20 75 | Those u| 00003d80 73 65 64 20 74 6f 20 64 65 61 6c 69 6e 67 20 77 |sed to dealing w| 00003d90 69 74 68 20 50 43 73 20 61 72 65 20 61 6e 79 20 |ith PCs are any | 00003da0 6f 74 68 65 72 20 63 6f 6d 70 75 74 65 72 73 20 |other computers | 00003db0 6d 61 79 20 62 65 20 75 73 65 64 0d 20 20 20 20 |may be used. | 00003dc0 20 20 20 20 20 20 74 6f 20 74 68 65 20 41 6d 65 | to the Ame| 00003dd0 72 69 63 61 6e 20 63 6f 6e 76 65 6e 74 69 6f 6e |rican convention| 00003de0 20 6f 66 20 75 73 69 6e 67 20 61 20 64 6f 6c 6c | of using a doll| 00003df0 61 72 20 70 72 65 66 69 78 20 69 6e 20 69 74 73 |ar prefix in its| 00003e00 20 70 6c 61 63 65 2e 0d 20 20 20 20 20 20 20 20 | place.. | 00003e10 20 20 49 74 20 73 68 6f 75 6c 64 20 62 65 20 6e | It should be n| 00003e20 6f 74 65 64 20 74 68 61 74 20 74 68 65 20 45 6c |oted that the El| 00003e30 6b 20 65 78 70 65 63 74 73 20 26 20 61 6e 64 20 |k expects & and | 00003e40 77 69 6c 6c 20 6e 6f 74 20 61 63 63 65 70 74 20 |will not accept | 00003e50 24 2e 0d 0d 45 78 61 6d 70 6c 65 3a 0d 0d 53 75 |$...Example:..Su| 00003e60 70 70 6f 73 65 20 49 20 77 61 6e 74 20 74 6f 20 |ppose I want to | 00003e70 64 72 61 77 20 61 20 62 6c 6f 62 20 69 6e 20 63 |draw a blob in c| 00003e80 68 61 72 61 63 74 65 72 20 73 71 75 61 72 65 20 |haracter square | 00003e90 28 36 2c 37 29 2c 20 69 6e 20 6d 6f 64 65 20 31 |(6,7), in mode 1| 00003ea0 2e 20 57 68 61 74 20 69 73 20 0d 74 68 65 20 61 |. What is .the a| 00003eb0 64 64 72 65 73 73 20 6f 66 20 74 68 69 73 20 73 |ddress of this s| 00003ec0 71 75 61 72 65 3f 20 28 67 69 76 65 6e 20 74 68 |quare? (given th| 00003ed0 61 74 20 65 61 63 68 20 63 68 61 72 61 63 74 65 |at each characte| 00003ee0 72 20 74 61 6b 65 73 20 31 36 20 62 79 74 65 73 |r takes 16 bytes| 00003ef0 20 6f 66 0d 73 63 72 65 65 6e 20 6d 65 6d 6f 72 | of.screen memor| 00003f00 79 20 74 6f 20 64 65 66 69 6e 65 20 69 6e 20 6d |y to define in m| 00003f10 6f 64 65 20 31 20 2d 20 77 65 27 6c 6c 20 63 6f |ode 1 - we'll co| 00003f20 6d 65 20 74 6f 20 68 6f 77 20 74 6f 20 63 61 6c |me to how to cal| 00003f30 63 75 6c 61 74 65 20 74 68 69 73 20 69 6e 0d 61 |culate this in.a| 00003f40 20 6d 69 6e 75 74 65 29 2e 0d 0d 57 65 6c 6c 20 | minute)...Well | 00003f50 2d 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 74 68 65 |- looking at the| 00003f60 20 74 61 62 6c 65 20 65 61 72 6c 69 65 72 2c 20 | table earlier, | 00003f70 73 63 72 65 65 6e 20 6d 65 6d 6f 72 79 20 73 74 |screen memory st| 00003f80 61 72 74 73 20 61 74 20 26 33 30 30 30 20 69 6e |arts at &3000 in| 00003f90 20 6d 6f 64 65 20 31 2e 0d 57 65 20 77 61 6e 74 | mode 1..We want| 00003fa0 20 74 6f 20 66 69 6e 64 20 74 68 65 20 73 74 61 | to find the sta| 00003fb0 72 74 20 6f 66 20 72 6f 77 20 37 20 69 6e 20 73 |rt of row 7 in s| 00003fc0 63 72 65 65 6e 20 6d 65 6d 6f 72 79 2e 20 54 68 |creen memory. Th| 00003fd0 69 73 20 72 6f 77 20 68 61 73 20 37 20 72 6f 77 |is row has 7 row| 00003fe0 73 20 6f 66 0d 63 68 61 72 61 63 74 65 72 73 20 |s of.characters | 00003ff0 61 62 6f 76 65 20 69 74 2c 20 61 6e 64 20 77 68 |above it, and wh| 00004000 69 63 68 20 77 69 6c 6c 20 62 65 20 73 74 6f 72 |ich will be stor| 00004010 65 64 20 62 65 66 6f 72 65 20 69 74 2e 20 45 61 |ed before it. Ea| 00004020 63 68 20 6f 66 20 74 68 65 73 65 20 72 6f 77 73 |ch of these rows| 00004030 0d 63 6f 6e 73 69 73 74 73 20 6f 66 20 34 30 20 |.consists of 40 | 00004040 63 68 61 72 61 63 74 65 72 73 2c 20 77 68 69 63 |characters, whic| 00004050 68 20 74 61 6b 65 20 75 70 20 31 36 20 62 79 74 |h take up 16 byt| 00004060 65 73 20 65 61 63 68 2e 20 54 68 65 72 65 66 6f |es each. Therefo| 00004070 72 65 20 74 68 65 20 74 6f 74 61 6c 0d 6d 65 6d |re the total.mem| 00004080 6f 72 79 20 74 61 6b 65 6e 20 75 70 20 62 79 20 |ory taken up by | 00004090 74 68 65 73 65 20 72 6f 77 73 20 69 73 20 37 20 |these rows is 7 | 000040a0 2a 20 34 30 20 2a 20 31 36 20 3d 20 34 34 38 30 |* 40 * 16 = 4480| 000040b0 20 62 79 74 65 73 2e 20 5b 45 61 63 68 20 63 68 | bytes. [Each ch| 000040c0 61 72 61 63 74 65 72 0d 69 73 20 31 36 20 62 79 |aracter.is 16 by| 000040d0 74 65 73 2c 20 65 61 63 68 20 72 6f 77 20 63 6f |tes, each row co| 000040e0 6e 73 69 73 74 73 20 6f 66 20 34 30 20 6f 66 20 |nsists of 40 of | 000040f0 74 68 65 73 65 20 63 68 61 72 61 63 74 65 72 73 |these characters| 00004100 2c 20 74 68 65 72 65 66 6f 72 65 20 77 65 0d 6d |, therefore we.m| 00004110 75 6c 74 69 70 6c 79 20 62 79 20 34 30 2c 20 61 |ultiply by 40, a| 00004120 6e 64 20 61 73 20 74 68 65 72 65 20 61 72 65 20 |nd as there are | 00004130 37 20 6f 66 20 74 68 65 73 65 20 63 6f 6d 70 6c |7 of these compl| 00004140 65 74 65 20 72 6f 77 73 2c 20 77 65 20 6d 75 6c |ete rows, we mul| 00004150 74 69 70 6c 79 20 62 79 0d 37 20 74 6f 20 67 65 |tiply by.7 to ge| 00004160 74 20 74 68 65 20 76 61 6c 75 65 20 66 6f 72 20 |t the value for | 00004170 73 65 76 65 6e 20 6f 66 20 74 68 65 73 65 20 72 |seven of these r| 00004180 6f 77 73 5d 0d 0d 4e 6f 77 20 77 65 20 68 61 76 |ows]..Now we hav| 00004190 65 20 74 68 61 74 20 74 68 65 20 73 74 61 72 74 |e that the start| 000041a0 69 6e 67 20 61 64 64 72 65 73 73 20 6f 66 20 72 |ing address of r| 000041b0 6f 77 20 37 20 69 73 20 61 74 3a 0d 0d 26 33 30 |ow 7 is at:..&30| 000041c0 30 30 20 2b 20 34 34 38 30 20 3d 20 26 34 31 38 |00 + 4480 = &418| 000041d0 30 0d 0d 4e 6f 77 20 74 68 61 74 20 77 65 20 68 |0..Now that we h| 000041e0 61 76 65 20 66 6f 75 6e 64 20 77 68 65 72 65 20 |ave found where | 000041f0 61 62 6f 75 74 73 20 69 6e 20 6d 65 6d 6f 72 79 |abouts in memory| 00004200 20 74 68 69 73 20 72 6f 77 20 73 74 61 72 74 73 | this row starts| 00004210 2c 20 77 65 20 6e 65 65 64 20 74 6f 0d 6c 6f 63 |, we need to.loc| 00004220 61 74 65 20 63 68 61 72 61 63 74 65 72 20 36 2e |ate character 6.| 00004230 20 54 68 69 73 20 73 68 6f 75 6c 64 20 62 65 20 | This should be | 00004240 66 61 69 72 6c 79 20 65 61 73 79 20 2d 20 77 65 |fairly easy - we| 00004250 20 6b 6e 6f 77 20 74 68 61 74 20 63 68 61 72 61 | know that chara| 00004260 63 74 65 72 73 20 61 72 65 0d 73 74 6f 72 65 64 |cters are.stored| 00004270 20 66 72 6f 6d 20 6c 65 66 74 20 74 6f 20 72 69 | from left to ri| 00004280 67 68 74 2c 20 73 6f 20 6a 75 73 74 20 61 64 64 |ght, so just add| 00004290 20 6f 6e 20 74 68 65 20 6d 65 6d 6f 72 79 20 72 | on the memory r| 000042a0 65 71 75 69 72 65 64 20 74 6f 20 73 74 6f 72 65 |equired to store| 000042b0 20 73 69 78 0d 63 68 61 72 61 63 74 65 72 73 20 | six.characters | 000042c0 74 6f 20 74 68 65 20 6c 65 66 74 20 6f 66 20 74 |to the left of t| 000042d0 68 65 20 6f 6e 65 20 77 65 20 77 61 6e 74 2c 20 |he one we want, | 000042e0 69 2e 65 2e 20 31 36 20 2a 20 36 20 3d 20 39 36 |i.e. 16 * 6 = 96| 000042f0 20 62 79 74 65 73 20 5b 53 69 78 0d 63 68 61 72 | bytes [Six.char| 00004300 61 63 74 65 72 73 2c 20 65 61 63 68 20 74 61 6b |acters, each tak| 00004310 69 6e 67 20 31 36 20 62 79 74 65 73 20 74 6f 20 |ing 16 bytes to | 00004320 73 74 6f 72 65 5d 2e 0d 0d 54 68 65 72 65 66 6f |store]...Therefo| 00004330 72 65 20 74 68 65 20 61 64 64 72 65 73 73 20 6f |re the address o| 00004340 66 20 63 68 61 72 61 63 74 65 72 20 28 36 2c 37 |f character (6,7| 00004350 29 20 77 69 6c 6c 20 62 65 3a 0d 0d 26 34 31 38 |) will be:..&418| 00004360 30 20 2b 20 39 36 20 3d 20 26 34 31 45 30 0d 0d |0 + 96 = &41E0..| 00004370 41 6e 73 77 65 72 3a 20 43 68 61 72 61 63 74 65 |Answer: Characte| 00004380 72 20 28 36 2c 37 29 20 69 73 20 73 74 6f 72 65 |r (6,7) is store| 00004390 64 20 66 72 6f 6d 20 26 34 31 45 30 20 74 6f 20 |d from &41E0 to | 000043a0 26 34 31 45 46 0d 0d 4a 75 73 74 20 74 6f 20 63 |&41EF..Just to c| 000043b0 68 65 63 6b 20 74 68 65 20 61 6e 73 77 65 72 20 |heck the answer | 000043c0 69 73 20 63 6f 72 72 65 63 74 2c 20 74 79 70 65 |is correct, type| 000043d0 20 74 68 69 73 20 73 69 6d 70 6c 65 20 6c 6f 6f | this simple loo| 000043e0 70 3a 0d 0d 31 30 20 4d 4f 44 45 20 31 0d 32 30 |p:..10 MODE 1.20| 000043f0 20 46 4f 52 20 61 64 3d 26 34 31 45 30 20 54 4f | FOR ad=&41E0 TO| 00004400 20 26 34 31 45 46 0d 33 30 20 3f 61 64 3d 32 35 | &41EF.30 ?ad=25| 00004410 35 0d 34 30 20 4e 45 58 54 0d 0d 41 6e 64 20 79 |5.40 NEXT..And y| 00004420 65 73 2c 20 61 20 77 68 69 74 65 20 73 70 6c 6f |es, a white splo| 00004430 64 67 65 20 64 6f 65 73 20 61 70 70 65 61 72 20 |dge does appear | 00004440 69 6e 20 73 71 75 61 72 65 20 28 36 2c 37 29 2e |in square (6,7).| 00004450 0d 0d 54 68 69 73 20 77 68 6f 6c 65 20 70 72 6f |..This whole pro| 00004460 63 65 64 75 72 65 20 63 61 6e 20 61 63 74 75 61 |cedure can actua| 00004470 6c 6c 79 20 62 65 20 72 65 66 69 6e 65 64 20 64 |lly be refined d| 00004480 6f 77 6e 2c 20 61 6e 64 20 65 78 70 72 65 73 73 |own, and express| 00004490 65 64 20 61 73 20 61 20 73 69 6d 70 6c 65 0d 66 |ed as a simple.f| 000044a0 6f 72 6d 75 6c 61 3a 0d 0d 41 64 64 72 65 73 73 |ormula:..Address| 000044b0 20 3d 20 42 61 73 65 20 2b 20 28 20 79 20 2a 20 | = Base + ( y * | 000044c0 4e 6f 2e 20 63 68 61 72 61 63 74 65 72 73 20 70 |No. characters p| 000044d0 65 72 20 6c 69 6e 65 20 2b 20 78 20 29 20 2a 20 |er line + x ) * | 000044e0 4d 65 6d 6f 72 79 20 70 65 72 20 63 68 61 72 61 |Memory per chara| 000044f0 63 74 65 72 0d 0d 57 68 65 72 65 3a 20 41 64 64 |cter..Where: Add| 00004500 72 65 73 73 3d 20 54 68 65 20 6d 65 6d 6f 72 79 |ress= The memory| 00004510 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 68 65 | location of the| 00004520 20 73 74 61 72 74 20 6f 66 20 74 68 65 20 63 68 | start of the ch| 00004530 61 72 61 63 74 65 72 20 79 6f 75 20 77 61 6e 74 |aracter you want| 00004540 2e 0d 20 20 20 20 20 20 20 42 61 73 65 20 20 20 |.. Base | 00004550 3d 20 53 74 61 72 74 20 6f 66 20 73 63 72 65 65 |= Start of scree| 00004560 6e 20 6d 65 6d 6f 72 79 20 69 6e 20 63 75 72 72 |n memory in curr| 00004570 65 6e 74 20 67 72 61 70 68 69 63 73 20 6d 6f 64 |ent graphics mod| 00004580 65 2e 0d 20 20 20 20 20 20 20 28 78 2c 79 29 20 |e.. (x,y) | 00004590 20 3d 20 43 6f 2d 6f 72 64 69 6e 61 74 65 20 6f | = Co-ordinate o| 000045a0 66 20 73 71 75 61 72 65 20 79 6f 75 20 77 61 6e |f square you wan| 000045b0 74 20 74 6f 20 61 63 63 65 73 73 20 28 73 61 6d |t to access (sam| 000045c0 65 20 61 73 20 50 52 49 4e 54 20 54 41 42 29 0d |e as PRINT TAB).| 000045d0 0d 53 69 6e 63 65 20 74 68 65 20 6e 75 6d 62 65 |.Since the numbe| 000045e0 72 20 6f 66 20 63 68 61 72 61 63 74 65 72 73 20 |r of characters | 000045f0 70 65 72 20 6c 69 6e 65 2c 20 74 68 65 20 6e 75 |per line, the nu| 00004600 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20 70 65 |mber of bytes pe| 00004610 72 20 63 68 61 72 61 63 74 65 72 2c 0d 61 6e 64 |r character,.and| 00004620 20 74 68 65 20 62 61 73 65 20 61 64 64 72 65 73 | the base addres| 00004630 73 20 6f 66 20 73 63 72 65 65 6e 20 6d 65 6d 6f |s of screen memo| 00004640 72 79 20 61 72 65 20 61 6c 6c 20 63 6f 6e 73 74 |ry are all const| 00004650 61 6e 74 20 66 6f 72 20 61 6e 79 20 70 61 72 74 |ant for any part| 00004660 69 63 75 6c 61 72 0d 67 72 61 70 68 69 63 73 20 |icular.graphics | 00004670 6d 6f 64 65 2c 20 74 68 65 20 76 61 6c 75 65 73 |mode, the values| 00004680 20 66 6f 72 20 74 68 65 20 67 72 61 70 68 69 63 | for the graphic| 00004690 73 20 6d 6f 64 65 20 79 6f 75 20 61 72 65 20 75 |s mode you are u| 000046a0 73 69 6e 67 20 63 61 6e 20 62 65 0d 73 75 62 73 |sing can be.subs| 000046b0 74 69 74 75 74 65 64 20 69 6e 74 6f 20 74 68 65 |tituted into the| 000046c0 20 65 71 75 61 74 69 6f 6e 20 69 6e 20 79 6f 75 | equation in you| 000046d0 72 20 70 72 6f 67 72 61 6d 2e 20 46 6f 72 20 6d |r program. For m| 000046e0 6f 64 65 20 31 2c 20 66 6f 72 20 65 78 61 6d 70 |ode 1, for examp| 000046f0 6c 65 2c 20 79 6f 75 0d 77 6f 75 6c 64 20 75 73 |le, you.would us| 00004700 65 3a 0d 0d 41 64 64 72 65 73 73 20 3d 20 26 33 |e:..Address = &3| 00004710 30 30 30 20 2b 20 28 34 30 20 2a 20 79 20 2b 20 |000 + (40 * y + | 00004720 78 29 20 2a 20 31 36 0d 0d 42 65 66 6f 72 65 20 |x) * 16..Before | 00004730 63 6f 6e 74 69 6e 75 69 6e 67 2c 20 6f 6e 65 20 |continuing, one | 00004740 6e 6f 74 65 20 73 68 6f 75 6c 64 20 62 65 20 62 |note should be b| 00004750 6f 72 6e 65 20 69 6e 20 6d 69 6e 64 2e 20 59 6f |orne in mind. Yo| 00004760 75 20 6d 61 79 20 72 65 6d 65 6d 62 65 72 20 74 |u may remember t| 00004770 68 61 74 0d 61 20 77 68 69 6c 65 20 62 61 63 6b |hat.a while back| 00004780 20 49 20 6d 65 6e 74 69 6f 6e 65 64 20 74 68 61 | I mentioned tha| 00004790 74 20 77 68 65 6e 20 79 6f 75 20 74 79 70 65 20 |t when you type | 000047a0 74 65 78 74 20 77 68 69 63 68 20 6f 76 65 72 66 |text which overf| 000047b0 6c 6f 77 73 20 6f 66 66 20 74 68 65 0d 62 6f 74 |lows off the.bot| 000047c0 74 6f 6d 20 6f 66 20 74 68 65 20 73 63 72 65 65 |tom of the scree| 000047d0 6e 2c 20 74 68 65 20 63 6f 6d 70 75 74 65 72 20 |n, the computer | 000047e0 6d 61 6b 65 73 20 61 20 6e 6f 74 65 20 74 68 61 |makes a note tha| 000047f0 74 20 65 61 63 68 20 6c 69 6e 65 20 69 73 20 73 |t each line is s| 00004800 74 6f 72 65 64 0d 69 6e 20 6d 65 6d 6f 72 79 20 |tored.in memory | 00004810 6f 6e 65 20 6c 69 6e 65 20 6c 6f 77 65 72 20 74 |one line lower t| 00004820 68 61 6e 20 69 74 20 73 68 6f 75 6c 64 20 62 65 |han it should be| 00004830 2c 20 62 75 74 20 64 6f 65 73 20 6e 6f 74 20 61 |, but does not a| 00004840 63 74 75 61 6c 6c 79 20 6d 6f 76 65 0d 61 6e 79 |ctually move.any| 00004850 74 68 69 6e 67 20 61 72 6f 75 6e 64 20 69 6e 20 |thing around in | 00004860 73 63 72 65 65 6e 20 6d 65 6d 6f 72 79 2e 20 54 |screen memory. T| 00004870 68 65 20 73 61 6d 65 20 65 66 66 65 63 74 20 63 |he same effect c| 00004880 61 6e 20 63 61 75 73 65 20 70 72 6f 62 6c 65 6d |an cause problem| 00004890 73 20 77 69 74 68 0d 64 69 72 65 63 74 20 61 63 |s with.direct ac| 000048a0 63 65 73 73 20 74 6f 20 73 63 72 65 65 6e 20 6d |cess to screen m| 000048b0 65 6d 6f 72 79 20 61 73 20 77 65 6c 6c 2e 20 54 |emory as well. T| 000048c0 68 65 20 73 69 6d 70 6c 65 20 72 75 6c 65 20 66 |he simple rule f| 000048d0 6f 72 20 62 65 67 69 6e 6e 65 72 73 20 69 73 2c |or beginners is,| 000048e0 0d 4e 45 56 45 52 20 61 74 74 65 6d 70 74 20 74 |.NEVER attempt t| 000048f0 6f 20 75 73 65 20 64 69 72 65 63 74 20 73 63 72 |o use direct scr| 00004900 65 65 6e 20 6d 65 6d 6f 72 79 20 61 63 63 65 73 |een memory acces| 00004910 73 20 77 68 65 6e 20 74 68 65 72 65 20 69 73 20 |s when there is | 00004920 65 76 65 6e 20 74 68 65 0d 73 6c 69 67 68 74 65 |even the.slighte| 00004930 73 74 20 70 6f 73 73 69 62 69 6c 69 74 79 20 74 |st possibility t| 00004940 68 61 74 20 74 68 65 20 73 63 72 65 65 6e 20 6d |hat the screen m| 00004950 69 67 68 74 20 68 61 76 65 20 62 65 65 6e 20 61 |ight have been a| 00004960 6c 6c 6f 77 65 64 20 74 6f 20 73 63 72 6f 6c 6c |llowed to scroll| 00004970 20 75 70 0d 61 74 20 61 6c 6c 20 28 65 2e 67 2e | up.at all (e.g.| 00004980 20 61 66 74 65 72 20 75 73 69 6e 67 20 49 4e 50 | after using INP| 00004990 55 54 20 74 6f 20 67 65 74 20 69 6e 70 75 74 20 |UT to get input | 000049a0 66 72 6f 6d 20 74 68 65 20 75 73 65 72 20 2d 20 |from the user - | 000049b0 68 6f 77 20 64 6f 20 79 6f 75 0d 6b 6e 6f 77 20 |how do you.know | 000049c0 74 68 61 74 20 74 68 65 79 20 64 69 64 6e 27 74 |that they didn't| 000049d0 20 74 79 70 65 20 73 6f 20 6d 75 63 68 20 74 68 | type so much th| 000049e0 61 74 20 69 74 20 77 65 6e 74 20 6f 66 20 74 68 |at it went of th| 000049f0 65 20 62 6f 74 74 6f 6d 20 6f 66 20 74 68 65 20 |e bottom of the | 00004a00 73 63 72 65 65 6e 3f 29 0d 49 66 20 79 6f 75 20 |screen?).If you | 00004a10 6b 6e 6f 77 20 77 68 61 74 20 79 6f 75 20 61 72 |know what you ar| 00004a20 65 20 64 6f 69 6e 67 2c 20 74 68 69 73 20 72 75 |e doing, this ru| 00004a30 6c 65 20 63 61 6e 20 62 65 20 69 67 6e 6f 72 65 |le can be ignore| 00004a40 64 2c 20 61 6e 64 20 68 69 67 68 2d 73 70 65 65 |d, and high-spee| 00004a50 64 0d 73 63 72 6f 6c 6c 69 6e 67 20 63 61 6e 20 |d.scrolling can | 00004a60 62 65 20 61 63 68 69 65 76 65 64 20 61 73 20 61 |be achieved as a| 00004a70 20 72 65 73 75 6c 74 2c 20 62 75 74 20 74 68 61 | result, but tha| 00004a80 74 20 69 73 20 6e 6f 74 20 66 6f 72 20 74 68 65 |t is not for the| 00004a90 20 62 65 67 69 6e 6e 65 72 21 20 49 0d 63 61 6e | beginner! I.can| 00004aa0 20 74 65 6c 6c 20 79 6f 75 20 66 72 6f 6d 20 66 | tell you from f| 00004ab0 69 72 73 74 20 68 61 6e 64 20 65 78 70 65 72 69 |irst hand experi| 00004ac0 65 6e 63 65 2c 20 74 68 61 74 20 63 72 65 61 74 |ence, that creat| 00004ad0 69 6e 67 20 73 63 72 6f 6c 6c 69 6e 67 20 69 6e |ing scrolling in| 00004ae0 20 4a 75 70 69 74 65 72 0d 33 20 62 79 20 74 68 | Jupiter.3 by th| 00004af0 69 73 20 74 65 63 68 6e 69 71 75 65 20 77 61 73 |is technique was| 00004b00 20 61 20 6e 69 67 68 74 6d 61 72 65 20 2d 20 65 | a nightmare - e| 00004b10 73 70 65 63 69 61 6c 6c 79 20 77 68 65 6e 20 74 |specially when t| 00004b20 68 65 20 6f 70 65 72 61 74 69 6e 67 20 73 79 73 |he operating sys| 00004b30 74 65 6d 0d 63 61 6c 6c 73 20 79 6f 75 20 6e 65 |tem.calls you ne| 00004b40 65 64 20 74 6f 20 6d 61 6b 65 20 74 6f 20 61 63 |ed to make to ac| 00004b50 68 69 65 76 65 20 74 68 69 73 20 61 72 65 20 63 |hieve this are c| 00004b60 6f 6d 70 6c 65 74 65 6c 79 20 64 69 66 66 65 72 |ompletely differ| 00004b70 65 6e 74 20 6f 6e 20 74 68 65 20 42 42 43 0d 74 |ent on the BBC.t| 00004b80 6f 20 74 68 65 20 45 6c 6b 2c 20 73 6f 20 79 6f |o the Elk, so yo| 00004b90 75 20 6e 65 65 64 20 74 6f 20 66 69 6e 64 20 6f |u need to find o| 00004ba0 75 74 20 77 68 69 63 68 20 70 6c 61 74 66 6f 72 |ut which platfor| 00004bb0 6d 20 79 6f 75 20 61 72 65 20 6f 70 65 72 61 74 |m you are operat| 00004bc0 69 6e 67 20 6f 6e 2c 0d 61 6e 64 20 74 68 65 6e |ing on,.and then| 00004bd0 20 6d 61 6b 65 20 74 68 65 20 72 65 6c 61 76 61 | make the relava| 00004be0 6e 74 20 63 61 6c 6c 73 20 66 6f 72 20 74 68 61 |nt calls for tha| 00004bf0 74 20 70 6c 61 74 66 6f 72 6d 21 0d 0d 4e 6f 77 |t platform!..Now| 00004c00 20 74 68 61 74 20 79 6f 75 20 63 61 6e 20 6c 6f | that you can lo| 00004c10 63 61 74 65 20 61 20 74 68 65 20 6d 65 6d 6f 72 |cate a the memor| 00004c20 79 20 6f 63 63 75 70 69 65 64 20 62 79 20 61 20 |y occupied by a | 00004c30 63 68 61 72 61 63 74 65 72 20 69 6e 20 73 63 72 |character in scr| 00004c40 65 65 6e 0d 6d 65 6d 6f 72 79 2c 20 79 6f 75 20 |een.memory, you | 00004c50 6e 65 65 64 20 74 6f 20 6b 6e 6f 77 20 68 6f 77 |need to know how| 00004c60 20 74 68 65 20 62 79 74 65 73 20 77 69 74 68 69 | the bytes withi| 00004c70 6e 20 74 68 69 73 20 62 6c 6f 63 6b 20 61 72 65 |n this block are| 00004c80 20 6c 61 69 64 20 6f 75 74 2c 20 73 6f 20 74 68 | laid out, so th| 00004c90 61 74 0d 79 6f 75 20 63 61 6e 20 68 61 76 65 20 |at.you can have | 00004ca0 70 69 78 65 6c 20 62 79 20 70 69 78 65 6c 20 63 |pixel by pixel c| 00004cb0 6f 6e 74 72 6f 6c 20 6f 76 65 72 20 79 6f 75 72 |ontrol over your| 00004cc0 20 6d 6f 6e 69 74 6f 72 20 73 63 72 65 65 6e 2e | monitor screen.| 00004cd0 20 54 68 69 73 20 69 73 20 61 6c 73 6f 0d 72 65 | This is also.re| 00004ce0 71 75 69 72 65 64 20 69 66 20 79 6f 75 20 61 72 |quired if you ar| 00004cf0 65 20 74 6f 20 62 65 20 61 62 6c 65 20 74 6f 20 |e to be able to | 00004d00 63 61 6c 63 75 6c 61 74 65 20 74 68 65 20 61 6d |calculate the am| 00004d10 6f 75 6e 74 20 6f 66 20 6d 65 6d 6f 72 79 20 74 |ount of memory t| 00004d20 61 6b 65 6e 20 75 70 0d 62 79 20 65 61 63 68 20 |aken up.by each | 00004d30 63 68 61 72 61 63 74 65 72 27 73 20 64 65 66 69 |character's defi| 00004d40 6e 69 74 69 6f 6e 20 69 6e 20 61 20 70 61 72 74 |nition in a part| 00004d50 69 63 75 6c 61 72 20 6d 6f 64 65 2e 0d 0d 54 68 |icular mode...Th| 00004d60 65 20 67 72 61 70 68 69 63 73 20 6d 6f 64 65 73 |e graphics modes| 00004d70 20 63 61 6e 20 62 65 20 64 69 76 69 64 65 64 20 | can be divided | 00004d80 69 6e 74 6f 20 74 68 72 65 65 20 63 61 74 65 67 |into three categ| 00004d90 6f 72 69 65 73 3a 20 6d 6f 6e 6f 63 68 72 6f 6d |ories: monochrom| 00004da0 65 20 6d 6f 64 65 73 0d 28 69 65 2e 20 74 77 6f |e modes.(ie. two| 00004db0 20 63 6f 6c 6f 75 72 73 29 2c 20 66 6f 75 72 20 | colours), four | 00004dc0 63 6f 6c 6f 75 72 20 6d 6f 64 65 73 2c 20 61 6e |colour modes, an| 00004dd0 64 20 73 69 78 74 65 65 6e 20 63 6f 6c 6f 75 72 |d sixteen colour| 00004de0 20 6d 6f 64 65 73 2e 20 41 6c 6c 20 6f 66 20 74 | modes. All of t| 00004df0 68 65 0d 45 6c 6b 27 73 20 6d 6f 64 65 73 20 66 |he.Elk's modes f| 00004e00 61 6c 6c 20 69 6e 74 6f 20 74 68 65 73 65 20 74 |all into these t| 00004e10 68 72 65 65 20 67 72 6f 75 70 69 6e 67 73 2e 20 |hree groupings. | 00004e20 57 68 69 63 68 20 6f 66 20 74 68 65 73 65 20 63 |Which of these c| 00004e30 6f 6c 6f 75 72 73 20 65 61 63 68 0d 70 69 78 65 |olours each.pixe| 00004e40 6c 20 6f 66 20 74 68 65 20 73 63 72 65 65 6e 20 |l of the screen | 00004e50 69 73 20 64 65 70 65 6e 64 73 20 75 70 6f 6e 20 |is depends upon | 00004e60 74 68 65 20 73 74 61 74 75 73 20 6f 66 20 61 20 |the status of a | 00004e70 6e 75 6d 62 65 72 20 6f 66 20 62 69 6e 61 72 79 |number of binary| 00004e80 20 62 69 74 73 2e 0d 54 68 65 73 65 20 68 61 76 | bits..These hav| 00004e90 65 20 74 77 6f 20 73 74 61 74 65 73 2c 20 30 20 |e two states, 0 | 00004ea0 6f 72 20 31 2e 20 4e 6f 77 2c 20 69 6e 20 61 20 |or 1. Now, in a | 00004eb0 6d 6f 6e 6f 63 68 72 6f 6d 65 20 6d 6f 64 65 2c |monochrome mode,| 00004ec0 20 6f 6e 65 20 62 69 74 20 69 73 0d 73 75 66 66 | one bit is.suff| 00004ed0 69 63 69 65 6e 74 20 74 6f 20 64 65 66 69 6e 65 |icient to define| 00004ee0 20 74 68 65 20 63 6f 6c 6f 75 72 20 6f 66 20 6f | the colour of o| 00004ef0 6e 65 20 70 69 78 65 6c 20 28 62 69 74 73 20 68 |ne pixel (bits h| 00004f00 61 76 65 20 74 77 6f 20 73 74 61 74 65 73 2c 20 |ave two states, | 00004f10 30 20 6f 72 20 31 2c 0d 61 6e 64 20 74 68 65 20 |0 or 1,.and the | 00004f20 70 69 78 65 6c 73 20 68 61 76 65 20 74 77 6f 20 |pixels have two | 00004f30 73 74 61 74 65 73 2c 20 63 6f 6c 6f 75 72 20 30 |states, colour 0| 00004f40 20 6f 72 20 63 6f 6c 6f 75 72 20 31 29 2e 20 49 | or colour 1). I| 00004f50 6e 20 61 20 66 6f 75 72 20 63 6f 6c 6f 75 72 20 |n a four colour | 00004f60 6d 6f 64 65 2c 0d 6f 6e 20 74 68 65 20 6f 74 68 |mode,.on the oth| 00004f70 65 72 20 68 61 6e 64 2c 20 6f 6e 65 20 62 69 74 |er hand, one bit| 00004f80 20 77 69 6c 6c 20 6e 6f 74 20 62 65 20 73 75 66 | will not be suf| 00004f90 66 69 63 69 65 6e 74 2c 20 61 73 20 66 6f 75 72 |ficient, as four| 00004fa0 20 64 69 66 66 65 72 65 6e 74 20 73 74 61 74 65 | different state| 00004fb0 73 0d 61 72 65 20 72 65 71 75 69 72 65 64 2e 20 |s.are required. | 00004fc0 54 77 6f 20 62 69 74 73 20 77 69 6c 6c 20 62 65 |Two bits will be| 00004fd0 20 65 6e 6f 75 67 68 20 74 6f 20 73 74 6f 72 65 | enough to store| 00004fe0 20 74 68 65 20 63 6f 6c 6f 75 72 20 6f 66 20 6f | the colour of o| 00004ff0 6e 65 20 70 69 78 65 6c 2c 0d 68 6f 77 65 76 65 |ne pixel,.howeve| 00005000 72 3a 0d 0d 42 69 74 20 31 20 73 74 61 74 65 20 |r:..Bit 1 state | 00005010 20 20 20 20 42 69 74 20 32 20 73 74 61 74 65 20 | Bit 2 state | 00005020 20 20 20 20 43 6f 6c 6f 75 72 0d 20 20 30 20 20 | Colour. 0 | 00005030 20 20 20 20 20 20 20 20 20 20 20 20 20 30 20 20 | 0 | 00005040 20 20 20 20 20 20 20 20 20 20 20 20 20 30 0d 20 | 0. | 00005050 20 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 0 | 00005060 20 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | 1 | 00005070 20 31 0d 20 20 31 20 20 20 20 20 20 20 20 20 20 | 1. 1 | 00005080 20 20 20 20 20 30 20 20 20 20 20 20 20 20 20 20 | 0 | 00005090 20 20 20 20 20 32 0d 20 20 31 20 20 20 20 20 20 | 2. 1 | 000050a0 20 20 20 20 20 20 20 20 20 31 20 20 20 20 20 20 | 1 | 000050b0 20 20 20 20 20 20 20 20 20 33 0d 0d 54 68 6f 73 | 3..Thos| 000050c0 65 20 66 61 6d 69 6c 69 61 72 20 77 69 74 68 20 |e familiar with | 000050d0 62 69 6e 61 72 79 20 77 69 6c 6c 20 73 70 6f 74 |binary will spot| 000050e0 20 74 68 65 20 70 61 74 74 65 72 6e 20 73 74 72 | the pattern str| 000050f0 61 69 67 68 74 20 61 77 61 79 20 2d 20 73 69 6d |aight away - sim| 00005100 70 6c 79 0d 63 6f 6e 76 65 72 74 20 74 68 65 20 |ply.convert the | 00005110 62 69 6e 61 72 79 20 76 61 6c 75 65 20 6f 66 20 |binary value of | 00005120 74 68 65 20 74 77 6f 20 62 69 74 73 20 69 6e 74 |the two bits int| 00005130 6f 20 64 65 63 69 6d 61 6c 2c 20 61 6e 64 20 79 |o decimal, and y| 00005140 6f 75 20 68 61 76 65 20 74 68 65 0d 6c 6f 67 69 |ou have the.logi| 00005150 63 61 6c 20 63 6f 6c 6f 75 72 20 6e 75 6d 62 65 |cal colour numbe| 00005160 72 2e 20 41 20 76 65 72 79 20 73 69 6d 69 6c 61 |r. A very simila| 00005170 72 20 70 61 74 74 65 72 6e 20 61 70 70 6c 69 65 |r pattern applie| 00005180 73 20 74 6f 20 4d 4f 44 45 20 32 20 2d 20 74 68 |s to MODE 2 - th| 00005190 65 20 45 6c 6b 27 73 0d 31 36 20 63 6f 6c 6f 75 |e Elk's.16 colou| 000051a0 72 20 6d 6f 64 65 2e 20 45 61 63 68 20 70 69 78 |r mode. Each pix| 000051b0 65 6c 20 72 65 71 75 69 72 65 73 20 34 20 62 69 |el requires 4 bi| 000051c0 74 73 20 74 6f 20 73 74 6f 72 65 20 69 74 73 20 |ts to store its | 000051d0 63 6f 6c 6f 75 72 20 28 32 5e 34 3d 31 36 29 2e |colour (2^4=16).| 000051e0 0d 4f 6e 63 65 20 61 67 61 69 6e 2c 20 74 68 65 |.Once again, the| 000051f0 20 63 6f 6c 6f 75 72 20 6f 66 20 74 68 65 20 70 | colour of the p| 00005200 69 78 65 6c 20 69 73 20 74 68 65 20 6c 6f 67 69 |ixel is the logi| 00005210 63 61 6c 20 63 6f 6c 6f 75 72 20 77 68 6f 73 65 |cal colour whose| 00005220 20 6e 75 6d 62 65 72 20 69 73 0d 67 69 76 65 6e | number is.given| 00005230 20 77 68 65 6e 20 74 68 65 20 66 6f 75 72 20 62 | when the four b| 00005240 69 74 73 20 61 72 65 20 70 75 74 20 74 6f 67 65 |its are put toge| 00005250 74 68 65 72 20 74 6f 20 66 6f 72 6d 20 61 20 62 |ther to form a b| 00005260 69 6e 61 72 79 20 76 61 6c 75 65 3a 0d 0d 42 69 |inary value:..Bi| 00005270 74 20 31 20 73 74 61 74 65 20 20 42 69 74 20 32 |t 1 state Bit 2| 00005280 20 73 74 61 74 65 20 20 42 69 74 20 33 20 73 74 | state Bit 3 st| 00005290 61 74 65 20 20 42 69 74 20 34 20 73 74 61 74 65 |ate Bit 4 state| 000052a0 20 20 43 6f 6c 6f 75 72 20 20 44 65 66 61 75 6c | Colour Defaul| 000052b0 74 0d 20 20 30 20 20 20 20 20 20 20 20 20 20 20 |t. 0 | 000052c0 20 30 20 20 20 20 20 20 20 20 20 20 20 20 30 20 | 0 0 | 000052d0 20 20 20 20 20 20 20 20 20 20 20 30 20 20 20 20 | 0 | 000052e0 20 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20 | 0 | 000052f0 42 4c 4b 0d 20 20 30 20 20 20 20 20 20 20 20 20 |BLK. 0 | 00005300 20 20 20 30 20 20 20 20 20 20 20 20 20 20 20 20 | 0 | 00005310 30 20 20 20 20 20 20 20 20 20 20 20 20 31 20 20 |0 1 | 00005320 20 20 20 20 20 20 20 20 20 20 31 20 20 20 20 20 | 1 | 00005330 20 20 52 45 44 0d 20 20 30 20 20 20 20 20 20 20 | RED. 0 | 00005340 20 20 20 20 20 30 20 20 20 20 20 20 20 20 20 20 | 0 | 00005350 20 20 31 20 20 20 20 20 20 20 20 20 20 20 20 30 | 1 0| 00005360 20 20 20 20 20 20 20 20 20 20 20 20 32 20 20 20 | 2 | 00005370 20 20 20 20 47 52 4e 0d 20 20 30 20 20 20 20 20 | GRN. 0 | 00005380 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20 20 | 0 | 00005390 20 20 20 20 31 20 20 20 20 20 20 20 20 20 20 20 | 1 | 000053a0 20 31 20 20 20 20 20 20 20 20 20 20 20 20 33 20 | 1 3 | 000053b0 20 20 20 20 20 20 59 45 4c 0d 20 20 30 20 20 20 | YEL. 0 | 000053c0 20 20 20 20 20 20 20 20 20 31 20 20 20 20 20 20 | 1 | 000053d0 20 20 20 20 20 20 30 20 20 20 20 20 20 20 20 20 | 0 | 000053e0 20 20 20 30 20 20 20 20 20 20 20 20 20 20 20 20 | 0 | 000053f0 34 20 20 20 20 20 20 20 42 4c 45 0d 20 20 30 20 |4 BLE. 0 | 00005400 20 20 20 20 20 20 20 20 20 20 20 31 20 20 20 20 | 1 | 00005410 20 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20 | 0 | 00005420 20 20 20 20 20 31 20 20 20 20 20 20 20 20 20 20 | 1 | 00005430 20 20 35 20 20 20 20 20 20 20 4d 47 54 0d 20 20 | 5 MGT. | 00005440 30 20 20 20 20 20 20 20 20 20 20 20 20 31 20 20 |0 1 | 00005450 20 20 20 20 20 20 20 20 20 20 31 20 20 20 20 20 | 1 | 00005460 20 20 20 20 20 20 20 30 20 20 20 20 20 20 20 20 | 0 | 00005470 20 20 20 20 36 20 20 20 20 20 20 20 43 59 4e 0d | 6 CYN.| 00005480 20 20 30 20 20 20 20 20 20 20 20 20 20 20 20 31 | 0 1| 00005490 20 20 20 20 20 20 20 20 20 20 20 20 31 20 20 20 | 1 | 000054a0 20 20 20 20 20 20 20 20 20 31 20 20 20 20 20 20 | 1 | 000054b0 20 20 20 20 20 20 37 20 20 20 20 20 20 20 57 48 | 7 WH| 000054c0 54 0d 20 20 31 20 20 20 20 20 20 20 20 20 20 20 |T. 1 | 000054d0 20 30 20 20 20 20 20 20 20 20 20 20 20 20 30 20 | 0 0 | 000054e0 20 20 20 20 20 20 20 20 20 20 20 30 20 20 20 20 | 0 | 000054f0 20 20 20 20 20 20 20 20 38 20 20 20 20 20 42 4c | 8 BL| 00005500 4b 2f 57 48 54 0d 20 20 31 20 20 20 20 20 20 20 |K/WHT. 1 | 00005510 20 20 20 20 20 30 20 20 20 20 20 20 20 20 20 20 | 0 | 00005520 20 20 30 20 20 20 20 20 20 20 20 20 20 20 20 31 | 0 1| 00005530 20 20 20 20 20 20 20 20 20 20 20 20 39 20 20 20 | 9 | 00005540 20 20 52 45 44 2f 43 59 4e 0d 20 20 31 20 20 20 | RED/CYN. 1 | 00005550 20 20 20 20 20 20 20 20 20 30 20 20 20 20 20 20 | 0 | 00005560 20 20 20 20 20 20 31 20 20 20 20 20 20 20 20 20 | 1 | 00005570 20 20 20 30 20 20 20 20 20 20 20 20 20 20 20 20 | 0 | 00005580 31 30 20 20 20 20 47 52 4e 2f 4d 47 54 0d 20 20 |10 GRN/MGT. | 00005590 31 20 20 20 20 20 20 20 20 20 20 20 20 30 20 20 |1 0 | 000055a0 20 20 20 20 20 20 20 20 20 20 31 20 20 20 20 20 | 1 | 000055b0 20 20 20 20 20 20 20 31 20 20 20 20 20 20 20 20 | 1 | 000055c0 20 20 20 20 31 31 20 20 20 20 59 45 4c 2f 42 4c | 11 YEL/BL| 000055d0 45 0d 20 20 31 20 20 20 20 20 20 20 20 20 20 20 |E. 1 | 000055e0 20 31 20 20 20 20 20 20 20 20 20 20 20 20 30 20 | 1 0 | 000055f0 20 20 20 20 20 20 20 20 20 20 20 30 20 20 20 20 | 0 | 00005600 20 20 20 20 20 20 20 20 31 32 20 20 20 20 42 4c | 12 BL| 00005610 45 2f 59 45 4c 0d 20 20 31 20 20 20 20 20 20 20 |E/YEL. 1 | 00005620 20 20 20 20 20 31 20 20 20 20 20 20 20 20 20 20 | 1 | 00005630 20 20 30 20 20 20 20 20 20 20 20 20 20 20 20 31 | 0 1| 00005640 20 20 20 20 20 20 20 20 20 20 20 20 31 33 20 20 | 13 | 00005650 20 20 4d 47 54 2f 47 52 4e 0d 20 20 31 20 20 20 | MGT/GRN. 1 | 00005660 20 20 20 20 20 20 20 20 20 31 20 20 20 20 20 20 | 1 | 00005670 20 20 20 20 20 20 31 20 20 20 20 20 20 20 20 20 | 1 | 00005680 20 20 20 30 20 20 20 20 20 20 20 20 20 20 20 20 | 0 | 00005690 31 34 20 20 20 20 43 59 4e 2f 52 45 44 0d 20 20 |14 CYN/RED. | 000056a0 31 20 20 20 20 20 20 20 20 20 20 20 20 31 20 20 |1 1 | 000056b0 20 20 20 20 20 20 20 20 20 20 31 20 20 20 20 20 | 1 | 000056c0 20 20 20 20 20 20 20 31 20 20 20 20 20 20 20 20 | 1 | 000056d0 20 20 20 20 31 35 20 20 20 20 57 48 54 2f 42 4c | 15 WHT/BL| 000056e0 4b 0d 0d 5b 44 65 66 61 75 6c 74 3a 20 44 65 66 |K..[Default: Def| 000056f0 61 75 6c 74 20 73 65 74 74 69 6e 67 20 6f 66 20 |ault setting of | 00005700 74 68 69 73 20 6c 6f 67 69 63 61 6c 20 63 6f 6c |this logical col| 00005710 6f 75 72 20 77 68 65 6e 20 4d 4f 44 45 20 32 20 |our when MODE 2 | 00005720 69 73 20 66 69 72 73 74 0d 65 6e 74 65 72 65 64 |is first.entered| 00005730 5d 0d 0d 53 6f 2e 2e 2e 20 74 68 65 20 45 6c 65 |]..So... the Ele| 00005740 63 74 72 6f 6e 20 68 61 73 20 6d 6f 64 65 73 20 |ctron has modes | 00005750 77 68 65 72 65 20 74 68 65 20 64 65 66 69 6e 69 |where the defini| 00005760 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 6f 6c 6f |tion of the colo| 00005770 75 72 20 6f 66 20 61 0d 63 65 72 74 61 69 6e 20 |ur of a.certain | 00005780 70 69 78 65 6c 20 63 61 6e 20 74 61 6b 65 20 31 |pixel can take 1| 00005790 2c 20 32 20 6f 72 20 34 20 62 69 74 73 2e 20 41 |, 2 or 4 bits. A| 000057a0 73 20 65 61 63 68 20 62 79 74 65 20 6f 66 20 74 |s each byte of t| 000057b0 68 65 20 65 6c 65 63 74 72 6f 6e 27 73 0d 6d 65 |he electron's.me| 000057c0 6d 6f 72 79 20 63 6f 6e 73 69 73 74 73 20 6f 66 |mory consists of| 000057d0 20 38 20 73 65 70 65 72 61 74 65 20 62 69 74 73 | 8 seperate bits| 000057e0 2c 20 74 68 69 73 20 6d 65 61 6e 73 20 74 68 61 |, this means tha| 000057f0 74 20 69 6e 20 6d 6f 6e 6f 63 68 72 6f 6d 65 20 |t in monochrome | 00005800 6d 6f 64 65 73 0d 77 65 20 63 61 6e 20 66 69 74 |modes.we can fit| 00005810 20 38 20 70 69 78 65 6c 73 20 69 6e 74 6f 20 65 | 8 pixels into e| 00005820 61 63 68 20 62 79 74 65 20 28 38 2f 31 3d 38 29 |ach byte (8/1=8)| 00005830 2e 20 49 6e 20 66 6f 75 72 20 63 6f 6c 6f 75 72 |. In four colour| 00005840 20 6d 6f 64 65 73 20 28 77 68 65 72 65 0d 65 61 | modes (where.ea| 00005850 63 68 20 70 69 78 65 6c 20 72 65 71 75 69 72 65 |ch pixel require| 00005860 73 20 74 77 6f 20 62 69 74 73 29 20 77 65 20 63 |s two bits) we c| 00005870 61 6e 20 66 69 74 20 34 20 70 69 78 65 6c 73 20 |an fit 4 pixels | 00005880 69 6e 74 6f 20 65 61 63 68 20 62 79 74 65 20 28 |into each byte (| 00005890 38 2f 32 3d 34 29 2e 0d 46 69 6e 61 6c 6c 79 20 |8/2=4)..Finally | 000058a0 69 6e 20 4d 4f 44 45 20 32 20 28 74 68 65 20 73 |in MODE 2 (the s| 000058b0 69 78 74 65 65 6e 20 63 6f 6c 6f 75 72 20 6d 6f |ixteen colour mo| 000058c0 64 65 20 77 68 65 72 65 20 65 61 63 68 20 70 69 |de where each pi| 000058d0 78 65 6c 20 72 65 71 75 69 72 65 73 20 34 0d 62 |xel requires 4.b| 000058e0 69 74 73 29 20 77 65 20 63 61 6e 20 66 69 74 20 |its) we can fit | 000058f0 74 77 6f 20 70 69 78 65 6c 73 20 69 6e 74 6f 20 |two pixels into | 00005900 65 61 63 68 20 62 79 74 65 2e 20 4c 65 74 27 73 |each byte. Let's| 00005910 20 6e 6f 77 20 6c 6f 6f 6b 20 61 74 20 68 6f 77 | now look at how| 00005920 20 65 61 63 68 20 69 73 0d 6c 61 69 64 20 6f 75 | each is.laid ou| 00005930 74 20 69 6e 20 6d 6f 72 65 20 64 65 70 74 68 3a |t in more depth:| 00005940 0d 0d 4d 4f 4e 4f 43 48 52 4f 4d 45 20 4d 4f 44 |..MONOCHROME MOD| 00005950 45 53 3a 0d 0d 54 68 65 73 65 20 61 72 65 20 6c |ES:..These are l| 00005960 61 69 64 20 6f 75 74 20 69 6e 20 74 68 65 20 73 |aid out in the s| 00005970 69 6d 70 6c 65 73 74 20 77 61 79 2c 20 61 73 20 |implest way, as | 00005980 65 69 67 68 74 20 70 69 78 65 6c 73 20 66 69 74 |eight pixels fit| 00005990 20 69 6e 74 6f 20 65 61 63 68 20 62 79 74 65 2e | into each byte.| 000059a0 0d 54 68 65 20 63 68 61 72 61 63 74 65 72 2c 20 |.The character, | 000059b0 72 65 6d 65 6d 62 65 72 2c 20 63 6f 6e 73 69 73 |remember, consis| 000059c0 74 73 20 6f 66 20 61 6e 20 38 20 62 79 20 38 20 |ts of an 8 by 8 | 000059d0 73 71 75 61 72 65 20 6f 66 20 70 69 78 65 6c 73 |square of pixels| 000059e0 2e 20 54 68 65 20 64 61 74 61 0d 69 73 20 73 74 |. The data.is st| 000059f0 6f 72 65 64 20 69 6e 20 74 68 65 20 73 61 6d 65 |ored in the same| 00005a00 20 77 61 79 20 61 73 20 75 73 65 72 20 64 65 66 | way as user def| 00005a10 69 6e 65 64 20 63 68 61 72 61 63 74 65 72 73 20 |ined characters | 00005a20 61 72 65 20 64 65 66 69 6e 65 64 20 75 73 69 6e |are defined usin| 00005a30 67 0d 56 44 55 32 33 2e 20 54 68 65 20 66 69 72 |g.VDU23. The fir| 00005a40 73 74 20 62 79 74 65 20 6f 66 20 74 68 65 20 64 |st byte of the d| 00005a50 65 66 69 6e 69 74 69 6f 6e 20 64 65 66 69 6e 65 |efinition define| 00005a60 73 20 74 68 65 20 74 6f 70 20 72 6f 77 20 6f 66 |s the top row of| 00005a70 20 65 69 67 68 74 20 70 69 78 65 6c 73 3b 0d 74 | eight pixels;.t| 00005a80 68 65 20 73 65 63 6f 6e 64 20 64 65 66 69 6e 65 |he second define| 00005a90 73 20 74 68 65 20 73 65 63 6f 6e 64 20 72 6f 77 |s the second row| 00005aa0 20 64 6f 77 6e 2c 20 65 74 63 2e 20 54 68 75 73 | down, etc. Thus| 00005ab0 20 74 68 65 20 65 6e 74 69 72 65 20 63 68 61 72 | the entire char| 00005ac0 61 63 74 65 72 20 63 61 6e 0d 62 65 20 64 65 66 |acter can.be def| 00005ad0 69 6e 65 64 20 69 6e 20 65 69 67 68 74 20 62 79 |ined in eight by| 00005ae0 74 65 73 2c 20 61 6e 64 20 74 68 69 73 20 69 73 |tes, and this is| 00005af0 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 62 | the number of b| 00005b00 79 74 65 73 20 6f 66 20 74 68 65 20 45 6c 6b 27 |ytes of the Elk'| 00005b10 73 0d 6d 65 6d 6f 72 79 20 77 68 69 63 68 20 69 |s.memory which i| 00005b20 73 20 75 73 65 64 20 62 79 20 65 61 63 68 20 63 |s used by each c| 00005b30 68 61 72 61 63 74 65 72 2e 20 4e 6f 74 65 20 2d |haracter. Note -| 00005b40 20 74 68 65 20 6d 6f 73 74 20 73 69 67 6e 69 66 | the most signif| 00005b50 69 63 61 6e 74 20 62 69 74 20 6f 66 0d 65 61 63 |icant bit of.eac| 00005b60 68 20 62 79 74 65 20 64 65 66 69 6e 65 73 20 74 |h byte defines t| 00005b70 68 65 20 6c 65 66 74 2d 6d 6f 73 74 20 70 69 78 |he left-most pix| 00005b80 65 6c 20 6f 66 20 74 68 65 20 72 6f 77 2c 20 61 |el of the row, a| 00005b90 6e 64 20 74 68 65 20 6c 65 61 73 74 20 73 69 67 |nd the least sig| 00005ba0 6e 69 66 69 63 61 6e 74 0d 62 69 74 20 64 65 66 |nificant.bit def| 00005bb0 69 6e 65 73 20 74 68 65 20 72 69 67 68 74 2d 6d |ines the right-m| 00005bc0 6f 73 74 20 70 69 78 65 6c 20 28 6a 75 73 74 20 |ost pixel (just | 00005bd0 61 73 20 77 69 74 68 20 56 44 55 20 32 33 20 64 |as with VDU 23 d| 00005be0 65 66 69 6e 69 74 69 6f 6e 73 29 0d 0d 46 4f 55 |efinitions)..FOU| 00005bf0 52 20 43 4f 4c 4f 55 52 20 4d 4f 44 45 53 3a 0d |R COLOUR MODES:.| 00005c00 0d 54 68 69 73 20 74 69 6d 65 20 65 61 63 68 20 |.This time each | 00005c10 62 79 74 65 20 63 61 6e 20 6f 6e 6c 79 20 68 6f |byte can only ho| 00005c20 6c 64 20 66 6f 75 72 20 70 69 78 65 6c 73 2e 20 |ld four pixels. | 00005c30 4f 6e 63 65 20 61 67 61 69 6e 2c 20 65 61 63 68 |Once again, each| 00005c40 20 62 79 74 65 20 68 6f 6c 64 73 0d 61 20 6e 75 | byte holds.a nu| 00005c50 6d 62 65 72 20 6f 66 20 70 69 78 65 6c 73 20 77 |mber of pixels w| 00005c60 68 69 63 68 20 61 72 65 20 69 6e 20 61 20 68 6f |hich are in a ho| 00005c70 72 69 7a 6f 6e 74 61 6c 20 6c 69 6e 65 2e 20 54 |rizontal line. T| 00005c80 68 69 73 20 74 69 6d 65 2c 20 61 73 20 62 65 66 |his time, as bef| 00005c90 6f 72 65 2c 0d 74 68 65 20 66 69 72 73 74 20 65 |ore,.the first e| 00005ca0 69 67 68 74 20 62 79 74 65 73 20 72 75 6e 20 64 |ight bytes run d| 00005cb0 6f 77 6e 20 69 6e 20 61 20 76 65 72 74 69 63 61 |own in a vertica| 00005cc0 6c 20 6c 69 6e 65 2e 20 54 68 69 73 20 74 69 6d |l line. This tim| 00005cd0 65 2c 20 74 68 6f 75 67 68 2c 20 6e 6f 74 0d 61 |e, though, not.a| 00005ce0 6c 6c 20 6f 66 20 74 68 65 20 70 69 78 65 6c 73 |ll of the pixels| 00005cf0 20 69 6e 20 74 68 65 20 63 68 61 72 61 63 74 65 | in the characte| 00005d00 72 20 61 72 65 20 62 65 69 6e 67 20 64 65 66 69 |r are being defi| 00005d10 6e 65 64 2c 20 61 6e 64 20 6f 6e 6c 79 20 74 68 |ned, and only th| 00005d20 65 20 6c 65 66 74 0d 6d 6f 73 74 20 34 20 70 69 |e left.most 4 pi| 00005d30 78 65 6c 73 2e 20 54 68 65 20 72 69 67 68 74 2d |xels. The right-| 00005d40 6d 6f 73 74 20 66 6f 75 72 20 70 69 78 65 6c 73 |most four pixels| 00005d50 20 61 72 65 20 64 65 66 69 6e 65 64 20 69 6e 20 | are defined in | 00005d60 61 20 73 65 63 6f 6e 64 20 64 6f 77 6e 77 61 72 |a second downwar| 00005d70 64 0d 76 65 72 74 69 63 61 6c 20 73 77 65 65 70 |d.vertical sweep| 00005d80 2e 20 54 68 75 73 20 74 68 65 20 74 6f 74 61 6c |. Thus the total| 00005d90 20 6d 65 6d 6f 72 79 20 61 6c 6c 6f 63 61 74 69 | memory allocati| 00005da0 6f 6e 20 66 6f 72 20 65 61 63 68 20 63 68 61 72 |on for each char| 00005db0 61 63 74 65 72 20 69 73 0d 73 69 78 74 65 65 6e |acter is.sixteen| 00005dc0 20 62 79 74 65 73 2e 20 54 68 65 20 6c 61 79 6f | bytes. The layo| 00005dd0 75 74 20 69 73 20 73 68 6f 77 6e 20 6d 6f 72 65 |ut is shown more| 00005de0 20 63 6c 65 61 72 6c 79 20 75 73 69 6e 67 20 61 | clearly using a| 00005df0 20 64 69 61 67 72 61 6d 2e 20 54 68 69 73 0d 73 | diagram. This.s| 00005e00 68 6f 77 73 20 74 68 65 20 65 69 67 68 74 20 62 |hows the eight b| 00005e10 79 20 65 69 67 68 74 20 62 6c 6f 63 6b 20 6f 66 |y eight block of| 00005e20 20 70 69 78 65 6c 73 20 69 6e 20 61 20 63 68 61 | pixels in a cha| 00005e30 72 61 63 74 65 72 2c 20 61 6e 64 20 65 61 63 68 |racter, and each| 00005e40 20 68 61 73 0d 74 68 65 20 6f 66 66 73 65 74 20 | has.the offset | 00005e50 6f 66 20 74 68 65 20 6d 65 6d 6f 72 79 20 6c 6f |of the memory lo| 00005e60 63 61 74 69 6f 6e 20 77 68 65 72 65 20 74 68 69 |cation where thi| 00005e70 73 20 70 69 78 65 6c 20 69 73 20 73 74 6f 72 65 |s pixel is store| 00005e80 64 20 66 72 6f 6d 20 74 68 65 0d 73 74 61 72 74 |d from the.start| 00005e90 20 6f 66 20 74 68 65 20 63 68 61 72 61 63 74 65 | of the characte| 00005ea0 72 20 64 65 66 69 6e 69 74 69 6f 6e 2e 20 4f 66 |r definition. Of| 00005eb0 66 73 65 74 73 20 61 72 65 20 67 69 76 65 6e 20 |fsets are given | 00005ec0 69 6e 20 68 65 78 69 64 65 63 69 6d 61 6c 3a 0d |in hexidecimal:.| 00005ed0 0d 50 49 58 45 4c 2d 42 59 20 50 49 58 45 4c 20 |.PIXEL-BY PIXEL | 00005ee0 4c 41 59 4f 55 54 20 20 20 20 4d 45 4d 4f 52 59 |LAYOUT MEMORY| 00005ef0 20 46 4c 4f 57 0d 0d 30 30 30 30 38 38 38 38 20 | FLOW..00008888 | 00005f00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00005f10 20 20 30 20 20 20 20 20 20 38 0d 31 31 31 31 39 | 0 8.11119| 00005f20 39 39 39 20 20 20 20 20 20 20 20 20 20 20 20 20 |999 | 00005f30 20 20 20 20 20 20 dd 20 20 20 20 20 20 dd 0d 32 | . ..2| 00005f40 32 32 32 41 41 41 41 20 20 20 20 20 20 20 20 20 |222AAAA | 00005f50 20 20 20 20 20 20 20 20 20 20 dd 20 20 20 20 20 | . | 00005f60 20 dd 0d 33 33 33 33 42 42 42 42 20 20 20 20 20 | ..3333BBBB | 00005f70 20 20 20 20 20 20 20 20 20 20 20 20 20 20 dd 20 | . | 00005f80 20 20 20 20 20 dd 0d 34 34 34 34 43 43 43 43 20 | ..4444CCCC | 00005f90 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | | 00005fa0 20 20 dd 20 20 20 20 20 20 dd 0d 35 35 35 35 44 | . ..5555D| 00005fb0 44 44 44 20 20 20 20 20 20 20 20 20 20 20 20 20 |DDD | 00005fc0 20 20 20 20 20 20 dd 20 20 20 20 20 20 dd 0d 36 | . ..6| 00005fd0 36 36 36 45 45 45 45 20 20 20 20 20 20 20 20 20 |666EEEE | 00005fe0 20 20 20 20 20 20 20 20 20 5c 20 2f 20 20 20 20 | \ / | 00005ff0 5c 20 2f 0d 37 37 37 37 46 46 46 46 20 20 20 20 |\ /.7777FFFF | 00006000 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 37 | 7| 00006010 20 20 20 20 20 20 46 0d 0d 45 61 63 68 20 6f 66 | F..Each of| 00006020 20 74 68 65 73 65 20 73 69 78 74 65 65 6e 20 62 | these sixteen b| 00006030 79 74 65 73 2c 20 61 73 20 61 6c 72 65 61 64 79 |ytes, as already| 00006040 20 64 69 73 63 75 73 73 65 64 2c 20 63 6f 6e 74 | discussed, cont| 00006050 61 69 6e 73 20 66 6f 75 72 20 70 69 78 65 6c 0d |ains four pixel.| 00006060 64 65 66 69 6e 69 74 69 6f 6e 73 2e 20 42 75 74 |definitions. But| 00006070 20 77 69 74 68 69 6e 20 74 68 65 20 62 79 74 65 | within the byte| 00006080 27 73 20 65 69 67 68 74 20 62 69 74 73 2c 20 74 |'s eight bits, t| 00006090 68 65 79 20 61 72 65 20 6e 6f 74 20 6c 61 69 64 |hey are not laid| 000060a0 20 6f 75 74 20 61 73 0d 79 6f 75 20 6d 69 67 68 | out as.you migh| 000060b0 74 20 61 74 20 66 69 72 73 74 20 69 6d 61 67 69 |t at first imagi| 000060c0 6e 65 2e 20 49 66 20 77 65 20 63 61 6c 6c 20 74 |ne. If we call t| 000060d0 68 65 20 66 6f 75 72 20 70 69 78 65 6c 73 20 41 |he four pixels A| 000060e0 2c 20 42 2c 20 43 20 61 6e 64 20 44 20 28 41 20 |, B, C and D (A | 000060f0 69 73 0d 6c 65 66 74 2d 6d 6f 73 74 2c 20 44 20 |is.left-most, D | 00006100 69 73 20 72 69 67 68 74 2d 6d 6f 73 74 29 2c 20 |is right-most), | 00006110 74 68 65 20 6c 61 79 20 6f 75 74 20 69 73 3a 0d |the lay out is:.| 00006120 0d 5b 4d 4f 53 54 20 53 49 47 4e 49 46 49 43 41 |.[MOST SIGNIFICA| 00006130 4e 54 5d 20 20 20 20 41 31 20 42 31 20 43 31 20 |NT] A1 B1 C1 | 00006140 44 31 20 41 30 20 42 30 20 43 30 20 44 30 20 20 |D1 A0 B0 C0 D0 | 00006150 20 20 5b 4c 45 41 53 54 20 53 49 47 4e 49 46 49 | [LEAST SIGNIFI| 00006160 43 41 4e 54 5d 0d 0d 57 68 65 72 65 3a 20 41 31 |CANT]..Where: A1| 00006170 3a 20 4d 6f 73 74 20 73 69 67 6e 69 66 69 63 61 |: Most significa| 00006180 6e 74 20 62 69 74 20 6f 66 20 41 27 73 20 64 65 |nt bit of A's de| 00006190 66 69 6e 69 74 69 6f 6e 20 20 dd 20 54 77 6f 20 |finition . Two | 000061a0 62 69 74 20 64 65 66 69 6e 69 74 69 6f 6e 0d 20 |bit definition. | 000061b0 20 20 20 20 20 20 41 30 3a 20 4c 65 61 73 74 20 | A0: Least | 000061c0 73 69 67 6e 69 66 69 63 61 6e 74 20 62 69 74 20 |significant bit | 000061d0 6f 66 20 41 27 73 20 64 65 66 69 6e 69 74 69 6f |of A's definitio| 000061e0 6e 20 dd 20 20 6f 66 20 70 69 78 65 6c 20 41 2e |n . of pixel A.| 000061f0 0d 0d 54 68 65 20 73 61 6d 65 20 70 61 74 74 65 |..The same patte| 00006200 72 6e 20 68 6f 6c 64 73 20 66 6f 72 20 42 2c 20 |rn holds for B, | 00006210 43 20 61 6e 64 20 44 2e 0d 0d 45 78 61 6d 70 6c |C and D...Exampl| 00006220 65 3a 0d 0d 4c 65 74 27 73 20 73 75 70 70 6f 73 |e:..Let's suppos| 00006230 65 20 77 65 20 77 61 6e 74 20 74 6f 20 73 65 74 |e we want to set| 00006240 20 74 68 65 20 63 6f 6c 6f 75 72 20 6f 66 20 74 | the colour of t| 00006250 68 65 20 6c 65 66 74 2d 6d 6f 73 74 20 70 69 78 |he left-most pix| 00006260 65 6c 20 69 6e 20 61 20 62 79 74 65 0d 6f 66 20 |el in a byte.of | 00006270 61 20 66 6f 75 72 20 63 6f 6c 6f 75 72 20 6d 6f |a four colour mo| 00006280 64 65 20 74 6f 20 62 65 20 63 6f 6c 6f 75 72 20 |de to be colour | 00006290 33 2e 20 57 65 20 77 6f 75 6c 64 20 75 73 65 3a |3. We would use:| 000062a0 0d 0d 3f 61 64 64 72 65 73 73 3d 28 3f 61 64 64 |..?address=(?add| 000062b0 72 65 73 73 20 41 4e 44 20 26 37 37 29 20 4f 52 |ress AND &77) OR| 000062c0 20 26 38 38 0d 0d 45 78 70 6c 61 6e 61 74 69 6f | &88..Explanatio| 000062d0 6e 20 2d 20 54 68 65 20 28 3f 61 64 64 72 65 73 |n - The (?addres| 000062e0 73 20 41 4e 44 20 26 37 37 29 20 62 69 74 20 63 |s AND &77) bit c| 000062f0 6c 65 61 72 73 20 74 68 65 20 74 77 6f 20 62 69 |lears the two bi| 00006300 74 73 20 64 65 66 69 6e 69 6e 67 20 74 68 65 0d |ts defining the.| 00006310 70 69 78 65 6c 20 74 68 61 74 20 77 65 20 77 61 |pixel that we wa| 00006320 6e 74 20 74 6f 20 63 68 61 6e 67 65 2e 20 54 68 |nt to change. Th| 00006330 65 20 4f 52 20 26 38 38 20 74 68 65 6e 20 73 65 |e OR &88 then se| 00006340 74 73 20 74 68 65 20 74 77 6f 20 62 69 74 73 20 |ts the two bits | 00006350 74 68 61 74 20 77 65 0d 77 61 6e 74 20 73 65 74 |that we.want set| 00006360 2e 20 54 68 69 73 20 77 61 79 20 77 65 20 65 6e |. This way we en| 00006370 73 75 72 65 20 74 68 61 74 20 77 68 65 6e 20 77 |sure that when w| 00006380 65 20 61 72 65 20 67 6f 69 6e 67 20 77 61 79 20 |e are going way | 00006390 66 72 6f 6d 20 63 6f 6c 6f 75 72 20 31 20 74 6f |from colour 1 to| 000063a0 0d 63 6f 6c 6f 75 72 20 32 2c 20 74 68 65 20 6c |.colour 2, the l| 000063b0 65 61 73 74 20 73 69 67 6e 69 66 69 63 61 6e 74 |east significant| 000063c0 20 62 69 74 20 6f 66 20 74 68 65 20 64 65 66 69 | bit of the defi| 000063d0 6e 69 74 69 6f 6e 20 69 73 20 63 6c 65 61 72 65 |nition is cleare| 000063e0 64 20 61 73 20 77 65 6c 6c 0d 61 73 20 74 68 65 |d as well.as the| 000063f0 20 6d 6f 73 74 20 73 69 67 6e 69 66 69 63 61 6e | most significan| 00006400 74 20 62 69 74 20 62 65 69 6e 67 20 73 65 74 2e |t bit being set.| 00006410 0d 0d 49 74 20 69 73 20 69 6d 70 6f 72 74 61 6e |..It is importan| 00006420 74 20 74 6f 20 6e 6f 74 69 63 65 20 74 68 65 20 |t to notice the | 00006430 70 61 74 74 65 72 6e 20 69 6e 20 74 68 65 73 65 |pattern in these| 00006440 20 62 69 74 73 20 2d 20 65 61 63 68 20 70 69 78 | bits - each pix| 00006450 65 6c 20 72 65 71 75 69 72 65 73 0d 61 20 74 77 |el requires.a tw| 00006460 6f 20 62 69 74 20 64 65 66 69 6e 69 74 69 6f 6e |o bit definition| 00006470 2c 20 62 75 74 20 74 68 65 73 65 20 74 77 6f 20 |, but these two | 00006480 62 69 74 73 20 61 72 65 20 6e 6f 74 20 6e 65 78 |bits are not nex| 00006490 74 20 74 6f 20 65 61 63 68 20 6f 74 68 65 72 20 |t to each other | 000064a0 69 6e 0d 74 68 65 20 62 79 74 65 20 2d 20 69 6e |in.the byte - in| 000064b0 73 74 65 61 64 20 61 6c 6c 20 6f 66 20 74 68 65 |stead all of the| 000064c0 20 68 69 67 68 2d 62 79 74 65 73 20 61 72 65 20 | high-bytes are | 000064d0 73 74 6f 72 65 64 20 74 6f 67 65 74 68 65 72 2c |stored together,| 000064e0 20 61 6e 64 20 61 6c 6c 20 6f 66 0d 74 68 65 20 | and all of.the | 000064f0 6c 6f 77 2d 62 79 74 65 73 20 61 72 65 20 73 74 |low-bytes are st| 00006500 6f 72 65 64 20 74 6f 67 65 74 68 65 72 2e 0d 0d |ored together...| 00006510 53 49 58 54 45 45 4e 20 43 4f 4c 4f 55 52 20 4d |SIXTEEN COLOUR M| 00006520 4f 44 45 53 0d 0d 54 68 65 20 70 61 74 74 65 72 |ODES..The patter| 00006530 6e 20 66 6f 72 20 73 69 78 74 65 65 6e 20 63 6f |n for sixteen co| 00006540 6c 6f 75 72 20 6d 6f 64 65 73 20 69 73 20 73 69 |lour modes is si| 00006550 6d 69 6c 61 72 20 74 6f 20 74 68 61 74 20 66 6f |milar to that fo| 00006560 75 6e 64 20 69 6e 20 66 6f 75 72 0d 63 6f 6c 6f |und in four.colo| 00006570 75 72 20 6d 6f 64 65 73 2c 20 65 78 63 65 70 74 |ur modes, except| 00006580 20 74 68 61 74 20 65 61 63 68 20 62 79 74 65 20 | that each byte | 00006590 63 61 6e 20 6f 6e 6c 79 20 73 74 6f 72 65 20 74 |can only store t| 000065a0 77 6f 20 70 69 78 65 6c 73 20 28 65 61 63 68 0d |wo pixels (each.| 000065b0 6f 63 63 75 70 69 65 73 20 66 6f 75 72 20 62 69 |occupies four bi| 000065c0 74 73 29 2e 20 41 73 20 77 69 74 68 20 70 72 65 |ts). As with pre| 000065d0 76 69 6f 75 73 20 63 61 73 65 73 2c 20 74 68 65 |vious cases, the| 000065e0 20 70 69 78 65 6c 73 20 61 72 65 20 73 74 6f 72 | pixels are stor| 000065f0 65 64 0d 69 6e 20 61 20 6e 75 6d 62 65 72 20 6f |ed.in a number o| 00006600 66 20 76 65 72 74 69 63 61 6c 20 73 77 65 65 70 |f vertical sweep| 00006610 73 20 73 74 61 72 74 69 6e 67 20 61 74 20 74 68 |s starting at th| 00006620 65 20 6c 65 66 74 20 6f 66 20 74 68 65 20 63 68 |e left of the ch| 00006630 61 72 61 63 74 65 72 2c 0d 61 6e 64 20 6d 6f 76 |aracter,.and mov| 00006640 69 6e 67 20 74 6f 20 74 68 65 20 72 69 67 68 74 |ing to the right| 00006650 2e 20 54 68 69 73 20 74 69 6d 65 2c 20 74 68 6f |. This time, tho| 00006660 75 67 68 2c 20 66 6f 75 72 20 76 65 72 74 69 63 |ugh, four vertic| 00006670 61 6c 20 73 77 65 65 70 73 20 61 72 65 0d 72 65 |al sweeps are.re| 00006680 71 75 69 72 65 64 20 74 6f 20 63 6f 76 65 72 20 |quired to cover | 00006690 74 68 65 20 65 6e 74 69 72 65 20 63 68 61 72 61 |the entire chara| 000066a0 63 74 65 72 2c 20 6e 6f 74 20 74 77 6f 20 61 73 |cter, not two as| 000066b0 20 77 69 74 68 20 66 6f 75 72 20 63 6f 6c 6f 75 | with four colou| 000066c0 72 0d 6d 6f 64 65 73 3a 0d 0d 50 49 58 45 4c 2d |r.modes:..PIXEL-| 000066d0 42 59 20 50 49 58 45 4c 20 4c 41 59 4f 55 54 20 |BY PIXEL LAYOUT | 000066e0 20 20 20 4d 45 4d 4f 52 59 20 46 4c 4f 57 0d 0d | MEMORY FLOW..| 000066f0 30 30 38 38 30 30 38 38 20 20 20 20 20 20 20 20 |00880088 | 00006700 20 20 20 20 20 20 20 20 20 20 20 30 20 20 20 20 | 0 | 00006710 20 20 38 20 20 20 20 31 30 20 20 20 20 31 38 0d | 8 10 18.| 00006720 31 31 39 39 31 31 39 39 20 20 20 20 20 20 20 20 |11991199 | 00006730 20 20 20 20 20 20 20 20 20 20 20 dd 20 20 20 20 | . | 00006740 20 20 dd 20 20 20 20 20 dd 20 20 20 20 20 dd 0d | . . ..| 00006750 32 32 41 41 32 32 41 41 20 20 20 20 20 20 20 20 |22AA22AA | 00006760 20 20 20 20 20 20 20 20 20 20 20 dd 20 20 20 20 | . | 00006770 20 20 dd 20 20 20 20 20 dd 20 20 20 20 20 dd 0d | . . ..| 00006780 33 33 42 42 33 33 42 42 20 20 20 20 20 20 20 20 |33BB33BB | 00006790 20 20 20 20 20 20 20 20 20 20 20 dd 20 20 20 20 | . | 000067a0 20 20 dd 20 20 20 20 20 dd 20 20 20 20 20 dd 0d | . . ..| 000067b0 34 34 43 43 34 34 43 43 20 20 20 20 20 20 20 20 |44CC44CC | 000067c0 20 20 20 20 20 20 20 20 20 20 20 dd 20 20 20 20 | . | 000067d0 20 20 dd 20 20 20 20 20 dd 20 20 20 20 20 dd 0d | . . ..| 000067e0 35 35 44 44 35 35 44 44 20 20 20 20 20 20 20 20 |55DD55DD | 000067f0 20 20 20 20 20 20 20 20 20 20 20 dd 20 20 20 20 | . | 00006800 20 20 dd 20 20 20 20 20 dd 20 20 20 20 20 dd 0d | . . ..| 00006810 36 36 45 45 36 36 45 45 20 20 20 20 20 20 20 20 |66EE66EE | 00006820 20 20 20 20 20 20 20 20 20 20 5c 20 2f 20 20 20 | \ / | 00006830 20 5c 20 2f 20 20 20 5c 20 2f 20 20 20 5c 20 2f | \ / \ / \ /| 00006840 0d 37 37 46 46 37 37 46 46 20 20 20 20 20 20 20 |.77FF77FF | 00006850 20 20 20 20 20 20 20 20 20 20 20 20 37 20 20 20 | 7 | 00006860 20 20 20 46 20 20 20 20 31 37 20 20 20 20 31 46 | F 17 1F| 00006870 0d 0d 4e 42 3a 20 4f 66 66 73 65 74 73 20 67 69 |..NB: Offsets gi| 00006880 76 65 6e 20 69 6e 20 68 65 78 61 64 65 63 69 6d |ven in hexadecim| 00006890 61 6c 2e 20 56 61 6c 75 65 73 20 69 6e 20 72 69 |al. Values in ri| 000068a0 67 68 74 20 68 61 6c 66 20 6f 66 20 6c 65 66 74 |ght half of left| 000068b0 20 64 69 61 67 72 61 6d 0d 73 68 6f 75 6c 64 20 | diagram.should | 000068c0 68 61 76 65 20 26 31 30 20 61 64 64 65 64 20 74 |have &10 added t| 000068d0 6f 20 74 68 65 6d 20 28 6f 6e 6c 79 20 6c 65 61 |o them (only lea| 000068e0 73 74 20 73 69 67 6e 69 66 69 63 61 6e 74 20 63 |st significant c| 000068f0 68 61 72 61 63 74 65 72 20 67 69 76 65 6e 29 0d |haracter given).| 00006900 0d 54 68 65 20 70 61 74 74 65 72 6e 20 6f 66 20 |.The pattern of | 00006910 74 68 65 20 6c 61 79 6f 75 74 20 6f 66 20 74 68 |the layout of th| 00006920 65 20 70 69 78 65 6c 20 64 61 74 61 20 69 6e 20 |e pixel data in | 00006930 65 61 63 68 20 6f 66 20 74 68 65 20 62 79 74 65 |each of the byte| 00006940 73 0d 69 73 20 61 6c 73 6f 20 73 69 6d 69 6c 61 |s.is also simila| 00006950 72 20 74 6f 20 74 68 61 74 20 66 6f 72 20 74 68 |r to that for th| 00006960 65 20 66 6f 75 72 20 63 6f 6c 6f 75 72 20 6d 6f |e four colour mo| 00006970 64 65 73 20 28 74 68 65 20 74 77 6f 20 70 69 78 |des (the two pix| 00006980 65 6c 73 0d 61 72 65 20 41 20 61 6e 64 20 42 2c |els.are A and B,| 00006990 20 61 6e 64 20 65 61 63 68 20 63 6f 6d 70 72 69 | and each compri| 000069a0 73 65 73 20 6f 66 20 66 6f 75 72 20 62 69 74 73 |ses of four bits| 000069b0 20 30 2d 33 2c 20 77 68 65 72 65 20 30 20 69 73 | 0-3, where 0 is| 000069c0 20 6c 65 61 73 74 0d 73 69 67 6e 69 66 69 63 61 | least.significa| 000069d0 6e 74 20 61 6e 64 20 33 20 69 73 20 6d 6f 73 74 |nt and 3 is most| 000069e0 20 73 69 67 6e 69 66 69 63 61 6e 74 29 2e 0d 0d | significant)...| 000069f0 5b 4d 4f 53 54 20 53 49 47 4e 49 46 49 43 41 4e |[MOST SIGNIFICAN| 00006a00 54 5d 20 20 20 20 41 33 20 42 33 20 41 32 20 42 |T] A3 B3 A2 B| 00006a10 32 20 41 31 20 42 31 20 41 30 20 42 30 20 20 20 |2 A1 B1 A0 B0 | 00006a20 20 5b 4c 45 41 53 54 20 53 49 47 4e 49 46 49 43 | [LEAST SIGNIFIC| 00006a30 41 4e 54 5d 0d 0d 4e 6f 74 69 63 65 20 74 68 61 |ANT]..Notice tha| 00006a40 74 20 6f 6e 63 65 20 61 67 61 69 6e 20 62 69 74 |t once again bit| 00006a50 73 20 64 65 66 69 6e 69 6e 67 20 74 68 65 20 70 |s defining the p| 00006a60 69 78 65 6c 73 20 41 20 61 6e 64 20 42 20 61 72 |ixels A and B ar| 00006a70 65 20 6e 6f 74 0d 73 74 6f 72 65 64 20 74 6f 67 |e not.stored tog| 00006a80 65 74 68 65 72 2c 20 62 75 74 20 74 68 6f 73 65 |ether, but those| 00006a90 20 64 65 66 69 6e 69 6e 67 20 74 68 65 20 6c 65 | defining the le| 00006aa0 61 73 74 2f 6d 6f 73 74 20 73 69 67 6e 69 66 69 |ast/most signifi| 00006ab0 63 61 6e 74 0d 62 69 74 73 20 61 72 65 20 73 74 |cant.bits are st| 00006ac0 6f 72 65 64 20 74 6f 67 65 74 68 65 72 2e 0d |ored together..| 00006acf