![]() |
Routines |
| Prev: 48183 | Up: Map | Next: 48244 |
|
Used by the routine at Draw_Sprites.
Applies colour attributes to a sprite's screen position. First writes the sprite's own colour attribute, then writes the background colour (2 RED ink) on top. The sprite occupies a 3x2 or 3x3 character cell area depending on alignment.
|
||||||||||
| ApplySpriteAttributes3Wide | 48210 | LD C,88 | Set the attribute base to 88 (i.e. the attribute buffer at 22528). | |||||||
| 48212 | LD D,0 | D=0. | ||||||||
|
Check if the sprite's X position is on a character boundary. If not, set bit 0 of D to indicate an extra column is needed.
|
||||||||||
| 48214 | LD A,(IX+0) | Load A with the sprite X position from *IX+0. | ||||||||
| 48217 | AND %00000111 | Keep only bits 0-2 (sub-character X offset). | ||||||||
| 48219 | JR Z,ApplySpriteAttributes3Wide_SpriteColour | Jump to ApplySpriteAttributes3Wide_SpriteColour if X-aligned. | ||||||||
| 48221 | SET 0,D | Set bit 0 of D (not X-aligned, need extra column). | ||||||||
|
First pass: write the sprite's own colour attribute to the attribute file. Skip if the attribute is 255 (transparent).
|
||||||||||
| ApplySpriteAttributes3Wide_SpriteColour | 48223 | LD E,(IX+2) | Load E with the sprite colour attribute from *IX+2. | |||||||
| 48226 | LD A,E | Jump to ApplySpriteAttributes3Wide_Background if the attribute byte is transparent (255). | ||||||||
| 48227 | CP 255 | |||||||||
| 48229 | JR Z,ApplySpriteAttributes3Wide_Background | |||||||||
| 48231 | PUSH HL | Stash the screen buffer address on the stack. | ||||||||
| 48232 | CALL WriteAttributeBlock3Wide | Call WriteAttributeBlock3Wide to write the sprite attribute. | ||||||||
| 48235 | POP HL | Restore the screen buffer address from the stack. | ||||||||
|
Second pass: write the background attribute (2 RED ink) over the sprite area using the room attribute base (248 maps to RoomAttributeBuffer).
|
||||||||||
| ApplySpriteAttributes3Wide_Background | 48236 | LD C,248 | C=248. | |||||||
| 48238 | LD E,2 | E=RED. | ||||||||
| 48240 | CALL WriteAttributeBlock3Wide | Call WriteAttributeBlock3Wide to write the background attribute. | ||||||||
| 48243 | RET | Return. | ||||||||
| Prev: 48183 | Up: Map | Next: 48244 |