Prev: BF87 Up: Map Next: BFD9
BF94: Unused: Write 3-Wide Attribute Cells
Unused routine to write INK colour to attribute cells for a 3-wide sprite. Identical in structure to Unused_Write_Attribute_Cells but used by the 3-wide drawing path.
Input
C Attribute buffer base high byte
D Bit 0: width flag, Bit 1: set if straddling two character rows
E Attribute INK colour
HL Screen buffer address
Unused_Write_3Wide_Attributes BF94 LD A,H Check if the sprite straddles two character rows by testing bits 0-2 of H; if non-zero, set bit 1 of D.
BF95 AND $07
BF97 OR A
BF98 JR Z,$BF9C
BF9A DEFB $CB,$CA
Unused_3Wide_Convert_Attr BF9C LD A,H Convert the screen address to the attribute address using C as the base high byte.
BF9D RRCA
BF9E RRCA
BF9F RRCA
BFA0 AND $03
BFA2 OR C
BFA3 LD H,A
BFA4 BIT 0,D Jump to Unused_3Wide_Write_1Col_Attr if bit 0 of D is clear (one column wide).
BFA6 JR Z,$BFC7
Two columns wide: write the INK colour to two adjacent attribute cells.
BFA8 LD A,(HL) Read *HL, mask with F8 OR in E and write back.
BFA9 AND $F8
BFAB OR E
BFAC LD (HL),A
BFAD INC L Advance to the next column, read, mask, OR and write back.
BFAE LD A,(HL)
BFAF AND $F8
BFB1 OR E
BFB2 LD (HL),A
BFB3 DEC L Move back to the first column.
BFB4 BIT 1,D Return if bit 1 of D is clear (no row straddling).
BFB6 RET Z
BFB7 LD BC,$0020 Add 0020 to advance to the next attribute row.
BFBA ADD HL,BC
BFBB LD A,(HL) Read, mask with F8 OR in E and write back.
BFBC AND $F8
BFBE OR E
BFBF LD (HL),A
BFC0 INC L Advance to the next column, read, mask, OR and write back.
BFC1 LD A,(HL)
BFC2 AND $F8
BFC4 OR E
BFC5 LD (HL),A
BFC6 RET Return.
One column wide: write the INK colour to a single attribute cell.
Unused_3Wide_Write_1Col_Attr BFC7 LD A,(HL) Read *HL, mask with F8 OR in E and write back.
BFC8 AND $F8
BFCA OR E
BFCB LD (HL),A
BFCC BIT 1,D Return if bit 1 of D is clear (no row straddling).
BFCE RET Z
BFCF LD BC,$0020 Add 0020 to advance to the next attribute row.
BFD2 ADD HL,BC
BFD3 LD A,(HL) Read, mask with F8 OR in E and write back.
BFD4 AND $F8
BFD6 OR E
BFD7 LD (HL),A
BFD8 RET Return.
Prev: BF87 Up: Map Next: BFD9