Thanks for that Ian — it does sound very similar to what I was aiming for. Though the standard screen$ capabilities seem very limited, with maybe just 1 change per line? (plus flash)
I've had a few more ideas about how to handle a running palette, with it tied into knowledge of SAM's display timings. It might be a while before there's anything to show for it though. Si On 3 Apr 2012, at 18:21, Ian Collier wrote: > The Sam does of course have line-based palette changes built into its > native SCREEN$ loader (before you say: yes I know that's not quite as > sophisticated as what's being discussed). > > In... oh, 1996, I attempted to write a program that could translate a > 256x192 image into a plain Sam screen with palette line changes, though > it wasn't hugely successful. > > It describes itself as follows: > > Usage: /tmp/ppmtosam [flags] [input] [output] > > This program converts the named input file (or standard input if none > is named) from raw PPM format to a Sam mode 4 screen picture and writes > the result in the named output file (or standard output). The resulting > file will contain the bitmap (24576 bytes) a palette (40 bytes) and, if > required, a line table (4*n bytes) and end with an end marker (character > 255). This is the same format as if the picture had been saved to disk > on a Sam. > > If line changes are not requested then the program selects the 16 best > colours for the palette. Otherwise the program attempts to calculate > a best palette for each line, based on the colours in the surrounding > area (the program does not take account of the fact that if several > palette changes are made on one line then the later ones will not be > available immediately). Alternatively, a picture can be produced using > the 14-colour greyscale palette. The picture is not dithered by default, > but Floyd-Steinberg dithering may be selected. > > Valid flags: (default values in brackets) > -c Allow line changes > -d Produce some debugging information > -f Use Floyd-Steinberg dithering > -g Produce a greyscale picture instead of a colour one > -q Quiet (don't print the number of palette changes) > -s Attempt to smooth boundaries caused by palette changes while dithering > > -A n Look ahead n lines when calculating popular colours for line changes [4] > -B n Look behind n lines when calculating colours for line changes [0] > -D n Discourage line changes (higher n makes fewer line changes) [4] > -k n Keep the first n colours constant when calculating line changes [8] > (pen 0 if kept should be a popular dark colour and pen 1 should be light) > -L n Use a maximum of L colour changes on a line [2] > -M n Use a maximum of n colour changes for the whole picture [127] > > imc