diff options
Diffstat (limited to 'src/mame/drivers/hp2620.cpp')
-rw-r--r-- | src/mame/drivers/hp2620.cpp | 70 |
1 files changed, 57 insertions, 13 deletions
diff --git a/src/mame/drivers/hp2620.cpp b/src/mame/drivers/hp2620.cpp index f091e0bf0b7..10f31895c17 100644 --- a/src/mame/drivers/hp2620.cpp +++ b/src/mame/drivers/hp2620.cpp @@ -7,7 +7,9 @@ Skeleton driver for HP-2620 series display terminals. ************************************************************************************************************************************/ #include "emu.h" +#include "bus/rs232/rs232.h" #include "cpu/z80/z80.h" +#include "machine/input_merger.h" #include "machine/mos6551.h" #include "machine/nvram.h" #include "video/dp8350.h" @@ -19,21 +21,27 @@ public: hp2620_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") + , m_nmigate(*this, "nmigate") , m_crtc(*this, "crtc") + , m_datacomm(*this, "datacomm") , m_p_chargen(*this, "chargen") , m_nvram(*this, "nvram") { } void hp2622(machine_config &config); +protected: + virtual void machine_reset() override; + private: - DECLARE_READ8_MEMBER(nvram_r); - DECLARE_WRITE8_MEMBER(nvram_w); - DECLARE_READ8_MEMBER(keystat_r); - DECLARE_WRITE8_MEMBER(keydisp_w); - DECLARE_READ8_MEMBER(sysstat_r); - DECLARE_WRITE8_MEMBER(modem_w); + u8 nvram_r(offs_t offset); + void nvram_w(offs_t offset, u8 data); + u8 keystat_r(); + void keydisp_w(u8 data); + u8 sysstat_r(); + void modem_w(u8 data); void crtc_w(offs_t offset, u8 data); + void ennmi_w(offs_t offset, u8 data); u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -41,7 +49,9 @@ private: void mem_map(address_map &map); required_device<cpu_device> m_maincpu; + required_device<input_merger_device> m_nmigate; required_device<dp8367_device> m_crtc; + required_device<rs232_port_device> m_datacomm; required_region_ptr<u8> m_p_chargen; required_shared_ptr<u8> m_nvram; }; @@ -52,32 +62,46 @@ u32 hp2620_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, con return 0; } -READ8_MEMBER(hp2620_state::nvram_r) +u8 hp2620_state::nvram_r(offs_t offset) { + // TODO: wait states return 0xf0 | m_nvram[offset]; } -WRITE8_MEMBER(hp2620_state::nvram_w) +void hp2620_state::nvram_w(offs_t offset, u8 data) { + // TODO: wait states m_nvram[offset] = data & 0x0f; } -READ8_MEMBER(hp2620_state::keystat_r) +u8 hp2620_state::keystat_r() { return 0xff; } -WRITE8_MEMBER(hp2620_state::keydisp_w) +void hp2620_state::keydisp_w(u8 data) { } -READ8_MEMBER(hp2620_state::sysstat_r) +u8 hp2620_state::sysstat_r() { - return 0xff; + // LS244 at U36 + u8 status = 0xe0; + + status |= m_crtc->vblank_r() << 0; + // TODO: D1 = PINT; + status |= m_datacomm->dsr_r() << 2; // DM (J6-12) + status |= m_datacomm->cts_r() << 3; // CS (J6-11) + status |= m_datacomm->ri_r() << 4; // OCR1 (J6-18) + + return status; } -WRITE8_MEMBER(hp2620_state::modem_w) +void hp2620_state::modem_w(u8 data) { + // LS174 at U35 (TODO: D0 = DISPOFF) + m_datacomm->write_spds(BIT(data, 1)); // OCD1 (J6-7) + m_crtc->refresh_control(BIT(data, 5)); } void hp2620_state::crtc_w(offs_t offset, u8 data) @@ -85,6 +109,11 @@ void hp2620_state::crtc_w(offs_t offset, u8 data) m_crtc->register_load(data & 3, offset & 0xfff); } +void hp2620_state::ennmi_w(offs_t offset, u8 data) +{ + m_nmigate->in_w<0>(BIT(offset, 0)); +} + void hp2620_state::mem_map(address_map &map) { map(0x0000, 0xbfff).rom().region("maincpu", 0); @@ -97,11 +126,18 @@ void hp2620_state::io_map(address_map &map) map.global_mask(0xff); map(0x00, 0x7f).rw(FUNC(hp2620_state::nvram_r), FUNC(hp2620_state::nvram_w)).share("nvram"); map(0x80, 0x80).r(FUNC(hp2620_state::keystat_r)); + map(0x88, 0x89).w(FUNC(hp2620_state::ennmi_w)); map(0x90, 0x90).r(FUNC(hp2620_state::sysstat_r)); map(0xa0, 0xa3).w("acia", FUNC(mos6551_device::write)); map(0xa4, 0xa7).r("acia", FUNC(mos6551_device::read)); map(0xa8, 0xa8).w(FUNC(hp2620_state::modem_w)); map(0xb8, 0xb8).w(FUNC(hp2620_state::keydisp_w)); + map(0xe1, 0xe1).nopw(); // program bug, undocumented expansion or ??? +} + +void hp2620_state::machine_reset() +{ + m_nmigate->in_w<1>(0); } static INPUT_PORTS_START( hp2622 ) @@ -115,6 +151,8 @@ void hp2620_state::hp2622(machine_config &config) NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // 5101 (A7 tied to GND) + battery (+ wait states) + INPUT_MERGER_ALL_HIGH(config, m_nmigate).output_handler().set_inputline(m_maincpu, INPUT_LINE_NMI); + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_screen_update(FUNC(hp2620_state::screen_update)); @@ -124,6 +162,12 @@ void hp2620_state::hp2622(machine_config &config) mos6551_device &acia(MOS6551(config, "acia", 0)); // SY6551 acia.set_xtal(25.7715_MHz_XTAL / 14); // 1.84 MHz acia.irq_handler().set_inputline("maincpu", INPUT_LINE_IRQ0); + acia.rts_handler().set(m_datacomm, FUNC(rs232_port_device::write_rts)); // RS (J6-22) + acia.dtr_handler().set(m_datacomm, FUNC(rs232_port_device::write_dtr)); // TR (J6-23) + acia.txd_handler().set(m_datacomm, FUNC(rs232_port_device::write_txd)); // SD (J6-21) + + RS232_PORT(config, m_datacomm, default_rs232_devices, nullptr); + m_datacomm->rxd_handler().set("acia", FUNC(mos6551_device::write_rxd)); // RD (J6-9) } /************************************************************************************************************** |