Prev: $0ECF Up: Map Next: $1042
$0FBA: Control the horizontal flight of a catapult pellet
This corresponds to $6D1C in the ZX Spectrum version.
The address of this uninterruptible subcommand routine is placed into a pellet's buffer by the routine at $2B52.
$0FBA JSR $322E Update the SRB for the pellet's current location.
$0FBD DEC $B2 Has the pellet finished its flight yet?
$0FBF BNE $0FCC Branch if not.
This entry point is used by the routine at $1042 to terminate the vertical portion of the pellet's flight.
$0FC1 LDA #$96 Hide the pellet at x-coordinate 150.
$0FC3 STA $FC
$0FC5 LDA #$00 Remove the uninterruptible subcommand routine address from the pellet's buffer.
$0FC7 STA $B1
$0FC9 JMP $1041 Return.
$0FCC LDA $26 Pick up the pellet's animatory state from $26.
$0FCE ASL A Is the pellet moving right?
$0FCF BCS $0FD6 Branch if so.
$0FD1 DEC $FC Decerement the pellet's x-coordinate at $FC.
$0FD3 JMP $0FD8 Jump forward.
$0FD6 INC $FC Increment the pellet's x-coordinate at $FC.
$0FD8 LDA $FC Pick up the pellet's new x-coordinate from $FC.
$0FDA CMP #$60 Is it now 96 or greater?
$0FDC BCS $0FC1 Terminate the pellet if so.
$0FDE LDA $FB Pick up the pellet's y-coordinate from $FB.
$0FE0 CMP #$03 Is the pellet at boys' eye level on the top floor?
$0FE2 BEQ $0FFB Branch if so.
$0FE4 CMP #$0A Is the pellet at boys' eye level on the middle floor?
$0FE6 BEQ $0FF2 Branch if so.
$0FE8 CMP #$11 Is the pellet at boys' eye level on the bottom floor?
$0FEA BEQ $1004 Branch if so.
$0FEC JSR $322E Update the SRB for the pellet's new location.
$0FEF JMP $1051 Check whether the pellet has hit a shield.
$0FF2 LDA $FC Pick up the pellet's x-coordinate from $FC.
$0FF4 CMP #$26 Is it 38 (equal to that of the Exam Room wall)?
$0FF6 BNE $1004 Branch if not.
$0FF8 JMP $0FC1 Otherwise jump back to terminate the pellet.
$0FFB LDA $FC Pick up the pellet's x-coordinate from $FC.
$0FFD CMP #$39 Is it 57 (equal to the Map Room wall)?
$0FFF BNE $1004 Branch if not.
$1001 JMP $0FC1 Otherwise jump back to terminate the pellet.
$1004 JSR $322E Update the SRB for the pellet's new location.
$1007 LDA $B2 Pick up the pellet's remaining distance to travel from $B2.
$1009 CMP #$08 Is the pellet ready to hit something?
$100B BCS $1041 Return if not.
$100D LDY $FB Pick up the pellet's coordinates in X and Y.
$100F LDX $FC
$1011 JSR $29C8 Check whether anyone has been hit by the pellet.
$1014 PHA Save A temporarily.
$1015 BCS $1033 Branch if someone was knocked over by the pellet.
$1017 PLA Restore A.
$1018 CMP #$00 Was anyone hit by the pellet?
$101A BEQ $1041 Return if not.
$101C LDA #$10 Place the address of the uninterruptible subcommand routine at $1042 into the pellet's buffer. This will control the vertical portion of the pellet's flight.
$101E STA $B1
$1020 LDA #$42
$1022 STA $B0
$1024 LDA #$05 Set the remaining distance for the pellet to travel to 5.
$1026 STA $B2
$1028 LDY $FB Pick up the pellet's y-coordinate from $FB.
$102A CPY #$03 Is the pellet on the top floor?
$102C BNE $1041 Branch if not.
$102E STY $B2 Otherwise adjust the remaining distance to 3.
$1030 JMP $1041 Return.
$1033 LDA #$01 Set the remaining distance for the pellet to travel to 1. This ensures that it's terminated on the next pass.
$1035 STA $B2
$1037 PLA Now A holds the number of the character who was knocked over by the pellet.
$1038 CMP #$11 Was it EINSTEIN?
$103A BNE $1041 Return if not.
$103C LDA #$03 Add 30 to the score and print it.
$103E JMP $1D37
$1041 RTS
Prev: $0ECF Up: Map Next: $1042