Hold-and-Modify
From Wikipedia, the free encyclopedia
Hold-and-Modify (more commonly known as HAM) is a screenmode of the Commodore Amiga computer. It allows all 4,096 colors of the Amiga's color palette to be displayed at once, using only 6 bits per pixel, even though 12 bits per pixel would normally be needed.
HAM can be interpreted as a lossy compression technique, where 12 bit color information is stored in 6 bits of RAM (with reduced quality) and is decompressed through hardware in realtime while the graphics buffer is scanned and displayed.
HAM operates on horizontally sequential pixels on the same display line. The previous pixel's red, green and blue color components are examined. Two of the components are held, one component is modified. Alternatively, all three components can be changed at once, but the color selection is limited to one of 16 colors from the indexed color palette.
The original HAM mode is part of the Original Amiga chipset, available in the first Amigas. With the release of Amigas based on the Advanced Graphics Architecture chipset, HAM was upgraded. The original HAM was renamed "HAM6", and the new "HAM8" mode could display up to 262,144 colors on-screen from a palette of 16,777,216.
Contents |
[edit] HAM6 operation
The Original Amiga chipset and Enhanced Chip Set support 16 distinct levels of red, green and blue color components, giving a grand total of 4,096 possible colors (16 * 16 * 16 = 4096). Each of the 3 components require 4 bits to store them (16 = 24), so 12 bits are needed to store an entire color.
However, the original and enhanced chipsets only support up to 6 bits per pixel planar screen modes, so normally only 32 colors from a color palette could be used. Each entry in the palette could be set to one of the full range of 4096 colors. When drawing the screen itself, 5 bits per pixel would give an index into the color palette.
Another Amiga-specific screenmode, Extra Half-Brite, allowed 5 bits per pixel for an index into the 32 color palette and one extra bit to say if the color should be at full or half luminosity. However, this still only allows for 64 colors.
HAM allowed all 4,096 of the Amiga's colors to be displayed. It did so by using 6 bits per pixel; 2 bits were used as decision-making "control" bits, and 4 bits were used as "data" bits. The resulting color for a pixel would be the result of following the instruction of the control bits. The 2 control bits allow for four possibilities, which were as follows:
- Set: Use the 4 bits of data as an index into the first 16 colors in the color palette. Use that color for this pixel.
- Modify Red: Maintain the green and blue color components of the previous pixel. Use the 4 bits of data as the new red color component of this pixel.
- Modify Green: Maintain the red and blue color components of the previous pixel. Use the 4 bits of data as the new green color component of this pixel.
- Modify Blue: Maintain the red and green color components of the previous pixel. Use the 4 bits of data as the new blue color component of this pixel.
[edit] HAM8 operation
With the Advanced Graphics Architecture, the Amiga's graphics quality was improved. Instead of 4 bits per color component, the Amiga now had 8 bits per color component, which offered 16,777,216 possible colors. The 6 bits per pixel was raised to 8 bits per pixel, allowing for a 256 color palette in normal operation.
HAM8 worked in the same way as HAM6, using 2 "control" bits per pixel, but now there were 6 bits of "data" per pixel instead of 4. The set operation could now select from a palette of 64 colors instead of 16. The modify operation could modify the 6 most significant bits of either the red, green or blue color component - the 2 least significant bits of the color could not be altered by this operation.
[edit] Advantages and disadvantages
When the Amiga was launched in 1985, HAM mode gave it a graphical advantage over competing systems, because it allowed the system to display digitized photographs and some rendered 3D images at a level claimed to be "photorealistic" at the time.
HAM is still only an approximation of truecolor. It can take up to three pixels to change from one color to another, so representing a sharp change in color, such as when digitizing and displaying a photograph, can lead to noticeable multi-hued "fringes" appearing.
Furthermore, the HAM screenmode is difficult to use in games or any other application where the contents of the screen need to be modified. If a "set" pixel is scrolled horizontally off the left hand side of the display, it is no longer drawn; any subsequent "modify" pixels no longer have a base color to modify and start to show the wrong color. This effect makes it difficult to scroll the screen without showing this artifact. The same happens if a "set" pixel is drawn in the middle of a sequence of "modify" pixels, so drawing blitter objects on the screen is very difficult to do without messing up the display.
[edit] Implementation of HAM
HAM was only originally put into the Amiga's custom chipset as an experiment. To quote Jay Miner:
“ | Hold and Modify came from a trip to see flight simulators in action and I had a kind of idea about a primitive type of virtual reality. NTSC on the chip meant you could hold the hue and change the luminance by only altering four bits. When we changed to RGB I said that wasn't needed any more as it wasn't useful and I asked the chip layout guy to take it off. He came back and said that this would either leave a big hole in the middle of the chip or take a three-month redesign and we couldn't do that. I didn't think anyone would use it. I was wrong again as that has really given the Amiga its edge in terms of the color palette. | ” |
HAM is not supported under AmigaOS version 4 on the AmigaOne. This can cause some incompatibilites with some software.
[edit] References
- Amiga Hardware Reference Manual, Commodore-Amiga
- Specification for the Advanced Amiga (AA) Chip Set, Commodore-Amiga