2020-02-21 14:48:51 -08: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 07:09:41 -07:00
|
|
|
SetSeenAndCaughtMon::
|
2013-09-18 18:54:31 -07:00
|
|
|
push af
|
|
|
|
ld c, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPokedexCaught
|
2013-09-18 18:54:31 -07:00
|
|
|
ld b, SET_FLAG
|
|
|
|
call PokedexFlagAction
|
|
|
|
pop af
|
|
|
|
; fallthrough
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SetSeenMon::
|
2013-09-18 18:54:31 -07:00
|
|
|
ld c, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPokedexSeen
|
2013-09-18 18:54:31 -07:00
|
|
|
ld b, SET_FLAG
|
|
|
|
jr PokedexFlagAction
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CheckCaughtMon::
|
2013-09-18 18:54:31 -07:00
|
|
|
ld c, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPokedexCaught
|
2013-09-18 18:54:31 -07:00
|
|
|
ld b, CHECK_FLAG
|
|
|
|
jr PokedexFlagAction
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CheckSeenMon::
|
2013-09-18 18:54:31 -07:00
|
|
|
ld c, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPokedexSeen
|
2013-09-18 18:54:31 -07:00
|
|
|
ld b, CHECK_FLAG
|
|
|
|
; fallthrough
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
PokedexFlagAction::
|
2013-09-18 18:54:31 -07:00
|
|
|
ld d, 0
|
2018-01-16 11:30:10 -08:00
|
|
|
predef SmallFarFlagAction
|
2013-09-18 18:54:31 -07:00
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
ret
|