summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author ajrhacker <ajrhacker@users.noreply.github.com>2018-10-08 17:12:24 -0400
committer GitHub <noreply@github.com>2018-10-08 17:12:24 -0400
commit4f0d8105b09b8c589a05c275e6c84c66605ef2ae (patch)
tree903e55a63a9f4f2bcb2f8cf7ad938224f5d8b758
parent5e0a1aa363c4acda617ac5efcab54ebef8deab8c (diff)
parentd929f8b41b256ddefb3cd997b1cbe3ebd6e9f820 (diff)
Merge pull request #4091 from hp9k/hp_human_interface_module
hp9k_3xx: move Sound, GPIB, Keyboard and RTC to human interface module
-rw-r--r--scripts/src/bus.lua2
-rw-r--r--src/devices/bus/hp_dio/hp_dio.h2
-rw-r--r--src/devices/bus/hp_dio/human_interface.cpp304
-rw-r--r--src/devices/bus/hp_dio/human_interface.h94
-rw-r--r--src/mame/drivers/hp9k_3xx.cpp237
5 files changed, 439 insertions, 200 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index e86393a9e8f..86fade73bff 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -893,6 +893,8 @@ if (BUSES["HPDIO"]~=null) then
MAME_DIR .. "src/devices/bus/hp_dio/hp98603b.h",
MAME_DIR .. "src/devices/bus/hp_dio/hp98644.cpp",
MAME_DIR .. "src/devices/bus/hp_dio/hp98644.h",
+ MAME_DIR .. "src/devices/bus/hp_dio/human_interface.cpp",
+ MAME_DIR .. "src/devices/bus/hp_dio/human_interface.h",
}
end
diff --git a/src/devices/bus/hp_dio/hp_dio.h b/src/devices/bus/hp_dio/hp_dio.h
index 938e267b7f6..d44a9e3bf66 100644
--- a/src/devices/bus/hp_dio/hp_dio.h
+++ b/src/devices/bus/hp_dio/hp_dio.h
@@ -89,6 +89,7 @@ public:
void unmap_bank(offs_t start, offs_t end);
void unmap_rom(offs_t start, offs_t end);
+ address_space *program_space() { return m_prgspace; }
// IRQs 1, 2, and 7 are reserved for non-bus usage.
@@ -186,6 +187,7 @@ protected:
virtual void interface_pre_start() override;
int get_index() { return m_index; };
+ address_space *program_space() { return m_dio_dev->program_space(); }
DECLARE_WRITE_LINE_MEMBER(irq1_out) { m_dio_dev->set_irq(m_index, 0, state); }
DECLARE_WRITE_LINE_MEMBER(irq2_out) { m_dio_dev->set_irq(m_index, 1, state); }
diff --git a/src/devices/bus/hp_dio/human_interface.cpp b/src/devices/bus/hp_dio/human_interface.cpp
new file mode 100644
index 00000000000..4358d71ffd9
--- /dev/null
+++ b/src/devices/bus/hp_dio/human_interface.cpp
@@ -0,0 +1,304 @@
+// license:BSD-3-Clause
+// copyright-holders:Sven Schnelle
+/***************************************************************************
+
+ HP Human interface board
+
+***************************************************************************/
+
+#include "emu.h"
+#include "human_interface.h"
+#include "cpu/mcs48/mcs48.h"
+#include "machine/tms9914.h"
+#include "machine/msm58321.h"
+#include "sound/sn76496.h"
+#include "bus/hp_hil/hp_hil.h"
+#include "bus/hp_hil/hil_devices.h"
+#include "bus/ieee488/ieee488.h"
+#include "speaker.h"
+//#define VERBOSE 1
+#include "logmacro.h"
+
+DEFINE_DEVICE_TYPE_NS(HPDIO_HUMAN_INTERFACE, bus::hp_dio, human_interface_device, "human_interface", "HP human interface card")
+
+namespace bus {
+ namespace hp_dio {
+
+MACHINE_CONFIG_START(human_interface_device::device_add_mconfig)
+
+ i8042_device &iocpu(I8042(config, "iocpu", XTAL(5'000'000)));
+ iocpu.set_addrmap(AS_PROGRAM, &human_interface_device::iocpu_map);
+ iocpu.p1_out_cb().set(FUNC(human_interface_device::iocpu_port1_w));
+ iocpu.p2_out_cb().set(FUNC(human_interface_device::iocpu_port2_w));
+ iocpu.p1_in_cb().set(FUNC(human_interface_device::iocpu_port1_r));
+ iocpu.t0_in_cb().set(FUNC(human_interface_device::iocpu_test0_r));
+ iocpu.p2_in_cb().set_constant(0xdf);
+ iocpu.t1_in_cb().set_constant(1);
+
+ MCFG_DEVICE_ADD(m_mlc, HP_HIL_MLC, XTAL(8'000'000))
+ MCFG_HP_HIL_SLOT_ADD("mlc", "hil1", hp_hil_devices, "hp_46021a")
+ SPEAKER(config, "mono").front_center();
+ MCFG_DEVICE_ADD("sn76494", SN76494, 333333)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
+
+ MCFG_DEVICE_ADD("rtc", MSM58321, 32.768_kHz_XTAL)
+ MCFG_MSM58321_DEFAULT_24H(false)
+ MCFG_MSM58321_D0_HANDLER(WRITELINE(*this, human_interface_device, rtc_d0_w))
+ MCFG_MSM58321_D1_HANDLER(WRITELINE(*this, human_interface_device, rtc_d1_w))
+ MCFG_MSM58321_D2_HANDLER(WRITELINE(*this, human_interface_device, rtc_d2_w))
+ MCFG_MSM58321_D3_HANDLER(WRITELINE(*this, human_interface_device, rtc_d3_w))
+
+ MCFG_DEVICE_ADD(m_tms9914, TMS9914, XTAL(5000000))
+ MCFG_TMS9914_INT_WRITE_CB(WRITELINE(*this, human_interface_device, gpib_irq));
+ MCFG_TMS9914_ACCRQ_WRITE_CB(WRITELINE(*this, human_interface_device, gpib_dreq));
+ MCFG_TMS9914_DIO_READWRITE_CB(READ8(IEEE488_TAG, ieee488_device, dio_r), WRITE8(IEEE488_TAG, ieee488_device, host_dio_w))
+ MCFG_TMS9914_EOI_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_eoi_w))
+ MCFG_TMS9914_DAV_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_dav_w))
+ MCFG_TMS9914_NRFD_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_nrfd_w))
+ MCFG_TMS9914_NDAC_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_ndac_w))
+ MCFG_TMS9914_IFC_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_ifc_w))
+ MCFG_TMS9914_SRQ_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_srq_w))
+ MCFG_TMS9914_ATN_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_atn_w))
+ MCFG_TMS9914_REN_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_ren_w))
+
+ MCFG_IEEE488_SLOT_ADD("ieee0", 0, hp_ieee488_devices, "hp9122c")
+ MCFG_IEEE488_SLOT_ADD("ieee_rem", 0, remote488_devices, nullptr)
+ MCFG_IEEE488_BUS_ADD()
+
+ MCFG_IEEE488_EOI_CALLBACK(WRITELINE(m_tms9914, tms9914_device, eoi_w))
+ MCFG_IEEE488_DAV_CALLBACK(WRITELINE(m_tms9914, tms9914_device, dav_w))
+ MCFG_IEEE488_NRFD_CALLBACK(WRITELINE(m_tms9914, tms9914_device, nrfd_w))
+ MCFG_IEEE488_NDAC_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ndac_w))
+ MCFG_IEEE488_IFC_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ifc_w))
+ MCFG_IEEE488_SRQ_CALLBACK(WRITELINE(m_tms9914, tms9914_device, srq_w))
+ MCFG_IEEE488_ATN_CALLBACK(WRITELINE(m_tms9914, tms9914_device, atn_w))
+ MCFG_IEEE488_REN_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ren_w))
+MACHINE_CONFIG_END
+
+ROM_START(human_interface)
+ ROM_REGION(0x800 , "iocpu" , 0)
+ ROM_LOAD( "1820-4784.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b))
+ROM_END
+
+const tiny_rom_entry *human_interface_device::device_rom_region() const
+{
+ return ROM_NAME(human_interface);
+}
+
+void human_interface_device::iocpu_map(address_map& map)
+{
+ map(0x0000, 0x07ff).rom().region("iocpu", 0);
+}
+void human_interface_device::map(address_map& map)
+{
+ map(0x00420000, 0x00420003).mirror(0x0000fffc).rw(m_iocpu, FUNC(upi41_cpu_device::upi41_master_r), FUNC(upi41_cpu_device::upi41_master_w)).umask32(0x00ff00ff);
+ map(0x00470000, 0x0047001f).mirror(0x0000ffe0).rw(FUNC(human_interface_device::gpib_r), FUNC(human_interface_device::gpib_w)).umask16(0x00ff);
+
+}
+
+human_interface_device::human_interface_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ human_interface_device(mconfig, HPDIO_HUMAN_INTERFACE, tag, owner, clock)
+{
+}
+
+human_interface_device::human_interface_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_dio16_card_interface(mconfig, *this),
+ m_iocpu(*this, "iocpu"),
+ m_mlc(*this, "mlc"),
+ m_sound(*this, "sn76494"),
+ m_tms9914(*this, "tms9914"),
+ m_rtc(*this, "rtc")
+{
+}
+
+void human_interface_device::device_start()
+{
+ program_space()->install_readwrite_handler(0x420000, 0x420003, 0x0003, 0xfffc, 0,
+ read8_delegate(FUNC(upi41_cpu_device::upi41_master_r), &(*m_iocpu)),
+ write8_delegate(FUNC(upi41_cpu_device::upi41_master_w), &(*m_iocpu)), 0x00ff00ff);
+
+ program_space()->install_readwrite_handler(0x470000, 0x47001f, 0x1f, 0xffe0, 0,
+ read8_delegate(FUNC(human_interface_device::gpib_r), this),
+ write8_delegate(FUNC(human_interface_device::gpib_w), this), 0x00ff00ff);
+
+ save_item(NAME(m_hil_read));
+ save_item(NAME(m_kbd_nmi));
+ save_item(NAME(gpib_irq_line));
+ save_item(NAME(m_old_latch_enable));
+ save_item(NAME(m_hil_data));
+ save_item(NAME(m_latch_data));
+ save_item(NAME(m_rtc_data));
+}
+
+void human_interface_device::device_reset()
+{
+ m_rtc->cs1_w(ASSERT_LINE);
+ m_rtc->cs2_w(CLEAR_LINE);
+ m_rtc->write_w(CLEAR_LINE);
+ m_rtc->read_w(CLEAR_LINE);
+ m_rtc->cs2_w(CLEAR_LINE);
+ m_iocpu->reset();
+}
+
+WRITE_LINE_MEMBER(human_interface_device::reset_in)
+{
+ if (state)
+ device_reset();
+}
+WRITE_LINE_MEMBER(human_interface_device::gpib_irq)
+{
+ gpib_irq_line = state;
+ irq3_out(state ? ASSERT_LINE : CLEAR_LINE);
+}
+
+WRITE_LINE_MEMBER(human_interface_device::gpib_dreq)
+{
+ dmar0_out(state);
+}
+
+WRITE8_MEMBER(human_interface_device::gpib_w)
+{
+ if (offset & 0x08) {
+ m_tms9914->reg8_w(space, offset & 0x07, data);
+ return;
+ }
+ LOG("gpib_w: %s %02X = %02X\n", machine().describe_context().c_str(), offset, data);
+}
+
+READ8_MEMBER(human_interface_device::gpib_r)
+{
+ uint8_t data = 0xff;
+
+ if (offset & 0x8) {
+ data = m_tms9914->reg8_r(space, offset & 0x07);
+ return data;
+ }
+
+ switch(offset) {
+ case 0: /* ID */
+ data = 0x80;
+ break;
+ case 1:
+ /* Int control */
+ data = 0x80 | (gpib_irq_line ? 0x40 : 0);
+ break;
+ case 2:
+ /* Address */
+ data = (m_tms9914->cont_r() ? 0x0 : 0x40) | 0x81;
+ if (m_kbd_nmi)
+ data |= 0x04;
+ break;
+ }
+ LOG("gpib_r: %s %02X = %02X\n", machine().describe_context().c_str(), offset, data);
+ return data;
+}
+
+
+WRITE8_MEMBER(human_interface_device::iocpu_port1_w)
+{
+ m_hil_data = data;
+ m_rtc->d0_w(data & 0x01 ? ASSERT_LINE : CLEAR_LINE);
+ m_rtc->d1_w(data & 0x02 ? ASSERT_LINE : CLEAR_LINE);
+ m_rtc->d2_w(data & 0x04 ? ASSERT_LINE : CLEAR_LINE);
+ m_rtc->d3_w(data & 0x08 ? ASSERT_LINE : CLEAR_LINE);
+}
+
+WRITE8_MEMBER(human_interface_device::iocpu_port2_w)
+{
+ bool latch_enable = data & LATCH_EN;
+
+ if ((data & (HIL_CS|HIL_WE)) == 0)
+ m_mlc->write(space, (m_latch_data & 0xc0) >> 6, m_hil_data, 0xff);
+
+ if ((data & SN76494_EN) == 0)
+ m_sound->write(m_hil_data);
+
+ m_hil_read = ((data & (HIL_CS|HIL_OE)) == 0);
+
+ m_rtc->address_write_w(data & 0x02 ? ASSERT_LINE : CLEAR_LINE);
+ m_rtc->write_w(data & 0x04 ? ASSERT_LINE : CLEAR_LINE);
+
+ if (!m_old_latch_enable && latch_enable) {
+ m_latch_data = m_hil_data;
+ m_rtc->read_w(m_latch_data & 0x20 ? ASSERT_LINE : CLEAR_LINE);
+ m_rtc->cs2_w(m_latch_data & 0x10 ? ASSERT_LINE : CLEAR_LINE);
+ }
+ irq1_out((data & 0x10) ? ASSERT_LINE : CLEAR_LINE);
+
+ if (!(data & KBD_RESET)) {
+ irq7_out(ASSERT_LINE);
+ m_kbd_nmi = true;
+ } else {
+ irq7_out(CLEAR_LINE);
+ m_kbd_nmi = false;
+ }
+ m_old_latch_enable = latch_enable;
+}
+
+READ8_MEMBER(human_interface_device::iocpu_port1_r)
+{
+ if (m_hil_read)
+ return m_mlc->read(space, (m_latch_data & 0xc0) >> 6, 0xff);
+ if (m_latch_data & 0x20)
+ return m_rtc_data;
+ return 0xff;
+}
+
+READ8_MEMBER(human_interface_device::iocpu_test0_r)
+{
+ return !m_mlc->get_int();
+}
+
+WRITE_LINE_MEMBER(human_interface_device::rtc_d0_w)
+{
+ if (state)
+ m_rtc_data |= 1;
+ else
+ m_rtc_data &= ~1;
+
+}
+
+WRITE_LINE_MEMBER(human_interface_device::rtc_d1_w)
+{
+ if (state)
+ m_rtc_data |= 2;
+ else
+ m_rtc_data &= ~2;
+}
+
+WRITE_LINE_MEMBER(human_interface_device::rtc_d2_w)
+{
+ if (state)
+ m_rtc_data |= 4;
+ else
+ m_rtc_data &= ~4;
+
+}
+
+WRITE_LINE_MEMBER(human_interface_device::rtc_d3_w)
+{
+ if (state)
+ m_rtc_data |= 8;
+ else
+ m_rtc_data &= ~8;
+
+}
+
+void human_interface_device::dmack_w_in(int channel, uint8_t data)
+{
+ if (channel)
+ return;
+// FIXME
+// m_tms9914->reg8_w(memory_space(), 7, data);
+}
+
+uint8_t human_interface_device::dmack_r_in(int channel)
+{
+ if (channel)
+ return 0xff;
+ return m_tms9914->reg8_r(machine().dummy_space(), 7);
+}
+
+} // namespace bus::hp_dio
+} // namespace bus
diff --git a/src/devices/bus/hp_dio/human_interface.h b/src/devices/bus/hp_dio/human_interface.h
new file mode 100644
index 00000000000..b2d412b6306
--- /dev/null
+++ b/src/devices/bus/hp_dio/human_interface.h
@@ -0,0 +1,94 @@
+// license:BSD-3-Clause
+// copyright-holders:Sven Schnelle
+
+#ifndef MAME_BUS_HPDIO_HUMAN_INTERFACE_H
+#define MAME_BUS_HPDIO_HUMAN_INTERFACE_H
+
+#pragma once
+
+#include "hp_dio.h"
+#include "cpu/mcs48/mcs48.h"
+#include "machine/tms9914.h"
+#include "machine/msm58321.h"
+#include "sound/sn76496.h"
+#include "bus/hp_hil/hp_hil.h"
+#include "bus/hp_hil/hil_devices.h"
+
+namespace bus {
+ namespace hp_dio {
+class human_interface_device :
+ public device_t,
+ public device_dio16_card_interface
+{
+public:
+ human_interface_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+protected:
+ human_interface_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+ virtual void device_add_mconfig(machine_config &config) override;
+ virtual const tiny_rom_entry *device_rom_region() const override;
+
+private:
+
+ /* 8042 interface */
+ DECLARE_WRITE8_MEMBER(iocpu_port1_w);
+ DECLARE_WRITE8_MEMBER(iocpu_port2_w);
+ DECLARE_READ8_MEMBER(iocpu_port1_r);
+ DECLARE_READ8_MEMBER(iocpu_test0_r);
+
+ /* GPIB */
+ DECLARE_READ8_MEMBER(gpib_r);
+ DECLARE_WRITE8_MEMBER(gpib_w);
+
+ DECLARE_WRITE_LINE_MEMBER(gpib_irq);
+ DECLARE_WRITE_LINE_MEMBER(gpib_dreq);
+
+ /* RTC */
+ DECLARE_WRITE_LINE_MEMBER(rtc_d0_w);
+ DECLARE_WRITE_LINE_MEMBER(rtc_d1_w);
+ DECLARE_WRITE_LINE_MEMBER(rtc_d2_w);
+ DECLARE_WRITE_LINE_MEMBER(rtc_d3_w);
+
+ DECLARE_WRITE_LINE_MEMBER(reset_in) override;
+
+ void dmack_w_in(int channel, uint8_t data) override;
+ uint8_t dmack_r_in(int channel) override;
+
+ required_device<i8042_device> m_iocpu;
+ required_device<hp_hil_mlc_device> m_mlc;
+ required_device<sn76494_device> m_sound;
+ required_device<tms9914_device> m_tms9914;
+ required_device<msm58321_device> m_rtc;
+
+ void map(address_map &map);
+ void iocpu_map(address_map &map);
+
+ static constexpr uint8_t HIL_CS = 0x01;
+ static constexpr uint8_t HIL_WE = 0x02;
+ static constexpr uint8_t HIL_OE = 0x04;
+ static constexpr uint8_t LATCH_EN = 0x08;
+ static constexpr uint8_t KBD_RESET = 0x40;
+ static constexpr uint8_t SN76494_EN = 0x80;
+
+ bool m_hil_read;
+ bool m_kbd_nmi;
+
+ bool gpib_irq_line;
+ bool m_old_latch_enable;
+
+ uint8_t m_hil_data;
+ uint8_t m_latch_data;
+ uint8_t m_rtc_data;
+
+
+};
+}
+}
+// device type definition
+DECLARE_DEVICE_TYPE_NS(HPDIO_HUMAN_INTERFACE, bus::hp_dio, human_interface_device)
+
+#endif // MAME_BUS_HPDIO_HUMAN_INTERFACE_H
diff --git a/src/mame/drivers/hp9k_3xx.cpp b/src/mame/drivers/hp9k_3xx.cpp
index c388cd710f8..4632301e262 100644
--- a/src/mame/drivers/hp9k_3xx.cpp
+++ b/src/mame/drivers/hp9k_3xx.cpp
@@ -57,30 +57,21 @@
#include "emu.h"
#include "logmacro.h"
#include "cpu/m68000/m68000.h"
-#include "cpu/mcs48/mcs48.h"
#include "machine/6840ptm.h"
-#include "machine/tms9914.h"
#include "sound/sn76496.h"
#include "bus/hp_dio/hp_dio.h"
#include "bus/hp_dio/hp98543.h"
#include "bus/hp_dio/hp98544.h"
-#include "bus/hp_hil/hp_hil.h"
-#include "bus/hp_hil/hil_devices.h"
#include "bus/hp_dio/hp98603a.h"
#include "bus/hp_dio/hp98603b.h"
#include "bus/hp_dio/hp98644.h"
-#include "bus/ieee488/ieee488.h"
+#include "bus/hp_dio/human_interface.h"
+
#include "screen.h"
-#include "speaker.h"
#include "softlist_dev.h"
#define MAINCPU_TAG "maincpu"
-#define IOCPU_TAG "iocpu"
#define PTM6840_TAG "ptm"
-#define MLC_TAG "mlc"
-#define SN76494_TAG "sn76494"
-
-#define SN76494_CLOCK 333333
class hp9k3xx_state : public driver_device
{
@@ -88,10 +79,6 @@ public:
hp9k3xx_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, MAINCPU_TAG),
- m_iocpu(*this, IOCPU_TAG),
- m_mlc(*this, MLC_TAG),
- m_sound(*this, SN76494_TAG),
- m_tms9914(*this, "tms9914"),
m_vram16(*this, "vram16"),
m_vram(*this, "vram")
{ }
@@ -108,10 +95,6 @@ public:
private:
required_device<m68000_base_device> m_maincpu;
- optional_device<i8042_device> m_iocpu;
- optional_device<hp_hil_mlc_device> m_mlc;
- optional_device<sn76494_device> m_sound;
- optional_device<tms9914_device> m_tms9914;
virtual void machine_reset() override;
optional_shared_ptr<uint16_t> m_vram16;
@@ -125,16 +108,6 @@ private:
DECLARE_READ32_MEMBER(buserror_r);
DECLARE_WRITE32_MEMBER(buserror_w);
- /* 8042 interface */
- DECLARE_WRITE8_MEMBER(iocpu_port1_w);
- DECLARE_WRITE8_MEMBER(iocpu_port2_w);
- DECLARE_READ8_MEMBER(iocpu_port1_r);
- DECLARE_READ8_MEMBER(iocpu_test0_r);
-
- DECLARE_READ8_MEMBER(gpib_r);
- DECLARE_WRITE8_MEMBER(gpib_w);
-
- DECLARE_WRITE_LINE_MEMBER(gpib_irq);
DECLARE_WRITE32_MEMBER(led_w)
{
if (mem_mask != 0x000000ff)
@@ -166,23 +139,18 @@ private:
void hp9k380_map(address_map &map);
void hp9k382_map(address_map &map);
void hp9k3xx_common(address_map &map);
- void iocpu_map(address_map &map);
+
+ DECLARE_WRITE_LINE_MEMBER(dio_irq1_w) { m_maincpu->set_input_line_and_vector(M68K_IRQ_1, state, M68K_INT_ACK_AUTOVECTOR); };
+ DECLARE_WRITE_LINE_MEMBER(dio_irq2_w) { m_maincpu->set_input_line_and_vector(M68K_IRQ_2, state, M68K_INT_ACK_AUTOVECTOR); };
+ DECLARE_WRITE_LINE_MEMBER(dio_irq3_w) { m_maincpu->set_input_line_and_vector(M68K_IRQ_3, state, M68K_INT_ACK_AUTOVECTOR); };
+ DECLARE_WRITE_LINE_MEMBER(dio_irq4_w) { m_maincpu->set_input_line_and_vector(M68K_IRQ_4, state, M68K_INT_ACK_AUTOVECTOR); };
+ DECLARE_WRITE_LINE_MEMBER(dio_irq5_w) { m_maincpu->set_input_line_and_vector(M68K_IRQ_5, state, M68K_INT_ACK_AUTOVECTOR); };
+ DECLARE_WRITE_LINE_MEMBER(dio_irq6_w) { m_maincpu->set_input_line_and_vector(M68K_IRQ_6, state, M68K_INT_ACK_AUTOVECTOR); };
+ DECLARE_WRITE_LINE_MEMBER(dio_irq7_w) { m_maincpu->set_input_line_and_vector(M68K_IRQ_7, state, M68K_INT_ACK_AUTOVECTOR); };
DECLARE_WRITE_LINE_MEMBER(cpu_reset);
- static constexpr uint8_t HIL_CS = 0x01;
- static constexpr uint8_t HIL_WE = 0x02;
- static constexpr uint8_t HIL_OE = 0x04;
- static constexpr uint8_t LATCH_EN = 0x08;
- static constexpr uint8_t KBD_RESET = 0x40;
- static constexpr uint8_t SN76494_EN = 0x80;
-
- bool m_hil_read;
- bool m_kbd_nmi;
- uint8_t m_hil_data;
- uint8_t m_latch_data;
uint32_t m_lastpc;
- bool gpib_irq_line;
};
uint32_t hp9k3xx_state::hp_medres_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
@@ -215,9 +183,6 @@ void hp9k3xx_state::hp9k3xx_common(address_map &map)
map(0x00000000, 0xffffffff).rw(FUNC(hp9k3xx_state::buserror_r), FUNC(hp9k3xx_state::buserror_w));
map(0x00000000, 0x0001ffff).rom().region("maincpu", 0).w(FUNC(hp9k3xx_state::led_w)); // writes to 1fffc are the LED
- map(0x00428000, 0x00428003).rw(m_iocpu, FUNC(upi41_cpu_device::upi41_master_r), FUNC(upi41_cpu_device::upi41_master_w)).umask32(0x00ff00ff);
- map(0x00470000, 0x0047001f).mirror(0x0000ffe0).rw(FUNC(hp9k3xx_state::gpib_r), FUNC(hp9k3xx_state::gpib_w)).umask16(0x00ff);
-
map(0x005f8000, 0x005f800f).rw(PTM6840_TAG, FUNC(ptm6840_device::read), FUNC(ptm6840_device::write)).umask32(0x00ff00ff);
map(0x005f4000, 0x005f400f).ram(); // somehow coprocessor related - bootrom crashes if not present
@@ -228,9 +193,6 @@ void hp9k3xx_state::hp9k310_map(address_map &map)
{
map(0x000000, 0x01ffff).rom().region("maincpu", 0).nopw(); // writes to 1fffc are the LED
- map(0x428000, 0x428003).rw(m_iocpu, FUNC(upi41_cpu_device::upi41_master_r), FUNC(upi41_cpu_device::upi41_master_w)).umask16(0x00ff);
- map(0x470000, 0x47001f).mirror(0x00ffe0).rw(FUNC(hp9k3xx_state::gpib_r), FUNC(hp9k3xx_state::gpib_w)).umask16(0x00ff);
-
map(0x510000, 0x510003).rw(FUNC(hp9k3xx_state::buserror16_r), FUNC(hp9k3xx_state::buserror16_w)); // no "Alpha display"
map(0x538000, 0x538003).rw(FUNC(hp9k3xx_state::buserror16_r), FUNC(hp9k3xx_state::buserror16_w)); // no "Graphics"
map(0x5c0000, 0x5c0003).rw(FUNC(hp9k3xx_state::buserror16_r), FUNC(hp9k3xx_state::buserror16_w)); // no add-on FP coprocessor
@@ -306,10 +268,6 @@ void hp9k3xx_state::hp9k382_map(address_map &map)
map(0x0051a000, 0x0051afff).rw(FUNC(hp9k3xx_state::buserror_r), FUNC(hp9k3xx_state::buserror_w)); // no "Alpha display"
}
-void hp9k3xx_state::iocpu_map(address_map &map)
-{
-}
-
uint32_t hp9k3xx_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
return 0;
@@ -321,7 +279,6 @@ INPUT_PORTS_END
WRITE_LINE_MEMBER(hp9k3xx_state::cpu_reset)
{
- m_iocpu->reset();
}
@@ -330,49 +287,6 @@ void hp9k3xx_state::machine_reset()
m_maincpu->set_reset_callback(write_line_delegate(FUNC(hp9k3xx_state::cpu_reset), this));
}
-WRITE_LINE_MEMBER(hp9k3xx_state::gpib_irq)
-{
- gpib_irq_line = state;
- m_maincpu->set_input_line(M68K_IRQ_3, state ? ASSERT_LINE : CLEAR_LINE);
-}
-
-WRITE8_MEMBER(hp9k3xx_state::gpib_w)
-{
- if (offset & 0x08) {
- m_tms9914->reg8_w(space, offset & 0x07, data);
- return;
- }
- LOG("gpib_w: %s %02X = %02X\n", machine().describe_context().c_str(), offset, data);
-}
-
-READ8_MEMBER(hp9k3xx_state::gpib_r)
-{
- uint8_t data = 0xff;
-
- if (offset & 0x8) {
- data = m_tms9914->reg8_r(space, offset & 0x07);
- return data;
- }
-
- switch(offset) {
- case 0: /* ID */
- data = 0x80;
- break;
- case 1:
- /* Int control */
- data = 0x80 | (gpib_irq_line ? 0x40 : 0);
- break;
- case 2:
- /* Address */
- data = (m_tms9914->cont_r() ? 0x0 : 0x40) | 0x81;
- if (m_kbd_nmi)
- data |= 0x04;
- break;
- }
- LOG("gpib_r: %s %02X = %02X\n", machine().describe_context().c_str(), offset, data);
- return data;
-}
-
READ16_MEMBER(hp9k3xx_state::buserror16_r)
{
m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE);
@@ -410,47 +324,6 @@ WRITE32_MEMBER(hp9k3xx_state::buserror_w)
m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE);
}
-WRITE8_MEMBER(hp9k3xx_state::iocpu_port1_w)
-{
- m_hil_data = data;
-}
-
-WRITE8_MEMBER(hp9k3xx_state::iocpu_port2_w)
-{
- if ((data & (HIL_CS|HIL_WE)) == 0)
- m_mlc->write(space, (m_latch_data & 0xc0) >> 6, m_hil_data, 0xff);
-
- if ((data & SN76494_EN) == 0)
- m_sound->write(m_hil_data);
-
- m_hil_read = ((data & (HIL_CS|HIL_OE)) == 0);
-
- if (!(data & LATCH_EN))
- m_latch_data = m_hil_data;
-
- m_maincpu->set_input_line(M68K_IRQ_1, data & 0x10 ? ASSERT_LINE : CLEAR_LINE);
-
- if (!(data & KBD_RESET)) {
- m_maincpu->set_input_line(M68K_IRQ_7, ASSERT_LINE);
- m_kbd_nmi = true;
- } else {
- m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE);
- m_kbd_nmi = false;
- }
-}
-
-READ8_MEMBER(hp9k3xx_state::iocpu_port1_r)
-{
- if (m_hil_read)
- return m_mlc->read(space, (m_latch_data & 0xc0) >> 6, 0xff);
- return 0xff;
-}
-
-READ8_MEMBER(hp9k3xx_state::iocpu_test0_r)
-{
- return !m_mlc->get_int();
-}
-
static void dio16_cards(device_slot_interface &device)
{
device.option_add("98543", HPDIO_98543); /* 98543 Medium Resolution Color Card */
@@ -458,53 +331,15 @@ static void dio16_cards(device_slot_interface &device)
device.option_add("98603a", HPDIO_98603A); /* 98603A ROM BASIC (4.0) */
device.option_add("98603b", HPDIO_98603B); /* 98603B ROM BASIC (5.1) */
device.option_add("98644", HPDIO_98644); /* 98644 Async serial interface */
+ device.option_add("human_interface", HPDIO_HUMAN_INTERFACE);
}
MACHINE_CONFIG_START(hp9k3xx_state::hp9k300)
- MCFG_DEVICE_ADD(m_iocpu, I8042, 5000000)
- MCFG_DEVICE_PROGRAM_MAP(iocpu_map)
- MCFG_MCS48_PORT_P1_OUT_CB(WRITE8(*this, hp9k3xx_state, iocpu_port1_w))
- MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(*this, hp9k3xx_state, iocpu_port2_w))
- MCFG_MCS48_PORT_P1_IN_CB(READ8(*this, hp9k3xx_state, iocpu_port1_r))
- MCFG_MCS48_PORT_T0_IN_CB(READ8(*this, hp9k3xx_state, iocpu_test0_r))
-
- MCFG_DEVICE_ADD(m_mlc, HP_HIL_MLC, XTAL(8'000'000))
- MCFG_HP_HIL_SLOT_ADD(MLC_TAG, "hil1", hp_hil_devices, "hp_46021a")
-
ptm6840_device &ptm(PTM6840(config, PTM6840_TAG, 250000)); // from oscillator module next to the 6840
ptm.set_external_clocks(250000.0f, 0.0f, 250000.0f);
ptm.o3_callback().set(PTM6840_TAG, FUNC(ptm6840_device::set_c2));
ptm.irq_callback().set_inputline("maincpu", M68K_IRQ_6);
- SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD(SN76494_TAG, SN76494, SN76494_CLOCK)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
-
- MCFG_DEVICE_ADD(m_tms9914, TMS9914, XTAL(5000000))
- MCFG_TMS9914_INT_WRITE_CB(WRITELINE(*this, hp9k3xx_state, gpib_irq));
- MCFG_TMS9914_DIO_READWRITE_CB(READ8(IEEE488_TAG, ieee488_device, dio_r), WRITE8(IEEE488_TAG, ieee488_device, host_dio_w))
- MCFG_TMS9914_EOI_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_eoi_w))
- MCFG_TMS9914_DAV_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_dav_w))
- MCFG_TMS9914_NRFD_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_nrfd_w))
- MCFG_TMS9914_NDAC_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_ndac_w))
- MCFG_TMS9914_IFC_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_ifc_w))
- MCFG_TMS9914_SRQ_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_srq_w))
- MCFG_TMS9914_ATN_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_atn_w))
- MCFG_TMS9914_REN_WRITE_CB(WRITELINE(IEEE488_TAG, ieee488_device, host_ren_w))
-
- MCFG_IEEE488_SLOT_ADD("ieee0", 0, hp_ieee488_devices, "hp9122c")
- MCFG_IEEE488_SLOT_ADD("ieee_rem", 0, remote488_devices, nullptr)
- MCFG_IEEE488_BUS_ADD()
-
- MCFG_IEEE488_EOI_CALLBACK(WRITELINE(m_tms9914, tms9914_device, eoi_w))
- MCFG_IEEE488_DAV_CALLBACK(WRITELINE(m_tms9914, tms9914_device, dav_w))
- MCFG_IEEE488_NRFD_CALLBACK(WRITELINE(m_tms9914, tms9914_device, nrfd_w))
- MCFG_IEEE488_NDAC_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ndac_w))
- MCFG_IEEE488_IFC_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ifc_w))
- MCFG_IEEE488_SRQ_CALLBACK(WRITELINE(m_tms9914, tms9914_device, srq_w))
- MCFG_IEEE488_ATN_CALLBACK(WRITELINE(m_tms9914, tms9914_device, atn_w))
- MCFG_IEEE488_REN_CALLBACK(WRITELINE(m_tms9914, tms9914_device, ren_w))
-
MCFG_SOFTWARE_LIST_ADD("flop_list", "hp9k3xx_flop")
MACHINE_CONFIG_END
@@ -516,6 +351,14 @@ MACHINE_CONFIG_START(hp9k3xx_state::hp9k310)
bus::hp_dio::dio16_device &dio16(DIO16(config, "diobus", 0));
dio16.set_cputag(m_maincpu);
+ dio16.irq1_out_cb().set(FUNC(hp9k3xx_state::dio_irq1_w));
+ dio16.irq2_out_cb().set(FUNC(hp9k3xx_state::dio_irq2_w));
+ dio16.irq3_out_cb().set(FUNC(hp9k3xx_state::dio_irq3_w));
+ dio16.irq4_out_cb().set(FUNC(hp9k3xx_state::dio_irq4_w));
+ dio16.irq5_out_cb().set(FUNC(hp9k3xx_state::dio_irq5_w));
+ dio16.irq6_out_cb().set(FUNC(hp9k3xx_state::dio_irq6_w));
+ dio16.irq7_out_cb().set(FUNC(hp9k3xx_state::dio_irq7_w));
+
DIO16_SLOT(config, "sl1", 0, "diobus", dio16_cards, "98544", false);
DIO16_SLOT(config, "sl2", 0, "diobus", dio16_cards, "98603b", false);
DIO16_SLOT(config, "sl3", 0, "diobus", dio16_cards, "98644", false);
@@ -532,6 +375,15 @@ MACHINE_CONFIG_START(hp9k3xx_state::hp9k320)
bus::hp_dio::dio16_device &dio32(DIO32(config, "diobus", 0));
dio32.set_cputag(m_maincpu);
+ dio32.irq1_out_cb().set(FUNC(hp9k3xx_state::dio_irq1_w));
+ dio32.irq2_out_cb().set(FUNC(hp9k3xx_state::dio_irq2_w));
+ dio32.irq3_out_cb().set(FUNC(hp9k3xx_state::dio_irq3_w));
+ dio32.irq4_out_cb().set(FUNC(hp9k3xx_state::dio_irq4_w));
+ dio32.irq5_out_cb().set(FUNC(hp9k3xx_state::dio_irq5_w));
+ dio32.irq6_out_cb().set(FUNC(hp9k3xx_state::dio_irq6_w));
+ dio32.irq7_out_cb().set(FUNC(hp9k3xx_state::dio_irq7_w));
+
+ DIO32_SLOT(config, "sl0", 0, "diobus", dio16_cards, "human_interface", true);
DIO32_SLOT(config, "sl1", 0, "diobus", dio16_cards, "98544", false);
DIO32_SLOT(config, "sl2", 0, "diobus", dio16_cards, "98603b", false);
DIO32_SLOT(config, "sl3", 0, "diobus", dio16_cards, "98644", false);
@@ -547,6 +399,15 @@ MACHINE_CONFIG_START(hp9k3xx_state::hp9k330)
bus::hp_dio::dio16_device &dio32(DIO32(config, "diobus", 0));
dio32.set_cputag(m_maincpu);
+ dio32.irq1_out_cb().set(FUNC(hp9k3xx_state::dio_irq1_w));
+ dio32.irq2_out_cb().set(FUNC(hp9k3xx_state::dio_irq2_w));
+ dio32.irq3_out_cb().set(FUNC(hp9k3xx_state::dio_irq3_w));
+ dio32.irq4_out_cb().set(FUNC(hp9k3xx_state::dio_irq4_w));
+ dio32.irq5_out_cb().set(FUNC(hp9k3xx_state::dio_irq5_w));
+ dio32.irq6_out_cb().set(FUNC(hp9k3xx_state::dio_irq6_w));
+ dio32.irq7_out_cb().set(FUNC(hp9k3xx_state::dio_irq7_w));
+
+ DIO32_SLOT(config, "sl0", 0, "diobus", dio16_cards, "human_interface", true);
DIO32_SLOT(config, "sl1", 0, "diobus", dio16_cards, "98544", false);
DIO32_SLOT(config, "sl2", 0, "diobus", dio16_cards, "98603b", false);
DIO32_SLOT(config, "sl3", 0, "diobus", dio16_cards, "98644", false);
@@ -599,10 +460,6 @@ ROM_START( hp9k310 )
ROM_LOAD16_BYTE( "1818-3771.bin", 0x000001, 0x008000, CRC(b9e4e3ad) SHA1(ed6f1fad94a15d95362701dbe124b52877fc3ec4) )
ROM_LOAD16_BYTE( "1818-3772.bin", 0x000000, 0x008000, CRC(a3665919) SHA1(ec1bc7e5b7990a1b09af947a06401e8ed3cb0516) )
- ROM_REGION( 0x800, IOCPU_TAG, 0 )
- ROM_LOAD( "1820-4784_1.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b) )
- ROM_LOAD( "1820-4784_2.bin", 0x000000, 0x000800, CRC(8defcf50) SHA1(d3abfea468a43db7c2369500a3e390e77a8e22e6) )
-
ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE )
ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000000, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) )
ROM_END
@@ -613,18 +470,12 @@ ROM_START( hp9k320 )
ROM_LOAD16_BYTE( "5061-6539.bin", 0x000000, 0x004000, CRC(a7ff104c) SHA1(c640fe68314654716bd41b04c6a7f4e560036c7e) )
ROM_LOAD16_BYTE( "5061-6540.bin", 0x008001, 0x004000, CRC(4f6796d6) SHA1(fd254897ac1afb8628f40ea93213f60a082c8d36) )
ROM_LOAD16_BYTE( "5061-6541.bin", 0x008000, 0x004000, CRC(39d32998) SHA1(6de1bda75187b0878c03c074942b807cf2924f0e) )
-
- ROM_REGION( 0x800, IOCPU_TAG, 0 )
- ROM_LOAD( "1820-4784.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b) )
ROM_END
ROM_START( hp9k330 )
ROM_REGION( 0x20000, MAINCPU_TAG, 0 )
ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) )
ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) )
-
- ROM_REGION( 0x800, IOCPU_TAG, 0 )
- ROM_LOAD( "1820-4784.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b) )
ROM_END
ROM_START( hp9k332 )
@@ -632,9 +483,6 @@ ROM_START( hp9k332 )
ROM_LOAD16_BYTE( "1818-4796.bin", 0x000000, 0x010000, CRC(8a7642da) SHA1(7ba12adcea85916d18b021255391bec806c32e94) )
ROM_LOAD16_BYTE( "1818-4797.bin", 0x000001, 0x010000, CRC(98129eb1) SHA1(f3451a854060f1be1bee9f17c5c198b4b1cd61ac) )
- ROM_REGION( 0x800, IOCPU_TAG, 0 )
- ROM_LOAD( "1820-4784.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b) )
-
ROM_REGION( 0x4000, "graphics", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT )
ROM_LOAD16_BYTE( "5180-0471.bin", 0x000001, 0x002000, CRC(7256af2e) SHA1(584e8d4dcae8c898c1438125dc9c4709631b32f7) )
ROM_END
@@ -644,34 +492,23 @@ ROM_START( hp9k340 )
ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) )
ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) )
- ROM_REGION( 0x800, IOCPU_TAG, 0 )
- ROM_LOAD( "1820-4784.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b) )
ROM_END
ROM_START( hp9k370 )
ROM_REGION( 0x20000, MAINCPU_TAG, 0 )
ROM_LOAD16_BYTE( "1818-4416.bin", 0x000000, 0x010000, CRC(cd71e85e) SHA1(3e83a80682f733417fdc3720410e45a2cfdcf869) )
ROM_LOAD16_BYTE( "1818-4417.bin", 0x000001, 0x010000, CRC(374d49db) SHA1(a12cbf6c151e2f421da4571000b5dffa3ef403b3) )
-
- ROM_REGION( 0x800, IOCPU_TAG, 0 )
- ROM_LOAD( "1820-4784.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b) )
ROM_END
ROM_START( hp9k380 )
ROM_REGION( 0x20000, MAINCPU_TAG, 0 )
ROM_LOAD16_WORD_SWAP( "1818-5062_98754_9000-380_27c210.bin", 0x000000, 0x020000, CRC(500a0797) SHA1(4c0a3929e45202a2689e353657e5c4b58ff9a1fd) )
-
- ROM_REGION( 0x800, IOCPU_TAG, 0 )
- ROM_LOAD( "1820-4784.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b) )
ROM_END
ROM_START( hp9k382 )
ROM_REGION( 0x20000, MAINCPU_TAG, 0 )
ROM_LOAD16_WORD_SWAP( "1818-5468_27c1024.bin", 0x000000, 0x020000, CRC(d1d9ef13) SHA1(6bbb17b9adad402fbc516dc2f3143e9c38ceef8e) )
- ROM_REGION( 0x800, IOCPU_TAG, 0 )
- ROM_LOAD( "1820-4784.bin", 0x000000, 0x000800, CRC(e929044a) SHA1(90849a10bdb8c6e38e73ce027c9c0ad8b3956b1b) )
-
ROM_REGION( 0x2000, "unknown", ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT )
ROM_LOAD( "1818-5282_8ce61e951207_28c64.bin", 0x000000, 0x002000, CRC(740442f3) SHA1(ab65bd4eec1024afb97fc2dd3bd3f017e90f49ae) )
ROM_END