![]() |
Routines |
| Prev: A631 | Up: Map | Next: A6C0 |
|
Used by the routines at OILED_ROBOT and SCENE_TOOL.
Reached when the scene after a game ends (SCENE_TOOL, OILED_ROBOT). Clears from WIPE_COUNT to the end of the object records, so the seed, the turn counter, the control method and the random number carry over, and falls into the setting up of a game at MAIN_NEW_GAME, where START joins.
A new game builds the drawing tables, has five lives, 6000 light years, and no room played yet; stirs the last game's turn count into the seed; clears the screen and shows the menu (MENU); plays the start tune; puts the robot in one of four start rooms (NEW_GAME_START); deals the valves and extra lives to their places (INIT_SPECIAL_OBJECTS); and gives every room back its colour (RESET_ROOM_COLOURS), undoing the white of the chambers activated last game.
Then three loops, one inside the other, each with its own entry: MAIN_NEW_LIFE starts a life (NEW_LIFE) and falls into MAIN_NEW_ROOM, which builds the room he is in (ENTER_ROOM) -- leaving a room comes back here from EXIT_LOW_U -- and falls into MAIN_NEXT_TURN, the start of a turn. MAIN_NEXT_OBJECT runs one record's update routine: the stack is reset to MIRROR_TABLE for every object, the address of OBJECT_DONE is pushed for the routine's RET to go to, and the record's last drawn size and place are kept (+18 to +1B into +1C to +1F) so that its old picture can be wiped. MAIN_DISPATCH jumps through UPDATES by the graphic; JUMP_THROUGH_TABLE jumps through any table of words by the index in L and the table in BC, and CALC_PLYR_DUV and SORT_AND_DRAW use it too.
Knight Lore's main and its object walk, with the clock where the sun and moon were and nothing for the cauldron; the stack is Alien 8's own, above the screen buffer, where Knight Lore's is below its variables.
|
||||
| AFTER_GAME | A647 | LD HL,WIPE_COUNT | from WIPE_COUNT up to BELOW_BLOCK | |
| A64A | LD BC,$0780 | |||
| A64D | CALL CLR_MEM | |||
|
This entry point is used by the routine at START.
|
||||
| MAIN_NEW_GAME | A650 | CALL BUILD_LOOKUP_TBLS | the tables at MIRROR_TABLE | |
| A653 | XOR A | no room played yet, so the first room built has nothing to write back | ||
| A654 | LD (PLAYED),A | |||
| A657 | LD ($CA29),A | clear the start legs' +C: not jumping, not standing | ||
| A65A | LD A,$05 | five lives: the first life takes one | ||
| A65C | LD (LIVES),A | |||
| A65F | LD HL,$0060 | 6000 light years: the first digit 6, the rest 0, none rolling | ||
| A662 | LD (CLOCK),HL | |||
| A665 | LD HL,$0000 | |||
| A668 | LD (CLOCK_LOW),HL | |||
| A66B | LD HL,SEED | stir the turn counter into the seed; it is zero on the first game after loading | ||
| A66E | LD A,(TURNS) | |||
| A671 | ADD A,(HL) | |||
| A672 | LD (HL),A | |||
| A673 | CALL CLEAR_SCRN | clear the screen, border black | ||
| A676 | CALL MENU | the menu, until 0 is pressed | ||
| A679 | LD DE,TUNE_START | the tune that plays as a game starts | ||
| A67C | CALL PLAY_TUNE | |||
| A67F | CALL NEW_GAME_START | the start records and the start room | ||
| A682 | CALL INIT_SPECIAL_OBJECTS | deal the valves and the extra lives | ||
| A685 | CALL RESET_ROOM_COLOURS | every room's colour from its record | ||
|
This entry point is used by the routine at OBJECT_DONE.
|
||||
| MAIN_NEW_LIFE | A688 | CALL NEW_LIFE | a life: the robot from the start records, a life fewer | |
|
This entry point is used by the routine at EXIT_LOW_U.
|
||||
| MAIN_NEW_ROOM | A68B | CALL ENTER_ROOM | build the room he is in | |
|
This entry point is used by the routines at OBJECT_DONE and GAME_ENDED.
|
||||
| MAIN_NEXT_TURN | A68E | LD IX,OBJECTS | the first record | |
|
This entry point is used by the routine at OBJECT_DONE.
|
||||
| MAIN_NEXT_OBJECT | A692 | LD SP,MIRROR_TABLE | a fresh stack for every object | |
| A695 | LD HL,OBJECT_DONE | its update routine returns to OBJECT_DONE | ||
| A698 | PUSH HL | |||
| A699 | LD A,(IX+$18) | keep last turn's size and place on the screen, to wipe | ||
| A69C | LD (IX+$1C),A | |||
| A69F | LD A,(IX+$19) | |||
| A6A2 | LD (IX+$1D),A | |||
| A6A5 | LD A,(IX+$1A) | |||
| A6A8 | LD (IX+$1E),A | |||
| A6AB | LD A,(IX+$1B) | |||
| A6AE | LD (IX+$1F),A | |||
|
This entry point is used by the routine at PLAYER_APPEARED.
|
||||
| MAIN_DISPATCH | A6B1 | LD L,(IX+$00) | the graphic indexes UPDATES | |
| A6B4 | LD BC,UPDATES | |||
|
This entry point is used by the routines at CALC_PLYR_DUV and SORT_AND_DRAW.
|
||||
| JUMP_THROUGH_TABLE | A6B7 | LD H,$00 | HL = BC + 2 * L; jump to the word there | |
| A6B9 | ADD HL,HL | |||
| A6BA | ADD HL,BC | |||
| A6BB | LD A,(HL) | |||
| A6BC | INC HL | |||
| A6BD | LD H,(HL) | |||
| A6BE | LD L,A | |||
| A6BF | JP (HL) | |||
| Prev: A631 | Up: Map | Next: A6C0 |