diff --git a/src/mame/sinclair/tsconf.cpp b/src/mame/sinclair/tsconf.cpp index ebe7ec88a71..e0d0475dbb2 100644 --- a/src/mame/sinclair/tsconf.cpp +++ b/src/mame/sinclair/tsconf.cpp @@ -29,7 +29,6 @@ FAQ-RUS: https://forum.tslabs.info/viewtopic.php?f=35&t=157 TODO: - Ram cache -- VDos ****************************************************************************/ @@ -77,27 +76,32 @@ void tsconf_state::tsconf_mem(address_map &map) } void tsconf_state::tsconf_io(address_map &map) +{ + map(0x0000, 0xffff).lrw8( + NAME([this](offs_t offset) { return m_ioext.read_byte((m_beta->dos_io_r() << 16) | offset); }), + NAME([this](offs_t offset, u8 data) { m_ioext.write_byte((m_beta->dos_io_r() << 16) | offset, data); })); +} + +void tsconf_state::tsconf_ioext(address_map &map) { map.unmap_value_high(); - map(0x0000, 0x0000).mirror(0x7ffd).w(FUNC(tsconf_state::tsconf_port_7ffd_w)); - map(0x001f, 0x001f).mirror(0xff00).r(FUNC(tsconf_state::tsconf_port_xx1f_r)).w(m_beta, FUNC(beta_disk_device::command_w)); - map(0x003f, 0x003f).mirror(0xff00).rw(m_beta, FUNC(beta_disk_device::track_r), FUNC(beta_disk_device::track_w)); - map(0x0057, 0x0057).mirror(0xff00).rw(FUNC(tsconf_state::tsconf_port_57_zctr_r), FUNC(tsconf_state::tsconf_port_57_zctr_w)); // spi config - map(0x0077, 0x0077).mirror(0xff00).rw(FUNC(tsconf_state::tsconf_port_77_zctr_r), FUNC(tsconf_state::tsconf_port_77_zctr_w)); // spi data - map(0x005f, 0x005f).mirror(0xff00).rw(m_beta, FUNC(beta_disk_device::sector_r), FUNC(beta_disk_device::sector_w)); - map(0x007f, 0x007f).mirror(0xff00).rw(m_beta, FUNC(beta_disk_device::data_r), FUNC(beta_disk_device::data_w)); - map(0x00fe, 0x00fe).select(0xff00).rw(FUNC(tsconf_state::spectrum_ula_r), FUNC(tsconf_state::tsconf_ula_w)); - map(0x00ff, 0x00ff).mirror(0xff00).rw(m_beta, FUNC(beta_disk_device::state_r), FUNC(beta_disk_device::param_w)); - map(0x00af, 0x00af).select(0xff00).rw(FUNC(tsconf_state::tsconf_port_xxaf_r), FUNC(tsconf_state::tsconf_port_xxaf_w)); - map(0xfadf, 0xfadf).lr8(NAME([this]() -> u8 { return 0x80 | (m_io_mouse[2]->read() & 0x07); })); - map(0xfbdf, 0xfbdf).lr8(NAME([this]() -> u8 { return m_io_mouse[0]->read(); })); - map(0xffdf, 0xffdf).lr8(NAME([this]() -> u8 { return ~m_io_mouse[1]->read(); })); - map(0x8ff7, 0x8ff7).select(0x7000).w(FUNC(tsconf_state::tsconf_port_f7_w)); // 3:bff7 5:dff7 6:eff7 - map(0xbff7, 0xbff7).r(FUNC(tsconf_state::tsconf_port_f7_r)); - map(0x00fb, 0x00fb).mirror(0xff00).w(m_dac, FUNC(dac_byte_interface::data_w)); - map(0x80fd, 0x80fd).mirror(0x3f00).lw8(NAME([this](u8 data) { return m_ay[m_ay_selected]->data_w(data); })); - map(0xc0fd, 0xc0fd).mirror(0x3f00).lr8(NAME([this]() { return m_ay[m_ay_selected]->data_r(); })) + map(0x0000, 0x0000).mirror(0x17ffd).w(FUNC(tsconf_state::tsconf_port_7ffd_w)); + map(0x001f, 0x001f).mirror(0x0ff00).r(FUNC(tsconf_state::tsconf_port_xx1f_r)); + map(0x0057, 0x0057).mirror(0x1ff00).rw(FUNC(tsconf_state::tsconf_port_57_zctr_r), FUNC(tsconf_state::tsconf_port_57_zctr_w)); // spi config + map(0x0077, 0x0077).mirror(0x1ff00).rw(FUNC(tsconf_state::tsconf_port_77_zctr_r), FUNC(tsconf_state::tsconf_port_77_zctr_w)); // spi data + map(0x00fe, 0x00fe).select(0x1ff00).rw(FUNC(tsconf_state::spectrum_ula_r), FUNC(tsconf_state::tsconf_ula_w)); + map(0x00af, 0x00af).select(0x1ff00).rw(FUNC(tsconf_state::tsconf_port_xxaf_r), FUNC(tsconf_state::tsconf_port_xxaf_w)); + map(0xfadf, 0xfadf).mirror(0x10000).lr8(NAME([this]() -> u8 { return 0x80 | (m_io_mouse[2]->read() & 0x07); })); + map(0xfbdf, 0xfbdf).mirror(0x10000).lr8(NAME([this]() -> u8 { return m_io_mouse[0]->read(); })); + map(0xffdf, 0xffdf).mirror(0x10000).lr8(NAME([this]() -> u8 { return ~m_io_mouse[1]->read(); })); + map(0x8ff7, 0x8ff7).select(0x17000).w(FUNC(tsconf_state::tsconf_port_f7_w)); // 3:bff7 5:dff7 6:eff7 + map(0xbff7, 0xbff7).mirror(0x10000).r(FUNC(tsconf_state::tsconf_port_f7_r)); + map(0x00fb, 0x00fb).mirror(0x1ff00).w(m_dac, FUNC(dac_byte_interface::data_w)); + map(0x80fd, 0x80fd).mirror(0x13f00).lw8(NAME([this](u8 data) { return m_ay[m_ay_selected]->data_w(data); })); + map(0xc0fd, 0xc0fd).mirror(0x13f00).lr8(NAME([this]() { return m_ay[m_ay_selected]->data_r(); })) .w(FUNC(tsconf_state::tsconf_ay_address_w)); + + tsconf_beta_device::beta_ioext(m_beta, map); } void tsconf_state::tsconf_switch(address_map &map) @@ -176,6 +180,7 @@ void tsconf_state::machine_start() { spectrum_128_state::machine_start(); m_maincpu->space(AS_PROGRAM).specific(m_program); + m_bankio->space(AS_PROGRAM).specific(m_ioext); save_item(NAME(m_regs)); // TODO save'm'all! @@ -188,6 +193,8 @@ void tsconf_state::machine_start() void tsconf_state::machine_reset() { + m_update_on_m1 = false; + m_frame_irq_timer->adjust(attotime::never); m_scanline_irq_timer->adjust(attotime::never); m_int_mask = 0; @@ -219,8 +226,7 @@ void tsconf_state::machine_reset() m_regs[INT_MASK] = 0x01; // xxxxx001 m_regs[CACHE_CONFIG] &= 0xf0; // xxxx0000 - if (m_beta->started()) - m_beta->enable(); + m_beta->fddvirt_w(m_regs[FDD_VIRT] & 0x0f); m_zctl_cs = 1; m_zctl_di = 0xff; @@ -268,15 +274,16 @@ void tsconf_state::tsconf(machine_config &config) config.device_remove("palette"); Z80(config.replace(), m_maincpu, 14_MHz_XTAL / 4); - m_maincpu->set_addrmap(AS_PROGRAM, &tsconf_state::tsconf_mem); - m_maincpu->set_addrmap(AS_IO, &tsconf_state::tsconf_io); - m_maincpu->set_addrmap(AS_OPCODES, &tsconf_state::tsconf_switch); + m_maincpu->set_memory_map(&tsconf_state::tsconf_mem); + m_maincpu->set_io_map(&tsconf_state::tsconf_io); + m_maincpu->set_m1_map(&tsconf_state::tsconf_switch); m_maincpu->set_irq_acknowledge_callback(FUNC(tsconf_state::irq_vector)); m_maincpu->set_vblank_int("screen", FUNC(tsconf_state::tsconf_vblank_interrupt)); + ADDRESS_MAP_BANK(config, m_bankio).set_map(&tsconf_state::tsconf_ioext).set_options(ENDIANNESS_LITTLE, 8, 17, 0); zxbus_device &zxbus(ZXBUS(config, "zxbus", 0)); - zxbus.set_iospace("maincpu", AS_IO); + zxbus.set_iospace(m_bankio, AS_PROGRAM); ZXBUS_SLOT(config, "zxbus1", 0, "zxbus", zxbus_cards, nullptr); //ZXBUS_SLOT(config, "zxbus2", 0, "zxbus", zxbus_cards, nullptr); @@ -292,7 +299,10 @@ void tsconf_state::tsconf(machine_config &config) m_dma->out_sfile_callback().set(FUNC(tsconf_state::sfile_write16)); m_dma->on_ready_callback().set(FUNC(tsconf_state::dma_ready)); - BETA_DISK(config, m_beta, 0); + TSCONF_BETA(config, m_beta, 0); + m_beta->out_dos_callback().set([this](int state) { tsconf_update_bank0(); }); + m_beta->out_vdos_m1_callback().set([this](int state) { m_update_on_m1 = true; }); + SPI_SDCARD(config, m_sdcard, 0); m_sdcard->set_prefer_sdhc(); m_sdcard->spi_miso_callback().set(FUNC(tsconf_state::tsconf_spi_miso_w)); diff --git a/src/mame/sinclair/tsconf.h b/src/mame/sinclair/tsconf.h index 37dfe65b808..9888c183564 100644 --- a/src/mame/sinclair/tsconf.h +++ b/src/mame/sinclair/tsconf.h @@ -13,9 +13,9 @@ #include "spec128.h" #include "glukrs.h" +#include "tsconf_beta.h" #include "tsconfdma.h" -#include "beta_m.h" #include "machine/pckeybrd.h" #include "machine/spi_sdcard.h" #include "sound/ay8910.h" @@ -28,10 +28,11 @@ class tsconf_state : public spectrum_128_state public: tsconf_state(const machine_config &mconfig, device_type type, const char *tag) : spectrum_128_state(mconfig, type, tag) + , m_bankio(*this, "bankio") , m_bank0_rom(*this, "bank0_rom") , m_keyboard(*this, "pc_keyboard") , m_io_mouse(*this, "mouse_input%u", 1U) - , m_beta(*this, BETA_DISK_TAG) + , m_beta(*this, "beta") , m_dma(*this, "dma") , m_sdcard(*this, "sdcard") , m_glukrs(*this, "glukrs") @@ -155,6 +156,7 @@ private: INTERRUPT_GEN_MEMBER(tsconf_vblank_interrupt); IRQ_CALLBACK_MEMBER(irq_vector); u8 m_int_mask; + bool m_update_on_m1; DECLARE_VIDEO_START(tsconf); TILE_GET_INFO_MEMBER(get_tile_info_txt); @@ -193,6 +195,7 @@ private: u8 beta_disable_r(offs_t offset); void tsconf_io(address_map &map) ATTR_COLD; + void tsconf_ioext(address_map &map) ATTR_COLD; void tsconf_mem(address_map &map) ATTR_COLD; void tsconf_switch(address_map &map) ATTR_COLD; @@ -213,12 +216,14 @@ private: u8 m_regs[0x100]; memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_program; + memory_access<17, 0, 0, ENDIANNESS_LITTLE>::specific m_ioext; + required_device m_bankio; memory_view m_bank0_rom; required_device m_keyboard; required_ioport_array<3> m_io_mouse; - required_device m_beta; + required_device m_beta; required_device m_dma; required_device m_sdcard; u8 m_zctl_di = 0; diff --git a/src/mame/sinclair/tsconf_beta.cpp b/src/mame/sinclair/tsconf_beta.cpp new file mode 100644 index 00000000000..1a717245cee --- /dev/null +++ b/src/mame/sinclair/tsconf_beta.cpp @@ -0,0 +1,269 @@ +// license:BSD-3-Clause +// copyright-holders:Andrei I. Holub +/********************************************************************** + Beta TR-DOS with virtual drives +**********************************************************************/ + +#include "emu.h" +#include "tsconf_beta.h" + +#include "formats/trd_dsk.h" + + +// device type definition +DEFINE_DEVICE_TYPE(TSCONF_BETA, tsconf_beta_device, "tsconf_beta", "Virtual TR-DOS") + + +tsconf_beta_device::tsconf_beta_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, TSCONF_BETA, tag, owner, clock) + , m_out_dos_cb(*this) + , m_out_vdos_m1_cb(*this) + , m_wd179x(*this, "wd179x") + , m_floppy(*this, "wd179x:%u", 0U) + , m_floppy_led(*this, "fdd%u_led", 0U) + , m_control(0) + , m_motor_active(false) +{ +} + +bool tsconf_beta_device::pre_vg_in_check() +{ + if (m_dos) + { + if (m_vdos) + { + m_vdos = false; + m_out_dos_cb(0); + return false; + } + else if ((1 << (m_control & 3)) & m_fddvirt) + { + m_out_vdos_m1_cb(1); + return false; + } + } + + return true; +} + +u8 tsconf_beta_device::status_r() +{ + return pre_vg_in_check() ? m_wd179x->status_r() : 0xff; +} + +u8 tsconf_beta_device::track_r() +{ + return pre_vg_in_check() ? m_wd179x->track_r() : 0xff; +} + +u8 tsconf_beta_device::sector_r() +{ + return pre_vg_in_check() ? m_wd179x->sector_r() : 0xff; +} + +u8 tsconf_beta_device::data_r() +{ + return pre_vg_in_check() ? m_wd179x->data_r() : 0xff; +} + +u8 tsconf_beta_device::state_r() +{ + if (pre_vg_in_check()) + { + u8 result = 0x3f; // actually open bus + result |= m_wd179x->drq_r() ? 0x40 : 0; + result |= m_wd179x->intrq_r() ? 0x80 : 0; + return result; + } + else + { + return 0xff; + } +} + +bool tsconf_beta_device::pre_vg_out_check(bool is_port_match = true) +{ + if (m_dos) + { + if (m_vdos) + { + if (is_port_match) + { + m_vdos = false; + m_out_dos_cb(0); + return false; + } + } + else if ((1 << (m_control & 3)) & m_fddvirt) + { + m_vdos = true; + m_out_dos_cb(0); + return false; + } + } + + return true; +} + +void tsconf_beta_device::param_w(offs_t offset, u8 data) +{ + if (pre_vg_out_check((offset & 0x60) != 0x60)) // not through 0xff + { + m_control = data; + floppy_image_device* floppy = m_floppy[data & 3]->get_device(); + m_wd179x->set_floppy(floppy); + + if (!m_vdos) + { + floppy->ss_w(BIT(data, 4) ? 0 : 1); + m_wd179x->dden_w(BIT(data, 6)); + m_wd179x->mr_w(BIT(data, 2)); + + m_wd179x->hlt_w(BIT(data, 3)); + + motors_control(); + } + } +} + +void tsconf_beta_device::command_w(u8 data) +{ + if (pre_vg_out_check()) + { + m_wd179x->cmd_w(data); + } +} + +void tsconf_beta_device::track_w(u8 data) +{ + if (pre_vg_out_check()) + { + m_wd179x->track_w(data); + } +} + +void tsconf_beta_device::sector_w(u8 data) +{ + if (pre_vg_out_check()) + { + m_wd179x->sector_w(data); + } +} + +void tsconf_beta_device::data_w(u8 data) +{ + if (pre_vg_out_check()) + { + m_wd179x->data_w(data); + } +} + +void tsconf_beta_device::turbo_w(int state) +{ + m_wd179x->set_clock_scale(1 << (state & 1)); +} + +void tsconf_beta_device::on_m1_w() +{ + m_vdos = true; + m_out_dos_cb(0); +} + +void tsconf_beta_device::enable_w(bool state) +{ + if ((state && !m_dos) || (!state && m_dos && !m_vdos)) + { + m_dos = state; + m_out_dos_cb(state); + } +} + +void tsconf_beta_device::fddvirt_w(u8 fddvirt) +{ + m_fddvirt = fddvirt & 0x0f; +} + +void tsconf_beta_device::io_forced_w(bool io_forced) +{ + m_io_forced = io_forced; +} + +void tsconf_beta_device::fdc_hld_w(int state) +{ + m_wd179x->set_force_ready(state); // HLD connected to RDY pin + m_motor_active = state; + motors_control(); +} + +void tsconf_beta_device::motors_control() +{ + for (int i = 0; i < 4; i++) + { + if (m_motor_active && (m_control & 3) == i) + { + m_floppy[i]->get_device()->mon_w(CLEAR_LINE); + m_floppy_led[i] = 1; + } + else + { + m_floppy[i]->get_device()->mon_w(ASSERT_LINE); + m_floppy_led[i] = 0; + } + } +} + +void tsconf_beta_device::beta_ioext(const device_finder &finder, address_map &map) +{ + map(0x1001f, 0x1001f).mirror(0xff00).rw(finder, FUNC(tsconf_beta_device::status_r), FUNC(tsconf_beta_device::command_w)); + map(0x1003f, 0x1003f).mirror(0xff00).rw(finder, FUNC(tsconf_beta_device::track_r), FUNC(tsconf_beta_device::track_w)); + map(0x1005f, 0x1005f).mirror(0xff00).rw(finder, FUNC(tsconf_beta_device::sector_r), FUNC(tsconf_beta_device::sector_w)); + map(0x1007f, 0x1007f).mirror(0xff00).rw(finder, FUNC(tsconf_beta_device::data_r), FUNC(tsconf_beta_device::data_w)); + map(0x1009f, 0x1009f).select(0xff60).rw(finder, FUNC(tsconf_beta_device::state_r), FUNC(tsconf_beta_device::param_w)); +} + +void tsconf_beta_device::floppy_formats(format_registration &fr) +{ + fr.add_mfm_containers(); + fr.add_pc_formats(); + fr.add(FLOPPY_TRD_FORMAT); +} + +static void beta_disk_floppies(device_slot_interface &device) +{ + device.option_add("525hd", FLOPPY_525_HD); + device.option_add("525qd", FLOPPY_525_QD); + device.option_add("35hd", FLOPPY_35_HD); + device.option_add("35dd", FLOPPY_35_DD); +} + +void tsconf_beta_device::device_start() +{ + save_item(NAME(m_control)); + save_item(NAME(m_motor_active)); + save_item(NAME(m_dos)); + save_item(NAME(m_vdos)); + save_item(NAME(m_io_forced)); + save_item(NAME(m_fddvirt)); + + m_floppy_led.resolve(); +} + +void tsconf_beta_device::device_reset() +{ + m_control = 0; + for (int i = 0; i < m_floppy_led.size(); i++) + m_floppy_led[i] = 0; + + m_dos = false; + m_vdos = false; + m_io_forced = false; + m_fddvirt = 0; +} + +void tsconf_beta_device::device_add_mconfig(machine_config &config) +{ + KR1818VG93(config, m_wd179x, 8_MHz_XTAL / 8); + m_wd179x->hld_wr_callback().set(FUNC(tsconf_beta_device::fdc_hld_w)); + for (auto &floppy : m_floppy) + FLOPPY_CONNECTOR(config, floppy, beta_disk_floppies, "525qd", tsconf_beta_device::floppy_formats).enable_sound(true); +} diff --git a/src/mame/sinclair/tsconf_beta.h b/src/mame/sinclair/tsconf_beta.h new file mode 100644 index 00000000000..95b3e9023ec --- /dev/null +++ b/src/mame/sinclair/tsconf_beta.h @@ -0,0 +1,72 @@ +// license:BSD-3-Clause +// copyright-holders:Andrei I. Holub +#ifndef MAME_SINCLAIR_TSCONF_BETA_H +#define MAME_SINCLAIR_TSCONF_BETA_H + +#pragma once + +#include "machine/wd_fdc.h" +#include "imagedev/floppy.h" + +class tsconf_beta_device : public device_t +{ +public: + tsconf_beta_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + auto out_dos_callback() { return m_out_dos_cb.bind(); } + auto out_vdos_m1_callback() { return m_out_vdos_m1_cb.bind(); } + + u8 status_r(); + u8 track_r(); + u8 sector_r(); + u8 data_r(); + u8 state_r(); + + void param_w(offs_t offset, u8 data); + void command_w(u8 data); + void track_w(u8 data); + void sector_w(u8 data); + void data_w(u8 data); + void turbo_w(int state); + + static void beta_ioext(const device_finder &finder, address_map &map); + void on_m1_w(); + bool dos_r() { return m_dos; } + bool vdos_r() { return m_vdos; } + bool dos_io_r() { return m_dos || m_io_forced; } + void enable_w(bool state); + void fddvirt_w(u8 fddvirt); + void io_forced_w(bool io_forced); + +protected: + virtual void device_start() override ATTR_COLD; + virtual void device_reset() override ATTR_COLD; + virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; + + devcb_write_line m_out_dos_cb; + devcb_write_line m_out_vdos_m1_cb; + +private: + required_device m_wd179x; + required_device_array m_floppy; + output_finder<4> m_floppy_led; + void fdc_hld_w(int state); + void motors_control(); + u8 m_control; + bool m_motor_active; + + static void floppy_formats(format_registration &fr); + + bool m_dos; + bool m_vdos; + bool m_io_forced; + u8 m_fddvirt; + + bool pre_vg_in_check(); + bool pre_vg_out_check(bool is_port_match); +}; + + +DECLARE_DEVICE_TYPE(TSCONF_BETA, tsconf_beta_device) + +#endif // MAME_SINCLAIR_TSCONF_BETA_H diff --git a/src/mame/sinclair/tsconf_m.cpp b/src/mame/sinclair/tsconf_m.cpp index 92f9678fd17..0e0907e48c4 100644 --- a/src/mame/sinclair/tsconf_m.cpp +++ b/src/mame/sinclair/tsconf_m.cpp @@ -66,13 +66,13 @@ void tsconf_state::tsconf_update_bank0() if (!NW0_MAP) { /* ROM: 0-SYS, 1-DOS, 2-128, 3-48 */ - page0 = m_beta->started() && m_beta->is_active() ? ROM128 : (0x02 | ROM128); - page0 |= (m_regs[PAGE0] & 0xfc); + page0 &= 0xfc; + page0 |= m_beta->dos_r() ? ROM128 : (0x02 | ROM128); } - if (W0_RAM) + if (W0_RAM || m_beta->vdos_r()) { - m_bank_ram[0]->set_entry(page0); + m_bank_ram[0]->set_entry(m_beta->vdos_r() ? 0xff : page0); m_bank0_rom.disable(); } else @@ -393,6 +393,8 @@ void tsconf_state::ram_bank_write(u8 bank, offs_t offset, u8 data) if (bank > 0 || (W0_WE && W0_RAM)) ram_page_write(m_regs[PAGE0 + bank], offset, data); + else if (!bank && m_beta->vdos_r()) + ram_page_write(0xff, offset, data); } void tsconf_state::ram_page_write(u8 page, offs_t offset, u8 data) @@ -472,9 +474,7 @@ void tsconf_state::sfile_write16(offs_t offset, u16 data) } u8 tsconf_state::tsconf_port_xx1f_r(offs_t offset) { - return m_beta->started() && m_beta->is_active() - ? m_beta->status_r() - : 0x00; // TODO kempston read + return 0x00; // TODO kempston read } void tsconf_state::tsconf_port_7ffd_w(u8 data) @@ -681,11 +681,15 @@ void tsconf_state::tsconf_port_xxaf_w(offs_t port, u8 data) update_frame_timer(); break; + case FDD_VIRT: + m_beta->io_forced_w(BIT(data, 7)); + m_beta->fddvirt_w(data & 0x0f); + break; + case FMAPS: case TS_CONFIG: case INT_MASK: // TODO - case FDD_VIRT: case CACHE_CONFIG: break; @@ -869,7 +873,7 @@ INTERRUPT_GEN_MEMBER(tsconf_state::tsconf_vblank_interrupt) void tsconf_state::dma_ready(int line) { - if (BIT(m_regs[INT_MASK], 2)) + if (BIT(m_regs[INT_MASK], 2) && !(m_beta->vdos_r() || m_update_on_m1)) { m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); m_int_mask |= 4; @@ -878,7 +882,7 @@ void tsconf_state::dma_ready(int line) TIMER_CALLBACK_MEMBER(tsconf_state::irq_frame) { - if (BIT(m_regs[INT_MASK], 0)) + if (BIT(m_regs[INT_MASK], 0) && !(m_beta->vdos_r() || m_update_on_m1)) { m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); m_irq_off_timer->adjust(attotime::from_ticks(32, m_maincpu->unscaled_clock())); @@ -888,7 +892,7 @@ TIMER_CALLBACK_MEMBER(tsconf_state::irq_frame) TIMER_CALLBACK_MEMBER(tsconf_state::irq_scanline) { - if (BIT(m_regs[INT_MASK], 1)) + if (BIT(m_regs[INT_MASK], 1) && !(m_beta->vdos_r() || m_update_on_m1)) { m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); m_int_mask |= 2; @@ -947,6 +951,11 @@ TIMER_CALLBACK_MEMBER(tsconf_state::irq_scanline) u8 tsconf_state::beta_neutral_r(offs_t offset) { + if (!machine().side_effects_disabled() && m_update_on_m1) + { + m_update_on_m1 = false; + m_beta->on_m1_w(); + } return m_program.read_byte(offset); } @@ -954,13 +963,14 @@ u8 tsconf_state::beta_enable_r(offs_t offset) { if (!machine().side_effects_disabled()) { - if (!W0_RAM && m_bank_rom[0]->entry() == 3) + if (m_update_on_m1) { - if (m_beta->started() && !m_beta->is_active()) - { - m_beta->enable(); - tsconf_update_bank0(); - } + m_update_on_m1 = false; + m_beta->on_m1_w(); + } + if (ROM128 && !NW0_MAP) + { + m_beta->enable_w(1); } } return m_program.read_byte(offset + 0x3d00); @@ -970,11 +980,12 @@ u8 tsconf_state::beta_disable_r(offs_t offset) { if (!machine().side_effects_disabled()) { - if (m_beta->started() && m_beta->is_active()) + if (m_update_on_m1) { - m_beta->disable(); - tsconf_update_bank0(); + m_update_on_m1 = false; + m_beta->on_m1_w(); } + m_beta->enable_w(0); } return m_program.read_byte(offset + 0x4000); }