Re: A89: Palet Shifting Routine


[Prev][Next][Index][Thread]

Re: A89: Palet Shifting Routine




> The grayscale routine does (simulate/emulate?) a pallet.  If we could have
> multiple planes and step through them while switching between the 1st 2nd
> and Nth plane we could do something with a similar effect as rotating the
> pallet.

If you mean pallette shifting as in switching the colors of the ENTIRE
sprite, it can be done easily in grayscale.  There are really 4 palletes for
each 4-color grayscale sprite:

1.) Normal Sprite Data
2.) Plane 1 complemented, Plane 2 normal
3.) Plane 2 complemented, Plane 1 normal
4.) Both planes complemented

By "complemented" I mean every bit of the sprite data in that plane XORed
with 1 - which will change all 1's to 0's and vice versa, essentially giving
the "inverse" or "negative" image of that plane.

Writing a routine to rapidly rotate the screen pallettes is simple:  First
complement the entire dark plane (cycle through it XORing every byte with
$FF), then complement the entire light plane, and repeat over and over.
Actually, it's a bit more complex - you don't want to complement the image
on the screen directly, you want to copy that to a buffer, complement it
there, then copy it back to the screen, otherwise there'll be massive
flickering - but that's more or less how it's done.

    -Scott




References: