Prev: FE52 Up: Map Next: FE75
FE57: Make a knocked-out sound effect
Used by the routine at 6AA7. Makes a sound effect just after ERIC has been knocked over or pushed out of his seat.
Input
A 1 + knockout delay counter value (7FF5)
FE57 CP $27 Return (to 6AD7) unless ERIC has just been knocked over
FE59 RET NZ
FE5A LD HL,$0113 A=0x02 (initial border colour: red), H=0x01 (pitch adjustment), L=0x13 (border alternates red/blue), D=0x00 (duration), E=0x00 (initial pitch)
FE5D LD DE,$0000
FE60 LD A,$02
This entry point is used by the routines at E4EC (to make the 'hit a shield' sound effect) and FE75 (to make the catapult sound effect) with the following parameters prepared:
A Initial border colour
D Duration
E Initial pitch
H Pitch adjustment
L 0x10 + border XOR value
FE62 XOR L Flip the border colour and the state of the speaker
FE63 OUT ($FE),A
FE65 LD B,E Pitch delay
FE66 DJNZ $FE66
FE68 LD B,A Save A temporarily
FE69 LD A,E Adjust the pitch
FE6A ADD A,H
FE6B LD E,A
FE6C LD A,B Restore A
FE6D DEC D Decrement the duration counter
FE6E JR NZ,$FE62 Jump back unless the sound effect is finished
FE70 LD A,$01 Make the border blue before returning
FE72 OUT ($FE),A
FE74 RET
Prev: FE52 Up: Map Next: FE75