Prev: A45F Up: Map Next: A485
A46E: Sounds: Door
Used by the routines at HandlerDoorClosed and HandlerTrapOpen.
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.
SoundsDoor A46E LD BC,$0830 B=08 (the number of bits in a byte) and C=30 (the number of bytes).
A471 LD HL,$0000 HL=00 (the start of the ROM).
SoundsDoor_Byte A474 LD E,(HL) Fetch the next byte of the ROM.
A475 INC HL Move on to the next byte.
A476 PUSH BC Stash the counters on the stack.
SoundsDoor_Bit A477 RRC E Rotate E right by one.
A479 LD A,E A=E.
A47A AND %00010000 Keep only bit 4 (the speaker bit).
A47C OUT ($FE),A Send it to the speaker.
A47E DJNZ SoundsDoor_Bit Decrease the bit counter by one and loop back to SoundsDoor_Bit until it is zero.
A480 POP BC Restore the counters from the stack.
A481 DEC C Decrease the byte counter by one and loop back to SoundsDoor_Byte until all of the bytes have been sent.
A482 JR NZ,SoundsDoor_Byte
A484 RET Return.
View the equivalent code in;
Prev: A45F Up: Map Next: A485