Registrarse

[Rutina] [ASM] Routine for "Oval Charm"

jiangzhengwenjz

Usuario mítico
The routine will increase the chance of getting eggs when it goes to that judgement if you have an oval charm in your bag.

It's kinda simple and i did it long time ago but i hope that it will help.

This piece of code is for "Firered USA" BPRE.

First we should get a branch:
branch.asm:
Código:
@insert at 0x46320
.thumb
.align 2
ldr r1, =XXXXXXXX @Pointer to code.asm, +1 because of thumb mode
@for example, 0x800000→0x8800001
bx r1
Then the main part:
code.asm:
Código:
.thumb
.align 2
push {r0, r2-r7}
mov r0, #0xfe @the index number of the item
mov r1, #1
bl checkitem
mov r1, r0
pop {r0, r2-r7}
lsr r0, r0, #0x10
cmp r1, #1
bne original
mov r1, #0x50
/*original value is 0x64 and we can decrease this value to increase the chance, for example i got 0x50 
(the accurate rate is not known in bulbapedia yet :(*/
b share

original:
mov r1, #0x64

share:
mul r0, r1
ldrh r1, =0xffff
ldr r3, =0x08046329
bx r3

checkitem:
ldr r4, =0x08099F41
bx r4
Hope you like it;)
(Absolutely you should know how to add a new item, that's really simple because you will only need to find some tables and handle them appropriately with your HEX editor and inserting the pictures and palettes correspondingly. Then you should write data for the new item.)
 
Última edición:

Shiny_Miner

Rocker Coder
The routine will increase the chance of getting eggs when it goes to that judgement if you have an oval charm in your bag.

It's kinda simple and i did it long time ago but i hope that it will help.

This piece of code is for "Firered USA" BPRE.

First we should get a branch:
branch.asm:
Código:
@insert at 0x46320
.thumb
.align 2
ldr r1, =XXXXXXXX @Pointer to code.asm, +1 because of thumb mode
@for example, 0x800000→0x8800001
bx r1
Then the main part:
code.asm:
Código:
.thumb
.align 2
push {r0, r2-r7}
mov r0, #0xfe @the index number of the item
mov r1, #1
bl checkitem
mov r1, r0
pop {r0, r2-r7}
lsr r0, r0, #0x10
cmp r1, #1
bne original
mov r1, #0x50
/*original value is 0x64 and we can decrease this value to increase the chance, for example i got 0x50 
(the accurate rate is not known in bulbapedia yet :(*/
b share

original:
mov r1, #0x64

share:
mul r0, r1
ldrh r1, =0xffff
ldr r3, =0x08046329
bx r3

checkitem:
ldr r4, =0x08099F41
bx r4
Hope you like it;)
(Absolutely you should know how to add a new item, that's really simple because you will only need to find some tables and handle them appropriately with your HEX editor and inserting the pictures and palettes correspondingly. Then you should write data for the new item.)
Best great for rombases
 
Arriba