.thumb
.align 2
@At 080143D6 place 00 47, and at 08014410 place the pointer to this function + 1
No_items: ldr r0, num_to_check
ldrb r0, [r0]
cmp r0, #0x1
bne return_to_normal
ldr r0, denyItemsAddr
bx r0
return_to_normal: ldr r1, battleFlags
ldr r0, [r1]
ldr r1, itemForbiddenTestAddr
bx r1
num_to_check: .word 0x020370c0
battleFlags: .word 0x02022B4C
denyItemsAddr: .word 0x080143E1
itemForbiddenTestAddr: .word 0x080143D9
@Routine is somewhere at 0x0806F116
.thumb
.align 2
No_items: ldr r0, num_to_check
ldrb r0, [r0]
cmp r0, #0x1
bne return_to_normal
ldr r0, denyItemsAddr
bx r0
return_to_normal: ldr r1, battleFlags
ldr r0, [r1]
ldr r1, itemForbiddenTestAddr
bx r1
num_to_check: .word 0x02022FFC @Some random location for testing
battleFlags: .word 0x02022FEC
denyItemsAddr: .word 0x08 @Unusure where this is one located
itemForbiddenTestAddr: .word 0x0806F11B @Also not sure here but seems like it
@Insert this compiled routine at 0x0803C230
.thumb
.equ qq_bag, 0x0803C230
.equ flag_check, 0x0809D790
.equ loc_803C23E, 0x0803C23E
.equ off_803C254, 0x0803C254
.equ loc, qq_bag
.equ checkflag, flag_check
.equ blockitem, loc_803C23E
.equ flag, off_803C254
main:
ldr r0, [pc, #flag-(loc+4)]
bl +checkflag-loc
bne +blockitem-loc
NOP
NOP
I want to make an ghost eeveelution and to evolve it you must level it up with a rare candy in the party while it is fainted then once it is leveled up it evolves
.text
.align 2
.thumb
.thumb_func
.global faintEvolution
main:
push {r0-r7}
[COLOR="Lime"]add r0, r6, r7[/COLOR] @line to change if expanded evos
lsl r0, r0, #0x3
add r0, r2, r0
add r3, r0, r3
ldrb r2, [r3, #0x2]
mov r0, r8
bl decrypt
mov r11, r0
pop {r0-r7}
mov r1, r11
[COLOR="Lime"]cmp r1, #0x2[/COLOR] @Compare Amount of Current Hp
blo low_hp
b exit
low_hp:
mov r10, r3
pop {r0-r7}
mov r1, r10
ldr r0, evolution_loc
bx r0
exit:
pop {r0-r7}
ldr r0, no_evo
bx r0
decrypt:
push {r0-r7}
mov r1, #0x39
ldr r2, decryptpoke
bx r2
.align 2
no_evo: .word 0x08043111
evolution_loc: .word 0x0804310D
decryptpoke: .word 0x0803FBE9
so, little question, cause I'm still learning.OAM routines
Generating OAMs
This routine is only to generate OAMs which are trainer or Pokemon sprites. I've modified it to be usable with a script, but honestly, setting the values yourself via ASM would've been faster (not that this is noticeably slow, just comparatively). I will have to do more research on making it portray an arbitrary image, but with the expansion work on the Pokedex and such, I don't see it as very necessary anymore.
How to insert:
Compile and insert the following routine into a free word aligned offset.
Spoiler:
Code:.text .align 2 .thumb .thumb_func main: push {r0-r4, lr} sub SP, SP, #0x14 @load PID ldr r2, =(0x20370B8) @PokeSlot ldrb r2, [r2] cmp r2, #0x6 beq shiny ldr r0, =(0x2024284) mov r4, #0x64 mul r2, r2, r4 add r2, r2, r0 ldrh r2, [r2] @PID @load TID ldr r1, =(0x300500C) ldr r1, [r1] ldrh r1, [r1, #0xA] @TID b cont shiny: mov r0, #0x0 mov r1, r0 mov r2, r0 cont: @X-pos ldr r0, =(0x20370BA) ldrh r0, [r0] str r0, [SP] @X-Pos @Y-pos ldr r0, =(0x20370BC) ldrh r0, [r0] str r0, [SP, #0x4] @Y-Pos @pal # ldr r0, =(0x20370BE) ldrh r0, [r0] str r0, [SP, #0x8] @pal # ldr r3, =(0x20370C0) ldrb r3, [r3] cmp r3, #0x1 bne nonsil mov r3, #0x0 str r3, [SP, #0xC] @occupacity b unkn nonsil: ldr r3, =(0x0000FFFF) str r3, [SP, #0xC] @occupacity unkn: @??? - No idea, but leave as 0s @possibly priority? ldr r0, =(0x20370C6) ldrb r0, [r0] str r0, [SP, #0x10] mov r0, #0x0 str r0, [SP, #0x14] @species/sprite ID ldr r0, =(0x20370C2) ldrh r0, [r0] @front VS back ldr r3, =(0x20370C4) ldrb r3, [r3] @display func ldr r4, =(0x810BDAC +1) bl linker add SP, SP, #0x14 pop {r0-r4, pc} linker: bx r4 .align 2
Compiled version:
Code:1F B5 85 B0 18 4A 12 78 06 2A 08 D0 17 48 64 24 62 43 12 18 12 88 16 49 09 68 49 89 02 E0 00 20 01 1C 02 1C 13 48 00 88 00 90 13 48 00 88 01 90 12 48 00 88 02 90 12 4B 1B 78 01 2B 02 D1 00 23 03 93 01 E0 0F 4B 03 93 0F 48 00 78 04 90 00 20 05 90 0E 48 00 88 0E 4B 1B 78 0E 4C 00 F0 02 F8 05 B0 1F BD 20 47 C0 46 B8 70 03 02 84 42 02 02 0C 50 00 03 BA 70 03 02 BC 70 03 02 BE 70 03 02 C0 70 03 02 FF FF 00 00 C6 70 03 02 C2 70 03 02 C4 70 03 02 AD BD 10 08
Is there a way to make the turbo slower?
I want the player to get as authentic of an experience as possible when playing my hack, which means that if I can disable the Turbo button, I will. Is there an emulator that doesn't have a turbo button?
Thank you,
I want the player to get as authentic of an experience as possible when playing my hack, which means that if I can disable the Turbo button, I will. Is there an emulator that doesn't have a turbo button?
Thank you,
Anyone can make a routine that counts the amount of a certain item in the bag and stores it in a variable? I know this can be made with loops but I think a routine is a better way to do this. Thanks anyway.
Hey helpful people, you all might have seen my post about this in a thread under Rom Hacking. But anyway, I've never used ASM coding in my PKMN hacking career thus far. I'm making a game in which I only want double battles and have encountered a glitch in which if you start a double battle with 1 (not-fainted) Pokémon is your party, the game just clones that pokemon for your partner in battle... (not desired) I've come to the realization that the only way to keep this game double battles only Is to either fix this glitch by changing the battle engine (sounds too hard) or to find another solution.
Well, the solution I came up with was to possibly have an ASM call before each trainer that would change the bitfield's double battle bit of the trainer in question to 1 or 0 based on how many Pokémon the player has. Now again, I've never used ASM so I don't know if you have access to that certain part of the rom, but if you did this would be a great way of fixing my problem.
So any help would be awesome, thanks!
I have a request. I followed this tutorial to make two frame animations in fire red. the only issue is with trainers the animation starts right out of the ball and with wild pokemon it starts at the beggining of the encounter and doesnt show the animation because the pokemon is not in sight when it starts. Would it be possible to create two animation tables and insert an asm routine that sets the pointer at 0x2349BC to point to animation table 1 by default or table 2 if a var or flag is set? If no one has time to make a routine like this could someone at least tell me if it is possible?
why would an asm routine take alot of storage?
.text
.align 2
.thumb
.thumb_func
main:
push {r5}
ldr r0, =(0x3005D8C) @Getting location of parents in daycare
ldr r0, [r0]
ldr r1, =0x3030
add r0, r0, r1
mov r5, r0
ldr r3, pokemon_get_gender @Get gender of 1st parent
bl linker
cmp r0, #0xFE
beq mother @Branch if female
mov r0, r5
mov r5, #0x8C
add r0, r0, r5
mov r5, r0
ldr r3, pokemon_get_gender @Get gender of 2nd parent
bl linker
cmp r0, #0xFE
beq mother @Branch if female
use_pokeball:
mov r1, #4
pop {r5}
add r0, sp, #0x10
strh r1, [r0]
mov r4, sp
return:
ldr r3, =(0x8070A50 +1)
bl linker
mother:
mov r0, r5
mov r1, #0x26
ldr r3, pokemon_getattr @get mother's pokeball
bl linker
mov r1, r0
cmp r1, #1 @It's a masterball
beq use_pokeball @Use pokeball instead of master
pop {r5}
add r0, sp, #0x10
strh r1, [r0] @Store mother's pokeball
mov r4, sp
b return
linker:
bx r3
.align 2
@Functions:
pokemon_get_gender:
.word 0x8069FC4 +1
pokemon_getattr:
.word 0x806A518 +1
@At 0x70A48 write 00 48 00 47 XX+1 XX XX 08
.text
.align 2
.thumb
.thumb_func
main:
mov r0, r5 @Doing things that we overwrote
mov r1, #0x25
ldr r3, pokemon_getattr @Get game of origin
bl linker
mov r1, r10
strb r0, [r1]
mov r0, r5
mov r1, #0x26
ldr r3, pokemon_getattr @Get the egg's pokeball
bl linker
ldr r1, =(0x20375D8) @var 0x8000
strh r0, [r1] @Store pokeball in 0x8000
ldr r3, =(0x80713DC +1)
bl linker
linker:
bx r3
.align 2
@Functions:
pokemon_getattr:
.word 0x806A518 +1
@At 0x713D4 write 00 48 00 47 XX+1 XX XX 08
.text
.align 2
.thumb
.thumb_func
main:
mov r2, sp
add r2, #0xE
ldr r0, =(0x20375D8) @Get ball from 0x8000
ldrh r0, [r0]
strh r0, [r2]
mov r0, r5
mov r1, #0x26
ldr r3, pokemon_setattr @Set pokeball
bl linker
ldr r3, =(0x8071536 +1)
bl linker
linker:
bx r3
.align 2
@Functions:
pokemon_setattr:
.word 0x806ACAC +1
@At 0x71528 write 00 4A 10 47 XX+1 XX XX 08