Prev: 29386 Up: Map Next: 29426
29391: 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 29391 LD A,(IX+0) Read offset 0 of IX.
29394 XOR (IX+1) Flip the bits of A that are set in the byte at offset 1 of IX.
29397 AND %00001111 Keep the bits of A that are set in 15.
29399 ADD A,8 Add 8 to A.
29401 LD C,A That is the number of clicks in the beam.
29402 LD A,(IX+2) Read offset 2 of IX.
29405 AND %00011111 Keep the bits of A that are set in 31.
29407 LD E,A The third byte is the click pattern.
PlayBeamSound_Loop 29408 LD A,C Mix the clicks still left with the pattern.
29409 ADD A,E A gains E.
29410 AND %00001111 Keep the bits of A that are set in 15.
29412 ADD A,A Double the mixed value.
29413 LD B,A Keep it as the on-time.
29414 LD A,E The off-time starts from the pattern.
29415 ADD A,B A gains B.
29416 ADD A,A Double the sum.
29417 SUB B Subtract B from A.
29418 LD D,A That is the off-time of this click.
29419 CALL MakeClick Call MakeClick.
29422 DEC C One click of the beam has been played.
29423 JR NZ,PlayBeamSound_Loop Jump to PlayBeamSound_Loop if the zero flag is clear.
29425 RET Return.
Prev: 29386 Up: Map Next: 29426