• 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 think that's a big problem. Not only the scene of registering Pokemon data is not right, but the data in Pokedex is also wrong when I open it to see the data. For example, I caught Gary's squirtle but in the Pokedex the data of Pidgey is obtained and squirtle is still marked not caught. I challenged another trainer with 2 Pokemon and the same thing happened.
 
146
Posts
11
Years
  • CO
  • Seen Mar 16, 2023
Wow, you took that well. I was expecting you to be a little annoyed at me for practically butchering through most of your suggestions. I like people who understand. Here's something you'll enjoy :)


Introducing ASM to your Bank scripts


Bank scripts are normally very simple. There's a variable which holds the amount of money you have, normally holding $65, 535. Or if the scripter who wrote the script is good like I am, it'd become 999, 999, 999. Anyways, bragging aside, I made two routines to help improve your banking experience :P



Adding Interest into your variable


Before you can insert this, you need to have the Minute Routines Framework inserted.

This is very specific to the bank variable you're using. I'll show you the routine first. There's some orange text for you to look at again. The first orange text is how often to add interest, 0x1 is every minute and 0x3b would be every hour. The second orange text is the amount you need to subtract from 0x4100 to reach your variable. Note, you bank variable should be in the range of 0x4011 - 0x40FF. If it's not you're using an unsafe variable and should change it to something.

After you've fixed the orange text to match your bank script compile and insert into free space.

Spoiler:


After you've inserted this routine, append a pointer to it to the Minute Routine Framework table.

Usage:

No usage. Interest is added on a minute basis to your variable of choice (which should be deposited value).



Battle Money Straight into a variable


So this one is kind of specific, but I kinda felt like helping someone out so I did it. All it does is, intercept the money being given to the bag, and adds it to a given variable instead. It's toggled by flag 0x250.

How to insert:

Look at the orange text. Similar to the first routine, you will need to change the amount subtracted to match your variable (remember you're subtracting two hex numbers). Once you've fixed it, you can go ahead and compile the routine into free space (write down the place you compiled it to).

Spoiler:


Now navigate to 0x259EC and insert the following byte changes:
Code:
 00 49 08 47 XX XX XX 08
Where XX XX XX is the reverse hex pointer to where you inserted this routine +1.

Usage:

Flag 0x250 must be set for the routine to be toggled on, else money will be put in the player's bag as normal.



Thank you so much!!! ^_^
Now I can start my hack....

It will be interesting to see if others use this as well...

Honestly I was just happy to get a reply at all for them requests,
I read the terms of the thread and wasn't even going to post but I thought hell with it midas well try...
I figured what the answers would be, but thought that it would be a good idea to get a programmers opinion on the subjects.
Usually to get a reply at all from the top asm programmers, scripters and graphic artist on here is a shot in the dark. So I do really appreciate it!

I would like to add though that I did try to make the Dawn Stone an its because of the gendercheck that it needs asm... From what I have been told, But you are right GoGo has it but wont release it until he feels the need I guess... sadly >_<
But that can always be worked around....

Again though THANK YOU!!!!!!
You need a donation button >_<
 
199
Posts
12
Years
  • Seen Jul 18, 2016
Well, actually this isn't as hard as you may think it is. In your script you can do a checkitem to check how many they have, and if they have too many you just say, "aww too bad". The only difficulties would be the mart checking if you have bag space...hmmm. I'm sure there's more cases of failure

Yeah that is true. Going through all those item scripts and such is going to be a nightmare if I truly want to do it. XD

but does anyone really max out their bags? I know I used to carry like 700 revives with me, but I think that's just me.

Well the idea is to prevent that. I know I filled up my bag with full restores and revives. :D
 
15
Posts
9
Years
  • Age 28
  • Seen Nov 20, 2016
How do you randomize the Trainer ID, because skipping the Oak Intro causes it to default at 000000.
 

Joexv

ManMadeOfGouda joexv.github.io
1,037
Posts
11
Years
Thank you so much!!! ^_^
Now I can start my hack....

It will be interesting to see if others use this as well...

Honestly I was just happy to get a reply at all for them requests,
I read the terms of the thread and wasn't even going to post but I thought hell with it midas well try...
I figured what the answers would be, but thought that it would be a good idea to get a programmers opinion on the subjects.
Usually to get a reply at all from the top asm programmers, scripters and graphic artist on here is a shot in the dark. So I do really appreciate it!

I would like to add though that I did try to make the Dawn Stone an its because of the gendercheck that it needs asm... From what I have been told, But you are right GoGo has it but wont release it until he feels the need I guess... sadly >_<
But that can always be worked around....

Again though THANK YOU!!!!!!
You need a donation button >_<

Dawn stone has a gender requirement? Odd...
But what you could do is use Kearnseyboy6's gender routine and modifie it to work with evolution stones. It would probably be adding an extra check to the evo stone routine though. Im not the best with asm so I wont try it out, but maybe someone could figure out a little routine for it.:)
 

Blah

Free supporter
1,924
Posts
11
Years
I think that's a big problem. Not only the scene of registering Pokemon data is not right, but the data in Pokedex is also wrong when I open it to see the data. For example, I caught Gary's squirtle but in the Pokedex the data of Pidgey is obtained and squirtle is still marked not caught. I challenged another trainer with 2 Pokemon and the same thing happened.

Hi, thank you for your reports. I've now fixed the bugs and will attach the fixes to this post.

Thank you so much!!! ^_^
Now I can start my hack....

It will be interesting to see if others use this as well...

Honestly I was just happy to get a reply at all for them requests,
I read the terms of the thread and wasn't even going to post but I thought hell with it midas well try...
I figured what the answers would be, but thought that it would be a good idea to get a programmers opinion on the subjects.
Usually to get a reply at all from the top asm programmers, scripters and graphic artist on here is a shot in the dark. So I do really appreciate it!

I would like to add though that I did try to make the Dawn Stone an its because of the gendercheck that it needs asm... From what I have been told, But you are right GoGo has it but wont release it until he feels the need I guess... sadly >_<
But that can always be worked around....

Again though THANK YOU!!!!!!
You need a donation button >_<

Alright, I'll make a Pokemon Gender check routine for you next time I've got time.

Yeah that is true. Going through all those item scripts and such is going to be a nightmare if I truly want to do it. XD

Well the idea is to prevent that. I know I filled up my bag with full restores and revives. :D

Hmmm, alright I'll look into it. It's just going to be painful because I'd need to make look-up tables and people need to keep those tables updated and such.

How do you randomize the Trainer ID, because skipping the Oak Intro causes it to default at 000000.
Oh, that's an interesting side effect. Yes, I can change it really easily using my Random number generator. Routine may come sometime tomorrow.


Trainer Pokemon Capturing bug fixes


There were two bugs that needed squashing. The first one was the Pokedex being incorrectly updated. The second one was the pokedex graphic being incorrectly updated. These routines are fixes for specifically trainer capturing, however, they will do no harm at all if you insert them into a ROM without the trainer hack. For those of you with buggy Pokedexes, I suggest you pay some attention, because this is the key to fixing those as well.

I'll attach some technical explanations of how the thing is implemented later, and the cause of the bug.


Fixing the Pokedex update


The Pokedex is incorrectly updated in the case you don't capture the opponent's first Pokemon. This is because the game assumes that the Pokemon captured is in the first slot. There aren't any double wild battles in FireRed, so the case of two Pokemon aren't covered. Not to mention that it was never originally intended for the player to be able to capture trainer Pokemon. If anyone is planning on double wild battles in FireRed, this is how you would fix the capturing system here as well.

How to insert:

Compile and insert into free space the following routine:

Spoiler:


Compiled version:
Code:
07 B4 0F 4A 12 68 00 24 05 2C 09 D0 0D 48 64 21 61 43 40 18 01 1C 00 68 90 42 02 D0 01 34 F3 E7 08 49 0C 1C 20 1C 0B 21 00 22 08 B4 06 4B 00 F0 05 F8 08 BC 05 1C 07 BC 04 48 00 47 18 47 C0 46 84 3C 02 02 2C 40 02 02 E9 FB 03 08 6F D9 02 08

Now navigate to 0x2D95E and insert the following byte changes:
Code:
00 00 00 48 00 47 XX XX XX 08
Where XX XX XX is the reverse hex pointer to where you inserted this routine +1


Usage:

There isn't a usage for this hack. It's run internally and is 100% (tested) and safe for wild battles as well.



Fixing the Pokedex graphic


The Pokedex graphic suffered the same issue as the Pokedex update, however the routines aren't connected, so you need to fix both to yield a proper result.

How to insert:

Compile and insert the following routine into free space:

Spoiler:


Compiled version:
Code:
0D 4A 12 68 00 24 05 2C 09 D0 0C 48 64 21 61 43 40 18 01 1C 00 68 90 42 02 D0 01 34 F3 E7 07 49 08 1C 0B 21 00 22 08 B4 05 4B 00 F0 04 F8 08 BC 05 1C 04 48 00 47 18 47 84 3C 02 02 2C 40 02 02 E9 FB 03 08 EB D9 02 08

Now navigate to 0x2D9DC and insert the following byte changes:
Code:
00 48 00 47 XX XX XX 08
Where XX XX XX is the reverse hex pointer to where you inserted your routine +1.

Usage:

There isn't a usage, it's run interally. I'm about 23% sure this might fix some people's Pokedex image bug as well.
 

Blah

Free supporter
1,924
Posts
11
Years
How do you randomize the Trainer ID, because skipping the Oak Intro causes it to default at 000000.

In response to this:

Setting a random Secret and Trainer ID


Requires the insertion of Random Number generator
So apparently TID isn't set if you skip the intro, and I'm sure SID is probably also not set. The following routine will randomize them for you!


To insert:

There's some orange text here, set it to be the pointer to where you inserted the random number generator routine +1 (keep the 0x8 prefix, but don't reverse the pointer).

After you've fixed the pointer, compile and insert into free space.

Spoiler:



Usage:

setvar 0x8001 0x0
callasm 0x[this routine +1]
setvar 0x8001 0x2
callasm 0x[this routine +1]

Call it twice like I have, setting var 0x8001 to 0x0 and 0x2 respectively, it will generate a random PID and SID.
 
Last edited by a moderator:

Trainer 781

Guest
0
Posts
Wide Lens (Raises wielder's accuracy by 10%)

Spoiler:
 
Last edited:
146
Posts
11
Years
  • CO
  • Seen Mar 16, 2023
No rush at all...
I am very appreciative for not only the Bank System I have been trying to get for years but every single contribution you bring to the community ^_^
So I again Thank and applaud you an even the rest of the contributors!!!

Joexv,
Dawn Stone- Effect: Causes Male Kirlia to evolve into Gallade.
Causes Female Snorunt to evolve into Froslass.

http://bulbapedia.bulbagarden.net/wiki/Evolutionary_stone

It will be a great addition to the game for sure ^_^
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
Compiled version:
Code:
0D 4A 12 68 00 24 05 2C 09 D0 0C 48 64 21 61 43 40 18 01 1C 00 68 90 42 02 D0 01 34 F3 E7 07 49 08 1C 0B 21 00 22 08 B4 05 4B 00 F0 04 F8 08 BC 05 1C 04 48 00 47 18 47 84 3C 02 02 2C 40 02 02 E9 FB 03 08 EB D9 02 08

Now navigate to 0x2D9DC and insert the following byte changes:
Code:
00 48 00 47 XX XX XX 08
Where XX XX XX is the reverse hex pointer to where you inserted your routine +1.

Usage:

There isn't a usage, it's run interally. I'm about 23% sure this might fix some people's Pokedex image bug as well.

Will these codes fix the graphic problem of expanded pokemon? It shares the same pokemon
 

jiangzhengwenjzw

now working on katam
181
Posts
11
Years
  • Seen today
Great work! The current problem was solved but I found another bug. When the old man in Firered taught you how to catch pokemon, the weedle he caught was registered on the Pokedex and it appeared in my team!
Edit: Moreover, when I watched the Teachy TV, as it caught a Jigglypuff, it didn't appear in my team but is registered in the Pokedex and marked as caught!
 
Last edited:
15
Posts
9
Years
  • Age 28
  • Seen Nov 20, 2016
In response to this:
To insert:

There's some orange text here, set it to be the pointer to where you inserted the random number generator routine +1 (keep the 0x8 prefix, but don't reverse the pointer).

After you've fixed the pointer, compile and insert into free space.

Spoiler:
 

Blah

Free supporter
1,924
Posts
11
Years
Wide Lens (Raises wielder's accuracy by 10%)

Spoiler:

Good job!


Will these codes fix the graphic problem of expanded pokemon? It shares the same pokemon

It likely won't. There's a lot of things that go wrong, there's limiting code everywhere. So unless you fix those and keep the data/clean and consistent you're going to get bugs all day :)

Great work! The current problem was solved but I found another bug. When the old man in Firered taught you how to catch pokemon, the weedle he caught was registered on the Pokedex and it appeared in my team!
Edit: Moreover, when I watched the Teachy TV, as it caught a Jigglypuff, it didn't appear in my team but is registered in the Pokedex and marked as caught!

Woah. That's actually a cool side-effect imo (especially since you can change what Pokemon the old guy catches you). But you can overcome with this clever use of the PSS full party swap routine. Basically call it at the start of the techy tv script, then use the PSS again at the end of the script.

It won't compile in HackMew's compiler. It complains for both "mov r2, 0xFFFF" lines that 0xFFFF/65535 is "out of range".

I've made some fixes
 
17
Posts
17
Years
  • Age 36
  • Seen Dec 13, 2016
Hi,

Using the Battle Mode + Remove White Out add-on. Is there any flag or variable to check whether I won or lost the last battle? (particularly for trainers)

I'm trying to branch a script using the 0x1 Trainerbattle byte. With a trainer having a 'victory' message and a 'defeated' message.

Many thanks :-)
 

Blah

Free supporter
1,924
Posts
11
Years

Check Pokemon Gender


This is a simple routine to check a certain Pokemon in your party's gender given a slot number.

How to insert:

Compile the following routine into Free space:
Spoiler:


Here's a compiled version:
Code:
1F B5 10 48 00 78 64 21 41 43 0F 48 40 18 04 1C 0B 21 0E 4A 00 F0 15 F8 02 1C 04 B4 20 1C 00 21 0A 4A 00 F0 0E F8 04 BC 01 1C 10 1C 08 4A 00 F0 08 F8 08 49 FF 22 10 1A 90 42 00 D1 02 20 08 70 1F BD 10 47 C0 70 03 02 84 42 02 02 E9 FB 03 08 8D F7 03 08 B8 70 03 02


Usage:

setvar 0x8004 0x[slot number]
callasm 0x[this routine]

The return value from the routine will be in variable 0x8000.

Genderless = 0
Female = 1
Male = 2


Hi,

Using the Battle Mode + Remove White Out add-on. Is there any flag or variable to check whether I won or lost the last battle? (particularly for trainers)

I'm trying to branch a script using the 0x1 Trainerbattle byte. With a trainer having a 'victory' message and a 'defeated' message.

Many thanks :-)
RAM location 0x2023E8A will be zero if they lost. Something else if they won.
 
Last edited:

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years

Check Pokemon Gender


This is a simple routine to check a certain Pokemon in your party's gender given a slot number.

How to insert:

Compile the following routine into Free space:
Spoiler:


Here's a compiled version:
Code:
1F B5 10 48 00 78 64 21 41 43 0F 48 40 18 04 1C 0B 21 0E 4A 00 F0 15 F8 02 1C 04 B4 20 1C 00 21 0A 4A 00 F0 0E F8 04 BC 01 1C 10 1C 08 4A 00 F0 08 F8 08 49 FF 22 10 1A 90 42 00 D1 02 20 08 70 1F BD 10 47 C0 70 03 02 84 42 02 02 E9 FB 03 08 8D F7 03 08 B8 70 03 02


Usage:

setvar 0x8004 0x[slot number]
callasm 0x[this routine]

The return value from the routine will be in variable 0x8000.

Genderless = 0
Female = 1
Male = 2



There isn't. I'll edit the routine to have one shortly.

This is awesome!
Upgrading your Party Item Checker Routine
A new var will be set making the game checks If an specified Pokemon holding an specified item in an specified party slot.
Example, A bulbasaur holding Master ball in Party Slot number 1.
 

Blah

Free supporter
1,924
Posts
11
Years
This is awesome!
Upgrading your Party Item Checker Routine
A new var will be set making the game checks If an specified Pokemon holding an specified item in an specified party slot.
Example, A bulbasaur holding Master ball in Party Slot number 1.

This is what it's capable of currently. It works with a species argument, and if you don't provide a species it will just look for the item.
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
Yes, he's saying that the routine is able to check whether a certain species in the party is carrying a specific item. If you give it a species to check for as well as an item, it will check both. If you give it just the item, it'll simply try to find the item.

No, That is Not what I mean, I know that routines usage. what I mean is The game will check not only the Specie and Item but also party slot,
example: A bulbasaur holding Master ball in 1st slot only.
 
Back
Top