Prev: 5E08 Up: Map Next: 5E32
5E09: Play a white noise
Used by the routine at 5D80.
5E09 EXX Save registers
5E0A PUSH HL Remember HL
5E0B LD HL,$0050 Timing constant
5E0E LD C,$10 Value to write to the speaker
5E10 LD A,C Get current speaker bit
5E11 EX AF,AF'
5E12 CALL $5DD8 Get timing value and wait
5E15 LD B,A
5E16 EX AF,AF'
5E17 DJNZ $5E17
5E19 EX AF,AF'
5E1A CALL $5DD8 Get timing value and wait
5E1D LD B,A
5E1E EX AF,AF'
5E1F DJNZ $5E1F
5E21 LD C,$FE Output to the speaker. This is equivalent to OUT (C),A
5E23 CALL $1E7D
5E26 XOR $10 Toggle speaker, so we can hear something
5E28 LD C,A Store new value
5E29 DEC HL Decrease time
5E2A DEC HL
5E2B LD A,H Time to stop?
5E2C OR L
5E2D JR NZ,$5E10 Not yet, so make some more noise
5E2F POP HL Restore HL
5E30 EXX Restore registers
5E31 RET
Prev: 5E08 Up: Map Next: 5E32