From 29b1e6283bf4884fd257df771072b2e188eef47f Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Sat, 11 Jan 2025 13:06:37 +0100 Subject: lsi/m3: Fix floppy regression, add initial software list New working software list additions ----------------------------------- M3 Utilities (Release 3) [Steve Hunt] --- hash/m3.xml | 20 +++++++++++++++++++ src/mame/lsi/m3.cpp | 55 +++++++++++++++++++++++++++-------------------------- 2 files changed, 48 insertions(+), 27 deletions(-) create mode 100644 hash/m3.xml diff --git a/hash/m3.xml b/hash/m3.xml new file mode 100644 index 00000000000..d7c98f11288 --- /dev/null +++ b/hash/m3.xml @@ -0,0 +1,20 @@ + + + + + + + + + + M3 Utilities (Release 3) + 198? + LSI + + + + + + + + diff --git a/src/mame/lsi/m3.cpp b/src/mame/lsi/m3.cpp index a077124757d..4502cab39ac 100644 --- a/src/mame/lsi/m3.cpp +++ b/src/mame/lsi/m3.cpp @@ -31,14 +31,13 @@ TODO: - Initial PC is currently hacked to f000 - - Verify/fix floppy hookup (CPU needs to be overclocked?) + - Verify/fix floppy hookup - Printer interface - Buzzer - Map the rest of the keys, verify existing keys - Switch FDC to 1 MHz for 5.25" drives Notes: - - No offical software available, but a custom version of CP/M - Y to boot from floppy, ESC to enter monitor, any other key to boot from IDE @@ -56,6 +55,7 @@ #include "bus/rs232/rs232.h" #include "emupal.h" #include "screen.h" +#include "softlist_dev.h" namespace { @@ -126,7 +126,9 @@ private: void fdc_drq_w(int state); uint8_t fdc_data_r(offs_t offset); void fdc_data_w(offs_t offset, uint8_t data); - bool m_nmi_taken = 0; + + bool m_nmi_enabled = false; + bool m_nmi_taken = false; }; @@ -451,8 +453,8 @@ void m3_state::fdc_intrq_w(int state) { if (state) { + m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); m_nmi_taken = false; - m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); } m_ctc->trg1(state); @@ -461,22 +463,25 @@ void m3_state::fdc_intrq_w(int state) void m3_state::fdc_drq_w(int state) { if (state) - m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); - - if (state && !m_nmi_taken) { - m_nmi_taken = true; - m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); + m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); + + if (m_nmi_enabled) + { + m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); + + m_nmi_enabled = false; + m_nmi_taken = true; + } } } uint8_t m3_state::fdc_data_r(offs_t offset) { - if ((m_fdc->drq_r() == 0) && m_nmi_taken) + if (m_nmi_taken && m_fdc->drq_r() == 0) { - // cpu tries to read data without drq, halt it and reset pc - m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - m_maincpu->set_state_int(Z80_PC, m_maincpu->state_int(Z80_PC) - 2); + m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + m_maincpu->retry_access(); return 0; } @@ -486,13 +491,10 @@ uint8_t m3_state::fdc_data_r(offs_t offset) void m3_state::fdc_data_w(offs_t offset, uint8_t data) { - if ((m_fdc->drq_r() == 0) && m_nmi_taken) + if (m_nmi_taken && m_fdc->drq_r() == 0) { - // cpu tries to write data without drq, halt it and reset pc - m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); - m_maincpu->set_state_int(Z80_PC, m_maincpu->state_int(Z80_PC) - 2); - - return; + m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, ASSERT_LINE); + m_maincpu->retry_access(); } m_fdc->data_w(data); @@ -505,7 +507,7 @@ void m3_state::ppi2_pa_w(uint8_t data) // 7------- not used? // -6------ buzzer // --5----- not used? - // ---4---- unknown (motor?) + // ---4---- nmi enable // ----3--- unknown // -----2-- floppy side // ------10 drive select @@ -521,6 +523,8 @@ void m3_state::ppi2_pa_w(uint8_t data) if (floppy) floppy->ss_w(BIT(data, 2)); + + m_nmi_enabled = bool(BIT(~data, 4)); } uint8_t m3_state::ppi2_pb_r() @@ -534,6 +538,7 @@ void m3_state::machine_start() save_item(NAME(m_kbd_col)); save_item(NAME(m_kbd_row)); save_item(NAME(m_kbd_data)); + save_item(NAME(m_nmi_enabled)); save_item(NAME(m_nmi_taken)); } @@ -541,13 +546,8 @@ void m3_state::machine_reset() { m_maincpu->set_pc(0xf000); + m_nmi_enabled = false; m_nmi_taken = false; - - // floppy motor is always on - if (m_floppy[0]) - m_floppy[0]->get_device()->mon_w(0); - if (m_floppy[1]) - m_floppy[1]->get_device()->mon_w(0); } @@ -582,7 +582,6 @@ static void m3_floppies(device_slot_interface &device) void m3_state::m3(machine_config &config) { Z80(config, m_maincpu, 4.9152_MHz_XTAL / 2); - m_maincpu->set_clock_scale(1.2f); // needs to be overclocked or its too slow for the floppy m_maincpu->set_addrmap(AS_PROGRAM, &m3_state::mem_map); m_maincpu->set_addrmap(AS_IO, &m3_state::io_map); m_maincpu->set_daisy_config(daisy_chain); @@ -633,6 +632,8 @@ void m3_state::m3(machine_config &config) FLOPPY_CONNECTOR(config, "fdc:0", m3_floppies, "sa850", floppy_image_device::default_mfm_floppy_formats); FLOPPY_CONNECTOR(config, "fdc:1", m3_floppies, "sa850", floppy_image_device::default_mfm_floppy_formats); + SOFTWARE_LIST(config, "floppy_list").set_original("m3"); + // keyboard I8035(config, m_kbdmcu, 6.144_MHz_XTAL); m_kbdmcu->set_addrmap(AS_PROGRAM, &m3_state::kbd_mem_map); -- cgit v1.2.3