![]() |
Routines |
| Prev: 56471 | Up: Map | Next: 56690 |
|
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 | 56481 | LD A,190 | A=190. | |
| 56483 | LD (52322),A | Update the fuel gauge row. | ||
| 56486 | LD HL,16896 | HL=16896. | ||
| 56489 | LD (52299),HL | Update the fuel level. | ||
| 56492 | XOR A | Clear A. | ||
| 56493 | LD (61713),A | Clear the background attribute. | ||
| 56496 | CALL ColourPlayfield | Call ColourPlayfield. | ||
| 56499 | LD A,(62969) | The planet number, from 0 to 4. | ||
| 56502 | ADD A,A | Double A. | ||
| 56503 | LD HL,56471 | The planet attributes. | ||
| 56506 | CALL AddAToHL | Call AddAToHL. | ||
| 56509 | LD A,(HL) | Read HL. | ||
| 56510 | LD (56469),A | Update the sky attribute. | ||
| 56513 | INC HL | Advance HL. | ||
| 56514 | LD A,(HL) | Read HL. | ||
| 56515 | LD (56470),A | Update the underground attribute. | ||
| 56518 | LD A,(56469) | The sky attribute. | ||
| 56521 | LD B,A | B=A. | ||
| 56522 | LD A,(62971) | The map row of the position that the ship restarts at. | ||
| 56525 | CP 12 | Jump to BeginLife_Attributes if A is less than 12. | ||
| 56527 | JR C,BeginLife_Attributes | |||
| 56529 | LD A,(56470) | The underground attribute. | ||
| 56532 | LD B,A | B=A. | ||
| 56533 | LD HL,63016 | The tenth item site. | ||
| 56536 | RES 7,(HL) | Reset bit 7 of the byte at the address in HL. | ||
| 56538 | LD HL,63020 | The eleventh item site. | ||
| 56541 | RES 7,(HL) | Reset bit 7 of the byte at the address in HL. | ||
| 56543 | XOR A | Clear A. | ||
| 56544 | LD (62967),A | Update the flag set when item 9 has been picked up. | ||
| BeginLife_Attributes | 56547 | LD A,B | A=B. | |
| 56548 | LD (61713),A | The background attribute. | ||
| 56551 | LD A,(62972) | The position of the ship: horizontal then vertical. | ||
| 56554 | AND %00000001 | Keep the bits of A that are set in 1. | ||
| 56556 | XOR %00000001 | Flip the bits of A that are set in 1. | ||
| 56558 | LD (56818),A | Update the chequered floor flag. | ||
| 56561 | JR Z,BeginLife_Position | Jump to BeginLife_Position if the zero flag is set. | ||
| 56563 | LD HL,22465 | HL=22465. | ||
| 56566 | LD C,80 | C=80. | ||
| BeginLife_Row | 56568 | LD B,28 | B=28. | |
| 56570 | PUSH HL | Stash HL on the stack. | ||
| BeginLife_Cell | 56571 | LD (HL),85 | Store 85 at the address in HL. | |
| 56573 | DEC H | Step H back. | ||
| 56574 | LD (HL),170 | Store 170 at the address in HL. | ||
| 56576 | INC H | Advance H. | ||
| 56577 | INC HL | Advance HL. | ||
| 56578 | DJNZ BeginLife_Cell | Decrease B and jump to BeginLife_Cell until none remain. | ||
| 56580 | POP HL | Bring HL back off the stack. | ||
| 56581 | DEC H | Step H back. | ||
| 56582 | CALL MoveUpARow | Call MoveUpARow. | ||
| 56585 | DEC C | Step C back. | ||
| 56586 | JR NZ,BeginLife_Row | Jump to BeginLife_Row if the zero flag is clear. | ||
| BeginLife_Position | 56588 | LD HL,(62970) | Fetch the word at 62970 into HL. | |
| 56591 | INC H | Advance H. | ||
| 56592 | LD (52823),HL | Update the map position. | ||
| 56595 | LD HL,(62972) | Fetch the word at 62972 into HL. | ||
| 56598 | LD A,L | A=L. | ||
| 56599 | AND %11111110 | Keep the bits of A that are set in 254. | ||
| 56601 | LD L,A | L=A. | ||
| 56602 | LD (52805),HL | Update the position across. | ||
| 56605 | LD HL,(62974) | Fetch the word at 62974 into HL. | ||
| 56608 | LD (52801),HL | Update the horizontal offset. | ||
| 56611 | LD A,2 | A=2. | ||
| 56613 | BIT 1,H | Jump to BeginLife_Speed if bit 1 of H is set. | ||
| 56615 | JR NZ,BeginLife_Speed | |||
| 56617 | ADD A,A | Double A. | ||
| BeginLife_Speed | 56618 | LD (52410),A | Update the vertical scroll speed. | |
| 56621 | LD A,255 | A=255. | ||
| 56623 | LD (23612),A | Update the scroll-in flag. | ||
| 56626 | LD HL,(52823) | Fetch the word at MapPosition into HL. | ||
| 56629 | CALL MakeTiles | Call MakeTiles. | ||
| 56632 | XOR A | Clear A. | ||
| 56633 | LD (52411),A | Update the horizontal scroll speed. | ||
| 56636 | LD A,96 | A=96. | ||
| 56638 | LD (51458),A | The column the ship starts drawn at. | ||
| 56641 | LD BC,300 | BC=300. | ||
| 56644 | LD HL,63161 | The ship work area. | ||
| BeginLife_Clear | 56647 | LD (HL),0 | Store 0 at the address in HL. | |
| 56649 | INC HL | Advance HL. | ||
| 56650 | DEC BC | Step BC back. | ||
| 56651 | LD A,B | A=B. | ||
| 56652 | OR C | Set the bits of A that are set in C. | ||
| 56653 | JR NZ,BeginLife_Clear | Jump to BeginLife_Clear if the zero flag is clear. | ||
| 56655 | CALL BuildShip | Call BuildShip. | ||
| 56658 | LD A,(62977) | The carried item. | ||
| 56661 | INC A | Advance A. | ||
| 56662 | JR Z,BeginLife_Continue | Jump to BeginLife_Continue if the zero flag is set. | ||
| 56664 | DEC A | Step A back. | ||
| 56665 | OR %11000000 | Set the bits of A that are set in 192. | ||
| 56667 | LD (51460),A | Update the item the ship is about to pick up. | ||
| 56670 | CALL BuildCarriedItemGraphic | Call BuildCarriedItemGraphic. | ||
| BeginLife_Continue | 56673 | XOR A | Clear A. | |
| 56674 | LD (51460),A | Update the item the ship is about to pick up. | ||
| 56677 | CALL BuildStackGraphic | Call BuildStackGraphic. | ||
| 56680 | LD A,(23608) | The ship row. | ||
| 56683 | SUB 9 | Subtract 9 from A. | ||
| 56685 | LD (51134),A | The row of the carried item. | ||
| 56688 | LD B,40 | B=40. | ||
|
Continue on to ScrollInWorld.
|
||||
| Prev: 56471 | Up: Map | Next: 56690 |