Prev: B863 Up: Map Next: B899
B881: Count the rooms seen
Used by the routine at GAME_ENDED.
Counts the set bits in the 32 bytes of ROOMS_SEEN, less one. Used for the rating after a game (GAME_ENDED).
Output
A the number of rooms seen, less one
COUNT_ROOMS_SEEN B881 LD E,$00 E counts; 8 bits in each of 32 bytes
B883 LD BC,$0820
B886 LD HL,ROOMS_SEEN
COUNT_ROOMS_SEEN_0 B889 PUSH BC count this byte's bits
B88A LD A,(HL)
B88B INC HL
COUNT_ROOMS_SEEN_1 B88C RRCA
B88D JR NC,COUNT_ROOMS_SEEN_2
B88F INC E
COUNT_ROOMS_SEEN_2 B890 DJNZ COUNT_ROOMS_SEEN_1
B892 POP BC the next byte
B893 DEC C
B894 JR NZ,COUNT_ROOMS_SEEN_0
B896 LD A,E less one
B897 DEC A
B898 RET
Prev: B863 Up: Map Next: B899