Prev: 53074 Up: Map Next: 53252
53156: Paint Narrow Entity Attributes
Paints the entity colour attribute across a two-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_Entity_Record_Fast, Tick_Entity_Colour_Timer and Process_Cluster_Entity.
Input
HL Entity state byte pointer (Y and X positions follow)
Paint_Narrow_Entity_Attributes 53156 INC HL Step to the entity Y position and load the attribute colour base into D.
53157 LD D,70
53159 LD E,(HL)
53160 INC HL
53161 SLA E Shift the Y position left to form the row address table index in DE.
53163 RL D
53165 LD A,(HL) Rotate the X position right three places to derive the attribute column.
53166 RRA
53167 RRA
53168 RRA
53169 AND %00011111 Keep the attribute column index.
53171 LD C,A Store the column index in C.
53172 EXX Copy the entity colour attribute from shadow B' into B.
53173 LD A,B
53174 EXX
53175 LD B,A
Write the entity colour to two adjacent attribute cells in each of three consecutive entity rows.
53176 LD A,(DE) Look up the first attribute row address and add the column offset.
53177 ADD A,C
53178 LD L,A
53179 INC DE
53180 LD A,(DE)
53181 LD H,A
53182 INC DE
53183 LD A,H Isolate the attribute page bits.
53184 RRCA
53185 RRCA
53186 RRCA
53187 AND %00000011 Keep only the two attribute page bits.
53189 OR %01011000 Combine with the attribute area base address.
53191 LD H,A Store the computed attribute high byte.
53192 LD (HL),B Write the entity colour to two adjacent attribute cells.
53193 INC HL
53194 LD (HL),B
53195 INC DE Advance the row address pointer to the second entity row.
53196 INC DE
53197 INC DE
53198 INC DE
53199 INC DE
53200 INC DE
53201 INC DE
53202 INC DE
53203 INC DE
53204 INC DE
53205 LD A,(DE) Look up the second attribute row address and add the column offset.
53206 ADD A,C
53207 LD L,A
53208 INC DE
53209 LD A,(DE)
53210 LD H,A
53211 INC DE
53212 LD A,H Isolate the attribute page bits.
53213 RRCA
53214 RRCA
53215 RRCA
53216 AND %00000011 Keep only the two attribute page bits.
53218 OR %01011000 Combine with the attribute area base address.
53220 LD H,A Store the computed attribute high byte.
53221 LD (HL),B Write the entity colour to two adjacent attribute cells.
53222 INC HL
53223 LD (HL),B
53224 INC DE Advance the row address pointer to the third entity row.
53225 INC DE
53226 INC DE
53227 INC DE
53228 INC DE
53229 INC DE
53230 INC DE
53231 INC DE
53232 INC DE
53233 INC DE
53234 LD A,(DE) Look up the third attribute row address and add the column offset.
53235 ADD A,C
53236 LD L,A
53237 INC DE
53238 LD A,(DE)
53239 INC DE
53240 RRCA Isolate the attribute page bits.
53241 RRCA
53242 RRCA
53243 AND %00000011 Keep only the two attribute page bits.
53245 OR %01011000 Combine with the attribute area base address.
53247 LD H,A Store the computed attribute high byte.
53248 LD (HL),B Write the entity colour to two adjacent attribute cells.
53249 INC HL
53250 LD (HL),B
53251 RET Return.
Prev: 53074 Up: Map Next: 53252