• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Code: ASM Resource Thread

My request is an ASM that will let you give or take on your current amount of money using var..
For example
Code:
callasm 0xDEADBEEF
setvar 0x8000 0x500
then 500 will be given or deducted on you, it will be useful for banks and stuffs
 
Is there a way to disable using the bag during a battle (like in the Battle Fronteir) in Fire Red? I know it's possible in Emerald but I don't remember if Fire Red ever has a battle type like that.
 
Is there a way to disable using the bag during a battle (like in the Battle Fronteir) in Fire Red? I know it's possible in Emerald but I don't remember if Fire Red ever has a battle type like that.

Link battles disable it. My machine with all of my notes is not currently behaving so I have no offsets for you, but try putting a breakpoint on the battle type (0x02022b4c) before opening the bag in battle.

https://pastebin.com/bHmFB5SX This routine lets you disable the bag when a flag is set. I didn't write it, though, I think it was daniilS. You just assemble it and insert it at x143D4.
 
Color Stats Based on Nature
someone know the values of the offsets of this routine for EMERALD ?
or can do it for EMERALD, it is very usefull.

FR has different stat summary screen display from Emerald, so you can't really change offsets. You're in luck though, as I wrote a routine that does that in EM.
LeftStats color change:
Spoiler:
RightStats color change:
Spoiler:
Image:
Spoiler:


Also, for anyone hacking Emerald. If there's an ASM feature that you'd like to have in your hack but is not present here, let me know. I've got some time, so who knows, I may help.
 
I don't know if anyone's been working on this lately, but I've been itching to share this.

FireRed lacks a system that uses a Region Dex order seperate from the National Dex. If you were to have a Region Dex and a National Dex, your National Dex would look unprofessional. What I'm putting here is my work towards a Region Dex system for FireRed. I would like to stress however that it is both unoptimized and unfinished, but I really wanted to release this.

The current routines
Spoiler:


Send me a PM if you're interested in fixing up what's left.
This post motivated me to create an actual regional dex instead of just giving a national dex at the start, so thanks :D I've added some extra routines to do things like display the correct regional dex number in summary screens, displaying dex info on capture, and having the proper regional dex count. New hooks:
Code:
.thumb
.align

.equ number_of_mons_in_regional_dex,	300	//or however long you wanted your regional dex to be
.equ number_of_mons_in_national_dex,	721





data_on_capture_hook:	//0x08106B84 via r1
	bl species_to_regional_dex_number
	cmp r0, #0x0
	bne capture_display_return
	ldr r0, add_task_no_capture_display
	bx r0

capture_display_return:
	ldr r0, add_task_capture_display
	bx r0





habitat_dex_regional_limit_hook:	//0x08106810 via r1
	push {r4, lr}
	mov r4, r0
	bl haz_national_dex_bool
	cmp r0, #0x1
	beq habitat_dex_regional_limit_return	//valid
	mov r0, r4
	bl species_to_regional_dex_number
	cmp r0, #0x0
	beq habitat_dex_regional_limit_return	//not in regional dex, return 0
	mov r0, #0x1

habitat_dex_regional_limit_return:
	pop {r4}
	pop {r1}
	bx r1





dex_seeable_mon_hook:	//0x08043F90 via r1
	push {r4, lr}
	mov r4, r0
	bl haz_national_dex_bool
	cmp r0, #0x0
	beq only_regional_numbered
//national
	mov r0, r4
	bl species_to_national_dex_number_1
	b dex_seeable_mon_check_valid_species

only_regional_numbered:
	mov r0, r4
	bl species_to_regional_dex_number

dex_seeable_mon_check_valid_species:
	cmp r0, #0x0
	bne dex_seeable_mon_return
	ldr r0, full_halfword

dex_seeable_mon_return:
	pop {r4}
	pop {r1}
	bx r1
.align
full_halfword:	.word 0xFFFF





dex_evolution_fix_hook:	//0x080CE91A via r1
	bl species_to_regional_dex_number
	cmp r0, #0x0	//not in regional dex, invalid
	beq dex_evolution_failure
	ldr r0, dex_evolution_success_return
	bx r0

dex_evolution_failure:
	mov r0, #0x11
	strh r0, [r5, #0x8]
	mov r2, #0x1
	ldr r1, dex_evolution_failure_return
	bx r1





dex_display_counts_hook:	//0x08104BBC via r2
	//r0: mode
	push {lr}
	cmp r1, #0x0
	beq call_regional_count
	bl national_pokedex_count
	b dex_display_counts_return

call_regional_count:
	bl dex_regional_count_hook

dex_display_counts_return:
	pop {pc}





dex_regional_count_hook:	//0x08088EDC via r1
	push {r4-r6, lr}
	mov r6, r0	//mode
	mov r4, #0x1	//loop
	mov r5, #0x0	//counter

dex_regional_count_loop:
	lsl r0, r4, #0x1	//loop times 2
	adr r1, regional_dex_order
	ldrh r0, [r1, r0]	//req species
	mov r1, r6	//mode
	mov r2, #0x1	//input is SPECIES
	bl dex_flag_check
	add r5, r5, r0
	add r4, #0x1
	ldr r0, regional_dex_limit
	cmp r4, r0
	blo dex_regional_count_loop
	mov r0, r5
	pop {r4-r6, pc}





dex_display_hook:	//0x0810352C via r1
	ldr r1, regional_dex_limit
	cmp r0, #0x0
	beq store_dex_limit_and_return
	ldr r1, national_dex_limit

store_dex_limit_and_return:
	str r1, [sp, #0x0]
	ldr r0, regional_dex_limit_return
	bx r0





regional_dex_hook:	//0x0810356C via r0
	mov r4, r8
	add r4, #0x1
	lsl r0, r4, #0x1	//index times 2
	adr r1, regional_dex_order
	ldrh r0, [r1, r0]
	bl species_to_national_dex_number_1
	mov r5, r0
	mov r1, #0x0
	ldr r2, regional_dex_hook_return
	bx r2





store_last_dex_seen_hook:	//0x081035B4 via r1
	str r0, [r2]
	mov r10, r4
	mov r4, r3
	ldr r0, def_store_string_dex_number
	bx r0





lazy_regional_dex_end_hook:	//0x081035F4 via r0
	mov r0, r8
	ldr r1, regional_dex_limit
	cmp r0, r1
	blo regional_dex_hook
	ldr r0, end_dex_display_return
	bx r0





display_regional_num_hook:	//0x08104A66 via r1
	mov r5, r0	//save species
	bl haz_national_dex_bool
	cmp r0, #0x0
	beq use_regional_dex_ordering
	ldr r1, dex_malloc_ptr
	ldr r1, [r1]
	add r1, #0x42
	ldrb r1, [r1]
	cmp r1, #0x0	//check if looking at regional dex
	beq use_regional_dex_ordering
	mov r0, r5
	bl species_to_national_dex_number_1
	b display_dex_number_return

use_regional_dex_ordering:
	mov r0, r5
	bl species_to_regional_dex_number	

display_dex_number_return:
	mov r5, r0
	ldr r0, dex_number_display_return
	bx r0





species_to_regional_dex_number:
	adr r3, regional_dex_order
	mov r2, r0	//req species
	mov r0, #0x0	//loop counter
find_regional_number_loop:
	lsl r1, r0, #0x1
	ldrh r1, [r3, r1]
	cmp r1, r2
	beq species_to_regional_dex_return
	add r0, #0x1
	ldr r1, regional_dex_limit
	cmp r0, r1
	bls find_regional_number_loop
	mov r0, #0x0	//not in dex: set number to 0
species_to_regional_dex_return:
	bx lr



species_to_national_dex_number_1:
	ldr r1, f_species_to_nat_dex
	bx r1
.align
f_species_to_nat_dex:	.word 0x08043298 + 1

haz_national_dex_bool:
	ldr r0, f_haz_national_check
	bx r0
.align
f_haz_national_check:	.word 0x0806E25C + 1

dex_flag_check:
	ldr r3, f_dex_flag_check
	bx r3
.align
f_dex_flag_check:	.word 0x08104AB0 + 1

national_pokedex_count:
	ldr r1, f_national_pokedex_count
	bx r1
.align
f_national_pokedex_count:	.word 0x08088E8C + 1



.align
add_task_no_capture_display:	.word 0x08106B90 + 1
add_task_capture_display:	.word 0x08106BA4 + 1
dex_evolution_success_return:	.word 0x080CE948 + 1
dex_evolution_failure_return:	.word 0x080CE924 + 1
regional_dex_limit:	.word number_of_mons_in_regional_dex
national_dex_limit:	.word number_of_mons_in_national_dex
regional_dex_limit_return:	.word 0x0810353a + 1
regional_dex_hook_return:	.word 0x08103578 + 1
def_store_string_dex_number:	.word 0x081035D6 + 1
end_dex_display_return:	.word 0x08103906 + 1
dex_malloc_ptr:			.word 0x0203ACF0
dex_number_display_return:	.word 0x08104A70 + 1

regional_dex_order:
.short 0x0000
.short CHIKORITA
.short BAYLEEF
.short MEGANIUM
etc
For anyone using Touched's scripts/ASMAGIX:
Code:
data_on_capture_hook		08106B84	1
dex_seeable_mon_hook		08043F90	1
dex_evolution_fix_hook		080CE91A	1
dex_display_counts_hook		08104BBC	2
dex_regional_count_hook		08088EDC	1
dex_display_hook		0810352C	1
regional_dex_hook		0810356C	0
store_last_dex_seen_hook	081035B4	1
lazy_regional_dex_end_hook	081035F4	0
display_regional_num_hook	08104A66	1
habitat_dex_regional_limit_hook	08106810	1
 
Last edited:
Code:
.thumb
.align

.equ number_of_mons_in_regional_dex,	300	//or however long you wanted your regional dex to be
.equ number_of_mons_in_national_dex,	721





data_on_capture_hook:	//0x08106B84 via r1
	bl species_to_regional_dex_number
	cmp r0, #0x0
	bne capture_display_return
	ldr r0, add_task_no_capture_display
	bx r0

capture_display_return:
	ldr r0, add_task_capture_display
	bx r0





habitat_dex_regional_limit_hook:	//0x08106810 via r1
	push {r4, lr}
	mov r4, r0
	bl haz_national_dex_bool
	cmp r0, #0x1
	beq habitat_dex_regional_limit_return	//valid
	mov r0, r4
	bl species_to_regional_dex_number
	cmp r0, #0x0
	beq habitat_dex_regional_limit_return	//not in regional dex, return 0
	mov r0, #0x1

habitat_dex_regional_limit_return:
	pop {r4}
	pop {r1}
	bx r1





dex_seeable_mon_hook:	//0x08043F90 via r1
	push {r4, lr}
	mov r4, r0
	bl haz_national_dex_bool
	cmp r0, #0x0
	beq only_regional_numbered
//national
	mov r0, r4
	bl species_to_national_dex_number_1
	b dex_seeable_mon_check_valid_species

only_regional_numbered:
	mov r0, r4
	bl species_to_regional_dex_number

dex_seeable_mon_check_valid_species:
	cmp r0, #0x0
	bne dex_seeable_mon_return
	ldr r0, full_halfword

dex_seeable_mon_return:
	pop {r4}
	pop {r1}
	bx r1
.align
full_halfword:	.word 0xFFFF





dex_evolution_fix_hook:	//0x080CE91A via r1
	bl species_to_regional_dex_number
	cmp r0, #0x0	//not in regional dex, invalid
	beq dex_evolution_failure
	ldr r0, dex_evolution_success_return
	bx r0

dex_evolution_failure:
	mov r0, #0x11
	strh r0, [r5, #0x8]
	mov r2, #0x1
	ldr r1, dex_evolution_failure_return
	bx r1





dex_display_counts_hook:	//0x08104BBC via r2
	//r0: mode
	push {lr}
	cmp r1, #0x0
	beq call_regional_count
	bl national_pokedex_count
	b dex_display_counts_return

call_regional_count:
	bl dex_regional_count_hook

dex_display_counts_return:
	pop {pc}





dex_regional_count_hook:	//0x08088EDC via r1
	push {r4-r6, lr}
	mov r6, r0	//mode
	mov r4, #0x1	//loop
	mov r5, #0x0	//counter

dex_regional_count_loop:
	lsl r0, r4, #0x1	//loop times 2
	adr r1, regional_dex_order
	ldrh r0, [r1, r0]	//req species
	mov r1, r6	//mode
	mov r2, #0x1	//input is SPECIES
	bl dex_flag_check
	add r5, r5, r0
	add r4, #0x1
	ldr r0, regional_dex_limit
	cmp r4, r0
	blo dex_regional_count_loop
	mov r0, r5
	pop {r4-r6, pc}





dex_display_hook:	//0x0810352C via r1
	ldr r1, regional_dex_limit
	cmp r0, #0x0
	beq store_dex_limit_and_return
	ldr r1, national_dex_limit

store_dex_limit_and_return:
	str r1, [sp, #0x0]
	ldr r0, regional_dex_limit_return
	bx r0





regional_dex_hook:	//0x0810356C via r0
	mov r4, r8
	add r4, #0x1
	lsl r0, r4, #0x1	//index times 2
	adr r1, regional_dex_order
	ldrh r0, [r1, r0]
	bl species_to_national_dex_number_1
	mov r5, r0
	mov r1, #0x0
	ldr r2, regional_dex_hook_return
	bx r2





store_last_dex_seen_hook:	//0x081035B4 via r1
	str r0, [r2]
	mov r10, r4
	mov r4, r3
	ldr r0, def_store_string_dex_number
	bx r0





lazy_regional_dex_end_hook:	//0x081035F4 via r0
	mov r0, r8
	ldr r1, regional_dex_limit
	cmp r0, r1
	blo regional_dex_hook
	ldr r0, end_dex_display_return
	bx r0





display_regional_num_hook:	//0x08104A66 via r1
	mov r5, r0	//save species
	bl haz_national_dex_bool
	cmp r0, #0x0
	beq use_regional_dex_ordering
	ldr r1, dex_malloc_ptr
	ldr r1, [r1]
	add r1, #0x42
	ldrb r1, [r1]
	cmp r1, #0x0	//check if looking at regional dex
	beq use_regional_dex_ordering
	mov r0, r5
	bl species_to_national_dex_number_1
	b display_dex_number_return

use_regional_dex_ordering:
	mov r0, r5
	bl species_to_regional_dex_number	

display_dex_number_return:
	mov r5, r0
	ldr r0, dex_number_display_return
	bx r0





species_to_regional_dex_number:
	adr r3, regional_dex_order
	mov r2, r0	//req species
	mov r0, #0x0	//loop counter
find_regional_number_loop:
	lsl r1, r0, #0x1
	ldrh r1, [r3, r1]
	cmp r1, r2
	beq species_to_regional_dex_return
	add r0, #0x1
	ldr r1, regional_dex_limit
	cmp r0, r1
	bls find_regional_number_loop
	mov r0, #0x0	//not in dex: set number to 0
species_to_regional_dex_return:
	bx lr



species_to_national_dex_number_1:
	ldr r1, f_species_to_nat_dex
	bx r1
.align
f_species_to_nat_dex:	.word 0x08043298 + 1

haz_national_dex_bool:
	ldr r0, f_haz_national_check
	bx r0
.align
f_haz_national_check:	.word 0x0806E25C + 1

dex_flag_check:
	ldr r3, f_dex_flag_check
	bx r3
.align
f_dex_flag_check:	.word 0x08104AB0 + 1

national_pokedex_count:
	ldr r1, f_national_pokedex_count
	bx r1
.align
f_national_pokedex_count:	.word 0x08088E8C + 1



.align
add_task_no_capture_display:	.word 0x08106B90 + 1
add_task_capture_display:	.word 0x08106BA4 + 1
dex_evolution_success_return:	.word 0x080CE948 + 1
dex_evolution_failure_return:	.word 0x080CE924 + 1
regional_dex_limit:	.word number_of_mons_in_regional_dex
national_dex_limit:	.word number_of_mons_in_national_dex
regional_dex_limit_return:	.word 0x0810353a + 1
regional_dex_hook_return:	.word 0x08103578 + 1
def_store_string_dex_number:	.word 0x081035D6 + 1
end_dex_display_return:	.word 0x08103906 + 1
dex_malloc_ptr:			.word 0x0203ACF0
dex_number_display_return:	.word 0x08104A70 + 1

regional_dex_order:
.short 0x0000
.short CHIKORITA
.short BAYLEEF
.short MEGANIUM
etc

Is a pointer needed for this? Or is it should be inserted on certain offset?

Correct numbering
Spoiler:

I cannot compile your routine "Correct numbering". It says there is an error in line 12: invalid offset, value too big (0xFFFFFFFC)
Maybe there should be an offset for .dexarea?
 
Last edited:
Is a pointer needed for this? Or is it should be inserted on certain offset?



I cannot compile your routine "Correct numbering". It says there is an error in line 12: invalid offset, value too big (0xFFFFFFFC)
Maybe there should be an offset for .dexarea?
Whoa, the notifications I got for this post. There are eleven pointers needed for this :D ctrl + F for "via" and for each of those routines, you need to create a hook.
For example, with data_on_capture_hook, the comment after the label means to insert

ldr r1, =(wherever in free space the routine is + 1)
bx r1
.align

at 0x106B84
 
Whoa, the notifications I got for this post. There are eleven pointers needed for this :D ctrl + F for "via" and for each of those routines, you need to create a hook.
For example, with data_on_capture_hook, the comment after the label means to insert

ldr r1, =(wherever in free space the routine is + 1)
bx r1
.align

at 0x106B84

Oh, now I get it. It's so simple! Thanks, your routine is great!
So, if it says "via r2" I need to insert this:
ldr r2, =(offset + 2)
bx r2
.align

Right?
 
Pokemon Emerald Multichoice Scrolling Box

So, the mechanic for that is already implemented, we just have to repoint some tables. So let's get down to work.
First, there's a table at 0x085B2CF0. Each entry is a pointer to text to be displayed in the box. One set consist of 16 options. This is important. Anyway, repoint to free space and change pointers to this table. It ends at 0x085B3030.

Now, there's a jumptable at 0x0813A168. It ends at 0x0813A19C. It has 12 entries, repoint it to free space. Now for every new set of options you want to add, you have to add a routine like this:
Spoiler:

Note that you can change parameters in those routines. Play with them and see which ones look the best for you. Now, every routine like that above, goes at the end of the repointed jumptable. There are 12-in game sets, so you'll start with 13. Change the byte at 0x813A148 to the amount of all sets.

One more thing, even though the table of pointers to text can only hold 16 pointers, it doesn't mean you're limited to only that many options. You can go to 126 max, because 127 is treated as hitting B. How? Well, in the routine above set how many in total to the amount you want and ignore occupied slots. For example if you want your set to have 50 options, divide it by 16, so you get 3 and some remainder. That means this set occupies 4 places in the jumptable, like this:
XX XX XX 08 00 00 00 00 00 00 00 00 00 00 00 00 NEW SET GOES HERE

Using it in a script is easy, just do this:
setvar 0x8004 slot in the jumptable (starts at 13, since 12 are already occupied in-game)
special 0x1BE
waitstate
Result is stored in the 0x800D. First option chosen is 0, second is 1, and so on. Hitting B be is 0x7F.
compare 0x800D 0x0
if 0x1 goto @first_option
....
compare 0x800D 0x7F
if 0x1 goto @chose_cancel

I hope everything's understandable. :)
 
Last edited:
Sitrus Berry Update:
Spoiler:


Berry Activation Update:
Spoiler:
Any chance of a firered port?
 
Battle End Move Target Held Items (FR):-

Loader Routine:
Spoiler:


Rocky Helmet:-
Spoiler:

Weakness Policy:-
Spoiler:

Knock Off Ban-list Hook:-
Spoiler:

What would be the consequence if I didn't edit those custom battle script moves?

Also, it seems that BSP is not recognizing "removeitem" command as valid. Tried to remove it but the Weakness Policy doesn't seem to work properly
 
Last edited:
What would be the consequence if I didn't edit those custom battle script moves?

Also, it seems that BSP is not recognizing "removeitem" command as valid. Tried to remove it but the Weakness Policy doesn't seem to work properly

Most probably, things like Conversion and Mirror Move will fail on those custom battle script moves.
For removeitem, check the Natural Gift move implementation in move resource thread.
 
Back
Top