Okay, I've been making small games, and they've all used MMC0, and they've all been like 25k games. But, now I'm trying to make larger games, and I need to know how to bankswitch! First of all, let me get this straight. When you bankswitch, you just jump into another PRG bank for more space in code, right? And you can just jump right in with no problems, correct? I've never used bank switching, and I'm confused. I know what it is though, so you don't have to explain that. Can you help me?
Basically, yeah you just jump in. But there's more to it, and it depends on what mapper you use.
Since the NES can only address 32kB of PRG-ROM, the banks overlap eachother. So you have to be aware of where the program is currently executing when you change banks. I normally do this either in some code around $FFxx (which on a mapper with 32kB pages I'd duplicate into each bank), or in RAM.
But as for NESASM, I don't know how to use bankswitching with it. All you need to do really is set the .org to $8000 on start of the next bank.
Also, if the mapper can swap the memory at $C000+, usually you need to duplicate the vectors and some startup code into each bank.
For larger games, I'd actually recommend looking into better assemblers than NESASM. NESASM reduces it to a one-step process (just assemble and poof you have a working .nes file), however as things get more complicated you're better off using an assembler which does things more conventionally (splitting the process into stages like assembling/linking).
I actually very much like ca65 for this kind of thing. Although getting used to its 'config file' setup is pretty weird...
I've been pretty bored today, so I'll see if I can't make you an example project to show you how to get ca65 working with mapper 4 (MMC3)
Will post later, hopefully
Disch wrote:
I actually very much like ca65 for this kind of thing. Although getting used to its 'config file' setup is pretty weird...
It's no worse than GNU Binutils (commonly packaged with GCC), which needs a "link script" that does the same thing. Just get a generic config file for your mapper and start coding.
I'm not even exactly sure how to make a simple hello world demo in like ca65, or WLA-DX. I can't even get them to frickin' compile. I don't want to have to read a 1000k document on how to frickin' use it, and then realize, Oh, I still don't even know anything about this assembler, as I did with WLA-DX. I'm not sure how to make a header in one of those. I'm sure it's just like .db $4E, $45, $53 then your header info like if it's battery packed, or what mapper it is etc. I've decided I'm just going to write an engine, then build an IDE around it so I can just incbin files that are like all game data, and the code will just do it's thing with those game data files. I am doing this for a very large project, and once I write the engine, it will actually be, you know, fun to make. I'm excited. It will be like your program Disch, FFHackster. But I need to learn more about Windows programming. Because I know alot of C, and well, not much C++, but the books I'm reading are for begginers, and they don't talk about Windows programming at all, it's all just 32 bit DOS box crap. By the way, did you absolutely NEED to use any C++ for FFHackster? Or could you have done it with just C? I don't know, this is a little off subject, but whatever.