Hold-And-Modify (more commonly know as HAM) is a screenmode of the Amiga micro computer. It works by interpreting the data for a pixel as 'copy the colour of my neighbour to the left' (Hold), then 'change that colour' (Modify). This allowed the computer to use a fairly rich palette, even if there were only a few bits available to indicate the colour.

A disadvantage was that rapid colour changes within a row of pixels were not possible, so if you tried to encode such a fast change, you would get artifacting similar to the type you sometimes get with the JPEG graphics format.

In the early days of multimedia, HAM gave the Amiga a small advantage over competing systems, because it allowed the system to display digitized photographs and rendered 3D images at a much more realistic level.

On early Amiga systems, only 5 bits could be used to indicate colours. Most screenmodes worked with indexed colours, meaning the 2^5 (=32) colours could be displayed at most. The HAM mode reserved 1 bit to indicate whether a colour was indexed or not (so 16 colours could come from an index and form the initial colours) and used 4 bits to indicate the shift in colour one pixel would have from its left neighbour.

A row of pixels would always start with one of the 16 indexed colours.

But how does it calculate the colour shift from there on?

HAM allowed for a maximum of 4096 colours to be used, because the system used 12-bit colour, 4 bits for each of Red, Green and Blue (2^12 = 4096).

On later Amiga systems (starting with the A1200 and A4000), a pixel could have 8 bits to encode its colour, which allowed for 256 colours from an index, and a HAM mode allowing colours from a 24-bit palette. HAM-8 as it was called, therefore allowed a maximum of 262,144 colours on-screen from a palette of 16,777,216.

HAM was only originally put into the Amigas custom chipset as an experiment. To quote Jay Miner (known as "the father of the Amiga") himself:

"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 colour palette."