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.cpp160
1 files changed, 39 insertions, 121 deletions
diff --git a/src/devices/bus/nes/sachen.cpp b/src/devices/bus/nes/sachen.cpp
index 61bb0a80111..69934c2b0cd 100644
--- a/src/devices/bus/nes/sachen.cpp
+++ b/src/devices/bus/nes/sachen.cpp
@@ -9,8 +9,8 @@
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]
@@ -21,10 +21,6 @@
* 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)
-
***********************************************************************************************************/
@@ -32,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"
//-------------------------------------------------
@@ -69,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)
{
}
@@ -157,91 +153,13 @@ 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()
-{
- common_start();
-}
-
-void nes_sachen_tcu01_device::pcb_reset()
-{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
- prg32(0);
- chr8(0, m_chr_source);
-}
-
void nes_sachen_tcu02_device::device_start()
{
common_start();
@@ -250,7 +168,6 @@ void nes_sachen_tcu02_device::device_start()
void nes_sachen_tcu02_device::pcb_reset()
{
- m_chr_source = m_vrom_chunks ? CHRROM : CHRRAM;
prg32(0);
chr8(0, m_chr_source);
@@ -280,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);
@@ -297,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);
@@ -308,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);
@@ -332,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);
}
@@ -351,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);
}
@@ -365,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);
@@ -393,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))
@@ -414,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);
@@ -440,7 +358,7 @@ void nes_sachen_sa72008_device::write_l(offs_t offset, uint8_t data)
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))
@@ -457,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);
}
}
@@ -480,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)
{
@@ -497,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;
@@ -545,7 +463,7 @@ u8 nes_sachen_3013_device::read_h(offs_t offset)
void nes_sachen_3014_device::write_h(offs_t offset, u8 data)
{
- LOG_MMC(("Sachen 3014 write_h, offset: %04x, data: %02x\n", offset, 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);
@@ -556,7 +474,7 @@ void nes_sachen_3014_device::write_h(offs_t offset, u8 data)
u8 nes_sachen_3014_device::read_h(offs_t offset)
{
-// LOG_MMC(("Sachen 3014 read_h, offset: %04x\n", offset));
+ LOGMASKED(LOG_HIFREQ, "Sachen 3014 read_h, offset: %04x\n", offset);
u8 temp = hi_access_rom(offset);
if ((offset & 0x7000) == 0x6000)
@@ -593,14 +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))
@@ -628,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;
@@ -639,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))
@@ -650,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))
@@ -714,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))