![]() |
Routines |
| Prev: D771 | Up: Map | Next: D7E7 |
|
Used by the routine at GoldfishGame.
|
||||
|
The sea is always the paper colour.
|
||||
| Handler_SeaCreatures | D778 | LD A,$11 | Set PAPER: BLUE (01). | |
| D77A | RST $10 | |||
| D77B | LD A,$01 | |||
| D77D | RST $10 | |||
| D77E | LD IX,$DB46 | IX=Data_SeaCreatures. | ||
| Handler_SeaCreatures_Loop | D782 | PUSH BC | Stash BC on the stack. | |
|
Should we deal with an existing creature or generate a new one?
|
||||
| D783 | LD A,(IX+$0A) | If *IX+0A is equal to 00 this is a "free-slot" so jump to Handler_SeaCreatures_Chooser. | ||
| D786 | CP $00 | |||
| D788 | JP Z,Handler_SeaCreatures_Chooser | |||
|
The sea creature for this slot is already set, so update it.
|
||||
| D78B | LD L,(IX+$10) | Fetch the UDG graphics pointer for this sea creature and store it in HL. | ||
| D78E | LD H,(IX+$11) | |||
| D791 | LD ($5C36),HL | Write the UDG graphics pointer to *CHARS. | ||
| D794 | LD A,$10 | Set the INK value for this sea creature using *IX+09. | ||
| D796 | RST $10 | |||
| D797 | LD A,(IX+$09) | |||
| D79A | RST $10 | |||
| D79B | LD A,(IX+$06) | Get the current sprite/ frame ID from *IX+06. | ||
|
The sprite increment number is held by *IX+12, it varies between creatures as obviously they are different sizes.
|
||||
| D79E | ADD A,(IX+$12) | Add on the sprite increment number. | ||
| D7A1 | CP (IX+$13) | Jump to Handler_SeaCreatures_SetFrameId if A is not yet equal to the maximum value held by *IX+13. | ||
| D7A4 | JR NZ,Handler_SeaCreatures_SetFrameId | |||
| D7A6 | LD A,$20 | Reset the sprite/ frame ID back to 20 which is always the first frame. | ||
| Handler_SeaCreatures_SetFrameId | D7A8 | LD (IX+$06),A | Update the current sprite/ frame ID back to *IX+06. | |
| D7AB | CALL Handler_SeaCreatureMovement | Call Handler_SeaCreatureMovement. | ||
| D7AE | LD (IX+$00),C | Write the updated co-ordinates to *IX+00/ *IX+01. | ||
| D7B1 | LD (IX+$01),B | |||
| D7B4 | LD (IX+$02),E | Write the updated block position offsets to *IX+02/ *IX+03. | ||
| D7B7 | LD (IX+$03),D | |||
| D7BA | CALL Handler_SeaCreatureAnimation | Call Handler_SeaCreatureAnimation. | ||
| D7BD | LD A,C | Jump to SeaCreature_FreeSlot if the current creature is now off-screen. | ||
| D7BE | CP $01 | |||
| D7C0 | JP Z,SeaCreature_FreeSlot | |||
| D7C3 | CALL $D647 | Call D647. | ||
| D7C6 | LD A,(IX+$00) | Stash the current co-ordinates at *IX+0D/ *IX+0E. | ||
| D7C9 | LD (IX+$0D),A | |||
| D7CC | LD A,(IX+$01) | |||
| D7CF | LD (IX+$0E),A | |||
| D7D2 | LD A,(IX+$02) | Stash the current block position offsets at *IX+0B/ *IX+0F. | ||
| D7D5 | LD (IX+$0B),A | |||
| D7D8 | LD A,(IX+$03) | |||
| D7DB | LD (IX+$0F),A | |||
|
This entry point is used by the routines at SeaCreature_FreeSlot and Handler_SeaCreatures_Chooser.
|
||||
| Handler_SeaCreatures_Next | D7DE | LD DE,$0018 | IX+=0018. | |
| D7E1 | ADD IX,DE | |||
| D7E3 | POP BC | Restore BC from the stack. | ||
| D7E4 | DJNZ Handler_SeaCreatures_Loop | Decrease counter by one and loop back to Handler_SeaCreatures_Loop until counter is zero. | ||
| D7E6 | RET | Return. | ||
| Prev: D771 | Up: Map | Next: D7E7 |