lcd_grey_data:
lea.l (-2*4, %sp), %sp
movem.l %a2-%a3, (%sp)
movem.l (2*4+4, %sp), %a0-%a2 /* values, phases, length */
lea.l LCD_BASE_ADDRESS+2, %a3 /* LCD data port address */
.ph_loop:
clr.l %d1
move.l (%a1), %d0 /* fetch 4 pixel phases */
bclr.l #31, %d0 /* Z = !(p0 & 0x80); p0 &= ~0x80; */
seq.b %d1 /* %d1 = ........................00000000 */
lsl.l #1, %d1 /* %d1 = .......................00000000. */
bclr.l #23, %d0 /* Z = !(p1 & 0x80); p1 &= ~0x80; */
seq.b %d1 /* %d1 = .......................011111111 */
lsl.l #1, %d1 /* %d1 = ......................011111111. */
bclr.l #15, %d0 /* Z = !(p2 & 0x80); p2 &= ~0x80; */
seq.b %d1 /* %d1 = ......................0122222222 */
lsl.l #1, %d1 /* %d1 = .....................0122222222. */
bclr.l #7, %d0 /* Z = !(p3 & 0x80); p3 &= ~0x80; */
seq.b %d1 /* %d1 = .....................01233333333 */
lsr.l #7, %d1 /* %d1 = ............................0123 */
add.l (%a0)+, %d0 /* add 4 pixel values to the phases */
move.l %d0, (%a1)+ /* store new phases, advance pointer */
move.w %d1, (%a3) /* transfer to lcd */
cmp.l %a2, %a1
bls .ph_loop
movem.l (%sp), %a2-%a3
lea.l (2*4, %sp), %sp
rts