chessmachine: improve sync

This commit is contained in:
hap 2023-07-30 19:33:45 +02:00
parent 1fe2664723
commit 057f7dd38e
11 changed files with 75 additions and 58 deletions

View File

@ -506,7 +506,7 @@ std::error_condition msx_cart_konami_sound_snatcher_device::initialize_cartridge
}
// The SD Snatcher Sound cartrdige has 64KB RAM available by selecting ram banks 8-15
// The SD Snatcher Sound cartridge has 64KB RAM available by selecting ram banks 8-15
msx_cart_konami_sound_sdsnatcher_device::msx_cart_konami_sound_sdsnatcher_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: msx_cart_konami_sound_device(mconfig, MSX_CART_SOUND_SDSNATCHER, tag, owner, clock, 8, 15)
{
@ -664,5 +664,4 @@ void msx_cart_ec701_device::bank_w(u8 data)
m_view.select(2);
break;
}
}

View File

@ -22,13 +22,13 @@ DEFINE_DEVICE_TYPE(IDT7202, idt7202_device, "idt7202", "IDT7202 FIFO (1024x9)")
// fifo7200_device - constructor
//-------------------------------------------------
fifo7200_device::fifo7200_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, int size)
: device_t(mconfig, type, tag, owner, (uint32_t)0),
m_ram_size(size),
m_read_ptr(0), m_write_ptr(0), m_ef(0), m_ff(0), m_hf(0),
m_ef_handler(*this),
m_ff_handler(*this),
m_hf_handler(*this)
fifo7200_device::fifo7200_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, int size) :
device_t(mconfig, type, tag, owner, (uint32_t)0),
m_ram_size(size),
m_read_ptr(0), m_write_ptr(0), m_ef(0), m_ff(0), m_hf(0),
m_ef_handler(*this),
m_ff_handler(*this),
m_hf_handler(*this)
{
}
@ -37,8 +37,8 @@ fifo7200_device::fifo7200_device(const machine_config &mconfig, device_type type
// idt7200_device - constructor
//-------------------------------------------------
idt7200_device::idt7200_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: fifo7200_device(mconfig, IDT7200, tag, owner, 0x100)
idt7200_device::idt7200_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
fifo7200_device(mconfig, IDT7200, tag, owner, 0x100)
{
}
@ -47,8 +47,8 @@ idt7200_device::idt7200_device(const machine_config &mconfig, const char *tag, d
// idt7201_device - constructor
//-------------------------------------------------
idt7201_device::idt7201_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: fifo7200_device(mconfig, IDT7201, tag, owner, 0x200)
idt7201_device::idt7201_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
fifo7200_device(mconfig, IDT7201, tag, owner, 0x200)
{
}
@ -57,8 +57,8 @@ idt7201_device::idt7201_device(const machine_config &mconfig, const char *tag, d
// idt7202_device - constructor
//-------------------------------------------------
idt7202_device::idt7202_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: fifo7200_device(mconfig, IDT7202, tag, owner, 0x400)
idt7202_device::idt7202_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
fifo7200_device(mconfig, IDT7202, tag, owner, 0x400)
{
}

View File

@ -26,7 +26,6 @@ CPU speed. It should be around 14-16MHz. The ARM CPU is rated 12MHz, they
probably went for this solution to get optimum possible speed for each module.
TODO:
- PC version still gives a sync error on boot sometimes, probably related to quantum
- is interrupt handling correct?
- timer shouldn't be needed for disabling bootrom, real ARM has already read the next opcode
@ -59,6 +58,10 @@ chessmachine_device::chessmachine_device(const machine_config &mconfig, const ch
void chessmachine_device::device_start()
{
// zerofill
m_bootrom_enabled = false;
memset(m_latch, 0, sizeof(m_latch));
// register for savestates
save_item(NAME(m_bootrom_enabled));
save_item(NAME(m_latch));
@ -70,35 +73,48 @@ void chessmachine_device::device_start()
// external handlers
//-------------------------------------------------
void chessmachine_device::sync0_callback(s32 param)
void chessmachine_device::data0_w_sync(int param)
{
m_latch[0] = (m_latch[0] & 0x80) | param;
if ((m_latch[0] & 1) != param)
{
machine().scheduler().perfect_quantum(attotime::from_usec(50));
m_latch[0] = (m_latch[0] & 0x80) | param;
}
}
void chessmachine_device::data0_w(int state)
{
machine().scheduler().synchronize(timer_expired_delegate(FUNC(chessmachine_device::sync0_callback), this), state ? 1 : 0);
machine().scheduler().synchronize(timer_expired_delegate(FUNC(chessmachine_device::data0_w_sync), this), state ? 1 : 0);
}
void chessmachine_device::sync1_callback(s32 param)
void chessmachine_device::data1_w_sync(int param)
{
m_latch[0] = (m_latch[0] & 1) | param;
if ((m_latch[0] & 0x80) != param)
{
machine().scheduler().perfect_quantum(attotime::from_usec(50));
m_latch[0] = (m_latch[0] & 1) | param;
// cause interrupt?
m_maincpu->set_input_line(ARM_FIRQ_LINE, param ? ASSERT_LINE : CLEAR_LINE);
// cause interrupt?
m_maincpu->set_input_line(ARM_FIRQ_LINE, param ? ASSERT_LINE : CLEAR_LINE);
}
}
void chessmachine_device::data1_w(int state)
{
machine().scheduler().synchronize(timer_expired_delegate(FUNC(chessmachine_device::sync1_callback), this), state ? 0x80 : 0);
machine().scheduler().synchronize(timer_expired_delegate(FUNC(chessmachine_device::data1_w_sync), this), state ? 0x80 : 0);
}
void chessmachine_device::reset_w_sync(int param)
{
m_maincpu->set_input_line(INPUT_LINE_RESET, param ? ASSERT_LINE : CLEAR_LINE);
if (!m_bootrom_enabled && param)
install_bootrom(true);
}
void chessmachine_device::reset_w(int state)
{
m_maincpu->set_input_line(INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE);
if (!m_bootrom_enabled && state)
install_bootrom(true);
machine().scheduler().synchronize(timer_expired_delegate(FUNC(chessmachine_device::reset_w_sync), this), state ? 1 : 0);
}

View File

@ -46,11 +46,12 @@ private:
devcb_write_line m_data_out;
u8 m_latch[2] = { 0, 0 };
void sync0_callback(s32 param);
void sync1_callback(s32 param);
u8 m_latch[2];
void data0_w_sync(int param);
void data1_w_sync(int param);
void reset_w_sync(int param);
bool m_bootrom_enabled = false;
bool m_bootrom_enabled;
void install_bootrom(bool enable);
TIMER_DEVICE_CALLBACK_MEMBER(disable_bootrom) { install_bootrom(false); }
u32 disable_bootrom_r();

View File

@ -147,7 +147,8 @@ public:
return m_ram[offset];
}
int busy_r() { return 0; } // _BUSY pin - not emulated
int left_busy_r() { return 0; } // _BUSY pin - not emulated
int right_busy_r() { return 0; } // "
protected:
dual_port_mailbox_ram_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)

View File

@ -33,8 +33,8 @@ namespace {
class cbasebal_state : public driver_device
{
public:
cbasebal_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
cbasebal_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
@ -43,7 +43,8 @@ public:
m_scrollram(*this, "scrollram"),
m_databank(*this, "databank"),
m_opbank(*this, "opbank"),
m_bankedram(*this, "bankedram") { }
m_bankedram(*this, "bankedram")
{ }
void init_cbasebal();
void cbasebal(machine_config &config);
@ -362,17 +363,17 @@ static INPUT_PORTS_START( cbasebal )
PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") // ?
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") // ?
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read)
PORT_START( "IO_01" )
PORT_BIT( 0x00000010, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, cs_write)
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, cs_write)
PORT_START( "IO_02" )
PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, clk_write)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, clk_write)
PORT_START( "IO_03" )
PORT_BIT( 0x00000040, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, di_write)
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, di_write)
INPUT_PORTS_END

View File

@ -3508,21 +3508,21 @@ void ataxx_state::init_asylum()
*************************************/
/* small master banks, small slave banks */
GAME( 1985, cerberus, 0, leland, cerberus, leland_state, init_cerberus, ROT0, "Cinematronics", "Cerberus", 0 )
GAME( 1985, mayhem, 0, leland, mayhem, leland_state, init_mayhem, ROT0, "Cinematronics", "Mayhem 2002", 0 )
GAME( 1985, powrplay, 0, leland, mayhem, leland_state, init_powrplay, ROT0, "Cinematronics", "Power Play", 0 )
GAME( 1985, wseries, 0, leland, wseries, leland_state, init_wseries, ROT0, "Cinematronics", "World Series: The Season (rev 1)", 0 )
GAME( 1985, wseries0, wseries, leland, wseries, leland_state, init_wseries, ROT0, "Cinematronics", "World Series: The Season (rev 0)", 0 )
GAME( 1986, alleymas, 0, leland, alleymas, leland_state, init_alleymas, ROT270, "Cinematronics", "Alley Master", 0 )
GAME( 1986, upyoural, alleymas, leland, upyoural, leland_state, init_upyoural, ROT270, "Cinematronics", "Up Your Alley", 0 ) // prototype of Alley Master?
GAME( 1985, cerberus, 0, leland, cerberus, leland_state, init_cerberus, ROT0, "Cinematronics", "Cerberus", 0 )
GAME( 1985, mayhem, 0, leland, mayhem, leland_state, init_mayhem, ROT0, "Cinematronics", "Mayhem 2002", 0 )
GAME( 1985, powrplay, 0, leland, mayhem, leland_state, init_powrplay, ROT0, "Cinematronics", "Power Play", 0 )
GAME( 1985, wseries, 0, leland, wseries, leland_state, init_wseries, ROT0, "Cinematronics", "World Series: The Season (rev 1)", 0 )
GAME( 1985, wseries0, wseries, leland, wseries, leland_state, init_wseries, ROT0, "Cinematronics", "World Series: The Season (rev 0)", 0 )
GAME( 1986, alleymas, 0, leland, alleymas, leland_state, init_alleymas, ROT270, "Cinematronics", "Alley Master", 0 )
GAME( 1986, upyoural, alleymas, leland, upyoural, leland_state, init_upyoural, ROT270, "Cinematronics", "Up Your Alley", 0 ) // prototype of Alley Master?
/* odd master banks, small slave banks */
GAME( 1986, dangerz, 0, leland, dangerz, leland_state, init_dangerz, ROT0, "Cinematronics", "Danger Zone (rev 2)", 0 )
GAME( 1986, dangerz, 0, leland, dangerz, leland_state, init_dangerz, ROT0, "Cinematronics", "Danger Zone (rev 2)", 0 )
/* small master banks + extra top board, small slave banks */
GAME( 1987, basebal2, 0, leland, basebal2, leland_state, init_basebal2, ROT0, "Cinematronics", "Baseball: The Season II", 0 )
GAME( 1987, dblplay, 0, leland, basebal2, leland_state, init_dblplay, ROT0, "Leland Corporation / Tradewest", "Super Baseball Double Play Home Run Derby", 0 )
GAME( 1988, strkzone, 0, leland, basebal2, leland_state, init_strkzone, ROT0, "Leland Corporation", "Strike Zone Baseball", 0 )
GAME( 1987, basebal2, 0, leland, basebal2, leland_state, init_basebal2, ROT0, "Cinematronics", "Baseball: The Season II", 0 )
GAME( 1987, dblplay, 0, leland, basebal2, leland_state, init_dblplay, ROT0, "Leland Corporation / Tradewest", "Super Baseball Double Play Home Run Derby", 0 )
GAME( 1988, strkzone, 0, leland, basebal2, leland_state, init_strkzone, ROT0, "Leland Corporation", "Strike Zone Baseball", 0 )
/* large master banks, small slave banks, 80186 sound */
GAME( 1987, redlin2p, 0, redline, redline, redline_state, init_redlin2p, ROT270, "Cinematronics (Tradewest license)", "Redline Racer (2 players)", 0 )
@ -3535,7 +3535,7 @@ GAME( 1988, viper, 0, lelandi, dangerz, redline_state, init_vipe
GAME( 1988, teamqb, 0, lelandi, teamqb, redline_state, init_teamqb, ROT270, "Leland Corporation", "John Elway's Team Quarterback (rev 3)", 0 )
GAME( 1988, teamqb2, teamqb, lelandi, teamqb, redline_state, init_teamqb, ROT270, "Leland Corporation", "John Elway's Team Quarterback (rev 2)", 0 )
GAME( 1989, aafb, 0, lelandi, teamqb, redline_state, init_aafb, ROT270, "Leland Corporation", "All American Football (rev E)", 0 )
GAME( 1989, aafbd2p, aafb, lelandi, aafb2p, redline_state, init_aafbd2p, ROT270, "Leland Corporation", "All American Football (rev D, 2 Players)", 0 )
GAME( 1989, aafbd2p, aafb, lelandi, aafb2p, redline_state, init_aafbd2p, ROT270, "Leland Corporation", "All American Football (rev D, 2 players)", 0 )
GAME( 1989, aafbc, aafb, lelandi, teamqb, redline_state, init_aafbb, ROT270, "Leland Corporation", "All American Football (rev C)", 0 )
GAME( 1989, aafbb, aafb, lelandi, teamqb, redline_state, init_aafbb, ROT270, "Leland Corporation", "All American Football (rev B)", MACHINE_NOT_WORKING )
@ -3543,7 +3543,7 @@ GAME( 1989, aafbb, aafb, lelandi, teamqb, redline_state, init_aafb
GAME( 1989, offroad, 0, lelandi, offroad, redline_state, init_offroad, ROT0, "Leland Corporation", "Ironman Ivan Stewart's Super Off-Road (rev 4)", 0 )
GAME( 1989, offroad3, offroad, lelandi, offroad, redline_state, init_offroad, ROT0, "Leland Corporation", "Ironman Ivan Stewart's Super Off-Road (rev 3)", 0 )
GAME( 1989, offroadt, 0, lelandi, offroad, redline_state, init_offroadt, ROT0, "Leland Corporation", "Ironman Ivan Stewart's Super Off-Road Track-Pak (rev 4?)", 0 ) // need to verify revision
GAME( 1989, offroadt2p, offroadt, lelandi, offroadt2p, redline_state, init_offroadt, ROT0, "Leland Corporation", "Ironman Ivan Stewart's Super Off-Road Track-Pak (rev 4, 2 Players)", 0 )
GAME( 1989, offroadt2p, offroadt, lelandi, offroadt2p, redline_state, init_offroadt, ROT0, "Leland Corporation", "Ironman Ivan Stewart's Super Off-Road Track-Pak (rev 4, 2 players)", 0 )
GAME( 1990, pigout, 0, lelandi, pigout, redline_state, init_pigout, ROT0, "Leland Corporation", "Pig Out: Dine Like a Swine! (rev 2?)", 0 ) // need to verify revision
GAME( 1990, pigouta, pigout, lelandi, pigout, redline_state, init_pigout, ROT0, "Leland Corporation", "Pig Out: Dine Like a Swine! (rev 1)", 0 )

View File

@ -153,7 +153,6 @@ void risc_state::mrisc(machine_config &config)
m_maincpu->set_periodic_int(FUNC(risc_state::irq0_line_hold), irq_period);
CHESSMACHINE(config, m_chessm, 14'000'000); // Mephisto manual says 14MHz (no XTAL)
config.set_perfect_quantum(m_maincpu);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);

View File

@ -594,9 +594,9 @@ static INPUT_PORTS_START( andromed )
PORT_DIPUNKNOWN( 0x04, 0x00 )
PORT_DIPUNKNOWN( 0x08, 0x00 )
PORT_DIPNAME( 0x30, 0x10, DEF_STR( Coinage ) )
PORT_DIPSETTING( 0x10, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
PORT_DIPSETTING( 0x10, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
PORT_DIPUNKNOWN( 0x40, 0x00 )
PORT_DIPUNKNOWN( 0x80, 0x00 )
INPUT_PORTS_END

View File

@ -67,7 +67,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(m107_state::scanline_interrupt)
{
m_upd71059c->ir0_w(0);
}
}
}

View File

@ -108,6 +108,7 @@ void k28_state::machine_start()
void k28_state::machine_reset()
{
m_vfd_data = 0;
m_power_on = true;
m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);