Routines |
Prev: $0ECE | Up: Map | Next: $0FBA |
$0ECF | JSR $0BAC | Compute the coordinate ranges within which the teacher can see. | ||
$0ED2 | LDA #$FF | $79 will hold the distance from the teacher to the closest main kid. Initialise it to $FF. | ||
$0ED4 | STA $79 | |||
First we check whether ERIC is in range.
|
||||
$0ED6 | LDA #$14 | Character number $14 is ERIC. | ||
$0ED8 | STA $07 | Store this potential target character number at $07. | ||
$0EDA | JSR $0D67 | Is ERIC close to the teacher? | ||
$0EDD | BCC $0F0B | Branch if not to check EINSTEIN. | ||
$0EDF | LDA #$78 | Prepare to address ERIC's character buffer at $8C60. | ||
$0EE1 | CLC | |||
$0EE2 | ADC $07 | |||
$0EE4 | STA $4F | |||
$0EE6 | LDA #$60 | |||
$0EE8 | STA $4E | |||
$0EEA | LDY #$01 | Pick up ERIC's x-coordinate from his character buffer and store it at $0B. | ||
$0EEC | LDA ($4E),Y | |||
$0EEE | STA $0B | |||
$0EF0 | CMP $FC | Is it less than the teacher's x-coordinate? | ||
$0EF2 | BCC $0EFA | Branch if so. | ||
$0EF4 | SEC | Now A holds the difference between the teacher's and ERIC's x-coordinates. | ||
$0EF5 | SBC $FC | |||
$0EF7 | JMP $0EFF | Jump forward. | ||
$0EFA | LDA $FC | Pick up the teacher's x-coordinate from $FC. | ||
$0EFC | SEC | Now A holds the difference between the teacher's and ERIC's x-coordinates. | ||
$0EFD | SBC $0B | |||
$0EFF | STA $7A | Store this x-coordinate difference at $7A. | ||
$0F01 | CMP $79 | Is it greater than any x-coordinate difference already calculated? | ||
$0F03 | BCS $0F0B | Branch if so (this branch is never made). | ||
$0F05 | STA $79 | Otherwise store this new minimum x-coordinate difference at $79, and ERIC's character number at $7B. | ||
$0F07 | LDA $07 | |||
$0F09 | STA $7B | |||
Next we check whether EINSTEIN is in range.
|
||||
$0F0B | LDA #$11 | Character number $11 is EINSTEIN. Store this potential target character number at $07. | ||
$0F0D | STA $07 | |||
$0F0F | JSR $0D67 | Is EINSTEIN close to the teacher? | ||
$0F12 | BCC $0F40 | Branch if not to check BOY WONDER. | ||
$0F14 | LDA #$78 | Prepare to address EINSTEIN's character buffer at $8960. | ||
$0F16 | CLC | |||
$0F17 | ADC $07 | |||
$0F19 | STA $4F | |||
$0F1B | LDA #$60 | |||
$0F1D | STA $4E | |||
$0F1F | LDY #$01 | Pick up EINSTEIN's x-coordinate from his character buffer and store it at $0B. | ||
$0F21 | LDA ($4E),Y | |||
$0F23 | STA $0B | |||
$0F25 | CMP $FC | Is it less than the teacher's x-coordinate? | ||
$0F27 | BCC $0F2F | Branch if so. | ||
$0F29 | SEC | Now A holds the difference between the teacher's and EINSTEIN's x-coordinates. | ||
$0F2A | SBC $FC | |||
$0F2C | JMP $0F34 | Jump forward. | ||
$0F2F | LDA $FC | Pick up the teacher's x-coordinate from $FC. | ||
$0F31 | SEC | Now A holds the difference between the teacher's and EINSTEIN's x-coordinates. | ||
$0F32 | SBC $0B | |||
$0F34 | STA $7A | Store this x-coordinate difference at $7A. | ||
$0F36 | CMP $79 | Is it greater than any x-coordinate difference already calculated? | ||
$0F38 | BCS $0F40 | Branch if so. | ||
$0F3A | STA $79 | Otherwise store this new minimum x-coordinate difference at $79, and EINSTEIN's character number at $7B. | ||
$0F3C | LDA $07 | |||
$0F3E | STA $7B | |||
Next we check whether BOY WONDER is in range.
|
||||
$0F40 | LDA #$10 | Character number $11 is BOY WONDER. Store this potential target character number at $07. | ||
$0F42 | STA $07 | |||
$0F44 | JSR $0D67 | Is BOY WONDER close to the teacher? | ||
$0F47 | BCC $0F75 | Branch if not to check ANGELFACE. | ||
$0F49 | LDA #$78 | Prepare to address BOY WONDER's character buffer at $8860. | ||
$0F4B | CLC | |||
$0F4C | ADC $07 | |||
$0F4E | STA $4F | |||
$0F50 | LDA #$60 | |||
$0F52 | STA $4E | |||
$0F54 | LDY #$01 | Pick up BOY WONDER's x-coordinate from his character buffer and store it at $0B. | ||
$0F56 | LDA ($4E),Y | |||
$0F58 | STA $0B | |||
$0F5A | CMP $FC | Is it less than the teacher's x-coordinate? | ||
$0F5C | BCC $0F64 | Branch if so. | ||
$0F5E | SEC | Now A holds the difference between the teacher's and BOY WONDER's x-coordinates. | ||
$0F5F | SBC $FC | |||
$0F61 | JMP $0F69 | Jump forward. | ||
$0F64 | LDA $FC | Pick up the teacher's x-coordinate from $FC. | ||
$0F66 | SEC | Now A holds the difference between the teacher's and BOY WONDER's x-coordinates. | ||
$0F67 | SBC $0B | |||
$0F69 | STA $7A | Store this x-coordinate difference at $7A. | ||
$0F6B | CMP $79 | Is it greater than any x-coordinate difference already calculated? | ||
$0F6D | BCS $0F75 | Branch if so. | ||
$0F6F | STA $79 | Otherwise store this new minimum x-coordinate difference at $79, and BOY WONDER's character number at $7B. | ||
$0F71 | LDA $07 | |||
$0F73 | STA $7B | |||
Finally we check whether ANGELFACE is in range.
|
||||
$0F75 | LDA #$0F | Character number $0F is ANGELFACE. Store this potential target character number at $07. | ||
$0F77 | STA $07 | |||
$0F79 | JSR $0D67 | Is ANGELFACE close to the teacher? | ||
$0F7C | BCC $0FAA | Branch if not. | ||
$0F7E | LDA #$78 | Prepare to address ANGELFACE's character buffer at $8760. | ||
$0F80 | CLC | |||
$0F81 | ADC $07 | |||
$0F83 | STA $4F | |||
$0F85 | LDA #$60 | |||
$0F87 | STA $4E | |||
$0F89 | LDY #$01 | Pick up ANGELFACE's x-coordinate from his character buffer and store it at $0B. | ||
$0F8B | LDA ($4E),Y | |||
$0F8D | STA $0B | |||
$0F8F | CMP $FC | Is it less than the teacher's x-coordinate? | ||
$0F91 | BCC $0F99 | Branch if so. | ||
$0F93 | SEC | Now A holds the difference between the teacher's and ANGELFACE's x-coordinates. | ||
$0F94 | SBC $FC | |||
$0F96 | JMP $0F9E | Jump forward. | ||
$0F99 | LDA $FC | Pick up the teacher's x-coordinate from $FC. | ||
$0F9B | SEC | Now A holds the difference between the teacher's and ANGELFACE's x-coordinates. | ||
$0F9C | SBC $0B | |||
$0F9E | STA $7A | Store this x-coordinate difference at $7A. | ||
$0FA0 | CMP $79 | Is it greater than any x-coordinate difference already calculated? | ||
$0FA2 | BCS $0FAA | Branch if so. | ||
$0FA4 | STA $79 | Otherwise store this new minimum x-coordinate difference at $79, and ANGELFACE's character number at $7B. | ||
$0FA6 | LDA $07 | |||
$0FA8 | STA $7B | |||
Having checked whether ERIC, EINSTEIN, BOY WONDER and ANGELFACE are in range, we now see which (if any) is closest to the teacher.
|
||||
$0FAA | INC $79 | Were any of the main kids within lines-receiving range? | ||
$0FAC | BEQ $0FB9 | Return if not. | ||
$0FAE | LDA $7B | Pick up the character number of the closest main kid and store it at $72. | ||
$0FB0 | STA $72 | |||
$0FB2 | LDA #$08 | Lines reprimand $08: NOW DON'T DO IT AGAIN. | ||
$0FB4 | STA $D8 | Store this lines reprimand identifier at $D8. | ||
$0FB6 | JMP $1DB7 | Make the teacher gives lines to the closest main kid. | ||
$0FB9 | RTS |
Prev: $0ECE | Up: Map | Next: $0FBA |