vtech2: added one waitstate to resolve MT 07094 and MT 07141.

This commit is contained in:
Robbbert 2020-08-19 20:58:04 +10:00
parent a0c1a32429
commit d5b09f7cbf
3 changed files with 37 additions and 1 deletions

View File

@ -510,7 +510,7 @@ void vtech2_state::laser350(machine_config &config)
CASSETTE(config, m_cassette);
m_cassette->set_formats(vtech2_cassette_formats);
m_cassette->set_default_state(CASSETTE_PLAY);
m_cassette->set_default_state(CASSETTE_STOPPED);
m_cassette->add_route(ALL_OUTPUTS, "mono", 0.05);
VTECH_IOEXP_SLOT(config, "io").set_io_space(m_maincpu, AS_IO);

View File

@ -75,6 +75,8 @@ private:
void m_map500(address_map &map);
void m_map700(address_map &map);
void init_waitstates();
required_device<cpu_device> m_maincpu;
required_device<speaker_sound_device> m_speaker;
required_device<cassette_image_device> m_cassette;

View File

@ -27,6 +27,8 @@ static const uint8_t laser_fdc_wrprot[2] = {0x80, 0x80};
void vtech2_state::init_laser()
{
init_waitstates();
uint8_t *gfx = memregion("gfx2")->base();
int i;
@ -99,6 +101,38 @@ uint8_t vtech2_state::cart_r(offs_t offset)
return m_cart->read_rom(offset);
}
// The ULA inserts one waitstate for every read and write in each space (MT 07094, MT 07141)
void vtech2_state::init_waitstates()
{
address_space &mem = m_maincpu->space(AS_PROGRAM);
address_space &io = m_maincpu->space(AS_IO);
mem.install_read_tap(0x0000, 0xffff, "mem_wait_r", [this](offs_t offset, u8 &data, u8 mem_mask)
{
if (!machine().side_effects_disabled())
m_maincpu->adjust_icount(-1);
return data;
});
mem.install_write_tap(0x0000, 0xffff, "mem_wait_w", [this](offs_t offset, u8 &data, u8 mem_mask)
{
if (!machine().side_effects_disabled())
m_maincpu->adjust_icount(-1);
return data;
});
io.install_read_tap(0x00, 0xff, "io_wait_r", [this](offs_t offset, u8 &data, u8 mem_mask)
{
if (!machine().side_effects_disabled())
m_maincpu->adjust_icount(-1);
return data;
});
io.install_write_tap(0x00, 0xff, "io_wait_w", [this](offs_t offset, u8 &data, u8 mem_mask)
{
if (!machine().side_effects_disabled())
m_maincpu->adjust_icount(-1);
return data;
});
}
/*************************************************
* memory mapped I/O read