Prev: 49031 Up: Map Next: 49113
49044: 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 49044 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.
49045 AND 7
49047 OR A
49048 JR Z,49052
49050 DEFB 203,202
Unused_3Wide_Convert_Attr 49052 LD A,H Convert the screen address to the attribute address using C as the base high byte.
49053 RRCA
49054 RRCA
49055 RRCA
49056 AND 3
49058 OR C
49059 LD H,A
49060 BIT 0,D Jump to Unused_3Wide_Write_1Col_Attr if bit 0 of D is clear (one column wide).
49062 JR Z,49095
Two columns wide: write the INK colour to two adjacent attribute cells.
49064 LD A,(HL) Read *HL, mask with 248 OR in E and write back.
49065 AND 248
49067 OR E
49068 LD (HL),A
49069 INC L Advance to the next column, read, mask, OR and write back.
49070 LD A,(HL)
49071 AND 248
49073 OR E
49074 LD (HL),A
49075 DEC L Move back to the first column.
49076 BIT 1,D Return if bit 1 of D is clear (no row straddling).
49078 RET Z
49079 LD BC,32 Add 0032 to advance to the next attribute row.
49082 ADD HL,BC
49083 LD A,(HL) Read, mask with 248 OR in E and write back.
49084 AND 248
49086 OR E
49087 LD (HL),A
49088 INC L Advance to the next column, read, mask, OR and write back.
49089 LD A,(HL)
49090 AND 248
49092 OR E
49093 LD (HL),A
49094 RET Return.
One column wide: write the INK colour to a single attribute cell.
Unused_3Wide_Write_1Col_Attr 49095 LD A,(HL) Read *HL, mask with 248 OR in E and write back.
49096 AND 248
49098 OR E
49099 LD (HL),A
49100 BIT 1,D Return if bit 1 of D is clear (no row straddling).
49102 RET Z
49103 LD BC,32 Add 0032 to advance to the next attribute row.
49106 ADD HL,BC
49107 LD A,(HL) Read, mask with 248 OR in E and write back.
49108 AND 248
49110 OR E
49111 LD (HL),A
49112 RET Return.
Prev: 49031 Up: Map Next: 49113