• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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

jiangzhengwenjzw

now working on katam
181
Posts
11
Years
  • Seen today
I hope this is the right place to ask, but I was wondering if anyone knows how to edit the following routines so that they don't end the script after completion? For example, use callasm 0x8XXXXXX and then continue with a msgbox, etc..

Naming the player from the overworld: callasm 0x809FC91
Change the A9 at 0x9FCB4 to C5 and then try to callasm 0x809FC91. (i guess you should perform the 'lock' command again after the callasm)
 
19
Posts
7
Years
  • Age 28
  • Seen Apr 14, 2017
I fixed this so it doesn't delete the fishing rod in the safari zone, among other glitches. It'll now verify that the item is a ball of some kind before it deletes it.

The code looks strange. I'm guessing it could be improved somehow, but it works:
Spoiler:

Made another improvement to the reusable pokeballs: safari balls can now be reused as well!

Code:
.text
.align 2
.thumb

@ FE3AA - 00 21
@ 56818 - 00 48 00 47 XX+1 XX XX XX
@ 3F008 - 02 E0 C0 46 C0 46 C0 46 [B][COLOR="Red"]! NEW[/COLOR][/B]
@ Optional: change initial safari ball count?: FC0E6 - XX 20, XX = initial count

main:
	@ if safari ball counter is not 0, then that's what we need to delete
	ldr r1, .safari_ball_count
	ldrb r0, [r1]
	cmp r0, #0x0
	bne delete_safari_ball
	
	@ ...otherwise, delete the last used item (if it's a pokeball)
	ldr r0, .last_used_item
	ldrh r0, [r0]
	@ checks that the item id is premier ball or lower
	cmp r0, #0xC
	bls delete_ball_in_bag
	@ support for custom pokeballs can be added like so:
	@ cmp r0, #CUSTOM_BALL_ID
	@ beq delete_ball_in_bag
	
	b finish


delete_safari_ball:
	@ r0 already contains current safari ball count, and
	@ r1 already contains safari ball count memory address
	sub r0, #1
	strb r0, [r1]
	b finish


delete_ball_in_bag:
	@ r0 already contains last_used_item.
	mov r1, #1
	ldr r2, .bag_remove_item
	bl x_r2
	b finish


finish:
	mov r9, r4
	mov r10, r5
	pop {r4-r7}
	pop {r2}
x_r2:
	bx r2


.align 2
.last_used_item:
	.word 0x0203CE7C
.bag_remove_item:
	.word 0x080D6AA4|1
.safari_ball_count:
	.word 0x0203A04C
 
Last edited:
239
Posts
8
Years
  • Age 31
  • Seen Apr 15, 2024
Change the A9 at 0x9FCB4 to C5 and then try to callasm 0x809FC91. (i guess you should perform the 'lock' command again after the callasm)

Thanks! Do you know how that change converts to assembly so I could try and do the same thing with the naming rival function?
 

jiangzhengwenjzw

now working on katam
181
Posts
11
Years
  • Seen today
Thanks! Do you know how that change converts to assembly so I could try and do the same thing with the naming rival function?
I guess the rival naming func is also built-in.

Change the A9 at 0x9FD54 to C5 and then try to callasm 0x809FD31. (It's from my old note in firered db, so i'm not sure whether it's correct or not...)
 
239
Posts
8
Years
  • Age 31
  • Seen Apr 15, 2024
I guess the rival naming func is also built-in.

Change the A9 at 0x9FD54 to C5 and then try to callasm 0x809FD31. (It's from my old note in firered db, so i'm not sure whether it's correct or not...)

Yep, that worked, thanks! :)

EDIT: actually it turns out that edits the players name instead of the rival's name

EDIT 2: looks like setting 0xA9 at 0x9FCB4 0xC5 fixed both naming the player and Jambo's routine (or I had made a mistake using it initially). Setting 0xA9 at 0x9FD54 to 0xC5 doesn't appear to change this either, but callasm 0x809FD31 will overwrite the player's name instead of the rival's
 
Last edited:

Wesley FG

Pokémon Kalos Advance !! Gba Hack
338
Posts
15
Years
REQUEST for change this ROUTINE for FIRE RED

The user Andrea make this awesome ASM for icon in menu like DPPt,

Originally Posted by ~Andrea
Hello everyone, today I would share with you this little patch:
2hclyd2.png

As you can see from the screen, the patch will add the icons of the DPP next to each menu item.
- ONLY FOR RUBY -
Note:
- If the menu item "Pokenav" should be active, the icons will be loaded out of phase respect to the corresponding menu item.
This is caused by the lack of an icon for Pokenav in DPP.

Technical information:
Offsets routine: 0x720000
Offset Images Icons (uncompressed): 0x7200D0
Offset Palette icons (uncompressed): 0x720610
To change icons you can open the ROM with NSE 2.X, click browse and input offsets earlier in the appropriate fields.

downloads:
http://www.mediafire.com/download/wzs1d0zg2i5e231/DPP_MENU.ips
Credit if you use it!

but it is only for RUBY version

the routine is it:

Spoiler:



i no have knlowledge for ASM and i really love with some ASM expert convert it for FIRE RED and EMERALD, because it is very beautifull, and make a awesome hack improve.

BUGS:
-No have icon for dex nav- when this flag is active bug it (R, EM)
-when the player enter in map with some wheater the icons bug, probably are using same location memory pal used for it
OvNCIWa.png


the original thread of andrea ASM;
https://www.pokecommunity.com/showthread.php?p=8880222#post8880222

PLZ port it for FIRE RED and EMERALD
 
Last edited:
352
Posts
7
Years
  • Age 30
  • Seen Mar 10, 2022
Made another improvement to the reusable pokeballs: safari balls can now be reused as well!

Code:
.text
.align 2
.thumb

@ FE3AA - 00 21
@ 56818 - 00 48 00 47 XX+1 XX XX XX
@ 3F008 - 02 E0 C0 46 C0 46 C0 46 [B][COLOR="Red"]! NEW[/COLOR][/B]
@ Optional: change initial safari ball count?: FC0E6 - XX 20, XX = initial count

main:
	@ if safari ball counter is not 0, then that's what we need to delete
	ldr r1, .safari_ball_count
	ldrb r0, [r1]
	cmp r0, #0x0
	bne delete_safari_ball
	
	@ ...otherwise, delete the last used item (if it's a pokeball)
	ldr r0, .last_used_item
	ldrh r0, [r0]
	@ checks that the item id is premier ball or lower
	cmp r0, #0xC
	bls delete_ball_in_bag
	@ support for custom pokeballs can be added like so:
	@ cmp r0, #CUSTOM_BALL_ID
	@ beq delete_ball_in_bag
	
	b finish


delete_safari_ball:
	@ r0 already contains current safari ball count, and
	@ r1 already contains safari ball count memory address
	sub r0, #1
	strb r0, [r1]
	b finish


delete_ball_in_bag:
	@ r0 already contains last_used_item.
	mov r1, #1
	ldr r2, .bag_remove_item
	bl x_r2
	b finish

x_r2:
	bx r2


finish:
	mov r9, r4
	mov r10, r5
	pop {r4-r7}
	pop {r0}
	bx r0

.align 2
.last_used_item:
	.word 0x0203CE7C
.bag_remove_item:
	.word 0x080D6AA4|1
.safari_ball_count:
	.word 0x0203A04C

sorry but can you port it to Fire Red?
 
19
Posts
7
Years
  • Age 28
  • Seen Apr 14, 2017
Change Daycare Cost [EM]

There's 2 versions of this routine.

The first is completely configurable (when you compile it), and the changes you need to make to do so are very simple and explained well in the code:
Spoiler:

The second is a little different. Rather than a configurable multiplier, it uses the "XP per step" value as the multiplier, so if you're using this modification to adjust the XP per step amount it will scale the daycare cost accordingly, e.x. 2 XP per step will multiply the normal daycare cost by 2:
Spoiler:

sorry but can you port it to Fire Red?

I am planning on porting the stuff I've done for Emerald to Fire Red soon. I just got back into playing the Gen III games a little while ago and decided to start with Emerald for some reason.

EDIT: Made some changes to the original code I posted to make it more compact/efficient. For those that were already using the old version, note that the first 2 bytes of the byte edit required have also been changed.
 
Last edited:
16
Posts
9
Years
  • Age 41
  • Seen Jul 10, 2021
Request!

1) Load 240x160 static images into BG1 or BG2 using (image, palette, RAW) table and allow (if possible) use BG0 to load texts (as in the presentation of Oak, Pokédex, etc.) and objects like pokepic, Mugshots, etc. And their respective routine to remove the image. If it is very difficult or impossible with ASM, it can be a routine that loads the image in BG0 and its respective routine to remove it. What I want to do is cinematic with frame sequences. I can not use the diploma hack because I need to make decisions by pressing the A, B and the arrow keys.

I tried this routine: FR - Vs. Bar Personalizable but it has no routine to remove the image so in the end I have to do a warp to refresh the screen and erase the image . Finally after 5
continuous frames the game freezes.

2) Load different dialogs in the presentation of Oak depending on the selected genre. What I want to do is a multi-language effect depending on gender. Example: Boy = Spanish, Girl = English.

Thanks for the help you can give me.

Here is the link to my current project:


Pokémon Terranova

PD: Sorry for my English
 
Last edited:

BluRose

blu rass
811
Posts
10
Years
Spoiler:
for the first one, try this
for your second request, just use the checkgender command and branch accordingly. i believe it returns 0 for male and 1 for female

para tu primer, prueba esta rutina
para tu segundo, usa "checkgender" y haz lo que necesitas. creo que vuelve 0 si eres hombre y 1 si eres mujer

pd: doesn't use bg0. can switch it to any other bg easily tho, edit for text and lay an rbox above or something
 
Last edited:
352
Posts
7
Years
  • Age 30
  • Seen Mar 10, 2022
Change Daycare Cost [EM]

There's 2 versions of this routine.

The first is completely configurable (when you compile it), and the changes you need to make to do so are very simple and explained well in the code:
Spoiler:

The second is a little different. Rather than a configurable multiplier, it uses the "XP per step" value as the multiplier, so if you're using this modification to adjust the XP per step amount it will scale the daycare cost accordingly, e.x. 2 XP per step will multiply the normal daycare cost by 2:
Spoiler:



I am planning on porting the stuff I've done for Emerald to Fire Red soon. I just got back into playing the Gen III games a little while ago and decided to start with Emerald for some reason.

Thank you for the reply. You're doing a great work with your routines, I like the way you explain them, it becomes very easy to understand for people who haven't learned ASM (or are learning like me), nice work.
 
Last edited:
19
Posts
7
Years
  • Age 28
  • Seen Apr 14, 2017
Thank you for the reply. You're doing a great work with your routines, I like the way you explain them, it becomes very easy to understand for people who haven't learned ASM (or are learning like me), nice work.

Thanks, I appreciate hearing that. My code comments can be a little excessive, but with reverse-engineering stuff I like to make notes of anything relevant in case I revisit it later. Glad it's helpful for you too.
 
16
Posts
9
Years
  • Age 41
  • Seen Jul 10, 2021
for the first one, try this
for your second request, just use the checkgender command and branch accordingly. i believe it returns 0 for male and 1 for female

pd: doesn't use bg0. can switch it to any other bg easily tho, edit for text and lay an rbox above or something

Thanks for the prompt response!
1) I only need to load images (preferably compressed in LZ77) from a table through the control of a variable, in BG1 or BG2 to be able to use the BG0 text box. I think I can do it from the example you left me, although I assume that it does not work with compressed images. Really thank you very much. I am starting in ASM and would like to learn more. And of course how to erase that image, the rest would do with scripting controlling the variable. Finally what doo to do is a system of choice of the initial pokémon this way:

4A6.gif


So I just need 2 routines. One that loads the image in with the following features preferably:

- That depends on the value of a variable (I can do it)
- Use a table (image) (pal) (raw) (I can do it)
- 16 colors (I can do it)
- Image compressed in LZ77 (since I need to insert many images)
- Use BG1 or BG2 to use the BG0 to load text boxes and OBJ

And another one that safely removes the image from said background

2) What I wanted was for the genre to be selected in Oak's presentation, immediately after selecting boy to show a text; And if you select girl it would show another different text. For example:

5FC.gif


And here I need to know how to point to the next text depending on the gender selected.​

Thank you in advance for the help you can give me.

PD: Gifs are not made since the rom, they were made with sequences of images obviously.
 
352
Posts
7
Years
  • Age 30
  • Seen Mar 10, 2022
Hi everyone, does anyone knows how to remove the Field Moves options (like Flash, Dig, Fly...) from the Pokémon menu? Because I want to move them to some place but don't know how to make them never show up when I teach the respective move to a Pokémon. Thanks in advance.
 
19
Posts
7
Years
  • Age 28
  • Seen Apr 14, 2017
Breeding: Same Offspring = Same Species [EM]

This is kind of a continuation of this post. To put it simply, if you put a Bulbasaur and an Ivysaur in the daycare, they produce fewer eggs than if you paired two Bulbasaurs or two Ivysaurs. This changes it so the Bulbasaur+Ivysaur pair produce the same amount of eggs as a Bulbasaur pair (meaning more than they used to).

Code:
.text
.align 2
.thumb
.thumb_func

@ [B][COLOR="Red"]0x70D88: 00 48 00 47 XX+1 XX XX XX[/COLOR][/B] (original: 20 1C 0B 21 F9 F7 72 FC)

main:
	mov r0, r4   @ move pointer to pokemon to r0
	mov r1, #0xB @ req_species
	ldr r2, .pokemon_getattr_encrypted
	bl x_r2
	
	@ r0 now contains the species index, which the game *used* to use.
	@ instead, replace it with the offspring index, so different Pokemon
	@ from the same evolution chain are properly recognized as the same species
	@ (e.x. breeding a Charmander and Charizard works as well as 2 Charmanders does)
	ldr r2, .determine_offspring_from_species_index
	bl x_r2
	
	@ go back to where we came from. (this falls through to the bx r2 below)
	ldr r2, .resume_execution

x_r2:
	bx r2


.align 2
.pokemon_getattr_encrypted:
	.word 0x0806A674|1
.determine_offspring_from_species_index:
	.word 0x08070004|1
.resume_execution:
	.word 0x08070D90|1
 
325
Posts
10
Years
I've been trying to study how to decrypt/encrypt a pokemon in party all day and I think the routine would be fairly short and simple but I just don't get how to set up the routine. This page shows a brief explanation and the offsets for decrypting/encrypting: http://www.romhack.me/database/23/fire-red-commonly-used-asm-rom-offsets/ . All I know is that there should be a 'mov r1, 0x#C' (held item) somewhere in the routine. Also are we supposed to decrypt a pokemon before encrypting?

Decrypt and encrypt is a misnomer, it actually should be something like get_attribute and set_attribute or something. To encrypt, or set an attribute, you need to have the pointer to the pokemon structure in r0. r1 is the attribute to set, and r2 must be the pointer to the thing you're setting. Here's an example.
Code:
.thumb

main:
    @get the address in r0
    mov r1, #0x24 @catch level
    mov r2, #0x10
    push {r2}
    mov r2, sp
    bl encrypt
    pop {r2}
This sets the catch level to 16. Now, I don't know why you'd want to set the catch level to something else, but you can do it. You can also just store the thing for r2 in some RAM address but I don't know an open word. And yes, the data must be stored as a word, so using var 0x8009 or whatever probably won't work.
 

AkameTheBulbasaur

Akame Marukawa of Iyotono
409
Posts
10
Years
JPAN had as part of his engine a way to make wild Pokemon and Trainers have dynamic levels (you can set a variable to certain values to change the levels to your liking, for example: setting the variable to 0x100 makes Wild/Trainer Pokemon levels match your highest Pokemon.)

However I've noticed that this doesn't seem to work with scripted battles (aka setwildbattle). It just uses the level that you buffered regardless of the routine.

Is there a way to make scripted battles have levels that match your highest level Pokemon?
 
19
Posts
7
Years
  • Age 28
  • Seen Apr 14, 2017
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:

I combined this into 1 routine and cut the total size down a lot. All credit to DizzyEgg of course, this is nothing compared to creating the mod in the first place.

Code:
.text
.thumb
.thumb_func
.align 2

@ [B][COLOR="Red"]0x1C379E: 02 30 00 4A 10 47 XX+1 XX XX 08[/COLOR][/B]
@ [B][COLOR="Red"]0x1C3864: 00 4A 10 47 XX+1 XX XX 08[/COLOR][/B]

main:
	@ at this point... r0 contains our return address (- 8). Convenient!
	push {r5-r7}
	
	@ save return address for later.
	mov r6, r0
	add r6, #0x8
	
	@ to determine what function we were called from:
	@ if it was right stats, r9 is 0. if it was left stats, r9 has something in it.
	mov r7, r9 @ can't really use hi registers in thumb, mov it down.
	@ so, to check the function type: cmp r7, #0. eq means right stats.
	
	sub sp, sp, #0x20
	ldr r0, [r4] @pokemon summary pointer. we're free to use r4 after this.
	add r0, #0xA3 @poke nature
	ldrb r1, [r0]
	ldr r0, nature_stat_table
	
	mov r2, #5
	mul r2, r1
	
	mov r1, sp
	mov r5, #0
	
	add r2, r2, r0 @r2 contains nature info
	cmp r7, #0
	beq right_stats_begin


@@ LEFT STAT COLORING BEGIN @@@

left_stats_begin:
	ldr r3, left_stats_string

handle_hp:
	ldrb r0, [r3, r5]
	strb r0, [r1, r5]
	add r5, #1
	cmp r5, #6
	bne handle_hp
	add r3, #6
	add r1, #6
	mov r5, #0

handle_atk:
	ldrb r0, [r2]
	cmp r0, #1
	beq red_font_atk
	cmp r0, #0xFF
	bne copy_atk
	bl blue_font
	b copy_atk

red_font_atk:
	bl red_font

copy_atk:
	ldrb r0, [r3, r5]
	strb r0, [r1, r5]
	add r5, #1
	cmp r5, #3
	bne copy_atk
	add r3, #3
	add r1, #3
	mov r5, #0

handle_def:
	add r2, #1
	ldrb r0, [r2]
	cmp r0, #1
	beq red_font_def
	cmp r0, #0xFF
	beq blue_font_def
	bl default_font
	b copy_def

red_font_def:
	bl red_font
	b copy_def

blue_font_def:
	bl blue_font

copy_def:
	ldrb r0, [r3, r5]
	strb r0, [r1, r5]
	add r5, #1
	cmp r5, #3
	bne copy_def
	b return

@@@ LEFT STAT COLORING END @@


@@@ RIGHT STAT COLORING BEGIN @@@

right_stats_begin:
	add r2, #3 @r2 contains beg of spatk stat
	ldr r3, right_stats_string

handle_spatk:
	ldrb r0, [r2]
	cmp r0, #1
	beq red_font_spatk
	cmp r0, #0xFF
	bne copy_spatk
	bl blue_font
	b copy_spatk

red_font_spatk:
	bl red_font

copy_spatk:
	ldrb r0, [r3, r5]
	strb r0, [r1, r5]
	add r5, #1
	cmp r5, #3
	bne copy_spatk
	add r3, #3
	add r1, #3
	mov r5, #0

handle_spdef:
	add r2, #1
	ldrb r0, [r2]
	cmp r0, #1
	beq red_font_spdef
	cmp r0, #0xFF
	beq blue_font_spdef
	bl default_font
	b copy_spdef

red_font_spdef:
	bl red_font
	b copy_spdef

blue_font_spdef:
	bl blue_font

copy_spdef:
	ldrb r0, [r3, r5]
	strb r0, [r1, r5]
	add r5, #1
	cmp r5, #3
	bne copy_spdef
	add r3, #3
	add r1, #3
	mov r5, #0

handle_spd:
	sub r2, #2
	ldrb r0, [r2]
	cmp r0, #1
	beq red_font_spd
	cmp r0, #0xFF
	beq blue_font_spd
	bl default_font
	b copy_spd

red_font_spd:
	bl red_font
	b copy_spd

blue_font_spd:
	bl blue_font

copy_spd:
	ldrb r0, [r3, r5]
	strb r0, [r1, r5]
	add r5, #1
	cmp r5, #3
	bne copy_spd
	b return

@@@ RIGHT STAT COLORING END @@@


@@@ FONT FUNCTIONS BEGIN @@@

blue_font: @FC 01 07
	mov r4, #7 @color of the lowered stat
	b font_common

red_font: @FC 01 05
	mov r4, #5 @color of the raised stat
	b font_common

default_font: @FC 01 01
	mov r4, #1 @color of the regular stats
	@ just fall through to font_common (no need to branch)

font_common:
	mov r0, #0xFC
	strb r0, [r1]
	add r1, #1
	mov r0, #1
	strb r0, [r1]
	add r1, #1
	strb r4, [r1]
	add r1, #1
	bx lr

@@@ FONT FUNCTIONS END @@@


return:
	ldr r0, displayed_string
	mov r1, sp
	ldr r2, special_f7_string_fct
	bl x_r2
	cmp r7, #0
	beq skip_mov_r0_r9
	mov r0, r9
skip_mov_r0_r9:
	add sp, sp, #0x20
	mov r2, r6
	pop {r5-r7}
x_r2:
	bx r2


.align 2
nature_stat_table: .word 0x0831E818
left_stats_string: .word 0x0861CE82
right_stats_string: .word 0x0861CE8E
displayed_string: .word 0x02021FC4
special_f7_string_fct: .word 0x081AFC29
 
794
Posts
10
Years
I combined this into 1 routine and cut the total size down a lot. All credit to DizzyEgg of course, this is nothing compared to creating the mod in the first place.

Code:
.text
.thumb
.thumb_func
.align 2

@ [B][COLOR=Red]0x1C379E: 02 30 00 4A 10 47 XX+1 XX XX 08[/COLOR][/B]
@ [B][COLOR=Red]0x1C3864: 00 4A 10 47 XX+1 XX XX 08[/COLOR][/B]

main:
    @ at this point... r0 contains our return address (- 8). Convenient!
    push {r5-r7}
    
    @ save return address for later.
    mov r6, r0
    add r6, #0x8
    
    @ to determine what function we were called from:
    @ if it was right stats, r9 is 0. if it was left stats, r9 has something in it.
    mov r7, r9 @ can't really use hi registers in thumb, mov it down.
    @ so, to check the function type: cmp r7, #0. eq means right stats.
    
    sub sp, sp, #0x20
    ldr r0, [r4] @pokemon summary pointer. we're free to use r4 after this.
    add r0, #0xA3 @poke nature
    ldrb r1, [r0]
    ldr r0, nature_stat_table
    
    mov r2, #5
    mul r2, r1
    
    mov r1, sp
    mov r5, #0
    
    add r2, r2, r0 @r2 contains nature info
    cmp r7, #0
    beq right_stats_begin


@@ LEFT STAT COLORING BEGIN @@@

left_stats_begin:
    ldr r3, left_stats_string

handle_hp:
    ldrb r0, [r3, r5]
    strb r0, [r1, r5]
    add r5, #1
    cmp r5, #6
    bne handle_hp
    add r3, #6
    add r1, #6
    mov r5, #0

handle_atk:
    ldrb r0, [r2]
    cmp r0, #1
    beq red_font_atk
    cmp r0, #0xFF
    bne copy_atk
    bl blue_font
    b copy_atk

red_font_atk:
    bl red_font

copy_atk:
    ldrb r0, [r3, r5]
    strb r0, [r1, r5]
    add r5, #1
    cmp r5, #3
    bne copy_atk
    add r3, #3
    add r1, #3
    mov r5, #0

handle_def:
    add r2, #1
    ldrb r0, [r2]
    cmp r0, #1
    beq red_font_def
    cmp r0, #0xFF
    beq blue_font_def
    bl default_font
    b copy_def

red_font_def:
    bl red_font
    b copy_def

blue_font_def:
    bl blue_font

copy_def:
    ldrb r0, [r3, r5]
    strb r0, [r1, r5]
    add r5, #1
    cmp r5, #3
    bne copy_def
    b return

@@@ LEFT STAT COLORING END @@


@@@ RIGHT STAT COLORING BEGIN @@@

right_stats_begin:
    add r2, #3 @r2 contains beg of spatk stat
    ldr r3, right_stats_string

handle_spatk:
    ldrb r0, [r2]
    cmp r0, #1
    beq red_font_spatk
    cmp r0, #0xFF
    bne copy_spatk
    bl blue_font
    b copy_spatk

red_font_spatk:
    bl red_font

copy_spatk:
    ldrb r0, [r3, r5]
    strb r0, [r1, r5]
    add r5, #1
    cmp r5, #3
    bne copy_spatk
    add r3, #3
    add r1, #3
    mov r5, #0

handle_spdef:
    add r2, #1
    ldrb r0, [r2]
    cmp r0, #1
    beq red_font_spdef
    cmp r0, #0xFF
    beq blue_font_spdef
    bl default_font
    b copy_spdef

red_font_spdef:
    bl red_font
    b copy_spdef

blue_font_spdef:
    bl blue_font

copy_spdef:
    ldrb r0, [r3, r5]
    strb r0, [r1, r5]
    add r5, #1
    cmp r5, #3
    bne copy_spdef
    add r3, #3
    add r1, #3
    mov r5, #0

handle_spd:
    sub r2, #2
    ldrb r0, [r2]
    cmp r0, #1
    beq red_font_spd
    cmp r0, #0xFF
    beq blue_font_spd
    bl default_font
    b copy_spd

red_font_spd:
    bl red_font
    b copy_spd

blue_font_spd:
    bl blue_font

copy_spd:
    ldrb r0, [r3, r5]
    strb r0, [r1, r5]
    add r5, #1
    cmp r5, #3
    bne copy_spd
    b return

@@@ RIGHT STAT COLORING END @@@


@@@ FONT FUNCTIONS BEGIN @@@

blue_font: @FC 01 07
    mov r4, #7 @color of the lowered stat
    b font_common

red_font: @FC 01 05
    mov r4, #5 @color of the raised stat
    b font_common

default_font: @FC 01 01
    mov r4, #1 @color of the regular stats
    @ just fall through to font_common (no need to branch)

font_common:
    mov r0, #0xFC
    strb r0, [r1]
    add r1, #1
    mov r0, #1
    strb r0, [r1]
    add r1, #1
    strb r4, [r1]
    add r1, #1
    bx lr

@@@ FONT FUNCTIONS END @@@


return:
    ldr r0, displayed_string
    mov r1, sp
    ldr r2, special_f7_string_fct
    bl x_r2
    cmp r7, #0
    beq skip_mov_r0_r9
    mov r0, r9
skip_mov_r0_r9:
    add sp, sp, #0x20
    mov r2, r6
    pop {r5-r7}
x_r2:
    bx r2


.align 2
nature_stat_table: .word 0x0831E818
left_stats_string: .word 0x0861CE82
right_stats_string: .word 0x0861CE8E
displayed_string: .word 0x02021FC4
special_f7_string_fct: .word 0x081AFC29

Good job :). I was pretty lazy back then and just duplicated the font functions :D.

Seems you're quite proficient in ASM. Wonder if you use IDE?
 
Back
Top