Prev: B625 Up: Map Next: B6EC
B628: Update a laser shot going left
Used by the routine at update_shot.
update_shot for a beam going left, mirrored: the left end moves 16 pixels a pass as the beam grows a cell, the probe 16 pixels a pass the other way (+7 the ship's speed less 16), the pattern taken from the left-going one at offset +F counting up. The head stops at the play area's left edge (x 8) or when the probe meets the landscape; the tail catches up when offset and length together reach 8.
Input
IX the shot's record
update_left_shot B628 LD DE,laser_pattern_left last pass's pattern, screen address and width into the alternate set
B62B CALL beam_pattern
B62E CALL record_screen_address
B631 LD B,(IX+$0E)
B634 EXX
B635 BIT 7,(IX+$10) the head has stopped
B639 JR NZ,update_left_shot_3
B63B LD A,$F0 the left end 16 out; the probe 16 ahead
B63D ADD A,(IX+$0B)
B640 LD (IX+$0B),A
B643 LD A,$F0
B645 ADD A,(IX+$07)
B648 LD (IX+$07),A
B64B LD A,(IX+$0E) first pass: the left end at x $58
B64E AND A
B64F JR NZ,update_left_shot_0
B651 LD (IX+$0B),$58
update_left_shot_0 B655 LD (IX+$0F),$00 the offset 0
B659 CALL probe_laser in the landscape (probe_laser)?
B65C JR Z,update_left_shot_1
B65E SET 7,(IX+$10) yes: the head stops, a hit; both back 16
B662 SET 5,(IX+$10)
B666 LD A,$10
B668 ADD A,(IX+$07)
B66B LD (IX+$07),A
B66E LD A,$10
B670 ADD A,(IX+$0B)
B673 LD (IX+$0B),A
B676 JR update_left_shot_2
update_left_shot_1 B678 LD A,(IX+$0E) no: a cell longer
B67B INC A
B67C LD (IX+$0E),A
update_left_shot_2 B67F LD A,(IX+$0B) at the left edge the head stops; draw it
B682 CP $08
B684 JP NZ,draw_shot
B687 SET 7,(IX+$10)
B68B JP draw_shot
update_left_shot_3 B68E LD A,(IX+$0F) stopped: the offset one more
B691 INC A
B692 LD (IX+$0F),A
B695 BIT 5,(IX+$10) probe again until it hits
B699 JR NZ,update_left_shot_4
B69B CALL probe_laser
B69E JR Z,update_left_shot_5
B6A0 SET 5,(IX+$10)
update_left_shot_4 B6A4 LD A,(IX+$07) follow the scroll across
B6A7 NEG
B6A9 ADD A,(IX+$0B)
B6AC LD (IX+$0B),A
B6AF LD (IX+$07),$00
B6B3 CP $08
B6B5 JR NC,update_left_shot_5
B6B7 ADD A,$08 past the left edge: a cell shorter, from the left
B6B9 LD (IX+$0B),A
B6BC LD A,(IX+$0E)
B6BF DEC A
B6C0 LD (IX+$0E),A
B6C3 LD A,(IX+$0F)
B6C6 INC A
B6C7 LD (IX+$0F),A
update_left_shot_5 B6CA BIT 6,(IX+$10) the tail catching up: a cell shorter
B6CE JR Z,update_left_shot_6
B6D0 LD A,(IX+$0E)
B6D3 DEC A
B6D4 LD (IX+$0E),A
B6D7 JP draw_shot
update_left_shot_6 B6DA LD A,(IX+$0F) offset and length reach 8: the tail starts
B6DD ADD A,(IX+$0E)
B6E0 CP $08
B6E2 JP NZ,draw_shot
B6E5 SET 6,(IX+$10)
B6E9 JP draw_shot
Prev: B625 Up: Map Next: B6EC