• 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

Thank you for this thread it helps so many people even though I've only used a couple of these ams routines because I haven't fully understood asm too much I thank you for this thread! :)

Thanks. Though I would like to point out, to use them all you really need to know is how to insert them and what they do. I've documented a guide on how to insert for beginners (it's a link in the FAQ first post). If you don't understand something or don't see how some routine works, feel free to ask!

Yes. Just yes. Nothing more. Nothing less.
:3

For the first thing, sorry, I was thinking of another link back there. Thanks.

As for the second thing, I meant pick from random which of an enemy trainer's first pokemon he or she will send out first, like if he or she has a rattata, a pidgey, and a charmander in his team, than I want to make it so that the game selects which of these he or she will send out first. I could hackishly create multiple entries in A-Trainer, but is there a way for the game to pick one of an enemy trainer's pokemon to be sent out first?

EDIT: Well, the trainer name screen screen comes up and makes the change when I callasm 0x09FC91, but I seem to come back to the map with the start menu active and my character still being able to move, but at least the name changes.

I'm still not understanding the incentive to randomizing the starting Pokemon. I suppose it would be a small bit of "game change" if someone were to play your hack more than once, but the feature seems a little useless to me :/

The battle system needs its own thread. It's amazing, I'll definitely be writing a few addons for it.
Also, won't it be more user-friendly to put the addons into a table? That way you never need to recompile.

Yeah it definitely could, and should read off of a table. I'll have to redo that little bit :x


Battle Modes addon: Delete fainted Pokemon


For those hackers who like minigames, this routine will delete Pokemon who have fainted in battle. There's a few things that need to happen for this effect to occur.

1) Pokemon who die in battle must be deleted
2) Eggs are spared
3) Pokemon who die outside of battle must be deleted (Poison or another similar effect)

However, if you put this in turn basis, you will NEED to make another routine to delete the Player's party if he/she loses the match. This is because the turn counter isn't reached on the last turn the player loses :x

If you're lazy like me you can just put this routine in as a battle by move addon and cover the whiteout case. Which is actually fine. It's rather fast, because it deletes the Pokemon as they die, so the worse case scenario is unforeseeable. And if a Pokemon dies it will only need to loop 5 times only doing operations on one of the 5 loops. If you're curious looping a maximum of 21 times is the worst case scenario (all 6 of your Pokemon die in 1 turn i.e never, and even if that did happen it'd be done in less .25 seconds). So it's fine to put in the battle by move section without expecting the game to lag.


How to insert:
Insert as addon to battle modes battle by move.
You will notice that near the start of the routine there is some commented out code (denoted by a prefix "@" symbol). That's for a flag check. Change [flag/4] = your flag/4 in hex if you want to toggle by flag. Of course the normal battle mode toggle flag should be used as well.

Spoiler:



Usage:
If you opted to use a flag, set it to allow further battles to delete Pokemon as they faint. If you didn't just sit back and let the unicorns inside the game do the rest.
 
Last edited:

Battle Modes addon: Delete fainted Pokemon


So really if you insert this then you would kinda have to add the game over otherwise you would get some messy gameplay glitches. Or is there a way to make it so a certain pokemon is never deleted?
 
So really if you insert this then you would kinda have to add the game over otherwise you would get some messy gameplay glitches. Or is there a way to make it so a certain pokemon is never deleted?

No, it's standalone and clears the Pokemon flag is the player has run out of Pokemon. So the "worst" glitch that can happen is that the player walks into wild grass without any Pokemon. The behavior there is the same as if this hack wasn't inplace and the trainer walked into grass, they would send out a "?" Pokemon.
If you added the reset feature you can avoid this "loop whole", or you can try and handle it in a different way.

Mini update:
I decided against rewriting the daycare system because I don't think it's "portable" to hacks. By that I mean that a routine that works in my ROM will be specific to my methods of Pokemon/item/stat table location insertions. That and I don't have a FR ROM with all the Pokemon/items in it to try the newer generation things. Also who breeds in hacks?

INSTEAD I'm doing roaming Pokemon! Basically, you might know that current Roaming is rather buggy and systematic. I'm going to be updating to the newer generation's roam mechanics and also allow for expansion of what's roaming. Current roaming Pokemon hacks (JPANs) is basically just the wild Pokemon roaming about and encouterable anywhere in the wild. This leads to things like Raikou in the middle of the ocean. I'm also going to do the 4 guaranteed 31 IVs thing :3
 
Here's another new item for y'all.

Light Clay

Code:
.text
.thumb
.thumb_func
.align 2
.global lightclay

main:
lsl r0, r1, #0x1
add r0, r0, r1
lsl r0, r0, #0x2
mov r1, lr 
add r0, r0, r4
push {r0-r3}
bl itemcheck
cmp r0, #0x4C
beq extend
pop {r0-r3}
add r1, #0x7
mov lr, r1
mov r1, #0x5
b return

itemcheck:
ldr r0, .routine
bx r0

extend:
pop {r0-r3}
add r1, #0x7
mov lr, r1
mov r1, #0x8

return:
bx lr

.align 2
.routine: .word 0x08800001

@ insert FE 46 00 48 00 47 XX XX XX 08 at 0802889E and 0802755E

This routine also utilizes the item check routine located in this post: https://www.pokecommunity.com/posts/8515067/

Replace the address at .routine with the item check routine's address.

Cheers!
 
ok so anyone whos having the game freeze when the trainer and pokemon are sliding in when using The by turn battle addon change 0xe2e0 to 00 4D 28 47 xx xx xx 08 81 08

Also found a bug. When a Pokemon is deleted with your asm which ever was in slot 2 gets "sent out" and is hovering behind your next pokemon.
 
Last edited:
Whoa. I've always told myself that I needed to learn ASM if I wanted to do some more crafty things while hacking. These are the kinds of things that are only possible through it! Never did I think a thread like this would exist. A compendium of tons of useful ASM routines, many of which people have been looking for for years! This is incredible! FBI agent, you are doing the work of titans.

I guess if I had to ask of one thing, it'd be this: Could changing what options do in the options menu be done via ASM? I tried changing pointers around areas that had other pointers to text used for it, but nothing seemed to change.

This is a rather pointless feature. TM bag space is limited to I think it's limited to 43 different types of TMs in the TM bag at once. This means that if you convert TMs to the newer generation compatibility (unconsumable) you will run out of bag space. Having studied the bag for my Bag deletion/restoration routines, I can tell you that expanding the bag slots will also be a very hard task. So no, I'm not going to expand TMs, and for anyone who bothers to try, that's a wall they will end up hitting.
By this, do you mean that you cannot carry more than 43 different TMs at once? If so, I don't think that's true. I was able to hold all 50 TMs in FireRed at once (along with all the HMs, of course). There's undoubtedly some tough-to-break limit that's far below 100, but I'm confident it's not 43.
 
For those hackers who like minigames, this routine will delete Pokemon who have fainted in battle. There's a few things that need to happen for this effect to occur.

1) Pokemon who die in battle must be deleted
2) Eggs are spared
3) Pokemon who die outside of battle must be deleted (Poison or another similar effect)

I have saved Pokémon from poison before, so now I shall let them die.
 
By this, do you mean that you cannot carry more than 43 different TMs at once? If so, I don't think that's true. I was able to hold all 50 TMs in FireRed at once (along with all the HMs, of course). There's undoubtedly some tough-to-break limit that's far below 100, but I'm confident it's not 43.

Is it possible to get rid of one of the Pokemon storage boxes from the PC (Say, remove Box 30) and repoint the TM Case contents there to make room for more TMs?
 
Ok, this one's for Christos, who requested this on IRC.
EDIT: And for MrDollSteak, cuz rombase. (who doesn't like new items?)

Weather Rocks

The following routines hijack the setweather commands and make them check your held item's effect byte.

First, insert this routine, and keep note of where you inserted this. This returns the held item effect byte to r0

All good Hido, but to burst your bubble just a tad, you don't need to make your own BL to get the held item effect byte. There's a routine in both Fire Red and Emerald that does it for you, and is in fact called in the game several times to do just that (storing it to r6) from there its just a matter of moving it to r0 in your own routines.

While there's nothing wrong with your implementation, running it off the game's BL may be better? Just because I believe the BL uses registers 4-6 meaning you won't need to push anything IIRC. The locations are 0x0809A924 forFire Red and 0x080D74DC for Emerald.

Anyway FBI, these are all amazing. The battle modes hack is great! Sad to see you're no longer working on a custom Day-Care, but understand completely. Your DKnot hack is useful anyway, and realistically you could just do mini hacks like that to simulate modern breeding mechanics. Roaming Pokemon sound great too! Anyway to branch that into Swarms too?
 
Last edited:
Whoa. I've always told myself that I needed to learn ASM if I wanted to do some more crafty things while hacking. These are the kinds of things that are only possible through it! Never did I think a thread like this would exist. A compendium of tons of useful ASM routines, many of which people have been looking for for years! This is incredible! FBI agent, you are doing the work of titans.

I guess if I had to ask of one thing, it'd be this: Could changing what options do in the options menu be done via ASM? I tried changing pointers around areas that had other pointers to text used for it, but nothing seemed to change.


By this, do you mean that you cannot carry more than 43 different TMs at once? If so, I don't think that's true. I was able to hold all 50 TMs in FireRed at once (along with all the HMs, of course). There's undoubtedly some tough-to-break limit that's far below 100, but I'm confident it's not 43.
1) The options menu does indeed require ASM. Though it's a big mess like the BRM iirc. I'll confirm later tonight, though it may not be feasible to edit it as there is a lot going on

2) Sorry it's actually 0x3D TMs in the tm bag, I was mixing up my numbers. But even that is just a little over 60.

ok so anyone whos having the game freeze when the trainer and pokemon are sliding in when using The by turn battle addon change 0xe2e0 to 00 4D 28 47 xx xx xx 08 81 08

Also found a bug. When a Pokemon is deleted with your asm which ever was in slot 2 gets "sent out" and is hovering behind your next pokemon.

Thanks for the bug report. You were right about the delete Pokemon one. I've fixed that now. As for the battle by move, it's working as intended. I haven't got any bugs. The reason you're getting the trainer slide "freeze" is because you've inserted it wrong probably.

I have saved Pokémon from poison before, so now I shall let them die.

The routine only handles deaths by battle. For poison you should just call this routine everystep :3

Is it possible to get rid of one of the Pokemon storage boxes from the PC (Say, remove Box 30) and repoint the TM Case contents there to make room for more TMs?

I couldn't tell you. I know the bag is DMA protected, and just "repointing it" isn't very feasible without a lot more research.

All good Hido, but to burst your bubble just a tad, you don't need to make your own BL to get the held item effect byte. There's a routine in both Fire Red and Emerald that does it for you, and is in fact called in the game several times to do just that (storing it to r6) from there its just a matter of moving it to r0 in your own routines.

While there's nothing wrong with your implementation, running it off the game's BL may be better? Just because I believe the BL uses registers 4-6 meaning you won't need to push anything IIRC. The locations are 0x0809A924 for Fire Red and 0x080D74DC for Emerald.

Anyway FBI, these are all amazing. The battle modes hack is great! Sad to see you're no longer working on a custom Day-Care, but understand completely. Your DKnot hack is useful anyway, and realistically you could just do mini hacks like that to simulate modern breeding mechanics. Roaming Pokemon sound great too! Anyway to branch that into Swarms too?

I don't know what swarming is, but I'll read about it and get back to you :P


Mini update:
I've updated the battle modes routines to read from tables, and have updated the insertion instructions (no more video :P).

I'v also updated/fixed bugs on: getAverageLevel, RemoveFaintedPokemon, setMoves, start menu swap routines
 
Last edited:
1) The options menu does indeed require ASM. Though it's a big mess like the BRM iirc. I'll confirm later tonight, though it may not be feasible to edit it as there is a lot going on
I hoped as such, I wasn't sure if it also required things beyond general ASM (besides the smaller things like scripting). If it'd need to be narrowed down, maybe using the redundant Exit option or repurposing something that isn't useful like Text Speed (lock it at fastest, slower speeds are too slow for anything. Or maybe have IT be the thing that is changed: modify it so one choice for it will skip all text with a button press) would work better. It's alright if it's too involved, I just thought that having a formal change of options would be neat. :)
2) Sorry it's actually 0x3D TMs in the tm bag, I was mixing up my numbers. But even that is just a little over 60.
That seems more correct to me! I wouldn't have been able to pinpoint the exact amount like that, though. If people aren't able to add all the TMs they want, there's always other options like move tutors.
 
All good Hido, but to burst your bubble just a tad, you don't need to make your own BL to get the held item effect byte. There's a routine in both Fire Red and Emerald that does it for you, and is in fact called in the game several times to do just that (storing it to r6) from there its just a matter of moving it to r0 in your own routines.

While there's nothing wrong with your implementation, running it off the game's BL may be better? Just because I believe the BL uses registers 4-6 meaning you won't need to push anything IIRC. The locations are 0x0809A924 forFire Red and 0x080D74DC for Emerald.

Anyway FBI, these are all amazing. The battle modes hack is great! Sad to see you're no longer working on a custom Day-Care, but understand completely. Your DKnot hack is useful anyway, and realistically you could just do mini hacks like that to simulate modern breeding mechanics. Roaming Pokemon sound great too! Anyway to branch that into Swarms too?
Ah, I didn't know that bl existed. Thanks for that. From what I'm seeing, it accepts the mon's held item ID as a parameter, and returns the held item effect byte to r0 (it'd be convenient if it got the user's held item ID itself instead of me having to give it, but oh well). I think I'll just modify my own bl a bit so that it gets the user's held item ID and does a bl to the routine you mentioned.
 

Swapping between two possible start menus


sooooo the goal was to REMOVE the save function... but it also ADDS Pokedex, and Pokemon, if they were not previously there. this is a problem, my hack wont have a pokedex (or the ability to save)

without the pokedex flag being set, the icon is useless (funny lol). maybe I could just set the actual text to nothing... if only I knew where that multi choice box was stored...
 

lol, thanks... but I already found it ;)

totally woulda saved me the 5 mins of searching in GoldFinger tho (the word pokedex shows up alot... fyi)

ive got the text repointed to a single space character for both the Pokedex and its description...

but the menu does not show the player card anymore(not that I need it)... not sure if it will when I set some flags (like the pokemon shouldnt be showing if I have never owned one) so well see how it works out
 
Last edited:
I hoped as such, I wasn't sure if it also required things beyond general ASM (besides the smaller things like scripting). If it'd need to be narrowed down, maybe using the redundant Exit option or repurposing something that isn't useful like Text Speed (lock it at fastest, slower speeds are too slow for anything. Or maybe have IT be the thing that is changed: modify it so one choice for it will skip all text with a button press) would work better. It's alright if it's too involved, I just thought that having a formal change of options would be neat. :)

That seems more correct to me! I wouldn't have been able to pinpoint the exact amount like that, though. If people aren't able to add all the TMs they want, there's always other options like move tutors.

I'll get back to you on the Options menu...soon :P

sooooo the goal was to REMOVE the save function... but it also ADDS Pokedex, and Pokemon, if they were not previously there. this is a problem, my hack wont have a pokedex (or the ability to save)

without the pokedex flag being set, the icon is useless (funny lol). maybe I could just set the actual text to nothing... if only I knew where that multi choice box was stored...

Use this one:
Spoiler:


The routine was just to swap between two. This one here is what you're trying to do.


I don't personally recommend changing pointers around. That's a good find in terms of locations of data, but I wouldn't just simply change the pointers, as you mess up the menu quite nicely.

lol, thanks... but I already found it ;)

totally woulda saved me the 5 mins of searching in GoldFinger tho (the word pokedex shows up alot... fyi)

ive got the text repointed to a single space character for both the Pokedex and its description...

but the menu does not show the player card anymore(not that I need it)... not sure if it will when I set some flags (like the pokemon shouldnt be showing if I have never owned one) so well see how it works out

RIP. Don't use that. Use the code I gave you a few quotes up.
 
Use this one:

sooo funny story...

I kept getting errors when I tried to test if the pokemon menu item would appear. every time I gave the user a pokemon it would go all rainbow and freeze up... test after test after test... failure... turns out... I was using a text "'player' got the 'buffered name' from oak" and i forgot to buffer the name lol

anyway. it works perfectly thanks so much ;)
 
Toggle Run Away

It can work with Toggle Capture very well, or completely independently.
If you use the same Variable as Toggle Capture, if the value is set to 0x1,
a Pokemon will be uncapturable, and you will be unable to Run Away from it.
If the value is 0x0, the game is as normal. If the value is anything else,
you cannot Run Away from the Pokemon BUT you can catch it.

However if you use a completely different variable you will be able to
run away, but not to catch the Pokemon, though to me this is pointless,
because if you have an uncatchable Pokemon, why would you be able to
Run Away from it?

Anyway here is the routine!

Fire Red


Spoiler:


Once I finish porting other abilities I'll make a brand new post for the
Emerald version of this.
 
Last edited:
So here's something you don't see here everyday: a port to EM!

FBI's battle mode hacks are looking awesome, and it'd be a cardinal sin if EM didn't have these features.

So here, have the Battle Routine by Move. (and the deletePokemon routine)

Battle Routine by Move (EM)
Spoiler:


Delete Pokemon (EM)
Spoiler:
 
Last edited:
Back
Top