mirror of
https://github.com/thornAvery/jep-hack.git
synced 2026-02-21 23:12:16 +13:00
First Commit
Upload literally everything from the pokecrystal16 expand-move-ID branch
This commit is contained in:
commit
2f8a41f833
4618 changed files with 480386 additions and 0 deletions
110
home/pokedex_flags.asm
Normal file
110
home/pokedex_flags.asm
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
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
|
||||
|
||||
CountSetBits16::
|
||||
; Count the number of set bits in bc bytes starting from hl - assumes bc < $1000
|
||||
; Returns in bc; hl points to the end of the buffer; clobbers everything else
|
||||
; Assumes that CountSetBits will leave hl pointing to the end of the buffer
|
||||
swap b
|
||||
ld a, c
|
||||
swap a
|
||||
and $f
|
||||
or b
|
||||
ld d, a
|
||||
ld a, c
|
||||
jr z, .small_count
|
||||
ld bc, 0
|
||||
and $f
|
||||
jr z, .loop
|
||||
push de
|
||||
call .small_count
|
||||
pop de
|
||||
.loop
|
||||
push bc
|
||||
push de
|
||||
ld b, $10
|
||||
call CountSetBits
|
||||
pop de
|
||||
pop bc
|
||||
add a, c
|
||||
ld c, a
|
||||
jr nc, .handle_loop
|
||||
inc b
|
||||
.handle_loop
|
||||
dec d
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
.small_count
|
||||
ld b, a
|
||||
call CountSetBits
|
||||
ld b, 0
|
||||
ret
|
||||
|
||||
GetWeekday::
|
||||
ld a, [wCurDay]
|
||||
.mod
|
||||
sub 7
|
||||
jr nc, .mod
|
||||
add 7
|
||||
ret
|
||||
|
||||
SetSeenAndCaughtMon::
|
||||
call GetPokemonFlagIndex
|
||||
push de
|
||||
call SetSeenMonIndex
|
||||
pop de
|
||||
SetCaughtMonIndex::
|
||||
ld hl, wPokedexCaught
|
||||
jr SetPokedexStatusMonIndex
|
||||
|
||||
SetSeenMon::
|
||||
call GetPokemonFlagIndex
|
||||
SetSeenMonIndex::
|
||||
ld hl, wPokedexSeen
|
||||
SetPokedexStatusMonIndex:
|
||||
ld b, SET_FLAG
|
||||
jr FlagActionBaseOne
|
||||
|
||||
CheckCaughtMon::
|
||||
call GetPokemonFlagIndex
|
||||
CheckCaughtMonIndex::
|
||||
ld hl, wPokedexCaught
|
||||
jr CheckPokedexStatusMonIndex
|
||||
|
||||
CheckSeenMon::
|
||||
call GetPokemonFlagIndex
|
||||
CheckSeenMonIndex::
|
||||
ld hl, wPokedexSeen
|
||||
CheckPokedexStatusMonIndex:
|
||||
ld b, CHECK_FLAG
|
||||
FlagActionBaseOne:
|
||||
dec de
|
||||
jp FlagAction
|
||||
|
||||
GetPokemonFlagIndex:
|
||||
call GetPokemonIndexFromID
|
||||
ld d, h
|
||||
ld e, l
|
||||
ret
|
||||
Loading…
Add table
Add a link
Reference in a new issue