Prev: 72CA Up: Map Next: 72F2
72CF: Play Beam Sound
Used by the routine at UpdateBeams.
Plays the noise of a beam, using clicks that depend on the first three bytes of the object of the beam.
Input
IX Address of the beam
PlayBeamSound 72CF LD A,(IX+$00) Read offset 00 of IX.
72D2 XOR (IX+$01) Flip the bits of A that are set in the byte at offset 01 of IX.
72D5 AND %00001111 Keep the bits of A that are set in 0F.
72D7 ADD A,$08 Add 08 to A.
72D9 LD C,A That is the number of clicks in the beam.
72DA LD A,(IX+$02) Read offset 02 of IX.
72DD AND %00011111 Keep the bits of A that are set in 1F.
72DF LD E,A The third byte is the click pattern.
PlayBeamSound_Loop 72E0 LD A,C Mix the clicks still left with the pattern.
72E1 ADD A,E A gains E.
72E2 AND %00001111 Keep the bits of A that are set in 0F.
72E4 ADD A,A Double the mixed value.
72E5 LD B,A Keep it as the on-time.
72E6 LD A,E The off-time starts from the pattern.
72E7 ADD A,B A gains B.
72E8 ADD A,A Double the sum.
72E9 SUB B Subtract B from A.
72EA LD D,A That is the off-time of this click.
72EB CALL MakeClick Call MakeClick.
72EE DEC C One click of the beam has been played.
72EF JR NZ,PlayBeamSound_Loop Jump to PlayBeamSound_Loop if the zero flag is clear.
72F1 RET Return.
Prev: 72CA Up: Map Next: 72F2