Routines |
Prev: $00FF | Up: Map | Next: $09E8 |
We start here after the game has loaded.
|
||||
$0800 | JSR $2CD9 | Initialise interrupts, screen memory and page 0. | ||
This entry point is used by the routine at $2757 to enter demo mode after a game has ended.
|
||||
$0803 | LDA $46 | Pick up the game mode indicator from $46. | ||
$0805 | BEQ $080A | Branch if we're in demo mode. | ||
$0807 | JSR $BE09 | Change the characters' names if required. | ||
$080A | JSR $3AD5 | Change the lesson. | ||
$080D | JSR $BA00 | Play the theme tune. | ||
$0810 | JSR $3012 | Bring the skool into view. | ||
The main loop proper starts here.
|
||||
$0813 | LDA #$01 | Initialise the timing counter at $2E to 1. | ||
$0815 | STA $2E | |||
$0817 | DEC $FD | Decrement the LSB of the lesson clock at $FD. | ||
$0819 | BNE $0822 | Branch unless it's zero. | ||
$081B | DEC $40 | Decrement the MSB of the lesson clock at $40. | ||
$081D | BNE $0822 | Branch unless it's zero. | ||
$081F | JSR $3AD5 | Change the lesson. | ||
$0822 | JSR $149F | Make any nearby teacher give ERIC lines if necessary. | ||
$0825 | JSR $BD00 | Manage any sound effect that is currently playing. | ||
$0828 | LDA $2B | Pick up ERIC's status flags from $2B. | ||
$082A | BEQ $083E | Branch if ERIC is walking or standing still. | ||
$082C | JSR $15B3 | Deal with ERIC if he's doing something other than walking or standing still. | ||
$082F | JSR $3AB4 | Move four characters. | ||
$0832 | JSR $3AB4 | |||
$0835 | JSR $3AB4 | |||
$0838 | JSR $3AB4 | |||
$083B | JMP $0916 | Jump forward. | ||
$083E | JSR $3AB4 | Move four characters. | ||
$0841 | JSR $3AB4 | |||
$0844 | JSR $3AB4 | |||
$0847 | JSR $3AB4 | |||
$084A | LDA #$80 | Set voice #3 control register: voice off, noise enabled. | ||
$084C | STA $D412 | |||
$084F | DEC $E5 | Decrement ERIC's midstride and input timer at $E5. | ||
$0851 | BEQ $0856 | Branch if it's zero now. | ||
$0853 | JMP $0916 | Otherwise jump forward to update the display before returning to the start of the main loop. | ||
The timer at $E5 has reached zero. Time to either move ERIC from the midstride position or check for input from the keyboard or joystick.
|
||||
$0856 | LDA $46 | Pick up the game mode indicator from $46. | ||
$0858 | BNE $0870 | Branch unless we're in demo mode. | ||
$085A | LDA $4C | Copy the keyboard/joystick reading from $4C to $C5 and reset $4C to zero. | ||
$085C | STA $C5 | |||
$085E | LDY #$00 | |||
$0860 | STY $4C | |||
$0862 | LDA $C5 | Pick up the keyboard/joystick reading from $C5. | ||
$0864 | BEQ $086D | Branch if there was no keyboard or joystick input. | ||
$0866 | LDA #$01 | Set the game mode indicator at $46 to 1. | ||
$0868 | STA $46 | |||
$086A | JMP $0803 | Jump back to start a new game. | ||
$086D | JMP $0920 | Jump forward to continue with demo mode. | ||
$0870 | LDA $60 | Pick up the current character number from $60. | ||
$0872 | PHA | Save it temporarily. | ||
$0873 | LDA #$14 | Character number $14 is ERIC. | ||
$0875 | STA $60 | Update the current character number at $60. | ||
$0877 | JSR $3279 | Copy ERIC's character buffer into page 0. | ||
$087A | LDA $4B | Pick up ERIC's midstride indicator from $4B. | ||
$087C | BEQ $0881 | Branch if it's zero (ERIC is not midstride). | ||
$087E | JMP $08FF | Otherwise jump forward to move ERIC from the midstride position. | ||
Now we check for input from the keyboard or joystick.
|
||||
$0881 | LDA $4C | Copy the keyboard/joystick reading from $4C to $C5 and then reset $4C to zero. | ||
$0883 | STA $C5 | |||
$0885 | LDY #$00 | |||
$0887 | STY $4C | |||
$0889 | LDA $C5 | Pick up the keyboard/joystick reading from $C5. | ||
$088B | BNE $0890 | Branch if there was any input. | ||
$088D | JMP $08FA | Otherwise jump forward. | ||
$0890 | LDA #$04 | Reset ERIC's midstride and input timer at $E5 to 4. | ||
$0892 | STA $E5 | |||
$0894 | LDA $C5 | Pick up the keyboard/joystick reading from $C5. | ||
$0896 | AND #$7F | Clear bit 7 (which is set for joystick input). | ||
$0898 | CMP #$4F | Was 'O' pressed or the joystick moved left? | ||
$089A | BNE $08A2 | Branch if not. | ||
$089C | JSR $3558 | Handle this keypress ('O', left). | ||
$089F | JMP $0910 | Jump forward. | ||
$08A2 | CMP #$50 | Was 'P' pressed or the joystick moved right? | ||
$08A4 | BNE $08AC | Branch if not. | ||
$08A6 | JSR $359E | Handle this keypress ('P', right). | ||
$08A9 | JMP $0910 | Jump forward. | ||
$08AC | CMP #$51 | Was 'Q' pressed or the joystick moved up? | ||
$08AE | BNE $08B6 | Branch if not. | ||
$08B0 | JSR $350B | Handle this keypress ('Q', up). | ||
$08B3 | JMP $0910 | Jump forward. | ||
$08B6 | CMP #$41 | Was 'A' pressed or the joystick moved down? | ||
$08B8 | BNE $08C0 | Branch if not. | ||
$08BA | JSR $34B5 | Handle this keypress ('A', down). | ||
$08BD | JMP $0910 | Jump forward. | ||
$08C0 | CMP #$53 | Was 'S' (sit/stand) pressed? | ||
$08C2 | BNE $08CA | Branch if not. | ||
$08C4 | JSR $3687 | Handle this keypress ('S', sit/stand). | ||
$08C7 | JMP $0910 | Jump forward. | ||
$08CA | CMP #$48 | Was 'H' (hit) pressed? | ||
$08CC | BNE $08D4 | Branch if not. | ||
$08CE | JSR $16DF | Handle this keypress ('H', hit). | ||
$08D1 | JMP $0910 | Jump forward. | ||
$08D4 | CMP #$57 | Was 'W' (write) pressed? | ||
$08D6 | BNE $08DE | Branch if not. | ||
$08D8 | JSR $19A5 | Handle this keypress ('W', write). | ||
$08DB | JMP $0910 | Jump forward. | ||
$08DE | CMP #$4A | Was 'J' (jump) pressed? | ||
$08E0 | BEQ $08E6 | Branch if so. | ||
$08E2 | CMP #$4C | Was 'L' (jump) pressed? | ||
$08E4 | BNE $08EC | Branch if not. | ||
$08E6 | JSR $16D0 | Handle this keypress ('J' or 'L', jump). | ||
$08E9 | JMP $0910 | Jump forward. | ||
$08EC | CMP #$46 | Was 'F' or the joystick fire button pressed? | ||
$08EE | BEQ $08F4 | Branch if so. | ||
$08F0 | CMP #$20 | Was SPACE (fire catapult) pressed? | ||
$08F2 | BNE $08F7 | Branch if not. | ||
$08F4 | JSR $169B | Handle this keypress ('F' or SPACE, fire). | ||
$08F7 | JMP $0910 | Jump forward. | ||
There was no keyboard input or joystick movement.
|
||||
$08FA | INC $E5 | Increment ERIC's midstride and input timer at $E5 to 1. | ||
$08FC | JMP $0910 | Jump forward. | ||
ERIC is midstride.
|
||||
$08FF | LDA #$04 | Reset ERIC's midstride and input timer at $E5 to 4. | ||
$0901 | STA $E5 | |||
$0903 | LDA #$00 | Clear ERIC's midstride indicator at $4B. | ||
$0905 | STA $4B | |||
$0907 | JSR $35EF | Move ERIC from the midstride position. | ||
$090A | PLA | Restore the current character number to $60. | ||
$090B | STA $60 | |||
$090D | JMP $0919 | Jump forward. | ||
$0910 | JSR $33BF | Restore ERIC's character buffer from page 0. | ||
$0913 | PLA | Restore the current character number to $60. | ||
$0914 | STA $60 | |||
$0916 | JSR $31EA | Update the display. | ||
$0919 | LDA $2E | Wait until the interrupt routine at $39C7 has decremented the timing counter at $2E below 0. | ||
$091B | BPL $0919 | |||
$091D | JMP $0813 | Jump back to the start of the main loop. | ||
We're in demo mode and there was no keyboard or joystick input.
|
||||
$0920 | LDA #$00 | Set the score at $7C to zero. | ||
$0922 | STA $7D | |||
$0924 | STA $7C | |||
$0926 | STA $7F | Set the lines total at $7E to zero. | ||
$0928 | STA $7E | |||
$092A | LDA $60 | Pick up the current character number from $60 and save it temporarily. | ||
$092C | PHA | |||
$092D | LDA #$14 | Set the current character number at $60 to $14 (ERIC). | ||
$092F | STA $60 | |||
$0931 | JSR $3279 | Copy ERIC's character buffer to page 0. | ||
$0934 | LDA $4B | Pick up ERIC's midstride indicator from $4B. | ||
$0936 | BEQ $093A | Branch if it's zero (ERIC is not midstride). | ||
$0938 | BNE $08FF | Otherwise branch back to move ERIC from the midstride position. | ||
$093A | LDA $26 | Pick up ERIC's animatory state from $26. | ||
$093C | CMP #$05 | Is ERIC sitting on a chair? | ||
$093E | BEQ $094C | Branch if so. | ||
$0940 | LDA $14 | Pick up ERIC's posture indicator from $14. | ||
$0942 | BEQ $095C | Branch if ERIC is not standing up. | ||
$0944 | LDA $2B | Pick up ERIC's status flags from $2B. | ||
$0946 | AND #$10 | Has ERIC just been knocked down or unseated? | ||
$0948 | BNE $095C | Branch if so. | ||
$094A | BEQ $0972 | Otherwise branch forward. | ||
$094C | LDA #$0A | Set the current character number at $60 to $0A (little boy no. 11). | ||
$094E | STA $60 | |||
$0950 | JSR $3279 | Copy little boy no. 11's character buffer to page 0. | ||
$0953 | LDA $26 | Pick up little boy no. 11's animatory state from $26. | ||
$0955 | CMP #$45 | Is he sitting on a chair? | ||
$0957 | BNE $095C | Branch if not. | ||
$0959 | JMP $09DE | Jump forward. | ||
ERIC is sitting in a chair, but little boy no. 11 isn't. ERIC should stand up now or soon.
|
||||
$095C | LDA $81 | Pick up ERIC's stand-up delay counter from $81. | ||
$095E | BNE $0967 | Branch unless it's zero at the moment. | ||
$0960 | LDA #$40 | Initialise ERIC's stand-up delay counter at $81 to $40 (little boy no. 11 has only just stood up). | ||
$0962 | STA $81 | |||
$0964 | JMP $09DE | Jump forward. | ||
$0967 | DEC $81 | Decrement ERIC's stand-up delay counter at $81. | ||
$0969 | BNE $0959 | Branch unless it's time for ERIC to stand up. | ||
$096B | LDA #$53 | Store the code for 'S' (sit/stand) at $C5. | ||
$096D | STA $C5 | |||
$096F | JMP $09D4 | Jump forward. | ||
$0972 | LDA #$0A | Character number $0A is little boy no. 11. Store this character number at $4D for the following subroutine call. | ||
$0974 | STA $4D | |||
$0976 | JSR $1B2E | Determine ERIC's next move in his pursuit of little boy no. 11. | ||
$0979 | BEQ $09AD | Branch if ERIC will stay where he is. | ||
$097B | CMP #$01 | Should ERIC go (or continue going) upstairs? | ||
$097D | BNE $0984 | Branch if not. | ||
$097F | LDA #$51 | This is the code for 'Q' (up). | ||
$0981 | JMP $0998 | Jump forward to store this code at $C5. | ||
$0984 | CMP #$02 | Should ERIC go (or continue going) downstairs? | ||
$0986 | BNE $098D | Branch if not. | ||
$0988 | LDA #$41 | This is the code for 'A' (down). | ||
$098A | JMP $0998 | Jump forward to store this code at $C5. | ||
$098D | CMP #$03 | Should ERIC go left? | ||
$098F | BNE $0996 | Branch if not. | ||
$0991 | LDA #$4F | This is the code for 'O' (left). | ||
$0993 | JMP $0998 | Jump forward to store this code at $C5. | ||
$0996 | LDA #$50 | This is the code for 'P' (right). | ||
$0998 | STA $C5 | Store the code for the simulated keypress at $C5. | ||
$099A | LDA $82 | Pick up the value of the interrupt counter from $82. | ||
$099C | CMP #$81 | Is it $81 or more? | ||
$099E | BCS $09A3 | Branch if so. | ||
$09A0 | JMP $09D4 | Otherwise jump forward. | ||
$09A3 | LDA #$80 | Set bit 7 of the simulated keyboard/joystick reading at $C5. This makes ERIC move faster. | ||
$09A5 | CLC | |||
$09A6 | ADC $C5 | |||
$09A8 | STA $C5 | |||
$09AA | JMP $09D4 | Jump forward. | ||
$09AD | LDA #$0A | Set the current character number at $60 to $0A (little boy no. 11). | ||
$09AF | STA $60 | |||
$09B1 | JSR $3279 | Copy little boy no. 11's character buffer to page 0. | ||
$09B4 | LDA $26 | Pick up little boy no. 11's animatory state from $26. | ||
$09B6 | CMP #$45 | Is little boy no. 11 sitting on a chair? | ||
$09B8 | BEQ $09BD | Branch if so. | ||
$09BA | JMP $09DE | Otherwise jump forward. | ||
$09BD | LDA #$14 | Set the current character number at $60 to $14 (ERIC). | ||
$09BF | STA $60 | |||
$09C1 | JSR $3279 | Copy ERIC's character buffer to page 0. | ||
$09C4 | LDA $26 | Pick up ERIC's animatory state from $26. | ||
$09C6 | ASL A | Is ERIC facing left? | ||
$09C7 | BCC $09D0 | Branch if so. | ||
$09C9 | LDA #$4F | Store the code for 'O' (left) at $C5. This will make ERIC turn round and face left. | ||
$09CB | STA $C5 | |||
$09CD | JMP $09D4 | Jump forward. | ||
$09D0 | LDA #$53 | Store the code for 'S' (sit/stand) at $C5. | ||
$09D2 | STA $C5 | |||
$09D4 | LDA #$14 | Set the current character number at $60 to $14 (ERIC). | ||
$09D6 | STA $60 | |||
$09D8 | JSR $3279 | Copy ERIC's character buffer to page 0. | ||
$09DB | JMP $0890 | Jump back. | ||
$09DE | LDA #$14 | Set the current character number at $60 to $14 (ERIC). | ||
$09E0 | STA $60 | |||
$09E2 | JSR $3279 | Copy ERIC's character buffer to page 0. | ||
$09E5 | JMP $08FA | Jump back. |
Prev: $00FF | Up: Map | Next: $09E8 |