summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/nes_ave.c
diff options
context:
space:
mode:
author Fabio Priuli <etabeta78@users.noreply.github.com>2013-04-21 19:27:29 +0000
committer Fabio Priuli <etabeta78@users.noreply.github.com>2013-04-21 19:27:29 +0000
commitc1540080a1f2262a86b0cce00d734ac49bafbc92 (patch)
tree6cfbab2077f5eaebb01bea115746b9470752db49 /src/mess/machine/nes_ave.c
parent335b6f828a3821a0dc84f86d55e6415a20f4160d (diff)
(MESS) nes.c: major refactoring and improvements of NES/FC cart emulation: [Fabio Priuli]
- converted carts, mappers and pcbs to use slot devices - fixed starting of Famicom, Famicom Twin and Dr. PCJr - fixed handling of "no disk" in FDS so that the system displays Mario and Luigi jumping around as expected - added AY8910 sound to Sunsoft-5B (Gimmick JPN sfx) - added YM2413 to VRC-7 (Lagrange Point OST) - added support for recorded samples to Jaleco sport titles and to Bandai Family Trainer Aerobics Studio, thanks to notes by hap and egoh, and recordings by Pongbashi (samples are needed because these games use a currently undumpable speech chip) - added support for NES-EVENT pcb used by Nintendo World Championship 1990, including dipswitches - added support for Galoob Game Genie real usage (in addition to the codes which Puggsy added to his cheat collections): when you load ggenie, a second cartslot becomes available to load another game attached to the cheat device (e.g. with "mess.exe nes -cart ggenie -cart2 smb") and you can enter the cheat codes as in a real NES - added support for Nantettatte!! Baseball lock-on mechanism, based on the tests performed by naruko on his carts: when you load nantbb, a second cartslot becomes available to load one of the two update minicarts (91 Hen or OB Hen) - improved emulation of Namcot 163, 175 and 340 boards, based on the tests performed by naruko, lidnariq and bootgod on the real hardware - moved Nantettatte!! Baseball minicarts to a separate list (nes_ntbrom.xml) because they cannot be loaded in the NES directly, but only through the nantbb subslot - emulated bus conflict (CPU/PRG) in PCBs documented as having it - partial emulation of open bus, enough to make working the games using it as a sort of protection - fixed crash when loading files using FFE mappers - fixed mirroring in some boards (Sunsoft DCS and UNL-CC-21) and in some games (e.g. Paris Dakar Rally Special and Escape from Atlantis) - fixed a few bugs in Tengen 800032 emulation (mapper 64), promoting Klax, Xybots and Road Runner to work state - fixed Tengen 800037 emulation (mapper 158), promoting US Alien Syndrome to work state - added working emulation of many bootleg pcbs used for pirate conversions from FDS (Ai Senshi Nicol, Doki Doki Panic, Fuuun Shaolin Kyo, Green Beret, Monty no Doki Doki Daidassou, Tobidase Daisakusen, Super Mario Bros Malee 2 / Genius Merio Bros...) - improved emulation of many pirate pcb (BMC-GOLDENCARD-6IN1, KS7013B, KS7012, BMC-GHOSTBUSTERS63IN1, UNL-MALISB, MAXI15 and more...) - improved RacerMate Challenge II emulation, but the game is still not working due to unemulated bicycle controller - added CPU-based IRQ mode in Tengen 800032 emulation (mapper 64), fixing Skulls & Crossbones gfx (but the game is still not working) - fixed many small inaccuracies in the old code, spot during the conversion - added support for most other known pcbs, even if in most cases emulation is only sketchy - reduced the need of fake alt pbcs for boards which only differed by mirroring handling (these are now recognized through the "mirroring" feature) - removed fake wram which was added to a lot of partially documented pcbs and re-added it only where actually present, so to more accurately document what was really in the carts Out of whatsnew: There's still a lot to do (e.g. to clean up the implementation of the pirate pcbs) but I hope that submitting this now I can get some wider testing help so to catch and fix regressions before next release :)
Diffstat (limited to 'src/mess/machine/nes_ave.c')
-rw-r--r--src/mess/machine/nes_ave.c207
1 files changed, 207 insertions, 0 deletions
diff --git a/src/mess/machine/nes_ave.c b/src/mess/machine/nes_ave.c
new file mode 100644
index 00000000000..3dee1c0c06b
--- /dev/null
+++ b/src/mess/machine/nes_ave.c
@@ -0,0 +1,207 @@
+/***********************************************************************************************************
+
+
+ NES/Famicom cartridge emulation for AVE PCBs
+
+ Copyright MESS Team.
+ Visit http://mamedev.org for licensing and usage restrictions.
+
+
+ Here we emulate the following PCBs
+
+ * AVE Nina-001 [mapper 34]
+ * AVE Nina-006/Nina-003/MB-91 [mapper 79]
+ * AVE Maxi 15 [mapper 234]
+
+
+ ***********************************************************************************************************/
+
+
+#include "emu.h"
+#include "machine/nes_ave.h"
+
+
+#ifdef NES_PCB_DEBUG
+#define VERBOSE 1
+#else
+#define VERBOSE 0
+#endif
+
+#define LOG_MMC(x) do { if (VERBOSE) logerror x; } while (0)
+
+
+//-------------------------------------------------
+// constructor
+//-------------------------------------------------
+
+const device_type NES_NINA001 = &device_creator<nes_nina001_device>;
+const device_type NES_NINA006 = &device_creator<nes_nina006_device>;
+const device_type NES_MAXI15 = &device_creator<nes_maxi15_device>;
+
+
+nes_nina001_device::nes_nina001_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : nes_nrom_device(mconfig, NES_NINA001, "NES Cart AVE Nina-001 PCB", tag, owner, clock, "nes_nina001", __FILE__)
+{
+}
+
+nes_nina006_device::nes_nina006_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : nes_nrom_device(mconfig, NES_NINA006, "NES Cart AVE Nina-006 PCB", tag, owner, clock, "nes_nina006", __FILE__)
+{
+}
+
+nes_maxi15_device::nes_maxi15_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : nes_nrom_device(mconfig, NES_MAXI15, "NES Cart AVE Maxi 15 PCB", tag, owner, clock, "nes_maxi15", __FILE__)
+{
+}
+
+
+
+
+void nes_nina001_device::device_start()
+{
+ common_start();
+}
+
+void nes_nina001_device::pcb_reset()
+{
+ m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
+ prg32(0);
+ chr8(0, m_chr_source);
+}
+
+void nes_nina006_device::device_start()
+{
+ common_start();
+}
+
+void nes_nina006_device::pcb_reset()
+{
+ m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
+ prg32(0);
+ chr8(0, m_chr_source);
+ set_nt_mirroring(PPU_MIRROR_HORZ);
+}
+
+
+void nes_maxi15_device::device_start()
+{
+ common_start();
+ save_item(NAME(m_bank));
+ save_item(NAME(m_reg));
+}
+
+void nes_maxi15_device::pcb_reset()
+{
+ m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
+ prg32(0);
+ chr8(0, m_chr_source);
+ set_nt_mirroring(PPU_MIRROR_VERT);
+
+ m_reg = 0;
+ m_bank = 0;
+}
+
+
+
+
+
+/*-------------------------------------------------
+ mapper specific handlers
+ -------------------------------------------------*/
+
+/*-------------------------------------------------
+
+ AVE NINA-001 board emulation
+
+ iNES: mapper 34
+
+ -------------------------------------------------*/
+
+WRITE8_MEMBER(nes_nina001_device::write_m)
+{
+ LOG_MMC(("nina-001 write_m, offset: %04x, data: %02x\n", offset, data));
+
+ switch (offset)
+ {
+ case 0x1ffd:
+ prg32(data);
+ break;
+ case 0x1ffe:
+ chr4_0(data, CHRROM);
+ break;
+ case 0x1fff:
+ chr4_4(data, CHRROM);
+ break;
+ }
+}
+
+/*-------------------------------------------------
+
+ AVE NINA-003, NINA-006 and MB-91 boards emulation
+
+ Games: Krazy Kreatures, Poke Block, Puzzle, Pyramid,
+ Solitaire, Ultimate League Soccer
+
+ iNES: mapper 79
+
+ In MESS: Supported.
+
+ -------------------------------------------------*/
+
+WRITE8_MEMBER(nes_nina006_device::write_l)
+{
+ LOG_MMC(("nina-006 write_l, offset: %04x, data: %02x\n", offset, data));
+
+ if (!(offset & 0x0100))
+ {
+ prg32(data >> 3);
+ chr8(data, CHRROM);
+ }
+}
+
+/*-------------------------------------------------
+
+ AVE Maxi 15 boards emulation
+
+ Games: Maxi 15
+
+ iNES: mapper 234
+
+ In MESS: Partially Supported.
+
+ -------------------------------------------------*/
+
+void nes_maxi15_device::update_banks()
+{
+ if (m_bank & 0x40)
+ {
+ prg32((m_bank & 0x0e) | (m_reg & 1));
+ chr8(((m_bank & 0x0e) << 2) | ((m_reg >> 4) & 7), m_chr_source);
+ }
+ else
+ {
+ prg32(m_bank & 0x0f);
+ chr8(((m_bank & 0x0f) << 2) | ((m_reg >> 4) & 3), m_chr_source);
+ }
+}
+
+READ8_MEMBER(nes_maxi15_device::read_h)
+{
+ LOG_MMC(("Maxi 15 read_h, offset: %04x\n", offset));
+
+ if (offset >= 0x7f80 && offset < 0x7fa0)
+ {
+ m_bank = hi_access_rom(offset);
+ set_nt_mirroring(BIT(m_bank, 7) ? PPU_MIRROR_HORZ : PPU_MIRROR_VERT);
+ update_banks();
+ return m_bank;
+ }
+ if (offset >= 0x7fe8 && offset < 0x7ff8)
+ {
+ m_reg = hi_access_rom(offset);
+ update_banks();
+ return m_reg;
+ }
+
+ return hi_access_rom(offset);
+}