Prev: 42079 Up: Map Next: 42117
42094: Sounds: Door
Used by the routines at HandlerDoorClosed and HandlerTrapOpen.
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.
SoundsDoor 42094 LD BC,2096 B=8 (the number of bits in a byte) and C=48 (the number of bytes).
42097 LD HL,0 HL=0 (the start of the ROM).
SoundsDoor_Byte 42100 LD E,(HL) Fetch the next byte of the ROM.
42101 INC HL Move on to the next byte.
42102 PUSH BC Stash the counters on the stack.
SoundsDoor_Bit 42103 RRC E Rotate E right by one.
42105 LD A,E A=E.
42106 AND %00010000 Keep only bit 4 (the speaker bit).
42108 OUT (254),A Send it to the speaker.
42110 DJNZ SoundsDoor_Bit Decrease the bit counter by one and loop back to SoundsDoor_Bit until it is zero.
42112 POP BC Restore the counters from the stack.
42113 DEC C Decrease the byte counter by one and loop back to SoundsDoor_Byte until all of the bytes have been sent.
42114 JR NZ,SoundsDoor_Byte
42116 RET Return.
View the equivalent code in;
Prev: 42079 Up: Map Next: 42117