From e374175e9f3956e956125d83a15d7bec059c6ff3 Mon Sep 17 00:00:00 2001 From: AJR Date: Thu, 23 Feb 2023 15:07:32 -0500 Subject: abc806, abc1600: Use addressable latch devices --- src/mame/luxor/abc1600.cpp | 166 +++++++++++++++++++++++++++------------------ src/mame/luxor/abc1600.h | 8 ++- src/mame/luxor/abc80x.cpp | 106 +++++++++++++++++++---------- src/mame/luxor/abc80x.h | 9 +++ 4 files changed, 185 insertions(+), 104 deletions(-) diff --git a/src/mame/luxor/abc1600.cpp b/src/mame/luxor/abc1600.cpp index 1b7a92e701e..727d0a89d4c 100644 --- a/src/mame/luxor/abc1600.cpp +++ b/src/mame/luxor/abc1600.cpp @@ -49,6 +49,8 @@ #include "emu.h" #include "abc1600.h" + +#include "machine/74259.h" #include "softlist_dev.h" @@ -56,7 +58,8 @@ // CONSTANTS / MACROS //************************************************************************** -#define LOG 0 +#define VERBOSE 0 +#include "logmacro.h" #define A1 BIT(offset, 1) @@ -126,7 +129,7 @@ uint8_t abc1600_state::bus_r(offs_t offset) // EXP data = m_bus0x->exp_r(); - if (LOG) logerror("%s EXP %02x: %02x\n", machine().describe_context(), cs, data); + LOG("%s EXP %02x: %02x\n", machine().describe_context(), cs, data); } else { @@ -170,7 +173,7 @@ uint8_t abc1600_state::bus_r(offs_t offset) data = 0xfc | (m_csb & 0x03); } - if (LOG) logerror("%s RCSB %02x\n", machine().describe_context(), data); + LOG("%s RCSB %02x\n", machine().describe_context(), data); } } else @@ -191,7 +194,7 @@ uint8_t abc1600_state::bus_r(offs_t offset) data &= m_bus2->read_inp(); } - if (LOG) logerror("%s INP %02x: %02x\n", machine().describe_context(), cs, data); + LOG("%s INP %02x: %02x\n", machine().describe_context(), cs, data); break; case STAT: @@ -206,7 +209,7 @@ uint8_t abc1600_state::bus_r(offs_t offset) data &= m_bus2->read_stat(); } - if (LOG) logerror("%s STAT %02x: %02x\n", machine().describe_context(), cs, data); + LOG("%s STAT %02x: %02x\n", machine().describe_context(), cs, data); break; case OPS: @@ -221,11 +224,11 @@ uint8_t abc1600_state::bus_r(offs_t offset) data &= m_bus2->ops_r(); } - if (LOG) logerror("%s OPS %02x: %02x\n", machine().describe_context(), cs, data); + LOG("%s OPS %02x: %02x\n", machine().describe_context(), cs, data); break; default: - if (LOG) logerror("%s Unmapped read from virtual I/O %06x\n", machine().describe_context(), offset); + LOG("%s Unmapped read from virtual I/O %06x\n", machine().describe_context(), offset); } } @@ -249,7 +252,7 @@ void abc1600_state::bus_w(offs_t offset, uint8_t data) switch ((offset >> 1) & 0x07) { case OUT: - if (LOG) logerror("%s OUT %02x: %02x\n", machine().describe_context(), cs, data); + LOG("%s OUT %02x: %02x\n", machine().describe_context(), cs, data); if (m_bus0) { @@ -264,7 +267,7 @@ void abc1600_state::bus_w(offs_t offset, uint8_t data) break; case C1: - if (LOG) logerror("%s C1 %02x: %02x\n", machine().describe_context(), cs, data); + LOG("%s C1 %02x: %02x\n", machine().describe_context(), cs, data); if (m_bus0) { @@ -279,7 +282,7 @@ void abc1600_state::bus_w(offs_t offset, uint8_t data) break; case C2: - if (LOG) logerror("%s C2 %02x: %02x\n", machine().describe_context(), cs, data); + LOG("%s C2 %02x: %02x\n", machine().describe_context(), cs, data); if (m_bus0) { @@ -294,7 +297,7 @@ void abc1600_state::bus_w(offs_t offset, uint8_t data) break; case C3: - if (LOG) logerror("%s C3 %02x: %02x\n", machine().describe_context(), cs, data); + LOG("%s C3 %02x: %02x\n", machine().describe_context(), cs, data); if (m_bus0) { @@ -309,7 +312,7 @@ void abc1600_state::bus_w(offs_t offset, uint8_t data) break; case C4: - if (LOG) logerror("%s C4 %02x: %02x\n", machine().describe_context(), cs, data); + LOG("%s C4 %02x: %02x\n", machine().describe_context(), cs, data); if (m_bus0) { @@ -324,7 +327,7 @@ void abc1600_state::bus_w(offs_t offset, uint8_t data) break; default: - if (LOG) logerror("%s Unmapped write %02x to virtual I/O %06x\n", machine().describe_context(), data, offset); + LOG("%s Unmapped write %02x to virtual I/O %06x\n", machine().describe_context(), data, offset); } } @@ -350,7 +353,7 @@ void abc1600_state::fw0_w(uint8_t data) */ - if (LOG) logerror("%s FW0 %02x\n", machine().describe_context(), data); + LOG("%s FW0 %02x\n", machine().describe_context(), data); // drive select floppy_image_device *floppy = nullptr; @@ -376,21 +379,21 @@ void abc1600_state::fw1_w(uint8_t data) bit description - 0 MR - 1 DDEN - 2 HLT - 3 MINI - 4 HLD - 5 P0 - 6 P1 - 7 P2 + 0 MR (FD1797) + 1 DDEN (FD1797, 9229B) + 2 HLT (FD1797) + 3 MINI (9229B) + 4 HLD (9229B) + 5 P0 (9229B) + 6 P1 (9229B) + 7 P2 (9229B) */ - if (LOG) logerror("%s FW1 %02x\n", machine().describe_context(), data); + LOG("%s FW1 %02x\n", machine().describe_context(), data); // FDC master reset - if (!BIT(data, 0)) m_fdc->reset(); + m_fdc->mr_w(BIT(data, 0)); // density select m_fdc->dden_w(BIT(data, 1)); @@ -398,56 +401,82 @@ void abc1600_state::fw1_w(uint8_t data) //------------------------------------------------- -// spec_contr_reg_w - +// cs7_w - CS7 output handler //------------------------------------------------- -void abc1600_state::spec_contr_reg_w(uint8_t data) +WRITE_LINE_MEMBER(abc1600_state::cs7_w) { - int state = BIT(data, 3); + LOG("%s CS7 %d\n", machine().describe_context(), state); - if (LOG) logerror("%s SPEC CONTR REG %u:%u\n", machine().describe_context(), data & 0x07, state); + m_cs7 = state; +} - switch (data & 0x07) - { - case 0: // CS7 - m_cs7 = state; - break; - case 1: - break; +//------------------------------------------------- +// btce_w - _BTCE output handler +//------------------------------------------------- - case 2: // _BTCE - m_btce = state; - break; +WRITE_LINE_MEMBER(abc1600_state::btce_w) +{ + LOG("%s _BTCE %d\n", machine().describe_context(), state); - case 3: // _ATCE - m_atce = state; - break; + m_btce = state; +} - case 4: // PARTST - m_mac->partst_w(state); - break; - case 5: // _DMADIS - m_dmadis = state; - break; +//------------------------------------------------- +// atce_w - _ATCE output handler +//------------------------------------------------- - case 6: // SYSSCC - m_sysscc = state; +WRITE_LINE_MEMBER(abc1600_state::atce_w) +{ + LOG("%s _ATCE %d\n", machine().describe_context(), state); - m_cio->pb5_w(!state); + m_atce = state; +} - update_drdy1(0); - break; - case 7: // SYSFS - m_sysfs = state; +//------------------------------------------------- +// dmadis_w - _DMADIS output handler +//------------------------------------------------- - m_cio->pb6_w(!state); +WRITE_LINE_MEMBER(abc1600_state::dmadis_w) +{ + LOG("%s _DMADIS %d\n", machine().describe_context(), state); - update_drdy0(0); - break; - } + m_dmadis = state; +} + + +//------------------------------------------------- +// sysscc_w - SYSSCC output handler +//------------------------------------------------- + +WRITE_LINE_MEMBER(abc1600_state::sysscc_w) +{ + LOG("%s SYSSCC %d\n", machine().describe_context(), state); + + m_sysscc = state; + + m_cio->pb5_w(!state); + + update_drdy1(0); +} + + +//------------------------------------------------- +// sysfs_w - SYSFS output handler +//------------------------------------------------- + +WRITE_LINE_MEMBER(abc1600_state::sysfs_w) +{ + LOG("%s SYSFS %d\n", machine().describe_context(), state); + + m_sysfs = state; + + m_cio->pb6_w(!state); + + update_drdy0(0); } @@ -492,7 +521,7 @@ void abc1600_state::mac_mem(address_map &map) map(0x1ffb00, 0x1ffb00).mirror(0x7e).w(FUNC(abc1600_state::fw0_w)); map(0x1ffb01, 0x1ffb01).mirror(0x7e).w(FUNC(abc1600_state::fw1_w)); map(0x1ffd00, 0x1ffd07).mirror(0xf8).w(ABC1600_MAC_TAG, FUNC(abc1600_mac_device::dmamap_w)); - map(0x1ffe00, 0x1ffe00).mirror(0xff).w(FUNC(abc1600_state::spec_contr_reg_w)); + map(0x1ffe00, 0x1ffe00).mirror(0xff).w("spec_contr_reg", FUNC(ls259_device::write_nibble_d3)); } @@ -753,7 +782,7 @@ void abc1600_state::cio_pc_w(uint8_t data) int rtc_cs = BIT(data, 2); int nvram_cs = BIT(data, 3); - if (LOG) logerror("CLK %u DATA %u RTC %u NVRAM %u\n", clock, data_out, rtc_cs, nvram_cs); + LOG("CLK %u DATA %u RTC %u NVRAM %u\n", clock, data_out, rtc_cs, nvram_cs); m_rtc->cs_w(rtc_cs); m_rtc->dio_w(data_out); @@ -822,12 +851,6 @@ void abc1600_state::machine_start() void abc1600_state::machine_reset() { - // clear special control register - for (int i = 0; i < 8; i++) - { - spec_contr_reg_w(i); - } - // clear floppy registers fw0_w(0); fw1_w(0); @@ -867,6 +890,15 @@ void abc1600_state::abc1600(machine_config &config) m_mac->in_tren2_cb().set(m_bus2, FUNC(abcbus_slot_device::read_tren)); m_mac->out_tren2_cb().set(m_bus2, FUNC(abcbus_slot_device::write_tren)); + ls259_device &spec_contr_reg(LS259(config, "spec_contr_reg")); // Special Control Register @ 13E + spec_contr_reg.q_out_cb<0>().set(FUNC(abc1600_state::cs7_w)); + spec_contr_reg.q_out_cb<2>().set(FUNC(abc1600_state::btce_w)); + spec_contr_reg.q_out_cb<3>().set(FUNC(abc1600_state::atce_w)); + spec_contr_reg.q_out_cb<4>().set(m_mac, FUNC(abc1600_mac_device::partst_w)); + spec_contr_reg.q_out_cb<5>().set(FUNC(abc1600_state::dmadis_w)); + spec_contr_reg.q_out_cb<6>().set(FUNC(abc1600_state::sysscc_w)); + spec_contr_reg.q_out_cb<7>().set(FUNC(abc1600_state::sysfs_w)); + Z80DMA(config, m_dma0, 64_MHz_XTAL / 16); m_dma0->out_busreq_callback().set(FUNC(abc1600_state::dbrq_w)); m_dma0->out_bao_callback().set(m_dma1, FUNC(z80dma_device::bai_w)); @@ -945,7 +977,7 @@ void abc1600_state::abc1600(machine_config &config) E0516(config, E050_C16PC_TAG, 32.768_kHz_XTAL); - FD1797(config, m_fdc, 64_MHz_XTAL / 64); + FD1797(config, m_fdc, 64_MHz_XTAL / 64); // clocked by 9229B m_fdc->intrq_wr_callback().set(m_cio, FUNC(z8536_device::pb7_w)); m_fdc->drq_wr_callback().set(FUNC(abc1600_state::update_drdy0)); diff --git a/src/mame/luxor/abc1600.h b/src/mame/luxor/abc1600.h index 58b63e7b195..d9391b68f27 100644 --- a/src/mame/luxor/abc1600.h +++ b/src/mame/luxor/abc1600.h @@ -121,7 +121,13 @@ private: void cio_w(offs_t offset, uint8_t data); void fw0_w(uint8_t data); void fw1_w(uint8_t data); - void spec_contr_reg_w(uint8_t data); + + DECLARE_WRITE_LINE_MEMBER(cs7_w); + DECLARE_WRITE_LINE_MEMBER(btce_w); + DECLARE_WRITE_LINE_MEMBER(atce_w); + DECLARE_WRITE_LINE_MEMBER(dmadis_w); + DECLARE_WRITE_LINE_MEMBER(sysscc_w); + DECLARE_WRITE_LINE_MEMBER(sysfs_w); void dbrq_w(int state); diff --git a/src/mame/luxor/abc80x.cpp b/src/mame/luxor/abc80x.cpp index c08c65d8ea4..b2a88c19892 100644 --- a/src/mame/luxor/abc80x.cpp +++ b/src/mame/luxor/abc80x.cpp @@ -789,43 +789,66 @@ uint8_t abc806_state::sti_r() void abc806_state::sto_w(uint8_t data) { - int level = BIT(data, 7); + m_sto->write_bit(data & 0x07, BIT(data, 7)); +} - switch (data & 0x07) - { - case 0: - // external memory enable - LOG("%s EME %u\n", machine().describe_context(), level); - m_eme = level; - break; - case 1: - // 40/80 column display - m_40 = level; - break; - case 2: - // HRU II address line 8, PROT A0 - m_hru2_a8 = level; - break; - case 3: - // PROT INI - break; - case 4: - // text display enable - m_txoff = level; - break; - case 5: - // RTC chip select - m_rtc->cs_w(!level); - break; - case 6: - // RTC clock - m_rtc->clk_w(level); - break; - case 7: - // RTC data in, PROT DIN - m_rtc->dio_w(level); - break; - } + +//------------------------------------------------- +// eme_w - external memory enable +//------------------------------------------------- + +WRITE_LINE_MEMBER(abc806_state::eme_w) +{ + LOG("%s EME %u\n", machine().describe_context(), state); + m_eme = state; +} + + +//------------------------------------------------- +// _40_w - 40/80 column display +//------------------------------------------------- + +WRITE_LINE_MEMBER(abc806_state::_40_w) +{ + m_40 = state; +} + + +//------------------------------------------------- +// hru2_a8_w - HRU II address line 8, PROT A0 +//------------------------------------------------- + +WRITE_LINE_MEMBER(abc806_state::hru2_a8_w) +{ + m_hru2_a8 = state; +} + + +//------------------------------------------------- +// prot_ini_w - PROT INI +//------------------------------------------------- + +WRITE_LINE_MEMBER(abc806_state::prot_ini_w) +{ +} + + +//------------------------------------------------- +// txoff_w - text display enable +//------------------------------------------------- + +WRITE_LINE_MEMBER(abc806_state::txoff_w) +{ + m_txoff = state; +} + + +//------------------------------------------------- +// prot_din_w - PROT DIN +//------------------------------------------------- + +WRITE_LINE_MEMBER(abc806_state::prot_din_w) +{ } @@ -2176,6 +2199,17 @@ void abc806_state::abc806(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &abc806_state::abc806_mem); m_maincpu->set_addrmap(AS_IO, &abc806_state::abc806_io); + LS259(config, m_sto); // 74ALS259 @ 13G + m_sto->q_out_cb<0>().set(FUNC(abc806_state::eme_w)); + m_sto->q_out_cb<1>().set(FUNC(abc806_state::_40_w)); + m_sto->q_out_cb<2>().set(FUNC(abc806_state::hru2_a8_w)); + m_sto->q_out_cb<3>().set(FUNC(abc806_state::prot_ini_w)); + m_sto->q_out_cb<4>().set(FUNC(abc806_state::txoff_w)); + m_sto->q_out_cb<5>().set(m_rtc, FUNC(e0516_device::cs_w)).invert(); + m_sto->q_out_cb<6>().set(m_rtc, FUNC(e0516_device::clk_w)); + m_sto->q_out_cb<7>().set(m_rtc, FUNC(e0516_device::dio_w)); // 74LS125A buffer as fake open collector + m_sto->q_out_cb<7>().append(FUNC(abc806_state::prot_din_w)); + // video hardware abc806_video(config); diff --git a/src/mame/luxor/abc80x.h b/src/mame/luxor/abc80x.h index 6b7a2a6c884..c7dc872f6ec 100644 --- a/src/mame/luxor/abc80x.h +++ b/src/mame/luxor/abc80x.h @@ -14,6 +14,7 @@ #include "imagedev/snapquik.h" #include "bus/abckb/abckb.h" #include "bus/abckb/abc800kb.h" +#include "machine/74259.h" #include "machine/e0516.h" #include "machine/z80ctc.h" #include "machine/z80sio.h" @@ -273,6 +274,7 @@ public: m_crtc(*this, MC6845_TAG), m_palette(*this, "palette"), m_rtc(*this, E0516_TAG), + m_sto(*this, "sto"), m_rad_prom(*this, "rad"), m_hru2_prom(*this, "hru"), m_char_rom(*this, MC6845_TAG), @@ -282,6 +284,7 @@ public: required_device m_crtc; required_device m_palette; required_device m_rtc; + required_device m_sto; required_memory_region m_rad_prom; required_memory_region m_hru2_prom; required_memory_region m_char_rom; @@ -311,6 +314,12 @@ public: void sso_w(uint8_t data); uint8_t sti_r(); void sto_w(uint8_t data); + DECLARE_WRITE_LINE_MEMBER( eme_w ); + DECLARE_WRITE_LINE_MEMBER( _40_w ); + DECLARE_WRITE_LINE_MEMBER( hru2_a8_w ); + DECLARE_WRITE_LINE_MEMBER( prot_ini_w ); + DECLARE_WRITE_LINE_MEMBER( txoff_w ); + DECLARE_WRITE_LINE_MEMBER( prot_din_w ); DECLARE_WRITE_LINE_MEMBER( hs_w ); DECLARE_WRITE_LINE_MEMBER( vs_w ); void abc806_palette(palette_device &palette) const; -- cgit v1.2.3