2020-02-21 22:48:51 +00:00
|
|
|
CountSetBits::
|
|
|
|
; Count the number of set bits in b bytes starting from hl.
|
|
|
|
; Return in a, c and [wNumSetBits].
|
|
|
|
ld c, 0
|
|
|
|
.next
|
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
|
|
|
ld d, 8
|
|
|
|
|
|
|
|
.count
|
|
|
|
srl e
|
|
|
|
ld a, 0
|
|
|
|
adc c
|
|
|
|
ld c, a
|
|
|
|
dec d
|
|
|
|
jr nz, .count
|
|
|
|
|
|
|
|
dec b
|
|
|
|
jr nz, .next
|
|
|
|
|
|
|
|
ld a, c
|
|
|
|
ld [wNumSetBits], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
GetWeekday::
|
|
|
|
ld a, [wCurDay]
|
|
|
|
.mod
|
|
|
|
sub 7
|
|
|
|
jr nc, .mod
|
|
|
|
add 7
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SetSeenAndCaughtMon::
|
2013-09-19 01:54:31 +00:00
|
|
|
push af
|
|
|
|
ld c, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPokedexCaught
|
2013-09-19 01:54:31 +00:00
|
|
|
ld b, SET_FLAG
|
|
|
|
call PokedexFlagAction
|
|
|
|
pop af
|
|
|
|
; fallthrough
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
SetSeenMon::
|
2013-09-19 01:54:31 +00:00
|
|
|
ld c, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPokedexSeen
|
2013-09-19 01:54:31 +00:00
|
|
|
ld b, SET_FLAG
|
|
|
|
jr PokedexFlagAction
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CheckCaughtMon::
|
2013-09-19 01:54:31 +00:00
|
|
|
ld c, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPokedexCaught
|
2013-09-19 01:54:31 +00:00
|
|
|
ld b, CHECK_FLAG
|
|
|
|
jr PokedexFlagAction
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
CheckSeenMon::
|
2013-09-19 01:54:31 +00:00
|
|
|
ld c, a
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPokedexSeen
|
2013-09-19 01:54:31 +00:00
|
|
|
ld b, CHECK_FLAG
|
|
|
|
; fallthrough
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
PokedexFlagAction::
|
2013-09-19 01:54:31 +00:00
|
|
|
ld d, 0
|
2018-01-16 19:30:10 +00:00
|
|
|
predef SmallFarFlagAction
|
2013-09-19 01:54:31 +00:00
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
ret
|