Prev: 59037 Up: Map Next: 59070
59045: 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 24576 instead of 28672.
Input
IX Object record
Output
A First byte of the entry
HL Address of the entry
Read_Room_State 59045 LD H,(IX+4) Fetch the room y of the object into H.
59048 XOR A Clear A.
59049 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.
59051 RRA
59052 SRL H
59054 RRA
59055 SRL H
59057 RRA
59058 LD L,(IX+2) Fetch the room x of the object into L.
59061 ADD A,L Add the room x twice to A.
59062 ADD A,L
59063 LD L,A Store the result in L.
59064 LD BC,24576 Set BC to 24576.
59067 ADD HL,BC Add it to the offset.
59068 LD A,(HL) Fetch the first byte of the entry.
59069 RET Return.
Prev: 59037 Up: Map Next: 59070