Prev: CFA4 Up: Map Next: D070
D004: Paint Wide Entity Attributes
Used by the routine at Process_Wall_Bouncing_Enemy.
Paints the entity colour attribute across a three-cell-wide, three-row region of the attribute area at the entity's screen position. Uses Screen_Row_Address_Lookup_Table to resolve each pixel row to its attribute address; the colour is read from shadow B'. Called by Process_Wall_Bouncing_Enemy.
Input
HL Entity state byte pointer (Y and X positions follow)
Paint_Wide_Entity_Attributes D004 INC HL Step to the entity Y position and load the attribute colour base into D.
D005 LD D,$46
D007 LD E,(HL)
D008 INC HL
D009 SLA E Shift the Y position left to form the row address table index in DE.
D00B RL D
D00D LD A,(HL) Rotate the X position right three places to derive the attribute column.
D00E RRA
D00F RRA
D010 RRA
D011 AND %00011111 Keep the attribute column index.
D013 LD C,A Store the column index in C.
D014 EXX Copy the entity colour attribute from shadow B' into B.
D015 LD A,B
D016 EXX
D017 LD B,A
Write the entity colour to three adjacent attribute cells in each of three consecutive entity rows.
D018 LD A,(DE) Look up the first attribute row address and add the column offset.
D019 ADD A,C
D01A LD L,A
D01B INC DE
D01C LD A,(DE)
D01D LD H,A
D01E INC DE
D01F LD A,H Isolate the attribute page bits.
D020 RRCA
D021 RRCA
D022 RRCA
D023 AND %00000011 Keep only the two attribute page bits.
D025 OR %01011000 Combine with the attribute area base address.
D027 LD H,A Store the computed attribute high byte.
D028 LD (HL),B Write the entity colour to three adjacent attribute cells.
D029 INC HL
D02A LD (HL),B
D02B INC HL
D02C LD (HL),B
D02D INC DE Advance the row address pointer to the second entity row.
D02E INC DE
D02F INC DE
D030 INC DE
D031 INC DE
D032 INC DE
D033 INC DE
D034 INC DE
D035 INC DE
D036 INC DE
D037 INC DE
D038 INC DE
D039 LD A,(DE) Look up the second attribute row address and add the column offset.
D03A ADD A,C
D03B LD L,A
D03C INC DE
D03D LD A,(DE)
D03E LD H,A
D03F INC DE
D040 LD A,H Isolate the attribute page bits.
D041 RRCA
D042 RRCA
D043 RRCA
D044 AND %00000011 Keep only the two attribute page bits.
D046 OR %01011000 Combine with the attribute area base address.
D048 LD H,A Store the computed attribute high byte.
D049 LD (HL),B Write the entity colour to three adjacent attribute cells.
D04A INC HL
D04B LD (HL),B
D04C INC HL
D04D LD (HL),B
D04E INC DE Advance the row address pointer to the third entity row.
D04F INC DE
D050 INC DE
D051 INC DE
D052 INC DE
D053 INC DE
D054 INC DE
D055 INC DE
D056 INC DE
D057 INC DE
D058 INC DE
D059 INC DE
D05A INC DE
D05B INC DE
D05C LD A,(DE) Look up the third attribute row address and add the column offset.
D05D ADD A,C
D05E LD L,A
D05F INC DE
D060 LD A,(DE)
D061 INC DE
D062 RRCA Isolate the attribute page bits.
D063 RRCA
D064 RRCA
D065 AND %00000011 Keep only the two attribute page bits.
D067 OR %01011000 Combine with the attribute area base address.
D069 LD H,A Store the computed attribute high byte.
D06A LD (HL),B Write the entity colour to three adjacent attribute cells.
D06B INC HL
D06C LD (HL),B
D06D INC HL
D06E LD (HL),B
D06F RET Return.
Prev: CFA4 Up: Map Next: D070