Prev: A628 Up: Map Next: A6CB
A639: Draw drones for multiple weapon
Used by the routine at 947A.
A639 LD A,($A055) Return if Rex is dead
A63C OR A
A63D RET NZ
A63E LD A,($A013) Return is weapon of Rex isn't multiple
A641 CP $03
A643 RET NZ
A644 LD A,($A060) Return if Rex is teleporting
A647 OR A
A648 RET NZ
A649 LD IY,$5E4E Set IY the base address for drone configuration
A64D LD A,($A014) Set B the number of drones. Number of drones = 3 + multiple weapon energy level
A650 ADD A,$03
A652 LD B,A
A653 PUSH BC Save BC
A654 LD A,(IY+$02) Set A to the index into the offset position for drones
A657 SLA A Point HL to the address for the offset position
A659 LD E,A
A65A LD D,$00
A65C LD HL,$A6CB
A65F ADD HL,DE
A660 LD A,($A0B6) Set A to the x-position of Rex
A663 DEC A Computes x-position of drone based on x-offset and x-position of Rex Drone x-position = Rex x-position + x-offset - 1
A664 ADD A,(HL)
A665 LD (IY+$00),A Set x-position of drone in table configuration buffer
A668 INC HL Increment address into offset position table
A669 LD A,($A0B7) Set A to the y-position of Rex
A66C ADD A,$02 Computes y-position of drone based on x-offset and y-position of Rex Drone y-position = Rex y-position + y-offset + 2
A66E ADD A,(HL)
A66F LD (IY+$01),A Set y-position of drone in table configuration buffer
A672 LD L,A Computes in HL the address into room graphic data for the drone position
A673 LD H,$00
A675 ADD HL,HL
A676 ADD HL,HL
A677 ADD HL,HL
A678 ADD HL,HL
A679 ADD HL,HL
A67A LD DE,$E7FF
A67D ADD HL,DE
A67E LD E,(IY+$00)
A681 SRL E
A683 SRL E
A685 SRL E
A687 LD D,$00
A689 ADD HL,DE
A68A PUSH HL Save HL
A68B LD A,(IY+$00) Computes in DE the graphic data of drone based on his x-position (x-position & 0x7) * 8 = index into graphic data table
A68E AND $07
A690 SLA A
A692 SLA A
A694 SLA A
A696 LD E,A
A697 LD D,$00
A699 LD HL,$A74B
A69C ADD HL,DE
A69D EX DE,HL
A69E POP HL Restore HL
A69F LD B,$04 Set B to the height of the drone sprite
A6A1 PUSH BC Save BC
A6A2 LD A,(DE) Copy into room graphic data the drone graphic data
A6A3 OR (HL)
A6A4 LD (HL),A
A6A5 INC DE Increase address for graphic data of drone and room graphic data
A6A6 INC HL
A6A7 LD A,(DE) Copy into room graphic data the drone graphic data
A6A8 OR (HL)
A6A9 LD (HL),A
A6AA INC DE Increment address for graphic data of drone
A6AB LD BC,$001F Point HL to the next row in room graphic data
A6AE ADD HL,BC
A6AF POP BC Restore BC
A6B0 DJNZ $A6A1 Jump until drone is drawn
A6B2 LD A,(IY+$02) Increment index into the offset position table for the drone
A6B5 INC A
A6B6 LD (IY+$02),A
A6B9 CP $40 Reset the index position if has reached to the end
A6BB JP NZ,$A6C2
A6BE LD (IY+$02),$00
A6C2 LD DE,$0003 Point IY to the next drone configuration
A6C5 ADD IY,DE
A6C7 POP BC Restore BC
A6C8 DJNZ $A653 Jump back and process next drone
A6CA RET
Prev: A628 Up: Map Next: A6CB