Prev: 41250 Up: Map Next: 41288
41265: Sounds: Door
Used by the routine at Burst_Into_Dust.
Makes a burst of noise by sending the bits of the first 48 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 41265 LD BC,2096 BC=2096 (B counts the bits of a byte and C counts 48 bytes).
41268 LD HL,0 Point at the start of the ROM (0).
SoundsDoor_Byte 41271 LD E,(HL) Fetch a byte of the ROM.
41272 INC HL Move on to the next byte.
41273 PUSH BC Stash the counters on the stack.
SoundsDoor_Bit 41274 RRC E Rotate the byte right.
41276 LD A,E Copy it to A.
41277 AND %00010000 Keep only the speaker bit.
41279 OUT (254),A Send it to the speaker.
41281 DJNZ SoundsDoor_Bit Decrease the bit counter and loop back until all eight bits are sent.
41283 POP BC Restore the counters from the stack.
41284 DEC C Decrease the byte counter and loop back until all of the bytes have been sent.
41285 JR NZ,SoundsDoor_Byte
41287 RET Return.
View the equivalent code in;
Prev: 41250 Up: Map Next: 41288