Prev: B853 Up: Map Next: B881
B863: Visit Room
Used by the routine at BuildRoomObjects.
Sets the bit for the room that the player is in, in RoomsVisitedBitmap. The bit to set is chosen by changing the opcode of the instruction at VisitRoom_Set.
Work out the byte and the SET n,(HL) opcode.
VisitRoom B863 LD A,($5B90) Fetch the room from 5B90.
B866 LD C,A Keep it in C.
B867 RRCA Divide the room by eight.
B868 RRCA
B869 RRCA
B86A AND %00011111 Keep only bits 0 to 4.
B86C LD L,A Keep it in L.
B86D LD H,$00 Set H to 00.
B86F LD A,C Fetch the room again.
B870 RLCA Rotate the room three times.
B871 RLCA
B872 RLCA
B873 AND %00111000 Keep only bits 3 to 5.
B875 OR %11000110 Make it a SET n,(HL) opcode.
B877 LD ($B87F),A Write the opcode to B87F.
Set the bit in the bitmap.
B87A LD BC,$5B58 Point HL at RoomsVisitedBitmap plus the byte offset.
B87D ADD HL,BC
This SET n,(HL) is self-modifying.
VisitRoom_Set B87E SET 0,(HL) Set the bit for the room.
B880 RET Return.
View the equivalent code in;
Prev: B853 Up: Map Next: B881