![]() |
Routines |
| Prev: C421 | Up: Map | Next: C5FF |
|
Used by the routines at draw_rocket and play.
The trail is a one-byte-wide line behind the ship whose bend follows the speed across (ship_across_speed): the frame is 1 + twice the whole pixels + the half, no more than one past the top speed, mirrored with the direction (record trail_frame-trail_hold, images trail_images). It is erased only when the frame changes, the ship turns (ship_turned) or the collision code asks (trail_collision). Also called at the start of each life and of the death sequence (play; dying, it is only erased) and by draw_rocket. Then on to the pause key, the fire button and the jets.
|
||||
| draw_trail | C4ED | LD HL,$0000 | The trail: its old frame and place (trail_frame) for the erase. | |
| C4F0 | LD (scratch_count),HL | |||
| C4F3 | LD IX,trail_frame | |||
| C4F7 | CALL graphic_frame_list | |||
| C4FA | LD HL,(trail_x) | |||
| C4FD | LD (sprite_screen_pos),HL | |||
| C500 | CALL read_graphic_size | |||
| C503 | CALL set_direct_old | |||
| C506 | LD HL,(sprite_screen_pos) | The 1-byte eraser, or the mirrored one (trail_mirror). | ||
| C509 | CALL pixel_to_screen | |||
| C50C | LD IY,direct_erase_one | |||
| C510 | CALL trail_mirror | |||
| C513 | JR NZ,draw_trail_0 | |||
| C515 | LD IY,mirrored_erase_one | |||
| draw_trail_0 | C519 | EXX | Keep the old frame in E. | |
| C51A | LD E,(IX+$00) | |||
| C51D | LD A,(part_being_fitted) | A part being fitted: the trail hangs lower (ship_line less 9) and is redrawn. | ||
| C520 | AND A | |||
| C521 | JR Z,draw_trail_1 | |||
| C523 | LD A,(ship_line) | |||
| C526 | SUB $09 | |||
| C528 | LD (trail_y),A | |||
| C52B | LD ($BF84),A | |||
| C52E | LD E,$FF | |||
| C530 | XOR A | |||
| C531 | LD (part_being_fitted),A | |||
| draw_trail_1 | C534 | LD HL,(ship_across_speed) | The ship's speed across (the step word kept at ship_across_speed, the whole pixels in the high byte): under half a pixel, flagged as moving right (trail_direction bit 7). | |
| C537 | LD A,H | |||
| C538 | LD H,L | |||
| C539 | LD L,A | |||
| C53A | LD A,H | |||
| C53B | AND A | |||
| C53C | JR NZ,draw_trail_2 | |||
| C53E | LD A,L | |||
| C53F | CP $80 | |||
| C541 | LD A,H | |||
| C542 | JR NC,draw_trail_2 | |||
| C544 | LD A,$80 | |||
| C546 | LD (trail_direction),A | |||
| C549 | JR draw_trail_3 | |||
| draw_trail_2 | C54B | AND $80 | Otherwise its sign; moving the other way, take its size. | |
| C54D | LD (trail_direction),A | |||
| C550 | CALL NZ,negate_hl | |||
| draw_trail_3 | C553 | LD A,L | Frame = 1 + twice the whole pixels + the half: the faster, the further bent; no more than one past the top speed (top_speed). | |
| C554 | AND $80 | |||
| C556 | RLCA | |||
| C557 | SLA H | |||
| C559 | ADD A,H | |||
| C55A | INC A | |||
| C55B | LD (IX+$00),A | |||
| C55E | LD A,(top_speed) | |||
| C561 | LD B,A | |||
| C562 | LD A,H | |||
| C563 | CP B | |||
| C564 | JR C,draw_trail_4 | |||
| C566 | INC B | |||
| C567 | LD (IX+$00),B | |||
| draw_trail_4 | C56A | LD A,(death_count) | A countdown at trail_hold (alive only) holds the frame at 6. | |
| C56D | AND A | |||
| C56E | JR NZ,draw_trail_5 | |||
| C570 | LD A,(trail_hold) | |||
| C573 | AND A | |||
| C574 | JR Z,draw_trail_5 | |||
| C576 | DEC A | |||
| C577 | LD (trail_hold),A | |||
| C57A | LD (IX+$00),$06 | |||
| C57E | JR draw_trail_6 | |||
| draw_trail_5 | C580 | LD A,(death_count) | Same frame, no turn and no collision (trail_collision): no erase needed. | |
| C583 | CP $0A | |||
| C585 | JR NC,draw_trail_8 | |||
| C587 | LD A,(trail_collision) | |||
| C58A | AND A | |||
| C58B | JR NZ,draw_trail_6 | |||
| C58D | LD A,(IX+$00) | |||
| C590 | CP E | |||
| C591 | JR NZ,draw_trail_6 | |||
| C593 | LD A,(ship_turned) | |||
| C596 | AND A | |||
| C597 | JR NZ,draw_trail_6 | |||
| C599 | LD (scratch_count),A | |||
| draw_trail_6 | C59C | CALL graphic_frame_list | The new image: x $68, or $78 facing left, at the trail's y. | |
| C59F | LD B,$68 | |||
| C5A1 | LD A,(ship_facing) | |||
| C5A4 | BIT 7,A | |||
| C5A6 | JR Z,draw_trail_7 | |||
| C5A8 | LD B,$78 | |||
| draw_trail_7 | C5AA | LD A,B | ||
| C5AB | LD (trail_x),A | |||
| C5AE | LD (sprite_screen_pos),A | |||
| C5B1 | CALL graphic_frame_list | |||
| C5B4 | CALL read_graphic_size | |||
| C5B7 | CALL set_direct_new | |||
| C5BA | LD IX,direct_draw_one | The 1-byte drawer, or the mirrored one 8 pixels further right. | ||
| C5BE | CALL trail_mirror | |||
| C5C1 | JR NZ,draw_trail_8 | |||
| C5C3 | LD IX,mirrored_draw_one | |||
| C5C7 | LD A,(sprite_screen_pos) | |||
| C5CA | ADD A,$08 | |||
| C5CC | LD (sprite_screen_pos),A | |||
| draw_trail_8 | C5CF | CALL draw_direct_pair | Erase and draw. | |
| C5D2 | XOR A | The collision flag is dealt with. | ||
| C5D3 | LD (trail_collision),A | |||
| C5D6 | LD A,(trail_frame) | Unless it is frame 6, the attribute cell 7 rows above its bottom made white. | ||
| C5D9 | CP $06 | |||
| C5DB | JP Z,draw_trail_9 | |||
| C5DE | LD HL,(sprite_screen_pos) | |||
| C5E1 | LD A,H | |||
| C5E2 | SUB $07 | |||
| C5E4 | LD H,A | |||
| C5E5 | CALL pixel_to_attribute | |||
| C5E8 | LD (HL),$47 | |||
|
This entry point is used by the routine at draw_ship.
|
||||
| draw_trail_9 | C5EA | CALL check_pause_in_play | The pause key and the fire button. | |
| C5ED | CALL fire | |||
| C5F0 | LD A,(death_count) | Alive, on even passes: the lift jet. | ||
| C5F3 | CP $0A | |||
| C5F5 | JR NC,side_jet | |||
| C5F7 | LD A,(pass_counter) | |||
| C5FA | AND $01 | |||
| C5FC | JP Z,lift_jet | |||
| Prev: C421 | Up: Map | Next: C5FF |