Home » Personal collection » Acorn hard disk » misc » misc3 » eug_titles/PT3/+P4

eug_titles/PT3/+P4

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn hard disk » misc » misc3
Filename: eug_titles/PT3/+P4
Read OK:
File size: 156A bytes
Load address: 0000
Exec address: 0000
Duplicates

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

File contents
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 VDU 23. 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's definition. 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. The difference this
time, though, is that not all of the pixels in the character are being
defined by the one sweep, and instead only the left-most four pixels can
be defined. The right-most four pixels are defined in a second downward
vertical sweep. Thus the total memory allocation for the definition of
each character is sixteen bytes. The layout of these is shown more clearly
by the diagram below. 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
hexadecimal:

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 each 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
the left-most, D is the right-most), the layout 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

A simialar 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) part clears the two bits defining the
pixel that we want to change. The OR &88 then sets the two bits that we
want to set. This way we ensure that when we are going say 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 tha pattern in these bits - each pixel requires
a two bit definition, but these two bits are not next to each other in the
byte as one might expect - 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 very simialr to that found in four
colour modes, except that each byte can only store two pixels (each
occupies four bites). As with previous cases, the pixels are stored in a
number of vertical sweeps starting at the left of the character, and
moving right. This time four vertical sweeps are required to cover all of
the character (there are eight pixels across, and each sweep covers two of
them). The layout is shown below:

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 hexadecinal. Values in the right half of the above
diagram (ie. the right four pixels, which have * underneath) should have
&10 added to them - only the least significant character of each
hexadecimal value is given. I am sure you can see my problem - the
hexadecimal values are two digits long, and I've only got one character in
which to put them!

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 once again that bits defining the pixels A and B are not stored
together, but those defining the least/most significant bits are stored
together.

MORE ON THE SUBJECT ON SCREEN MEMORY IN NEXT EUG...
00000000  53 6f 2e 2e 2e 20 74 68  65 20 45 6c 65 63 74 72  |So... the Electr|
00000010  6f 6e 20 68 61 73 20 6d  6f 64 65 73 20 77 68 65  |on has modes whe|
00000020  72 65 20 74 68 65 20 64  65 66 69 6e 69 74 69 6f  |re the definitio|
00000030  6e 20 6f 66 20 74 68 65  20 63 6f 6c 6f 75 72 20  |n of the colour |
00000040  6f 66 20 61 0d 63 65 72  74 61 69 6e 20 70 69 78  |of a.certain pix|
00000050  65 6c 20 63 61 6e 20 74  61 6b 65 20 31 2c 20 32  |el can take 1, 2|
00000060  20 6f 72 20 34 20 62 69  74 73 2e 20 41 73 20 65  | or 4 bits. As e|
00000070  61 63 68 20 62 79 74 65  20 6f 66 20 74 68 65 20  |ach byte of the |
00000080  65 6c 65 63 74 72 6f 6e  27 73 0d 6d 65 6d 6f 72  |electron's.memor|
00000090  79 20 63 6f 6e 73 69 73  74 73 20 6f 66 20 38 20  |y consists of 8 |
000000a0  73 65 70 65 72 61 74 65  20 62 69 74 73 2c 20 74  |seperate bits, t|
000000b0  68 69 73 20 6d 65 61 6e  73 20 74 68 61 74 20 69  |his means that i|
000000c0  6e 20 6d 6f 6e 6f 63 68  72 6f 6d 65 20 6d 6f 64  |n monochrome mod|
000000d0  65 73 0d 77 65 20 63 61  6e 20 66 69 74 20 38 20  |es.we can fit 8 |
000000e0  70 69 78 65 6c 73 20 69  6e 74 6f 20 65 61 63 68  |pixels into each|
000000f0  20 62 79 74 65 20 28 38  2f 31 3d 38 29 2e 20 49  | byte (8/1=8). I|
00000100  6e 20 66 6f 75 72 20 63  6f 6c 6f 75 72 20 6d 6f  |n four colour mo|
00000110  64 65 73 20 28 77 68 65  72 65 0d 65 61 63 68 20  |des (where.each |
00000120  70 69 78 65 6c 20 72 65  71 75 69 72 65 73 20 74  |pixel requires t|
00000130  77 6f 20 62 69 74 73 29  20 77 65 20 63 61 6e 20  |wo bits) we can |
00000140  66 69 74 20 34 20 70 69  78 65 6c 73 20 69 6e 74  |fit 4 pixels int|
00000150  6f 20 65 61 63 68 20 62  79 74 65 20 28 38 2f 32  |o each byte (8/2|
00000160  3d 34 29 2e 0d 46 69 6e  61 6c 6c 79 20 69 6e 20  |=4)..Finally in |
00000170  4d 4f 44 45 20 32 20 28  74 68 65 20 73 69 78 74  |MODE 2 (the sixt|
00000180  65 65 6e 20 63 6f 6c 6f  75 72 20 6d 6f 64 65 20  |een colour mode |
00000190  77 68 65 72 65 20 65 61  63 68 20 70 69 78 65 6c  |where each pixel|
000001a0  20 72 65 71 75 69 72 65  73 20 34 0d 62 69 74 73  | requires 4.bits|
000001b0  29 20 77 65 20 63 61 6e  20 66 69 74 20 74 77 6f  |) we can fit two|
000001c0  20 70 69 78 65 6c 73 20  69 6e 74 6f 20 65 61 63  | pixels into eac|
000001d0  68 20 62 79 74 65 2e 20  4c 65 74 27 73 20 6e 6f  |h byte. Let's no|
000001e0  77 20 6c 6f 6f 6b 20 61  74 20 68 6f 77 20 65 61  |w look at how ea|
000001f0  63 68 20 69 73 0d 6c 61  69 64 20 6f 75 74 20 69  |ch is.laid out i|
00000200  6e 20 6d 6f 72 65 20 64  65 70 74 68 3a 0d 0d 4d  |n more depth:..M|
00000210  4f 4e 4f 43 48 52 4f 4d  45 20 4d 4f 44 45 53 3a  |ONOCHROME MODES:|
00000220  0d 0d 54 68 65 73 65 20  61 72 65 20 6c 61 69 64  |..These are laid|
00000230  20 6f 75 74 20 69 6e 20  74 68 65 20 73 69 6d 70  | out in the simp|
00000240  6c 65 73 74 20 77 61 79  2c 20 61 73 20 65 69 67  |lest way, as eig|
00000250  68 74 20 70 69 78 65 6c  73 20 66 69 74 20 69 6e  |ht pixels fit in|
00000260  74 6f 20 65 61 63 68 0d  62 79 74 65 2e 20 54 68  |to each.byte. Th|
00000270  65 20 63 68 61 72 61 63  74 65 72 2c 20 72 65 6d  |e character, rem|
00000280  65 6d 62 65 72 2c 20 63  6f 6e 73 69 73 74 73 20  |ember, consists |
00000290  6f 66 20 61 6e 20 38 2d  62 79 2d 38 20 73 71 75  |of an 8-by-8 squ|
000002a0  61 72 65 20 6f 66 20 70  69 78 65 6c 73 2e 20 54  |are of pixels. T|
000002b0  68 65 0d 64 61 74 61 20  69 73 20 73 74 6f 72 65  |he.data is store|
000002c0  64 20 69 6e 20 74 68 65  20 73 61 6d 65 20 77 61  |d in the same wa|
000002d0  79 20 61 73 20 75 73 65  72 20 64 65 66 69 6e 65  |y as user define|
000002e0  64 20 63 68 61 72 61 63  74 65 72 73 20 61 72 65  |d characters are|
000002f0  20 64 65 66 69 6e 65 64  0d 75 73 69 6e 67 20 56  | defined.using V|
00000300  44 55 20 32 33 2e 20 54  68 65 20 66 69 72 73 74  |DU 23. The first|
00000310  20 62 79 74 65 20 6f 66  20 74 68 65 20 64 65 66  | byte of the def|
00000320  69 6e 69 74 69 6f 6e 20  64 65 66 69 6e 65 73 20  |inition defines |
00000330  74 68 65 20 74 6f 70 20  72 6f 77 20 6f 66 0d 65  |the top row of.e|
00000340  69 67 68 74 20 70 69 78  65 6c 73 3b 20 74 68 65  |ight pixels; the|
00000350  20 73 65 63 6f 6e 64 20  64 65 66 69 6e 65 73 20  | second defines |
00000360  74 68 65 20 73 65 63 6f  6e 64 20 72 6f 77 20 64  |the second row d|
00000370  6f 77 6e 2c 20 65 74 63  2e 20 54 68 75 73 20 74  |own, etc. Thus t|
00000380  68 65 20 65 6e 74 69 72  65 0d 63 68 61 72 61 63  |he entire.charac|
00000390  74 65 72 20 63 61 6e 20  62 65 20 64 65 66 69 6e  |ter can be defin|
000003a0  65 64 20 69 6e 20 65 69  67 68 74 20 62 79 74 65  |ed in eight byte|
000003b0  73 2c 20 61 6e 64 20 74  68 69 73 20 69 73 20 74  |s, and this is t|
000003c0  68 65 20 6e 75 6d 62 65  72 20 6f 66 20 62 79 74  |he number of byt|
000003d0  65 73 0d 6f 66 20 74 68  65 20 45 6c 6b 27 73 20  |es.of the Elk's |
000003e0  6d 65 6d 6f 72 79 20 77  68 69 63 68 20 69 73 20  |memory which is |
000003f0  75 73 65 64 20 62 79 20  65 61 63 68 20 63 68 61  |used by each cha|
00000400  72 61 63 74 65 72 27 73  20 64 65 66 69 6e 69 74  |racter's definit|
00000410  69 6f 6e 2e 20 4e 6f 74  65 20 2d 0d 74 68 65 20  |ion. Note -.the |
00000420  6d 6f 73 74 20 73 69 67  6e 69 66 69 63 61 6e 74  |most significant|
00000430  20 62 69 74 20 6f 66 20  65 61 63 68 20 62 79 74  | bit of each byt|
00000440  65 20 64 65 66 69 6e 65  73 20 74 68 65 20 6c 65  |e defines the le|
00000450  66 74 2d 6d 6f 73 74 20  70 69 78 65 6c 20 6f 66  |ft-most pixel of|
00000460  20 74 68 65 0d 72 6f 77  2c 20 61 6e 64 20 74 68  | the.row, and th|
00000470  65 20 6c 65 61 73 74 20  73 69 67 6e 69 66 69 63  |e least signific|
00000480  61 6e 74 20 62 69 74 20  64 65 66 69 6e 65 73 20  |ant bit defines |
00000490  74 68 65 20 72 69 67 68  74 2d 6d 6f 73 74 20 70  |the right-most p|
000004a0  69 78 65 6c 20 28 6a 75  73 74 20 61 73 0d 77 69  |ixel (just as.wi|
000004b0  74 68 20 56 44 55 20 32  33 20 64 65 66 69 6e 69  |th VDU 23 defini|
000004c0  74 69 6f 6e 73 29 2e 0d  0d 46 4f 55 52 20 43 4f  |tions)...FOUR CO|
000004d0  4c 4f 55 52 20 4d 4f 44  45 53 3a 0d 0d 54 68 69  |LOUR MODES:..Thi|
000004e0  73 20 74 69 6d 65 20 65  61 63 68 20 62 79 74 65  |s time each byte|
000004f0  20 63 61 6e 20 6f 6e 6c  79 20 68 6f 6c 64 20 66  | can only hold f|
00000500  6f 75 72 20 70 69 78 65  6c 73 2e 20 4f 6e 63 65  |our pixels. Once|
00000510  20 61 67 61 69 6e 2c 20  65 61 63 68 20 62 79 74  | again, each byt|
00000520  65 20 68 6f 6c 64 73 0d  61 20 6e 75 6d 62 65 72  |e holds.a number|
00000530  20 6f 66 20 70 69 78 65  6c 73 20 77 68 69 63 68  | of pixels which|
00000540  20 61 72 65 20 69 6e 20  61 20 68 6f 72 69 7a 6f  | are in a horizo|
00000550  6e 74 61 6c 20 6c 69 6e  65 2e 20 54 68 69 73 20  |ntal line. This |
00000560  74 69 6d 65 2c 20 61 73  20 62 65 66 6f 72 65 2c  |time, as before,|
00000570  0d 74 68 65 20 66 69 72  73 74 20 65 69 67 68 74  |.the first eight|
00000580  20 62 79 74 65 73 20 72  75 6e 20 64 6f 77 6e 20  | bytes run down |
00000590  69 6e 20 61 20 76 65 72  74 69 63 61 6c 20 6c 69  |in a vertical li|
000005a0  6e 65 2e 20 54 68 65 20  64 69 66 66 65 72 65 6e  |ne. The differen|
000005b0  63 65 20 74 68 69 73 0d  74 69 6d 65 2c 20 74 68  |ce this.time, th|
000005c0  6f 75 67 68 2c 20 69 73  20 74 68 61 74 20 6e 6f  |ough, is that no|
000005d0  74 20 61 6c 6c 20 6f 66  20 74 68 65 20 70 69 78  |t all of the pix|
000005e0  65 6c 73 20 69 6e 20 74  68 65 20 63 68 61 72 61  |els in the chara|
000005f0  63 74 65 72 20 61 72 65  20 62 65 69 6e 67 0d 64  |cter are being.d|
00000600  65 66 69 6e 65 64 20 62  79 20 74 68 65 20 6f 6e  |efined by the on|
00000610  65 20 73 77 65 65 70 2c  20 61 6e 64 20 69 6e 73  |e sweep, and ins|
00000620  74 65 61 64 20 6f 6e 6c  79 20 74 68 65 20 6c 65  |tead only the le|
00000630  66 74 2d 6d 6f 73 74 20  66 6f 75 72 20 70 69 78  |ft-most four pix|
00000640  65 6c 73 20 63 61 6e 0d  62 65 20 64 65 66 69 6e  |els can.be defin|
00000650  65 64 2e 20 54 68 65 20  72 69 67 68 74 2d 6d 6f  |ed. The right-mo|
00000660  73 74 20 66 6f 75 72 20  70 69 78 65 6c 73 20 61  |st four pixels a|
00000670  72 65 20 64 65 66 69 6e  65 64 20 69 6e 20 61 20  |re defined in a |
00000680  73 65 63 6f 6e 64 20 64  6f 77 6e 77 61 72 64 0d  |second downward.|
00000690  76 65 72 74 69 63 61 6c  20 73 77 65 65 70 2e 20  |vertical sweep. |
000006a0  54 68 75 73 20 74 68 65  20 74 6f 74 61 6c 20 6d  |Thus the total m|
000006b0  65 6d 6f 72 79 20 61 6c  6c 6f 63 61 74 69 6f 6e  |emory allocation|
000006c0  20 66 6f 72 20 74 68 65  20 64 65 66 69 6e 69 74  | for the definit|
000006d0  69 6f 6e 20 6f 66 0d 65  61 63 68 20 63 68 61 72  |ion of.each char|
000006e0  61 63 74 65 72 20 69 73  20 73 69 78 74 65 65 6e  |acter is sixteen|
000006f0  20 62 79 74 65 73 2e 20  54 68 65 20 6c 61 79 6f  | bytes. The layo|
00000700  75 74 20 6f 66 20 74 68  65 73 65 20 69 73 20 73  |ut of these is s|
00000710  68 6f 77 6e 20 6d 6f 72  65 20 63 6c 65 61 72 6c  |hown more clearl|
00000720  79 0d 62 79 20 74 68 65  20 64 69 61 67 72 61 6d  |y.by the diagram|
00000730  20 62 65 6c 6f 77 2e 20  54 68 69 73 20 73 68 6f  | below. This sho|
00000740  77 73 20 74 68 65 20 65  69 67 68 74 2d 62 79 2d  |ws the eight-by-|
00000750  65 69 67 68 74 20 62 6c  6f 63 6b 20 6f 66 20 70  |eight block of p|
00000760  69 78 65 6c 73 20 69 6e  20 61 0d 63 68 61 72 61  |ixels in a.chara|
00000770  63 74 65 72 2c 20 61 6e  64 20 65 61 63 68 20 68  |cter, and each h|
00000780  61 73 20 74 68 65 20 6f  66 66 73 65 74 20 6f 66  |as the offset of|
00000790  20 74 68 65 20 6d 65 6d  6f 72 79 20 6c 6f 63 61  | the memory loca|
000007a0  74 69 6f 6e 20 77 68 65  72 65 20 74 68 69 73 20  |tion where this |
000007b0  70 69 78 65 6c 0d 69 73  20 73 74 6f 72 65 64 20  |pixel.is stored |
000007c0  66 72 6f 6d 20 74 68 65  20 73 74 61 72 74 20 6f  |from the start o|
000007d0  66 20 74 68 65 20 63 68  61 72 61 63 74 65 72 20  |f the character |
000007e0  64 65 66 69 6e 69 74 69  6f 6e 2e 20 4f 66 66 73  |definition. Offs|
000007f0  65 74 73 20 61 72 65 20  67 69 76 65 6e 20 69 6e  |ets are given in|
00000800  0d 68 65 78 61 64 65 63  69 6d 61 6c 3a 0d 0d 50  |.hexadecimal:..P|
00000810  49 58 45 4c 2d 42 59 2d  50 49 58 45 4c 20 4c 41  |IXEL-BY-PIXEL LA|
00000820  59 4f 55 54 20 20 20 20  20 4d 45 4d 4f 52 59 20  |YOUT     MEMORY |
00000830  46 4c 4f 57 0d 0d 30 30  30 30 38 38 38 38 20 20  |FLOW..00008888  |
00000840  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000850  20 20 30 20 20 20 20 20  20 38 0d 31 31 31 31 39  |  0      8.11119|
00000860  39 39 39 20 20 20 20 20  20 20 20 20 20 20 20 20  |999             |
00000870  20 20 20 20 20 20 20 7c  20 20 20 20 20 20 7c 0d  |       |      |.|
00000880  32 32 32 32 41 41 41 41  20 20 20 20 20 20 20 20  |2222AAAA        |
00000890  20 20 20 20 20 20 20 20  20 20 20 20 7c 20 20 20  |            |   |
000008a0  20 20 20 7c 0d 33 33 33  33 42 42 42 42 20 20 20  |   |.3333BBBB   |
000008b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
000008c0  20 7c 20 20 20 20 20 20  7c 0d 34 34 34 34 43 43  | |      |.4444CC|
000008d0  43 43 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |CC              |
000008e0  20 20 20 20 20 20 7c 20  20 20 20 20 20 7c 0d 35  |      |      |.5|
000008f0  35 35 35 44 44 44 44 20  20 20 20 20 20 20 20 20  |555DDDD         |
00000900  20 20 20 20 20 20 20 20  20 20 20 7c 20 20 20 20  |           |    |
00000910  20 20 7c 0d 36 36 36 36  45 45 45 45 20 20 20 20  |  |.6666EEEE    |
00000920  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 5c  |               \|
00000930  20 2f 20 20 20 20 5c 20  2f 0d 37 37 37 37 46 46  | /    \ /.7777FF|
00000940  46 46 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |FF              |
00000950  20 20 20 20 20 20 37 20  20 20 20 20 20 46 0d 0d  |      7      F..|
00000960  45 61 63 68 20 6f 66 20  74 68 65 73 65 20 73 69  |Each of these si|
00000970  78 74 65 65 6e 20 62 79  74 65 73 2c 20 61 73 20  |xteen bytes, as |
00000980  61 6c 72 65 61 64 79 20  64 69 73 63 75 73 73 65  |already discusse|
00000990  64 2c 20 63 6f 6e 74 61  69 6e 73 20 66 6f 75 72  |d, contains four|
000009a0  20 70 69 78 65 6c 0d 64  65 66 69 6e 69 74 69 6f  | pixel.definitio|
000009b0  6e 73 2e 20 42 75 74 20  77 69 74 68 69 6e 20 65  |ns. But within e|
000009c0  61 63 68 20 62 79 74 65  27 73 20 65 69 67 68 74  |ach byte's eight|
000009d0  20 62 69 74 73 2c 20 74  68 65 79 20 61 72 65 20  | bits, they are |
000009e0  6e 6f 74 20 6c 61 69 64  20 6f 75 74 20 61 73 0d  |not laid out as.|
000009f0  79 6f 75 20 6d 69 67 68  74 20 61 74 20 66 69 72  |you might at fir|
00000a00  73 74 20 69 6d 61 67 69  6e 65 2e 20 49 66 20 77  |st imagine. If w|
00000a10  65 20 63 61 6c 6c 20 74  68 65 20 66 6f 75 72 20  |e call the four |
00000a20  70 69 78 65 6c 73 20 41  2c 20 42 2c 20 43 20 61  |pixels A, B, C a|
00000a30  6e 64 20 44 20 28 41 20  69 73 0d 74 68 65 20 6c  |nd D (A is.the l|
00000a40  65 66 74 2d 6d 6f 73 74  2c 20 44 20 69 73 20 74  |eft-most, D is t|
00000a50  68 65 20 72 69 67 68 74  2d 6d 6f 73 74 29 2c 20  |he right-most), |
00000a60  74 68 65 20 6c 61 79 6f  75 74 20 69 73 3a 0d 0d  |the layout is:..|
00000a70  5b 4d 4f 53 54 20 53 49  47 4e 49 46 49 43 41 4e  |[MOST SIGNIFICAN|
00000a80  54 5d 20 20 41 31 20 42  31 20 43 31 20 44 31 20  |T]  A1 B1 C1 D1 |
00000a90  41 30 20 42 30 20 43 30  20 44 30 20 20 5b 4c 45  |A0 B0 C0 D0  [LE|
00000aa0  41 53 54 20 53 49 47 4e  49 46 49 43 41 4e 54 5d  |AST SIGNIFICANT]|
00000ab0  0d 0d 57 68 65 72 65 3a  20 41 31 3a 20 4d 6f 73  |..Where: A1: Mos|
00000ac0  74 20 73 69 67 6e 69 66  69 63 61 6e 74 20 62 69  |t significant bi|
00000ad0  74 20 6f 66 20 41 27 73  20 64 65 66 69 6e 69 74  |t of A's definit|
00000ae0  69 6f 6e 20 20 7d 20 54  77 6f 20 62 69 74 20 64  |ion  } Two bit d|
00000af0  65 66 69 6e 69 74 69 6f  6e 0d 20 20 20 20 20 20  |efinition.      |
00000b00  20 41 30 3a 20 4c 65 61  73 74 20 73 69 67 6e 69  | A0: Least signi|
00000b10  66 69 63 61 6e 74 20 62  69 74 20 6f 66 20 41 27  |ficant bit of A'|
00000b20  73 20 64 65 66 69 6e 69  74 69 6f 6e 20 7d 20 20  |s definition }  |
00000b30  6f 66 20 70 69 78 65 6c  20 41 0d 0d 41 20 73 69  |of pixel A..A si|
00000b40  6d 69 61 6c 61 72 20 70  61 74 74 65 72 6e 20 68  |mialar pattern h|
00000b50  6f 6c 64 73 20 66 6f 72  20 42 2c 20 43 20 61 6e  |olds for B, C an|
00000b60  64 20 44 2e 0d 0d 45 58  41 4d 50 4c 45 3a 0d 0d  |d D...EXAMPLE:..|
00000b70  4c 65 74 27 73 20 73 75  70 70 6f 73 65 20 77 65  |Let's suppose we|
00000b80  20 77 61 6e 74 20 74 6f  20 73 65 74 20 74 68 65  | want to set the|
00000b90  20 63 6f 6c 6f 75 72 20  6f 66 20 74 68 65 20 6c  | colour of the l|
00000ba0  65 66 74 2d 6d 6f 73 74  20 70 69 78 65 6c 20 69  |eft-most pixel i|
00000bb0  6e 20 61 20 62 79 74 65  0d 6f 66 20 61 20 66 6f  |n a byte.of a fo|
00000bc0  75 72 2d 63 6f 6c 6f 75  72 20 6d 6f 64 65 20 74  |ur-colour mode t|
00000bd0  6f 20 62 65 20 63 6f 6c  6f 75 72 20 33 2e 20 57  |o be colour 3. W|
00000be0  65 20 77 6f 75 6c 64 20  75 73 65 3a 0d 0d 3f 61  |e would use:..?a|
00000bf0  64 64 72 65 73 73 3d 28  3f 61 64 64 72 65 73 73  |ddress=(?address|
00000c00  20 41 4e 44 20 26 37 37  29 20 4f 52 20 26 38 38  | AND &77) OR &88|
00000c10  0d 0d 45 78 70 6c 61 6e  61 74 69 6f 6e 20 2d 20  |..Explanation - |
00000c20  54 68 65 20 28 3f 61 64  64 72 65 73 73 20 41 4e  |The (?address AN|
00000c30  44 20 26 37 37 29 20 70  61 72 74 20 63 6c 65 61  |D &77) part clea|
00000c40  72 73 20 74 68 65 20 74  77 6f 20 62 69 74 73 20  |rs the two bits |
00000c50  64 65 66 69 6e 69 6e 67  20 74 68 65 0d 70 69 78  |defining the.pix|
00000c60  65 6c 20 74 68 61 74 20  77 65 20 77 61 6e 74 20  |el that we want |
00000c70  74 6f 20 63 68 61 6e 67  65 2e 20 54 68 65 20 4f  |to change. The O|
00000c80  52 20 26 38 38 20 74 68  65 6e 20 73 65 74 73 20  |R &88 then sets |
00000c90  74 68 65 20 74 77 6f 20  62 69 74 73 20 74 68 61  |the two bits tha|
00000ca0  74 20 77 65 0d 77 61 6e  74 20 74 6f 20 73 65 74  |t we.want to set|
00000cb0  2e 20 54 68 69 73 20 77  61 79 20 77 65 20 65 6e  |. This way we en|
00000cc0  73 75 72 65 20 74 68 61  74 20 77 68 65 6e 20 77  |sure that when w|
00000cd0  65 20 61 72 65 20 67 6f  69 6e 67 20 73 61 79 20  |e are going say |
00000ce0  66 72 6f 6d 20 63 6f 6c  6f 75 72 20 31 0d 74 6f  |from colour 1.to|
00000cf0  20 63 6f 6c 6f 75 72 20  32 2c 20 74 68 65 20 6c  | colour 2, the l|
00000d00  65 61 73 74 20 73 69 67  6e 69 66 69 63 61 6e 74  |east significant|
00000d10  20 62 69 74 20 6f 66 20  74 68 65 20 64 65 66 69  | bit of the defi|
00000d20  6e 69 74 69 6f 6e 20 69  73 20 63 6c 65 61 72 65  |nition is cleare|
00000d30  64 20 61 73 0d 77 65 6c  6c 20 61 73 20 74 68 65  |d as.well as the|
00000d40  20 6d 6f 73 74 20 73 69  67 6e 69 66 69 63 61 6e  | most significan|
00000d50  74 20 62 69 74 20 62 65  69 6e 67 20 73 65 74 2e  |t bit being set.|
00000d60  0d 0d 49 74 20 69 73 20  69 6d 70 6f 72 74 61 6e  |..It is importan|
00000d70  74 20 74 6f 20 6e 6f 74  69 63 65 20 74 68 61 20  |t to notice tha |
00000d80  70 61 74 74 65 72 6e 20  69 6e 20 74 68 65 73 65  |pattern in these|
00000d90  20 62 69 74 73 20 2d 20  65 61 63 68 20 70 69 78  | bits - each pix|
00000da0  65 6c 20 72 65 71 75 69  72 65 73 0d 61 20 74 77  |el requires.a tw|
00000db0  6f 20 62 69 74 20 64 65  66 69 6e 69 74 69 6f 6e  |o bit definition|
00000dc0  2c 20 62 75 74 20 74 68  65 73 65 20 74 77 6f 20  |, but these two |
00000dd0  62 69 74 73 20 61 72 65  20 6e 6f 74 20 6e 65 78  |bits are not nex|
00000de0  74 20 74 6f 20 65 61 63  68 20 6f 74 68 65 72 20  |t to each other |
00000df0  69 6e 20 74 68 65 0d 62  79 74 65 20 61 73 20 6f  |in the.byte as o|
00000e00  6e 65 20 6d 69 67 68 74  20 65 78 70 65 63 74 20  |ne might expect |
00000e10  2d 20 69 6e 73 74 65 61  64 20 61 6c 6c 20 6f 66  |- instead all of|
00000e20  20 74 68 65 20 68 69 67  68 2d 62 79 74 65 73 20  | the high-bytes |
00000e30  61 72 65 20 73 74 6f 72  65 64 0d 74 6f 67 65 74  |are stored.toget|
00000e40  68 65 72 2c 20 61 6e 64  20 61 6c 6c 20 6f 66 20  |her, and all of |
00000e50  74 68 65 20 6c 6f 77 2d  62 79 74 65 73 20 61 72  |the low-bytes ar|
00000e60  65 20 73 74 6f 72 65 64  20 74 6f 67 65 74 68 65  |e stored togethe|
00000e70  72 2e 0d 0d 53 49 58 54  45 45 4e 20 43 4f 4c 4f  |r...SIXTEEN COLO|
00000e80  55 52 20 4d 4f 44 45 53  0d 0d 54 68 65 20 70 61  |UR MODES..The pa|
00000e90  74 74 65 72 6e 20 66 6f  72 20 73 69 78 74 65 65  |ttern for sixtee|
00000ea0  6e 20 63 6f 6c 6f 75 72  20 6d 6f 64 65 73 20 69  |n colour modes i|
00000eb0  73 20 76 65 72 79 20 73  69 6d 69 61 6c 72 20 74  |s very simialr t|
00000ec0  6f 20 74 68 61 74 20 66  6f 75 6e 64 20 69 6e 20  |o that found in |
00000ed0  66 6f 75 72 0d 63 6f 6c  6f 75 72 20 6d 6f 64 65  |four.colour mode|
00000ee0  73 2c 20 65 78 63 65 70  74 20 74 68 61 74 20 65  |s, except that e|
00000ef0  61 63 68 20 62 79 74 65  20 63 61 6e 20 6f 6e 6c  |ach byte can onl|
00000f00  79 20 73 74 6f 72 65 20  74 77 6f 20 70 69 78 65  |y store two pixe|
00000f10  6c 73 20 28 65 61 63 68  0d 6f 63 63 75 70 69 65  |ls (each.occupie|
00000f20  73 20 66 6f 75 72 20 62  69 74 65 73 29 2e 20 41  |s four bites). A|
00000f30  73 20 77 69 74 68 20 70  72 65 76 69 6f 75 73 20  |s with previous |
00000f40  63 61 73 65 73 2c 20 74  68 65 20 70 69 78 65 6c  |cases, the pixel|
00000f50  73 20 61 72 65 20 73 74  6f 72 65 64 20 69 6e 20  |s are stored in |
00000f60  61 0d 6e 75 6d 62 65 72  20 6f 66 20 76 65 72 74  |a.number of vert|
00000f70  69 63 61 6c 20 73 77 65  65 70 73 20 73 74 61 72  |ical sweeps star|
00000f80  74 69 6e 67 20 61 74 20  74 68 65 20 6c 65 66 74  |ting at the left|
00000f90  20 6f 66 20 74 68 65 20  63 68 61 72 61 63 74 65  | of the characte|
00000fa0  72 2c 20 61 6e 64 0d 6d  6f 76 69 6e 67 20 72 69  |r, and.moving ri|
00000fb0  67 68 74 2e 20 54 68 69  73 20 74 69 6d 65 20 66  |ght. This time f|
00000fc0  6f 75 72 20 76 65 72 74  69 63 61 6c 20 73 77 65  |our vertical swe|
00000fd0  65 70 73 20 61 72 65 20  72 65 71 75 69 72 65 64  |eps are required|
00000fe0  20 74 6f 20 63 6f 76 65  72 20 61 6c 6c 20 6f 66  | to cover all of|
00000ff0  0d 74 68 65 20 63 68 61  72 61 63 74 65 72 20 28  |.the character (|
00001000  74 68 65 72 65 20 61 72  65 20 65 69 67 68 74 20  |there are eight |
00001010  70 69 78 65 6c 73 20 61  63 72 6f 73 73 2c 20 61  |pixels across, a|
00001020  6e 64 20 65 61 63 68 20  73 77 65 65 70 20 63 6f  |nd each sweep co|
00001030  76 65 72 73 20 74 77 6f  20 6f 66 0d 74 68 65 6d  |vers two of.them|
00001040  29 2e 20 54 68 65 20 6c  61 79 6f 75 74 20 69 73  |). The layout is|
00001050  20 73 68 6f 77 6e 20 62  65 6c 6f 77 3a 0d 0d 50  | shown below:..P|
00001060  49 58 45 4c 2d 42 59 2d  50 49 58 45 4c 20 4c 41  |IXEL-BY-PIXEL LA|
00001070  59 4f 55 54 20 20 20 4d  45 4d 4f 52 59 20 46 4c  |YOUT   MEMORY FL|
00001080  4f 57 0d 0d 30 30 38 38  30 30 38 38 20 20 20 20  |OW..00880088    |
00001090  20 20 20 20 20 20 20 20  20 20 20 20 20 30 20 20  |             0  |
000010a0  20 20 20 38 20 20 20 20  31 30 20 20 20 20 31 38  |   8    10    18|
000010b0  0d 31 31 39 39 31 31 39  39 20 20 20 20 20 20 20  |.11991199       |
000010c0  20 20 20 20 20 20 20 20  20 20 7c 20 20 20 20 20  |          |     |
000010d0  7c 20 20 20 20 20 7c 20  20 20 20 20 7c 0d 32 32  ||     |     |.22|
000010e0  41 41 32 32 41 41 20 20  20 20 20 20 20 20 20 20  |AA22AA          |
000010f0  20 20 20 20 20 20 20 7c  20 20 20 20 20 7c 20 20  |       |     |  |
00001100  20 20 20 7c 20 20 20 20  20 7c 0d 33 33 42 42 33  |   |     |.33BB3|
00001110  33 42 42 20 20 20 20 20  20 20 20 20 20 20 20 20  |3BB             |
00001120  20 20 20 20 7c 20 20 20  20 20 7c 20 20 20 20 20  |    |     |     |
00001130  7c 20 20 20 20 20 7c 0d  34 34 43 43 34 34 43 43  ||     |.44CC44CC|
00001140  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00001150  20 7c 20 20 20 20 20 7c  20 20 20 20 20 7c 20 20  | |     |     |  |
00001160  20 20 20 7c 0d 35 35 44  44 35 35 44 44 20 20 20  |   |.55DD55DD   |
00001170  20 20 20 20 20 20 20 20  20 20 20 20 20 20 7c 20  |              | |
00001180  20 20 20 20 7c 20 20 20  20 20 7c 20 20 20 20 20  |    |     |     |
00001190  7c 0d 36 36 45 45 36 36  45 45 20 20 20 20 20 20  ||.66EE66EE      |
000011a0  20 20 20 20 20 20 20 20  20 20 5c 20 2f 20 20 20  |          \ /   |
000011b0  5c 20 2f 20 20 20 5c 20  2f 20 20 20 5c 20 2f 0d  |\ /   \ /   \ /.|
000011c0  37 37 46 46 37 37 46 46  20 20 20 20 20 20 20 20  |77FF77FF        |
000011d0  20 20 20 20 20 20 20 20  20 37 20 20 20 20 20 46  |         7     F|
000011e0  20 20 20 20 31 37 20 20  20 20 31 46 0d 20 20 20  |    17    1F.   |
000011f0  20 2a 2a 2a 2a 0d 0d 4e  42 3a 20 4f 66 66 73 65  | ****..NB: Offse|
00001200  74 73 20 67 69 76 65 6e  20 69 6e 20 68 65 78 61  |ts given in hexa|
00001210  64 65 63 69 6e 61 6c 2e  20 56 61 6c 75 65 73 20  |decinal. Values |
00001220  69 6e 20 74 68 65 20 72  69 67 68 74 20 68 61 6c  |in the right hal|
00001230  66 20 6f 66 20 74 68 65  20 61 62 6f 76 65 0d 64  |f of the above.d|
00001240  69 61 67 72 61 6d 20 28  69 65 2e 20 74 68 65 20  |iagram (ie. the |
00001250  72 69 67 68 74 20 66 6f  75 72 20 70 69 78 65 6c  |right four pixel|
00001260  73 2c 20 77 68 69 63 68  20 68 61 76 65 20 2a 20  |s, which have * |
00001270  75 6e 64 65 72 6e 65 61  74 68 29 20 73 68 6f 75  |underneath) shou|
00001280  6c 64 20 68 61 76 65 0d  26 31 30 20 61 64 64 65  |ld have.&10 adde|
00001290  64 20 74 6f 20 74 68 65  6d 20 2d 20 6f 6e 6c 79  |d to them - only|
000012a0  20 74 68 65 20 6c 65 61  73 74 20 73 69 67 6e 69  | the least signi|
000012b0  66 69 63 61 6e 74 20 63  68 61 72 61 63 74 65 72  |ficant character|
000012c0  20 6f 66 20 65 61 63 68  0d 68 65 78 61 64 65 63  | of each.hexadec|
000012d0  69 6d 61 6c 20 76 61 6c  75 65 20 69 73 20 67 69  |imal value is gi|
000012e0  76 65 6e 2e 20 49 20 61  6d 20 73 75 72 65 20 79  |ven. I am sure y|
000012f0  6f 75 20 63 61 6e 20 73  65 65 20 6d 79 20 70 72  |ou can see my pr|
00001300  6f 62 6c 65 6d 20 2d 20  74 68 65 0d 68 65 78 61  |oblem - the.hexa|
00001310  64 65 63 69 6d 61 6c 20  76 61 6c 75 65 73 20 61  |decimal values a|
00001320  72 65 20 74 77 6f 20 64  69 67 69 74 73 20 6c 6f  |re two digits lo|
00001330  6e 67 2c 20 61 6e 64 20  49 27 76 65 20 6f 6e 6c  |ng, and I've onl|
00001340  79 20 67 6f 74 20 6f 6e  65 20 63 68 61 72 61 63  |y got one charac|
00001350  74 65 72 20 69 6e 0d 77  68 69 63 68 20 74 6f 20  |ter in.which to |
00001360  70 75 74 20 74 68 65 6d  21 0d 0d 54 68 65 20 70  |put them!..The p|
00001370  61 74 74 65 72 6e 20 6f  66 20 74 68 65 20 6c 61  |attern of the la|
00001380  79 6f 75 74 20 6f 66 20  74 68 65 20 70 69 78 65  |yout of the pixe|
00001390  6c 20 64 61 74 61 20 69  6e 20 65 61 63 68 20 6f  |l data in each o|
000013a0  66 20 74 68 65 20 62 79  74 65 73 20 69 73 20 61  |f the bytes is a|
000013b0  6c 73 6f 0d 73 69 6d 69  6c 61 72 20 74 6f 20 74  |lso.similar to t|
000013c0  68 61 74 20 66 6f 72 20  74 68 65 20 66 6f 75 72  |hat for the four|
000013d0  20 63 6f 6c 6f 75 72 20  6d 6f 64 65 73 20 28 74  | colour modes (t|
000013e0  68 65 20 74 77 6f 20 70  69 78 65 6c 73 20 61 72  |he two pixels ar|
000013f0  65 20 41 20 61 6e 64 20  42 2c 20 61 6e 64 0d 65  |e A and B, and.e|
00001400  61 63 68 20 63 6f 6d 70  72 69 73 65 73 20 6f 66  |ach comprises of|
00001410  20 66 6f 75 72 20 62 69  74 73 20 30 2d 33 2c 20  | four bits 0-3, |
00001420  77 68 65 72 65 20 30 20  69 73 20 6c 65 61 73 74  |where 0 is least|
00001430  20 73 69 67 6e 69 66 69  63 61 6e 74 20 61 6e 64  | significant and|
00001440  20 33 20 69 73 0d 6d 6f  73 74 20 73 69 67 6e 69  | 3 is.most signi|
00001450  66 69 63 61 6e 74 29 2e  0d 0d 5b 4d 4f 53 54 20  |ficant)...[MOST |
00001460  53 49 47 4e 49 46 49 43  41 4e 54 5d 20 20 41 33  |SIGNIFICANT]  A3|
00001470  20 42 33 20 41 32 20 42  32 20 41 31 20 42 31 20  | B3 A2 B2 A1 B1 |
00001480  41 30 20 42 30 20 20 5b  4c 45 41 53 54 20 53 49  |A0 B0  [LEAST SI|
00001490  47 4e 49 46 49 43 41 4e  54 5d 0d 0d 4e 6f 74 69  |GNIFICANT]..Noti|
000014a0  63 65 20 6f 6e 63 65 20  61 67 61 69 6e 20 74 68  |ce once again th|
000014b0  61 74 20 62 69 74 73 20  64 65 66 69 6e 69 6e 67  |at bits defining|
000014c0  20 74 68 65 20 70 69 78  65 6c 73 20 41 20 61 6e  | the pixels A an|
000014d0  64 20 42 20 61 72 65 20  6e 6f 74 20 73 74 6f 72  |d B are not stor|
000014e0  65 64 0d 74 6f 67 65 74  68 65 72 2c 20 62 75 74  |ed.together, but|
000014f0  20 74 68 6f 73 65 20 64  65 66 69 6e 69 6e 67 20  | those defining |
00001500  74 68 65 20 6c 65 61 73  74 2f 6d 6f 73 74 20 73  |the least/most s|
00001510  69 67 6e 69 66 69 63 61  6e 74 20 62 69 74 73 20  |ignificant bits |
00001520  61 72 65 20 73 74 6f 72  65 64 0d 74 6f 67 65 74  |are stored.toget|
00001530  68 65 72 2e 0d 0d 4d 4f  52 45 20 4f 4e 20 54 48  |her...MORE ON TH|
00001540  45 20 53 55 42 4a 45 43  54 20 4f 4e 20 53 43 52  |E SUBJECT ON SCR|
00001550  45 45 4e 20 4d 45 4d 4f  52 59 20 49 4e 20 4e 45  |EEN MEMORY IN NE|
00001560  58 54 20 45 55 47 2e 2e  2e 0d                    |XT EUG....|
0000156a