From c1540080a1f2262a86b0cce00d734ac49bafbc92 Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Sun, 21 Apr 2013 19:27:29 +0000 Subject: (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 :) --- src/mess/machine/nes_hes.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 src/mess/machine/nes_hes.c (limited to 'src/mess/machine/nes_hes.c') diff --git a/src/mess/machine/nes_hes.c b/src/mess/machine/nes_hes.c new file mode 100644 index 00000000000..c6eba7d51db --- /dev/null +++ b/src/mess/machine/nes_hes.c @@ -0,0 +1,88 @@ +/*********************************************************************************************************** + + + NES/Famicom cartridge emulation for HES PCBs + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + + + Here we emulate the HES PCBs (both the one with hardwired mirroring and the one with mapper-controlled + mirroring used by HES 6 in 1) [mapper 113] + + + ***********************************************************************************************************/ + + +#include "emu.h" +#include "machine/nes_hes.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_HES = &device_creator; + + +nes_hes_device::nes_hes_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : nes_nrom_device(mconfig, NES_HES, "NES Cart HES PCB", tag, owner, clock, "nes_hes", __FILE__) +{ +} + + +void nes_hes_device::device_start() +{ + common_start(); +} + +void nes_hes_device::pcb_reset() +{ + m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM; + prg32(0); + chr8(0, m_chr_source); +} + + + +/*------------------------------------------------- + mapper specific handlers + -------------------------------------------------*/ + +/*------------------------------------------------- + + Bootleg Board by HES (also used by others) + + Games: AV Hanafuda Club, AV Soccer, Papillon, Sidewinder, + Total Funpack + + Actually, two variant: one for HES 6-in-1 with mirroring control + and one for AV Soccer and others with hardwired mirroring + + iNES: mapper 113 + + In MESS: Supported. + + -------------------------------------------------*/ + +WRITE8_MEMBER(nes_hes_device::write_l) +{ + LOG_MMC(("hes write_l, offset: %04x, data: %02x\n", offset, data)); + + if (!(offset & 0x100)) + { + prg32((data & 0x38) >> 3); + chr8((data & 0x07) | ((data & 0x40) >> 3), CHRROM); + if (m_pcb_ctrl_mirror) + set_nt_mirroring(BIT(data, 7) ? PPU_MIRROR_VERT : PPU_MIRROR_HORZ); + } +} -- cgit v1.2.3-70-g09d2