![]() |
Routines |
| Prev: 9421 | Up: Map | Next: 9481 |
|
Used by the routines at START_GAME and DYING.
Copies the eight-byte template at PLAYER_TEMPLATE over $EA90, having patched two things into it first: the room, from $EA91, and -- into the template's last byte, not its first -- the character's sprite, worked out from the menu selection the way DRAW_LIVES does it: shift $5E00 up, mask to $30, add 8.
The first byte of the template is $66, and that is the point. A game does not begin with the player standing there; it begins with them rising out of the floor, because $66 is what MATERIALISING answers to. The character's own sprite goes into +$07, which is where FINISH_MATERIALISING looks when the animation ends.
This is the answer to something that looked like a bug early on: reading the player's sprite byte a second after starting a game gives $66, not $08, and nothing responds to the controls. Nothing is wrong -- the player has not finished arriving.
|
||||
| PLACE_PLAYER | 9443 | LD A,($5E00) | ||
| 9446 | RLCA | |||
| 9447 | AND $30 | |||
| 9449 | ADD A,$08 | |||
| 944B | LD ($9488),A | PLAYER_TEMPLATE+7: the character's sprite | ||
| 944E | LD A,($EA91) | |||
| 9451 | LD ($9482),A | PLAYER_TEMPLATE+1: the room | ||
| 9454 | LD HL,PLAYER_TEMPLATE | |||
| 9457 | LD DE,$EA90 | |||
| 945A | LD BC,$0008 | |||
| 945D | LDIR | |||
| 945F | LD A,$68 | |||
| 9461 | LD ($5E3C),A | |||
| 9464 | LD A,($5E21) | |||
| 9467 | CP $03 | |||
| 9469 | JR Z,PLACE_PLAYER_0 | |||
| 946B | PUSH IX | |||
| 946D | LD IX,$EA90 | |||
| 9471 | CALL DRAW_THING | |||
| 9474 | POP IX | |||
| PLACE_PLAYER_0 | 9476 | LD A,$F0 | ||
| 9478 | LD ($5E28),A | |||
| 947B | CALL DRAW_FOOD | |||
| 947E | JP DRAW_LIVES | |||
| Prev: 9421 | Up: Map | Next: 9481 |