• 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?".
  • Forum moderator applications are now open! Click here for details.
  • 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.

[Fire Red]: Extending The Number Of Safe Flags And Variables

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Hi there, and as you may have come to notice, the number of truly safe variables and flags available in the vanilla Fire Red game is extremely limiting.

If you don't know this, then read this great thread by karatekid552 which explains why flags and variables after/before a certain number are unsafe to use.

So, is there any good way to solve this problem? Well, yes, we can repoint a block of the variables and flags to use free memory!

It should be noted that, after including this repoint in your hack, any PLAYERS will be forced to restart their save games! There is no way around this.

PREREQUISITES
Spoiler:


So, to the main part of this post.

Making Flags 0x900-0x18FF safe to use:
Spoiler:


And secondly, the variables!

Making Vars 0x5000-0x51FF safe to use:
Spoiler:


It should be noted that these routines are not mutually exclusive. You can have both or you can have one or the other. You do NOT need both for only the flag hack, or both for the var hack. Obviously, if you want both the flags and vars hack, you need both.

Since people seem to not understand how to assemble and insert ASM (understandable, it is awkward compared to scripting et al), I'm gonna quote this very useful mini-guide from further down this page.

Spoiler:

Anyway, that's everything for this tutorial!
 
Last edited by a moderator:

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
Wow, you're an ASM King! Anyway, congrats, I may use this but using many variables is quite useless since a single variable can hold a value of 0-65,535 so using like three variables in a hack is possible. However, flags are limited so I may use that.
 
Last edited:

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
That's why I put significantly less extra variables into it than extra flags XD. However, don't underestimate the potential uses of combining the safe var hack and JPAN's hacked engine, for example, since that uses a significant number of variables to operate.
 

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
That is true. I may actually consider it now.
 
534
Posts
11
Years
  • Age 26
  • Seen Jul 24, 2023
Whoa. O_o Just a few days ago talking about it. Posts a thread showing how to do it the next day.
 

Dragonflye

Author of Pokémon Sovereign of the Skies
107
Posts
14
Years
  • Age 28
  • Seen Oct 9, 2023
Can I use this code in Emerlad? I would be really happy, and how would also like to use in emerald with no problems vars and flags.

Edit: Sorry its a nice work.^^
 
Last edited:

Renegade

Time for real life...
995
Posts
12
Years
Is it possible for me to test if it works? (Really I KNOW it will work, I just want to know if I screwed anything up :P)
 

MrDollSteak

Formerly known as 11bayerf1
858
Posts
15
Years
Fabulous work Jambo! Another fantastic addition to the Romhacking Community.

You're on a roll!
 

miksy91

Dark Energy is back in action! ;)
1,480
Posts
15
Years
Nice work! Though you should also add proper documentation of what ram areas the codings use. That way, it would be clear where the users could store all kinds of other data as well and not just bit values/sets describing flags and vars.
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Nice work! Though you should also add proper documentation of what ram areas the codings use. That way, it would be clear where the users could store all kinds of other data as well and not just bit values/sets describing flags and vars.

It's pretty clear if you understand the ASM, but that's obviously a bit of a rarity. It repoints the flags into 0x0203C000 - 0x0203C1FF (0x200 bytes in total, giving 8 * 0x200 = 0x1000 flags).

And the vars are repointed into 0x0203C200 - 0x0203C5FF (0x400 bytes in total, giving 0x400 / 2 = 0x200 vars).

This memory is not normally saved, hence the requirement for JPAN's save block hack (which I link to a patch version of in the first post).

If you use both of these routines, you are left with 0x0203C600 - 0x0203CEC4 in the save block, meaning you can place other useful things in it, for example, you could store roaming Pokémon data in it (hint hint, wink wink :P).
 

Trev

[span="font-size: 8px; color: white;"][font="Monts
1,505
Posts
11
Years
  • Age 27
  • Seen Nov 15, 2023
Okay, two questions.

1.) When I try to download the patch, I get a message saying "You do not have permission to view this download." Do I have to make an account for that site to get it? Yep, that's what I had to do.

2.) Since I have no understanding of ASM, how exactly do I assemble this and insert it into my ROM? Is it just done in any script editor or do I need some other program?
 
Last edited:

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Okay, two questions.

1.) When I try to download the patch, I get a message saying "You do not have permission to view this download." Do I have to make an account for that site to get it? Yep, that's what I had to do.

It's also available somewhere on PC, but I don't know where.

2.) Since I have no understanding of ASM, how exactly do I assemble this and insert it into my ROM? Is it just done in any script editor or do I need some other program?

http://www.pokecommunity.com/showthread.php?t=117917#ASM1
This part of the post sums up how to assemble and insert ASM pretty well. Obviously, you're not needing to do any of the script parts of that post, just the ASM assembly.
 

Trev

[span="font-size: 8px; color: white;"][font="Monts
1,505
Posts
11
Years
  • Age 27
  • Seen Nov 15, 2023
Okay, so what program is the best for ASM? Because I have absolutely no clue...
 
146
Posts
11
Years
  • CO
  • Seen Mar 16, 2023
^_^ Very much appreciated Jambo51 you are a Hall of Famer in my book... I'm going to try this right now and see what happens. I have never done ASM before but I will take it step by step and use some common sense, even though it seems fairly complex.
When this is installed correctly how could I test it and know? ( sorry for the noob question >_< )
And would it be ok to use XSE's rom expander?


Well I seem to be stuck =( I can't for the life of me find a ASM to hex assembler as I am not good with command promt. and do not wanna mess up my system. Is there any software that can take asm and turn it into Hex?
 
Last edited:

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Well I seem to be stuck =( I can't for the life of me find a ASM to hex assembler as I am not good with command promt. and do not wanna mess up my system. Is there any software that can take asm and turn it into Hex?

You can find a set of files here which assemble ASM files into raw hex code. You're after the THUMB.bat file (and all the files it calls). You may want to read how to assemble the ASM in that short tutorial as well.
 
146
Posts
11
Years
  • CO
  • Seen Mar 16, 2023
You can find a set of files here which assemble ASM files into raw hex code. You're after the THUMB.bat file (and all the files it calls). You may want to read how to assemble the ASM in that short tutorial as well.

Ok well I have sat here and read Hackmews ASM tut about 4 times now and still I can't seem to understand how to assemble ASM to HEX... His tut seems to speak to people who already know the basics of programming and as for me I am a complete noob to programming... I can't find any video tutorials on GBA ASM hacking nor can I seem to find any IDE or Software that simply converts ASM to HEX. So I am starting to feel at a lose here, like I will never understand how this works (to the point I'm ripping my hair out)... There is no way that you could make a patch for this so us that see ASM as a whole other world of hacking =( ( I will be buying some books for sure)
 

Trev

[span="font-size: 8px; color: white;"][font="Monts
1,505
Posts
11
Years
  • Age 27
  • Seen Nov 15, 2023
Ok well I have sat here and read Hackmews ASM tut about 4 times now and still I can't seem to understand how to assemble ASM to HEX... His tut seems to speak to people who already know the basics of programming and as for me I am a complete noob to programming... I can't find any video tutorials on GBA ASM hacking nor can I seem to find any IDE or Software that simply converts ASM to HEX. So I am starting to feel at a lose here, like I will never understand how this works (to the point I'm ripping my hair out)... There is no way that you could make a patch for this so us that see ASM as a whole other world of hacking =( ( I will be buying some books for sure)

Don't waste your money on books, those will just make everything more confusing. It's not as hard as you're making it out to be. Here's how I did it, which made it work fine.

Spoiler:
 
Last edited:
146
Posts
11
Years
  • CO
  • Seen Mar 16, 2023
Don't waste your money on books, those will just make everything more confusing. It's not as hard as your'e making it out to be. Here's how I did it, which made it work fine.

Spoiler:


It would be helpful to have a tutorial on how to do this, Jambo, since most people don't have the knowledge of how to do this stuff.


Well thank you very much for this. I am understanding now... I have both flag.bin and var.bin now and have already added the flag one to my rom as you made it easy by tossing in the 01 00 80 but my final question is when you revers hex and add one does that mean 800044 becomes 45 00 80 and so on???

PS. Again I thank bolt of you for answering my questions so fast as that is rare on here.. Thanks to you, Jambo51 and karatekid I am at more of an understanding to this ASM. And you where more than right, I was making it harder than it was for sure ^_^
 
Back
Top