Prev: 89D9 Up: Map Next: 8A36
8A0F: Cornering sound effect
The game only ever uses a duty factor of 100 and a count of 1.
Input
D Duty factor and outer loop count
E Inner loop count
Half duty cycle: only run on every other call.
sfx_cornering 8A0F LD A,$00 Toggle static flag
8A11 XOR $01
8A13 LD ($8A10),A
8A16 RET NZ Return if flag became non-zero
sfx_cornering_loop_outer 8A17 LD C,E Set inner loop counter
sfx_cornering_loop_inner 8A18 CALL rng Call rng
8A1B AND $10 Mask off bit 4
8A1D JR Z,sfx_cornering_continue If zero goto sfx_cornering_continue
Delay for (24 - D) iterations.
8A1F LD A,$18
8A21 SUB D
8A22 LD B,A
sfx_cornering_delay1 8A23 DJNZ sfx_cornering_delay1
I'm unsure why they're setting both of the EAR and MIC bits here. Is it louder?
8A25 LD A,$18 Set EAR and MIC bits
8A27 OUT ($FE),A Set output
Delay for D iterations.
8A29 LD B,D
sfx_cornering_delay2 8A2A DJNZ sfx_cornering_delay2
8A2C XOR A Clear output
8A2D OUT ($FE),A
sfx_cornering_continue 8A2F DEC C Loop while inner loop counter > 0
8A30 JR NZ,sfx_cornering_loop_inner
8A32 DEC D Loop while duty factor > 0
8A33 JR NZ,sfx_cornering_loop_outer
8A35 RET Return
Prev: 89D9 Up: Map Next: 8A36