View Single Post
Old August 27th, 2012 (2:09 PM).
redriders180's Avatar
redriders180 redriders180 is offline
Mastermind of Pokemon Glazed
    Join Date: Jun 2010
    Location: Path of Victory, Tunod
    Gender: Male
    Nature: Quirky
    Posts: 540
    Originally Posted by No-san View Post
    Exactly what I needed, thank you very much redriders180 and DavidJCobb (and sorry I couldn't find that post myself... ) !!

    But, um, I'm very new to the world of hacking, and your answer brings up questions...
    When you say it would free "254 or so variables", I understand that there is a limit to the number of variables you can add... How come ? Is that a problem with the size of the ROM that would cause a problem when patching with the hack ? And, in the same fashion, is there a limit to the number of flags too ?

    And last question, where does that "65.535" come from ?

    You suddenly made me all nervous about ROM-space management... Though I shouldn't, when I see those great hacks allowing to visit more than a single region...
    There is a limit to both flags and variables...I don't know the limit off the top of my head, but it's generally good practice to use the range of flags and variables used by the original: i.e., only use flags and variables on that list. I believe that the usable variables are something like 0x4000 to 0x40FF, and once you go higher than that, you'll start overwriting Pokemon info from the box; you'd put in a Horsea, and it might be deleted, or turned into something else entirely!

    It's actually not the size of the ROM that does this...rather, it's the size of the RAM, or basically the memory of the game. The RAM in Pokemon games is already stretched to near-capacity, because it needs to hold data on whatever six Pokemon you have, and whatever 420 Pokemon you may have in any given box, in addition to other things, such as your name, position, rival's name, amount of money, etc.

    For a beginner, the best thing to do is to work within the limits. From what I know, JPAN has created an ASM routine that can expand the saveable RAM, to allow for many more flags or variables, but it's a complicated ordeal.

    I said earlier that a variable is two bytes. One byte is 0xFF...or 255, in decimal. Two bytes is 0xFFFF, which is 65,535 in decimal.

    I think I'm done with ROM hacking. I'll still pop in and visit, though.