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 15:59:08 -05:00
commit 3a2dbb5289
10 changed files with 364 additions and 344 deletions

31
common/double_speed.asm Normal file
View File

@ -0,0 +1,31 @@
; The CGB hardware introduces Double Speed Mode.
; While active, the clock speed is doubled.
; The hardware can switch between normal speed
; and double speed at any time, but LCD output
; collapses during the switch.
DoubleSpeed: ; 2fef
ld hl, rKEY1
bit 7, [hl]
jr z, SwitchSpeed
ret
; 2ff7
NormalSpeed: ; 2ff7
ld hl, rKEY1
bit 7, [hl]
ret z
; 2ffd
SwitchSpeed: ; 2ffd
set 0, [hl]
xor a
ld [rIF], a
ld [rIE], a
ld a, $30
ld [rJOYP], a
stop ; rgbasm adds a nop after this instruction by default
ret
; 300b

38
common/handshake.asm Normal file
View File

@ -0,0 +1,38 @@
AskSerial: ; 2063
; send out a handshake while serial int is off
ld a, [$c2d4]
bit 0, a
ret z
ld a, [$c2d5]
and a
ret nz
; once every 6 frames
ld hl, $ca8a
inc [hl]
ld a, [hl]
cp 6
ret c
xor a
ld [hl], a
ld a, $c
ld [$c2d5], a
; handshake
ld a, $88
ld [rSB], a
; switch to internal clock
ld a, %00000001
ld [rSC], a
; start transfer
ld a, %10000001
ld [rSC], a
ret
; 208a

View File

@ -156,7 +156,7 @@ Init: ; 17d
ld a, [hCGB] ld a, [hCGB]
and a and a
jr z, .asm_22b jr z, .asm_22b
call Function2ff7 call NormalSpeed
.asm_22b .asm_22b
xor a xor a

76
common/item.asm Normal file
View File

@ -0,0 +1,76 @@
DoItemEffect: ; 2f3f
callba _DoItemEffect
ret
; 2f46
CheckTossableItem: ; 2f46
push hl
push de
push bc
callba _CheckTossableItem
pop bc
pop de
pop hl
ret
; 2f53
TossItem: ; 2f53
push hl
push de
push bc
ld a, [hROMBank]
push af
ld a, BANK(_TossItem)
rst Bankswitch
call _TossItem
pop bc
ld a, b
rst Bankswitch
pop bc
pop de
pop hl
ret
; 2f66
ReceiveItem: ; 2f66
push bc
ld a, [hROMBank]
push af
ld a, BANK(_ReceiveItem)
rst Bankswitch
push hl
push de
call _ReceiveItem
pop de
pop hl
pop bc
ld a, b
rst Bankswitch
pop bc
ret
; 2f79
CheckItem: ; 2f79
push hl
push de
push bc
ld a, [hROMBank]
push af
ld a, BANK(_CheckItem)
rst Bankswitch
call _CheckItem
pop bc
ld a, b
rst Bankswitch
pop bc
pop de
pop hl
ret
; 2f8c

54
common/predef.asm Normal file
View File

@ -0,0 +1,54 @@
Predef: ; 2d83
; Call predefined function a.
; Preserves bc, de, hl and f.
ld [PredefID], a
ld a, [hROMBank]
push af
ld a, BANK(GetPredefPointer)
rst Bankswitch
call GetPredefPointer ; stores hl in PredefTemp
; Switch to the new function's bank
rst Bankswitch
; Instead of directly calling stuff,
; push it to the stack in reverse.
ld hl, .Return
push hl
; Call the Predef function
ld a, [PredefAddress]
ld h, a
ld a, [PredefAddress + 1]
ld l, a
push hl
; Get hl back
ld a, [PredefTemp]
ld h, a
ld a, [PredefTemp + 1]
ld l, a
ret
.Return
; Clean up after the Predef call
ld a, h
ld [PredefTemp], a
ld a, l
ld [PredefTemp+1], a
pop hl
ld a, h
rst Bankswitch
ld a, [PredefTemp]
ld h, a
ld a, [PredefTemp + 1]
ld l, a
ret
; 2dba

76
common/random.asm Normal file
View File

@ -0,0 +1,76 @@
Random: ; 2f8c
; A simple hardware-based random number generator (RNG).
; Two random numbers are generated by adding and subtracting
; the divider to the respective values every time it's called.
; The divider is a register that increments at a rate of 16384Hz.
; For comparison, the Game Boy operates at a clock speed of 4.2MHz.
; Additionally, an equivalent function is executed in VBlank.
; This leaves a with the value in hRandomSub.
push bc
ld a, [rDIV]
ld b, a
ld a, [hRandomAdd]
adc b
ld [hRandomAdd], a
ld a, [rDIV]
ld b, a
ld a, [hRandomSub]
sbc b
ld [hRandomSub], a
pop bc
ret
; 2f9f
BattleRandom: ; 2f9f
; _BattleRandom lives in another bank.
; It handles all RNG calls in the battle engine, allowing
; link battles to remain in sync using a shared PRNG.
ld a, [hROMBank]
push af
ld a, BANK(_BattleRandom)
rst Bankswitch
call _BattleRandom
ld [$cfb6], a
pop af
rst Bankswitch
ld a, [$cfb6]
ret
; 2fb1
Function2fb1: ; 2fb1
push bc
ld c, a
xor a
sub c
.asm_2fb5
sub c
jr nc, .asm_2fb5
add c
ld b, a
push bc
.asm_2fbb
call Random
ld a, [hRandomAdd]
ld c, a
add b
jr c, .asm_2fbb
ld a, c
pop bc
call SimpleDivide
pop bc
ret
; 2fcb

34
common/sram.asm Normal file
View File

@ -0,0 +1,34 @@
GetSRAMBank: ; 2fcb
; load sram bank a
; if invalid bank, sram is disabled
cp NUM_SRAM_BANKS
jr c, OpenSRAM
jr CloseSRAM
; 2fd1
OpenSRAM: ; 2fd1
; switch to sram bank a
push af
; latch clock data
ld a, 1
ld [MBC3LatchClock], a
; enable sram/clock write
ld a, SRAM_ENABLE
ld [MBC3SRamEnable], a
; select sram bank
pop af
ld [MBC3SRamBank], a
ret
; 2fe1
CloseSRAM: ; 2fe1
push af
ld a, SRAM_DISABLE
; reset clock latch for next time
ld [MBC3LatchClock], a
; disable sram/clock write
ld [MBC3SRamEnable], a
pop af
ret
; 2fec

View File

@ -539,7 +539,7 @@ Script_verbosegiveitem2: ; 0x96f8e
ld a, [de] ld a, [de]
ld [$d10c], a ld [$d10c], a
ld hl, $d892 ld hl, $d892
call Function2f66 call ReceiveItem
ld a, $1 ld a, $1
jr c, .asm_96fb0 ; 0x96fad $1 jr c, .asm_96fb0 ; 0x96fad $1
xor a xor a
@ -2320,7 +2320,7 @@ Script_giveitem: ; 0x977ca
call GetScriptByte call GetScriptByte
ld [$d10c], a ld [$d10c], a
ld hl, $d892 ld hl, $d892
call Function2f66 call ReceiveItem
jr nc, .asm_977eb ; 0x977e3 $6 jr nc, .asm_977eb ; 0x977e3 $6
ld a, $1 ld a, $1
ld [$c2dd], a ld [$c2dd], a
@ -2346,7 +2346,7 @@ Script_takeitem: ; 0x977f0
ld a, $ff ld a, $ff
ld [$d107], a ld [$d107], a
ld hl, $d892 ld hl, $d892
call Function2f53 call TossItem
ret nc ret nc
ld a, $1 ld a, $1
ld [$c2dd], a ld [$c2dd], a
@ -2363,7 +2363,7 @@ Script_checkitem: ; 0x97812
call GetScriptByte call GetScriptByte
ld [$d106], a ld [$d106], a
ld hl, $d892 ld hl, $d892
call PickUpItem call CheckItem
ret nc ret nc
ld a, $1 ld a, $1
ld [$c2dd], a ld [$c2dd], a

387
main.asm
View File

@ -475,45 +475,7 @@ Function1d19: ; 1d19
INCLUDE "common/menu.asm" INCLUDE "common/menu.asm"
INCLUDE "common/handshake.asm"
AskSerial: ; 2063
; send out a handshake while serial int is off
ld a, [$c2d4]
bit 0, a
ret z
ld a, [$c2d5]
and a
ret nz
; once every 6 frames
ld hl, $ca8a
inc [hl]
ld a, [hl]
cp 6
ret c
xor a
ld [hl], a
ld a, $c
ld [$c2d5], a
; handshake
ld a, $88
ld [rSB], a
; switch to internal clock
ld a, %00000001
ld [rSC], a
; start transfer
ld a, %10000001
ld [rSC], a
ret
; 208a
INCLUDE "common/game_time.asm" INCLUDE "common/game_time.asm"
@ -543,60 +505,7 @@ Function2d43: ; 2d43
INCLUDE "common/farcall.asm" INCLUDE "common/farcall.asm"
INCLUDE "common/predef.asm"
Predef: ; 2d83
; Call predefined function a.
; Preserves bc, de, hl and f.
ld [PredefID], a
ld a, [hROMBank]
push af
ld a, BANK(GetPredefPointer)
rst Bankswitch
call GetPredefPointer ; stores hl in PredefTemp
; Switch to the new function's bank
rst Bankswitch
; Instead of directly calling stuff,
; push it to the stack in reverse.
ld hl, .Return
push hl
; Call the Predef function
ld a, [PredefAddress]
ld h, a
ld a, [PredefAddress + 1]
ld l, a
push hl
; Get hl back
ld a, [PredefTemp]
ld h, a
ld a, [PredefTemp + 1]
ld l, a
ret
.Return
; Clean up after the Predef call
ld a, h
ld [PredefTemp], a
ld a, l
ld [PredefTemp+1], a
pop hl
ld a, h
rst Bankswitch
ld a, [PredefTemp]
ld h, a
ld a, [PredefTemp + 1]
ld l, a
ret
; 2dba
ResetWindow: ; 2dba ResetWindow: ; 2dba
@ -768,32 +677,37 @@ Function2ee4: ; 2ee4
INCLUDE "common/string.asm" INCLUDE "common/string.asm"
Function2f17: ; 2f17 IsInJohto: ; 2f17
; Return 0 if the player is in Johto, and 1 in Kanto.
ld a, [MapGroup] ld a, [MapGroup]
ld b, a ld b, a
ld a, [MapNumber] ld a, [MapNumber]
ld c, a ld c, a
call GetWorldMapLocation call GetWorldMapLocation
cp $5f
jr z, .asm_2f39 cp $5f ; SS Aqua
cp $0 jr z, .Johto
jr nz, .asm_2f35
cp $0 ; Poke Center 2F
jr nz, .CheckRegion
ld a, [BackupMapGroup] ld a, [BackupMapGroup]
ld b, a ld b, a
ld a, [BackupMapNumber] ld a, [BackupMapNumber]
ld c, a ld c, a
call GetWorldMapLocation call GetWorldMapLocation
.asm_2f35 .CheckRegion
cp $2f cp $2f ; Pallet Town
jr nc, .asm_2f3b jr nc, .Kanto
.asm_2f39 .Johto
xor a xor a
ret ret
.asm_2f3b .Kanto
ld a, $1 ld a, 1
ret ret
; 2f3e ; 2f3e
@ -802,193 +716,12 @@ Function2f3e: ; 2f3e
ret ret
; 2f3f ; 2f3f
DoItemEffect: ; 2f3f
callba _DoItemEffect
ret
; 2f46
CheckTossableItem: ; 2f46 INCLUDE "common/item.asm"
push hl
push de
push bc
callba _CheckTossableItem
pop bc
pop de
pop hl
ret
; 2f53
Function2f53: ; 2f53 INCLUDE "common/random.asm"
push hl
push de
push bc
ld a, [hROMBank]
push af
ld a, $3
rst Bankswitch
call $520d INCLUDE "common/sram.asm"
pop bc
ld a, b
rst Bankswitch
pop bc
pop de
pop hl
ret
; 2f66
Function2f66: ; 2f66
push bc
ld a, [hROMBank]
push af
ld a, $3
rst Bankswitch
push hl
push de
call $51d5
pop de
pop hl
pop bc
ld a, b
rst Bankswitch
pop bc
ret
; 2f79
PickUpItem: ; 2f79
push hl
push de
push bc
ld a, [hROMBank]
push af
ld a, BANK(_PickUpItem)
rst Bankswitch
call _PickUpItem
pop bc
ld a, b
rst Bankswitch
pop bc
pop de
pop hl
ret
; 2f8c
Random: ; 2f8c
; A simple hardware-based random number generator (RNG).
; Two random numbers are generated by adding and subtracting
; the divider to the respective values every time it's called.
; The divider is a register that increments at a rate of 16384Hz.
; For comparison, the Game Boy operates at a clock speed of 4.2MHz.
; Additionally, an equivalent function is executed in VBlank.
; This leaves a with the value in hRandomSub.
push bc
ld a, [rDIV]
ld b, a
ld a, [hRandomAdd]
adc b
ld [hRandomAdd], a
ld a, [rDIV]
ld b, a
ld a, [hRandomSub]
sbc b
ld [hRandomSub], a
pop bc
ret
; 2f9f
BattleRandom: ; 2f9f
; _BattleRandom lives in another bank.
; It handles all RNG calls in the battle engine, allowing
; link battles to remain in sync using a shared PRNG.
ld a, [hROMBank]
push af
ld a, BANK(_BattleRandom)
rst Bankswitch
call _BattleRandom
ld [$cfb6], a
pop af
rst Bankswitch
ld a, [$cfb6]
ret
; 2fb1
Function2fb1: ; 2fb1
push bc
ld c, a
xor a
sub c
.asm_2fb5
sub c
jr nc, .asm_2fb5
add c
ld b, a
push bc
.asm_2fbb
call Random
ld a, [hRandomAdd]
ld c, a
add b
jr c, .asm_2fbb
ld a, c
pop bc
call SimpleDivide
pop bc
ret
; 2fcb
GetSRAMBank: ; 2fcb
; load sram bank a
; if invalid bank, sram is disabled
cp NUM_SRAM_BANKS
jr c, OpenSRAM
jr CloseSRAM
; 2fd1
OpenSRAM: ; 2fd1
; switch to sram bank a
push af
; latch clock data
ld a, 1
ld [MBC3LatchClock], a
; enable sram/clock write
ld a, SRAM_ENABLE
ld [MBC3SRamEnable], a
; select sram bank
pop af
ld [MBC3SRamBank], a
ret
; 2fe1
CloseSRAM: ; 2fe1
; preserve a
push af
ld a, SRAM_DISABLE
; reset clock latch for next time
ld [MBC3LatchClock], a
; disable sram/clock write
ld [MBC3SRamEnable], a
pop af
ret
; 2fec
; Register aliases ; Register aliases
@ -1003,29 +736,7 @@ _de_: ; 2fed
; 2fef ; 2fef
Function2fef: ; 2fef INCLUDE "common/double_speed.asm"
ld hl, rKEY1
bit 7, [hl]
jr z, Function2ffd
ret
; 2ff7
Function2ff7: ; 2ff7
ld hl, rKEY1
bit 7, [hl]
ret z
; 2ffd
Function2ffd: ; 2ffd
set 0, [hl]
xor a
ld [rIF], a
ld [rIE], a
ld a, $30
ld [rJOYP], a
stop ; rgbasm adds a nop after this instruction by default
ret
; 300b
ClearSprites: ; 300b ClearSprites: ; 300b
@ -14133,7 +13844,7 @@ Functionc309: ; c309
ld a, $1 ld a, $1
ld [$d10c], a ld [$d10c], a
ld hl, NumItems ld hl, NumItems
call Function2f66 call ReceiveItem
jr nc, .asm_c33d jr nc, .asm_c33d
xor a xor a
ld [$abe2], a ld [$abe2], a
@ -14233,7 +13944,7 @@ Functionc3ae: ; c3ae
ld a, $36 ld a, $36
ld [CurItem], a ld [CurItem], a
ld hl, NumItems ld hl, NumItems
call PickUpItem call CheckItem
jr nc, .asm_c3c9 jr nc, .asm_c3c9
and a and a
ret ret
@ -16266,7 +15977,7 @@ UnknownText_0xd1d0: ; 0xd1d0
; 0xd1d5 ; 0xd1d5
Functiond1d5: ; d1d5 _ReceiveItem: ; d1d5
call Functiond27b call Functiond27b
jp nz, Functiond29c jp nz, Functiond29c
push hl push hl
@ -16313,7 +16024,7 @@ Functiond201: ; d201
; d20d ; d20d
Functiond20d: ; d20d _TossItem: ; d20d
call Functiond27b call Functiond27b
jr nz, .asm_d241 jr nz, .asm_d241
push hl push hl
@ -16361,7 +16072,7 @@ Functiond20d: ; d20d
jp Functiond2ff jp Functiond2ff
; d244 ; d244
_PickUpItem: ; d244 _CheckItem: ; d244
call Functiond27b call Functiond27b
jr nz, .asm_d278 jr nz, .asm_d278
push hl push hl
@ -16419,7 +16130,7 @@ Functiond27b: ; d27b
; d283 ; d283
Functiond283: ; d283 Functiond283: ; d283
ld c, $14 ld c, 20
ld a, e ld a, e
cp TMsHMsEnd % $100 cp TMsHMsEnd % $100
jr nz, .asm_d28e jr nz, .asm_d28e
@ -16428,7 +16139,7 @@ Functiond283: ; d283
ret z ret z
.asm_d28e .asm_d28e
ld c, $32 ld c, 50
ld a, e ld a, e
cp BallsEnd % $100 cp BallsEnd % $100
jr nz, .asm_d299 jr nz, .asm_d299
@ -19464,7 +19175,7 @@ Functionf795: ; f795
ld hl, NumItems ld hl, NumItems
ld a, $1 ld a, $1
ld [$d10c], a ld [$d10c], a
jp Function2f53 jp TossItem
; f7a0 ; f7a0
Functionf7a0: ; f7a0 Functionf7a0: ; f7a0
@ -22291,7 +22002,7 @@ Function12cdf: ; 12cdf
ld a, $1 ld a, $1
ld [$d10c], a ld [$d10c], a
ld hl, NumItems ld hl, NumItems
jp Function2f66 jp ReceiveItem
; 12cea ; 12cea
INCBIN "baserom.gbc", $12cea, $12cf5 - $12cea INCBIN "baserom.gbc", $12cea, $12cf5 - $12cea
@ -27029,14 +26740,14 @@ Function157e9: ; 0x157e9
ld a, [$d107] ld a, [$d107]
ld [Buffer2], a ld [Buffer2], a
ld hl, NumItems ld hl, NumItems
call Function2f66 call ReceiveItem
jr nc, .PackFull jr nc, .PackFull
ld a, [Buffer1] ld a, [Buffer1]
ld [$d10c], a ld [$d10c], a
ld a, [Buffer2] ld a, [Buffer2]
ld [$d107], a ld [$d107], a
ld hl, PCItems ld hl, PCItems
call Function2f53 call TossItem
ld a, $3b ld a, $3b
call Predef call Predef
ld hl, .WithdrewText ld hl, .WithdrewText
@ -27210,14 +26921,14 @@ Function1590a: ; 0x1590a
ld a, [$d107] ld a, [$d107]
ld [Buffer2], a ld [Buffer2], a
ld hl, PCItems ld hl, PCItems
call Function2f66 call ReceiveItem
jr nc, .asm_15965 jr nc, .asm_15965
ld a, [Buffer1] ld a, [Buffer1]
ld [$d10c], a ld [$d10c], a
ld a, [Buffer2] ld a, [Buffer2]
ld [$d107], a ld [$d107], a
ld hl, NumItems ld hl, NumItems
call Function2f53 call TossItem
ld a, $3b ld a, $3b
call Predef call Predef
ld hl, .DepositText ld hl, .DepositText
@ -27785,7 +27496,7 @@ Function15cef: ; 15cef
call Function1600b call Function1600b
jr c, .asm_15d79 jr c, .asm_15d79
ld hl, NumItems ld hl, NumItems
call Function2f66 call ReceiveItem
jr nc, .asm_15d6f jr nc, .asm_15d6f
ld a, [$d107] ld a, [$d107]
ld e, a ld e, a
@ -28003,7 +27714,7 @@ Function15efd: ; 15efd
call Function15fd7 call Function15fd7
ld a, [$d107] ld a, [$d107]
ld hl, NumItems ld hl, NumItems
call Function2f53 call TossItem
ld a, $3b ld a, $3b
call Predef call Predef
ld hl, $c5b9 ld hl, $c5b9
@ -31292,7 +31003,7 @@ Function24c64: ; 24c64
push hl push hl
ld [CurItem], a ld [CurItem], a
ld hl, NumItems ld hl, NumItems
call PickUpItem call CheckItem
pop hl pop hl
jr nc, .asm_24c89 jr nc, .asm_24c89
ld a, [hl] ld a, [hl]
@ -36055,7 +35766,7 @@ Function2a200: ; 2a200
jr .asm_2a27a jr .asm_2a27a
.asm_2a235 .asm_2a235
call Function2f17 call IsInJohto
and a and a
ret z ret z
ld h, d ld h, d
@ -50161,7 +49872,7 @@ Function4484a: ; 0x4484a
ld a, $1 ld a, $1
ld [$d10c], a ld [$d10c], a
ld hl, NumItems ld hl, NumItems
call Function2f66 call ReceiveItem
jr c, .asm_4489e jr c, .asm_4489e
ld hl, .PackFullText ld hl, .PackFullText
jp Function1d67 jp Function1d67
@ -51575,12 +51286,12 @@ Function4a927: ; 4a927
ld a, [ScriptVar] ld a, [ScriptVar]
ld [CurItem], a ld [CurItem], a
ld hl, PCItems ld hl, PCItems
call PickUpItem call CheckItem
jr c, .asm_4a948 jr c, .asm_4a948
ld a, [ScriptVar] ld a, [ScriptVar]
ld [CurItem], a ld [CurItem], a
ld hl, NumItems ld hl, NumItems
call PickUpItem call CheckItem
jr c, .asm_4a948 jr c, .asm_4a948
xor a xor a
ld [ScriptVar], a ld [ScriptVar], a
@ -60616,7 +60327,7 @@ Function88211: ; 88211
ld hl, NumItems ld hl, NumItems
ld a, b ld a, b
ld [$d10c], a ld [$d10c], a
call Function2f53 call TossItem
pop bc pop bc
ld a, c ld a, c
sub b sub b
@ -62456,7 +62167,7 @@ Function8adef: ; 8adef
ld a, WATER_STONE ld a, WATER_STONE
ld [CurItem], a ld [CurItem], a
ld hl, NumItems ld hl, NumItems
call PickUpItem call CheckItem
jr c, .asm_8ae24 jr c, .asm_8ae24
ld a, [PartyCount] ld a, [PartyCount]
@ -62776,7 +62487,7 @@ Function8afd4: ; 8afd4
ld a, $1 ld a, $1
ld [$d10c], a ld [$d10c], a
ld hl, NumItems ld hl, NumItems
call Function2f66 call ReceiveItem
pop hl pop hl
jr nc, .asm_8b04c jr nc, .asm_8b04c
ld a, [hl] ld a, [hl]
@ -76550,7 +76261,7 @@ Functionfd0c3: ; fd0c3
ld a, $1 ld a, $1
ld [$d10c], a ld [$d10c], a
ld hl, PCItems ld hl, PCItems
call Function2f66 call ReceiveItem
ret ret
; fd0eb ; fd0eb
@ -76671,7 +76382,7 @@ Function1000a4: ; 1000a4
ld [$ffe9], a ld [$ffe9], a
xor a xor a
ld [$ff9e], a ld [$ff9e], a
call Function2ff7 call NormalSpeed
xor a xor a
ld [rIF], a ld [rIF], a
ld a, [BGMapBuffer] ld a, [BGMapBuffer]
@ -82123,7 +81834,7 @@ Function1183cb: ; 1183cb
di di
ld a, [rIE] ld a, [rIE]
ld [$cd32], a ld [$cd32], a
call Function2fef call DoubleSpeed
xor a xor a
ld [rIF], a ld [rIF], a
ld [$c300], a ld [$c300], a
@ -82172,7 +81883,7 @@ Function118452: ; 118452
ld [$ffc9], a ld [$ffc9], a
ld [$ffe9], a ld [$ffe9], a
ld [$ff9e], a ld [$ff9e], a
call Function2ff7 call NormalSpeed
xor a xor a
ld [rIF], a ld [rIF], a
ld a, [$cd32] ld a, [$cd32]

View File

@ -45,7 +45,7 @@ GiveOddEgg: ; 1fb4b6
ld a, $ff ld a, $ff
ld [$d107], a ld [$d107], a
ld hl, NumItems ld hl, NumItems
call Function2f53 call TossItem
ld a, EGG ld a, EGG
ld [$cd2a], a ld [$cd2a], a
ld a, $29 ld a, $29