• 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

1,344
Posts
14
Years
  • Seen Dec 10, 2021
You probably messed up pointers. Try doing it again and make sure all your pointers are correct.



It seems that TMs are still consumable if taught to a pokemon without animation, i.e. if it only knows 2 moves.
There's already a fix for this here.
 
39
Posts
8
Years
  • Seen Jul 29, 2018
Hello, since the EXP. Gain canceller had been effin'ly implemented, it's good to have MONEY gain and reduce canceller so that we can make a Battle frontier-like event.
Request

Temporarily disabling prize money from battle

(Only works in FireRed)

Here is a routine that will prevent you from getting money after you won a battle against a trainer. Good for tournament-style battles, where it makes no sense that you get or lose money.

How to insert:

Compile and insert this routine anywhere into free space:
Spoiler:
Now navigate to 0x0259E8 and insert following bytes:
Code:
00 48 00 47 XX XX XX 08
Where XX XX XX is the location of the routine you inserted + 1.


Next compile and insert this routine into free space:
Spoiler:
Finally navigate to 0x054BE0 and insert following bytes where XX XX XX is the location of the second routine +1:
Code:
00 48 00 47 XX XX XX 08
This thing requires two routines, that's because the money gets reduced when you black out while the prize money is gained after the message appears. These are two different places so there have to be two different functions :P


At last you should also want to remove the text that appears after winning/losing that informs you about the money you gained/lost. You need another routine for that. Compile and insert into free space:
Spoiler:
Now change the bytes at 0x032B44 to following (XX XX XX) is the location of this last routine:
Code:
00 48 00 47 XX XX XX 08
How to use:

In order to disable prize money you have to set the flag 0x203.
If you want to reenable it just clear the flag and you will get money again.
 
Last edited:

Joexv

ManMadeOfGouda joexv.github.io
1,037
Posts
11
Years
Temporarily disabling prize money from battle


Here is a routine that will prevent you from getting money after you won a battle against a trainer. Note that the message telling you about your prize money still shows up, iI am working on that. I'll update the post later with the final version because I don't have much time today. EDIT: I just realized ita lso doesn't work when you lose, so just wait a bit and dont insert it yet...


How to insert:

Compile and insert this routine anywhere into free space:
Spoiler:

Now navigate to 0x0259E8 and insert following bytes:
Code:
00 48 00 47 XX XX XX 08
Where XX XX XX is the location of the routine you inserted + 1.


How to use:

In order to disable prize money you have to set the flag 0x203.
If you want to reenable it just clear the flag and you will get money again.

The location of the text is 0x3FB41A, there seem to be only one pointer to it, its setup in a table along with various other winning/losing messages which appears to start at 0x3FDF3C. Hope this helps.
 
277
Posts
9
Years
You probably messed up pointers. Try doing it again and make sure all your pointers are correct.



It seems that TMs are still consumable if taught to a pokemon without animation, i.e. if it only knows 2 moves.

Where XX XX XX is the location of the routine you inserted + 1.
I don't really get what the "+1" means. That's probably where I messed up.
 
58
Posts
8
Years
  • Age 31
  • Seen Jan 7, 2017
I would like to make a request: wild double battle in Pkmn FR version
Based on JPAN's document on battle scripts, we can change a word in the EWRAM to change the battle type. However, simply putting a hook at the function storing type to that location is obviously with several bugs so I hope that someone will get the full source code and share it, thanks!
 
3,830
Posts
14
Years
  • Age 27
  • OH
  • Seen Feb 26, 2024

Day/Night Switching of Textbox Palettes (FireRed)

So this is one of my few successful ASM hacks. What it does is swap the palettes used by the textbox depending on whether it is day or night (based on Prime Dialga's D/N system). Some of you older users may remember such a feature being implemented by Shiny Quagsire for Pokémon Grey (iirc).

So the first thing you need to do is go to 0x471DEC and copy 0xA0 bytes there, and then paste them into freespace somewhere. Be sure to note the offset. These are the five palettes used by the textboxes. You can use this copy as the base for your new night palettes.

Next, assemble and insert the following routine into freespace, once again noting the offset. Be sure to replace the ZZZZZZ with the offset of your new night palettes.
Code:
.text
.align 2
.thumb
.thumb_func

main:
  @ get the time
  ldr r1, =(0x300553C) @ if your RTC uses a different location for the time, change this
  ldrb r1, [r1, #0x6]

  @ check the time
  @ if <= 6 AM or >= 6 PM
  @   load night palette
  @ else
  @   load day palette
  cmp r1, #0x6 @ 6 AM
  ble set_night
  cmp r1, #0x12 @ 6 PM
  bge set_night

set_day:
  ldr r1, day_palette
  b return

set_night:
  ldr r1, night_palette

return:
  @ this uses the end of the original function
  @ so there should be no problems
  add r0, r0, r1
  pop {r1}
  bx r1

.align 2

day_palette:
  .word 0x08471DEC

night_palette:
  .word 0x08ZZZZZZ @ change this to your night palette

Now finally, navigate to 0x150448 and place this (the hook):
Code:
00 49 08 47 XX XX XX 08 00 00 00 00
Where XX XX XX 08 is the pointer to the location you inserted the ASM + 1.

I know it's a bit of a silly hack, but I hope someone makes use of it! :)
 
Last edited:
277
Posts
9
Years
If you put the routine at 0x800000, your pointer would NOT be 00 00 80 08, it would be 01 00 80 08, as if the location was 0x800001. It's a THUMB quirk, I think.
So it's just +1 for the first byte? Also, for every asm pointer, do I always have to add +1?
 
58
Posts
8
Years
  • Age 31
  • Seen Jan 7, 2017
for every asm pointer, do I always have to add +1?

No, that depends on the way to jump to the code.
If you use bx (or callasm in script, which also use bx to jump to the code), you should add 1 if the code is in thumb mode as is always the case.
If you use another way to branch, such as
Code:
ldr r0, .addr
mov pc, r0
.align 2
.addr: [offset of your code]
This kind of code don't need to add 1 to the pointer of the code it jumps to.
But most people use bx to jump, so adding 1 is often required.
 

Splash

But nothing happened.
658
Posts
14
Years
ASM Request:
Sneak Mechanic from ORAS
Function:
Slowing down the movement that will give you higher chance of encountering shiny pokemon or pokemon with egg moves.
 
218
Posts
10
Years
  • Seen Nov 12, 2021
I know there's several routines like this one, but I didn't found them practical.

Check a specific pokémon with a specific slot through the use of Special 0xA2, for Emerald :
Spoiler:
 
Last edited:

Le pug

Creator of Pokémon: Discovery / Fat Kid
870
Posts
10
Years
Spoiler:

Requesting this in Emerald. Great resource and besides tournaments, it can be used for trainer-battle styled wild pokemon battles (obviously they dont give you $)
 

Ephraim225

Freaky Frillish Guy
161
Posts
10
Years
Checking HM Compatibility
Hey guys, I've got a fun one for you. If you're like me and hate wasting move slots on HMs, this hack will make that a thing of the past. This hack checks whether the player's team contains a Pokemon that can learn an HM you specify. It doesn't check if they actually HAVE it, only whether they CAN learn it. Used correctly, the player can simply walk up to a tree and cut it immediately if they have a Pokémon that can cut. This is for Fire Red but porting it should be simple if you know the equivalent offsets in Emerald (and I don't, if someone does, let me know and I'll update this post)

Compile and insert to free space:
Spoiler:


NOTE: Before you compile, direct your attention to the line highlighted in blue. The offset here is the offset of the table that determines TM/HM compatibility. If you have expanded the number of Pokémon in your hack, be sure to change this offset to whatever the new offset is.

Now, using this ASM is simple. In whatever script you're writing, first set variable 0x800D (aka LASTRESULT) to one of the following values based on the HM you are checking:

Spoiler:


Then, call the ASM using Callasm. After the ASM runs, variable 0x800D will be set to the party slot containing the Pokémon who can learn whatever move you checked for, or 0x6 if no Pokémon was found.

The only issue is, Fly and Flash aren't used in scripts by the game, and Dive and Waterfall can't be checked. Making items that perform the same functions using other methods, however, is a working substitute.

Here's an example script. Let's say I'm editing the cut tree script. (If you remove the badge check and attack check as I have you can actually overwrite the original script with this, as there's enough space for it)
Spoiler:


Anyways, that's that. I'll be using this in the future, but I do hope others can make use of it too.
 

Blah

Free supporter
1,924
Posts
11
Years
Checking HM Compatibility
Hey guys, I've got a fun one for you. If you're like me and hate wasting move slots on HMs, this hack will make that a thing of the past. This hack checks whether the player's team contains a Pokemon that can learn an HM you specify. It doesn't check if they actually HAVE it, only whether they CAN learn it. Used correctly, the player can simply walk up to a tree and cut it immediately if they have a Pokémon that can cut. This is for Fire Red but porting it should be simple if you know the equivalent offsets in Emerald (and I don't, if someone does, let me know and I'll update this post)

Compile and insert to free space:
Spoiler:


NOTE: Before you compile, direct your attention to the line highlighted in blue. The offset here is the offset of the table that determines TM/HM compatibility. If you have expanded the number of Pokémon in your hack, be sure to change this offset to whatever the new offset is.

Now, using this ASM is simple. In whatever script you're writing, first set variable 0x800D (aka LASTRESULT) to one of the following values based on the HM you are checking:

Spoiler:


Then, call the ASM using Callasm. After the ASM runs, variable 0x800D will be set to the party slot containing the Pokémon who can learn whatever move you checked for, or 0x6 if no Pokémon was found.

The only issue is, Fly and Flash aren't used in scripts by the game, and Dive and Waterfall can't be checked. Making items that perform the same functions using other methods, however, is a working substitute.

Here's an example script. Let's say I'm editing the cut tree script. (If you remove the badge check and attack check as I have you can actually overwrite the original script with this, as there's enough space for it)
Spoiler:


Anyways, that's that. I'll be using this in the future, but I do hope others can make use of it too.

First of all, good job! As for the issues with Surf, Waterfall and Fly, I think these links would help you a good amount:
http://www.pokecommunity.com/showthread.php?t=338513
http://www.pokecommunity.com/showpost.php?p=8676227&postcount=530

Lastly, just a small tip.
Code:
cmp r5, r3
beq endfail
b loopback
When you have two branches in a row (and one or both aren't "bl") it can be reduced to a single branch. Here bne loopback would do the same as these two branches if you move endfail as the next line in sequence :)
 
132
Posts
9
Years
  • Age 23
  • Seen Apr 21, 2024
Hey, I'm not sure if this is the correct place to put this, but I used KDS's script for the Wide Lens in my hack. It compiled properly and everything, but the game isn't letting me hold the item, so I can't test if it actually worked.

Where's the check that says whether or not an item can be held?
 
58
Posts
8
Years
  • Age 31
  • Seen Jan 7, 2017
I don't know where it is either. Perhaps you can ask daniilS via VM or something.




1) For forced evolution, I don't know what you're really talking about. You mean just make a Pokemon evolve without giving the player time to hit the "b" button? I'll look into Pokemon evolution sure.

2) I haven't seen it so VMing me it would be nice. Anyways this is rather easy, I've done it before. I'll post the results at the bottom of this post.

3) Skipping the introduction was already done by Knizz. There's a post in the research and development section's quick research thread.


Preventing TMs from being consumed on use


Quick research:
TMs are deleted in two places. The first place is in their own function. When called from the bag, after use the TM has it's own deletion mechanism. The second way is from the bag, after you use a TM the bag attempts to delete it as well. Well, the solution is quite simple. There's two ways to do this, either go to 0809A1D8 call your own function there which checks if the item is a TM, and if it is, just jump to the end. Or much more simply you just remove the parts from the bag and tm function that deletes the TM (Which is what I did). The former way is a way you can make another item you have unconsumable.

To insert:
Do the byte changes below
0x124F78: 00 00 00 00
0x125C80: 00 00 00 00

Make it Ungivable:
insert that at 0x1326B8: 00 00 17 E0

Make it consumable after animation:
Insert: 00 00 00 00 at 0x124F78

To remove the quantities showing up in the bag:

Compile and insert into free space:
Spoiler:


Here's a compiled version:
Code:
00 2D 01 D1 05 4B 18 47 38 1C 08 21 22 1C 04 4E 00 F0 02 F8 01 4B 18 47 30 47 C0 46 FF 1E 13 08 B1 35 13 08

Now navigate to 0x131EF4 and insert:
Code:
00 48 00 47 XX XX XX 08
Where XX XX XX is the pointer to where you assembled the routine +1

Now navigate to 0x131EA5 and change the byte to E0

Unsellable:
Basically for the TMs, you can still sell them to vendors. To change this, you need to modify each TM individually. It's unfortunate, but the game checks if an item can be sold my comparing it's market price to zero. If it's strictly greater than zero, then you can sell it to a vendor, seems to be the rule. So to make TMs unsellable you need to set their market prices individually to zero.
I can't use my own checks to disguise the TMs as unique because the sell routine in shops are used for ALL items including potions, berries, TMs, and other items like nuggets.


Present :3
3nina1p.png

I've found a way to make TMs unsellable:
Code:
0x132924 - 00 00 00 00
In addition, the quantity in bag when you buy TMs in the game should be hided, and here is a quick way to remove the box which shows the quantity for all items:
Code:
0x9BCC2 - 00 00 00 00
So here's the full code, no extra routines needed

Reusable TMs

Code:
0x1326BA - 17 E0 //can't hold as item
0x124F78 - 00 00 00 00 //can't delete
0x125C80 - 00 00 00 00 //can't delete
0x124EAC - 00 00 00 00 //can't delete
0x131EA6 - 2A E0 //fix the graphic
0x132924 - 00 00 00 00 //can't sell
0x9BCC2 - 00 00 00 00 //hide the box showing quantity

My contribution:

Forcing the text speed to "fast"

It is done by neglecting the speed set by the player:
Code:
0xF78D0 - 01 20
Then everything is done automatically.
 
Last edited:
534
Posts
11
Years
  • Age 26
  • Seen Jul 24, 2023
I've found a way to make TMs unsellable:
Code:
0x132924 - 00 00 00 00
In addition, the quantity in bag when you buy TMs in the game should be hided, and here is a quick way to remove the box which shows the quantity for all items:
Code:
0x9BCC2 - 00 00 00 00
So here's the full code, no extra routines needed

Reusable TMs

Code:
0x1326BA - 17 E0 //can't hold as item
0x124F78 - 00 00 00 00 //can't delete
0x125C80 - 00 00 00 00 //can't delete
0x124EAC - 00 00 00 00 //can't delete
0x131EA6 - 2A E0 //fix the graphic
0x132924 - 00 00 00 00 //can't sell
0x9BCC2 - 00 00 00 00 //hide the box showing quantity
My contribution:

Forcing the text speed to "fast"

It is done by neglecting the speed set by the player:
Code:
0xF78D0 - 01 20
Then everything is done automatically.

Umm... Hi. I believe I don't understand the implication of your comment "//can't delete". Does this mean I can't delete the attack I taught using a TM?
 
58
Posts
8
Years
  • Age 31
  • Seen Jan 7, 2017
Umm... Hi. I believe I don't understand the implication of your comment "//can't delete". Does this mean I can't delete the attack I taught using a TM?

It means that it won't be deleted even it's used so that's just part of this hack. (It is from FBI's hack so please don't worry about it)
 
Back
Top