![]() |
Routines |
| Prev: 27145 | Up: Map | Next: 27251 |
|
Used by the routine at 27291.
|
||||
| DrawPlayer | 27193 | LD HL,(24080) | HL=Player_Direction. | |
| 27196 | LD BC,32 | BC=0032. | ||
| 27199 | ADD HL,BC | |||
| 27200 | LD A,H | |||
| 27201 | AND %00000011 | Keep only bits 0-1. | ||
| 27203 | RL L | |||
| 27205 | RLA | |||
| 27206 | RL L | |||
| 27208 | RLA | |||
| 27209 | SLA A | |||
| 27211 | LD HL,32548 | HL=PlayerSpriteTable. | ||
| 27214 | LD C,A | Create an offset in BC. | ||
| 27215 | LD B,0 | |||
| 27217 | ADD HL,BC | HL=PlayerSpriteTable + offset. | ||
| 27218 | LD E,(HL) | DE=pointer to the player sprite for this direction. | ||
| 27219 | INC HL | |||
| 27220 | LD D,(HL) | |||
|
The player is drawn statically in the centre of the play area.
|
||||
| 27221 | LD HL,20371 | HL=20371 (screen location). | ||
|
The player sprite is 2 bytes in width.
|
||||
| 27224 | LD A,2 | Write 2 to WidthCounter. | ||
| 27226 | LD (24108),A | |||
| 27229 | LD A,(DE) | A=height of the sprite in pixels. | ||
| 27230 | INC DE | Increment DE by one to point to the sprite data. | ||
| 27231 | LD C,A | C=A (height of the sprite). | ||
| DrawPlayer_NextRow | 27232 | LD A,(24108) | B=WidthCounter. | |
| 27235 | LD B,A | |||
| 27236 | PUSH HL | Push HL on the stack. | ||
| DrawPlayer_NextCol | 27237 | LD A,(DE) | Copy a byte from DE (the player sprite data) to HL (the screen position). | |
| 27238 | LD (HL),A | |||
| 27239 | INC DE | Increment DE (the player sprite data pointer) by one. | ||
| 27240 | INC L | Increment L by one, this moves onto the next adjacent screen byte. | ||
| 27241 | DJNZ DrawPlayer_NextCol | Decrease counter by one and loop back to DrawPlayer_NextCol until counter is zero. | ||
| 27243 | POP HL | Restore HL from the stack. | ||
| 27244 | CALL ScreenPos1PixelAbove | Call ScreenPos1PixelAbove. | ||
| 27247 | DEC C | Decrease C (height) by one and jump to DrawPlayer_NextRow if it is not zero. | ||
| 27248 | JR NZ,DrawPlayer_NextRow | |||
| 27250 | RET | Return. | ||
| Prev: 27145 | Up: Map | Next: 27251 |