![]() |
Routines |
| Prev: 8701 | Up: Map | Next: 877C |
|
Write the actor's attribute bytes into the buffer using AttributeAddress.
|
||||||||||
Write the actor colour into the attribute rectangle.
|
||||||||||
| ColouriseSprite | 8733 | LD L,(IX+$01) | Fetch the screen column and actor Y. | |||||||
| 8736 | LD H,(IX+$04) | |||||||||
| 8739 | LD D,(IX+$07) | Fetch the actor colour from *IX+07. | ||||||||
| 873C | LD A,($5E57) | Return if SpriteWidth is zero. | ||||||||
| 873F | AND A | |||||||||
| 8740 | RET Z | |||||||||
| 8741 | LD B,A | Set the column counter from SpriteWidth. | ||||||||
| 8742 | CALL AttributeAddress | Call AttributeAddress. | ||||||||
| 8745 | LD A,($5E58) | Turn SpriteHeight into an attribute-row count. | ||||||||
| 8748 | RRCA | |||||||||
| 8749 | RRCA | |||||||||
| 874A | INC A | |||||||||
| 874B | RRCA | |||||||||
| 874C | AND %00011111 | Keep only bits 0-4. | ||||||||
| 874E | INC A | Store the row count. | ||||||||
| 874F | LD C,A | |||||||||
|
Paint one attribute row, then step up to the next.
|
||||||||||
| ColouriseSprite_Loop | 8750 | PUSH BC | Stash the counters and attribute address. | |||||||
| 8751 | PUSH HL | |||||||||
| 8752 | LD A,H | Jump to ColouriseSprite_NextRow if the address is below 5800. | ||||||||
| 8753 | CP $58 | |||||||||
| 8755 | JR C,ColouriseSprite_NextRow | |||||||||
| 8757 | PUSH BC | Skip this row if the address is at or past 5AC0. | ||||||||
| 8758 | PUSH HL | |||||||||
| 8759 | LD BC,$5AC0 | |||||||||
| 875C | AND A | |||||||||
| 875D | SBC HL,BC | |||||||||
| 875F | POP HL | |||||||||
| 8760 | POP BC | |||||||||
| 8761 | JR NC,ColouriseSprite_NextRow | |||||||||
|
Write the actor colour along the row, skipping empty attributes.
|
||||||||||
| ColouriseSprite_WriteInk | 8763 | LD A,(HL) | Jump to ColouriseSprite_NextColumn if this attribute is empty. | |||||||
| 8764 | AND A | |||||||||
| 8765 | JR Z,ColouriseSprite_NextColumn | |||||||||
| 8767 | LD (HL),D | Write the actor colour. | ||||||||
| ColouriseSprite_NextColumn | 8768 | INC L | Move onto the next attribute column. | |||||||
| 8769 | LD A,L | |||||||||
| 876A | AND %00011111 | Keep only bits 0-4. | ||||||||
| 876C | JR Z,ColouriseSprite_NextRow | Jump to ColouriseSprite_NextRow if the row wrapped, else loop back to ColouriseSprite_WriteInk. | ||||||||
| 876E | DJNZ ColouriseSprite_WriteInk | |||||||||
|
Step up one attribute row and repeat until every row is painted.
|
||||||||||
| ColouriseSprite_NextRow | 8770 | POP HL | Restore the start of this attribute row. | |||||||
| 8771 | LD BC,$0020 | Move up one attribute row. | ||||||||
| 8774 | AND A | |||||||||
| 8775 | SBC HL,BC | |||||||||
| 8777 | POP BC | |||||||||
| 8778 | DEC C | Decrease the row counter and loop back to ColouriseSprite_Loop until every row is painted. | ||||||||
| 8779 | JR NZ,ColouriseSprite_Loop | |||||||||
| 877B | RET | Return. | ||||||||
| Prev: 8701 | Up: Map | Next: 877C |