Prev: 50870 Up: Map Next: 50922
50892: Mark Room Visited
Used by the routine at BuildRoom.
Sets the bit for a room in the table of the rooms that the player has visited, RoomsVisitedBitmap. The room number is in eight bits: the upper five choose the byte, and the lower three choose the bit, starting from the top of the byte.
Input
IX Record of the legs, which holds the number of the room
Find the byte for this room.
MarkRoomVisited 50892 LD A,(IX+8) Fetch the room.
50895 RRA Move the upper five bits of the room to the lower five.
50896 RRA
50897 RRA
50898 AND %00011111 Keep only those bits.
50900 LD E,A Set the offset of the byte in E.
50901 LD A,(IX+8) Fetch the room again.
Make the bit for this room.
50904 AND %00000111 Keep only the lower three bits.
50906 LD B,A Keep the bit number.
50907 INC B Add one to it, to be the number of times to rotate.
50908 XOR A Start with all of the bits clear.
50909 SCF Set the carry flag.
MarkRoomVisited_Rotate 50910 RRA Rotate the carry flag in from the left.
50911 DJNZ MarkRoomVisited_Rotate Decrease the counter and loop until the bit is in place.
Set the bit in the table of rooms visited.
50913 LD D,0 Set D to zero, to make the offset of the byte a whole number.
50915 LD HL,42831 Start at the table of rooms visited.
50918 ADD HL,DE Add the offset to get the address of the byte.
50919 OR (HL) Add the bit for this room to those that are set.
50920 LD (HL),A Set the byte.
50921 RET Return.
Prev: 50870 Up: Map Next: 50922