| Routines

F0BE: End a cutscene

Used by the routine at 790D. Ends the cutscene by entering demo mode or resuming the game in the next mode.
F0BE | CALL $EAD9 | Check the keyboard (to flush any recent keypress)
F0C1 | LD HL,($7F9E) | 7F9E holds the number of bucks Sam has left
F0C4 | LD A,H | Has Sam's cash supply run out?
F0C5 | OR L
F0C6 | JR Z,$F0D3 | Jump if so
F0C8 | LD HL,$7F5F | Set every bit of the screen refresh buffer so that the entire display will be updated
F0CB | LD (HL),$FF
F0CD | DEC L
F0CE | JR NZ,$F0CB
F0D0 | JP $EA80 | Update the display
Sam is out of money, so it must be the end of the game. Time to check for a new high score and enter demo mode.
F0D3 | LD HL,($FFEC) | Collect the old high score from FFEC
F0D6 | LD DE,($7F9C) | Collect the score from 7F9C
F0DA | SBC HL,DE | Do we have a new high score?
F0DC | JR NC,$F0E7 | Jump if not
F0DE | LD ($FFEC),DE | Otherwise set the new high score
F0E2 | JR $F0E7 | Jump forward to enter demo mode
This entry point is used by the routine at F0A0 and by the unused routine at F0AC.
F0E4 | CALL $DD00 | This startup routine prepares the bottom 4 lines of the screen just after the game has loaded
F0E7 | XOR A | A=0 (demo mode)
F0E8 | JR $F0EC |
This entry point is used by the routine at 7996 to start a new game.
F0EA | LD A,$01 | A=1 (new game)
F0EC | LD ($FFEE),A | Store the game mode (0 or 1) at FFEE, from where it will be copied to 7FEE
F0EF | LD SP,$5D5A | Reset the stack pointer
F0F2 | NOP |
F0F3 | CALL $F8AE | Prepare for demo mode or a new game
F0F6 | JP $F03F | Enter the main loop