Prev: B530 Up: Map Next: B5C4
B54C: Configure weapon sound and check for weapon free slot
Used by the routines at B3B8, B49C and B937.
Output
IY Address pointer into projectile configuration for new projectile
B54C XOR A Set A214 to playing sound for Rex weapon
B54D LD ($A214),A
B550 LD IY,$5B60 Set IY to the address for the rex projectile configuration
B554 LD E,$1E Set E to the max number of projectiles
B556 LD A,($A1AC) Set A to the in use Rex weapon
B559 OR A is basic laser?
B55A JP Z,$B565 Jump forward if so
B55D CP $01 is double fire?
B55F JP Z,$B565 Jump forward if so
B562 JP $B56E Jump to play sound
B565 LD A,($A1AD) Set E to max number of Rex projectile based on weapon energy level max num. projectiles = weapon energy level * 4
B568 SLA A
B56A SLA A
B56C INC A
B56D LD E,A
Check if there is a free slot for projectile and configure sound
B56E DEC E Set B to the number of projectiles to check for sound play
B56F LD B,E
B570 LD A,(IY+$06) Set A to the projectile state
B573 OR A is projectile slot free?
B574 JP Z,$B583 Jump to play sound
B577 LD DE,$000F Point IY to the next projectile
B57A ADD IY,DE
B57C DJNZ $B570 Jump until all projectiles handled
B57E LD IY,$03E8 No slot available, point IY to rom address
B582 RET
Configure sound
B583 PUSH HL Save HL
B584 LD A,($A214) playing sound for enemy weapon?
B587 OR A
B588 JP NZ,$B5A8 Jump if so
B58B LD DE,$D4FB Set DE to the address sound data for basic laser, double fire and multiple
B58E LD A,($A1AC) weapon in use is laser?
B591 CP $02
B593 CALL Z,$B5A0 Configure address for his sound data
B596 CP $04 weapon in use is spray?
B598 CALL Z,$B5A4 Configure address for his sound data
B59B CALL $D37F Configure sound channel and mixer register
B59E POP HL Restore HL
B59F RET
Configure address for laser sound data
B5A0 LD DE,$D50D
B5A3 RET
Configure address for spray sound data
B5A4 LD DE,$D516
B5A7 RET
Configure address for enemy sound data
B5A8 POP HL Restore HL
B5A9 LD A,($D5DA) sound channel 3 in use?
B5AC CP $FF
B5AE RET NZ Return if so
B5AF LD DE,$D504 Configure address for enemy sound data
B5B2 CALL $D37F Configure sound channel and mixer register
B5B5 RET
Check for slot to create a new projectile and configure weapon sound if so. Used by the routines at BC48, BF4F and BFA8.
B5B6 LD A,$01 Set A214 to playing enemy sound data
B5B8 LD ($A214),A
B5BB LD IY,$5D22 Set IY to the address for the enemy projectile configuration
B5BF LD E,$14 Set E to the max number of projectiles
B5C1 JP $B56E Jump back and check if sound need to be played
Prev: B530 Up: Map Next: B5C4