Tricks with HAM images

Back in 1985 when the Amiga was first released, the HAM (Hold And Modify) screenmode was revolutionary. It allowed 4096 colours to be displayed simultaneously, meaning near true-colour images could be displayed while only using the amount of memory that a normal 64-colour screen would use.

HAM does have its disadvantages, though – while a regular bitplane image can be faded out very easily by simply fading the palette, this trick doesn’t work for HAM images.

Fading out a HAM image can be done, however, using the Blitter.

This AMOSPro program uses some “evil” trickery to fade a HAM image to black, using the Screen Copy command with blitter modes, peeks and pokes to shuffle bitplanes around between screens, and what amounts to a ShadeBOB routine over the entire screen.

Step by step, the theory of operation is something like this:

  • Logical OR the two control planes together to make a mask plane.  This mask plane is “0” wherever pixels use the base palette, and “1” wherever a direct R, G or B level is being specified.
  • Use the mask plane to perform binary subtraction on the four data planes, using another spare plane to hold carry data.
  • Check for overflow, and zero the image wherever overflow has occurred.

This is done simultaneously with fading out the palette, and the end result is quite a nice fade-out of a HAM image.

Download: Compiled HAM fading slideshow, including AMOSPro source code

Leave a Reply

Your email address will not be published. Required fields are marked *