Prev: D1E6 Up: Map Next: D237
D219: Visit Room
Used by the routine at BuildRoomObjects.
Flags the room that the player is in as visited, in the bitmap of the rooms at RoomsVisitedBitmap. The bit that is set is chosen by changing the instruction at VisitRoom_Set, which is a SET instruction, by changing the byte that follows it.
Set the bit of this room in RoomsVisitedBitmap.
VisitRoom D219 LD A,($5C10) Fetch the room number.
D21C LD C,A Stash it in C.
D21D RRCA Divide it by eight.
D21E RRCA
D21F RRCA
D220 AND %00011111 Keep the offset of the byte.
D222 LD L,A Stash it in L.
D223 LD H,$00 Clear the high byte of the offset.
D225 LD A,C Fetch the room number.
D226 RLCA Move the low three bits to bits 3 to 5.
D227 RLCA
D228 RLCA
D229 AND %00111000 Keep them.
D22B OR %11000110 Make them into the second byte of an instruction to set that bit.
D22D LD ($D235),A Put the byte into the instruction at VisitRoom_Set.
D230 LD BC,$5BE8 Point BC at RoomsVisitedBitmap.
D233 ADD HL,BC Add the offset of the byte.
VisitRoom_Set D234 SET 0,(HL) Set the bit of the room.
D236 RET Return.
View the equivalent code in;
Prev: D1E6 Up: Map Next: D237