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_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) : 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); m_view.select(2);
break; break;
} }
} }

View File

@ -22,8 +22,8 @@ DEFINE_DEVICE_TYPE(IDT7202, idt7202_device, "idt7202", "IDT7202 FIFO (1024x9)")
// fifo7200_device - constructor // fifo7200_device - constructor
//------------------------------------------------- //-------------------------------------------------
fifo7200_device::fifo7200_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, int size) 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), device_t(mconfig, type, tag, owner, (uint32_t)0),
m_ram_size(size), m_ram_size(size),
m_read_ptr(0), m_write_ptr(0), m_ef(0), m_ff(0), m_hf(0), m_read_ptr(0), m_write_ptr(0), m_ef(0), m_ff(0), m_hf(0),
m_ef_handler(*this), m_ef_handler(*this),
@ -37,8 +37,8 @@ fifo7200_device::fifo7200_device(const machine_config &mconfig, device_type type
// idt7200_device - constructor // idt7200_device - constructor
//------------------------------------------------- //-------------------------------------------------
idt7200_device::idt7200_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) idt7200_device::idt7200_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
: fifo7200_device(mconfig, IDT7200, tag, owner, 0x100) 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 - constructor
//------------------------------------------------- //-------------------------------------------------
idt7201_device::idt7201_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) idt7201_device::idt7201_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
: fifo7200_device(mconfig, IDT7201, tag, owner, 0x200) 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 - constructor
//------------------------------------------------- //-------------------------------------------------
idt7202_device::idt7202_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) idt7202_device::idt7202_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
: fifo7200_device(mconfig, IDT7202, tag, owner, 0x400) 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. probably went for this solution to get optimum possible speed for each module.
TODO: TODO:
- PC version still gives a sync error on boot sometimes, probably related to quantum
- is interrupt handling correct? - is interrupt handling correct?
- timer shouldn't be needed for disabling bootrom, real ARM has already read the next opcode - 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() void chessmachine_device::device_start()
{ {
// zerofill
m_bootrom_enabled = false;
memset(m_latch, 0, sizeof(m_latch));
// register for savestates // register for savestates
save_item(NAME(m_bootrom_enabled)); save_item(NAME(m_bootrom_enabled));
save_item(NAME(m_latch)); save_item(NAME(m_latch));
@ -70,35 +73,48 @@ void chessmachine_device::device_start()
// external handlers // external handlers
//------------------------------------------------- //-------------------------------------------------
void chessmachine_device::sync0_callback(s32 param) void chessmachine_device::data0_w_sync(int param)
{ {
if ((m_latch[0] & 1) != param)
{
machine().scheduler().perfect_quantum(attotime::from_usec(50));
m_latch[0] = (m_latch[0] & 0x80) | param; m_latch[0] = (m_latch[0] & 0x80) | param;
} }
}
void chessmachine_device::data0_w(int state) 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)
{ {
if ((m_latch[0] & 0x80) != param)
{
machine().scheduler().perfect_quantum(attotime::from_usec(50));
m_latch[0] = (m_latch[0] & 1) | param; m_latch[0] = (m_latch[0] & 1) | param;
// cause interrupt? // cause interrupt?
m_maincpu->set_input_line(ARM_FIRQ_LINE, param ? ASSERT_LINE : CLEAR_LINE); m_maincpu->set_input_line(ARM_FIRQ_LINE, param ? ASSERT_LINE : CLEAR_LINE);
} }
}
void chessmachine_device::data1_w(int state) 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) void chessmachine_device::reset_w(int state)
{ {
m_maincpu->set_input_line(INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE); machine().scheduler().synchronize(timer_expired_delegate(FUNC(chessmachine_device::reset_w_sync), this), state ? 1 : 0);
if (!m_bootrom_enabled && state)
install_bootrom(true);
} }

View File

@ -46,11 +46,12 @@ private:
devcb_write_line m_data_out; devcb_write_line m_data_out;
u8 m_latch[2] = { 0, 0 }; u8 m_latch[2];
void sync0_callback(s32 param); void data0_w_sync(int param);
void sync1_callback(s32 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); void install_bootrom(bool enable);
TIMER_DEVICE_CALLBACK_MEMBER(disable_bootrom) { install_bootrom(false); } TIMER_DEVICE_CALLBACK_MEMBER(disable_bootrom) { install_bootrom(false); }
u32 disable_bootrom_r(); u32 disable_bootrom_r();

View File

@ -147,7 +147,8 @@ public:
return m_ram[offset]; 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: protected:
dual_port_mailbox_ram_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) 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 class cbasebal_state : public driver_device
{ {
public: public:
cbasebal_state(const machine_config &mconfig, device_type type, const char *tag) cbasebal_state(const machine_config &mconfig, device_type type, const char *tag) :
: driver_device(mconfig, type, tag), driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"), m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"), m_palette(*this, "palette"),
@ -43,7 +43,8 @@ public:
m_scrollram(*this, "scrollram"), m_scrollram(*this, "scrollram"),
m_databank(*this, "databank"), m_databank(*this, "databank"),
m_opbank(*this, "opbank"), m_opbank(*this, "opbank"),
m_bankedram(*this, "bankedram") { } m_bankedram(*this, "bankedram")
{ }
void init_cbasebal(); void init_cbasebal();
void cbasebal(machine_config &config); void cbasebal(machine_config &config);
@ -366,13 +367,13 @@ static INPUT_PORTS_START( cbasebal )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read) 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_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_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_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 INPUT_PORTS_END

View File

@ -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, 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( 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, 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, 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 ) 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, 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, 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, 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, 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 ) 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); 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) 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); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);

View File

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

View File

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