Prev: E69D Up: Map Next: E6BE
E6A5: Read Room State
Used by the routines at Draw_Room, Set_Up_Stalactites and Handle_Collectable.
Reads the entry of the room visit table (see Room_Visit_Table) for the room that an object is in. The address of the entry is worked out in the same way as the address of the world map entry (see Find_World_Map_Address), but from 6000 instead of 7000.
Input
IX Object record
Output
A First byte of the entry
HL Address of the entry
Read_Room_State E6A5 LD H,(IX+$04) Fetch the room y of the object into H.
E6A8 XOR A Clear A.
E6A9 SRL H Move the three low bits of the room y into the top of A, so that H holds the room y divided by eight.
E6AB RRA
E6AC SRL H
E6AE RRA
E6AF SRL H
E6B1 RRA
E6B2 LD L,(IX+$02) Fetch the room x of the object into L.
E6B5 ADD A,L Add the room x twice to A.
E6B6 ADD A,L
E6B7 LD L,A Store the result in L.
E6B8 LD BC,$6000 Set BC to 6000.
E6BB ADD HL,BC Add it to the offset.
E6BC LD A,(HL) Fetch the first byte of the entry.
E6BD RET Return.
Prev: E69D Up: Map Next: E6BE