Prev: A122 Up: Map Next: A148
A131: Sounds: Door
Used by the routine at Burst_Into_Dust.
Makes a burst of noise by sending the bits of the first 30 bytes of the ROM to the speaker. Bit 4 of the port is the speaker bit. The byte is rotated right before each of the eight writes, so every bit of it is sent to the speaker in turn.
SoundsDoor A131 LD BC,$0830 BC=0830 (B counts the bits of a byte and C counts 30 bytes).
A134 LD HL,$0000 Point at the start of the ROM (00).
SoundsDoor_Byte A137 LD E,(HL) Fetch a byte of the ROM.
A138 INC HL Move on to the next byte.
A139 PUSH BC Stash the counters on the stack.
SoundsDoor_Bit A13A RRC E Rotate the byte right.
A13C LD A,E Copy it to A.
A13D AND %00010000 Keep only the speaker bit.
A13F OUT ($FE),A Send it to the speaker.
A141 DJNZ SoundsDoor_Bit Decrease the bit counter and loop back until all eight bits are sent.
A143 POP BC Restore the counters from the stack.
A144 DEC C Decrease the byte counter and loop back until all of the bytes have been sent.
A145 JR NZ,SoundsDoor_Byte
A147 RET Return.
View the equivalent code in;
Prev: A122 Up: Map Next: A148