Prev: B483 Up: Map Next: B625
B5AF: Draw a beam, colour it, and free the record when it has gone
Used by the routine at update_left_shot.
The end of every beam's update: update_left_shot comes in at the top with the left-going pattern, update_shot at its second instruction with the right-going one, update_special_beam at its third with its own in DE. The beam follows the vertical scroll (scroll_down) on the screen; last pass's beam is rubbed out (erase_laser) and this pass's drawn (draw_beam), and the record moved by its speed (move_object).
A laser is coloured with its own attribute, a strip of its length one cell high (shot_colour_patch, painted by fill_attributes); the special beam bright magenta over its width and height (colour_sprite's second entry). A beam of no length is finished: its record is freed (+B 0) and, for the special beam, the ship let go (special_beam_on) -- the jump to load_ore then returns at once, a shot's +13 being 0.
Input
IX the shot's record
draw_shot B5AF LD DE,laser_pattern_left the left-going pattern
This entry point is used by the routine at update_shot.
draw_shot_0 B5B2 CALL beam_pattern plus the record's offset
This entry point is used by the routine at update_special_beam.
draw_shot_1 B5B5 LD A,(scroll_down) follow the vertical scroll
B5B8 ADD A,(IX+$0C)
B5BB LD (IX+$0C),A
B5BE CALL record_screen_address this pass's screen address and length (not below 0)
B5C1 LD B,(IX+$0E)
B5C4 BIT 7,B
B5C6 JR Z,draw_shot_2
B5C8 LD B,$00
B5CA LD (IX+$0E),B
draw_shot_2 B5CD CALL erase_laser rub out, draw, and move the record through the world
B5D0 CALL draw_beam
B5D3 CALL move_object
B5D6 LD A,(IX+$0E) gone: free the record
B5D9 AND A
B5DA JR NZ,draw_shot_3
B5DC LD (IX+$0B),$00
B5E0 BIT 7,(IX+$15)
B5E4 RET Z
B5E5 XOR A the special beam gone: the ship is free
B5E6 LD (special_beam_on),A
B5E9 JP load_ore
draw_shot_3 B5EC BIT 7,(IX+$15) the special beam: bright magenta, its height in lines, its width in pixels
B5F0 JR Z,draw_shot_4
B5F2 LD A,$43
B5F4 LD ($AF03),A
B5F7 LD L,(IX+$0B)
B5FA LD H,(IX+$0C)
B5FD LD A,(new_sprite_rows)
B600 LD D,A
B601 LD A,(IX+$0E)
B604 ADD A,A
B605 ADD A,A
B606 ADD A,A
B607 LD B,A
B608 JP colour_sprite_3
draw_shot_4 B60B LD DE,shot_colour_patch a laser: a strip of its length, one cell high, in its colour
B60E LD A,(IX+$0E)
B611 LD (DE),A
B612 INC DE
B613 INC DE
B614 LD A,(IX+$0D)
B617 LD (DE),A
B618 LD L,(IX+$0B)
B61B LD H,(IX+$0C)
B61E LD DE,shot_colour_patch
B621 CALL fill_attributes
B624 RET
Prev: B483 Up: Map Next: B625