Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
1 user currently in Rom Hacking: hukka | 2 guests
Acmlm's Board - I2 Archive - Rom Hacking - Extending NES roms- no flaming please! | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
midget35

Paragoomba
Level: 13

Posts: 38/70
EXP: 8877
For next: 1390

Since: 03-17-05

Since last post: 3 days
Last activity: 14 hours
Posted on 07-25-05 08:06 PM Link | Quote
Every doc I've looked up about increasing the size of a NES rom more or less states: 'Don't even try!!!'

Nonetheless- it seems that DD has managed to do so with his upcoming Mario vs Luigio hack, so it's got me thinking again.

I really want to put more types of screens and room objects into Metroid. If I recall correctly- Parasyite was trying to expand the rom for his wip metroid hack? I wonder how that goes, and what processes are involved?

I know it can be a bit of a sore subject, but short of learning the game's code, might there be a way to increase the room data in original Metroid??

Thanks,

dan

Snap Dragon
Level: 43

Posts: 665/782
EXP: 534516
For next: 30530

Since: 03-15-04

Since last post: 20 hours
Last activity: 14 hours
Posted on 07-25-05 08:23 PM Link | Quote
It is possible to expand NES ROMs. Most documents that say it's impossible were written ages ago, when there was a lack of appropriate tutorials, tools, etc.

You will need to be fairly competent with 6502 assembly, how the game you want to expand actually works (this one is the most important), and what mapper the game uses. It will be quite a bit of work (some games will easier than others)

Personally, I think one of the best ways to learn about all this stuff is to take a single bank mapper 0 game (Dig Dug, Battle City, etc) and expand it to run under a memory mapper, and actually use the new PRG space. If you can do that, you should have learned enough to expand NES ROMs.
DukeNukem007

Shyguy
Level: 13

Posts: 28/90
EXP: 9247
For next: 1020

Since: 07-08-05
From: Quahog, RI

Since last post: 18 days
Last activity: 12 hours
Posted on 07-25-05 09:19 PM Link | Quote
Since you're asking about Metroid--If you want to expand the room set, the way the maps of the game work (in a simple sense--I'm not into the details of how hacks work) is that there's a layout of how all the rooms are arranged around $2400h in the ROM--you can see the layout with an 8-bit linear option in a graphics viewer or a hex editor. Then there's data on each of the various room types elsewhere. (You've probably noticed how a lot of screens are "re-used" in Metroid, which is a lot of what makes it so much more confusing and harder to play than Super Metroid.)

So I would suggest moving the map pointer from $2400h to a later slot (somewhere in the second 128k if you were making a 256k PRG rom, or I suppose you could make a 128k PRG/64k CHR rom if you messed with the mapper enough) and working from there.
beneficii

Lakitu
Level: 36

Posts: 325/567
EXP: 299656
For next: 8454

Since: 06-27-04
From: Cordova, TN, USA

Since last post: 14 hours
Last activity: 6 hours
Posted on 07-25-05 10:18 PM Link | Quote
With SMB3, which uses the MMC3 mapper, I don't think it would be too difficult. Keep the first 3C000h bytes of the PRG-ROM in place while making sure those last 4000h bytes remain the last. Fill in anything else in between. (It should only be a problem if the game attempts to load any 2000h byte bank of those last 4000h bytes into any other bank, which I consider unlikely but possible; in that case, make two copies of the last 4000h bytes.) With the CHR-ROM, just keep the banks in place and add past the end. If you increase Mario 3, which has a 256k PRG-ROM and 128k CHR-ROM, you should increase it to 512k PRG-ROM and 256k CHR-ROm.


(edited by beneficii on 07-25-05 01:20 PM)
Dish

Spiny
Level: 38

Posts: 455/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 07-25-05 11:22 PM Link | Quote
adding more PRG/CHR is one thing (and is actually not that hard if you have the idea)

Actually USING that new space is something else entirely, and it often isn't easy. For extra PRG... whenever you wan to use the new space you must swap in the desired bank, do whatever work you want to be done, then swap back in the original bank before returning to the game's original code. This takes not only a decent understanding of 6502, but also of the mapper's registers and swapping abilities.

Using extra CHR is easier -- since all you need to do is swap to the desired bank. For things like animation done through CHR swapping, you'd need to add/modify an existing routine in the game to constantly swap in new CHR banks (animating tiles which use that bank). But still, to do this you have to actually know what you're doing.

As was already mentioned... most mappers need to have a power-of-2 PRG/CHR size. So if a game has 256k PRG and you want to expand it... you'll have to bump it up to at LEAST 512k of PRG -- even if you only want a few extra bytes (there are exceptions to this rule, some rare mappers can have abstract PRG/CHR sizes).

Also beware of mapper limitations. Not only do PRG/CHR sizes have a limit, but some mappers also lack on board cartridge RAM (no ram @ $6000-$7FFF), and some mappers have bus conflicts, so the value you write to the mapper register must match the value read from that address.
beneficii

Lakitu
Level: 36

Posts: 328/567
EXP: 299656
For next: 8454

Since: 06-27-04
From: Cordova, TN, USA

Since last post: 14 hours
Last activity: 6 hours
Posted on 07-25-05 11:28 PM Link | Quote
Originally posted by Disch
adding more PRG/CHR is one thing (and is actually not that hard if you have the idea)

Actually USING that new space is something else entirely, and it often isn't easy. For extra PRG... whenever you wan to use the new space you must swap in the desired bank, do whatever work you want to be done, then swap back in the original bank before returning to the game's original code. This takes not only a decent understanding of 6502, but also of the mapper's registers and swapping abilities.

Using extra CHR is easier -- since all you need to do is swap to the desired bank. For things like animation done through CHR swapping, you'd need to add/modify an existing routine in the game to constantly swap in new CHR banks (animating tiles which use that bank). But still, to do this you have to actually know what you're doing.

As was already mentioned... most mappers need to have a power-of-2 PRG/CHR size. So if a game has 256k PRG and you want to expand it... you'll have to bump it up to at LEAST 512k of PRG -- even if you only want a few extra bytes (there are exceptions to this rule, some rare mappers can have abstract PRG/CHR sizes).

Also beware of mapper limitations. Not only do PRG/CHR sizes have a limit, but some mappers also lack on board cartridge RAM (no ram @ $6000-$7FFF), and some mappers have bus conflicts, so the value you write to the mapper register must match the value read from that address.


Agreed. It should only be done if you're going to make a huge expansion. Otherwise, just try to find some clusters of FF's in the already existant banks to hack, like I did in my starting space ASM hack of SMB3.


(edited by beneficii on 07-25-05 02:58 PM)
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 6057/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 07-26-05 12:51 AM Link | Quote
Actually, most games I've seen use 00 instead of FF.
beneficii

Lakitu
Level: 36

Posts: 331/567
EXP: 299656
For next: 8454

Since: 06-27-04
From: Cordova, TN, USA

Since last post: 14 hours
Last activity: 6 hours
Posted on 07-26-05 12:52 AM Link | Quote
Originally posted by HyperHacker
Actually, most games I've seen use 00 instead of FF.


Well, if you see any clusters like that, you know what to do.
NetSplit

Koopa
Level: 19

Posts: 71/117
EXP: 30378
For next: 5399

Since: 04-05-04

Since last post: 1 day
Last activity: 1 hour
Posted on 07-26-05 02:44 AM Link | Quote
I don't know if Metroid is a good bet for expanding an NES ROM for the purposes of level data and whatnot. The game uses individual banks for each of the 5 areas and has a lot of identical code in each one (for example, if you want to make it so that doors don't close after you open them in order to avoid the wall jump / secret world stuff, you have to change the same routine in all 5 banks). If you can't fit new rooms and objects into any of those banks as it is, then you could potentially have some difficulty setting the game up to use extra banks for its level data simply because of the odd way the game is currently set up.

But anyway, good look on that.
DukeNukem007

Shyguy
Level: 13

Posts: 30/90
EXP: 9247
For next: 1020

Since: 07-08-05
From: Quahog, RI

Since last post: 18 days
Last activity: 12 hours
Posted on 07-26-05 04:16 AM Link | Quote
Originally posted by Disch

As was already mentioned... most mappers need to have a power-of-2 PRG/CHR size. So if a game has 256k PRG and you want to expand it... you'll have to bump it up to at LEAST 512k of PRG -- even if you only want a few extra bytes (there are exceptions to this rule, some rare mappers can have abstract PRG/CHR sizes).

Also beware of mapper limitations. Not only do PRG/CHR sizes have a limit, but some mappers also lack on board cartridge RAM (no ram @ $6000-$7FFF), and some mappers have bus conflicts, so the value you write to the mapper register must match the value read from that address.


My copy of Super C has 128k PRG/120k CHR and I used to have a copy of Smash TV that was 128K PRG/104 or 112k CHR, although there might have been a "bad dump" involved. (hehe huhuh heheh...he said "bad dump.")
Dish

Spiny
Level: 38

Posts: 465/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 07-26-05 04:28 AM Link | Quote
120k is a very awkward size. It could be that it was 128k on the cart but the last 8k wasn't used so it got left out of the dump. Or it was 64k on the cart and it's a big overdump. I couldn't say.

I don't think SuperC uses any obscure mappers... so it would (or should might be a better word) be limited to the same power-of-2 size restrictions.

There are many... MANY improperly headered, dumped, and hacked ROMs floating around.
midget35

Paragoomba
Level: 13

Posts: 39/70
EXP: 8877
For next: 1390

Since: 03-17-05

Since last post: 3 days
Last activity: 14 hours
Posted on 07-26-05 03:28 PM Link | Quote
Thanks to all for taking the time to write such helpful, considered replies.

I can't tell you how surprised I am that ROM expansion is a real possibility these days- for so long it was discouraged in so many docs.

I think I'll have a look around in a hex editor for some spare FFs and 00s first (trying to run before I can walk otherwise).

Thanks again one and all.
DahrkDaiz

Red Super Koopa

Acmlm's Mosts 2005
Best ROM Hacker

Level: 45

Posts: 750/885
EXP: 643520
For next: 16644

Since: 03-15-04
From: K-Town

Since last post: 4 hours
Last activity: 4 hours
Posted on 07-26-05 07:44 PM Link | Quote
Originally posted by HyperHacker
Actually, most games I've seen use 00 instead of FF.


Actually, the way a PROM works is that there are fuses on a cartridge that are blown out. A non-blown fuse = a 1, a blown fuse = 0. So since we can't un-do a blown fuse it's sensible to leave unused bytes with all fuses intact, rather than blowing them all out, so if there's a byte in a PROM that's not used, all of it's fuses are left intact, thus, an unused bytes in a PROM are FF, not 00. An NES cartridge probably doesn't use fuses, but the concept is still the same. Chunks of FF = free data.

Anyways, expanding NES ROMs is rather easy but like Disch said, using that data is the hard part. I'll walk you guys through a quick run down of how I expanded SMB3 for Luigi vs Mario.

First, I found out that for the MMC3, the last 16K of PRG-ROM is "hard wired" into the ROM, meaning that this code will exist at all times and cannot be swapped out. MMC3 has options as to where to put this unswappable code and SMB3 chooses to put the first 8K at $8000-$9FFF and the last 8K at $E000-$FFFF. Thus, $A000-$DFFF will change through out the game.

So anyways, since the last 16K of space won't ever be changed out and it needs to STAY the last 16K, I realized you need to add your free space between the last 16K (which for SMB3 starts at 0x3C010) and the rest of the ROM, so I had to add the space between at 0x3C010, pushing the last 16K further down the road. Now, MMC3 requires that the PRG-ROM be at 128K, 256K or 512K. That's how the MMC3 works. So since PRG-ROM for SMB3 was already 256K, I extended it to 512K. So I inserted 256K of the byte 0xFF at 0x3C010.

Now, emulators need to know how much PRG-ROM there is. The iNES header format has the amount of 16K PRG-ROM banks numbered at the 4th byte. Let's do a byte of math. I now have 512K of PRG-ROM. Divide that up by 16: 512/16 = 32. So 32 in hex is 0x20. I enter 0x20 for the 4th byte to show there's 32 banks of 16K of PRG-ROM in this newly expanded ROM.

Tah-dah! The ROM has now been expanded. Now how do I use this newly found ROM area? What I wanted to do with Luigi vs Mario was to have seperate paths for each character, and since the game divides up each level "type" (Plains, Hills, Sky, Underground, etc) into it's own seperate 16K bank, I could do that easily. I copied over all the level data to the new expanded area (0x1e010-0x30010). Then, I made an ASM hack. When the game switches banks to load level data from the proper bank area, I did a small check. If the game is being played by Mario, I jumped to a new routine that loaded a different bank number for Mario. The bank number it loaded would be in the area of the newly expanded ROM area. Then, I made a small program that would copy the normal level data of one rom over to the new level data in the expanded area of another rom. I made a copy of my hack, a Luigi side and a Mario side. When I edit the ROM for the Mario side, I just run the program once and it copies over the Mario side into the new level data area of the main rom. Then when I play the main hack rom and am Mario, my routine will switch in a different bank and with the same pointers, I get two different levels with each character.

This just goes to show the amount of work needed to pull off ROM expansion. It takes a lot of patience, but it's not THAT hard. I made a lot of mistakes and errors before I got SMB3 expanded and working like this, but I kept at it and within 2 hours, I had it all done.
beneficii

Lakitu
Level: 36

Posts: 338/567
EXP: 299656
For next: 8454

Since: 06-27-04
From: Cordova, TN, USA

Since last post: 14 hours
Last activity: 6 hours
Posted on 07-26-05 08:27 PM Link | Quote
Originally posted by DahrkDaiz
Originally posted by HyperHacker
Actually, most games I've seen use 00 instead of FF.


Actually, the way a PROM works is that there are fuses on a cartridge that are blown out. A non-blown fuse = a 1, a blown fuse = 0. So since we can't un-do a blown fuse it's sensible to leave unused bytes with all fuses intact, rather than blowing them all out, so if there's a byte in a PROM that's not used, all of it's fuses are left intact, thus, an unused bytes in a PROM are FF, not 00. An NES cartridge probably doesn't use fuses, but the concept is still the same. Chunks of FF = free data.

Anyways, expanding NES ROMs is rather easy but like Disch said, using that data is the hard part. I'll walk you guys through a quick run down of how I expanded SMB3 for Luigi vs Mario.

First, I found out that for the MMC3, the last 16K of PRG-ROM is "hard wired" into the ROM, meaning that this code will exist at all times and cannot be swapped out. MMC3 has options as to where to put this unswappable code and SMB3 chooses to put the first 8K at $8000-$9FFF and the last 8K at $E000-$FFFF. Thus, $A000-$DFFF will change through out the game.

So anyways, since the last 16K of space won't ever be changed out and it needs to STAY the last 16K, I realized you need to add your free space between the last 16K (which for SMB3 starts at 0x3C010) and the rest of the ROM, so I had to add the space between at 0x3C010, pushing the last 16K further down the road. Now, MMC3 requires that the PRG-ROM be at 128K, 256K or 512K. That's how the MMC3 works. So since PRG-ROM for SMB3 was already 256K, I extended it to 512K. So I inserted 256K of the byte 0xFF at 0x3C010.

Now, emulators need to know how much PRG-ROM there is. The iNES header format has the amount of 16K PRG-ROM banks numbered at the 4th byte. Let's do a byte of math. I now have 512K of PRG-ROM. Divide that up by 16: 512/16 = 32. So 32 in hex is 0x20. I enter 0x20 for the 4th byte to show there's 32 banks of 16K of PRG-ROM in this newly expanded ROM.

Tah-dah! The ROM has now been expanded. Now how do I use this newly found ROM area? What I wanted to do with Luigi vs Mario was to have seperate paths for each character, and since the game divides up each level "type" (Plains, Hills, Sky, Underground, etc) into it's own seperate 16K bank, I could do that easily. I copied over all the level data to the new expanded area (0x1e010-0x30010). Then, I made an ASM hack. When the game switches banks to load level data from the proper bank area, I did a small check. If the game is being played by Mario, I jumped to a new routine that loaded a different bank number for Mario. The bank number it loaded would be in the area of the newly expanded ROM area. Then, I made a small program that would copy the normal level data of one rom over to the new level data in the expanded area of another rom. I made a copy of my hack, a Luigi side and a Mario side. When I edit the ROM for the Mario side, I just run the program once and it copies over the Mario side into the new level data area of the main rom. Then when I play the main hack rom and am Mario, my routine will switch in a different bank and with the same pointers, I get two different levels with each character.

This just goes to show the amount of work needed to pull off ROM expansion. It takes a lot of patience, but it's not THAT hard. I made a lot of mistakes and errors before I got SMB3 expanded and working like this, but I kept at it and within 2 hours, I had it all done.


Ah, you did just as I predicted above.

Anyway, I've been thinking of simply making a much longer game (which would require the same expanion), but I should probably make the SAVERAM battery-backed in that case; since the game keeps writing over the whole SAVERAM, that would be somewhat difficult. I still think it's possible though.

Anyway, good job.
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Rom Hacking - Extending NES roms- no flaming please! | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.019 seconds.