Prev: 41152 Up: Map Next: 41176
41157: Sound Effect Next Note
Handler for the object type 138 a sound object. Byte 1 of the object is a count, which it decreases. When the count reaches zero the object is removed. Until then it plays a tone of as many cycles as the count, with a half period that is made from the count rotated left three times, inverted and exclusive ORed with 64. No object of this type is ever created (see Unused_Start_Sound_Object_8A), so the game never plays this sound.
Input
IX Object record
SoundEffectNext 41157 DEC (IX+1) Decrease the count of the sound and jump to ClearSound if it has run out.
41160 JR Z,ClearSound
41162 LD A,(IX+1) Fetch the count of the sound.
41165 LD C,A Use it as the number of cycles.
41166 RLCA Rotate the count left three times.
41167 RLCA
41168 RLCA
41169 CPL Invert the bits.
41170 XOR %01000000 Flip bit 6 to make the half period.
41172 LD B,A Store the half period in B.
41173 JP SoundsBeep Jump to SoundsBeep to play the tone.
View the equivalent code in;
Prev: 41152 Up: Map Next: 41176