![]() |
Routines |
| Prev: DC97 | Up: Map | Next: DD72 |
|
Used by the routine at PlayLife.
Sets up the screen at the start of each life. It shows the fuel gauge as empty but fills the tank, so the gauge fills up, and chooses the attributes for the planet. It restores the position of the ship from the state of the current player (which starts at CurrentPlayerState) and makes the tiles for that position. It builds the ship with BuildShip and puts back any item that it was carrying. It then drops into the loop at ScrollInWorld that scrolls the world until the ship is in place.
|
||||
| BeginLife | DCA1 | LD A,$BE | A=BE. | |
| DCA3 | LD ($CC62),A | Update the fuel gauge row. | ||
| DCA6 | LD HL,$4200 | HL=4200. | ||
| DCA9 | LD ($CC4B),HL | Update the fuel level. | ||
| DCAC | XOR A | Clear A. | ||
| DCAD | LD ($F111),A | Clear the background attribute. | ||
| DCB0 | CALL ColourPlayfield | Call ColourPlayfield. | ||
| DCB3 | LD A,($F5F9) | The planet number, from 00 to 04. | ||
| DCB6 | ADD A,A | Double A. | ||
| DCB7 | LD HL,$DC97 | The planet attributes. | ||
| DCBA | CALL AddAToHL | Call AddAToHL. | ||
| DCBD | LD A,(HL) | Read HL. | ||
| DCBE | LD ($DC95),A | Update the sky attribute. | ||
| DCC1 | INC HL | Advance HL. | ||
| DCC2 | LD A,(HL) | Read HL. | ||
| DCC3 | LD ($DC96),A | Update the underground attribute. | ||
| DCC6 | LD A,($DC95) | The sky attribute. | ||
| DCC9 | LD B,A | B=A. | ||
| DCCA | LD A,($F5FB) | The map row of the position that the ship restarts at. | ||
| DCCD | CP $0C | Jump to BeginLife_Attributes if A is less than 0C. | ||
| DCCF | JR C,BeginLife_Attributes | |||
| DCD1 | LD A,($DC96) | The underground attribute. | ||
| DCD4 | LD B,A | B=A. | ||
| DCD5 | LD HL,$F628 | The tenth item site. | ||
| DCD8 | RES 7,(HL) | Reset bit 7 of the byte at the address in HL. | ||
| DCDA | LD HL,$F62C | The eleventh item site. | ||
| DCDD | RES 7,(HL) | Reset bit 7 of the byte at the address in HL. | ||
| DCDF | XOR A | Clear A. | ||
| DCE0 | LD ($F5F7),A | Update the flag set when item 09 has been picked up. | ||
| BeginLife_Attributes | DCE3 | LD A,B | A=B. | |
| DCE4 | LD ($F111),A | The background attribute. | ||
| DCE7 | LD A,($F5FC) | The position of the ship: horizontal then vertical. | ||
| DCEA | AND %00000001 | Keep the bits of A that are set in 01. | ||
| DCEC | XOR %00000001 | Flip the bits of A that are set in 01. | ||
| DCEE | LD ($DDF2),A | Update the chequered floor flag. | ||
| DCF1 | JR Z,BeginLife_Position | Jump to BeginLife_Position if the zero flag is set. | ||
| DCF3 | LD HL,$57C1 | HL=57C1. | ||
| DCF6 | LD C,$50 | C=50. | ||
| BeginLife_Row | DCF8 | LD B,$1C | B=1C. | |
| DCFA | PUSH HL | Stash HL on the stack. | ||
| BeginLife_Cell | DCFB | LD (HL),$55 | Store 55 at the address in HL. | |
| DCFD | DEC H | Step H back. | ||
| DCFE | LD (HL),$AA | Store AA at the address in HL. | ||
| DD00 | INC H | Advance H. | ||
| DD01 | INC HL | Advance HL. | ||
| DD02 | DJNZ BeginLife_Cell | Decrease B and jump to BeginLife_Cell until none remain. | ||
| DD04 | POP HL | Bring HL back off the stack. | ||
| DD05 | DEC H | Step H back. | ||
| DD06 | CALL MoveUpARow | Call MoveUpARow. | ||
| DD09 | DEC C | Step C back. | ||
| DD0A | JR NZ,BeginLife_Row | Jump to BeginLife_Row if the zero flag is clear. | ||
| BeginLife_Position | DD0C | LD HL,($F5FA) | Fetch the word at F5FA into HL. | |
| DD0F | INC H | Advance H. | ||
| DD10 | LD ($CE57),HL | Update the map position. | ||
| DD13 | LD HL,($F5FC) | Fetch the word at F5FC into HL. | ||
| DD16 | LD A,L | A=L. | ||
| DD17 | AND %11111110 | Keep the bits of A that are set in FE. | ||
| DD19 | LD L,A | L=A. | ||
| DD1A | LD ($CE45),HL | Update the position across. | ||
| DD1D | LD HL,($F5FE) | Fetch the word at F5FE into HL. | ||
| DD20 | LD ($CE41),HL | Update the horizontal offset. | ||
| DD23 | LD A,$02 | A=02. | ||
| DD25 | BIT 1,H | Jump to BeginLife_Speed if bit 1 of H is set. | ||
| DD27 | JR NZ,BeginLife_Speed | |||
| DD29 | ADD A,A | Double A. | ||
| BeginLife_Speed | DD2A | LD ($CCBA),A | Update the vertical scroll speed. | |
| DD2D | LD A,$FF | A=FF. | ||
| DD2F | LD ($5C3C),A | Update the scroll-in flag. | ||
| DD32 | LD HL,($CE57) | Fetch the word at MapPosition into HL. | ||
| DD35 | CALL MakeTiles | Call MakeTiles. | ||
| DD38 | XOR A | Clear A. | ||
| DD39 | LD ($CCBB),A | Update the horizontal scroll speed. | ||
| DD3C | LD A,$60 | A=60. | ||
| DD3E | LD ($C902),A | The column the ship starts drawn at. | ||
| DD41 | LD BC,$012C | BC=012C. | ||
| DD44 | LD HL,$F6B9 | The ship work area. | ||
| BeginLife_Clear | DD47 | LD (HL),$00 | Store 00 at the address in HL. | |
| DD49 | INC HL | Advance HL. | ||
| DD4A | DEC BC | Step BC back. | ||
| DD4B | LD A,B | A=B. | ||
| DD4C | OR C | Set the bits of A that are set in C. | ||
| DD4D | JR NZ,BeginLife_Clear | Jump to BeginLife_Clear if the zero flag is clear. | ||
| DD4F | CALL BuildShip | Call BuildShip. | ||
| DD52 | LD A,($F601) | The carried item. | ||
| DD55 | INC A | Advance A. | ||
| DD56 | JR Z,BeginLife_Continue | Jump to BeginLife_Continue if the zero flag is set. | ||
| DD58 | DEC A | Step A back. | ||
| DD59 | OR %11000000 | Set the bits of A that are set in C0. | ||
| DD5B | LD ($C904),A | Update the item the ship is about to pick up. | ||
| DD5E | CALL BuildCarriedItemGraphic | Call BuildCarriedItemGraphic. | ||
| BeginLife_Continue | DD61 | XOR A | Clear A. | |
| DD62 | LD ($C904),A | Update the item the ship is about to pick up. | ||
| DD65 | CALL BuildStackGraphic | Call BuildStackGraphic. | ||
| DD68 | LD A,($5C38) | The ship row. | ||
| DD6B | SUB $09 | Subtract 09 from A. | ||
| DD6D | LD ($C7BE),A | The row of the carried item. | ||
| DD70 | LD B,$28 | B=28. | ||
|
Continue on to ScrollInWorld.
|
||||
| Prev: DC97 | Up: Map | Next: DD72 |