“PC value out of range.”
This is the message a lot of NESmaker developers dread. It (usually) means that the static bank $1F is full, and you’ll need to size it down a few notches. Here are three (bigger and smaller) suggestions on how to move or get rid of those excessive bytes!
1. Move nonstatic scripts out of the static bank
Not all scripts that are in the static bank by default, really need to be there actually. You can move quite a few scripts from there to dynamic banks, and bankswitch to access them. The following two three! excellent contributions of JamesNES to the community will save you tons of space. You’ll find the approximate space save per suggestion in brackets.
[4.5.x] Move doLoadScreen to bank 16 (about 15%)
[4.5.9] Move physics out of the static bank (about 7%)
[4.5.9] Move your inputs out of the static bank (depends on the amount of input scripts, usually it saves around 2-6% i think)
2. Remove what you don’t need
Because NESmaker was modified to become an all-purpose NES game development environment, there’s a lot of stock material that you may not need for your project. This is also why I suggest you use a new folder for every NESmaker project you do. NESmaker is portable, so you can have multiple instances of it next to each other. This way ensures you won’t modify scripts that you might still need unmodified for other/older projects. Either way, I digress. One example of stock material you (more often than not) might get rid of from the static bank, are the initial screen triggers (line 139-206 of Initialization.asm) – this saves about 128 bytes (or 0.8%), which isn’t much but might be just enough.
3. Move empty user variables to zero page RAM
In NESmaker, go to Project Settings and then click the User Variables tab. The user variables that have a default value of zero can be removed from this tab and then re-added with the same name to the Zero Page RAM tab. That saves four bytes per variable, which seems like nothing but might add up if you use them a lot.