Pixel Stuff - convert ST style bitplanes to packed pixel format for the Falcon
Algorithm used is to shift bits out of planes and into packed pix register
one at a time, high bit first.
Note: Don't do this with 1 bpp data, it wastes time & confuses things.
Pseudo-Code to convert 16 pixels (2 4 or 8 bpp) to packed pixels
--------------------------------------------------------------------------------
LOAD PLANES[1..NUMBITPLANES] WITH one bitplane word (16 bits) each
; (sequential out of memory)
FOR k = 1 to (NUMBITPLANES/2) ; save every 32 bits of ppix
FOR i = 1 to (32/NUMBITPLANES) ; create 32 bits of packedpixels
FOR j = NUMBITPLANES downto 1 ; Get MSB of the pixel first
LSL.L PLANE[j] ; shift bit left into X bit
ROXL.L PACKEDPIX ; Rotate X bit left into dest.
ENDFOR j
ENDFOR i
SAVE PACKEDPIX ; save 32 bits of ppix
ENDFOR k
--------------------------------------------------------------------------------