![]() |
Routines |
| Prev: $217E | Up: Map | Next: $2387 |
| $2241 | LDA $60 | Pick up the current character number from $60. | ||
| $2243 | CMP #$0B | Is it $0B (MR WACKER)? | ||
| $2245 | BEQ $224A | Branch if so. | ||
| $2247 | JMP $22F3 | Otherwise jump forward. | ||
|
MR WACKER is conducting this lesson, so we have to prepare a multiplication question and answer. First, generate two random numbers and store the ASCII codes of their digits in the question message.
|
||||
| $224A | LDX #$20 | Generate a random number between 32 and 99 and store it at $A3 and $C0. | ||
| $224C | LDY #$63 | |||
| $224E | JSR $253E | |||
| $2251 | STA $A3 | |||
| $2253 | STA $C0 | |||
| $2255 | LDA #$30 | Store the code for '0' at $8B for no apparent reason. | ||
| $2257 | STA $8B | |||
| $2259 | JSR $221C | Generate the character codes of the digits of this number at $8D and $8E. | ||
| $225C | LDA #$00 | Store $5A00 (WHAT IS 12 x 34?) at $50. | ||
| $225E | STA $50 | |||
| $2260 | LDA #$5A | |||
| $2262 | STA $51 | |||
| $2264 | LDY #$08 | Replace the '12' in this message with the digits of the number. | ||
| $2266 | LDA $8D | |||
| $2268 | STA ($50),Y | |||
| $226A | INY | |||
| $226B | LDA $8E | |||
| $226D | STA ($50),Y | |||
| $226F | LDX #$20 | Generate another random number between 32 and 99 and store it at $A3 and $C1. | ||
| $2271 | LDY #$63 | |||
| $2273 | JSR $253E | |||
| $2276 | STA $A3 | |||
| $2278 | STA $C1 | |||
| $227A | LDA #$30 | Store the code for '0' at $8B for no apparent reason. | ||
| $227C | STA $8B | |||
| $227E | JSR $221C | Generate the character codes of the digits of this number at $8D and $8E. | ||
| $2281 | LDY #$0D | Replace the '34' in the question message with the digits of the number. | ||
| $2283 | LDA $8D | |||
| $2285 | STA ($50),Y | |||
| $2287 | INY | |||
| $2288 | LDA $8E | |||
| $228A | STA ($50),Y | |||
| $228C | LDY #$08 | Multiply the two numbers and store the product at $A3 and $A4. | ||
| $228E | LDA #$00 | |||
| $2290 | ASL A | |||
| $2291 | ROL $C0 | |||
| $2293 | BCC $229C | |||
| $2295 | CLC | |||
| $2296 | ADC $C1 | |||
| $2298 | BCC $229C | |||
| $229A | INC $C0 | |||
| $229C | DEY | |||
| $229D | BNE $2290 | |||
| $229F | STA $A3 | |||
| $22A1 | LDA $C0 | |||
| $22A3 | STA $A4 | |||
| $22A5 | JSR $217E | Generate the character codes of the digits of this product. | ||
| $22A8 | LDA #$11 | Store $5A11 (Please Sir I cannot tell a lie . . It's 1234) at $52. | ||
| $22AA | STA $52 | |||
| $22AC | LDA #$5A | |||
| $22AE | STA $53 | |||
| $22B0 | LDY #$06 | Replace the '1234' in this message with the digits of the answer to the multiplication question. | ||
| $22B2 | LDA $8B | |||
| $22B4 | STA ($52),Y | |||
| $22B6 | INY | |||
| $22B7 | LDA $8C | |||
| $22B9 | STA ($52),Y | |||
| $22BB | INY | |||
| $22BC | LDA $8D | |||
| $22BE | STA ($52),Y | |||
| $22C0 | INY | |||
| $22C1 | LDA $8E | |||
| $22C3 | STA ($52),Y | |||
| $22C5 | LDA $60 | Pick up the teacher's character number from $60. | ||
| $22C7 | PHA | Save it temporarily. | ||
| $22C8 | LDA #$11 | Set the current character number at $60 to $11 (EINSTEIN). | ||
| $22CA | STA $60 | |||
| $22CC | JSR $3279 | Copy EINSTEIN's character buffer to page 0. | ||
| $22CF | LDA $52 | Copy the address of the answer message into EINSTEIN's character buffer. | ||
| $22D1 | STA $AC | |||
| $22D3 | LDA $53 | |||
| $22D5 | STA $AD | |||
| $22D7 | JSR $33BF | Restore EINSTEIN's buffer from page 0. | ||
| $22DA | PLA | Restore the teacher's character number to A. | ||
| $22DB | STA $60 | Update the current character number at $60. | ||
| $22DD | JSR $3279 | Copy the teacher's character buffer to page 0. | ||
| $22E0 | LDA $50 | Copy the address of the question message into the teacher's buffer. | ||
| $22E2 | STA $AC | |||
| $22E4 | LDA $51 | |||
| $22E6 | STA $AD | |||
| $22E8 | LDA #$87 | Place the address of the interruptible subcommand routine at $2387 into the teacher's buffer to make him ask the question. | ||
| $22EA | STA $AA | |||
| $22EC | LDA #$23 | |||
| $22EE | STA $AB | |||
| $22F0 | JMP $2386 | Return. | ||
|
Some teacher other than MR WACKER is conducting this lesson. Check whether MR CREAK needs to ask what happened in the year that he was born.
|
||||
| $22F3 | CMP #$0E | Is the current character number $0E (MR CREAK)? | ||
| $22F5 | BNE $2320 | Branch if not. | ||
| $22F7 | LDA $46 | Pick up the game mode indicator from $46. | ||
| $22F9 | BEQ $2320 | Branch if we're in demo mode. | ||
| $22FB | CMP #$03 | Has ERIC already opened the safe? | ||
| $22FD | BCS $2320 | Branch if so. | ||
| $22FF | LDA $C2 | Has MR CREAK already asked the birth year question in this lesson? | ||
| $2301 | BNE $2320 | Branch if so. | ||
| $2303 | LDA #$01 | Update the birth year question indicator at $C2. | ||
| $2305 | STA $C2 | |||
| $2307 | LDA #$2D | Store $5B2D (WHAT HAPPENED IN THE YEAR THAT I WAS BORN) at $50. | ||
| $2309 | STA $50 | |||
| $230B | LDA #$5B | |||
| $230D | STA $51 | |||
| $230F | LDA #$E1 | Store $5AE1 (Please Sir I cannot tell a lie . . It was the BATTLE OF Q) at $52. | ||
| $2311 | STA $52 | |||
| $2313 | LDA #$5A | |||
| $2315 | STA $53 | |||
| $2317 | LDY #$16 | Replace the 'Q' in this message with the message number of MR CREAK's year of birth. | ||
| $2319 | LDA $A5 | |||
| $231B | STA ($52),Y | |||
| $231D | JMP $22C5 | Jump back to prepare MR CREAK and EINSTEIN. | ||
|
Now we randomly select a question-answer pair.
|
||||
| $2320 | LDX #$00 | Generate a random value between $00 and $29 and store it at $57. | ||
| $2322 | LDY #$29 | |||
| $2324 | JSR $253E | |||
| $2327 | STA $57 | |||
| $2329 | LDA $60 | Pick up the current character number from $60. | ||
| $232B | CMP #$0C | Is it $0C (MR ROCKITT)? | ||
| $232D | BEQ $2338 | Branch if so. | ||
| $232F | CMP #$0D | Is the current character number $0D (MR WITHIT)? | ||
| $2331 | BEQ $233D | Branch if so. | ||
| $2333 | LDA #$D4 | The history message numbers are in the range $D4-$FD. | ||
| $2335 | JMP $233F | Jump forward. | ||
| $2338 | LDA #$80 | The chemistry message numbers are in the range $80-$A9. | ||
| $233A | JMP $233F | Jump forward. | ||
| $233D | LDA #$AA | The geography message numbers are in the range $AA-$D3. | ||
| $233F | CLC | Add the random value between $00 and $29 chosen earlier to the base message number, and store the result at $C3. | ||
| $2340 | ADC $57 | |||
| $2342 | STA $C3 | |||
| $2344 | LDA $60 | Pick up the teacher's character number ($0C-$0E) from $60. | ||
| $2346 | SEC | Change it to 0 (MR ROCKITT), 4 (MR WITHIT) or 8 (MR CREAK), and store it at $57. | ||
| $2347 | SBC #$0C | |||
| $2349 | ASL A | |||
| $234A | ASL A | |||
| $234B | STA $57 | |||
| $234D | LDA $C3 | Pick up the message number from $C3. | ||
| $234F | LSR A | Is the message number even? | ||
| $2350 | BCC $2359 | Branch if so. | ||
| $2352 | LDA $57 | Add 12 to the teacher identifier at $57, giving 12 (MR ROCKITT), 16 (MR WITHIT) or 20 (MR CREAK). | ||
| $2354 | CLC | |||
| $2355 | ADC #$0C | |||
| $2357 | STA $57 | |||
| $2359 | LDA $57 | Pick up the LSB of the address of the question message from the data table at $46E0 and copy it to $50. | ||
| $235B | TAX | |||
| $235C | LDA $46E0,X | |||
| $235F | STA $50 | |||
| $2361 | LDA #$5A | Set the MSB of the address of the question message to $5A. | ||
| $2363 | STA $51 | |||
| $2365 | INX | Replace the 'Q' in the question message with the randomly chosen message number saved at $C3. | ||
| $2366 | LDA $46E0,X | |||
| $2369 | TAY | |||
| $236A | LDA $C3 | |||
| $236C | STA ($50),Y | |||
| $236E | INX | Pick up the LSB of the address of the answer message from the data table at $46E0 and copy it to $52. | ||
| $236F | LDA $46E0,X | |||
| $2372 | STA $52 | |||
| $2374 | LDA #$5A | Set the MSB of the address of the question message to $5A. | ||
| $2376 | STA $53 | |||
| $2378 | INX | Replace the 'Q' in the answer message with the appropriate message number. | ||
| $2379 | LDA $46E0,X | |||
| $237C | TAY | |||
| $237D | LDA $C3 | |||
| $237F | EOR #$01 | |||
| $2381 | STA ($52),Y | |||
| $2383 | JMP $22C5 | Jump back to prepare the teacher and EINSTEIN. | ||
| $2386 | RTS | |||
| Prev: $217E | Up: Map | Next: $2387 |