Prev: B9E6 Up: Map Next: BA6A
BA09: Handle weapon energy increase
Used by the routine at D204.
Input
A The quantity of energy to increase
BA09 LD HL,$A22C Set A22C to the energy to increase
BA0C LD (HL),A
BA0D LD A,($A1AD) Return if weapon energy level equals to 6
BA10 CP $06
BA12 RET Z
BA13 LD A,($A1B1) Increment accumulated weapon energy
BA16 ADD A,(HL)
BA17 LD ($A1B1),A
BA1A CP $78 Return if accumulated energy less than 120
BA1C RET C
BA1D SUB $78 Substract 120 to the accumulated energy
BA1F LD ($A1B1),A
BA22 LD A,($A1AD) Increment weapon energy level
BA25 INC A
BA26 CP $06 If weapon energy level is equal to 6 jump to increase the number of weapon that has energy
BA28 JP Z,$BA3B
BA2B LD ($A1AD),A Set the new weapon energy level
BA2E SLA A Set new laser duration based on energy level duration = energy level * 5
BA30 SLA A
BA32 ADD A,$04
BA34 LD ($A201),A
BA37 CALL $A793 Initialise drones configuration data buffer
BA3A RET
increase the number of weapons that has energy
BA3B LD A,($A207) Increase number of weapons that has energy
BA3E INC A
BA3F CP $05 Return if number is 5
BA41 RET Z
BA42 LD ($A207),A Set the new number into A207
BA45 LD HL,($A1AE) Increment address into attribute file to point to the next weapon icon in HUD
BA48 INC HL
BA49 INC HL
BA4A LD ($A1AE),HL
BA4D LD A,$01 Set the new weapon energy level to 1
BA4F LD ($A1AD),A
Change the current weapon for Rex based on accumulated energy. This entry point is used by the routines at BA6A and BAB8.
BA52 LD HL,$A1E8 Set HL to point to data buffer for weapons inventory
BA55 LD A,($A207) Set A the accumulated energy weapon
BA58 INC A Set B to the number of weapons that permits the accumulated energy
BA59 LD B,A
BA5A LD E,$00 Set E the current possible weapon
BA5C LD A,(HL) Rex has this weapon in inventory?
BA5D OR A
BA5E JP Z,$BA65 Jump forward if not
BA61 LD A,E Set this weapon for the current weapon of Rex
BA62 LD ($A1AC),A
BA65 INC E Increase the weapon number
BA66 INC HL Increase the addres to point to the next weapon in inventory
BA67 DJNZ $BA5C Jump back until looped all the permited weapons for the accumulated energy
BA69 RET
Prev: B9E6 Up: Map Next: BA6A