![]() |
Routines |
| Prev: 50036 | Up: Map | Next: 50687 |
|
Used by the routines at UpdateCrystalStack and ExplodeShip.
Draws the top of the ship, which is one of the six sprites for types 1 to 6: the one that is used depends on the horizontal speed of the ship, and type 6 is used while the ship has just been hit. Then it checks for the pause keys with CheckPauseAndSilence and fires the weapons with FireWeapons. Carries on with DrawMainFlame or DrawSideFlames on alternate frames. This is a best reading of the code.
|
||||
| DrawShipTop | 50413 | LD HL,0 | HL=0. | |
| 50416 | LD (23580),HL | No saved row count. | ||
| 50419 | LD IX,51132 | The ship top object. | ||
| 50423 | CALL FetchObjectFrameTable | Call FetchObjectFrameTable. | ||
| 50426 | LD HL,(51133) | Fetch the word at 51133 into HL. | ||
| 50429 | LD (49027),HL | The position of the ship top. | ||
| 50432 | CALL ReadSpriteSize | Call ReadSpriteSize. | ||
| 50435 | CALL SetFirstRowGroup | Call SetFirstRowGroup. | ||
| 50438 | LD HL,(49027) | Fetch the word at 49027 into HL. | ||
| 50441 | CALL GetScreenAddress | Call GetScreenAddress. | ||
| 50444 | LD IY,42567 | The sixth aligned-row erase. | ||
| 50448 | CALL TestDirection | Call TestDirection. | ||
| 50451 | JR NZ,DrawShipTop_Frame | Jump to DrawShipTop_Frame if the zero flag is clear. | ||
| 50453 | LD IY,42956 | The sixth mirrored-row erase. | ||
| DrawShipTop_Frame | 50457 | EXX | Switch to the alternate registers. | |
| 50458 | LD E,(IX+0) | Read offset 0 of IX into E. | ||
| 50461 | LD A,(51460) | The item the ship is about to pick up. | ||
| 50464 | AND A | Jump to DrawShipTop_Speed if A is zero. | ||
| 50465 | JR Z,DrawShipTop_Speed | |||
| 50467 | LD A,(23608) | The ship row. | ||
| 50470 | SUB 9 | Subtract 9 from A. | ||
| 50472 | LD (51134),A | The row of the carried item. | ||
| 50475 | LD (49028),A | The row the item is drawn on. | ||
| 50478 | LD E,255 | E=255. | ||
| 50480 | XOR A | Clear A. | ||
| 50481 | LD (51460),A | Update the item the ship is about to pick up. | ||
| DrawShipTop_Speed | 50484 | LD HL,(51454) | Fetch the word at 51454 into HL. | |
| 50487 | LD A,H | A=H. | ||
| 50488 | LD H,L | H=L. | ||
| 50489 | LD L,A | L=A. | ||
| 50490 | LD A,H | A=H. | ||
| 50491 | AND A | Jump to DrawShipTop_Fast if A is not zero. | ||
| 50492 | JR NZ,DrawShipTop_Fast | |||
| 50494 | LD A,L | A=L. | ||
| 50495 | CP 128 | Compare A with 128. | ||
| 50497 | LD A,H | A=H. | ||
| 50498 | JR NC,DrawShipTop_Fast | Jump to DrawShipTop_Fast if the carry flag is clear. | ||
| 50500 | LD A,128 | A=128. | ||
| 50502 | LD (51135),A | The ship top faces left. | ||
| 50505 | JR DrawShipTop_Select | Jump to DrawShipTop_Select. | ||
| DrawShipTop_Fast | 50507 | AND %10000000 | Keep the bits of A that are set in 128. | |
| 50509 | LD (51135),A | The facing of the ship top. | ||
| 50512 | CALL NZ,NegateNumber | Call NegateNumber if the zero flag is clear. | ||
| DrawShipTop_Select | 50515 | LD A,L | A=L. | |
| 50516 | AND %10000000 | Keep the bits of A that are set in 128. | ||
| 50518 | RLCA | Rotate A left. | ||
| 50519 | SLA H | Shift H left. | ||
| 50521 | ADD A,H | A gains H. | ||
| 50522 | INC A | Advance A. | ||
| 50523 | LD (IX+0),A | Write A to offset 0 of IX. | ||
| 50526 | LD A,(23614) | The horizontal scroll limit. | ||
| 50529 | LD B,A | B=A. | ||
| 50530 | LD A,H | A=H. | ||
| 50531 | CP B | Jump to DrawShipTop_Hit if A is less than B. | ||
| 50532 | JR C,DrawShipTop_Hit | |||
| 50534 | INC B | Advance B. | ||
| 50535 | LD (IX+0),B | Write B to offset 0 of IX. | ||
| DrawShipTop_Hit | 50538 | LD A,(36691) | The ship state. | |
| 50541 | AND A | Jump to DrawShipTop_Show if A is not zero. | ||
| 50542 | JR NZ,DrawShipTop_Show | |||
| 50544 | LD A,(51137) | The hit-flash timer. | ||
| 50547 | AND A | Jump to DrawShipTop_Show if A is zero. | ||
| 50548 | JR Z,DrawShipTop_Show | |||
| 50550 | DEC A | Step A back. | ||
| 50551 | LD (51137),A | Update the hit-flash timer. | ||
| 50554 | LD (IX+0),6 | Store 6 at offset 0 of IX. | ||
| 50558 | JR DrawShipTop_Position | Jump to DrawShipTop_Position. | ||
| DrawShipTop_Show | 50560 | LD A,(36691) | The ship state. | |
| 50563 | CP 10 | Jump to DrawShipTop_Draw if A is 10 or more. | ||
| 50565 | JR NC,DrawShipTop_Draw | |||
| 50567 | LD A,(53436) | The collision kind. | ||
| 50570 | AND A | Jump to DrawShipTop_Position if A is not zero. | ||
| 50571 | JR NZ,DrawShipTop_Position | |||
| 50573 | LD A,(IX+0) | Read offset 0 of IX. | ||
| 50576 | CP E | Jump to DrawShipTop_Position if A is not E. | ||
| 50577 | JR NZ,DrawShipTop_Position | |||
| 50579 | LD A,(51136) | The turn flag. | ||
| 50582 | AND A | Jump to DrawShipTop_Position if A is not zero. | ||
| 50583 | JR NZ,DrawShipTop_Position | |||
| 50585 | LD (23580),A | The ship is not turning. | ||
| DrawShipTop_Position | 50588 | CALL FetchObjectFrameTable | Call FetchObjectFrameTable. | |
| 50591 | LD B,104 | B=104. | ||
| 50593 | LD A,(51453) | The ship's facing. | ||
| 50596 | BIT 7,A | Jump to DrawShipTop_Store if bit 7 of A is clear. | ||
| 50598 | JR Z,DrawShipTop_Store | |||
| 50600 | LD B,120 | B=120. | ||
| DrawShipTop_Store | 50602 | LD A,B | A=B. | |
| 50603 | LD (51133),A | The column of the ship top. | ||
| 50606 | LD (49027),A | The column of the ship top. | ||
| 50609 | CALL FetchObjectFrameTable | Call FetchObjectFrameTable. | ||
| 50612 | CALL ReadSpriteSize | Call ReadSpriteSize. | ||
| 50615 | CALL SetSecondRowGroup | Call SetSecondRowGroup. | ||
| 50618 | LD IX,42641 | The sixth aligned-row draw. | ||
| 50622 | CALL TestDirection | Call TestDirection. | ||
| 50625 | JR NZ,DrawShipTop_Draw | Jump to DrawShipTop_Draw if the zero flag is clear. | ||
| 50627 | LD IX,43001 | The sixth mirrored-row draw. | ||
| 50631 | LD A,(49027) | The column of the ship top. | ||
| 50634 | ADD A,8 | Add 8 to A. | ||
| 50636 | LD (49027),A | The column one byte to the right. | ||
| DrawShipTop_Draw | 50639 | CALL DrawSpritesDirectly | Call DrawSpritesDirectly. | |
| 50642 | XOR A | Clear A. | ||
| 50643 | LD (53436),A | Update the collision kind. | ||
| 50646 | LD A,(51132) | The ship top object. | ||
| 50649 | CP 6 | Jump to DrawShipTop_Pause if A is 6. | ||
| 50651 | JP Z,DrawShipTop_Pause | |||
| 50654 | LD HL,(49027) | Fetch the word at 49027 into HL. | ||
| 50657 | LD A,H | A=H. | ||
| 50658 | SUB 7 | Subtract 7 from A. | ||
| 50660 | LD H,A | H=A. | ||
| 50661 | CALL AttributeAddress | Call AttributeAddress. | ||
| 50664 | LD (HL),71 | Store 71 at the address in HL. | ||
|
This entry point is used by the routine at RunFrame.
|
||||
| DrawShipTop_Pause | 50666 | CALL CheckPauseAndSilence | Call CheckPauseAndSilence. | |
| 50669 | CALL FireWeapons | Call FireWeapons. | ||
| 50672 | LD A,(36691) | The ship state. | ||
| 50675 | CP 10 | Jump to DrawSideFlames if A is 10 or more. | ||
| 50677 | JR NC,DrawSideFlames | |||
| 50679 | LD A,(39524) | The frame counter. | ||
| 50682 | AND %00000001 | Keep the bits of A that are set in 1. | ||
| 50684 | JP Z,DrawMainFlame | Jump to DrawMainFlame if the zero flag is set. | ||
|
Continue on to DrawSideFlames.
|
||||
| Prev: 50036 | Up: Map | Next: 50687 |