![]() |
Routines |
| Prev: 7447 | Up: Map | Next: 748F |
| ColouriseSprite | 7450 | EXX | Switch to the shadow registers. | |
| 7451 | LD HL,($5E1A) | HL'=actor co-ordinates. | ||
| 7454 | CALL AttributeAddress | Call AttributeAddress - HL' now holds the co-ordinates to an attribute file address. | ||
| 7457 | LD A,($5E0F) | B'=width loop counter (in pixels). | ||
| 745A | LD B,A | |||
| 745B | LD A,($5E0E) | A=5E0E. | ||
| 745E | RRCA | A=((A / 04) + 01) / 02. | ||
| 745F | RRCA | |||
| 7460 | INC A | |||
| 7461 | RRCA | |||
| 7462 | AND %00011111 | Keep only bits 0-4. | ||
| 7464 | INC A | Increment A by one. | ||
| 7465 | LD C,A | C=height loop counter (in pixels). | ||
| 7466 | LD D,(IX+$03) | D=object colour attribute. | ||
| 7469 | LD E,B | E=width loop counter (in pixels). | ||
| ColouriseSprite_Loop1 | 746A | PUSH HL | Stash HL on the stack. | |
| ColouriseSprite_Loop2 | 746B | LD A,H | A=actor Y position. | |
| 746C | CP $5B | Decrement position if address is outside of attribute file address range. | ||
| 746E | JR NC,ColouriseSprite_1 | |||
| 7470 | CP $58 | |||
| 7472 | JR C,ColouriseSprite_1 | |||
| 7474 | LD (HL),D | Otherwise, set the colour at this location. | ||
| 7475 | INC L | Next tile column. | ||
| 7476 | LD A,L | Next tile if column < screen width (32 chars). | ||
| 7477 | AND %00011111 | |||
| 7479 | JR NZ,ColouriseSprite_0 | |||
| 747B | LD A,L | else, wrap-around and continue applying colour. | ||
| 747C | SUB $20 | |||
| 747E | LD L,A | L=start of current row. | ||
| ColouriseSprite_0 | 747F | DJNZ ColouriseSprite_Loop2 | Decrease counter by one and loop back to ColouriseSprite_Loop2 until counter is zero. | |
| ColouriseSprite_1 | 7481 | POP HL | Restore HL from the stack. | |
| 7482 | PUSH BC | Stash BC on the stack. | ||
| 7483 | AND A | Clear the carry flag. | ||
| 7484 | LD BC,$0020 | HL -= 32 tiles. Places address pointer previous line. | ||
| 7487 | SBC HL,BC | |||
| 7489 | POP BC | Restore BC from the stack. | ||
| 748A | LD B,E | B=reset to original width counter. | ||
| 748B | DEC C | Decrement height counter. | ||
| 748C | JR NZ,ColouriseSprite_Loop1 | Repeat until all tiles have been coloured. | ||
| 748E | RET | Return. | ||
| Prev: 7447 | Up: Map | Next: 748F |