Prev: A737 Up: Map Next: A79F
A763: Load Orchid
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.
Input
IX Actor record of the player
LoadOrchid A763 LD A,(IX+$01) Fetch the room of the player.
A766 CALL HandlerOrchidType Find the state of the orchid for the room.
A769 LD DE,$97DA Point DE at the orchid's actor record at OrchidData.
A76C LD C,(HL) Fetch the state of the orchid from the table into C and B.
A76D INC HL
A76E LD B,(HL)
A76F LD A,C Copy the first byte of the state to A.
A770 AND %00000111 Keep only the stage of growth (bits 0-2).
A772 OR %01001000 Set bits 3 and 6, giving a sprite ID of 48 to 4F.
A774 LD (DE),A Set the sprite ID of the orchid.
A775 INC DE Move onto the room of the orchid.
A776 LD A,(IX+$01) Fetch the room of the player.
A779 LD (DE),A Set the room of the orchid.
A77A INC DE Move onto the direction of growth of the orchid.
A77B LD A,C Copy the first byte of the state to A.
A77C AND %00001000 Keep only the direction of growth (bit 3).
A77E LD (DE),A Set the direction of growth of the orchid.
A77F INC DE Move onto the X position of the orchid.
A780 CALL HandlerOrchidPosition Find the position of the orchid for the room.
A783 LD A,(HL) Fetch the X position of the orchid.
A784 INC HL Move onto the Y position.
A785 LD (DE),A Set the X position of the orchid.
A786 INC DE Move onto the Y position of the orchid.
A787 LD A,(HL) Fetch the Y position of the orchid.
A788 LD (DE),A Set the Y position of the orchid.
A789 INC DE Move onto the colour of the orchid.
A78A LD A,B Copy the second byte of the state to A.
A78B AND %00000111 Keep only the colour (bits 0-2).
A78D OR %01000000 Set bit 6 (bright).
A78F LD (DE),A Set the colour of the orchid.
A790 INC DE Move onto the timer of the orchid.
A791 LD A,B Copy the second byte of the state to A.
A792 AND %11111000 Keep only the low bits of the timer (bits 3-7).
A794 LD (DE),A Set the low byte of the timer of the orchid.
A795 INC DE Move onto the high byte of the timer.
A796 LD A,C Copy the first byte of the state to A.
A797 RRCA Rotate the first byte of the state right four times.
A798 RRCA
A799 RRCA
A79A RRCA
A79B AND %00001111 Keep only the high bits of the timer (bits 0-3).
A79D LD (DE),A Set the high byte of the timer of the orchid.
A79E RET Return.
Prev: A737 Up: Map Next: A79F