Prev: C6B6 Up: Map Next: C6EA
C6CC: 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 C6CC LD A,(IX+$08) Fetch the room.
C6CF RRA Move the upper five bits of the room to the lower five.
C6D0 RRA
C6D1 RRA
C6D2 AND %00011111 Keep only those bits.
C6D4 LD E,A Set the offset of the byte in E.
C6D5 LD A,(IX+$08) Fetch the room again.
Make the bit for this room.
C6D8 AND %00000111 Keep only the lower three bits.
C6DA LD B,A Keep the bit number.
C6DB INC B Add one to it, to be the number of times to rotate.
C6DC XOR A Start with all of the bits clear.
C6DD SCF Set the carry flag.
MarkRoomVisited_Rotate C6DE RRA Rotate the carry flag in from the left.
C6DF DJNZ MarkRoomVisited_Rotate Decrease the counter and loop until the bit is in place.
Set the bit in the table of rooms visited.
C6E1 LD D,$00 Set D to zero, to make the offset of the byte a whole number.
C6E3 LD HL,$A74F Start at the table of rooms visited.
C6E6 ADD HL,DE Add the offset to get the address of the byte.
C6E7 OR (HL) Add the bit for this room to those that are set.
C6E8 LD (HL),A Set the byte.
C6E9 RET Return.
Prev: C6B6 Up: Map Next: C6EA