I'd read the Enhanced mode 1 pictures thread some time ago and that provided a starting off point. Obviously, palettes that adapt to the image aren't really suitable for animation - they'd severely restrict what you could place where without requiring more than four colours per line. Similarly, only being able to change two colours per scan line would also be an issue - I'd been thinking about alternating RGBW and CMYK palettes on successive lines to get all eight colours on screen. hexwab's mention of the flash bit in that thread provided the key to a solution because that would enable switching the whole palette with only one write the the ULA and it fits perfectly with my idea of swapping between RGBW and CMYK palettes.
The first step was to see if you could still get reasonable results from such an arrangement, so I wrote a alternating palette aware implementation of the Floyd-Steinberg dithering algorithm that converts an image to only use the colours available on the Beeb with alternating RGBW and CMYK palettes. You can customise the palette used by editing a variable near the top of the program.
The results where promising:-
Not being able to produce true black or white can a problem but you can always define some fixed colours at the loss of others - a fixed black is an obvious example for space games. The last two images above do this (fixed black, no white for supghouls and fixed black and white with no green or magenta for superrtype). For reproducing photos, the approaches described in the Enhanced mode 1 pictures thread would produce superior results but the advantage of this scheme is it could be used for games.
Now obviously, the Beeb doesn't have the memory to store huge sprites or backgrounds used in those example images so to give an idea of what might be more achievable I added colours to a screenshot of the Spectrum version of SabreWulf and ran it through my dithering program. Obviously, there has to be enough time left over from palette switching to run a game so to test it out I've implemented a little demo that moves 6 24x24 spites over the mslug image. It uses use interrupts from user VIA timer 1 to control when the palette switches occur. Here it is running in b-em: The attached ZIP file contains:
- dither.ssd - a disc image containing the demo.
- dither.py - the palette switching aware dithering program.
- tomode1.py - a program that takes the output of dither.py and converts it into Beeb 4 colour format.
- dither.6502 - the source to the demo program.
- bbc.6502 - some Beeb related defines and macros used by dither.6502.
- square.dat - the sprite used in the demo.
- slug1 - a version of the mslug 1 image above padded out to fill a mode 1 screen.