Prev: E36D Up: Map Next: E3EC
E3D3: Generate a sound effect
Used by the routines at AA7F, E2FC, E33F, F814, F9F5 and FAE7.
Input
B pitch
C first segment time (descending)
D second segment time (static)
E third segment time (ascending)
H pitch to drop on first segment
L pitch to raise on third segment
The sound effect routine uses a basic pitch in B, plus three pitch segments - descending, static and ascending for each component of sound. For the first segment, the pitch is incrementally lowered by H, for the second it is unchanged, while for the third, it is incrementally raised by L.
E3D3 LD A,B Get the default pitch
E3D4 SUB H Subtract the pitch to drop for the first part
E3D5 LD B,A Play one wave of sound at that pitch.
E3D6 CALL $E3EC
E3D9 DEC C Loop while there is more to play for the first duration.
E3DA JR NZ,$E3D3
E3DC CALL $E3EC Play one wave of sound.
E3DF DEC D Loop while there is more to play for the second duration.
E3E0 JR NZ,$E3DC
E3E2 LD A,B Raise the pitch by the required amount for the third part.
E3E3 ADD A,L
E3E4 LD B,A
E3E5 CALL $E3EC Play one wave of sound.
E3E8 DEC E Loop while there is more to play for the third duration.
E3E9 JR NZ,$E3E2
E3EB RET Return.
Prev: E36D Up: Map Next: E3EC