Prev: 41987 Up: Map Next: 42011
41992: Sound Effect Next Note
The handler of the sound entity for the sound set up by SoundsEntry. The count in the second byte of the entity is decreased on each pass of the main loop. When the count reaches zero the entity is cleared. Until then it plays a tone of as many cycles as the count, and the half period is made from the count (rotated left three times, flipped and exclusive ORed with 64).
Input
IX The sound entity
SoundEffectNext 41992 DEC (IX+1) Decrease the count of notes, and jump to ClearSound if there are none left.
41995 JR Z,ClearSound
41997 LD A,(IX+1) Fetch the count and keep the number of cycles in C.
42000 LD C,A
42001 RLCA Rotate left three times.
42002 RLCA
42003 RLCA
42004 CPL Flip the bits.
42005 XOR %01000000 Flip bit 6.
42007 LD B,A Keep the half period in B.
42008 JP SoundsBeep Jump to SoundsBeep to play the tone.
View the equivalent code in;
Prev: 41987 Up: Map Next: 42011