From ee33a7bfafe559bb273d26aa3f149f93deb1e151 Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Wed, 24 Apr 2013 21:49:57 +0000 Subject: [PATCH] (MESS) NES: hopefully fixed a crash occurring at exit when PRG is not a multiple of 16KB. Also promoted to working state two other SMB clones running on the same pcb as SMB Malee 2 (whose support was added a few days ago). nw. --- hash/nes.xml | 76 ++++++++++++++++++++----------------- src/mess/machine/nes_slot.c | 9 +++++ 2 files changed, 51 insertions(+), 34 deletions(-) diff --git a/hash/nes.xml b/hash/nes.xml index b1e3e068473..f6b3669b4c3 100644 --- a/hash/nes.xml +++ b/hash/nes.xml @@ -60832,40 +60832,6 @@ We don't include these hacks because they were not burned into real carts nor so - - Tin Choi Ma Lei (Chi) - 19?? - <unknown> - - - - - - - - - - - - - - - Tin Choi Ma Lei (Chi, Alt) - 19?? - JMH MTV Corp? - - - - - - - - - - - - - Tiny Toon Adventures 6 (Asia) 19?? @@ -63403,6 +63369,48 @@ Also notice that VRAM & WRAM are probably incorrect for some of these sets, at t + + Tin Choi Ma Lei (Chi) + 19?? + <unknown> + + + + + + + + + + + + + + + + + + + Genius Merio Bros. (Chi) + 19?? + JMH MTV Corp? + + + + + + + + + + + + + + + + + Super Mario Bros. 2 (FDS conversion) 19?? diff --git a/src/mess/machine/nes_slot.c b/src/mess/machine/nes_slot.c index 99fcf8d7cd8..583b5cefa8e 100644 --- a/src/mess/machine/nes_slot.c +++ b/src/mess/machine/nes_slot.c @@ -118,6 +118,15 @@ void device_nes_cart_interface::prg_alloc(running_machine &machine, size_t size) m_prg = auto_alloc_array_clear(machine, UINT8, size); m_prg_size = size; m_prg_chunks = size / 0x4000; + if (size % 0x4000) + { + // A few pirate carts have PRG made of 32K + 2K or some weird similar config + // in this case we treat the banking as if this 'extra' PRG is not present and + // the pcb code has to handle it by accessing directly m_prg! + printf("Warning! The loaded PRG has size not a multiple of 16KB (0x%X)\n", (UINT32)size); + m_prg_chunks--; + } + m_prg_mask = ((m_prg_chunks << 1) - 1); // printf("first mask %x!\n", m_prg_mask);