23

The game Universe for Amiga boasted ability of use of 256 different Amiga colors available through the ECS chips, with only limitation of 64 colors in halfbrite palette (32 arbitrary + 32 at half brightness of the first 32) per scanline.

This was pretty much unachievable in common use, and while there were games or programs that would switch the palette at cost of one entirely black scanline (e.g. Personal Paint keeping the toolbox bar in its original palette while providing all 64 colors of halfbrite for painting) this was the only case I know about where a full palette switch could be achieved within each scanline.... or something around that, my memory may be sketchy.

How was that possible? Was that used elsewhere? Advanced answers, even with assembly code snippets are most welcome.

  • Remember the days when games bragged about the number of colors on-screen? Pepperidge Farm remembers.... – cbmeeks Jan 25 '17 at 19:33
19

On a PAL Amiga, a full line sweep translates to about 454 virtual Lores (Low Resolution) pixels. (64 µs duration of a horizontal line, 7.093790 MHz pixel clock =~ 140.968 ns per pixel: 64 µs / 140.968 ns =~ 454).

I say virtual pixels because not all of those pixels are actually usable as there is the horizontal sync period of about 4 µs and the back porch of about 8 µs, leaving about 52 µs or about 369 pixels. In practice, the number of used pixels was even lower (so it would fit into the visible non-distorted area of the CRT) - usually 320 pixels in Low Resolution.

Therefore, the number of pixel-times where nothing is displayed is about 134. Copper lists allowed positioning (waiting) horizontally with 4 pixel granularity and a copper MOVE instruction took 8 pixels to complete. 134 / 8 are a little more than 16. So you can update about 14 to 16 color registers each line outside of the display data fetch when using copper lists.

So assuming we use 5 bitplanes (32 colors), we could use 16 colors for the background and prepare a copper list that changes those 16 colors (or most of them) each line, providing for a very colorful setting. The copper list could be prepared once when switching to a different scene and then not changed anymore while the scene is active, or it could be prepared once per frame during the vertical blanking area.

We could then use the remaining 16 colors (which remain static) for blitting the animated character onto the background.

Update:

I checked the game for what it actually does and it pretty much matches:

It loads BPLCON0 with $6200, which means 6 bitplanes without HAM mode, i. e. EHB (Extra HalfBrite) mode (64 colors with 32 freely controllable palette entries and the remaining 32 colors roughly half as bright as the first 32), as you originally suggested.

Apart from that it uses the technique I outlined above: In the Copper list it does a WAIT $xxE1FFFC for each raster line and then changes a couple of colors (about 2 to 8 per line) out of the first 16 (leaving index 0 alone - as a consequence it also affects color indices 33 to 47 of the EHB image) and doesn't touch color indices 16 to 31 (consequentially, indices 48 to 63 of the EHB image also remain static).

  • 1
    I can add that the technique described above works on OCS too. – Valentino Miazzo Apr 20 '16 at 4:53
  • That's true. There aren't that many practical differences between ECS and OCS when it comes to games, as games usually didn't make use of ECS-only features. – blubberdiblub Apr 20 '16 at 5:34
  • 1
    One silly question - I remember the maximum horizontal limit for standard resolutions to be 640 pixels for ECS/OCS.. but this is completely unrelated, your 454 "virtual pixels" is simply calculating in theory how many times you could manipulate colour per scanline sweep given a certain clock frequency for instructions? – nsandersen Apr 20 '16 at 19:16
  • I was talking about Lores (Low resolution) pixels. Hires did some tricks to achieve double the horizontal resolution (indeed 640), but had some serious limitations on OCS/ECS Amigas (they were lifted with AGA) that made it unsuitable for most games. For instance it reduces the maximum possible bitplanes to 4, i. e. 16 colors. – blubberdiblub Apr 20 '16 at 19:24
  • And indeed the "small" Amigas' crystal clock rates are based around the Lores pixels. To produce Hires pixels it maybe used a frequency multiplier to change the pixel color twice during one clock cycle or it just utilized the high phase of the clock for the left Hires pixel and the low phase for the right Hires pixel of a pixel pair. – blubberdiblub Apr 20 '16 at 19:30
3

Note that the limitation of 64 colors per scanline implies the use of the Extra Half Brite (EHB) mode of the Amiga.

This is the graphic mode capable of displaying the most colors per scanline without artifacts on ECS models.

However, answering with advanced detailed examples is asking quite a bit since the subject is quite complex and this information is available on the Internet already (cf link at the bottom). ;)

The simple answer is that the Copper processor is being used to switch colors while the display electron beam is blanked while it returns from the right border of the screen to the left one (this is called the horizontal blanking interval).

Almost all Amiga games used the Copper to increase the amount of colors on screen, even if this was just used to create a background/sky gradient.

The Copper can switch about 31 to 32 colours per scanline on a regular 320 x 256 display. But with the EHB mode, this also modifies the upper 32 colors of the palette (they are darker versions of the lower 32 ones). This means that one can theoretically display 256 * 64 distinct colors on OCS.

The screen is thus divided vertically in slices which each use a different palette. 256 colors are reached by using only four slices: 4 * 64.

The game Pang uses this technique, this is detailed in this great article from CodeTapper: http://www.codetapper.com/amiga/maptapper/documentation/gfx/gfx-palette

You will find plenty of other examples of this kind on his website.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.