Prev: 47187 Up: Map Next: 47233
47203: 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 47203 LD A,(23440) Fetch the room from 23440.
47206 LD C,A Keep it in C.
47207 RRCA Divide the room by eight.
47208 RRCA
47209 RRCA
47210 AND %00011111 Keep only bits 0 to 4.
47212 LD L,A Keep it in L.
47213 LD H,0 Set H to 0.
47215 LD A,C Fetch the room again.
47216 RLCA Rotate the room three times.
47217 RLCA
47218 RLCA
47219 AND %00111000 Keep only bits 3 to 5.
47221 OR %11000110 Make it a SET n,(HL) opcode.
47223 LD (47231),A Write the opcode to 47231.
Set the bit in the bitmap.
47226 LD BC,23384 Point HL at RoomsVisitedBitmap plus the byte offset.
47229 ADD HL,BC
This SET n,(HL) is self-modifying.
VisitRoom_Set 47230 SET 0,(HL) Set the bit for the room.
47232 RET Return.
View the equivalent code in;
Prev: 47187 Up: Map Next: 47233