Prev: $149F Up: Map Next: $1640
$15B3: Deal with ERIC
Called from the main loop at $0800 to deal with ERIC when he's doing something other than walking or standing still.
$15B3 LDA $60 Pick up the current character number from $60.
$15B5 PHA Save it temporarily.
$15B6 LDA #$14 Set the current character number at $60 to $14 (ERIC).
$15B8 STA $60
$15BA JSR $3279 Copy ERIC's character buffer to page 0.
$15BD LDA $2B Pick up ERIC's status flags from $2B.
$15BF ASL A Is bit 6 set?
$15C0 ASL A
$15C1 BCC $15C9 Branch if not.
Bit 6 of ERIC's status flags is set, indicating that he's immobilised.
$15C3 JSR $290F Deal with ERIC if he's being spoken to by little boy no. 10.
$15C6 JMP $1636 Jump forward.
$15C9 ASL A Is bit 4 of ERIC's status flags set?
$15CA ASL A
$15CB BCC $1615 Branch if not.
Bit 4 of ERIC's status flags is set, indicating that he's just been knocked down or unseated.
$15CD LDA #$00 Clear ERIC's midstride indicator at $4B.
$15CF STA $4B
$15D1 LDA $30 Pick up ERIC's knockout delay counter from $30.
$15D3 BEQ $15D9 Branch if it's zero (ERIC's just been knocked over).
$15D5 CMP #$0B Is ERIC's knockout delay counter less than $0B?
$15D7 BCC $1608 Branch if so (this always happens).
$15D9 LDA #$1A Set voice #3 attack length to 8ms and and decay length to 1.5s.
$15DB STA $D413
$15DE LDA #$81 Set voice #3 control register: voice on, attack-decay-sustain cycle; noise enabled.
$15E0 STA $D412
$15E3 LDA #$0A Initialise ERIC's knockout delay counter at $30 to $0A.
$15E5 STA $30
$15E7 JSR $322E Update the SRB for the ERIC's current animatory state and location.
$15EA LDA $26 Pick up ERIC's animatory state from $26.
$15EC AND #$06 Keep only bits 1 and 2.
$15EE CMP #$05 Compare the result with $05.
$15F0 BEQ $15FC This branch is never made.
$15F2 LDA $26 Pick up ERIC's animatory state from $26.
$15F4 AND #$80 Keep only the direction bit (bit 7).
$15F6 CLC Now A=$07 or $87: ERIC lying on his back.
$15F7 ADC #$07
$15F9 JMP $1603 Jump forward.
$15FC LDA $26 Pick up ERIC's animatory state from $26.
$15FE AND #$80 Keep only the direction bit (bit 7).
$1600 CLC Now A=$06 or $86: ERIC sitting on the floor.
$1601 ADC #$06
$1603 STA $26 Update ERIC's animatory state.
$1605 JSR $322E Update the SRB for the ERIC's new animatory state.
$1608 DEC $30 Decrement ERIC's knockout delay counter at $30.
$160A BNE $1636 Branch unless it's zero now.
$160C LDA #$00 Clear ERIC's status flags at $2B.
$160E STA $2B
$1610 STA $14 Set ERIC's posture indicator at $14 to 0: he's not standing up.
$1612 JMP $1636 Jump forward.
$1615 ASL A Is bit 3 of ERIC's status flags set?
$1616 BCC $161E Branch if not.
Bit 3 of ERIC's status flags is set, indicating that he's writing on a blackboard.
$1618 JSR $184E Deal with ERIC when he's writing on a blackboard.
$161B JMP $1636 Jump forward.
$161E ASL A Is bit 2 of ERIC's status flags set?
$161F BCC $1627 Branch if not.
Bit 2 of ERIC's status flags is set, indicating that he's hitting.
$1621 JSR $17E5 Deal with ERIC when he's hitting.
$1624 JMP $1636 Jump forward.
$1627 ASL A Is bit 1 of ERIC's status flags set?
$1628 BCC $1630 Branch if not.
Bit 1 of ERIC's status flags is set, indicating that he's jumping.
$162A JSR $189D Deal with ERIC when he's jumping.
$162D JMP $1636 Jump forward.
$1630 ASL A Is bit 0 of ERIC's status flags set?
$1631 BCC $1636 Branch if not.
Bit 0 of ERIC's status flags is set, indicating that he's firing the catapult.
$1633 JSR $191B Deal with ERIC when he's firing the catapult.
$1636 JSR $33BF Restore ERIC's character buffer from page 0.
$1639 PLA Restore the current character number to $60.
$163A STA $60
$163C JSR $3279 Copy the current character's buffer to page 0.
$163F RTS
Prev: $149F Up: Map Next: $1640