Hello.
I'm starting out in NES emulation, and have quite a few (probably stupid) questions.
I've read a lot of documentation, and have a working CPU core and ROM loader, but mappers are confusing me.
I've read some posts about keeping pointers for PRG "pages", but I don't think I really know what I'm doing!
For the minute, I'm only catering for NROM carts, but I'd like to make my code easily "upgradeable" to handle other mappers too. Would this be right for an NROM cart, assuming prg_rom is loaded with the cart's ROM data (as per the iNES header)?
... or am I completely messing that up?
Thanks for any help/suggestions.
I'm starting out in NES emulation, and have quite a few (probably stupid) questions.
I've read a lot of documentation, and have a working CPU core and ROM loader, but mappers are confusing me.
I've read some posts about keeping pointers for PRG "pages", but I don't think I really know what I'm doing!
For the minute, I'm only catering for NROM carts, but I'd like to make my code easily "upgradeable" to handle other mappers too. Would this be right for an NROM cart, assuming prg_rom is loaded with the cart's ROM data (as per the iNES header)?
Code:
byte *prg_rom;
byte *prg_page[10]; // 4k pages from $6000
...
void nrom_init()
{
int count, num;
for(count = 0, num = 0; count <= 0x10000; count += 0x1000, num++)
prg_page[num] = &prg_rom[count];
if(prg_pages == 1)
{
prg_page[2] = prg_rom; // $8000
prg_page[6] = prg_rom; // $C000
}
}
byte *prg_page[10]; // 4k pages from $6000
...
void nrom_init()
{
int count, num;
for(count = 0, num = 0; count <= 0x10000; count += 0x1000, num++)
prg_page[num] = &prg_rom[count];
if(prg_pages == 1)
{
prg_page[2] = prg_rom; // $8000
prg_page[6] = prg_rom; // $C000
}
}
... or am I completely messing that up?
Thanks for any help/suggestions.