Prev: D1EF Up: Map Next: D237
D219: Mark the player's room as visited
Used by the routine at build_room.
$5BE8 to $5C07 is a 256-bit map of the castle, a bit per room number. The byte is the room number divided by 8; the bit number is the bottom three bits, and since SET takes its bit number in the opcode, the second opcode byte of the SET n,(HL) near the end of this routine is rewritten before it runs. calc_and_display_percent counts the bits for the percentage shown when the game ends.
flag_room_visited D219 LD A,($5C10) HL = room / 8
D21C LD C,A
D21D RRCA
D21E RRCA
D21F RRCA
D220 AND $1F
D222 LD L,A
D223 LD H,$00
D225 LD A,C opcode byte for SET (room AND 7),(HL)
D226 RLCA
D227 RLCA
D228 RLCA
D229 AND $38
D22B OR $C6
D22D LD ($D235),A
D230 LD BC,$5BE8 set the bit in the map
D233 ADD HL,BC
D234 SET 0,(HL)
D236 RET
Prev: D1EF Up: Map Next: D237