From d95b885da9aca92c2921a67265c41cca5b31e640 Mon Sep 17 00:00:00 2001 From: arbee Date: Wed, 30 Dec 2020 10:03:57 -0500 Subject: [PATCH] dim68k: add DUART, use views for boot-time bankswitch, some minor cleanup [R. Belmont] --- src/mame/drivers/dim68k.cpp | 126 ++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 70 deletions(-) diff --git a/src/mame/drivers/dim68k.cpp b/src/mame/drivers/dim68k.cpp index b2937aaef95..396489244fa 100644 --- a/src/mame/drivers/dim68k.cpp +++ b/src/mame/drivers/dim68k.cpp @@ -1,33 +1,25 @@ // license:BSD-3-Clause -// copyright-holders:Robbbert +// copyright-holders:R. Belmont, Robbbert /*************************************************************************** Micro Craft Dimension 68000 - 28/12/2011 Skeleton driver. - This computer had the facility for plug-in cards to emulate popular - computers of the time such as apple, trs80, kaypro, etc. The floppy - disk parameters could be set to be able to read the disks of the - various systems, or you create any other format you wished. + computers of the time such as the Apple II Plus, TRS80, Kaypro, etc. + The floppy disk parameters could be set to be able to read the disks + of the emulated systems, or you create any other format you wished. - There is no schematic available, so not fully able to emulate at - this time. - - ToDo: - - - Floppy controller - - Floppy formats (not sure if MESS supports user-defined formats) + TODO: + - Floppy controller hookup and boot CP/M 68K + - Floppy formats - Banking - Graphics display (including colour and video_control options) - - DUART - RTC - - RS232 interface - - Keyboard + - Serial keyboard (300 8/N/1) - Centronics printer - Video-high - Video-reset - - Game switches, paddles and timers + - Game switches, paddles and timers (which work almost identically to the Apple II) - The plug-in boards - Emulator trap function @@ -36,7 +28,7 @@ #include "emu.h" #include "cpu/m68000/m68000.h" #include "imagedev/floppy.h" -#include "machine/keyboard.h" +#include "machine/mc68681.h" #include "machine/upd765.h" #include "sound/spkrdev.h" #include "video/mc6845.h" @@ -56,17 +48,18 @@ public: , m_ram(*this, "ram") , m_palette(*this, "palette") , m_p_chargen(*this, "chargen") + , m_duart(*this, "duart") + , m_bootview(*this, "bootview") { } void dim68k(machine_config &config); private: - u16 dim68k_duart_r(offs_t offset); u16 dim68k_fdc_r(); u16 dim68k_game_switches_r(); u16 dim68k_speaker_r(); + u16 dim68k_banksw_r(); void dim68k_banksw_w(u16 data); - void dim68k_duart_w(u16 data); void dim68k_fdc_w(u16 data); void dim68k_printer_strobe_w(u16 data); void dim68k_reset_timers_w(u16 data); @@ -74,36 +67,25 @@ private: void dim68k_video_control_w(u16 data); void dim68k_video_high_w(u16 data); void dim68k_video_reset_w(u16 data); - void kbd_put(u8 data); MC6845_UPDATE_ROW(crtc_update_row); void mem_map(address_map &map); bool m_speaker_bit; u8 m_video_control; - u8 m_term_data; void machine_reset() override; void machine_start() override; + required_device m_maincpu; required_device m_crtc; required_device m_speaker; required_shared_ptr m_ram; required_device m_palette; required_region_ptr m_p_chargen; + required_device m_duart; + memory_view m_bootview; }; -u16 dim68k_state::dim68k_duart_r(offs_t offset) -// Port A is for the keyboard : 300 baud, no parity, 8 bits, 1 stop bit. Port B is for RS232. -// The device also controls the parallel printer (except the strobe) and the RTC. -// Device = SCN2681, not emulated. The keyboard is standard ASCII, so we can use the terminal -// keyboard for now. -{ - if (offset==3) - return m_term_data; - else - return 0; -} - u16 dim68k_state::dim68k_fdc_r() { return 0; @@ -171,10 +153,6 @@ void dim68k_state::dim68k_video_reset_w(u16 data) { } -void dim68k_state::dim68k_duart_w(u16 data) -{ -} - void dim68k_state::dim68k_reset_timers_w(u16 data) // reset game port timer before reading paddles { @@ -185,38 +163,53 @@ void dim68k_state::dim68k_printer_strobe_w(u16 data) { } -void dim68k_state::dim68k_banksw_w(u16 data) -// At boot time, the rom and IO occupy 0-FFFF, this moves it to the proper place +u16 dim68k_state::dim68k_banksw_r() { + m_bootview.disable(); + return 0xffff; +} + +void dim68k_state::dim68k_banksw_w(u16 data) +{ + m_bootview.disable(); } void dim68k_state::mem_map(address_map &map) { - map.unmap_value_high(); - map(0x00000000, 0x00feffff).ram().share("ram"); // 16MB RAM / ROM at boot - map(0x00ff0000, 0x00ff1fff).rom().region("bootrom", 0); - map(0x00ff2000, 0x00ff7fff).ram(); // Graphics Video RAM - map(0x00ff8001, 0x00ff8001).rw(m_crtc, FUNC(mc6845_device::status_r), FUNC(mc6845_device::address_w)); - map(0x00ff8003, 0x00ff8003).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w)); - map(0x00ff8004, 0x00ff8005).w(FUNC(dim68k_state::dim68k_video_high_w)); - map(0x00ff8008, 0x00ff8009).w(FUNC(dim68k_state::dim68k_video_control_w)); - map(0x00ff800a, 0x00ff800b).w(FUNC(dim68k_state::dim68k_video_reset_w)); - map(0x00ff8800, 0x00ff8fff).rom().region("cop6512", 0); // slot 1 controller rom - map(0x00ff9000, 0x00ff97ff).rom().region("copz80", 0); // slot 2 controller rom - map(0x00ff9800, 0x00ff9fff).rom().region("cop8086", 0); // slot 3 controller rom + map(0x000000, 0x7fffff).ram().share("ram"); // 8 MiB of RAM + map(0x000000, 0x00ffff).view(m_bootview); + m_bootview[0](0x000000, 0x001fff).rom().region("bootrom", 0); + // graphics VRAM is not used by the stub before the bankswitch occurs, so it's not mapped here + m_bootview[0](0x008001, 0x008001).rw(m_crtc, FUNC(mc6845_device::status_r), FUNC(mc6845_device::address_w)); + m_bootview[0](0x008003, 0x008003).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w)); + m_bootview[0](0x008004, 0x008005).w(FUNC(dim68k_state::dim68k_video_high_w)); + m_bootview[0](0x008008, 0x008009).w(FUNC(dim68k_state::dim68k_video_control_w)); + m_bootview[0](0x00800a, 0x00800b).w(FUNC(dim68k_state::dim68k_video_reset_w)); + m_bootview[0](0x00dc00, 0x00dc01).rw(FUNC(dim68k_state::dim68k_banksw_r), FUNC(dim68k_state::dim68k_banksw_w)); + + map(0xff0000, 0xff1fff).rom().region("bootrom", 0); + map(0xff2000, 0xff7fff).ram(); // Graphics Video RAM + map(0xff8001, 0xff8001).rw(m_crtc, FUNC(mc6845_device::status_r), FUNC(mc6845_device::address_w)); + map(0xff8003, 0xff8003).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w)); + map(0xff8004, 0xff8005).w(FUNC(dim68k_state::dim68k_video_high_w)); + map(0xff8008, 0xff8009).w(FUNC(dim68k_state::dim68k_video_control_w)); + map(0xff800a, 0xff800b).w(FUNC(dim68k_state::dim68k_video_reset_w)); + map(0xff8800, 0xff8fff).rom().region("cop6512", 0); // slot 1 controller rom + map(0xff9000, 0xff97ff).rom().region("copz80", 0); // slot 2 controller rom + map(0xff9800, 0xff9fff).rom().region("cop8086", 0); // slot 3 controller rom #if 0 - map(0x00ffa000, 0x00ffa7ff).rom(); // slot 4 controller rom - map(0x00ffa800, 0x00ffafff).rom(); // slot 5 controller rom - map(0x00ffb000, 0x00ffb7ff).rom(); // slot 6 controller rom + map(0xffa000, 0xffa7ff).rom(); // slot 4 controller rom + map(0xffa800, 0xffafff).rom(); // slot 5 controller rom + map(0xffb000, 0xffb7ff).rom(); // slot 6 controller rom #endif - map(0x00ffc400, 0x00ffc41f).rw(FUNC(dim68k_state::dim68k_duart_r), FUNC(dim68k_state::dim68k_duart_w)); // Signetics SCN2681AC1N40 Dual UART - map(0x00ffc800, 0x00ffc801).rw(FUNC(dim68k_state::dim68k_speaker_r), FUNC(dim68k_state::dim68k_speaker_w)); - map(0x00ffcc00, 0x00ffcc1f).rw(FUNC(dim68k_state::dim68k_game_switches_r), FUNC(dim68k_state::dim68k_reset_timers_w)); - map(0x00ffd000, 0x00ffd003).m("fdc", FUNC(upd765a_device::map)).umask16(0x00ff); // NEC uPD765A - map(0x00ffd004, 0x00ffd005).rw(FUNC(dim68k_state::dim68k_fdc_r), FUNC(dim68k_state::dim68k_fdc_w)); + map(0xffc400, 0xffc41f).rw(m_duart, FUNC(scn2681_device::read), FUNC(scn2681_device::write)).umask16(0x00ff); + map(0xffc800, 0xffc801).rw(FUNC(dim68k_state::dim68k_speaker_r), FUNC(dim68k_state::dim68k_speaker_w)); + map(0xffcc00, 0xffcc1f).rw(FUNC(dim68k_state::dim68k_game_switches_r), FUNC(dim68k_state::dim68k_reset_timers_w)); + map(0xffd000, 0xffd003).m("fdc", FUNC(upd765a_device::map)).umask16(0x00ff); // NEC uPD765A + map(0xffd004, 0xffd005).rw(FUNC(dim68k_state::dim68k_fdc_r), FUNC(dim68k_state::dim68k_fdc_w)); //map(0x00ffd400, 0x00ffd403) emulation trap control - map(0x00ffd800, 0x00ffd801).w(FUNC(dim68k_state::dim68k_printer_strobe_w)); - map(0x00ffdc00, 0x00ffdc01).w(FUNC(dim68k_state::dim68k_banksw_w)); + map(0xffd800, 0xffd801).w(FUNC(dim68k_state::dim68k_printer_strobe_w)); + map(0xffdc00, 0xffdc01).rw(FUNC(dim68k_state::dim68k_banksw_r), FUNC(dim68k_state::dim68k_banksw_w)); } /* Input ports */ @@ -306,16 +299,10 @@ static void dim68k_floppies(device_slot_interface &device) device.option_add("525hd", FLOPPY_525_HD); } -void dim68k_state::kbd_put(u8 data) -{ - m_term_data = data; -} - void dim68k_state::machine_start() { save_item(NAME(m_speaker_bit)); save_item(NAME(m_video_control)); - save_item(NAME(m_term_data)); } void dim68k_state::dim68k(machine_config &config) @@ -349,8 +336,7 @@ void dim68k_state::dim68k(machine_config &config) m_crtc->set_char_width(8); m_crtc->set_update_row_callback(FUNC(dim68k_state::crtc_update_row)); - generic_keyboard_device &keyboard(GENERIC_KEYBOARD(config, "keyboard", 0)); - keyboard.set_keyboard_callback(FUNC(dim68k_state::kbd_put)); + SCN2681(config, m_duart, 3.6864_MHz_XTAL); // software lists SOFTWARE_LIST(config, "flop_list").set_original("dim68k");