![]() |
Routines |
Prev: 28728 | Up: Map | Next: 28823 |
Used by the routine at 26163.
|
||||
ColouriseSprite | 28747 | EXX | Switch to the shadow registers. | |
28748 | LD HL,(24103) | HL'=actor co-ordinates. | ||
28751 | LD D,(IX+3) | D'=object colour attribute. | ||
This entry point is used by the routine at 28588.
|
||||
ColouriseSprite_0 | 28754 | CALL AttributeAddress | Call AttributeAddress - HL' now holds the co-ordinates to an attribute file address. | |
28757 | LD A,(24100) | B'=width loop counter (in pixels). | ||
28760 | LD B,A | |||
28761 | LD A,(24099) | A=HeightPixels. | ||
28764 | RRCA | A=((A / 4) + 1) / 2. | ||
28765 | RRCA | |||
28766 | INC A | |||
28767 | RRCA | |||
28768 | AND %00011111 | Keep only bits 0-4. | ||
28770 | INC A | Increment A by one. | ||
28771 | LD C,A | C'=height loop counter (in pixels). | ||
This entry point is used by the routine at 27291.
|
||||
ColouriseSprite_1 | 28772 | LD E,B | E'=width loop counter (in pixels). | |
ColouriseSprite_Loop1 | 28773 | PUSH HL | Stash HL on the stack. | |
ColouriseSprite_Loop2 | 28774 | LD A,H | A=actor Y position. | |
28775 | CP 91 | Decrement position if address is outside of attribute file address range. | ||
28777 | JR NC,ColouriseSprite_4 | |||
28779 | PUSH HL | Stash HL and BC on the stack. | ||
28780 | PUSH BC | |||
28781 | LD BC,22560 | BC'=22560. | ||
28784 | AND A | Clear the carry flag. | ||
28785 | SBC HL,BC | |||
28787 | POP BC | Restore BC and HL from the stack. | ||
28788 | POP HL | |||
28789 | JR C,ColouriseSprite_4 | |||
28791 | LD A,(HL) | |||
28792 | CP 118 | |||
28794 | JR Z,ColouriseSprite_2 | |||
28796 | LD (HL),D | |||
ColouriseSprite_2 | 28797 | INC L | ||
28798 | LD A,L | |||
28799 | AND %00011111 | Keep only bits 0-4. | ||
28801 | JR NZ,ColouriseSprite_3 | |||
28803 | LD A,L | |||
28804 | SUB 32 | |||
28806 | LD L,A | |||
ColouriseSprite_3 | 28807 | DJNZ ColouriseSprite_Loop2 | Decrease counter by one and loop back to ColouriseSprite_Loop2 until counter is zero. | |
ColouriseSprite_4 | 28809 | POP HL | Restore HL from the stack. | |
28810 | PUSH BC | Stash BC on the stack. | ||
28811 | AND A | Clear the carry flag. | ||
28812 | LD BC,32 | HL -= 32 tiles. Places address pointer previous line. | ||
28815 | SBC HL,BC | |||
28817 | POP BC | Restore BC from the stack. | ||
28818 | LD B,E | B=reset to original width counter. | ||
28819 | DEC C | Decrement height counter. | ||
28820 | JR NZ,ColouriseSprite_Loop1 | Repeat until all tiles have been coloured. | ||
28822 | RET | Return. |
Prev: 28728 | Up: Map | Next: 28823 |