Prev: A88D Up: Map Next: A8F4
A8A5: Load ore into the carried ore tank
Used by the routine at draw_shot.
Only while the rocket part the ship carries (+$1A of the player's record score) is part 6, the ore tank: adds one or two units (one for an ore kind 8 or 9, two for kind $0A, from bit 1 of A) to the ore aboard (the byte after the ship record in bare_ship), at most 18 -- a full tank, which drop_part waits for before letting the part go; clears the new rows on the screen, two bytes at x=$70 above the old level from the ship's bottom line; and redraws the level in the ship's picture (the entry at the eighth instruction from the end of the clearing): the ore's rows, bottom up, from the 2-byte-wide graphic after rocket_tank_graphic into bytes 2 and 3 of each row of ship_picture.
Called with the special beam's record by draw_shot, which carries the ore kind in +$13 (beam_hits_ground_object), and with A by test_player_shots at the second instruction. Only the redraw ran in the build's sessions (from build_ship_sprite and start_landscape).
A bug, read only: the clearing loop moves DE up a line (line_up_de) but writes through HL, so it clears the same two bytes every time.
Input
IX A record whose +$13 not zero lets it run
load_ore A8A5 LD A,(IX+$13) Nothing to do if +$13 is zero
A8A8 AND A
A8A9 RET Z
This entry point is used by the routine at test_player_shots.
load_ore_0 A8AA AND $02 One unit for A=0 or 1 (with the kind's bits 0-3: 8 or 9), two for 2 or 3 ($0A)
A8AC SRL A
A8AE INC A
A8AF LD B,A
A8B0 LD A,(rocket_part_carried) Only while the ore tank is carried
A8B3 CP $06
A8B5 RET NZ
A8B6 LD A,(ore) Load it, to 18 units at most
A8B9 LD E,A
A8BA ADD A,B
A8BB CP $12
A8BD JR C,load_ore_1
A8BF LD A,$12
load_ore_1 A8C1 LD (ore),A
A8C4 LD A,(ship_screen_y) The screen address of the first new row in the ship, at x=$70
A8C7 SUB E
A8C8 LD H,A
A8C9 LD L,$70
A8CB CALL pixel_to_screen
load_ore_2 A8CE LD (HL),$00 Clear two bytes for each new row (but see above)
A8D0 INC L
A8D1 LD (HL),$00
A8D3 DEC L
A8D4 CALL line_up_de
A8D7 DJNZ load_ore_2
This entry point is used by the routines at build_ship_sprite and start_landscape.
load_ore_3 A8D9 LD HL,$F6BB The entry from build_ship_sprite and start_landscape: draw the ore aboard into the ship's picture
A8DC LD DE,ore_rows_graphic
A8DF LD A,(ore)
A8E2 AND A
A8E3 RET Z
A8E4 LD B,A Two bytes a row from the ore graphic into bytes 2 and 3 of each six-byte row of the picture
load_ore_4 A8E5 LD A,(DE)
A8E6 LD (HL),A
A8E7 INC DE
A8E8 INC HL
A8E9 LD A,(DE)
A8EA LD (HL),A
A8EB INC DE
A8EC LD A,$05
A8EE CALL add_a_to_hl
A8F1 DJNZ load_ore_4
A8F3 RET
Prev: A88D Up: Map Next: A8F4