Merge branch 'yenatch/split-predefs-specials-stds' into fix-split-predefs-specials-stds

https://github.com/kanzure/pokecrystal/pull/198
This commit is contained in:
Bryan Bishop 2013-09-09 16:00:05 -05:00
commit 33d7ef72fe
7 changed files with 2355 additions and 757 deletions

134
common/copy2.asm Normal file
View File

@ -0,0 +1,134 @@
CopyBytes: ; 0x3026
; copy bc bytes from hl to de
inc b ; we bail the moment b hits 0, so include the last run
inc c ; same thing; include last byte
jr .HandleLoop
.CopyByte
ld a, [hli]
ld [de], a
inc de
.HandleLoop
dec c
jr nz, .CopyByte
dec b
jr nz, .CopyByte
ret
SwapBytes: ; 0x3034
; swap bc bytes between hl and de
.Loop
; stash [hl] away on the stack
ld a, [hl]
push af
; copy a byte from [de] to [hl]
ld a, [de]
ld [hli], a
; retrieve the previous value of [hl]; put it in [de]
pop af
ld [de], a
inc de
; handle loop stuff
dec bc
ld a, b
or c
jr nz, .Loop
ret
ByteFill: ; 0x3041
; fill bc bytes with the value of a, starting at hl
inc b ; we bail the moment b hits 0, so include the last run
inc c ; same thing; include last byte
jr .HandleLoop
.PutByte
ld [hli], a
.HandleLoop
dec c
jr nz, .PutByte
dec b
jr nz, .PutByte
ret
GetFarByte: ; 0x304d
; retrieve a single byte from a:hl, and return it in a.
; bankswitch to new bank
ld [hBuffer], a
ld a, [hROMBank]
push af
ld a, [hBuffer]
rst Bankswitch
; get byte from new bank
ld a, [hl]
ld [hBuffer], a
; bankswitch to previous bank
pop af
rst Bankswitch
; return retrieved value in a
ld a, [hBuffer]
ret
GetFarHalfword: ; 0x305d
; retrieve a halfword from a:hl, and return it in hl.
; bankswitch to new bank
ld [hBuffer], a
ld a, [hROMBank]
push af
ld a, [hBuffer]
rst Bankswitch
; get halfword from new bank, put it in hl
ld a, [hli]
ld h, [hl]
ld l, a
; bankswitch to previous bank and return
pop af
rst Bankswitch
ret
; 0x306b
FarCopyWRAM: ; 306b
ld [hBuffer], a
ld a, [rSVBK]
push af
ld a, [hBuffer]
ld [rSVBK], a
call CopyBytes
pop af
ld [rSVBK], a
ret
; 307b
GetFarWRAMByte: ; 307b
ld [hBuffer], a
ld a, [rSVBK]
push af
ld a, [hBuffer]
ld [rSVBK], a
ld a, [hl]
ld [hBuffer], a
pop af
ld [rSVBK], a
ld a, [hBuffer]
ret
; 308d
GetFarWRAMWord: ; 308d
ld [hBuffer], a
ld a, [rSVBK]
push af
ld a, [hBuffer]
ld [rSVBK], a
ld a, [hli]
ld h, [hl]
ld l, a
pop af
ld [rSVBK], a
ret
; 309d

76
common/math.asm Normal file
View File

@ -0,0 +1,76 @@
SimpleMultiply: ; 3105
; Return a * c.
and a
ret z
push bc
ld b, a
xor a
.loop
add c
dec b
jr nz, .loop
pop bc
ret
; 3110
SimpleDivide: ; 3110
; Divide a by c. Return quotient b and remainder a.
ld b, 0
.loop
inc b
sub c
jr nc, .loop
dec b
add c
ret
; 3119
Multiply: ; 3119
; Multiply hMultiplicand (3 bytes) by hMultiplier. Result in hProduct.
; All values are big endian.
push hl
push bc
callab _Multiply
pop bc
pop hl
ret
; 3124
Divide: ; 3124
; Divide hDividend length b (max 4 bytes) by hDivisor. Result in hQuotient.
; All values are big endian.
push hl
push de
push bc
ld a, [hROMBank]
push af
ld a, BANK(_Divide)
rst Bankswitch
call _Divide
pop af
rst Bankswitch
pop bc
pop de
pop hl
ret
; 3136
SubtractSigned: ; 3136
; Return a - b, sign in carry.
sub b
ret nc
cpl
add 1
scf
ret
; 313d

236
event/name_rater.asm Normal file
View File

@ -0,0 +1,236 @@
NameRater: ; fb6ed
ld hl, UnknownText_0xfb80f
call PrintText
call Function1dcf
jp c, .asm_fb77e
ld hl, UnknownText_0xfb814
call PrintText
callba Function50000
jr c, .asm_fb77e
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_fb783
call GetCurNick
call Functionfb78a
jr c, .asm_fb779
ld hl, UnknownText_0xfb819
call PrintText
call Function1dcf
jr c, .asm_fb77e
ld hl, UnknownText_0xfb81e
call PrintText
xor a
ld [MonType], a
ld a, [CurPartySpecies]
ld [$d265], a
ld [CurSpecies], a
call GetBaseData
ld b, 0
ld de, StringBuffer2
callba Function116b7
call Functionfb7be
ld hl, UnknownText_0xfb837
jr c, .asm_fb76c
call Functionfb7d3
ld hl, UnknownText_0xfb837
jr c, .asm_fb76c
ld hl, PartyMon1Nickname
ld bc, $000b
ld a, [CurPartyMon]
call AddNTimes
ld e, l
ld d, h
ld hl, StringBuffer2
ld bc, $000b
call CopyBytes
ld hl, UnknownText_0xfb823
.asm_fb76c
push hl
call GetCurNick
ld hl, UnknownText_0xfb83c
call PrintText
pop hl
jr .asm_fb786
.asm_fb779
ld hl, UnknownText_0xfb82d
jr .asm_fb786
.asm_fb77e
ld hl, UnknownText_0xfb828
jr .asm_fb786
.asm_fb783
ld hl, UnknownText_0xfb832
.asm_fb786
call PrintText
ret
; fb78a
Functionfb78a: ; fb78a
ld hl, PartyMon1OT
ld bc, $000b
ld a, [CurPartyMon]
call AddNTimes
ld de, PlayerName
ld c, $b
call .asm_fb7b1
jr c, .asm_fb7bc
ld hl, PartyMon1ID
ld bc, PartyMon2 - PartyMon1
ld a, [CurPartyMon]
call AddNTimes
ld de, PlayerID
ld c, $2
.asm_fb7b1
ld a, [de]
cp [hl]
jr nz, .asm_fb7bc
inc hl
inc de
dec c
jr nz, .asm_fb7b1
and a
ret
.asm_fb7bc
scf
ret
; fb7be
Functionfb7be: ; fb7be
ld hl, StringBuffer2
ld c, 10
.asm_fb7c3
ld a, [hli]
cp "@"
jr z, .asm_fb7cf
cp " "
jr nz, .asm_fb7d1
dec c
jr nz, .asm_fb7c3
.asm_fb7cf
scf
ret
.asm_fb7d1
and a
ret
; fb7d3
Functionfb7d3: ; fb7d3
ld hl, PartyMon1Nickname
ld bc, $000b
ld a, [CurPartyMon]
call AddNTimes
push hl
call Functionfb802
ld b, c
ld hl, StringBuffer2
call Functionfb802
pop hl
ld a, c
cp b
jr nz, .asm_fb7fe
ld de, StringBuffer2
.asm_fb7f2
ld a, [de]
cp "@"
jr z, .asm_fb800
cp [hl]
jr nz, .asm_fb7fe
inc hl
inc de
jr .asm_fb7f2
.asm_fb7fe
and a
ret
.asm_fb800
scf
ret
; fb802
Functionfb802: ; fb802
ld c, 0
.asm_fb804
ld a, [hli]
cp "@"
ret z
inc c
ld a, c
cp 10
jr nz, .asm_fb804
ret
; fb80f
UnknownText_0xfb80f: ; 0xfb80f
; Hello, hello! I'm the NAME RATER.
; I rate the names of #MON.
; Would you like me to rate names?
text_jump UnknownText_0x1c0043, BANK(UnknownText_0x1c0043)
db "@"
; 0xfb814
UnknownText_0xfb814: ; 0xfb814
; Which #MON's nickname should I rate for you?
text_jump UnknownText_0x1c00a0, BANK(UnknownText_0x1c00a0)
db "@"
; 0xfb819
UnknownText_0xfb819: ; 0xfb819
; Hm… @ … That's a fairly decent name.
; But, how about a slightly better nickname?
; Want me to give it a better name?
text_jump UnknownText_0x1c00cd, BANK(UnknownText_0x1c00cd)
db "@"
; 0xfb81e
UnknownText_0xfb81e: ; 0xfb81e
; All right. What name should we give it, then?
text_jump UnknownText_0x1c0142, BANK(UnknownText_0x1c0142)
db "@"
; 0xfb823
UnknownText_0xfb823: ; 0xfb823
; That's a better name than before! Well done!
text_jump UnknownText_0x1c0171, BANK(UnknownText_0x1c0171)
db "@"
; 0xfb828
UnknownText_0xfb828: ; 0xfb828
; OK, then. Come again sometime.
text_jump UnknownText_0x1c019e, BANK(UnknownText_0x1c019e)
db "@"
; 0xfb82d
UnknownText_0xfb82d: ; 0xfb82d
; Hm… @ ? What a great name! It's perfect.
; Treat @ with loving care.
text_jump UnknownText_0x1c01be, BANK(UnknownText_0x1c01be)
db "@"
; 0xfb832
UnknownText_0xfb832: ; 0xfb832
; Whoa… That's just an EGG.
text_jump UnknownText_0x1c0208, BANK(UnknownText_0x1c0208)
db "@"
; 0xfb837
UnknownText_0xfb837: ; 0xfb837
; It might look the same as before,
; but this new name is much better! Well done!
text_jump UnknownText_0x1c0222, BANK(UnknownText_0x1c0222)
db "@"
; 0xfb83c
UnknownText_0xfb83c: ; 0xfb83c
; All right. This #MON is now named @ .
text_jump UnknownText_0x1c0272, BANK(UnknownText_0x1c0272)
db "@"
; 0xfb841

1145
main.asm

File diff suppressed because it is too large Load Diff

922
predef/cgb.asm Normal file
View File

@ -0,0 +1,922 @@
; Replaces the functionality of sgb.asm to work with CGB hardware.
CheckCGB: ; 8d55
ld a, [hCGB]
and a
ret
; 8d59
Function8d59: ; 8d59
ld a, b
cp $ff
jr nz, .asm_8d61
ld a, [SGBPredef]
.asm_8d61
cp $fc
jp z, Function96f3
call Function9673
ld l, a
ld h, 0
add hl, hl
ld de, Table8d7a
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld de, Function8d79
push de
jp [hl]
; 8d79
Function8d79: ; 8d79
ret
; 8d7a
Table8d7a: ; 8d7a
dw Function8db8
dw Function8ddb
dw Function8eb9
dw Function8edb
dw Function8f70
dw Function906e
dw Function90f8
dw Function9122
dw Function91ad
dw Function91c8
dw Function91d1
dw Function91e4
dw Function9228
dw Function9251
dw Function9373
dw Function93a6
dw Function93ba
dw Function9195
dw Function9499
dw Function94d0
dw Function93d3
dw Function9289
dw Function903e
dw Function8fca
dw Function925e
dw Function94fa
dw Function9529
dw Function9555
dw Function9578
dw Function9591
dw Function9542
; 8db8
Function8db8: ; 8db8
ld hl, $5c67
ld de, $d000
ld c, $4
call $5615
ld hl, $5c67
ld de, $d020
ld c, $4
call $5615
ld hl, $5c67
ld de, MartPointer
ld c, $2
call $5615
jr Function8e23
Function8ddb: ; 8ddb
ld de, $d000
call Function9729
push hl
call Function9643
call Function973a
push hl
call Function9643
ld a, [EnemyHPPal]
ld l, a
ld h, $0
add hl, hl
add hl, hl
ld bc, $68be
add hl, bc
call Function9643
ld a, [PlayerHPPal]
ld l, a
ld h, $0
add hl, hl
add hl, hl
ld bc, $68be
add hl, bc
call Function9643
ld hl, $68ca
call Function9643
ld de, MartPointer
pop hl
call Function9643
pop hl
call Function9643
ld a, $1
ld [SGBPredef], a
call Function96a4
Function8e23: ; 8e23
call Function8e85
ld hl, AttrMap
ld bc, $0168
ld a, $2
call ByteFill
ld hl, $ce29
ld bc, $080a
ld a, $0
call Function9663
ld hl, $cde3
ld bc, $070a
ld a, $1
call Function9663
ld hl, AttrMap
ld bc, $040a
ld a, $2
call Function9663
ld hl, $ce6f
ld bc, $050a
ld a, $3
call Function9663
ld hl, $cebf
ld bc, $0109
ld a, $4
call Function9663
ld hl, $cec9
ld bc, $0078
ld a, $7
call ByteFill
ld hl, $579c
ld de, $d050
ld bc, $0030
ld a, $5
call FarCopyWRAM
call Function96b3
ret
; 8e85
Function8e85: ; 8e85
ld a, $40
ld hl, $4dc0
rst FarCall
ld hl, $7311
jr nc, .asm_8e93
ld hl, $7309
.asm_8e93
ld de, $d038
ld bc, $0008
ld a, $5
call FarCopyWRAM
ret
; 8e9f
Function8e9f: ; 8e9f
callba Function100dc0
ld hl, $7311
jr nc, .asm_8ead
ld hl, $7309
.asm_8ead
ld de, $d000
ld bc, $0008
ld a, $5
call FarCopyWRAM
ret
; 8eb9
Function8eb9: ; 8eb9
ld a, [PlayerGender]
bit 0, a
jr z, .asm_8ec5
ld hl, $7759
jr .asm_8ec8
.asm_8ec5
ld hl, $7729
.asm_8ec8
ld de, $d000
ld bc, $0030
ld a, $5
call FarCopyWRAM
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 8edb
Function8edb: ; 8edb
ld de, $d000
ld a, [$cda1]
ld l, a
ld h, $0
add hl, hl
add hl, hl
ld bc, $68be
add hl, bc
call Function9643
ld a, [CurPartySpecies]
ld bc, TempMonDVs
call Function974b
call Function9643
ld hl, $68ca
call Function9643
ld hl, $4f52
ld de, $d018
ld bc, $0018
ld a, $5
call FarCopyWRAM
call Function9699
ld hl, AttrMap
ld bc, $0814
ld a, $1
call Function9663
ld hl, $cf23
ld bc, $000a
ld a, $2
call ByteFill
ld hl, $ce4a
ld bc, $0202
ld a, $3
call Function9663
ld hl, $ce4c
ld bc, $0202
ld a, $4
call Function9663
ld hl, $ce4e
ld bc, $0202
ld a, $5
call Function9663
call Function96b3
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 8f52
INCBIN "baserom.gbc", $8f52, $8f70 - $8f52
Function8f70: ; 8f70
ld de, Unkn1Pals
ld a, $1d
call Function9625
call Function9630
ld a, [CurPartySpecies]
cp $ff
jr nz, .asm_8f8a
ld hl, $4fba
call Function9630
jr .asm_8f90
.asm_8f8a
call Function9775
call Function9643
.asm_8f90
call Function9699
ld hl, $cdee
ld bc, $0707
ld a, $1
call Function9663
call Function971a
ld hl, $4fc2
ld de, $d078
ld bc, $0008
ld a, $5
call FarCopyWRAM
call Function96b3
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 8fba
INCBIN "baserom.gbc", $8fba, $8fca - $8fba
Function8fca: ; 8fca
ld de, Unkn1Pals
ld a, $1d
call Function9625
call Function9630
ld a, [CurPartySpecies]
cp $ff
jr nz, .asm_8fe4
ld hl, $5036
call Function9630
jr .asm_8fed
.asm_8fe4
ld bc, TempMonDVs
call Function974b
call Function9643
.asm_8fed
call Function9699
ld hl, $ce2a
ld bc, $0707
ld a, $1
call Function9663
call Function971a
call Function96b3
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 9009
INCBIN "baserom.gbc", $9009, $903e - $9009
Function903e: ; 903e
ld de, Unkn1Pals
ld a, $1d
call Function9625
call Function9630
ld a, [CurPartySpecies]
call Function9775
call Function9643
call Function9699
ld hl, $ce44
ld bc, $0707
ld a, $1
call Function9663
call Function971a
call Function96b3
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 906e
Function906e: ; 906e
ld hl, $77a9
ld de, Unkn1Pals
ld bc, $0080
ld a, $5
call FarCopyWRAM
call Function9699
ld hl, $ce01
ld bc, $0a03
ld a, $2
call Function9663
ld hl, $ce12
ld bc, $0a03
ld a, $2
call Function9663
ld hl, $ce29
ld bc, $0603
ld a, $3
call Function9663
ld hl, $ce3a
ld bc, $0603
ld a, $3
call Function9663
ld hl, $ce51
ld bc, $0203
ld a, $4
call Function9663
ld hl, $ce62
ld bc, $0203
ld a, $4
call Function9663
ld hl, $ce05
ld bc, $020c
ld a, $1
call Function9663
ld hl, $ce04
ld bc, $0a01
ld a, $1
call Function9663
ld hl, $ce11
ld bc, $0a01
ld a, $1
call Function9663
ld hl, $cec9
ld bc, $0078
ld a, $7
call ByteFill
call Function96b3
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 90f8
Function90f8: ; 90f8
ld hl, $5ca7
call Function9610
call Function9699
ld de, Unkn2Pals
ld a, $3c
call Function9625
call Function9630
ld hl, $ce51
ld bc, $0c14
ld a, $1
call Function9663
call Function96b3
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 9122
Function9122: ; 9122
ld b, $0
ld hl, $512d
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 912d
INCBIN "baserom.gbc", $912d, $9195 - $912d
Function9195: ; 9195
ld hl, $7789
ld de, Unkn1Pals
ld bc, $0028
ld a, $5
call FarCopyWRAM
call Function96a4
call Function9699
call Function96b3
ret
; 91ad
Function91ad: ; 91ad
ld hl, $7641
ld de, Unkn1Pals
ld bc, $0080
ld a, $5
call FarCopyWRAM
ld hl, $5cb7
call Function9610
call Function9699
call Function96b3
ret
; 91c8
Function91c8: ; 91c8
call Functionb1de
ld a, $9
ld [SGBPredef], a
ret
; 91d1
Function91d1: ; 91d1
ld hl, $5c57
call Function9610
call Function8e9f
call Function8e85
call Function971a
call Function96b3
ret
; 91e4
Function91e4: ; 91e4
ld de, Unkn1Pals
ld a, c
and a
jr z, .asm_91f5
ld a, $1a
call Function9625
call Function9630
jr .asm_921a
.asm_91f5
ld hl, PartyMon1DVs
ld bc, $0030
ld a, [CurPartyMon]
call AddNTimes
ld c, l
ld b, h
ld a, [PlayerHPPal]
call Function974b
call Function9643
ld hl, $579c
ld de, $d050
ld bc, $0030
ld a, $5
call FarCopyWRAM
.asm_921a
call Function9699
call Function96b3
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 9228
Function9228: ; 9228
ld hl, $76f1
ld de, Unkn1Pals
ld bc, $0028
ld a, $5
call FarCopyWRAM
ld hl, $7719
ld de, Unkn2Pals
ld bc, $0010
ld a, $5
call FarCopyWRAM
ld a, $8
ld [SGBPredef], a
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 9251
Function9251: ; 9251
ld hl, $5cb7
call Function9610
call Function9699
call Function96b3
ret
; 925e
Function925e: ; 925e
ld hl, $5bc7
call Function9610
ld de, Unkn2Pals
ld a, $4c
call Function9625
call Function9630
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
ld hl, Unkn2Pals
ld a, $1f
ld [hli], a
ld a, $0
ld [hl], a
pop af
ld [rSVBK], a
call Function9699
call Function96b3
ret
; 9289
Function9289: ; 9289
ld de, Unkn1Pals
xor a
call Function976b
call Function9643
ld a, $1
call Function976b
call Function9643
ld a, $3
call Function976b
call Function9643
ld a, $2
call Function976b
call Function9643
ld a, $4
call Function976b
call Function9643
ld a, $7
call Function976b
call Function9643
ld a, $6
call Function976b
call Function9643
ld a, $5
call Function976b
call Function9643
ld a, $24
call Function9625
call Function9630
ld hl, AttrMap
ld bc, $0168
ld a, [PlayerGender]
and a
ld a, $1
jr z, .asm_92e3
ld a, $0
.asm_92e3
call ByteFill
ld hl, $cdfb
ld bc, $0705
ld a, [PlayerGender]
and a
ld a, $0
jr z, .asm_92f6
ld a, $1
.asm_92f6
call Function9663
ld hl, $cdff
ld [hl], $1
ld hl, $ceb7
ld bc, $0204
ld a, $1
call Function9663
ld hl, $cebb
ld bc, $0204
ld a, $2
call Function9663
ld hl, $cebf
ld bc, $0204
ld a, $3
call Function9663
ld hl, $cec3
ld bc, $0204
ld a, $4
call Function9663
ld hl, $cef3
ld bc, $0204
ld a, $5
call Function9663
ld hl, $cef7
ld bc, $0204
ld a, $6
call Function9663
ld hl, $cefb
ld bc, $0204
ld a, $7
call Function9663
ld a, [PlayerGender]
and a
push af
jr z, .asm_935d
ld hl, $ceff
ld bc, $0204
ld a, $1
call Function9663
.asm_935d
pop af
ld c, $0
jr nz, .asm_9363
inc c
.asm_9363
ld a, c
ld hl, $cdff
ld [hl], a
call Function96b3
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 9373
Function9373: ; 9373
ld de, Unkn1Pals
ld a, $10
call Function9625
call Function9630
ld a, [PlayerHPPal]
ld l, a
ld h, $0
add hl, hl
add hl, hl
ld bc, $68be
add hl, bc
call Function9643
call Function9699
ld hl, $cdf8
ld bc, $0209
ld a, $1
call Function9663
call Function96b3
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 93a6
Function93a6: ; 93a6
ld hl, $5c47
call Function9610
call Function9699
call Function96b3
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 93ba
Function93ba: ; 93ba
ld de, Unkn1Pals
ld a, $1d
call Function9625
call Function9630
call Function9699
call Function96b3
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 93d3
Function93d3: ; 93d3
ld a, [BattleType]
cp $3
jr z, .asm_93e6
ld a, [PlayerGender]
bit 0, a
jr z, .asm_93e6
ld hl, $5469
jr .asm_93e9
.asm_93e6
ld hl, $5439
.asm_93e9
ld de, Unkn1Pals
ld bc, $0040
ld a, $5
call FarCopyWRAM
call Function9699
ld hl, AttrMap
ld bc, $010a
ld a, $1
call Function9663
ld hl, $cde3
ld bc, $010a
ld a, $2
call Function9663
ld hl, $ce08
ld bc, $0901
ld a, $3
call Function9663
ld hl, $ce65
ld bc, $0305
ld a, $4
call Function9663
ld hl, $ce15
ld bc, $0305
ld a, $5
call Function9663
call Function96b3
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 9439
INCBIN "baserom.gbc", $9439, $9499 - $9439
Function9499: ; 9499
call Function91c8
ld de, $0014
ld hl, AttrMap
ld a, [$cf82]
.asm_94a5
and a
jr z, .asm_94ac
dec a
add hl, de
jr .asm_94a5
.asm_94ac
ld a, [$cf83]
ld e, a
ld d, $0
add hl, de
ld a, [$cf82]
ld b, a
ld a, [$cf84]
inc a
sub b
ld b, a
ld a, [$cf83]
ld c, a
ld a, [$cf85]
sub c
inc a
ld c, a
ld a, $0
call Function9663
call Function96b3
ret
; 94d0
Function94d0: ; 94d0
ld hl, $5ba7
call Function9610
call Function9699
ld hl, $ce29
ld bc, $0a14
ld a, $2
call Function9663
ld hl, $ce51
ld bc, $0614
ld a, $1
call Function9663
call Function96b3
call Function96a4
ld a, $1
ld [hCGBPalUpdate], a
ret
; 94fa
Function94fa: ; 94fa
ld de, Unkn1Pals
ld a, $4e
call Function9625
call Function9630
ld hl, $5521
ld de, Unkn2Pals
call Function9630
ld hl, $5521
ld de, $d048
call Function9630
call Function9699
call Function96b3
call Function96a4
ret
; 9521
INCBIN "baserom.gbc", $9521, $9529 - $9521
Function9529: ; 9529
ld de, Unkn1Pals
ld a, [CurPartySpecies]
ld bc, TempMonDVs
call Function974b
call Function9643
call Function9699
call Function96b3
call Function96a4
ret
; 9542
Function9542: ; 9542
ld de, Unkn1Pals
ld a, [CurPartySpecies]
call Function9775
call Function9643
call Function9699
call Function96b3
ret
; 9555
Function9555: ; 9555
ld hl, $5cc7
call Function9610
ld hl, $7681
ld de, Unkn2Pals
ld bc, $0008
ld a, $5
call FarCopyWRAM
ld de, $d078
ld a, $1c
call Function9625
call Function9630
call Function9699
ret
; 9578
Function9578: ; 9578
ld de, Unkn1Pals
ld a, [CurPartySpecies]
ld bc, TempMonDVs
call Function9764
call Function9643
call Function9699
call Function96b3
call Function96a4
ret
; 9591
Function9591: ; 9591
ld hl, $55e0
ld de, Unkn1Pals
ld bc, $0010
ld a, $5
call FarCopyWRAM
call Function96a4
call Function9699
ld hl, $ce68
ld bc, $080e
ld a, $1
call Function9663
ld hl, $ce3e
ld bc, $0112
ld a, $1
call Function9663
ld hl, $cf1a
ld bc, $0112
ld a, $1
call Function9663
ld hl, AttrMap
ld bc, $1102
ld a, $1
call Function9663
ld hl, $ce4f
ld bc, $0c01
ld a, $1
call Function9663
call Function96b3
ret
; 95e0

591
predef/sgb.asm Normal file
View File

@ -0,0 +1,591 @@
Function864c: ; 864c
; LoadSGBLayout
call CheckCGB
jp nz, Function8d59
ld a, b
cp $ff
jr nz, .asm_865a
ld a, [SGBPredef]
.asm_865a
cp $fc
jp z, Function8ade
ld l, a
ld h, 0
add hl, hl
ld de, Table866f
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld de, Function8a60
push de
jp [hl]
; 866f
Table866f: ; 866f
dw Function86ad
dw Function86b4
dw Function875c
dw Function8763
dw Function87b2
dw Function8852
dw Function8859
dw Function8867
dw Function8860
dw Function88b1
dw Function87ab
dw Function88cd
dw Function8884
dw Function891a
dw Function873c
dw Function8897
dw Function882a
dw Function889e
dw Function8928
dw Function8890
dw Function884b
dw Function891a
dw Function8823
dw Function87e9
dw Function8921
dw Function89a6
dw Function89ad
dw Function89d9
dw Function89e0
dw Function8860
dw Function8969
; 86ad
Function86ad: ; 86ad
ld hl, $5c66
ld de, $5aa6
ret
; 86b4
Function86b4: ; 86b4
ld hl, $5aa6
call Function9809
ld hl, $5ce6
ld de, $cda9
ld bc, $0010
call CopyBytes
ld a, [PlayerHPPal]
ld l, a
ld h, $0
add hl, hl
add hl, hl
ld de, $68be
add hl, de
ld a, [hli]
ld [$cdac], a
ld a, [hli]
ld [$cdad], a
ld a, [hli]
ld [$cdae], a
ld a, [hl]
ld [$cdaf], a
ld a, [EnemyHPPal]
ld l, a
ld h, $0
add hl, hl
add hl, hl
ld de, $68be
add hl, de
ld a, [hli]
ld [$cdb2], a
ld a, [hli]
ld [$cdb3], a
ld a, [hli]
ld [$cdb4], a
ld a, [hl]
ld [$cdb5], a
ld hl, $5cf6
ld de, $cdb9
ld bc, $0010
call CopyBytes
call Function9729
ld a, [hli]
ld [$cdbc], a
ld a, [hli]
ld [$cdbd], a
ld a, [hli]
ld [$cdbe], a
ld a, [hl]
ld [$cdbf], a
call Function973a
ld a, [hli]
ld [$cdc2], a
ld a, [hli]
ld [$cdc3], a
ld a, [hli]
ld [$cdc4], a
ld a, [hl]
ld [$cdc5], a
ld hl, $cda9
ld de, $cdb9
ld a, $1
ld [SGBPredef], a
ret
; 873c
Function873c: ; 873c
ld hl, $5bd6
ld de, $cda9
ld bc, $0010
call CopyBytes
ld hl, $cdaa
ld [hl], $10
inc hl
inc hl
ld a, [PlayerHPPal]
add $2f
ld [hl], a
ld hl, $cda9
ld de, $5ad6
ret
; 875c
Function875c: ; 875c
ld hl, $5c76
ld de, $5a86
ret
; 8763
Function8763: ; 8763
ld hl, $5ce6
ld de, $cda9
ld bc, $0010
call CopyBytes
ld a, [$cda1]
ld l, a
ld h, $0
add hl, hl
add hl, hl
ld de, $68be
add hl, de
ld a, [hli]
ld [$cdac], a
ld a, [hli]
ld [$cdad], a
ld a, [hli]
ld [$cdae], a
ld a, [hl]
ld [$cdaf], a
ld a, [CurPartySpecies]
ld bc, TempMonDVs
call Function974b
ld a, [hli]
ld [$cdb2], a
ld a, [hli]
ld [$cdb3], a
ld a, [hli]
ld [$cdb4], a
ld a, [hl]
ld [$cdb5], a
ld hl, $cda9
ld de, $5ac6
ret
; 87ab
Function87ab: ; 87ab
ld hl, $5c56
ld de, $cdaa
ret
; 87b2
Function87b2: ; 87b2
ld hl, $5ce6
ld de, $cda9
ld bc, $0010
call CopyBytes
ld hl, $cdac
ld [hl], $9f
inc hl
ld [hl], $2a
inc hl
ld [hl], $5a
inc hl
ld [hl], $19
ld a, [CurPartySpecies]
call Function9775
ld a, [hli]
ld [$cdb2], a
ld a, [hli]
ld [$cdb3], a
ld a, [hli]
ld [$cdb4], a
ld a, [hl]
ld [$cdb5], a
ld hl, $cda9
ld de, $5ae6
ret
; 87e9
Function87e9: ; 87e9
ld hl, $5ce6
ld de, $cda9
ld bc, $0010
call CopyBytes
ld hl, $cdac
ld [hl], $9f
inc hl
ld [hl], $2a
inc hl
ld [hl], $5a
inc hl
ld [hl], $19
ld a, [CurPartySpecies]
ld bc, TempMonDVs
call Function974b
ld a, [hli]
ld [$cdb2], a
ld a, [hli]
ld [$cdb3], a
ld a, [hli]
ld [$cdb4], a
ld a, [hl]
ld [$cdb5], a
ld hl, $cda9
ld de, $5ae6
ret
; 8823
Function8823: ; 8823
call Function87b2
ld de, $5af6
ret
; 882a
Function882a: ; 882a
ld hl, $5ce6
ld de, $cda9
ld bc, $0010
call CopyBytes
ld hl, $cdac
ld [hl], $9f
inc hl
ld [hl], $2a
inc hl
ld [hl], $5a
inc hl
ld [hl], $19
ld hl, $cda9
ld de, $5a86
ret
; 884b
Function884b: ; 884b
ld hl, $5c36
ld de, $5a86
ret
; 8852
Function8852: ; 8852
ld hl, $5c96
ld de, $5b06
ret
; 8859
Function8859: ; 8859
ld hl, $5ca6
ld de, $5b76
ret
; 8860
Function8860: ; 8860
ld hl, $5cb6
ld de, $5a86
ret
; 8867
Function8867: ; 8867
ld b, $0
ld hl, $4878
add hl, bc
add hl, bc
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
ret
; 8878
INCBIN "baserom.gbc", $8878, $8884 - $8878
Function8884: ; 8884
ld hl, $5b96
ld de, $5b56
ld a, $8
ld [SGBPredef], a
ret
; 8890
Function8890: ; 8890
ld hl, $5ba6
ld de, $5b86
ret
; 8897
Function8897: ; 8897
ld hl, $5c46
ld de, $5a86
ret
; 889e
Function889e: ; 889e
ld hl, $5a86
ld de, PlayerLightScreenCount
ld bc, $0010
call CopyBytes
ld hl, $5bb6
ld de, $5a86
ret
; 88b1
Function88b1: ; 88b1
ld hl, $5bd6
ld de, $cda9
ld bc, $0010
call CopyBytes
call Function8a0c
ld hl, $cdaa
ld [hld], a
ld de, $5a86
ld a, $9
ld [SGBPredef], a
ret
; 88cd
Function88cd: ; 88cd
push bc
ld hl, $5ce6
ld de, $cda9
ld bc, $0010
call CopyBytes
pop bc
ld a, c
and a
jr z, .asm_88ef
ld hl, $cdac
ld [hl], $e7
inc hl
ld [hl], $1c
inc hl
ld [hl], $62
inc hl
ld [hl], $c
jr .asm_8913
.asm_88ef
ld hl, PartyMon1DVs
ld bc, $0030
ld a, [CurPartyMon]
call AddNTimes
ld c, l
ld b, h
ld a, [PlayerHPPal]
call Function974b
ld a, [hli]
ld [$cdac], a
ld a, [hli]
ld [$cdad], a
ld a, [hli]
ld [$cdae], a
ld a, [hl]
ld [$cdaf], a
.asm_8913
ld hl, $cda9
ld de, $5a86
ret
; 891a
Function891a: ; 891a
ld hl, $5cb6
ld de, $5a86
ret
; 8921
Function8921: ; 8921
ld hl, $5bc6
ld de, $5a86
ret
; 8928
Function8928: ; 8928
ld hl, $5bd6
ld de, $cda9
ld bc, $0010
call CopyBytes
ld hl, $5a86
ld de, $cdb9
ld bc, $0010
call CopyBytes
call Function8a0c
ld hl, $cdaa
ld [hl], a
ld hl, $cdac
ld [hl], $2e
ld hl, $cdbc
ld a, $5
ld [hli], a
ld a, [$cf83]
ld [hli], a
ld a, [$cf82]
ld [hli], a
ld a, [$cf85]
ld [hli], a
ld a, [$cf84]
ld [hl], a
ld hl, $cda9
ld de, $cdb9
ret
; 8969
Function8969: ; 8969
ld hl, $5ce6
ld de, $cda9
ld bc, $0010
call CopyBytes
ld a, [CurPartySpecies]
ld l, a
ld h, $0
add hl, hl
add hl, hl
add hl, hl
ld de, $68ce
add hl, de
ld a, [$cf65]
and $3
sla a
sla a
ld c, a
ld b, $0
add hl, bc
ld a, [hli]
ld [$cdac], a
ld a, [hli]
ld [$cdad], a
ld a, [hli]
ld [$cdae], a
ld a, [hl]
ld [$cdaf], a
ld hl, $cda9
ld de, $5a86
ret
; 89a6
Function89a6: ; 89a6
ld hl, $5cd6
ld de, $5a86
ret
; 89ad
Function89ad: ; 89ad
ld hl, $5ce6
ld de, $cda9
ld bc, $0010
call CopyBytes
ld a, [CurPartySpecies]
ld bc, TempMonDVs
call Function974b
ld a, [hli]
ld [$cdac], a
ld a, [hli]
ld [$cdad], a
ld a, [hli]
ld [$cdae], a
ld a, [hl]
ld [$cdaf], a
ld hl, $cda9
ld de, $5a86
ret
; 89d9
Function89d9: ; 89d9
ld hl, $5cc6
ld de, $5a86
ret
; 89e0
Function89e0: ; 89e0
ld hl, $5ce6
ld de, $cda9
ld bc, $0010
call CopyBytes
ld a, [CurPartySpecies]
ld bc, TempMonDVs
call Function9764
ld a, [hli]
ld [$cdac], a
ld a, [hli]
ld [$cdad], a
ld a, [hli]
ld [$cdae], a
ld a, [hl]
ld [$cdaf], a
ld hl, $cda9
ld de, $5a86
ret
; 8a0c
Function8a0c: ; 8a0c
ld a, [TimeOfDayPal]
cp $2
jr c, .asm_8a16
ld a, $19
ret
.asm_8a16
ld a, [$d19a]
cp $2
jr z, .asm_8a39
cp $4
jr z, .asm_8a3c
cp $7
jr z, .asm_8a3c
cp $5
jr z, .asm_8a3f
cp $6
jr z, .asm_8a42
ld a, [MapGroup]
ld e, a
ld d, $0
ld hl, $4a45
add hl, de
ld a, [hl]
ret
.asm_8a39
ld a, $0
ret
.asm_8a3c
ld a, $18
ret
.asm_8a3f
ld a, $6
ret
.asm_8a42
ld a, $3
ret
; 8a45
INCBIN "baserom.gbc", $8a45, $8a60 - $8a45
Function8a60: ; 8a60
push de
call Function9809
pop hl
jp Function9809
; 8a68

View File

@ -2026,12 +2026,12 @@ PartyMon6Nickname: ; de78
PartyMonNicknamesEnd
SECTION "Pokedex",WRAMX[$de99],BANK[1]
PokedexSeen: ; de99
ds 32
EndPokedexSeen:
PokedexCaught: ; deb9
PokedexCaught: ; de99
ds 32
EndPokedexCaught:
PokedexSeen: ; deb9
ds 32
EndPokedexSeen:
UnownDex: ; ded9
ds 26
UnlockedUnowns: ; def3