![]() |
Routines |
| Prev: 42807 | Up: Map | Next: 42911 |
|
Used by the routines at InitialiseGame and DrawRoomContents.
Sets up the orchid for the room the player is in, using the state of the orchid held in TableOrchidTypes and its position in TableOrchidPositions. The record is built in OrchidData. This is the opposite of SaveOrchid.
|
||||||||
| LoadOrchid | 42851 | LD A,(IX+1) | Fetch the room of the player. | |||||
| 42854 | CALL HandlerOrchidType | Find the state of the orchid for the room. | ||||||
| 42857 | LD DE,38874 | Point DE at the orchid's actor record at OrchidData. | ||||||
| 42860 | LD C,(HL) | Fetch the state of the orchid from the table into C and B. | ||||||
| 42861 | INC HL | |||||||
| 42862 | LD B,(HL) | |||||||
| 42863 | LD A,C | Copy the first byte of the state to A. | ||||||
| 42864 | AND %00000111 | Keep only the stage of growth (bits 0-2). | ||||||
| 42866 | OR %01001000 | Set bits 3 and 6, giving a sprite ID of 72 to 79. | ||||||
| 42868 | LD (DE),A | Set the sprite ID of the orchid. | ||||||
| 42869 | INC DE | Move onto the room of the orchid. | ||||||
| 42870 | LD A,(IX+1) | Fetch the room of the player. | ||||||
| 42873 | LD (DE),A | Set the room of the orchid. | ||||||
| 42874 | INC DE | Move onto the direction of growth of the orchid. | ||||||
| 42875 | LD A,C | Copy the first byte of the state to A. | ||||||
| 42876 | AND %00001000 | Keep only the direction of growth (bit 3). | ||||||
| 42878 | LD (DE),A | Set the direction of growth of the orchid. | ||||||
| 42879 | INC DE | Move onto the X position of the orchid. | ||||||
| 42880 | CALL HandlerOrchidPosition | Find the position of the orchid for the room. | ||||||
| 42883 | LD A,(HL) | Fetch the X position of the orchid. | ||||||
| 42884 | INC HL | Move onto the Y position. | ||||||
| 42885 | LD (DE),A | Set the X position of the orchid. | ||||||
| 42886 | INC DE | Move onto the Y position of the orchid. | ||||||
| 42887 | LD A,(HL) | Fetch the Y position of the orchid. | ||||||
| 42888 | LD (DE),A | Set the Y position of the orchid. | ||||||
| 42889 | INC DE | Move onto the colour of the orchid. | ||||||
| 42890 | LD A,B | Copy the second byte of the state to A. | ||||||
| 42891 | AND %00000111 | Keep only the colour (bits 0-2). | ||||||
| 42893 | OR %01000000 | Set bit 6 (bright). | ||||||
| 42895 | LD (DE),A | Set the colour of the orchid. | ||||||
| 42896 | INC DE | Move onto the timer of the orchid. | ||||||
| 42897 | LD A,B | Copy the second byte of the state to A. | ||||||
| 42898 | AND %11111000 | Keep only the low bits of the timer (bits 3-7). | ||||||
| 42900 | LD (DE),A | Set the low byte of the timer of the orchid. | ||||||
| 42901 | INC DE | Move onto the high byte of the timer. | ||||||
| 42902 | LD A,C | Copy the first byte of the state to A. | ||||||
| 42903 | RRCA | Rotate the first byte of the state right four times. | ||||||
| 42904 | RRCA | |||||||
| 42905 | RRCA | |||||||
| 42906 | RRCA | |||||||
| 42907 | AND %00001111 | Keep only the high bits of the timer (bits 0-3). | ||||||
| 42909 | LD (DE),A | Set the high byte of the timer of the orchid. | ||||||
| 42910 | RET | Return. | ||||||
| Prev: 42807 | Up: Map | Next: 42911 |