summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author angelosa <lordkale4@gmail.com>2025-07-22 11:33:51 +0200
committer angelosa <lordkale4@gmail.com>2025-07-22 11:41:48 +0200
commit76ee412d6c62ff853f2aa436a9b437536d80403b (patch)
tree1a4a9f5ef1cee5215b4a7d723025ceaf434bb1ce
parent90d03538692b81c0d7e51e70a18fbdbe9cc6051d (diff)
sega/mdconsole.cpp: perform various 32x changes:
* fix regressed stereo sound routing * remove _32X_SWAP_MASTER_SLAVE_HACK (fifa96 doesn't mind anymore) * rewrite commsram read/write to use scheduler synchronize * fix soulstar missing layer by mirroring DRAM area * make set_maximum_quantum more deterministic * hash/32x.xml: perform a QA pass
-rw-r--r--hash/32x.xml103
-rw-r--r--src/mame/sega/mdconsole.cpp36
-rw-r--r--src/mame/shared/mega32x.cpp148
-rw-r--r--src/mame/shared/mega32x.h4
4 files changed, 189 insertions, 102 deletions
diff --git a/hash/32x.xml b/hash/32x.xml
index 7cda580da51..dbd7bdd3941 100644
--- a/hash/32x.xml
+++ b/hash/32x.xml
@@ -14,10 +14,13 @@ license:CC0-1.0
<!-- Confirmed dump by ElBarto -->
- <software name="doom">
+ <software name="doom" supported="partial">
<description>Doom (Europe)</description>
<year>1994</year>
<publisher>Sega</publisher>
+ <notes><![CDATA[
+Missing [PWM] samples
+]]></notes>
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="_32x_cart">
<feature name="pcb" value="171-6885A" />
@@ -59,7 +62,7 @@ license:CC0-1.0
</part>
</software>
- <software name="swa" supported="no">
+ <software name="swa">
<description>Star Wars Arcade (Europe)</description>
<year>1994</year>
<publisher>Sega</publisher>
@@ -75,8 +78,7 @@ license:CC0-1.0
</part>
</software>
- <!-- boot OK -->
- <software name="toughman">
+ <software name="toughman" supported="yes">
<description>Toughman Contest (Europe, USA)</description>
<year>1995</year>
<publisher>Electronic Arts</publisher>
@@ -93,11 +95,13 @@ license:CC0-1.0
</part>
</software>
- <!-- Has 3d geometry bugs on attract mode with SH2 DRC, crashes if you attempt to enter into main menu -->
<software name="vrdx" supported="no">
<description>Virtua Racing Deluxe (Europe)</description>
<year>1994</year>
<publisher>Sega</publisher>
+ <notes><![CDATA[
+Some 3d geometry bugs when [DRC] is used
+]]></notes>
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="_32x_cart">
<feature name="pcb" value="171-6885A" />
@@ -169,10 +173,13 @@ license:CC0-1.0
<!-- Old interleaved/unconfirmed dump -->
<!-- PCB info and part numbers are taken from SMS Power and from nepereny's PCB pictures and other sources -->
- <software name="aburner">
+ <software name="aburner" supported="partial">
<description>After Burner Complete (Europe)</description>
<year>1994</year>
<publisher>Sega</publisher>
+ <notes><![CDATA[
+[PWM] samples are too quiet
+]]></notes>
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="_32x_cart">
<dataarea name="rom" size="2097152">
@@ -370,10 +377,13 @@ license:CC0-1.0
</part>
</software>
- <software name="darxide">
+ <software name="darxide" supported="partial">
<description>Darxide (Europe)</description>
<year>1995</year>
<publisher>Sega</publisher>
+ <notes><![CDATA[
+[PWM] samples are too quiet
+]]></notes>
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="_32x_cart">
<dataarea name="rom" size="2097152">
@@ -563,6 +573,9 @@ license:CC0-1.0
<description>Ecco the Dolphin CinePak Demo (Japan, USA, developer cart)</description>
<year>199?</year>
<publisher>&lt;unknown&gt;</publisher>
+ <notes><![CDATA[
+Black screen after Sega logo, tight loops at comms RAM dword read $a15120
+]]></notes>
<part name="cart" interface="_32x_cart">
<dataarea name="rom" size="3145728">
<rom name="ecco the dolphin cinepak demo (japan, usa) (developer cart).bin" size="3145728" crc="b06178df" sha1="10409f2245b058e8a32cba51e1ea391ca4480108" />
@@ -586,6 +599,9 @@ license:CC0-1.0
<description>36 Great Holes Starring Fred Couples (Europe)</description>
<year>1994</year>
<publisher>Sega</publisher>
+ <notes><![CDATA[
+Missing [SRAM] cart interface, may hang
+]]></notes>
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="_32x_cart">
<dataarea name="rom" size="3145728">
@@ -598,6 +614,9 @@ license:CC0-1.0
<description>36 Great Holes Starring Fred Couples (Japan, USA)</description>
<year>1994</year>
<publisher>Sega</publisher>
+ <notes><![CDATA[
+Missing [SRAM] cart interface, may hang
+]]></notes>
<info name="serial" value="GM-5002 (JPN)"/>
<info name="release" value="19950224 (JPN)"/>
<info name="alt_title" value="ゴルフマガジンプレゼンツ 36グレイトホールズ スターリング フレッド コプルス"/>
@@ -1009,10 +1028,13 @@ license:CC0-1.0
</part>
</software>
- <software name="chaotix">
+ <software name="chaotix" supported="partial">
<description>Chaotix (Europe)</description>
<year>1995</year>
<publisher>Sega</publisher>
+ <notes><![CDATA[
+Missing [SRAM] cart interface
+]]></notes>
<info name="alt_title" value="Knuckles' Chaotix (Box)"/>
<sharedfeat name="compatibility" value="PAL"/>
<part name="cart" interface="_32x_cart">
@@ -1022,10 +1044,13 @@ license:CC0-1.0
</part>
</software>
- <software name="chaotixju" cloneof="chaotix">
+ <software name="chaotixju" cloneof="chaotix" supported="partial">
<description>Chaotix (Japan, USA)</description>
<year>1995</year>
<publisher>Sega</publisher>
+ <notes><![CDATA[
+Missing [SRAM] cart interface
+]]></notes>
<info name="serial" value="GM-5003 (JPN)"/>
<info name="release" value="19950421 (JPN)"/>
<info name="alt_title" value="カオティクス フィーチャリング ナックルズ ザ エキドゥナ, Knuckles' Chaotix (USA Box)"/>
@@ -1632,11 +1657,13 @@ license:CC0-1.0
</part>
</software>
- <!-- missing I2C hookup so POST fails with blue/black vertical stripes (same I2C type as plain MD version) -->
<software name="nbajamte" supported="no">
<description>NBA Jam T.E. - Tournament Edition (World)</description>
<year>1995</year>
<publisher>Acclaim Entertainment</publisher>
+ <notes><![CDATA[
+Missing [I2C] hookup so POST fails with blue/black vertical stripes (same I2C type as plain MD version)
+]]></notes>
<info name="serial" value="T-8102A (JPN)"/>
<info name="release" value="19950901 (JPN)"/>
<info name="alt_title" value="NBAジャム トーナメントエディション"/>
@@ -1647,11 +1674,14 @@ license:CC0-1.0
</part>
</software>
- <!-- black screen, missing h irq? -->
<software name="nflqb" supported="no">
<description>NFL Quarterback Club ~ NFL Quarterback '95 (World)</description>
<year>1995</year>
<publisher>Acclaim Entertainment</publisher>
+ <notes><![CDATA[
+Black screen, all CPUs lock up in comms RAM.
+Master SH-2 enables HINT
+]]></notes>
<info name="serial" value="T-8103A (JPN)"/>
<info name="release" value="19950714 (JPN)"/>
<info name="alt_title" value="NFL クォーターバッククラブ'95"/>
@@ -1662,10 +1692,16 @@ license:CC0-1.0
</part>
</software>
- <software name="pitfall">
+ <software name="pitfall" supported="no">
<description>Pitfall - The Mayan Adventure (USA)</description>
<year>1995</year>
<publisher>Activision</publisher>
+ <notes><![CDATA[
+left/right column sprites don't wraparound properly (webs in stage 1, first boss intro roar) (verify)
+Waterfall in stage 2 is static on left side, looks less prominent in YT videos (verify)
+Randomly crashed once during stage 2
+Reportedly runs at 30 FPS on real HW
+]]></notes>
<sharedfeat name="compatibility" value="NTSC-U"/>
<part name="cart" interface="_32x_cart">
<dataarea name="rom" size="3145728">
@@ -1698,11 +1734,14 @@ license:CC0-1.0
</part>
</software>
- <!-- black screen after Sega logo -->
<software name="sangoku4" supported="no">
<description>Sangokushi IV (Japan)</description>
<year>1994</year>
<publisher>Koei</publisher>
+ <notes><![CDATA[
+Black screen after Sega logo, [Master SH-2] corrupts stack
+Accesses [cart] backup RAM
+]]></notes>
<info name="serial" value="T-7601A (JPN)"/>
<info name="release" value="19950728 (JPN)"/>
<info name="alt_title" value="三国志IV"/>
@@ -1824,12 +1863,14 @@ license:CC0-1.0
</part>
</software>
- <!-- boot OK, OSD and player sprite aren't drawn -->
- <software name="soulstar" supported="no">
+ <software name="soulstar" supported="partial">
<!-- The dumper also released larger size files, which were this exact dump padded with 0xff up to the end of the file -->
<description>SoulStar X (USA, prototype)</description>
<year>1995</year>
<publisher>Sega</publisher>
+ <notes><![CDATA[
+[m68k] writes to cart space at $8a2xxx (Backup RAM? NOP-ed out?)
+]]></notes>
<sharedfeat name="compatibility" value="NTSC-U"/>
<part name="cart" interface="_32x_cart">
<dataarea name="rom" size="2097152">
@@ -1891,7 +1932,7 @@ license:CC0-1.0
</part>
</software>
- <software name="swaj" cloneof="swa" supported="no">
+ <software name="swaj" cloneof="swa">
<description>Star Wars Arcade (Japan)</description>
<year>1994</year>
<publisher>Sega</publisher>
@@ -1905,7 +1946,7 @@ license:CC0-1.0
</part>
</software>
- <software name="swau" cloneof="swa" supported="no">
+ <software name="swau" cloneof="swa">
<description>Star Wars Arcade (USA)</description>
<year>1994</year>
<publisher>Sega</publisher>
@@ -2119,6 +2160,7 @@ license:CC0-1.0
</part>
</software>
+ <!-- TODO: crashed once in stage 1 -->
<software name="tmek">
<description>T-Mek (Europe, USA)</description>
<year>1995</year>
@@ -2250,6 +2292,10 @@ license:CC0-1.0
<description>Time Warner 32X CMD Download Cartridge</description>
<year>199?</year>
<publisher>Time Warner Interactive</publisher>
+ <notes><![CDATA[
+Uses [DE-9] port 2 button B for something
+[Slave SH-2] tests [SCI] port
+]]></notes>
<part name="cart" interface="_32x_cart">
<dataarea name="rom" size="262144">
<rom name="time warner 32x cmd download cartridge.bin" size="262144" crc="6c2176ca" sha1="460439b83ce50021339acf5fca4a63b45c0c1c0b" />
@@ -2389,6 +2435,9 @@ license:CC0-1.0
<description>Virtua Racing Deluxe (Japan)</description>
<year>1994</year>
<publisher>Sega</publisher>
+ <notes><![CDATA[
+Some 3d geometry bugs when [DRC] is used
+]]></notes>
<info name="serial" value="GM-5001 (JPN)"/>
<info name="release" value="19941216 (JPN)"/>
<info name="alt_title" value="バーチャレーシング デラックス"/>
@@ -2404,6 +2453,9 @@ license:CC0-1.0
<description>Virtua Racing Deluxe (USA)</description>
<year>1994</year>
<publisher>Sega</publisher>
+ <notes><![CDATA[
+Some 3d geometry bugs when [DRC] is used
+]]></notes>
<sharedfeat name="compatibility" value="NTSC-U"/>
<part name="cart" interface="_32x_cart">
<!-- Dump To Be Confirmed (and split in properly sized parts) (nepereny's) -->
@@ -2453,10 +2505,13 @@ license:CC0-1.0
</part>
</software>
- <software name="wsb">
+ <software name="wsb" supported="no">
<description>World Series Baseball Starring Deion Sanders (USA)</description>
<year>1995</year>
<publisher>Sega</publisher>
+ <notes><![CDATA[
+Extensive checks for [cart] SRAM space, boots back to main menu if a new league is created
+]]></notes>
<sharedfeat name="compatibility" value="NTSC-J,NTSC-U,PAL"/>
<part name="cart" interface="_32x_cart">
<dataarea name="rom" size="3145728">
@@ -2465,10 +2520,12 @@ license:CC0-1.0
</part>
</software>
+ <!-- TODO: sometimes it corrupts sound? -->
<software name="wwfraw">
<description>WWF Raw (World)</description>
<year>1994</year>
<publisher>Acclaim Entertainment</publisher>
+ <info name="usage" value="Supports 4-players thru teamplay option"/>
<info name="serial" value="T-8101A (JPN)"/>
<info name="release" value="19950901 (JPN)"/>
<sharedfeat name="compatibility" value="NTSC-J,NTSC-U,PAL"/>
@@ -2479,11 +2536,13 @@ license:CC0-1.0
</part>
</software>
- <!-- invisible 32x layer -->
- <software name="wwfag" supported="no">
+ <software name="wwfag" supported="partial">
<description>WWF WrestleMania - The Arcade Game (USA)</description>
<year>1995</year>
<publisher>Acclaim Entertainment</publisher>
+ <notes><![CDATA[
+Missing [PWM] samples
+]]></notes>
<part name="cart" interface="_32x_cart">
<dataarea name="rom" size="4194304">
<rom name="wwf wrestlemania - the arcade game (usa).bin" size="4194304" crc="61833503" sha1="551eedc963cba0e1410b3d229b332ef9ea061469" />
@@ -2491,11 +2550,13 @@ license:CC0-1.0
</part>
</software>
- <!-- black screen after choosing a level, requires SH2 SCI support -->
<software name="xmen" supported="no">
<description>X-Men (USA, prototype)</description>
<year>1995</year>
<publisher>&lt;unknown&gt;</publisher>
+ <notes><![CDATA[
+Black screen after choosing a level, requires SH-2 [SCI] support
+]]></notes>
<sharedfeat name="compatibility" value="NTSC-U"/>
<part name="cart" interface="_32x_cart">
<dataarea name="rom" size="4194304">
diff --git a/src/mame/sega/mdconsole.cpp b/src/mame/sega/mdconsole.cpp
index 15c515c015f..e8c153df9c6 100644
--- a/src/mame/sega/mdconsole.cpp
+++ b/src/mame/sega/mdconsole.cpp
@@ -439,21 +439,21 @@ void md_cons_state::genesis_32x(machine_config &config)
m_vdp->set_md_32x_scanline_helper(FUNC(md_cons_state::_32x_scanline_helper_callback));
m_vdp->set_md_32x_interrupt(FUNC(md_cons_state::_32x_interrupt_callback));
m_vdp->reset_routes();
- m_vdp->add_route(ALL_OUTPUTS, "speaker", (0.50)/2);
- m_vdp->add_route(ALL_OUTPUTS, "speaker", (0.50)/2);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
SEGA_32X_NTSC(config, m_32x, (MASTER_CLOCK_NTSC * 3) / 7, m_maincpu, m_scan_timer);
m_32x->set_screen("megadriv");
- m_32x->add_route(0, "speaker", 1.00);
- m_32x->add_route(1, "speaker", 1.00);
+ m_32x->add_route(0, "speaker", 1.00, 0);
+ m_32x->add_route(1, "speaker", 1.00, 1);
m_screen->screen_vblank().set(FUNC(md_cons_state::screen_vblank_console));
// we need to remove and re-add the YM because the balance is different
// due to MAME having severe issues if the dac output is > 0.40? (sound is corrupted even if DAC is silent?!)
m_ymsnd->reset_routes();
- m_ymsnd->add_route(0, "speaker", (0.50)/2);
- m_ymsnd->add_route(1, "speaker", (0.50)/2);
+ m_ymsnd->add_route(0, "speaker", (0.50)/2, 0);
+ m_ymsnd->add_route(1, "speaker", (0.50)/2, 1);
md_ctrl_ports(config);
md_exp_port(config);
@@ -474,21 +474,21 @@ void md_cons_state::mdj_32x(machine_config &config)
m_vdp->set_md_32x_scanline_helper(FUNC(md_cons_state::_32x_scanline_helper_callback));
m_vdp->set_md_32x_interrupt(FUNC(md_cons_state::_32x_interrupt_callback));
m_vdp->reset_routes();
- m_vdp->add_route(ALL_OUTPUTS, "speaker", (0.50)/2);
- m_vdp->add_route(ALL_OUTPUTS, "speaker", (0.50)/2);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
SEGA_32X_NTSC(config, m_32x, (MASTER_CLOCK_NTSC * 3) / 7, m_maincpu, m_scan_timer);
m_32x->set_screen("megadriv");
- m_32x->add_route(0, "speaker", 1.00);
- m_32x->add_route(1, "speaker", 1.00);
+ m_32x->add_route(0, "speaker", 1.00, 0);
+ m_32x->add_route(1, "speaker", 1.00, 1);
m_screen->screen_vblank().set(FUNC(md_cons_state::screen_vblank_console));
// we need to remove and re-add the sound system because the balance is different
// due to MAME having severe issues if the dac output is > 0.40? (sound is corrupted even if DAC is silent?!)
m_ymsnd->reset_routes();
- m_ymsnd->add_route(0, "speaker", (0.50)/2);
- m_ymsnd->add_route(1, "speaker", (0.50)/2);
+ m_ymsnd->add_route(0, "speaker", (0.50)/2, 0);
+ m_ymsnd->add_route(1, "speaker", (0.50)/2, 1);
md_ctrl_ports(config);
md_exp_port(config);
@@ -509,21 +509,21 @@ void md_cons_state::md_32x(machine_config &config)
m_vdp->set_md_32x_scanline_helper(FUNC(md_cons_state::_32x_scanline_helper_callback));
m_vdp->set_md_32x_interrupt(FUNC(md_cons_state::_32x_interrupt_callback));
m_vdp->reset_routes();
- m_vdp->add_route(ALL_OUTPUTS, "speaker", (0.50)/2);
- m_vdp->add_route(ALL_OUTPUTS, "speaker", (0.50)/2);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 0);
+ m_vdp->add_route(ALL_OUTPUTS, "speaker", 0.50, 1);
SEGA_32X_PAL(config, m_32x, (MASTER_CLOCK_PAL * 3) / 7, m_maincpu, m_scan_timer);
m_32x->set_screen("megadriv");
- m_32x->add_route(0, "speaker", 1.00);
- m_32x->add_route(1, "speaker", 1.00);
+ m_32x->add_route(0, "speaker", 1.00, 0);
+ m_32x->add_route(1, "speaker", 1.00, 1);
m_screen->screen_vblank().set(FUNC(md_cons_state::screen_vblank_console));
// we need to remove and re-add the sound system because the balance is different
// due to MAME having severe issues if the dac output is > 0.40? (sound is corrupted even if DAC is silent?!)
m_ymsnd->reset_routes();
- m_ymsnd->add_route(0, "speaker", (0.50)/2);
- m_ymsnd->add_route(1, "speaker", (0.50)/2);
+ m_ymsnd->add_route(0, "speaker", (0.50)/2, 0);
+ m_ymsnd->add_route(1, "speaker", (0.50)/2, 1);
md_ctrl_ports(config);
md_exp_port(config);
diff --git a/src/mame/shared/mega32x.cpp b/src/mame/shared/mega32x.cpp
index 85201394792..75d354839cc 100644
--- a/src/mame/shared/mega32x.cpp
+++ b/src/mame/shared/mega32x.cpp
@@ -192,12 +192,16 @@ GFX check (these don't explicitly fails):
#include "mega32x.h"
#include "machine/timer.h"
+#define LOG_IRQ (1U << 1)
+
+#define VERBOSE (LOG_GENERAL | LOG_IRQ)
+//#define LOG_OUTPUT_FUNC osd_printf_info
+
+#include "logmacro.h"
+
+#define LOGIRQ(...) LOGMASKED(LOG_IRQ, __VA_ARGS__)
+
-// Fifa96 needs the CPUs swapped for the gameplay to enter due to some race conditions
-// when using the DRC core. Needs further investigation, the non-DRC core works either
-// way
-#define _32X_SWAP_MASTER_SLAVE_HACK
-#define _32X_COMMS_PORT_SYNC 0
#define MAX_HPOSITION 480
/* need to make some pwm stuff part of device */
@@ -377,17 +381,17 @@ void sega_32x_device::m68k_a15106_w(address_space &space, offs_t offset, uint16_
m_fifo_block_b_full = 0;
}
- //printf("m68k_a15106_w %04x\n", data);
+ //logerror("m68k_a15106_w %04x\n", data);
/*
if (m_a15106_reg & 0x4)
- printf(" --- 68k Write Mode enabled\n");
+ logerror(" --- 68k Write Mode enabled\n");
else
- printf(" --- 68k Write Mode disabled\n");
+ logerror(" --- 68k Write Mode disabled\n");
if (m_a15106_reg & 0x1)
- printf(" --- DMA Start Allowed \n");
+ logerror(" --- DMA Start Allowed \n");
else
- printf(" --- DMA Start No Operation\n");
+ logerror(" --- DMA Start No Operation\n");
*/
}
@@ -415,7 +419,7 @@ uint16_t sega_32x_device::dreq_common_r(address_space &space, offs_t offset)
case 0x0a/2: // a15112 / 4012
if (&space == &_68kspace)
{
- printf("attempting to READ FIFO with 68k!\n");
+ logerror("attempting to READ FIFO with 68k!\n");
return 0xffff;
}
@@ -423,7 +427,7 @@ uint16_t sega_32x_device::dreq_common_r(address_space &space, offs_t offset)
m_current_fifo_read_pos++;
- // printf("reading FIFO!\n");
+ // logerror("reading FIFO!\n");
if (m_current_fifo_readblock == m_fifo_block_a && !m_fifo_block_a_full)
logerror("Fifo block a isn't filled!\n");
@@ -476,14 +480,14 @@ void sega_32x_device::dreq_common_w(address_space &space, offs_t offset, uint16_
case 0x02/2: // a1510a / 400a
if (&space != &_68kspace)
{
- printf("attempting to WRITE DREQ SRC with SH2!\n");
+ logerror("attempting to WRITE DREQ SRC with SH2!\n");
return;
}
m_dreq_src_addr[offset&1] = ((offset&1) == 0) ? (data & 0xff) : (data & 0xfffe);
//if((m_dreq_src_addr[0]<<16)|m_dreq_src_addr[1])
- // printf("DREQ set SRC = %08x\n",(m_dreq_src_addr[0]<<16)|m_dreq_src_addr[1]);
+ // logerror("DREQ set SRC = %08x\n",(m_dreq_src_addr[0]<<16)|m_dreq_src_addr[1]);
break;
@@ -491,53 +495,53 @@ void sega_32x_device::dreq_common_w(address_space &space, offs_t offset, uint16_
case 0x06/2: // a1510e / 400e
if (&space != &_68kspace)
{
- printf("attempting to WRITE DREQ DST with SH2!\n");
+ logerror("attempting to WRITE DREQ DST with SH2!\n");
return;
}
m_dreq_dst_addr[offset&1] = ((offset&1) == 0) ? (data & 0xff) : (data & 0xffff);
//if((m_dreq_dst_addr[0]<<16)|m_dreq_dst_addr[1])
- // printf("DREQ set DST = %08x\n",(m_dreq_dst_addr[0]<<16)|m_dreq_dst_addr[1]);
+ // logerror("DREQ set DST = %08x\n",(m_dreq_dst_addr[0]<<16)|m_dreq_dst_addr[1]);
break;
case 0x08/2: // a15110 / 4010
if (&space != &_68kspace)
{
- printf("attempting to WRITE DREQ SIZE with SH2!\n");
+ logerror("attempting to WRITE DREQ SIZE with SH2!\n");
return;
}
m_dreq_size = data & 0xfffc;
// if(m_dreq_size)
- // printf("DREQ set SIZE = %04x\n",m_dreq_size);
+ // logerror("DREQ set SIZE = %04x\n",m_dreq_size);
break;
case 0x0a/2: // a15112 / 4012 - FIFO Write (68k only!)
if (&space != &_68kspace)
{
- printf("attempting to WRITE FIFO with SH2!\n");
+ logerror("attempting to WRITE FIFO with SH2!\n");
return;
}
if (m_current_fifo_block==m_fifo_block_a && m_fifo_block_a_full)
{
- printf("attempt to write to Full Fifo block a!\n");
+ logerror("attempt to write to Full Fifo block a!\n");
return;
}
if (m_current_fifo_block==m_fifo_block_b && m_fifo_block_b_full)
{
- printf("attempt to write to Full Fifo block b!\n");
+ logerror("attempt to write to Full Fifo block b!\n");
return;
}
if((m_a15106_reg & 4) == 0)
{
- printf("attempting to WRITE FIFO with 68S cleared!\n"); // corpse32
+ logerror("attempting to WRITE FIFO with 68S cleared!\n"); // corpse32
return;
}
@@ -602,7 +606,7 @@ void sega_32x_device::m68k_a1511a_w(uint16_t data)
{
m_sega_tv = data & 1;
- printf("SEGA TV register set = %04x\n",data);
+ logerror("SEGA TV register set = %04x\n",data);
}
/*
@@ -710,7 +714,7 @@ void sega_32x_device::m68k_a15100_w(address_space &space, offs_t offset, uint16_
uint16_t sega_32x_device::m68k_a15102_r()
{
- //printf("_32x_68k_a15102_r\n");
+ //logerror("_32x_68k_a15102_r\n");
return m_32x_68k_a15102_reg;
}
@@ -723,13 +727,13 @@ void sega_32x_device::m68k_a15102_w(offs_t offset, uint16_t data, uint16_t mem_m
if (data&0x1)
{
if (m_sh2_master_cmdint_enable) m_master_cpu->set_input_line(SH2_CINT_IRQ_LEVEL,ASSERT_LINE);
- else printf("master cmdint when masked!\n");
+ else logerror("master cmdint when masked!\n");
}
if (data&0x2)
{
if (m_sh2_slave_cmdint_enable) m_slave_cpu->set_input_line(SH2_CINT_IRQ_LEVEL,ASSERT_LINE);
- else printf("slave cmdint when masked!\n");
+ else logerror("slave cmdint when masked!\n");
}
}
}
@@ -772,15 +776,23 @@ void sega_32x_device::m68k_a15104_w(offs_t offset, uint16_t data, uint16_t mem_m
// reads
uint16_t sega_32x_device::m68k_m_commsram_r(offs_t offset)
{
- if (_32X_COMMS_PORT_SYNC) machine().scheduler().synchronize();
+ if (!machine().side_effects_disabled())
+ machine().scheduler().synchronize();
return m_commsram[offset];
}
// writes
void sega_32x_device::m68k_m_commsram_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
- COMBINE_DATA(&m_commsram[offset]);
- if (_32X_COMMS_PORT_SYNC) machine().scheduler().synchronize();
+// COMBINE_DATA(&m_commsram[offset]);
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(sega_32x_device::sync_commsram_w), this), (offset << 16) | (data & mem_mask) | (m_commsram[offset] & ~mem_mask));
+}
+
+void sega_32x_device::sync_commsram_w(s32 param)
+{
+ u8 offset = (param >> 16) & 7;
+ u16 data = param & 0xffff;
+ m_commsram[offset] = data;
}
/**********************************************************************************************/
@@ -869,8 +881,8 @@ TIMER_CALLBACK_MEMBER(sega_32x_device::handle_pwm_callback)
if(m_pwm_timer_tick == m_pwm_tm_reg)
{
m_pwm_timer_tick = 0;
- if(sh2_master_pwmint_enable) { m_master_cpu->set_input_line(SH2_PINT_IRQ_LEVEL,ASSERT_LINE); }
- if(sh2_slave_pwmint_enable) { m_slave_cpu->set_input_line(SH2_PINT_IRQ_LEVEL,ASSERT_LINE); }
+ if(m_sh2_master_pwmint_enable) { m_master_cpu->set_input_line(SH2_PINT_IRQ_LEVEL,ASSERT_LINE); }
+ if(m_sh2_slave_pwmint_enable) { m_slave_cpu->set_input_line(SH2_PINT_IRQ_LEVEL,ASSERT_LINE); }
}
m_32x_pwm_timer->adjust(attotime::from_hz(clock() / (m_pwm_cycle - 1)));
@@ -887,7 +899,7 @@ uint16_t sega_32x_device::pwm_r(offs_t offset)
case 0x08/2: return m_lch_fifo_state & m_rch_fifo_state; // mono ch
}
- printf("Read at undefined PWM register %02x\n",offset);
+ logerror("Read at undefined PWM register %02x\n",offset);
return 0xffff;
}
@@ -931,7 +943,7 @@ void sega_32x_device::pwm_w(offs_t offset, uint16_t data)
m_rch_fifo_state = (m_rch_size == PWM_FIFO_SIZE) ? 0x8000 : 0x0000;
break;
default:
- printf("Write at undefined PWM register %02x %04x\n",offset,data);
+ logerror("Write at undefined PWM register %02x %04x\n",offset,data);
break;
}
}
@@ -985,7 +997,7 @@ uint16_t sega_32x_device::common_vdp_regs_r(offs_t offset)
int ntsc;
-// printf("_32x_68k_a15180_r (a15180) %04x\n",mem_mask);
+// logerror("_32x_68k_a15180_r (a15180) %04x\n",mem_mask);
// read needs authorization too I think, undefined behavior otherwise
switch (offset)
@@ -1079,7 +1091,7 @@ void sega_32x_device::common_vdp_regs_w(address_space &space, offs_t offset, uin
switch (offset)
{
case 0x00:
- //printf("_32x_68k_a15180_w (a15180) %04x %04x source m_32x_access_auth %04x\n",data,mem_mask, m_32x_access_auth);
+ //logerror("_32x_68k_a15180_w (a15180) %04x %04x source m_32x_access_auth %04x\n",data,mem_mask, m_32x_access_auth);
if (ACCESSING_BITS_0_7)
{
@@ -1195,7 +1207,7 @@ uint16_t sega_32x_device::master_4000_r()
retvalue |= m_sh2_master_vint_enable;
retvalue |= m_sh2_master_hint_enable;
retvalue |= m_sh2_master_cmdint_enable;
- retvalue |= sh2_master_pwmint_enable;
+ retvalue |= m_sh2_master_pwmint_enable;
return retvalue;
}
@@ -1213,10 +1225,15 @@ void sega_32x_device::master_4000_w(offs_t offset, uint16_t data, uint16_t mem_m
m_sh2_master_vint_enable = data & 0x8;
m_sh2_master_hint_enable = data & 0x4;
m_sh2_master_cmdint_enable = data & 0x2;
- sh2_master_pwmint_enable = data & 0x1;
+ m_sh2_master_pwmint_enable = data & 0x1;
- //if (m_sh2_master_hint_enable) printf("m_sh2_master_hint_enable enable!\n");
- //if (sh2_master_pwmint_enable) printf("sh2_master_pwn_enable enable!\n");
+ LOGIRQ("$4000 SH2 master: %d HINT_IN_VBL| %d VINT| %d HINT| %d CMDINT| %d PWMINT\n"
+ , m_sh2_hint_in_vbl
+ , m_sh2_master_vint_enable
+ , m_sh2_master_hint_enable
+ , m_sh2_master_cmdint_enable
+ , m_sh2_master_pwmint_enable
+ );
check_irqs();
}
@@ -1232,7 +1249,7 @@ uint16_t sega_32x_device::slave_4000_r()
retvalue |= m_sh2_slave_vint_enable;
retvalue |= m_sh2_slave_hint_enable;
retvalue |= m_sh2_slave_cmdint_enable;
- retvalue |= sh2_slave_pwmint_enable;
+ retvalue |= m_sh2_slave_pwmint_enable;
return retvalue;
}
@@ -1251,10 +1268,15 @@ void sega_32x_device::slave_4000_w(offs_t offset, uint16_t data, uint16_t mem_ma
m_sh2_slave_vint_enable = data & 0x8;
m_sh2_slave_hint_enable = data & 0x4;
m_sh2_slave_cmdint_enable = data & 0x2;
- sh2_slave_pwmint_enable = data & 0x1;
+ m_sh2_slave_pwmint_enable = data & 0x1;
- //if (m_sh2_slave_hint_enable) printf("m_sh2_slave_hint_enable enable!\n");
- //if (sh2_slave_pwmint_enable) printf("sh2_slave_pwm_enable enable!\n");
+ LOGIRQ("$4000 SH2 slave: %d HINT_IN_VBL| %d VINT| %d HINT| %d CMDINT| %d PWMINT\n"
+ , m_sh2_hint_in_vbl
+ , m_sh2_slave_vint_enable
+ , m_sh2_slave_hint_enable
+ , m_sh2_slave_cmdint_enable
+ , m_sh2_slave_pwmint_enable
+ );
check_irqs();
}
@@ -1268,13 +1290,13 @@ void sega_32x_device::slave_4000_w(offs_t offset, uint16_t data, uint16_t mem_ma
uint16_t sega_32x_device::common_4002_r()
{
- printf("reading 4002!\n");
+ logerror("reading 4002!\n");
return 0x0000;
}
void sega_32x_device::common_4002_w(uint16_t data)
{
- printf("write 4002!\n");
+ logerror("write 4002!\n");
}
@@ -1301,13 +1323,13 @@ void sega_32x_device::common_4004_w(uint16_t data)
uint16_t sega_32x_device::common_4006_r()
{
- //printf("DREQ read!\n"); // tempo reads it, shut up for now
+ //logerror("DREQ read!\n"); // tempo reads it, shut up for now
return m68k_a15106_r();
}
void sega_32x_device::common_4006_w(uint16_t data)
{
- printf("DREQ write!\n"); //register is read only on SH-2 side
+ logerror("DREQ write!\n"); //register is read only on SH-2 side
}
@@ -1359,12 +1381,12 @@ void sega_32x_device::slave_401c_w(uint16_t data) { m_slave_cpu->set_input_line(
void sega_32x_device::master_401e_w(uint16_t data)
{
- printf("master_401e_w\n");
+ logerror("master_401e_w\n");
}
void sega_32x_device::slave_401e_w(uint16_t data)
{
- printf("slave_401e_w\n");
+ logerror("slave_401e_w\n");
}
/**********************************************************************************************/
@@ -1449,8 +1471,9 @@ void sega_32x_device::sh2_common_map(address_map &map)
map(0x00004100, 0x0000410b).rw(FUNC(sega_32x_device::common_vdp_regs_r), FUNC(sega_32x_device::common_vdp_regs_w));
map(0x00004200, 0x000043ff).rw(FUNC(sega_32x_device::m68k_palette_r), FUNC(sega_32x_device::m68k_palette_w));
- map(0x04000000, 0x0401ffff).rw(FUNC(sega_32x_device::m68k_dram_r), FUNC(sega_32x_device::m68k_dram_w));
- map(0x04020000, 0x0403ffff).rw(FUNC(sega_32x_device::m68k_dram_overwrite_r), FUNC(sega_32x_device::m68k_dram_overwrite_w));
+ // soulstar slave access at $0405xxxx
+ map(0x04000000, 0x0401ffff).mirror(0x00040000).rw(FUNC(sega_32x_device::m68k_dram_r), FUNC(sega_32x_device::m68k_dram_w));
+ map(0x04020000, 0x0403ffff).mirror(0x00040000).rw(FUNC(sega_32x_device::m68k_dram_overwrite_r), FUNC(sega_32x_device::m68k_dram_overwrite_w));
map(0x06000000, 0x0603ffff).ram().share("sh2_shared");
@@ -1684,28 +1707,29 @@ const rom_entry *sega_32x_device::device_rom_region() const
//
// some games appear to dislike 'perfect' levels of interleave, probably due to
// non-emulated cache, ram waitstates and other issues?
-#define _32X_INTERLEAVE_LEVEL \
- config.set_maximum_quantum(attotime::from_hz(1800000));
void sega_32x_device::device_add_mconfig(machine_config &config)
{
-#ifndef _32X_SWAP_MASTER_SLAVE_HACK
+ // HD6417095
SH7604(config, m_master_cpu, DERIVED_CLOCK(1, 1));
m_master_cpu->set_is_slave(0);
m_master_cpu->set_dma_fifo_data_available_callback(FUNC(sega_32x_device::_32x_fifo_available_callback));
-#endif
+ // HD6417095
SH7604(config, m_slave_cpu, DERIVED_CLOCK(1, 1));
m_slave_cpu->set_is_slave(1);
m_slave_cpu->set_dma_fifo_data_available_callback(FUNC(sega_32x_device::_32x_fifo_available_callback));
-#ifdef _32X_SWAP_MASTER_SLAVE_HACK
- SH7604(config, m_master_cpu, DERIVED_CLOCK(1, 1));
- m_master_cpu->set_is_slave(0);
- m_master_cpu->set_dma_fifo_data_available_callback(FUNC(sega_32x_device::_32x_fifo_available_callback));
-#endif
+ // brutal: needs high levels of interleaving otherwise background animations won't work
+ // (update: actually fixed by using synchronize in comms space)
+ // sharrierju: "press start button" will flicker at /512 onward
+ // chaotixju: hangs after sega logo at /256
- _32X_INTERLEAVE_LEVEL
+ // some games appear to dislike 'perfect' levels of interleave, probably due to
+ // non-emulated cache, ram waitstates and other issues?
+ const unsigned quantum_hz = this->clock() / 128;
+ config.set_maximum_quantum(attotime::from_hz(quantum_hz));
+// config.set_maximum_quantum(attotime::from_hz(1800000));
}
void sega_32x_ntsc_device::device_add_mconfig(machine_config &config)
@@ -1765,7 +1789,7 @@ void sega_32x_device::device_reset()
m_sh2_master_vint_enable = m_sh2_slave_vint_enable = 0;
m_sh2_master_hint_enable = m_sh2_slave_hint_enable = 0;
m_sh2_master_cmdint_enable = m_sh2_slave_cmdint_enable = 0;
- sh2_master_pwmint_enable = sh2_slave_pwmint_enable = 0;
+ m_sh2_master_pwmint_enable = m_sh2_slave_pwmint_enable = 0;
m_sh2_master_vint_pending = m_sh2_slave_vint_pending = 0;
m_sh2_hint_in_vbl = 0;
diff --git a/src/mame/shared/mega32x.h b/src/mame/shared/mega32x.h
index 81c1e0066f9..e342eafa437 100644
--- a/src/mame/shared/mega32x.h
+++ b/src/mame/shared/mega32x.h
@@ -56,6 +56,8 @@ public:
void m68k_a15104_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
uint16_t m68k_m_commsram_r(offs_t offset);
void m68k_m_commsram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
+ void sync_commsram_w(s32 param);
+
uint16_t pwm_r(offs_t offset);
void pwm_w(offs_t offset, uint16_t data);
void m68k_pwm_w(offs_t offset, uint16_t data);
@@ -88,7 +90,6 @@ public:
void render_videobuffer_to_screenbuffer_helper(int scanline);
void render_videobuffer_to_screenbuffer(int x, uint32_t priority, uint32_t &lineptr);
- int sh2_master_pwmint_enable = 0, sh2_slave_pwmint_enable = 0;
void check_framebuffer_swap(bool enabled);
void check_irqs();
@@ -162,6 +163,7 @@ private:
int m_sh2_master_vint_enable = 0, m_sh2_slave_vint_enable = 0;
int m_sh2_master_hint_enable = 0, m_sh2_slave_hint_enable = 0;
int m_sh2_master_cmdint_enable = 0, m_sh2_slave_cmdint_enable = 0;
+ int m_sh2_master_pwmint_enable = 0, m_sh2_slave_pwmint_enable = 0;
int m_sh2_hint_in_vbl = 0;
int m_sh2_master_vint_pending = 0;
int m_sh2_slave_vint_pending = 0;