Routines |
Prev: 6A09 | Up: Map | Next: 6A73 |
Used by the routine at 6A9B.
|
||||
DrawPlayer | 6A39 | LD HL,($5E10) | HL=Player_Direction. | |
6A3C | LD BC,$0020 | BC=0020. | ||
6A3F | ADD HL,BC | |||
6A40 | LD A,H | |||
6A41 | AND %00000011 | Keep only bits 0-1. | ||
6A43 | RL L | |||
6A45 | RLA | |||
6A46 | RL L | |||
6A48 | RLA | |||
6A49 | SLA A | |||
6A4B | LD HL,$7F24 | HL=PlayerSpriteTable. | ||
6A4E | LD C,A | Create an offset in BC. | ||
6A4F | LD B,$00 | |||
6A51 | ADD HL,BC | HL=PlayerSpriteTable + offset. | ||
6A52 | LD E,(HL) | DE=pointer to the player sprite for this direction. | ||
6A53 | INC HL | |||
6A54 | LD D,(HL) | |||
The player is drawn statically in the centre of the play area.
|
||||
6A55 | LD HL,$4F93 | HL=4F93 (screen location). | ||
The player sprite is 02 bytes in width.
|
||||
6A58 | LD A,$02 | Write 02 to WidthCounter. | ||
6A5A | LD ($5E2C),A | |||
6A5D | LD A,(DE) | A=height of the sprite in pixels. | ||
6A5E | INC DE | Increment DE by one to point to the sprite data. | ||
6A5F | LD C,A | C=A (height of the sprite). | ||
DrawPlayer_NextRow | 6A60 | LD A,($5E2C) | B=WidthCounter. | |
6A63 | LD B,A | |||
6A64 | PUSH HL | Push HL on the stack. | ||
DrawPlayer_NextCol | 6A65 | LD A,(DE) | Copy a byte from DE (the player sprite data) to HL (the screen position). | |
6A66 | LD (HL),A | |||
6A67 | INC DE | Increment DE (the player sprite data pointer) by one. | ||
6A68 | INC L | Increment L by one, this moves onto the next adjacent screen byte. | ||
6A69 | DJNZ DrawPlayer_NextCol | Decrease counter by one and loop back to DrawPlayer_NextCol until counter is zero. | ||
6A6B | POP HL | Restore HL from the stack. | ||
6A6C | CALL ScreenPos1PixelAbove | Call ScreenPos1PixelAbove. | ||
6A6F | DEC C | Decrease C (height) by one and jump to DrawPlayer_NextRow if it is not zero. | ||
6A70 | JR NZ,DrawPlayer_NextRow | |||
6A72 | RET | Return. |
Prev: 6A09 | Up: Map | Next: 6A73 |