Prev: 42851 Up: Map Next: 42964
42911: 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 42911 LD A,(38571) Fetch the room of the orchid from Moved_Actor_Room.
42914 CALL HandlerOrchidType Find the state of the orchid for the room.
42917 PUSH IX Stash the actor pointer on the stack.
42919 LD IX,38874 Point IX at the orchid's actor record at OrchidData.
42923 LD A,(IX+0) Fetch the sprite ID of the orchid.
42926 AND %00000111 Keep only the stage of growth (bits 0-2).
42928 LD C,A Stash the stage of growth in C.
42929 LD A,(IX+2) Fetch the direction of growth of the orchid.
42932 AND %00001000 Keep only the direction of growth (bit 3).
42934 OR C Merge in the stage of growth.
42935 LD C,A Stash the stage and direction of growth in C.
42936 LD A,(IX+7) Fetch the high byte of the timer of the orchid.
42939 RLCA Rotate the high byte of the timer left four times.
42940 RLCA
42941 RLCA
42942 RLCA
42943 AND %11110000 Keep only bits 4-7.
42945 OR C Merge in the stage and direction of growth.
42946 LD (HL),A Store the first byte of the state in the table.
42947 INC HL Move onto the second byte of the state.
42948 LD A,(IX+5) Fetch the colour of the orchid.
42951 AND %00000111 Keep only the colour (bits 0-2).
42953 LD B,A Stash the colour in B.
42954 LD A,(IX+6) Fetch the low byte of the timer of the orchid.
42957 AND %11111000 Keep only the low bits of the timer (bits 3-7).
42959 OR B Merge in the colour.
42960 LD (HL),A Store the second byte of the state in the table.
42961 POP IX Restore the actor pointer from the stack.
42963 RET Return.
Prev: 42851 Up: Map Next: 42964