Prev: $176F Up: Map Next: $184E
$17E5: Deal with ERIC when he's hitting
This corresponds to $F4A4 in the ZX Spectrum version.
Used by the routine at $15B3.
$17E5 DEC $FE Decrement ERIC's action timer at $FE.
$17E7 BNE $17EC Branch unless it's zero now.
$17E9 JMP $191F Otherwise restore ERIC's animatory state to what it was before he threw the punch.
$17EC LDA $FE Pick up ERIC's action timer from $FE.
$17EE CMP #$0C Is it time to raise the fist to eye level?
$17F0 BNE $17F5 Branch if not.
$17F2 JMP $2B47 Raise ERIC's fist to eye level.
$17F5 CMP #$0B Is it time to check whether anyone was hit?
$17F7 BNE $184D Branch if not.
$17F9 LDY $FB Pick up ERIC's y-coordinate from $FB.
$17FB LDA $26 Pick up ERIC's animatory state from $26.
$17FD ASL A Is ERIC facing right?
$17FE BCS $1808 Branch if so.
$1800 LDA $FC Pick up ERIC's x-coordinate from $FC.
$1802 SEC Subtract 2 from it to get the x-coordinate of ERIC's fist.
$1803 SBC #$02
$1805 JMP $180D Jump forward.
$1808 LDA $FC Pick up ERIC's x-coordinate from $FC.
$180A CLC Add 2 to it to get the x-coordinate of ERIC's fist.
$180B ADC #$02
$180D TAX Transfer the x-coordinate of ERIC's fist to X.
$180E JSR $27D2 Did ERIC hit anyone?
$1811 BCC $182F Branch if not.
$1813 CMP #$0F Character number $0F is ANGELFACE.
$1815 STA $C1 Store the character number of ERIC's victim at $C1.
$1817 BNE $181E Branch unless ERIC hit ANGELFACE.
$1819 LDA #$03 Add 30 to the score and print it.
$181B JSR $1D37
$181E JSR $33BF Restore the character's buffer from page 0.
$1821 LDA $60 Pick up the current character number from $60 and copy it to $2F.
$1823 STA $2F
$1825 LDA $C1 Pick up the character number of ERIC's victim from $C1 and copy it to $60.
$1827 STA $60
$1829 JSR $3279 Copy the victim's character buffer into page 0.
$182C JSR $2A19 Knock the victim to the floor.
$182F LDA #$10 Set voice #2 frequency to $1000.
$1831 STA $D408
$1834 LDA #$00
$1836 STA $D407
$1839 LDA #$34 Set voice #2 attack length to 24ms and decay length to 114ms.
$183B STA $D40C
$183E LDA #$00 Set voice #2 sustain volume to 0 and release length to 6ms.
$1840 STA $D40D
$1843 LDA #$81 Set voice #2 control register: voice on, attack-decay-sustain cycle; noise enabled.
$1845 STA $D40B
$1848 LDA #$0E Lines reprimand $0E: DON'T HIT YOUR MATES.
$184A JMP $1972 Make any nearby teacher give ERIC lines.
$184D RTS
Prev: $176F Up: Map Next: $184E