AmigaExamples/007.masked_blit
alpine9000 ffc5f1f93d Got build working on newer OSX, included missing ADFs 2019-06-11 13:58:03 +10:00
..
bin Got build working on newer OSX, included missing ADFs 2019-06-11 13:58:03 +10:00
Makefile Used better test image 2016-03-14 13:31:29 +11:00
README.md Update README.md 2016-03-09 14:56:05 +11:00
masked_blit.s A few incorrect dbra counters 2016-03-25 19:49:36 +11:00
screenshot.png Used better test image 2016-03-14 13:31:29 +11:00

README.md

perform a masked blit

Extending 006.simple_blit, we now add a mask to the blit.

Using the "cookie-cut" blitter logic funtion we set up the blitter to use all four DMA channels.

From the hardware manual:

To draw the car, we might use the A DMA channel to fetch the car mask, the B DMA channel to fetch the actual car data, the C DMA channel to fetch the background, and the D DMA channel to write out the new image.

A = mask
B = blitter object (sprite)
C = background
D = destination (background)

Now we calculate the logic function minterm:

blitter logic function minterm truth table

We fill in the desired logic values in the D column. In this case D is set if:

  • The mask bit is set and the bob bit is set
  • The mask bit is not set and the background bit is set
A(mask) B(bob) C(bg) D(dest)
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1

Then we read D column from bottom up to give us the logic function minterm:

11001010 = $ca

This is then ready to be used in the LF1-7 bits of the BLTCON0 register setup.

imagecon generates the interleaved mask bitplanes for the A channel.

We then blit the sprite to the background and notice it now has a shape!

screenshot

Screenshot

try it