diff options
author | Michael Zapf <Michael.Zapf@mizapf.de> | 2017-07-10 17:48:08 +0200 |
---|---|---|
committer | Michael Zapf <Michael.Zapf@mizapf.de> | 2017-07-10 17:49:16 +0200 |
commit | 7d980227979c30aac9eb527f15c5b893aebea5c6 (patch) | |
tree | 3a0a064457a7bec2bd9a3c57f7cfddc8bd48bea8 | |
parent | a725cd2ba8839e166ac9f43893c2506214492661 (diff) |
ti99: Moved Hexbus one level up
-rw-r--r-- | scripts/src/bus.lua | 18 | ||||
-rw-r--r-- | scripts/target/mame/mess.lua | 1 | ||||
-rw-r--r-- | src/devices/bus/hexbus/hexbus.cpp (renamed from src/devices/bus/ti99/hexbus/hexbus.cpp) | 25 | ||||
-rw-r--r-- | src/devices/bus/hexbus/hexbus.h (renamed from src/devices/bus/ti99/hexbus/hexbus.h) | 33 | ||||
-rw-r--r-- | src/devices/bus/hexbus/hx5102.cpp (renamed from src/devices/bus/ti99/hexbus/hx5102.cpp) | 10 | ||||
-rw-r--r-- | src/devices/bus/hexbus/hx5102.h (renamed from src/devices/bus/ti99/hexbus/hx5102.h) | 14 | ||||
-rw-r--r-- | src/devices/bus/ti99/internal/998board.cpp | 48 | ||||
-rw-r--r-- | src/devices/bus/ti99/internal/998board.h | 12 | ||||
-rw-r--r-- | src/mame/drivers/ti99_8.cpp | 2 |
9 files changed, 108 insertions, 55 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index b4eb4f52400..1991a06ab3a 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -767,6 +767,19 @@ if (BUSES["GENERIC"]~=null) then } end +--------------------------------------------------- +-- +--@src/devices/bus/hexbus/hexbus.h,BUSES["HEXBUS"] = true +--------------------------------------------------- + +if (BUSES["HEXBUS"]~=null) then + files { + MAME_DIR .. "src/devices/bus/hexbus/hexbus.cpp", + MAME_DIR .. "src/devices/bus/hexbus/hexbus.h", + MAME_DIR .. "src/devices/bus/hexbus/hx5102.cpp", + MAME_DIR .. "src/devices/bus/hexbus/hx5102.h", + } +end --------------------------------------------------- -- @@ -2388,7 +2401,6 @@ end --@src/devices/bus/ti99/joyport/joyport.h,BUSES["TI99"] = true --@src/devices/bus/ti99/peb/peribox.h,BUSES["TI99"] = true --@src/devices/bus/ti99/internal/genboard.h,BUSES["TI99"] = true ---@src/devices/bus/ti99/hexbus/hexbus.h,BUSES["TI99"] = true --------------------------------------------------- if (BUSES["TI99"]~=null) then @@ -2418,10 +2430,6 @@ if (BUSES["TI99"]~=null) then MAME_DIR .. "src/devices/bus/ti99/gromport/multiconn.h", MAME_DIR .. "src/devices/bus/ti99/gromport/singleconn.cpp", MAME_DIR .. "src/devices/bus/ti99/gromport/singleconn.h", - MAME_DIR .. "src/devices/bus/ti99/hexbus/hexbus.cpp", - MAME_DIR .. "src/devices/bus/ti99/hexbus/hexbus.h", - MAME_DIR .. "src/devices/bus/ti99/hexbus/hx5102.cpp", - MAME_DIR .. "src/devices/bus/ti99/hexbus/hx5102.h", MAME_DIR .. "src/devices/bus/ti99/joyport/handset.cpp", MAME_DIR .. "src/devices/bus/ti99/joyport/handset.h", MAME_DIR .. "src/devices/bus/ti99/joyport/joyport.cpp", diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 6b4b0c9f62d..60aa06fa3c3 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -662,6 +662,7 @@ BUSES["GAMEBOY"] = true BUSES["GAMEGEAR"] = true BUSES["GBA"] = true BUSES["GENERIC"] = true +BUSES["HEXBUS"] = true BUSES["HPHIL"] = true BUSES["HPDIO"] = true BUSES["IEEE488"] = true diff --git a/src/devices/bus/ti99/hexbus/hexbus.cpp b/src/devices/bus/hexbus/hexbus.cpp index d8c315057c7..d369f61f88b 100644 --- a/src/devices/bus/ti99/hexbus/hexbus.cpp +++ b/src/devices/bus/hexbus/hexbus.cpp @@ -1,4 +1,4 @@ -// license:LGPL-2.1+ +// license:BSD-3-Clause // copyright-holders:Michael Zapf /**************************************************************************** @@ -108,7 +108,7 @@ direction. Also, reading from the bus is the product of all active output buffers. With no active device, the bus lines are pulled high. - Every Hexbus device has an interface "device_ti_hexbus_interface" which + Every Hexbus device has an interface "device_hexbus_interface" which allows it to plug into a preceding Hexbus socket. Since the signal propagation is the same for all devices, there is a @@ -119,12 +119,15 @@ Reading is simpler, because we assume that changes can only be done by writing to the bus. - The "hexbus_chained_device" implements the "device_ti_hexbus_interface" + The "hexbus_chained_device" implements the "device_hexbus_interface" and holds references to up to two Hexbus instances, one for each direction. The computer console will not offer an inbound Hexbus connection, only an outbound one, and possibly there is some device that must be connected at the end, without further outbound connections. + By default, instances of "hexbus_chained_device" own an outbound + hexbus slot as a subdevice; this may be overwritten by subclasses. + References ---------- @@ -143,12 +146,12 @@ #include "hx5102.h" // Hexbus instance -DEFINE_DEVICE_TYPE_NS(TI_HEXBUS, bus::ti99::hexbus, hexbus_device, "ti_hexbus", "Hexbus") +DEFINE_DEVICE_TYPE_NS(HEXBUS, bus::hexbus, hexbus_device, "hexbus", "Hexbus") -namespace bus { namespace ti99 { namespace hexbus { +namespace bus { namespace hexbus { hexbus_device::hexbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - device_t(mconfig, TI_HEXBUS, tag, owner, clock), + device_t(mconfig, HEXBUS, tag, owner, clock), device_slot_interface(mconfig, *this), m_next_dev(nullptr) { @@ -156,7 +159,7 @@ hexbus_device::hexbus_device(const machine_config &mconfig, const char *tag, dev void hexbus_device::device_start() { - m_next_dev = dynamic_cast<device_ti_hexbus_interface *>(get_card_device()); + m_next_dev = dynamic_cast<device_hexbus_interface *>(get_card_device()); } /* @@ -201,7 +204,7 @@ uint8_t hexbus_device::read(int dir) hexbus_chained_device::hexbus_chained_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock): device_t(mconfig, type, tag, owner, clock), - device_ti_hexbus_interface(mconfig, *this) + device_hexbus_interface(mconfig, *this) { m_hexbus_inbound = dynamic_cast<hexbus_device *>(owner); m_myvalue = 0xff; @@ -298,9 +301,9 @@ MACHINE_CONFIG_END // ------------------------------------------------------------------------ -} } } // end namespace bus::ti99::hexbus +} } // end namespace bus::hexbus -SLOT_INTERFACE_START( ti_hexbus_conn ) - SLOT_INTERFACE("hx5102", TI_HX5102) +SLOT_INTERFACE_START( hexbus_conn ) + SLOT_INTERFACE("hx5102", HX5102) SLOT_INTERFACE_END diff --git a/src/devices/bus/ti99/hexbus/hexbus.h b/src/devices/bus/hexbus/hexbus.h index 5c9f62274c2..3c3280cca91 100644 --- a/src/devices/bus/ti99/hexbus/hexbus.h +++ b/src/devices/bus/hexbus/hexbus.h @@ -1,4 +1,4 @@ -// license:LGPL-2.1+ +// license:BSD-3-Clause // copyright-holders:Michael Zapf /**************************************************************************** @@ -10,14 +10,12 @@ *****************************************************************************/ -#ifndef MAME_BUS_TI99_HEXBUS_HEXBUS_H -#define MAME_BUS_TI99_HEXBUS_HEXBUS_H +#ifndef MAME_BUS_HEXBUS_HEXBUS_H +#define MAME_BUS_HEXBUS_HEXBUS_H #pragma once -#include "bus/ti99/ti99defs.h" - -namespace bus { namespace ti99 { namespace hexbus { +namespace bus { namespace hexbus { enum { @@ -32,14 +30,14 @@ class hexbus_chained_device; Interface for a device that connects to the Hexbus ********************************************************************/ -class device_ti_hexbus_interface : public device_slot_card_interface +class device_hexbus_interface : public device_slot_card_interface { public: virtual uint8_t bus_read(int dir) =0; virtual void bus_write(int dir, uint8_t data) =0; protected: - device_ti_hexbus_interface(const machine_config &mconfig, device_t &device) : + device_hexbus_interface(const machine_config &mconfig, device_t &device) : device_slot_card_interface(mconfig, device) { } }; @@ -47,7 +45,7 @@ protected: Common parent class of all devices attached to the hexbus port This class implements the signal propagation in both directions ********************************************************************/ -class hexbus_chained_device : public device_t, public device_ti_hexbus_interface +class hexbus_chained_device : public device_t, public device_hexbus_interface { friend class hexbus_device; @@ -58,6 +56,8 @@ public: protected: virtual void device_add_mconfig(machine_config &config) override; + void set_outbound_hexbus(hexbus_device *outbound) { m_hexbus_outbound = outbound; } + // Link to the inbound Hexbus (if not null, see Oso chip) hexbus_device *m_hexbus_inbound; @@ -78,7 +78,6 @@ protected: // For interrupts virtual void hexbus_value_changed(uint8_t data) { }; -private: uint8_t m_myvalue; }; @@ -102,7 +101,7 @@ public: protected: void device_start() override; - device_ti_hexbus_interface *m_next_dev; + device_hexbus_interface *m_next_dev; private: // owner of this Hexbus socket; may be the owning component or another @@ -112,13 +111,13 @@ private: }; #define MCFG_HEXBUS_ADD( _tag ) \ - MCFG_DEVICE_ADD(_tag, TI_HEXBUS, 0) \ - MCFG_DEVICE_SLOT_INTERFACE( ti_hexbus_conn, nullptr, false) + MCFG_DEVICE_ADD(_tag, HEXBUS, 0) \ + MCFG_DEVICE_SLOT_INTERFACE( hexbus_conn, nullptr, false) -} } } // end namespace bus::ti99::hexbus +} } // end namespace bus::hexbus -SLOT_INTERFACE_EXTERN( ti_hexbus_conn ); +SLOT_INTERFACE_EXTERN( hexbus_conn ); -DECLARE_DEVICE_TYPE_NS(TI_HEXBUS, bus::ti99::hexbus, hexbus_device) +DECLARE_DEVICE_TYPE_NS(HEXBUS, bus::hexbus, hexbus_device) -#endif // MAME_BUS_TI99_HEXBUS_HEXBUS_H +#endif // MAME_BUS_HEXBUS_HEXBUS_H diff --git a/src/devices/bus/ti99/hexbus/hx5102.cpp b/src/devices/bus/hexbus/hx5102.cpp index e1bfb5fcbfa..71fe674506f 100644 --- a/src/devices/bus/ti99/hexbus/hx5102.cpp +++ b/src/devices/bus/hexbus/hx5102.cpp @@ -1,4 +1,4 @@ -// license:LGPL-2.1+ +// license:BSD-3-Clause // copyright-holders:Michael Zapf /**************************************************************************** @@ -17,12 +17,12 @@ #define TRACE_HEXBUS 0 -DEFINE_DEVICE_TYPE_NS(TI_HX5102, bus::ti99::hexbus, hx5102_device, "ti_hx5102", "TI Hexbus Floppy") +DEFINE_DEVICE_TYPE_NS(HX5102, bus::hexbus, hx5102_device, "hx5102", "TI Hexbus Floppy") -namespace bus { namespace ti99 { namespace hexbus { +namespace bus { namespace hexbus { hx5102_device::hx5102_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock): - hexbus_chained_device(mconfig, TI_HX5102, tag, owner, clock) + hexbus_chained_device(mconfig, HX5102, tag, owner, clock) { } @@ -31,5 +31,5 @@ void hx5102_device::hexbus_value_changed(uint8_t data) if (TRACE_HEXBUS) logerror("Hexbus value changed to %02x\n", data); } -} } } // end namespace bus::ti99::hexbus +} } // end namespace bus::hexbus diff --git a/src/devices/bus/ti99/hexbus/hx5102.h b/src/devices/bus/hexbus/hx5102.h index c384305a9fd..fdb0c198f8d 100644 --- a/src/devices/bus/ti99/hexbus/hx5102.h +++ b/src/devices/bus/hexbus/hx5102.h @@ -1,4 +1,4 @@ -// license:LGPL-2.1+ +// license:BSD-3-Clause // copyright-holders:Michael Zapf /**************************************************************************** @@ -12,14 +12,14 @@ *****************************************************************************/ -#ifndef MAME_BUS_TI99_HEXBUS_HX5102_H -#define MAME_BUS_TI99_HEXBUS_HX5102_H +#ifndef MAME_BUS_HEXBUS_HX5102_H +#define MAME_BUS_HEXBUS_HX5102_H #pragma once #include "hexbus.h" -namespace bus { namespace ti99 { namespace hexbus { +namespace bus { namespace hexbus { class hx5102_device : public hexbus_chained_device { @@ -28,8 +28,8 @@ public: void hexbus_value_changed(uint8_t data) override; }; -} } } // end namespace bus::ti99::hexbus +} } // end namespace bus::hexbus -DECLARE_DEVICE_TYPE_NS(TI_HX5102, bus::ti99::hexbus, hx5102_device) +DECLARE_DEVICE_TYPE_NS(HX5102, bus::hexbus, hx5102_device) -#endif // MAME_BUS_TI99_HEXBUS_HX5102_H +#endif // MAME_BUS_HEXBUS_HX5102_H diff --git a/src/devices/bus/ti99/internal/998board.cpp b/src/devices/bus/ti99/internal/998board.cpp index a89353051e9..f6eaf940e4d 100644 --- a/src/devices/bus/ti99/internal/998board.cpp +++ b/src/devices/bus/ti99/internal/998board.cpp @@ -426,6 +426,9 @@ WRITE_LINE_MEMBER( mainboard8_device::clock_in ) m_mofetta->skdrcs_in(m_amigo->skdrcs_out()); + // Clock to Oso + m_oso->clock_in(state); + int gromclk = m_mofetta->gromclk_out(); if (gromclk != m_gromclk) // when it changed, propagate to the GROMs @@ -2227,12 +2230,27 @@ enum SHSK = 0x01 }; +/* Control register bits */ +enum +{ + WIEN = 0x80, + RIEN = 0x40, + BAVIAEN = 0x20, + BAVAIEN = 0x10, + BAVC = 0x08, + WEN = 0x04, + REN = 0x02, + CR7 = 0x01 +}; + oso_device::oso_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - bus::ti99::hexbus::hexbus_chained_device(mconfig, TI99_OSO, tag, owner, clock), + bus::hexbus::hexbus_chained_device(mconfig, TI99_OSO, tag, owner, clock), m_data(0), - m_status(0), + m_status(0xff), m_control(0), - m_xmit(0) + m_xmit(0), + m_clkcount(0), + m_xmit_send(0) { m_hexbus_inbound = nullptr; m_hexbus_outbound = nullptr; @@ -2277,9 +2295,7 @@ WRITE8_MEMBER( oso_device::write ) // write 5FF8: write transmit register if (TRACE_OSO) logerror("Write transmit register %02x\n", data); m_xmit = data; - hexbus_write(data); - // We set the status register directly in order to prevent lock-ups - // until we have a complete Hexbus implementation + m_xmit_send = 2; m_status |= HSKWT; break; case 1: @@ -2299,13 +2315,31 @@ void oso_device::hexbus_value_changed(uint8_t data) if (TRACE_OSO) logerror("Hexbus value changed to %02x\n", data); } +/* + Phi3 incoming clock pulse +*/ +WRITE_LINE_MEMBER( oso_device::clock_in ) +{ + if (state==ASSERT_LINE) m_clkcount++; + if (m_clkcount > 30 && ((m_control & WEN)!=0) && (m_xmit_send > 0)) + { + if (TRACE_OSO) logerror("Write nibble %d\n", 3-m_xmit_send); + hexbus_write(((m_xmit & 0x0c)<<4) | (m_xmit & 0x03)); + m_xmit >>= 4; + m_clkcount = 0; + m_xmit_send--; + } +} + void oso_device::device_start() { logerror("Starting\n"); m_status = m_xmit = m_control = m_data = 0; - m_hexbus_outbound = dynamic_cast<bus::ti99::hexbus::hexbus_device*>(machine().device(TI_HEXBUS_TAG)); + m_hexbus_outbound = dynamic_cast<bus::hexbus::hexbus_device*>(machine().device(TI_HEXBUS_TAG)); + // Establish callback for inbound propagations + m_hexbus_outbound->set_chain_element(this); // Establish callback m_hexbus_outbound->set_chain_element(this); diff --git a/src/devices/bus/ti99/internal/998board.h b/src/devices/bus/ti99/internal/998board.h index a0d09062a54..bde035d7d73 100644 --- a/src/devices/bus/ti99/internal/998board.h +++ b/src/devices/bus/ti99/internal/998board.h @@ -20,7 +20,7 @@ #include "bus/ti99/ti99defs.h" #include "bus/ti99/gromport/gromport.h" -#include "bus/ti99/hexbus/hexbus.h" +#include "bus/hexbus/hexbus.h" #include "bus/ti99/internal/ioport.h" #include "machine/ram.h" @@ -422,21 +422,29 @@ private: /* Custom chip: OSO */ -class oso_device : public bus::ti99::hexbus::hexbus_chained_device +class oso_device : public bus::hexbus::hexbus_chained_device { public: oso_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); void device_start() override; + // Don't add a hexbus connector; we use the one from the driver instance + virtual void device_add_mconfig(machine_config &config) override { }; void hexbus_value_changed(uint8_t data) override; + WRITE_LINE_MEMBER( clock_in ); + private: uint8_t m_data; uint8_t m_status; uint8_t m_control; uint8_t m_xmit; + + int m_clkcount; + + int m_xmit_send; }; class mainboard8_device : public device_t diff --git a/src/mame/drivers/ti99_8.cpp b/src/mame/drivers/ti99_8.cpp index 71d00d8947f..7f84f2ca701 100644 --- a/src/mame/drivers/ti99_8.cpp +++ b/src/mame/drivers/ti99_8.cpp @@ -183,7 +183,7 @@ Known Issues (MZ, 2010-11-07) #include "bus/ti99/internal/998board.h" #include "bus/ti99/gromport/gromport.h" -#include "bus/ti99/hexbus/hexbus.h" +#include "bus/hexbus/hexbus.h" #include "bus/ti99/joyport/joyport.h" #include "bus/ti99/internal/ioport.h" |