CODING THE BIT-PLANES FOR CORRECT COLORING After you have specified the number of bit-planes and set the bit-plane pointers, you can actually write the color register codes into the bit-planes. A ONE-OR TWO-COLOR PLAYFIELD For a one-color playfield, all you need do is write "0"s in all the bits of the single bit-plane as shown in the example below. This code fills a low-resolution bit-plane with the background color (COLOR00) by writing all "0"s into its memory area. The bit-plane starts at $21000 and is 8,000 bytes long. LEA $21000,a0 ; Point at bit-plane MOVE.W #2000,d0 ; Write 2000 longwords = 8000 bytes LOOP:
MOVE.L #0,(a0)+ ; Write out a zero DBRA d0,LOOP ; Decrement counter and loop until done For a two-color playfield, you define a bit-plane that has "0"s where you want the background color and "1"s where you want the color in register 1. The following example code is identical to the last example, except the bit-plane is filled with $FF00FF00 instead of all 0's. This will produce two colors. LEA $21000,a0 ; Point at bit-plane MOVE.W #2000,d0 ; Write 2000 longwords = 8000 bytes LOOP: MOVE.L #$FF00FF00,(a0)+ ; Write out $FF00FF00 DBRA d0,LOOP ; Decrement counter & loop until done A PLAYFIELD OF THREE OR MORE COLORS For three or more colors, you need more than one bit-plane.
The task here is to define each bit-plane in such a way that when they are combined for display, each pixel contains the correct combination of bits. This is a little more complicated than a playfield of one bit-plane. The following examples show a four-color playfield, but the basic idea and procedures are the same for playfields containing up to 32 colors. Figure 3-8 shows two bit-planes forming a four-color playfield: - Playfield Hardware 49 -