![]() |
Routines |
| Prev: AA27 | Up: Map | Next: AAD7 |
|
Used by the routines at draw_ship_image and start_landscape.
The ship's picture is built in RAM at ship_picture, six bytes a row, bottom row first, and a rocket part the ship carries hangs in its bottom rows. This XORs the part's graphic (from type $1E's frame list rocket_part_frames, by the part number in bits 0-3 of the ship record's +$1F) into the picture, shifted four pixels right through the shift tables' fourth and fifth pages (shift_tables) and one byte in -- so the same call puts it in and takes it out -- and clears the same place on the screen (four bytes from a byte in, the part's height up from the ship's bottom line), presumably because the direct drawer rubs the ship out with its picture as it now is, which would leave the old part's pixels behind. Called from draw_ship when bit 7 of +$1F asks for it.
Then (also the entry at the 24th instruction, used by build_ship_sprite when it rebuilds the picture) the ship's height and the picture's start are set for whether a part hangs there (bit 6 of +$1F): five rows more and the picture from ship_picture, or five fewer and from 30 bytes into it; the ship's line for shots (ship_line) moves by three, and the ship record's screen y and position are moved to match (move_object, ship_speed_from_scroll).
|
||||||||
| toggle_carried_part | AA37 | LD HL,rocket_part_frames | The part's graphic | |||||
| AA3A | LD A,(part_being_fitted) | |||||||
| AA3D | AND $0F | |||||||
| AA3F | LD C,A | |||||||
| AA40 | CALL table_word | |||||||
| AA43 | EX DE,HL | |||||||
| AA44 | LD A,(DE) | Its width and height; the picture's first row, a byte in | ||||||
| AA45 | LD B,A | |||||||
| AA46 | LD (row_count_spare),A | |||||||
| AA49 | INC DE | |||||||
| AA4A | LD A,(DE) | |||||||
| AA4B | LD (pieces_left),A | |||||||
| AA4E | LD C,A | |||||||
| AA4F | LD HL,$F6BA | |||||||
| toggle_carried_part_0 | AA52 | PUSH HL | Each byte, shifted four pixels right, XORed into two bytes of the picture | |||||
| toggle_carried_part_1 | AA53 | PUSH BC | ||||||
| AA54 | LD B,$FC | |||||||
| AA56 | INC DE | |||||||
| AA57 | LD A,(DE) | |||||||
| AA58 | LD C,A | |||||||
| AA59 | LD A,(BC) | |||||||
| AA5A | XOR (HL) | |||||||
| AA5B | LD (HL),A | |||||||
| AA5C | INC B | |||||||
| AA5D | INC HL | |||||||
| AA5E | LD A,(BC) | |||||||
| AA5F | XOR (HL) | |||||||
| AA60 | LD (HL),A | |||||||
| AA61 | POP BC | |||||||
| AA62 | DJNZ toggle_carried_part_1 | |||||||
| AA64 | POP HL | Next row, six bytes on | ||||||
| AA65 | LD A,(row_count_spare) | |||||||
| AA68 | LD B,A | |||||||
| AA69 | LD A,$06 | |||||||
| AA6B | CALL add_a_to_hl | |||||||
| AA6E | DEC C | |||||||
| AA6F | JR NZ,toggle_carried_part_0 | |||||||
| AA71 | LD HL,(ship_screen_x) | Clear the part's rows under the ship on the screen, four bytes a row | ||||||
| AA74 | CALL pixel_to_screen | |||||||
| AA77 | LD A,(pieces_left) | |||||||
| AA7A | LD B,A | |||||||
| AA7B | INC L | |||||||
| toggle_carried_part_2 | AA7C | LD (HL),$00 | ||||||
| AA7E | INC L | |||||||
| AA7F | LD (HL),$00 | |||||||
| AA81 | INC L | |||||||
| AA82 | LD (HL),$00 | |||||||
| AA84 | INC L | |||||||
| AA85 | LD (HL),$00 | |||||||
| AA87 | DEC L | |||||||
| AA88 | DEC L | |||||||
| AA89 | DEC L | |||||||
| AA8A | CALL line_up_hl | |||||||
| AA8D | DJNZ toggle_carried_part_2 | |||||||
| AA8F | LD A,(map_rebuild) | Not while the view is being built (map_rebuild) | ||||||
| AA92 | AND A | |||||||
| AA93 | RET NZ | |||||||
|
This entry point is used by the routine at build_ship_sprite.
|
||||||||
| toggle_carried_part_3 | AA94 | LD A,(part_being_fitted) | A part hangs there: the picture from its first byte and five rows more | |||||
| AA97 | LD B,A | |||||||
| AA98 | LD A,(ship_height) | |||||||
| AA9B | LD C,A | |||||||
| AA9C | LD (IX+$09),$08 | |||||||
| AAA0 | LD E,$03 | |||||||
| AAA2 | LD HL,ship_picture | |||||||
| AAA5 | LD A,$05 | |||||||
| AAA7 | BIT 6,B | None: from 30 bytes on and five rows fewer | ||||||
| AAA9 | JR NZ,toggle_carried_part_4 | |||||||
| AAAB | LD HL,$F6D7 | |||||||
| AAAE | LD E,$FD | |||||||
| AAB0 | NEG | |||||||
| AAB2 | LD (IX+$09),$F8 | |||||||
| toggle_carried_part_4 | AAB6 | LD (ship_graphic),HL | The ship's picture and height (in star_offsets) | |||||
| AAB9 | ADD A,C | |||||||
| AABA | LD (ship_height),A | |||||||
| AABD | LD A,(ship_line) | Adjust the ship's shot line and record to match, and recompute its position | ||||||
| AAC0 | ADD A,E | |||||||
| AAC1 | LD (ship_line),A | |||||||
| AAC4 | LD A,(IX+$09) | |||||||
| AAC7 | ADD A,(IX+$1E) | |||||||
| AACA | LD (IX+$1E),A | |||||||
| AACD | LD (IX+$07),$00 | |||||||
| AAD1 | CALL move_object | |||||||
| AAD4 | JP ship_speed_from_scroll | |||||||
| Prev: AA27 | Up: Map | Next: AAD7 |