![]() |
Routines |
Prev: 26836 | Up: Map |
This section of code is entered at various points. The main entry point below is used by the startup routine at 24288.
|
|||||||
26880 | LD SP,23806 | Put the stack pointer somewhere safe | |||||
26883 | CALL 32390 | Play the theme tune | |||||
26886 | JR 26902 | Enter demo mode | |||||
This entry point is used by the routine at 63990 when ERIC has been sent home (either for having mumps or for having over 10000 lines).
|
|||||||
26888 | CALL 32470 | Remove the speech bubble | |||||
26891 | LD DE,(32708) | DE=score | |||||
26895 | AND A | Reset the carry flag ready for a subtraction | |||||
26896 | SBC HL,DE | Subtract the score from the high score... | |||||
26898 | ADD HL,DE | ...and add it back again | |||||
26899 | JR NC,26902 | Jump unless we have a new high score | |||||
26901 | EX DE,HL | HL=new high score | |||||
26902 | LD A,255 | 255: demo mode | |||||
26904 | JR 26913 | ||||||
This entry point is used by the routine at 32250 when exiting demo mode.
|
|||||||
26906 | CALL 60896 | Ask for the input method, and change the character names (if desired) | |||||
26909 | LD HL,(32706) | HL=high score | |||||
26912 | XOR A | 0: game mode (as opposed to demo mode) | |||||
26913 | LD SP,23806 | Put the stack pointer somewhere safe | |||||
26916 | PUSH HL | Save the high score | |||||
26917 | LD E,A | E=255 (demo mode) or 0 | |||||
26918 | LD A,(32761) | Collect the current lesson number (0-63) from 32761 | |||||
26921 | AND 48 | Set A to 15, 31, 47 or 63 (lessons 0, 16, 32, and 48 are PLAYTIME) | |||||
26923 | ADD A,15 | ||||||
26925 | LD D,A | D=new lesson number minus one | |||||
26926 | PUSH DE | Save this for now | |||||
26927 | CALL 63242 | Unflash the safe and all shields | |||||
26930 | LD HL,32765 | 32765 holds the number (152-171) of the last character moved | |||||
26933 | LD (HL),151 | Reset this number so 152 (little boy no. 1) is moved next | |||||
26935 | DEC L | Blank out the rest of the game status buffer (except for the random number seed at 32766) | |||||
26936 | LD (HL),0 | ||||||
26938 | JR NZ,26935 | ||||||
26940 | LD L,232 | Initialise ERIC's main action timer at 32744 | |||||
26942 | LD (HL),17 | ||||||
26944 | LD L,249 | HL=32761 (which holds the lesson number, 0-63) | |||||
26946 | POP DE | Restore the lesson number to D and game mode indicator (0 or 255) to E | |||||
26947 | LD (HL),D | Set the lesson number | |||||
26948 | LD L,247 | Set the lesson clock (at 32759) to 1 | |||||
26950 | INC (HL) | ||||||
26951 | INC E | If a new game is starting, prepare the shields and safe, and play the theme tune | |||||
26952 | CALL NZ,63668 | ||||||
26955 | POP HL | Restore the high score to HL, and save it in 32706 | |||||
26956 | LD (32706),HL | ||||||
The following loop sets the initial animatory state, location and character flags (byte 122 of the buffer) for each character (including ERIC).
|
|||||||
26959 | LD H,152 | 152=little boy no. 1 | |||||
26961 | LD DE,56064 | The data table at 56064 holds the initial animatory states of the characters | |||||
26964 | LD L,96 | Point HL at byte 96 of the character buffer | |||||
26966 | LD A,(DE) | Set the initial animatory state of the character | |||||
26967 | LD (HL),A | ||||||
26968 | INC L | L=97 | |||||
26969 | INC D | The data table at 56320 holds the initial x-coordinates of the characters | |||||
26970 | LD (HL),169 | All characters start on the bottom floor (y=169) | |||||
26972 | INC L | L=98 | |||||
26973 | LD A,(DE) | Pick up the character's initial x-coordinate | |||||
26974 | INC D | The data table at 56576 holds the character flags | |||||
26975 | LD (HL),A | Set the character's initial x-coordinate | |||||
26976 | LD A,(DE) | Pick up the character flags (0=kid; 16=adult; 32=pellet) | |||||
26977 | DEC D | Point DE back at the table of initial animatory states | |||||
26978 | DEC D | ||||||
26979 | INC E | Next character | |||||
26980 | LD B,29 | Blank out the remaining 29 bytes of the character's buffer | |||||
26982 | INC L | ||||||
26983 | LD (HL),0 | ||||||
26985 | DJNZ 26982 | ||||||
26987 | LD L,122 | Place the character flags into byte 122 of the character's buffer | |||||
26989 | LD (HL),A | ||||||
26990 | INC L | ||||||
26991 | INC L | L=124 | |||||
26992 | LD (HL),159 | Place the address of the continual subcommand routine at 25247 (RET) into bytes 124 and 125 of the character's buffer | |||||
26994 | INC L | ||||||
26995 | LD (HL),98 | ||||||
26997 | INC H | Next character | |||||
26998 | INC A | Have we done all the non-player characters? | |||||
26999 | JR NZ,26964 | Jump back to do the next one if not | |||||
All that remains now is to print the logo, lesson box and score box, and bring the skool into view.
|
|||||||
27001 | CALL 27406 | Print the bottom 3 lines of the screen | |||||
27004 | JP 63768 | Scroll the skool into view and enter the main loop |
Prev: 26836 | Up: Map |