Hello all!
I've been working on my emulator, and am about to start adding memory mappers. So I've been trying to think of the best way to create a somewhat generic set of methods to accomplish CHR/PRG bank switching. Admittedly, I am something of a novice when it comes to bank switching, so go easy on me!
Something like the following will be used in my mapper base class:
Now, the parts I'm unsure of are the following:
1. What parameters will be needed for those methods. (I know I need to specify what size bank I am attempting to switch, but other than that..)
2. If I should have some sort of method that will allow you to modify the values passed to the mapper by the currently running game. (I don't want to do this in the calls to the Switch methods, and have ugly looking code!)
It would be ideal in my opinion to have some sort of pointer array, to keep track of which bank is holding which page of PRG/CHR rom:
But I am unsure, so I'm asking; What do you guys think is the best way to implement what I want?
If I have been unclear, let me know and I will try to correct that!
I've been working on my emulator, and am about to start adding memory mappers. So I've been trying to think of the best way to create a somewhat generic set of methods to accomplish CHR/PRG bank switching. Admittedly, I am something of a novice when it comes to bank switching, so go easy on me!
Something like the following will be used in my mapper base class:
Code:
public:
virtual void SwitchChr() = 0;
virtual void SwitchPrg() = 0;
virtual void SwitchChr() = 0;
virtual void SwitchPrg() = 0;
Now, the parts I'm unsure of are the following:
1. What parameters will be needed for those methods. (I know I need to specify what size bank I am attempting to switch, but other than that..)
2. If I should have some sort of method that will allow you to modify the values passed to the mapper by the currently running game. (I don't want to do this in the calls to the Switch methods, and have ugly looking code!)
It would be ideal in my opinion to have some sort of pointer array, to keep track of which bank is holding which page of PRG/CHR rom:
Code:
BYTE* prgBank[8];
BYTE* chrBank[8];
BYTE* chrBank[8];
But I am unsure, so I'm asking; What do you guys think is the best way to implement what I want?
If I have been unclear, let me know and I will try to correct that!