bsnes/bsnes/snes/chip/necdsp/necdsp.cpp

53 lines
1.3 KiB
C++
Raw Normal View History

#include <snes/snes.hpp>
Update to v072r09 release. Unfortunately, I missed the v072r08 release; it was taken down before I saw the announcement. byuu says (about v072r08): This WIP adds NEC uPD77C25 emulation. Unfortunately it's not at all functional yet, there are way too many things I don't understand about the chip. I'm absolutely going to need help to complete this. [...] For now, you need the included PCB XML to manually map the program/data ROM in, which are included with the archive. You'll have to rewrite the map yourself to run other DSP-1 games, unless they have the same layout as Mario Kart. I am using the US [!] version, name it mariokart.sfc and put all the archive files and the ROM together. From here, bsnes will load up the ROMs, and start executing instructions. Since the emulation is so incomplete, it just deadlocks on the "Nintendo" logo as if there were no DSP on the cart at all, but if you enable tracing, you'll see it actually starts doing a lot of stuff before getting stuck in a really long and confusing loop. [Note: the DSP-1B program and data ROMs are not included in this commit. The PCB XML file mentioned above looks like this: <?xml version='1.0' encoding='UTF-8'?> <cartridge region='NTSC'> <rom> <map mode='shadow' address='00-3f:8000-ffff'/> <map mode='linear' address='40-7f:0000-ffff'/> <map mode='shadow' address='80-bf:8000-ffff'/> <map mode='linear' address='c0-ff:0000-ffff'/> </rom> <ram size='800'> <map mode='linear' address='20-3f:6000-7fff'/> <map mode='linear' address='a0-bf:6000-7fff'/> <map mode='linear' address='70-7f:0000-ffff'/> </ram> <upd77c25 program="dsp1b-program.bin" data="dsp1b-data.bin"> <dr> <map address='00-1f:6000-6fff'/> <map address='80-9f:6000-6fff'/> </dr> <sr> <map address='00-1f:7000-7fff'/> <map address='80-9f:7000-7fff'/> </sr> </upd77c25> </cartridge> Save it as 'mariokart.xml'] byuu says (about v072r09): Fixes OP/LD RQM=1 on DR modify, Mario Kart can get in-game, but the track is completely corrupted. Reorders order of operations for OP, in an attempt to mimic parallelism. Added support for OP KLM DST. Added S1 flag setting, probably not correct.
2010-12-17 10:54:28 +00:00
#define NECDSP_CPP
Update to v072r09 release. Unfortunately, I missed the v072r08 release; it was taken down before I saw the announcement. byuu says (about v072r08): This WIP adds NEC uPD77C25 emulation. Unfortunately it's not at all functional yet, there are way too many things I don't understand about the chip. I'm absolutely going to need help to complete this. [...] For now, you need the included PCB XML to manually map the program/data ROM in, which are included with the archive. You'll have to rewrite the map yourself to run other DSP-1 games, unless they have the same layout as Mario Kart. I am using the US [!] version, name it mariokart.sfc and put all the archive files and the ROM together. From here, bsnes will load up the ROMs, and start executing instructions. Since the emulation is so incomplete, it just deadlocks on the "Nintendo" logo as if there were no DSP on the cart at all, but if you enable tracing, you'll see it actually starts doing a lot of stuff before getting stuck in a really long and confusing loop. [Note: the DSP-1B program and data ROMs are not included in this commit. The PCB XML file mentioned above looks like this: <?xml version='1.0' encoding='UTF-8'?> <cartridge region='NTSC'> <rom> <map mode='shadow' address='00-3f:8000-ffff'/> <map mode='linear' address='40-7f:0000-ffff'/> <map mode='shadow' address='80-bf:8000-ffff'/> <map mode='linear' address='c0-ff:0000-ffff'/> </rom> <ram size='800'> <map mode='linear' address='20-3f:6000-7fff'/> <map mode='linear' address='a0-bf:6000-7fff'/> <map mode='linear' address='70-7f:0000-ffff'/> </ram> <upd77c25 program="dsp1b-program.bin" data="dsp1b-data.bin"> <dr> <map address='00-1f:6000-6fff'/> <map address='80-9f:6000-6fff'/> </dr> <sr> <map address='00-1f:7000-7fff'/> <map address='80-9f:7000-7fff'/> </sr> </upd77c25> </cartridge> Save it as 'mariokart.xml'] byuu says (about v072r09): Fixes OP/LD RQM=1 on DR modify, Mario Kart can get in-game, but the track is completely corrupted. Reorders order of operations for OP, in an attempt to mimic parallelism. Added support for OP KLM DST. Added S1 flag setting, probably not correct.
2010-12-17 10:54:28 +00:00
namespace SNES {
#include "serialization.cpp"
NECDSP necdsp;
Update to v072r09 release. Unfortunately, I missed the v072r08 release; it was taken down before I saw the announcement. byuu says (about v072r08): This WIP adds NEC uPD77C25 emulation. Unfortunately it's not at all functional yet, there are way too many things I don't understand about the chip. I'm absolutely going to need help to complete this. [...] For now, you need the included PCB XML to manually map the program/data ROM in, which are included with the archive. You'll have to rewrite the map yourself to run other DSP-1 games, unless they have the same layout as Mario Kart. I am using the US [!] version, name it mariokart.sfc and put all the archive files and the ROM together. From here, bsnes will load up the ROMs, and start executing instructions. Since the emulation is so incomplete, it just deadlocks on the "Nintendo" logo as if there were no DSP on the cart at all, but if you enable tracing, you'll see it actually starts doing a lot of stuff before getting stuck in a really long and confusing loop. [Note: the DSP-1B program and data ROMs are not included in this commit. The PCB XML file mentioned above looks like this: <?xml version='1.0' encoding='UTF-8'?> <cartridge region='NTSC'> <rom> <map mode='shadow' address='00-3f:8000-ffff'/> <map mode='linear' address='40-7f:0000-ffff'/> <map mode='shadow' address='80-bf:8000-ffff'/> <map mode='linear' address='c0-ff:0000-ffff'/> </rom> <ram size='800'> <map mode='linear' address='20-3f:6000-7fff'/> <map mode='linear' address='a0-bf:6000-7fff'/> <map mode='linear' address='70-7f:0000-ffff'/> </ram> <upd77c25 program="dsp1b-program.bin" data="dsp1b-data.bin"> <dr> <map address='00-1f:6000-6fff'/> <map address='80-9f:6000-6fff'/> </dr> <sr> <map address='00-1f:7000-7fff'/> <map address='80-9f:7000-7fff'/> </sr> </upd77c25> </cartridge> Save it as 'mariokart.xml'] byuu says (about v072r09): Fixes OP/LD RQM=1 on DR modify, Mario Kart can get in-game, but the track is completely corrupted. Reorders order of operations for OP, in an attempt to mimic parallelism. Added support for OP KLM DST. Added S1 flag setting, probably not correct.
2010-12-17 10:54:28 +00:00
void NECDSP::Enter() { necdsp.enter(); }
void NECDSP::enter() {
while(true) {
if(scheduler.sync == Scheduler::SynchronizeMode::All) {
scheduler.exit(Scheduler::ExitReason::SynchronizeEvent);
}
exec();
step(1);
synchronize_cpu();
}
}
uint8 NECDSP::sr_read(unsigned) { cpu.synchronize_coprocessors(); return uPD96050::sr_read(); }
void NECDSP::sr_write(unsigned, uint8 data) { cpu.synchronize_coprocessors(); return uPD96050::sr_write(data); }
Update to v072r09 release. Unfortunately, I missed the v072r08 release; it was taken down before I saw the announcement. byuu says (about v072r08): This WIP adds NEC uPD77C25 emulation. Unfortunately it's not at all functional yet, there are way too many things I don't understand about the chip. I'm absolutely going to need help to complete this. [...] For now, you need the included PCB XML to manually map the program/data ROM in, which are included with the archive. You'll have to rewrite the map yourself to run other DSP-1 games, unless they have the same layout as Mario Kart. I am using the US [!] version, name it mariokart.sfc and put all the archive files and the ROM together. From here, bsnes will load up the ROMs, and start executing instructions. Since the emulation is so incomplete, it just deadlocks on the "Nintendo" logo as if there were no DSP on the cart at all, but if you enable tracing, you'll see it actually starts doing a lot of stuff before getting stuck in a really long and confusing loop. [Note: the DSP-1B program and data ROMs are not included in this commit. The PCB XML file mentioned above looks like this: <?xml version='1.0' encoding='UTF-8'?> <cartridge region='NTSC'> <rom> <map mode='shadow' address='00-3f:8000-ffff'/> <map mode='linear' address='40-7f:0000-ffff'/> <map mode='shadow' address='80-bf:8000-ffff'/> <map mode='linear' address='c0-ff:0000-ffff'/> </rom> <ram size='800'> <map mode='linear' address='20-3f:6000-7fff'/> <map mode='linear' address='a0-bf:6000-7fff'/> <map mode='linear' address='70-7f:0000-ffff'/> </ram> <upd77c25 program="dsp1b-program.bin" data="dsp1b-data.bin"> <dr> <map address='00-1f:6000-6fff'/> <map address='80-9f:6000-6fff'/> </dr> <sr> <map address='00-1f:7000-7fff'/> <map address='80-9f:7000-7fff'/> </sr> </upd77c25> </cartridge> Save it as 'mariokart.xml'] byuu says (about v072r09): Fixes OP/LD RQM=1 on DR modify, Mario Kart can get in-game, but the track is completely corrupted. Reorders order of operations for OP, in an attempt to mimic parallelism. Added support for OP KLM DST. Added S1 flag setting, probably not correct.
2010-12-17 10:54:28 +00:00
uint8 NECDSP::dr_read(unsigned) { cpu.synchronize_coprocessors(); return uPD96050::dr_read(); }
void NECDSP::dr_write(unsigned, uint8 data) { cpu.synchronize_coprocessors(); return uPD96050::dr_write(data); }
Update to v072r09 release. Unfortunately, I missed the v072r08 release; it was taken down before I saw the announcement. byuu says (about v072r08): This WIP adds NEC uPD77C25 emulation. Unfortunately it's not at all functional yet, there are way too many things I don't understand about the chip. I'm absolutely going to need help to complete this. [...] For now, you need the included PCB XML to manually map the program/data ROM in, which are included with the archive. You'll have to rewrite the map yourself to run other DSP-1 games, unless they have the same layout as Mario Kart. I am using the US [!] version, name it mariokart.sfc and put all the archive files and the ROM together. From here, bsnes will load up the ROMs, and start executing instructions. Since the emulation is so incomplete, it just deadlocks on the "Nintendo" logo as if there were no DSP on the cart at all, but if you enable tracing, you'll see it actually starts doing a lot of stuff before getting stuck in a really long and confusing loop. [Note: the DSP-1B program and data ROMs are not included in this commit. The PCB XML file mentioned above looks like this: <?xml version='1.0' encoding='UTF-8'?> <cartridge region='NTSC'> <rom> <map mode='shadow' address='00-3f:8000-ffff'/> <map mode='linear' address='40-7f:0000-ffff'/> <map mode='shadow' address='80-bf:8000-ffff'/> <map mode='linear' address='c0-ff:0000-ffff'/> </rom> <ram size='800'> <map mode='linear' address='20-3f:6000-7fff'/> <map mode='linear' address='a0-bf:6000-7fff'/> <map mode='linear' address='70-7f:0000-ffff'/> </ram> <upd77c25 program="dsp1b-program.bin" data="dsp1b-data.bin"> <dr> <map address='00-1f:6000-6fff'/> <map address='80-9f:6000-6fff'/> </dr> <sr> <map address='00-1f:7000-7fff'/> <map address='80-9f:7000-7fff'/> </sr> </upd77c25> </cartridge> Save it as 'mariokart.xml'] byuu says (about v072r09): Fixes OP/LD RQM=1 on DR modify, Mario Kart can get in-game, but the track is completely corrupted. Reorders order of operations for OP, in an attempt to mimic parallelism. Added support for OP KLM DST. Added S1 flag setting, probably not correct.
2010-12-17 10:54:28 +00:00
uint8 NECDSP::dp_read(unsigned addr) { cpu.synchronize_coprocessors(); return uPD96050::dp_read(addr); }
void NECDSP::dp_write(unsigned addr, uint8 data) { cpu.synchronize_coprocessors(); return uPD96050::dp_write(addr, data); }
Update to v072r09 release. Unfortunately, I missed the v072r08 release; it was taken down before I saw the announcement. byuu says (about v072r08): This WIP adds NEC uPD77C25 emulation. Unfortunately it's not at all functional yet, there are way too many things I don't understand about the chip. I'm absolutely going to need help to complete this. [...] For now, you need the included PCB XML to manually map the program/data ROM in, which are included with the archive. You'll have to rewrite the map yourself to run other DSP-1 games, unless they have the same layout as Mario Kart. I am using the US [!] version, name it mariokart.sfc and put all the archive files and the ROM together. From here, bsnes will load up the ROMs, and start executing instructions. Since the emulation is so incomplete, it just deadlocks on the "Nintendo" logo as if there were no DSP on the cart at all, but if you enable tracing, you'll see it actually starts doing a lot of stuff before getting stuck in a really long and confusing loop. [Note: the DSP-1B program and data ROMs are not included in this commit. The PCB XML file mentioned above looks like this: <?xml version='1.0' encoding='UTF-8'?> <cartridge region='NTSC'> <rom> <map mode='shadow' address='00-3f:8000-ffff'/> <map mode='linear' address='40-7f:0000-ffff'/> <map mode='shadow' address='80-bf:8000-ffff'/> <map mode='linear' address='c0-ff:0000-ffff'/> </rom> <ram size='800'> <map mode='linear' address='20-3f:6000-7fff'/> <map mode='linear' address='a0-bf:6000-7fff'/> <map mode='linear' address='70-7f:0000-ffff'/> </ram> <upd77c25 program="dsp1b-program.bin" data="dsp1b-data.bin"> <dr> <map address='00-1f:6000-6fff'/> <map address='80-9f:6000-6fff'/> </dr> <sr> <map address='00-1f:7000-7fff'/> <map address='80-9f:7000-7fff'/> </sr> </upd77c25> </cartridge> Save it as 'mariokart.xml'] byuu says (about v072r09): Fixes OP/LD RQM=1 on DR modify, Mario Kart can get in-game, but the track is completely corrupted. Reorders order of operations for OP, in an attempt to mimic parallelism. Added support for OP KLM DST. Added S1 flag setting, probably not correct.
2010-12-17 10:54:28 +00:00
void NECDSP::init() {
Update to v072r09 release. Unfortunately, I missed the v072r08 release; it was taken down before I saw the announcement. byuu says (about v072r08): This WIP adds NEC uPD77C25 emulation. Unfortunately it's not at all functional yet, there are way too many things I don't understand about the chip. I'm absolutely going to need help to complete this. [...] For now, you need the included PCB XML to manually map the program/data ROM in, which are included with the archive. You'll have to rewrite the map yourself to run other DSP-1 games, unless they have the same layout as Mario Kart. I am using the US [!] version, name it mariokart.sfc and put all the archive files and the ROM together. From here, bsnes will load up the ROMs, and start executing instructions. Since the emulation is so incomplete, it just deadlocks on the "Nintendo" logo as if there were no DSP on the cart at all, but if you enable tracing, you'll see it actually starts doing a lot of stuff before getting stuck in a really long and confusing loop. [Note: the DSP-1B program and data ROMs are not included in this commit. The PCB XML file mentioned above looks like this: <?xml version='1.0' encoding='UTF-8'?> <cartridge region='NTSC'> <rom> <map mode='shadow' address='00-3f:8000-ffff'/> <map mode='linear' address='40-7f:0000-ffff'/> <map mode='shadow' address='80-bf:8000-ffff'/> <map mode='linear' address='c0-ff:0000-ffff'/> </rom> <ram size='800'> <map mode='linear' address='20-3f:6000-7fff'/> <map mode='linear' address='a0-bf:6000-7fff'/> <map mode='linear' address='70-7f:0000-ffff'/> </ram> <upd77c25 program="dsp1b-program.bin" data="dsp1b-data.bin"> <dr> <map address='00-1f:6000-6fff'/> <map address='80-9f:6000-6fff'/> </dr> <sr> <map address='00-1f:7000-7fff'/> <map address='80-9f:7000-7fff'/> </sr> </upd77c25> </cartridge> Save it as 'mariokart.xml'] byuu says (about v072r09): Fixes OP/LD RQM=1 on DR modify, Mario Kart can get in-game, but the track is completely corrupted. Reorders order of operations for OP, in an attempt to mimic parallelism. Added support for OP KLM DST. Added S1 flag setting, probably not correct.
2010-12-17 10:54:28 +00:00
}
Update to v075 release. byuu says: This release brings improved Super Game Boy emulation, the final SHA256 hashes for the DSP-(1,1B,2,3,4) and ST-(0010,0011) coprocessors, user interface improvements, and major internal code restructuring. Changelog (since v074): - completely rewrote memory sub-system to support 1-byte granularity in XML mapping - removed Memory inheritance and MMIO class completely, any address can be mapped to any function now - SuperFX: removed SuperFXBus : Bus, now implemented manually - SA-1: removed SA1Bus : Bus, now implemented manually - entire bus mapping is now static, happens once on cartridge load - as a result, read/write handlers now handle MMC mapping; slower average case, far faster worst case - namespace memory is no more, RAM arrays are stored inside the chips they are owned by now - GameBoy: improved CPU HALT emulation, fixes Zelda: Link's Awakening scrolling - GameBoy: added serial emulation (cannot connect to another GB yet), fixes Shin Megami Tensei - Devichil - GameBoy: improved LCD STAT emulation, fixes Sagaia - ui: added fullscreen support (F11 key), video settings allows for three scale settings - ui: fixed brightness, contrast, gamma, audio volume, input frequency values on program startup - ui: since Qt is dead, config file becomes bsnes.cfg once again - Super Game Boy: you can now load the BIOS without a game inserted to see a pretty white box - ui-gameboy: can be built without SNES components now - libsnes: now a UI target, compile with 'make ui=ui-libsnes' - libsnes: added WRAM, APURAM, VRAM, OAM, CGRAM access (cheat search, etc) - source: removed launcher/, as the Qt port is now gone - source: Makefile restructuring to better support new ui targets - source: lots of other internal code cleanup work
2011-01-27 08:52:34 +00:00
void NECDSP::load() {
Update to v074r10 release. byuu says: Major WIP, countless changes. I really went to town on cleaning up the source today with all kinds of new ideas. I'll post the ones I remember, use diff -ru to get the rest. What I like the most is my new within template: template<unsigned lo, unsigned hi> alwaysinline bool within(unsigned addr) { static const unsigned mask = ~(hi ^ lo); return (addr & mask) == lo; } Before, you would see code like this: if((addr & 0xe0e000) == 0x206000) { //$20-3f:6000-7fff The comment is basically necessary, and you have to trust that the mask is right, or do the math yourself. Now, it looks like this: if(within<0x20, 0x3f, 0x6000, 0x7fff>(addr)) { That's the same as within<0x206000, 0x3f7fff>, I just made an SNES-variant to more closely simulate my XML mapping style: 20-3f:6000-7fff. Now obviously this has limitations, it only works in base-2 and it can't manage some tricky edge cases like (addr & 0x408000) == 0x008000 for 00-3f|80-bf:8000-ffff. But for the most part, I'll be using this where I can. The Game Boy is fully ported over to it (via the MBCs), but the SNES only has the BS-X town cartridge moved over so far. SuperFX and SA-1 at the very least could benefit. Next up, since the memory map is now static, there's really no reason to remap the entire thing at power-on and reset. So it is now set up at cartridge load and that's it. I moved the CPU/PPU/WRAM mapping out of memory.cpp and into their respective processors. A bit of duplication only because there are multiple processor cores for the different profiles, but I'm not worried about that. This is also going to be necessary to fix the debugger. Next, Coprocessor::enable() actually does what I initially intended it to now: it is called once to turn a chip on after cartridge load. It's not called on power cycle anymore. This should help fix power-cycle on my serial simulation code, and was needed to map the bus exactly one time. Although most stuff is mapped through XML, some chips still need some manual hooks for monitoring and such (eg S-DD1.) Next, I've started killing off memory::, it was initially an over-reaction to the question of where to put APURAM (in the SMP or DSP?). The idea was to have this namespace that contained all memory for everything. But it was very annoying and tedious, and various chips ignored the convention anyway like ST-0011 RAM, which couldn't work anyway since it is natively uint16 and not uint8. Cx4 will need 24-bit RAM eventually, too. There's 8->24-bit functions in there now, because the HLE code is hideous. So far, all the cartridge.cpp memory:: types have been destroyed. memory::cartrom, memory::cartram become cartridge.rom and cartridge.ram. memory::cartrtc was moved into the SRTC and SPC7110 classes directly. memory::bsxflash was moved into BSXFlash. memory::bsxram and memory::bsxpram were moved into BSXCartridge (the town cartridge). memory::st[AB](rom|ram) were moved into a new area, snes/chip/sufamiturbo. The snes/chip moniker really doesn't work so well, since it also has base units, and the serial communications stuff which is through the controller port, but oh well, now it also has the base structure for the Sufami Turbo cartridge too. So now we have sufamiturbo.slotA.rom, sufamiturbo.slotB.ram, etc. Next, the ST-0010/ST-0011 actually save the data RAM to disk. This wasn't at all compatible with my old system, and I didn't want to keep adding memory types to check inside the main UI cartridge RAM loading and saving routines. So I built a NonVolatileRAM vector inside SNES::Cartridge, and any chip that has memory it wants to save and load from disk can append onto it : data, size, id ("srm", "rtc", "nec", etc) and slot (0 = cartridge, 1 = slot A, 2 = slot B) To load and save memory, we just do a simple: foreach(memory, SNES::cartridge.nvram) load/saveMemory(memory). As a result, you can now keep your save games in F1 Race of Champions II and Hayazashi Nidan Morita Shougi. Technically I think Metal Combat should work this way as well, having the RAM being part of the chip itself, but for now that chip just writes directly into cartridge.ram, so it also technically saves to disk for now. To avoid a potential conflict with a manipulated memory map, BS-X SRAM and PSRAM are now .bss and .bsp, and not .srm and .psr. Honestly I don't like .srm as an extension either, but it doesn't bother me enough to break save RAM compatibility with other emulators, so don't worry about that changing. I finally killed off MappedRAM initializing size to ~0 (-1U). A size of zero means there is no memory there just the same. This was an old holdover for handling MMIO mapping, if I recall correctly. Something about a size of zero on MMIO-Memory objects causing it to wrap the address, so ~0 would let it map direct addresses ... or something. Whatever, that's not needed at all anymore. BSXBase becomes BSXSatellaview, and I've defaulted the device to being attached since it won't affect non-BSX games anyway. Eventually the GUI needs to make that an option. BSXCart becomes BSXCartridge. BSXFlash remains unchanged. I probably need to make Coprocessor::disable() functions now to free up memory on unload, but it shouldn't hurt anything the way it is. libsnes is most definitely broken to all hell and back now, and the debugger is still shot. I suppose we'll need some tricky code to work with the old ID system, and we'll need to add some more IDs for the new memory types.
2011-01-24 08:59:45 +00:00
if(revision == Revision::uPD96050) {
cartridge.nvram.append({ "upd96050.ram", (uint8_t*)dataRAM, 4096 });
Update to v074r10 release. byuu says: Major WIP, countless changes. I really went to town on cleaning up the source today with all kinds of new ideas. I'll post the ones I remember, use diff -ru to get the rest. What I like the most is my new within template: template<unsigned lo, unsigned hi> alwaysinline bool within(unsigned addr) { static const unsigned mask = ~(hi ^ lo); return (addr & mask) == lo; } Before, you would see code like this: if((addr & 0xe0e000) == 0x206000) { //$20-3f:6000-7fff The comment is basically necessary, and you have to trust that the mask is right, or do the math yourself. Now, it looks like this: if(within<0x20, 0x3f, 0x6000, 0x7fff>(addr)) { That's the same as within<0x206000, 0x3f7fff>, I just made an SNES-variant to more closely simulate my XML mapping style: 20-3f:6000-7fff. Now obviously this has limitations, it only works in base-2 and it can't manage some tricky edge cases like (addr & 0x408000) == 0x008000 for 00-3f|80-bf:8000-ffff. But for the most part, I'll be using this where I can. The Game Boy is fully ported over to it (via the MBCs), but the SNES only has the BS-X town cartridge moved over so far. SuperFX and SA-1 at the very least could benefit. Next up, since the memory map is now static, there's really no reason to remap the entire thing at power-on and reset. So it is now set up at cartridge load and that's it. I moved the CPU/PPU/WRAM mapping out of memory.cpp and into their respective processors. A bit of duplication only because there are multiple processor cores for the different profiles, but I'm not worried about that. This is also going to be necessary to fix the debugger. Next, Coprocessor::enable() actually does what I initially intended it to now: it is called once to turn a chip on after cartridge load. It's not called on power cycle anymore. This should help fix power-cycle on my serial simulation code, and was needed to map the bus exactly one time. Although most stuff is mapped through XML, some chips still need some manual hooks for monitoring and such (eg S-DD1.) Next, I've started killing off memory::, it was initially an over-reaction to the question of where to put APURAM (in the SMP or DSP?). The idea was to have this namespace that contained all memory for everything. But it was very annoying and tedious, and various chips ignored the convention anyway like ST-0011 RAM, which couldn't work anyway since it is natively uint16 and not uint8. Cx4 will need 24-bit RAM eventually, too. There's 8->24-bit functions in there now, because the HLE code is hideous. So far, all the cartridge.cpp memory:: types have been destroyed. memory::cartrom, memory::cartram become cartridge.rom and cartridge.ram. memory::cartrtc was moved into the SRTC and SPC7110 classes directly. memory::bsxflash was moved into BSXFlash. memory::bsxram and memory::bsxpram were moved into BSXCartridge (the town cartridge). memory::st[AB](rom|ram) were moved into a new area, snes/chip/sufamiturbo. The snes/chip moniker really doesn't work so well, since it also has base units, and the serial communications stuff which is through the controller port, but oh well, now it also has the base structure for the Sufami Turbo cartridge too. So now we have sufamiturbo.slotA.rom, sufamiturbo.slotB.ram, etc. Next, the ST-0010/ST-0011 actually save the data RAM to disk. This wasn't at all compatible with my old system, and I didn't want to keep adding memory types to check inside the main UI cartridge RAM loading and saving routines. So I built a NonVolatileRAM vector inside SNES::Cartridge, and any chip that has memory it wants to save and load from disk can append onto it : data, size, id ("srm", "rtc", "nec", etc) and slot (0 = cartridge, 1 = slot A, 2 = slot B) To load and save memory, we just do a simple: foreach(memory, SNES::cartridge.nvram) load/saveMemory(memory). As a result, you can now keep your save games in F1 Race of Champions II and Hayazashi Nidan Morita Shougi. Technically I think Metal Combat should work this way as well, having the RAM being part of the chip itself, but for now that chip just writes directly into cartridge.ram, so it also technically saves to disk for now. To avoid a potential conflict with a manipulated memory map, BS-X SRAM and PSRAM are now .bss and .bsp, and not .srm and .psr. Honestly I don't like .srm as an extension either, but it doesn't bother me enough to break save RAM compatibility with other emulators, so don't worry about that changing. I finally killed off MappedRAM initializing size to ~0 (-1U). A size of zero means there is no memory there just the same. This was an old holdover for handling MMIO mapping, if I recall correctly. Something about a size of zero on MMIO-Memory objects causing it to wrap the address, so ~0 would let it map direct addresses ... or something. Whatever, that's not needed at all anymore. BSXBase becomes BSXSatellaview, and I've defaulted the device to being attached since it won't affect non-BSX games anyway. Eventually the GUI needs to make that an option. BSXCart becomes BSXCartridge. BSXFlash remains unchanged. I probably need to make Coprocessor::disable() functions now to free up memory on unload, but it shouldn't hurt anything the way it is. libsnes is most definitely broken to all hell and back now, and the debugger is still shot. I suppose we'll need some tricky code to work with the old ID system, and we'll need to add some more IDs for the new memory types.
2011-01-24 08:59:45 +00:00
}
Update to v072r09 release. Unfortunately, I missed the v072r08 release; it was taken down before I saw the announcement. byuu says (about v072r08): This WIP adds NEC uPD77C25 emulation. Unfortunately it's not at all functional yet, there are way too many things I don't understand about the chip. I'm absolutely going to need help to complete this. [...] For now, you need the included PCB XML to manually map the program/data ROM in, which are included with the archive. You'll have to rewrite the map yourself to run other DSP-1 games, unless they have the same layout as Mario Kart. I am using the US [!] version, name it mariokart.sfc and put all the archive files and the ROM together. From here, bsnes will load up the ROMs, and start executing instructions. Since the emulation is so incomplete, it just deadlocks on the "Nintendo" logo as if there were no DSP on the cart at all, but if you enable tracing, you'll see it actually starts doing a lot of stuff before getting stuck in a really long and confusing loop. [Note: the DSP-1B program and data ROMs are not included in this commit. The PCB XML file mentioned above looks like this: <?xml version='1.0' encoding='UTF-8'?> <cartridge region='NTSC'> <rom> <map mode='shadow' address='00-3f:8000-ffff'/> <map mode='linear' address='40-7f:0000-ffff'/> <map mode='shadow' address='80-bf:8000-ffff'/> <map mode='linear' address='c0-ff:0000-ffff'/> </rom> <ram size='800'> <map mode='linear' address='20-3f:6000-7fff'/> <map mode='linear' address='a0-bf:6000-7fff'/> <map mode='linear' address='70-7f:0000-ffff'/> </ram> <upd77c25 program="dsp1b-program.bin" data="dsp1b-data.bin"> <dr> <map address='00-1f:6000-6fff'/> <map address='80-9f:6000-6fff'/> </dr> <sr> <map address='00-1f:7000-7fff'/> <map address='80-9f:7000-7fff'/> </sr> </upd77c25> </cartridge> Save it as 'mariokart.xml'] byuu says (about v072r09): Fixes OP/LD RQM=1 on DR modify, Mario Kart can get in-game, but the track is completely corrupted. Reorders order of operations for OP, in an attempt to mimic parallelism. Added support for OP KLM DST. Added S1 flag setting, probably not correct.
2010-12-17 10:54:28 +00:00
}
Update to v075 release. byuu says: This release brings improved Super Game Boy emulation, the final SHA256 hashes for the DSP-(1,1B,2,3,4) and ST-(0010,0011) coprocessors, user interface improvements, and major internal code restructuring. Changelog (since v074): - completely rewrote memory sub-system to support 1-byte granularity in XML mapping - removed Memory inheritance and MMIO class completely, any address can be mapped to any function now - SuperFX: removed SuperFXBus : Bus, now implemented manually - SA-1: removed SA1Bus : Bus, now implemented manually - entire bus mapping is now static, happens once on cartridge load - as a result, read/write handlers now handle MMC mapping; slower average case, far faster worst case - namespace memory is no more, RAM arrays are stored inside the chips they are owned by now - GameBoy: improved CPU HALT emulation, fixes Zelda: Link's Awakening scrolling - GameBoy: added serial emulation (cannot connect to another GB yet), fixes Shin Megami Tensei - Devichil - GameBoy: improved LCD STAT emulation, fixes Sagaia - ui: added fullscreen support (F11 key), video settings allows for three scale settings - ui: fixed brightness, contrast, gamma, audio volume, input frequency values on program startup - ui: since Qt is dead, config file becomes bsnes.cfg once again - Super Game Boy: you can now load the BIOS without a game inserted to see a pretty white box - ui-gameboy: can be built without SNES components now - libsnes: now a UI target, compile with 'make ui=ui-libsnes' - libsnes: added WRAM, APURAM, VRAM, OAM, CGRAM access (cheat search, etc) - source: removed launcher/, as the Qt port is now gone - source: Makefile restructuring to better support new ui targets - source: lots of other internal code cleanup work
2011-01-27 08:52:34 +00:00
void NECDSP::unload() {
}
void NECDSP::power() {
}
Update to v072r09 release. Unfortunately, I missed the v072r08 release; it was taken down before I saw the announcement. byuu says (about v072r08): This WIP adds NEC uPD77C25 emulation. Unfortunately it's not at all functional yet, there are way too many things I don't understand about the chip. I'm absolutely going to need help to complete this. [...] For now, you need the included PCB XML to manually map the program/data ROM in, which are included with the archive. You'll have to rewrite the map yourself to run other DSP-1 games, unless they have the same layout as Mario Kart. I am using the US [!] version, name it mariokart.sfc and put all the archive files and the ROM together. From here, bsnes will load up the ROMs, and start executing instructions. Since the emulation is so incomplete, it just deadlocks on the "Nintendo" logo as if there were no DSP on the cart at all, but if you enable tracing, you'll see it actually starts doing a lot of stuff before getting stuck in a really long and confusing loop. [Note: the DSP-1B program and data ROMs are not included in this commit. The PCB XML file mentioned above looks like this: <?xml version='1.0' encoding='UTF-8'?> <cartridge region='NTSC'> <rom> <map mode='shadow' address='00-3f:8000-ffff'/> <map mode='linear' address='40-7f:0000-ffff'/> <map mode='shadow' address='80-bf:8000-ffff'/> <map mode='linear' address='c0-ff:0000-ffff'/> </rom> <ram size='800'> <map mode='linear' address='20-3f:6000-7fff'/> <map mode='linear' address='a0-bf:6000-7fff'/> <map mode='linear' address='70-7f:0000-ffff'/> </ram> <upd77c25 program="dsp1b-program.bin" data="dsp1b-data.bin"> <dr> <map address='00-1f:6000-6fff'/> <map address='80-9f:6000-6fff'/> </dr> <sr> <map address='00-1f:7000-7fff'/> <map address='80-9f:7000-7fff'/> </sr> </upd77c25> </cartridge> Save it as 'mariokart.xml'] byuu says (about v072r09): Fixes OP/LD RQM=1 on DR modify, Mario Kart can get in-game, but the track is completely corrupted. Reorders order of operations for OP, in an attempt to mimic parallelism. Added support for OP KLM DST. Added S1 flag setting, probably not correct.
2010-12-17 10:54:28 +00:00
void NECDSP::reset() {
create(NECDSP::Enter, frequency);
uPD96050::power();
Update to v072r09 release. Unfortunately, I missed the v072r08 release; it was taken down before I saw the announcement. byuu says (about v072r08): This WIP adds NEC uPD77C25 emulation. Unfortunately it's not at all functional yet, there are way too many things I don't understand about the chip. I'm absolutely going to need help to complete this. [...] For now, you need the included PCB XML to manually map the program/data ROM in, which are included with the archive. You'll have to rewrite the map yourself to run other DSP-1 games, unless they have the same layout as Mario Kart. I am using the US [!] version, name it mariokart.sfc and put all the archive files and the ROM together. From here, bsnes will load up the ROMs, and start executing instructions. Since the emulation is so incomplete, it just deadlocks on the "Nintendo" logo as if there were no DSP on the cart at all, but if you enable tracing, you'll see it actually starts doing a lot of stuff before getting stuck in a really long and confusing loop. [Note: the DSP-1B program and data ROMs are not included in this commit. The PCB XML file mentioned above looks like this: <?xml version='1.0' encoding='UTF-8'?> <cartridge region='NTSC'> <rom> <map mode='shadow' address='00-3f:8000-ffff'/> <map mode='linear' address='40-7f:0000-ffff'/> <map mode='shadow' address='80-bf:8000-ffff'/> <map mode='linear' address='c0-ff:0000-ffff'/> </rom> <ram size='800'> <map mode='linear' address='20-3f:6000-7fff'/> <map mode='linear' address='a0-bf:6000-7fff'/> <map mode='linear' address='70-7f:0000-ffff'/> </ram> <upd77c25 program="dsp1b-program.bin" data="dsp1b-data.bin"> <dr> <map address='00-1f:6000-6fff'/> <map address='80-9f:6000-6fff'/> </dr> <sr> <map address='00-1f:7000-7fff'/> <map address='80-9f:7000-7fff'/> </sr> </upd77c25> </cartridge> Save it as 'mariokart.xml'] byuu says (about v072r09): Fixes OP/LD RQM=1 on DR modify, Mario Kart can get in-game, but the track is completely corrupted. Reorders order of operations for OP, in an attempt to mimic parallelism. Added support for OP KLM DST. Added S1 flag setting, probably not correct.
2010-12-17 10:54:28 +00:00
}
}