summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nes/sachen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/nes/sachen.cpp')
-rw-r--r--src/devices/bus/nes/sachen.cpp238
1 files changed, 121 insertions, 117 deletions
diff --git a/src/devices/bus/nes/sachen.cpp b/src/devices/bus/nes/sachen.cpp
index 0622bfec8d4..69934c2b0cd 100644
--- a/src/devices/bus/nes/sachen.cpp
+++ b/src/devices/bus/nes/sachen.cpp
@@ -9,20 +9,18 @@
Here we emulate the following PCBs
* Sachen SA-009 [mapper 160]
- * Sachen SA-0036 [mapper 148]
- * Sachen SA-0037 [mapper 149]
+ * Sachen SA-0036 [mapper 149]
+ * Sachen SA-0037 [mapper 148]
* Sachen SA-72007 [mapper 145]
* Sachen SA-72008 [mapper 133]
* Sachen TCA-01 [mapper 143]
* Sachen TCU-01 [mapper 147]
* Sachen TCU-02 [mapper 136]
+ * Sachen 3013 [mapper 553]
+ * Sachen 3014 [mapper 533]
* Sachen Discrete PCBs [mapper 150 & 243]
* Sachen 8259 [mapper 141 (A), 138 (B), 139 (C), 137 (D)]
- Known issues on specific mappers:
-
- * 133 Qi Wang starts with corrupted graphics (ingame seems better)
-
***********************************************************************************************************/
@@ -30,14 +28,14 @@
#include "emu.h"
#include "sachen.h"
+#define LOG_HIFREQ (1U << 1)
#ifdef NES_PCB_DEBUG
-#define VERBOSE 1
+#define VERBOSE (LOG_GENERAL)
#else
-#define VERBOSE 0
+#define VERBOSE (0)
#endif
-
-#define LOG_MMC(x) do { if (VERBOSE) logerror x; } while (0)
+#include "logmacro.h"
//-------------------------------------------------
@@ -52,6 +50,8 @@ DEFINE_DEVICE_TYPE(NES_SACHEN_SA72008, nes_sachen_sa72008_device, "nes_sa7
DEFINE_DEVICE_TYPE(NES_SACHEN_TCA01, nes_sachen_tca01_device, "nes_tca01", "NES Cart Sachen TCA-01 PCB")
DEFINE_DEVICE_TYPE(NES_SACHEN_TCU01, nes_sachen_tcu01_device, "nes_tcu01", "NES Cart Sachen TCU-01 PCB")
DEFINE_DEVICE_TYPE(NES_SACHEN_TCU02, nes_sachen_tcu02_device, "nes_tcu02", "NES Cart Sachen TCU-02 PCB")
+DEFINE_DEVICE_TYPE(NES_SACHEN_3013, nes_sachen_3013_device, "nes_3013", "NES Cart Sachen 3013 PCB")
+DEFINE_DEVICE_TYPE(NES_SACHEN_3014, nes_sachen_3014_device, "nes_3014", "NES Cart Sachen 3014 PCB")
DEFINE_DEVICE_TYPE(NES_SACHEN_74X374, nes_sachen_74x374_device, "nes_s74x374", "NES Cart Sachen 74*374 PCB")
DEFINE_DEVICE_TYPE(NES_SACHEN_74X374_ALT, nes_sachen_74x374_alt_device, "nes_s74x374a", "NES Cart Sachen 74*374 Alt PCB")
DEFINE_DEVICE_TYPE(NES_SACHEN_8259A, nes_sachen_8259a_device, "nes_s8259a", "NES Cart Sachen 8259A PCB")
@@ -65,7 +65,7 @@ nes_sachen_sa009_device::nes_sachen_sa009_device(const machine_config &mconfig,
{
}
-nes_sachen_sa0036_device::nes_sachen_sa0036_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+nes_sachen_sa0036_device::nes_sachen_sa0036_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: nes_nrom_device(mconfig, NES_SACHEN_SA0036, tag, owner, clock)
{
}
@@ -100,6 +100,16 @@ nes_sachen_tcu02_device::nes_sachen_tcu02_device(const machine_config &mconfig,
{
}
+nes_sachen_3013_device::nes_sachen_3013_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : nes_nrom_device(mconfig, NES_SACHEN_3013, tag, owner, clock)
+{
+}
+
+nes_sachen_3014_device::nes_sachen_3014_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
+ : nes_nrom_device(mconfig, NES_SACHEN_3014, tag, owner, clock), m_latch(0)
+{
+}
+
nes_sachen_74x374_device::nes_sachen_74x374_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: nes_nrom_device(mconfig, type, tag, owner, clock), m_latch(0), m_mmc_vrom_bank(0)
{
@@ -143,102 +153,37 @@ nes_sachen_8259d_device::nes_sachen_8259d_device(const machine_config &mconfig,
-void nes_sachen_sa009_device::device_start()
-{
- common_start();
-}
-
-void nes_sachen_sa009_device::pcb_reset()
-{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
- prg32(0);
- chr8(0, m_chr_source);
-}
-
-void nes_sachen_sa0036_device::device_start()
-{
- common_start();
-}
-
-void nes_sachen_sa0036_device::pcb_reset()
-{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
- prg32(0);
- chr8(0, m_chr_source);
-}
-
-void nes_sachen_sa0037_device::device_start()
-{
- common_start();
-}
-
-void nes_sachen_sa0037_device::pcb_reset()
-{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
- prg32(0);
- chr8(0, m_chr_source);
-}
-
-void nes_sachen_sa72007_device::device_start()
-{
- common_start();
-}
-
-void nes_sachen_sa72007_device::pcb_reset()
-{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
- prg32(0);
- chr8(0, m_chr_source);
-}
-
-void nes_sachen_sa72008_device::device_start()
-{
- common_start();
-}
-
-void nes_sachen_sa72008_device::pcb_reset()
-{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
- prg32(0);
- chr8(0, m_chr_source);
-}
-
-void nes_sachen_tca01_device::device_start()
-{
- common_start();
-}
-
void nes_sachen_tca01_device::pcb_reset()
{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
prg16_89ab(0);
prg16_cdef(1);
chr8(0, m_chr_source);
}
-void nes_sachen_tcu01_device::device_start()
+void nes_sachen_tcu02_device::device_start()
{
common_start();
+ save_item(NAME(m_latch));
}
-void nes_sachen_tcu01_device::pcb_reset()
+void nes_sachen_tcu02_device::pcb_reset()
{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
prg32(0);
chr8(0, m_chr_source);
+
+ m_latch = 0;
}
-void nes_sachen_tcu02_device::device_start()
+void nes_sachen_3014_device::device_start()
{
common_start();
save_item(NAME(m_latch));
}
-void nes_sachen_tcu02_device::pcb_reset()
+void nes_sachen_3014_device::pcb_reset()
{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
prg32(0);
- chr8(0, m_chr_source);
+ chr8(0, CHRROM);
m_latch = 0;
}
@@ -252,7 +197,6 @@ void nes_sachen_74x374_device::device_start()
void nes_sachen_74x374_device::pcb_reset()
{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
prg32(0);
chr8(0, m_chr_source);
@@ -269,7 +213,6 @@ void nes_sachen_8259a_device::device_start()
void nes_sachen_8259a_device::pcb_reset()
{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
prg32(0);
chr8(0, m_chr_source);
set_nt_mirroring(PPU_MIRROR_VERT);
@@ -280,7 +223,6 @@ void nes_sachen_8259a_device::pcb_reset()
void nes_sachen_8259d_device::pcb_reset()
{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
prg32(0);
chr8(m_vrom_chunks - 1, CHRROM);
set_nt_mirroring(PPU_MIRROR_VERT);
@@ -304,13 +246,13 @@ void nes_sachen_8259d_device::pcb_reset()
iNES: mapper 160
- In MESS: Supported.
+ In MAME: Supported.
-------------------------------------------------*/
void nes_sachen_sa009_device::write_l(offs_t offset, uint8_t data)
{
- LOG_MMC(("SA009 write_l, offset: %04x, data: %02x\n", offset, data));
+ LOG("SA009 write_l, offset: %04x, data: %02x\n", offset, data);
chr8(data, m_chr_source);
}
@@ -323,13 +265,16 @@ void nes_sachen_sa009_device::write_l(offs_t offset, uint8_t data)
iNES: mapper 149
- In MESS: Supported.
+ In MAME: Supported.
-------------------------------------------------*/
-void nes_sachen_sa0036_device::write_h(offs_t offset, uint8_t data)
+void nes_sachen_sa0036_device::write_h(offs_t offset, u8 data)
{
- LOG_MMC(("sa0036 write_h, offset: %04x, data: %02x\n", offset, data));
+ LOG("sa0036 write_h, offset: %04x, data: %02x\n", offset, data);
+
+ // this pcb is subject to bus conflict
+ data = account_bus_conflict(offset, data);
chr8(data >> 7, CHRROM);
}
@@ -337,18 +282,19 @@ void nes_sachen_sa0036_device::write_h(offs_t offset, uint8_t data)
/*-------------------------------------------------
Sachen SA0037 bootleg boards
+ Tengen 800008 board
- Games: Mahjong World, Shisen Mahjong
+ Games: Mahjong World, Shisen Mahjong, Tengen Tetris
iNES: mapper 148
- In MESS: Supported.
+ In MAME: Supported.
-------------------------------------------------*/
-void nes_sachen_sa0037_device::write_h(offs_t offset, uint8_t data)
+void nes_sachen_sa0037_device::write_h(offs_t offset, u8 data)
{
- LOG_MMC(("sa0037 write_h, offset: %04x, data: %02x\n", offset, data));
+ LOG("sa0037 write_h, offset: %04x, data: %02x\n", offset, data);
// this pcb is subject to bus conflict
data = account_bus_conflict(offset, data);
@@ -365,13 +311,13 @@ void nes_sachen_sa0037_device::write_h(offs_t offset, uint8_t data)
iNES: mapper 145
- In MESS: Supported.
+ In MAME: Supported.
-------------------------------------------------*/
void nes_sachen_sa72007_device::write_l(offs_t offset, uint8_t data)
{
- LOG_MMC(("SA72007 write_l, offset: %04x, data: %02x\n", offset, data));
+ LOG("SA72007 write_l, offset: %04x, data: %02x\n", offset, data);
/* only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */
if (!(offset & 0x100))
@@ -386,13 +332,13 @@ void nes_sachen_sa72007_device::write_l(offs_t offset, uint8_t data)
iNES: mapper 133
- In MESS: Supported.
+ In MAME: Supported.
-------------------------------------------------*/
void nes_sachen_sa72008_device::write_l(offs_t offset, uint8_t data)
{
- LOG_MMC(("SA72008 write_l, offset: %04x, data: %02x\n", offset, data));
+ LOG("SA72008 write_l, offset: %04x, data: %02x\n", offset, data);
prg32(data >> 2);
chr8(data, CHRROM);
@@ -402,17 +348,17 @@ void nes_sachen_sa72008_device::write_l(offs_t offset, uint8_t data)
Sachen TCA-01 bootleg boards
- iNES: mapper 143
-
Games: Dancing Blocks, Magic Mathematic
- In MESS: Supported.
+ iNES: mapper 143
+
+ In MAME: Supported.
-------------------------------------------------*/
uint8_t nes_sachen_tca01_device::read_l(offs_t offset)
{
- LOG_MMC(("TCA-01 read_l, offset: %04x\n", offset));
+ LOG("TCA-01 read_l, offset: %04x\n", offset);
/* the address is read only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */
if (!(offset & 0x100))
@@ -429,17 +375,17 @@ uint8_t nes_sachen_tca01_device::read_l(offs_t offset)
iNES: mapper 147
- In MESS: Supported.
+ In MAME: Supported.
-------------------------------------------------*/
void nes_sachen_tcu01_device::write_l(offs_t offset, uint8_t data)
{
- LOG_MMC(("TCU-01 write_l, offset: %04x, data: %02x\n", offset, data));
+ LOG("TCU-01 write_l, offset: %04x, data: %02x\n", offset, data);
if ((offset & 0x103) == 0x002)
{
- prg32(((data >> 6) & 0x02) | ((data >> 2) & 0x01));
+ prg32(bitswap<2>(data, 7, 2));
chr8(data >> 3, CHRROM);
}
}
@@ -452,13 +398,13 @@ void nes_sachen_tcu01_device::write_l(offs_t offset, uint8_t data)
iNES: mapper 136
- In MESS: Supported.
+ In MAME: Supported.
-------------------------------------------------*/
void nes_sachen_tcu02_device::write_l(offs_t offset, uint8_t data)
{
- LOG_MMC(("TCU-02 write_l, offset: %04x, data: %02x\n", offset, data));
+ LOG("TCU-02 write_l, offset: %04x, data: %02x\n", offset, data);
if ((offset & 0x103) == 0x002)
{
@@ -469,7 +415,7 @@ void nes_sachen_tcu02_device::write_l(offs_t offset, uint8_t data)
uint8_t nes_sachen_tcu02_device::read_l(offs_t offset)
{
- LOG_MMC(("TCU-02 read_l, offset: %04x\n", offset));
+ LOG("TCU-02 read_l, offset: %04x\n", offset);
if ((offset & 0x103) == 0x000)
return m_latch | 0x40;
@@ -479,6 +425,65 @@ uint8_t nes_sachen_tcu02_device::read_l(offs_t offset)
/*-------------------------------------------------
+ Sachen 3013 board
+
+ Games: Dong Dong Nao 1
+
+ This discrete board basically behaves like standard
+ NROM-128 (mapper 0) but has circuitry so that the
+ lower half of PRG reads as a constant instead of as
+ a mirror of the upper half.
+
+ NES 2.0: mapper 553
+
+ In MAME: Supported.
+
+ -------------------------------------------------*/
+
+u8 nes_sachen_3013_device::read_h(offs_t offset)
+{
+ return (offset < 0x4000) ? 0x3a : hi_access_rom(offset);
+}
+
+/*-------------------------------------------------
+
+ Sachen 3014 board (also marked with serial SA-003)
+
+ Games: Dong Dong Nao 2
+
+ This board is a CNROM variant with simple protection.
+ The upper nibble of high address writes is latched
+ and read back in the lower nibble at 0xe000-0xefff.
+
+ NES 2.0: mapper 533
+
+ In MAME: Supported.
+
+ -------------------------------------------------*/
+
+void nes_sachen_3014_device::write_h(offs_t offset, u8 data)
+{
+ LOG("Sachen 3014 write_h, offset: %04x, data: %02x\n", offset, data);
+
+ // this pcb is subject to bus conflict
+ data = account_bus_conflict(offset, data);
+
+ m_latch = data >> 4;
+ chr8(m_latch & 1, CHRROM);
+}
+
+u8 nes_sachen_3014_device::read_h(offs_t offset)
+{
+ LOGMASKED(LOG_HIFREQ, "Sachen 3014 read_h, offset: %04x\n", offset);
+ u8 temp = hi_access_rom(offset);
+
+ if ((offset & 0x7000) == 0x6000)
+ temp = (temp & 0xf0) | m_latch;
+ return temp;
+}
+
+/*-------------------------------------------------
+
Sachen 74x374 bootleg boards
Games: Chess Academy, Chinese Checkers Jpn, Mahjong Academy,
@@ -506,15 +511,14 @@ void nes_sachen_74x374_device::set_mirror(uint8_t nt) // also used by mappers 13
set_nt_mirroring(PPU_MIRROR_LOW);
break;
default:
- LOG_MMC(("Mapper set NT to invalid value %02x", nt));
+ LOG("Mapper set NT to invalid value %02x", nt);
break;
}
}
-
void nes_sachen_74x374_device::write_l(offs_t offset, uint8_t data)
{
- LOG_MMC(("Sachen 74*374 write_l, offset: %04x, data: %02x\n", offset, data));
+ LOG("Sachen 74*374 write_l, offset: %04x, data: %02x\n", offset, data);
/* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */
if (!(offset & 0x100))
@@ -542,7 +546,7 @@ void nes_sachen_74x374_device::write_l(offs_t offset, uint8_t data)
chr8(m_mmc_vrom_bank, CHRROM);
break;
case 0x07:
- set_mirror((data >> 1) & 0x03);
+ set_mirror(BIT(data, 1, 2));
break;
default:
break;
@@ -553,7 +557,7 @@ void nes_sachen_74x374_device::write_l(offs_t offset, uint8_t data)
uint8_t nes_sachen_74x374_device::read_l(offs_t offset)
{
- LOG_MMC(("Sachen 74*374 read_l, offset: %04x", offset));
+ LOG("Sachen 74*374 read_l, offset: %04x", offset);
/* read happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */
if (!(offset & 0x100))
@@ -564,7 +568,7 @@ uint8_t nes_sachen_74x374_device::read_l(offs_t offset)
void nes_sachen_74x374_alt_device::write_l(offs_t offset, uint8_t data)
{
- LOG_MMC(("Sachen 74*374 Alt write_l, offset: %04x, data: %02x\n", offset, data));
+ LOG("Sachen 74*374 Alt write_l, offset: %04x, data: %02x\n", offset, data);
/* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */
if (!(offset & 0x100))
@@ -628,7 +632,7 @@ void nes_sachen_8259a_device::chr_update()
void nes_sachen_8259a_device::write_l(offs_t offset, uint8_t data)
{
- LOG_MMC(("Sachen 8259 write_l, offset: %04x, data: %02x\n", offset, data));
+ LOG("Sachen 8259 write_l, offset: %04x, data: %02x\n", offset, data);
/* write happens only if we are at 0x4100 + k * 0x200, but 0x4100 is offset = 0 */
if (!(offset & 0x100))