From c402a32302b793dd1165761dacf5a308e350d880 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Fri, 12 Jul 2024 14:28:44 +0300 Subject: nokia/mikromikko2: Wired up the serial I/O and attached a diagnostic terminal. [Curt Coder] --- src/mame/nokia/mikromikko2.cpp | 44 ++++++++++++++++++++++++++++++++---------- src/mame/nokia/mikromikko2.h | 18 +++++++++++++++++ 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/src/mame/nokia/mikromikko2.cpp b/src/mame/nokia/mikromikko2.cpp index 3c4b9579567..bb439d36040 100644 --- a/src/mame/nokia/mikromikko2.cpp +++ b/src/mame/nokia/mikromikko2.cpp @@ -43,7 +43,7 @@ void mm2_state::novram_store(offs_t offset, uint8_t data) void mm2_state::novram_recall(offs_t offset, uint8_t data) { - m_novram->recall(BIT(data, 0)); + m_novram->recall(!BIT(data, 0)); } uint8_t mm2_state::videoram_r(offs_t offset) @@ -61,6 +61,15 @@ uint8_t mm2_state::videoram_r(offs_t offset) return data & 0xff; } +uint8_t mm2_state::status_r(offs_t offset) +{ + uint8_t data = 0x80; + + data |= !m_rs232a->dsr_r() << 4; + + return data; +} + void mm2_state::mm2_map(address_map &map) { map(0x00000, 0x1ffff).ram(); // DRAM 128 KB (on SBC186) @@ -77,24 +86,24 @@ void mm2_state::mm2_io_map(address_map &map) { // SBC16 map(0xf800, 0xf803).rw(m_pic, FUNC(pic8259_device::read), FUNC(pic8259_device::write)).umask16(0x00ff); - map(0xf880, 0xf887).rw(m_mpsc, FUNC(i8274_device::cd_ba_r), FUNC(i8274_device::cd_ba_w)).umask16(0xff00); - //map(0xf885, 0xf885) STATUS INPUT PORT + map(0xf880, 0xf887).rw(m_mpsc, FUNC(i8274_device::cd_ba_r), FUNC(i8274_device::cd_ba_w)).umask16(0x00ff); + map(0xf884, 0xf885).r(FUNC(mm2_state::status_r)).umask16(0xff00); map(0xf900, 0xf901).w(FUNC(mm2_state::novram_store)).umask16(0x00ff); map(0xf97e, 0xf97f).w(FUNC(mm2_state::novram_recall)).umask16(0xff00); map(0xf930, 0xf937).rw(m_pit, FUNC(pit8253_device::read), FUNC(pit8253_device::write)).umask16(0xff00); - //map(0xf941, 0xf941) TIMER INTERRUPT CLEAR LATCH + map(0xf940, 0xf941).w(FUNC(mm2_state::tcl_w)).umask16(0xff00); map(0xf950, 0xf951).w(FUNC(mm2_state::diag_w)).umask16(0xff00); - //map(0xf961, 0xf961) CLOCK SELECT CLS0 - //map(0xf963, 0xf963) CLOCK SELECT CLS1 + map(0xf960, 0xf961).w(FUNC(mm2_state::cls0_w)).umask16(0xff00); + map(0xf962, 0xf963).w(FUNC(mm2_state::cls1_w)).umask16(0xff00); //map(0xf965, 0xf965) LOOPBACK LLBA //map(0xf967, 0xf967) LOOPBACK LLBB //map(0xf969, 0xf969) DATA CODING NRZI //map(0xf96b, 0xf96b) SIGNAL LEVELS V24 //map(0xf96d, 0xf96d) SIGNAL LEVELS X27 - //map(0xf96f, 0xf96f) V24 SIGNAL DTRA + map(0xf96e, 0xf96f).w(FUNC(mm2_state::dtra_w)).umask16(0xff00); //map(0xf971, 0xf971) V24 SIGNAL TSTA //map(0xf973, 0xf973) V24 SIGNAL SRSA - //map(0xf975, 0xf975) V24 SIGNAL DTRB + map(0xf974, 0xf975).w(FUNC(mm2_state::dtrb_w)).umask16(0xff00); // CRTC186 map(0xf980, 0xf9ff).rw(m_vpac, FUNC(crt9007_device::read), FUNC(crt9007_device::write)).umask16(0x00ff); @@ -220,6 +229,8 @@ void mm2_state::mm2(machine_config &config) I80186(config, m_maincpu, 16_MHz_XTAL/2); m_maincpu->set_addrmap(AS_PROGRAM, &mm2_state::mm2_map); m_maincpu->set_addrmap(AS_IO, &mm2_state::mm2_io_map); + m_maincpu->tmrout0_handler().set(FUNC(mm2_state::tmrout0_w)); + m_maincpu->tmrout1_handler().set(FUNC(mm2_state::tmrout1_w)); PIC8259(config, m_pic); m_pic->out_int_callback().set(m_maincpu, FUNC(i80186_cpu_device::int0_w)); @@ -228,12 +239,25 @@ void mm2_state::mm2(machine_config &config) m_pit->set_clk<0>(16_MHz_XTAL/8); m_pit->set_clk<1>(16_MHz_XTAL/8); m_pit->set_clk<2>(16_MHz_XTAL/8); - m_pit->out_handler<0>().set(m_pic, FUNC(pic8259_device::ir0_w)); - //m_pit->out_handler<1>().set()); MPSC ch B line clock + m_pit->out_handler<0>().set(FUNC(mm2_state::ir0_w)); + m_pit->out_handler<1>().set(m_mpsc, FUNC(i8274_device::rxtxcb_w)); m_pit->out_handler<2>().set(m_speaker, FUNC(speaker_sound_device::level_w)); I8274(config, m_mpsc, 16_MHz_XTAL/4); + m_mpsc->out_txda_callback().set(m_rs232a, FUNC(rs232_port_device::write_txd)); + m_mpsc->out_rtsa_callback().set(m_rs232a, FUNC(rs232_port_device::write_rts)); + m_mpsc->out_txdb_callback().set(m_rs232b, FUNC(rs232_port_device::write_txd)); + m_mpsc->out_rtsb_callback().set(m_rs232b, FUNC(rs232_port_device::write_rts)); m_mpsc->out_int_callback().set(m_pic, FUNC(pic8259_device::ir1_w)); + + RS232_PORT(config, m_rs232a, default_rs232_devices, nullptr); + m_rs232a->rxd_handler().set(m_mpsc, FUNC(z80dart_device::rxa_w)); + m_rs232a->dcd_handler().set(m_mpsc, FUNC(z80dart_device::dcda_w)); + m_rs232a->cts_handler().set(m_mpsc, FUNC(z80dart_device::ctsa_w)); + + RS232_PORT(config, m_rs232b, default_rs232_devices, "terminal"); + m_rs232b->rxd_handler().set(m_mpsc, FUNC(z80dart_device::rxb_w)); + m_rs232b->cts_handler().set(m_mpsc, FUNC(z80dart_device::ctsb_w)); X2212(config, m_novram); diff --git a/src/mame/nokia/mikromikko2.h b/src/mame/nokia/mikromikko2.h index e46d5eed90d..38fed8a2ac2 100644 --- a/src/mame/nokia/mikromikko2.h +++ b/src/mame/nokia/mikromikko2.h @@ -9,6 +9,7 @@ #include "screen.h" #include "speaker.h" #include "bus/nscsi/devices.h" +#include "bus/rs232/rs232.h" #include "bus/scsi/s1410.h" #include "bus/scsi/scsihd.h" #include "cpu/i86/i186.h" @@ -49,6 +50,8 @@ public: m_fdc(*this, UPD765_TAG), m_speaker(*this, "speaker"), m_sasi(*this, "sasi:7:scsicb"), + m_rs232a(*this, "rs232a"), + m_rs232b(*this, "rs232b"), m_palette(*this, "palette") { } @@ -72,6 +75,8 @@ private: required_device m_fdc; required_device m_speaker; required_device m_sasi; + required_device m_rs232a; + required_device m_rs232b; required_device m_palette; void mm2_map(address_map &map); @@ -90,11 +95,24 @@ private: bool m_vpac_int; bool m_sio_rxrdy; bool m_sio_txrdy; + int m_cls; + bool m_ir0; + void update_pic_ir0() { m_pic->ir0_w(m_ir0); } + void ir0_w(int state) { if (state) { m_ir0 = ASSERT_LINE; update_pic_ir0(); } } + void tcl_w(offs_t offset, uint8_t data) { m_ir0 = CLEAR_LINE; update_pic_ir0(); } + void update_pic_ir5() { m_pic->ir5_w(m_vpac_int || m_sio_rxrdy || m_sio_txrdy); } void vpac_int_w(int state) { m_vpac_int = state; update_pic_ir5(); } void sio_rxrdy_w(int state) { m_sio_rxrdy = state; update_pic_ir5(); } void sio_txrdy_w(int state) { m_sio_txrdy = state; update_pic_ir5(); } + void dtra_w(offs_t offset, uint8_t data) { m_rs232a->write_txd(!BIT(data, 0)); } + void dtrb_w(offs_t offset, uint8_t data) { m_rs232b->write_txd(!BIT(data, 0)); } + uint8_t status_r(offs_t offset); + void cls0_w(offs_t offset, uint8_t data) { m_cls = (m_cls & 0x2) | BIT(data, 0); } + void cls1_w(offs_t offset, uint8_t data) { m_cls = (BIT(data, 0) << 1) | (m_cls & 0x1); } + void tmrout0_w(int state) { if (m_cls == 0) { m_mpsc->rxca_w(state); m_mpsc->txca_w(state); } }; + void tmrout1_w(int state) { if (m_cls == 1) { m_mpsc->rxca_w(state); m_mpsc->txca_w(state); } }; bool m_cpl; bool m_blc; -- cgit v1.2.3