From 41fb106f07b0a78a6af973e131ce60369da9e1a1 Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 9 Mar 2019 17:18:26 -0500 Subject: tti: Fix ASC addressing; add more handlers (nw) --- src/mame/drivers/tti.cpp | 64 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/tti.cpp b/src/mame/drivers/tti.cpp index 54077ada8a2..0e0c3642858 100644 --- a/src/mame/drivers/tti.cpp +++ b/src/mame/drivers/tti.cpp @@ -32,11 +32,22 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_mfp(*this, "mfp") + , m_asc(*this, "scsibus:7:asc") + , m_dma_address(0) { } void tti(machine_config &config); +protected: + virtual void machine_start() override; + private: + u8 asc_r(offs_t offset); + void asc_w(offs_t offset, u8 data); + void dma_address_w(offs_t offset, u8 data); + u8 io_status_r(); + void channel_w(u8 data); + void asc_config(device_t *device); IRQ_CALLBACK_MEMBER(intack); @@ -45,8 +56,16 @@ private: required_device m_maincpu; required_device m_mfp; + required_device m_asc; + + u32 m_dma_address; }; +void tti_state::machine_start() +{ + save_item(NAME(m_dma_address)); +} + IRQ_CALLBACK_MEMBER(tti_state::intack) { return m_mfp->get_vector(); @@ -55,13 +74,56 @@ IRQ_CALLBACK_MEMBER(tti_state::intack) static INPUT_PORTS_START( tti ) INPUT_PORTS_END +u8 tti_state::asc_r(offs_t offset) +{ + return m_asc->read(offset ^ 1); +} + +void tti_state::asc_w(offs_t offset, u8 data) +{ + m_asc->write(offset ^ 1, data); +} + +void tti_state::dma_address_w(offs_t offset, u8 data) +{ + m_dma_address &= ~(0xff000000 >> (offset * 8)); + m_dma_address |= u32(data) << (24 - offset * 8); +} + +u8 tti_state::io_status_r() +{ + return 0; +} + +void tti_state::channel_w(u8 data) +{ + switch (data & 0x03) + { + case 0: + m_mfp->i4_w(0); + break; + + case 1: + m_mfp->i3_w(0); + break; + + case 3: + m_mfp->i5_w(0); + break; + } +} + void tti_state::prg_map(address_map &map) { map(0x00000, 0x07fff).rom().region("maincpu", 0); map(0x7e000, 0x7ffff).ram(); map(0x80000, 0x80017).rw(m_mfp, FUNC(mc68901_device::read), FUNC(mc68901_device::write)); - map(0x80020, 0x8002b).m("scsibus:7:asc", FUNC(ncr53c90a_device::map)); + map(0x80018, 0x8001f).ram(); + map(0x80020, 0x8002b).rw(FUNC(tti_state::asc_r), FUNC(tti_state::asc_w)); map(0x80070, 0x80077).w("bitlatch", FUNC(ls259_device::write_d0)); + map(0x80078, 0x8007b).w(FUNC(tti_state::dma_address_w)); + map(0x8007c, 0x8007c).r(FUNC(tti_state::io_status_r)); + map(0x8007d, 0x8007d).w(FUNC(tti_state::channel_w)); } static void tti_scsi_devices(device_slot_interface &device) -- cgit v1.2.3