Prev: A763 Up: Map Next: A7D4
A79F: Save Orchid
Used by the routine at DrawRoomContents.
Stores the state of the orchid in OrchidData back into the table in TableOrchidTypes, for the room which it was in (held in Moved_Actor_Room), so that it is as it was left when the player returns to the room. This is the opposite of LoadOrchid.
SaveOrchid A79F LD A,($96AB) Fetch the room of the orchid from Moved_Actor_Room.
A7A2 CALL HandlerOrchidType Find the state of the orchid for the room.
A7A5 PUSH IX Stash the actor pointer on the stack.
A7A7 LD IX,$97DA Point IX at the orchid's actor record at OrchidData.
A7AB LD A,(IX+$00) Fetch the sprite ID of the orchid.
A7AE AND %00000111 Keep only the stage of growth (bits 0-2).
A7B0 LD C,A Stash the stage of growth in C.
A7B1 LD A,(IX+$02) Fetch the direction of growth of the orchid.
A7B4 AND %00001000 Keep only the direction of growth (bit 3).
A7B6 OR C Merge in the stage of growth.
A7B7 LD C,A Stash the stage and direction of growth in C.
A7B8 LD A,(IX+$07) Fetch the high byte of the timer of the orchid.
A7BB RLCA Rotate the high byte of the timer left four times.
A7BC RLCA
A7BD RLCA
A7BE RLCA
A7BF AND %11110000 Keep only bits 4-7.
A7C1 OR C Merge in the stage and direction of growth.
A7C2 LD (HL),A Store the first byte of the state in the table.
A7C3 INC HL Move onto the second byte of the state.
A7C4 LD A,(IX+$05) Fetch the colour of the orchid.
A7C7 AND %00000111 Keep only the colour (bits 0-2).
A7C9 LD B,A Stash the colour in B.
A7CA LD A,(IX+$06) Fetch the low byte of the timer of the orchid.
A7CD AND %11111000 Keep only the low bits of the timer (bits 3-7).
A7CF OR B Merge in the colour.
A7D0 LD (HL),A Store the second byte of the state in the table.
A7D1 POP IX Restore the actor pointer from the stack.
A7D3 RET Return.
Prev: A763 Up: Map Next: A7D4