Routines |
Prev: 7038 | Up: Map | Next: 7097 |
Used by the routine at 6633.
|
||||
ColouriseSprite | 704B | EXX | Switch to the shadow registers. | |
704C | LD HL,($5E27) | HL'=actor co-ordinates. | ||
704F | LD D,(IX+$03) | D'=object colour attribute. | ||
This entry point is used by the routine at 6FAC.
|
||||
ColouriseSprite_0 | 7052 | CALL AttributeAddress | Call AttributeAddress - HL' now holds the co-ordinates to an attribute file address. | |
7055 | LD A,($5E24) | B'=width loop counter (in pixels). | ||
7058 | LD B,A | |||
7059 | LD A,($5E23) | A=HeightPixels. | ||
705C | RRCA | A=((A / 04) + 01) / 02. | ||
705D | RRCA | |||
705E | INC A | |||
705F | RRCA | |||
7060 | AND %00011111 | Keep only bits 0-4. | ||
7062 | INC A | Increment A by one. | ||
7063 | LD C,A | C'=height loop counter (in pixels). | ||
This entry point is used by the routine at 6A9B.
|
||||
ColouriseSprite_1 | 7064 | LD E,B | E'=width loop counter (in pixels). | |
ColouriseSprite_Loop1 | 7065 | PUSH HL | Stash HL on the stack. | |
ColouriseSprite_Loop2 | 7066 | LD A,H | A=actor Y position. | |
7067 | CP $5B | Decrement position if address is outside of attribute file address range. | ||
7069 | JR NC,ColouriseSprite_4 | |||
706B | PUSH HL | Stash HL and BC on the stack. | ||
706C | PUSH BC | |||
706D | LD BC,$5820 | BC'=5820. | ||
7070 | AND A | Clear the carry flag. | ||
7071 | SBC HL,BC | |||
7073 | POP BC | Restore BC and HL from the stack. | ||
7074 | POP HL | |||
7075 | JR C,ColouriseSprite_4 | |||
7077 | LD A,(HL) | |||
7078 | CP $76 | |||
707A | JR Z,ColouriseSprite_2 | |||
707C | LD (HL),D | |||
ColouriseSprite_2 | 707D | INC L | ||
707E | LD A,L | |||
707F | AND %00011111 | Keep only bits 0-4. | ||
7081 | JR NZ,ColouriseSprite_3 | |||
7083 | LD A,L | |||
7084 | SUB $20 | |||
7086 | LD L,A | |||
ColouriseSprite_3 | 7087 | DJNZ ColouriseSprite_Loop2 | Decrease counter by one and loop back to ColouriseSprite_Loop2 until counter is zero. | |
ColouriseSprite_4 | 7089 | POP HL | Restore HL from the stack. | |
708A | PUSH BC | Stash BC on the stack. | ||
708B | AND A | Clear the carry flag. | ||
708C | LD BC,$0020 | HL -= 32 tiles. Places address pointer previous line. | ||
708F | SBC HL,BC | |||
7091 | POP BC | Restore BC from the stack. | ||
7092 | LD B,E | B=reset to original width counter. | ||
7093 | DEC C | Decrement height counter. | ||
7094 | JR NZ,ColouriseSprite_Loop1 | Repeat until all tiles have been coloured. | ||
7096 | RET | Return. |
Prev: 7038 | Up: Map | Next: 7097 |