| Alien (BUGFIX 1.7) | Routines |
| Prev: 36448 | Up: Map | Next: 36579 |
|
Main game entry point. Initialises the stack, runs the title and options screens, then enters the per-frame main loop. The loop calls every major subsystem once per frame and repeats indefinitely.
The loop is NOT synced to the 50 Hz interrupt: an idle iteration contains two ~36 ms BusyWait delays (via FrameTiming and PlayMusic) plus the real work, and measures ~260,000 T-states ≈ 74 ms ≈ 13.5 iterations/s (skoolkit-simulator median over 200 idle gameplay passes). Every "frame" timer in the game counts these ~74 ms loop passes, and a queued sound effect stretches its iteration by another ~0.25 s.
|
||||
| 36457 | LD SP,65530 | stack at $FFFA (top of game RAM, below extra data) | ||
| 36460 | CALL 33600 | ResetScriptPtr: seed ROM-traversal script pointer | ||
| 36463 | CALL 42581 | DrawIntroScreen: animated Alien title screen | ||
| 36466 | CALL 42821 | GameModeScreen: crew roster + game-mode menu | ||
| 36469 | CALL 43610 | OptionsScreen: difficulty selection (keys 1-4) | ||
| 36472 | CALL 44561 | ScreenTransition: wipe to black, set white attributes | ||
| 36475 | CALL 45401 | UpdateAllCrew: pairwise companion morale support | ||
| 36478 | CALL 31417 | InitGameView: draw initial corridor view | ||
|
Main per-frame loop body. Re-entered every frame via JR back to here.
|
||||
| 36481 | CALL 34684 | HandleInput: scan keyboard, dispatch crew movement | ||
| 36484 | CALL 40319 | FrameTiming: ~36ms busy-wait or play queued sound | ||
| 36487 | CALL 40826 | UpdateAndroid: activate the Android once the alien event has fired | ||
| 36490 | CALL 41264 | TriggerAlienEvent: poll alien event timer | ||
| 36493 | CALL 37018 | UpdateAlienAI: give the idle alien its next action | ||
| 36496 | CALL 37363 | TickMessageQueue: tick the queued per-crew animation slots | ||
| 36499 | CALL 36859 | UpdateJones: walk Jones the cat one room when due | ||
| 36502 | CALL 35973 | ResetCrewTimers / corridor pass 1 | ||
| 36505 | CALL 34967 | AnimateCrewA: XOR-blit crew sprite set A (10-frame) | ||
| 36508 | CALL 35016 | AnimateCrewB: XOR-blit cursor / sprite set B (5-frame) | ||
| 36511 | CALL 44880 | PlayMusic: emit one beeper note from current phrase | ||
| 36514 | CALL 34967 | AnimateCrewA: second blit erases via XOR (double-buf) | ||
| 36517 | CALL 35016 | AnimateCrewB: second blit erases via XOR | ||
| 36520 | CALL 37363 | TickMessageQueue: second animation-tick pass | ||
| 36523 | CALL 38379 | UpdateRoomActors: corridor advance / room actor logic | ||
| 36526 | CALL 44313 | CheckCrewAlive: end the game if no human survives | ||
| 36529 | LD BC,63486 | BC = port 63486 ($F7FE): keyboard half-row 1-5 | ||
| 36532 | IN A,(C) | read key row (active-low: 0 = key pressed) | ||
| 36534 | BIT 0,A | test key 1 (pause / restart) | ||
| 36536 | CALL Z,44815 | key 1 down → open PauseMenu | ||
| 36539 | CALL 33589 | AdvanceScriptPtr: consume next ROM script nibble | ||
| 36542 | CP 0 | nibble 0 = no-op | ||
| 36544 | CALL Z,33589 | skip a second nibble | ||
| 36547 | CP 0 | |||
| 36549 | CALL Z,33600 | two consecutive 0s → ResetScriptPtr (reseed from FRAMES) | ||
| 36552 | JR 36481 | tail-loop back to the start of the per-frame body | ||
|
PreActionCheck's Android branch (see 36579): the Android quietly disobeys an ATTACK order.
|
||||
| 36554 | LD A,(IX+3) | Android ordered to ATTACK (state 4)? | ||
| 36557 | CP 4 | |||
| 36559 | JR NZ,36574 | |||
| 36561 | CALL 36717 | yes: it disobeys — pick a random room | ||
| 36564 | LD (IX+3),1 | and wander there instead (state 1) | ||
| 36568 | LD (IX+0),20 | in 20 frames | ||
| 36572 | XOR A | A = 0: cancel this dispatch | ||
| 36573 | RET | |||
| 36574 | CP 3 | other Android states: 3+ fire as-is, | ||
| 36576 | RET NC | |||
| 36577 | JR 36611 | 1-2 go through the destination checks | ||
| Prev: 36448 | Up: Map | Next: 36579 |