Prev: A403 Up: Map Next: A41B
A408: 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 40).
Input
IX The sound entity
SoundEffectNext A408 DEC (IX+$01) Decrease the count of notes, and jump to ClearSound if there are none left.
A40B JR Z,ClearSound
A40D LD A,(IX+$01) Fetch the count and keep the number of cycles in C.
A410 LD C,A
A411 RLCA Rotate left three times.
A412 RLCA
A413 RLCA
A414 CPL Flip the bits.
A415 XOR %01000000 Flip bit 6.
A417 LD B,A Keep the half period in B.
A418 JP SoundsBeep Jump to SoundsBeep to play the tone.
View the equivalent code in;
Prev: A403 Up: Map Next: A41B