Skip to content

Instantly share code, notes, and snippets.

@Demonic722
Created September 4, 2012 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Demonic722/3617400 to your computer and use it in GitHub Desktop.
Save Demonic722/3617400 to your computer and use it in GitHub Desktop.
Pokémon HeartGold/Soul Silver Real-Time PC Box Deletion
023FE074 012FFF11
E0000000 00000098
E28F0001 E12FFF10
6800481C D0342800
880BA11B 4D1C18C0
882A884B D105421A
60044C1A 60444C1A
60844C1A 421A888B
7802D123 7A047903
D11E2A01 D11C2B02
D11A2C03 88C38842
2A128944 2B1EDC15
2C1EDC13 88CDDC11
25101940 436A022D
18801B52 436B2588
1B5B436C 1824181B
601A2200 42A33304
4770D1FB 02111880
03000D14 E9FC0004
04000130 00120001
001E0002 001E0003
023FE074 E3520003
/***********************************************************************************************************
*Pokémon HeartGold/SoulSilver Project by Demonic722
*Project: Using ASM, make a code where the user controls how many Pokémon he/she can discard from the PC.
*The user controls which PC Box to discard the Pokémon from, and how many can be discarded. This code will
*use the typical "PokéBall" method which will make a Master Ball quantity correspond to the PC Box Number,
*an Ultra Master Ball to correspond to the "starting slot" and a Great Ball to correspond to the "ending slot".
*
*Button Combinations:
*Pressing L+R will store 18 Master Balls (boxes), 30 Ultra Balls (sSlot) and 30 Great Balls (eSlot).
*Pressing Select will then remove those Pokémon from that specified PC box and slot(s).
*
*Example:
*If the user discards 17 master balls, 29 Ultra Balls and 24 Great Balls, Pokémon 1-6 in Box 1 will be "released".
*
*Addresses Needed (Thanks, Codr):
*0x02111880 @Pointer for almost every damn thing in this game
*0x0000F710 @PC Box 1, Slot 1
*0x0000F798 @PC Box 1, Slot 2
*0x00010678 @PC Box 1, Slot 30
*0x00000F68 @PC Box Range (Last - First)
*0x00000088 @Offset between PC Slots
*0x00001000 @Offset between PC Boxes
*0x00000D14 @Master Ball Offset
*0x00000D18 @Ultra Ball Offset
*0x00000D1C @Great Ball Offset
*0x00120001 @Master Ball Value
*0x001E0002 @Ultra Ball Value
*0x001E0003 @Great Ball Value
*0x00000000 @No Pokémon Value
**********************************************************************************************************/
@BranchToThumb
add r0,pc,#0x1
bx r0
.thumb
ldr r0,pointer
ldr r0,[r0]
cmp r0,#0x0
beq exit
adr r1,code_data
ldrh r3,[r1]
add r0,r0,r3
ldr r5,io_keys
ldrh r3,[r1,#0x2]
ldrh r2,[r5,#0x0]
tst r2,r3
bne check_select
ldr r4,master_ball
str r4,[r0,#0x0]
ldr r4,ultra_ball
str r4,[r0,#0x4]
ldr r4,great_ball
str r4,[r0,#0x8]
check_select:
ldrh r3,[r1,#0x4]
tst r2,r3
bne exit
ldrb r2,[r0,#0x0]
ldrb r3,[r0,#0x4]
ldrb r4,[r0,#0x8]
cmp r2,#0x1
bne exit
cmp r3,#0x2
bne exit
cmp r4,#0x3
bne exit
ldrh r2,[r0,#0x2]
ldrh r3,[r0,#0x6]
ldrh r4,[r0,#0xA]
cmp r2,#0x12
bgt exit
cmp r3,#0x1E
bgt exit
cmp r4,#0x1E
bgt exit
ldrh r5,[r1,#0x6]
add r0,r0,r5
mov r5,#0x10
lsl r5,r5,#8
mul r2,r2,r5
sub r2,r2,r5
add r0,r0,r2
mov r5,#0x88
mul r3,r3,r5
mul r4,r4,r5
sub r3,r3,r5
add r3,r3,r0
add r4,r4,r0
mov r2,#0x0
loop:
str r2,[r3]
add r3,#0x4
cmp r3,r4
bne loop
exit:
bx lr
.arm
pointer:
.word 0x02111880
code_data:
.word 0x03000D14
.word 0xE9FC0004
io_keys:
.word 0x04000130
master_ball:
.word 0x00120001
ultra_ball:
.word 0x001E0002
great_ball:
.word 0x001E0003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment