From 871c97b8156132a22f3f762198a9c5294470e66d Mon Sep 17 00:00:00 2001 From: Sandro Ronco Date: Sun, 2 Nov 2014 17:20:07 +0100 Subject: (MESS) dmv: added preliminary K803 emulation. (nw) (MESS) dmv.xml: added more disks. (nw) --- hash/dmv.xml | 74 ++++++++++++++++++++++++-- src/emu/bus/bus.mak | 1 + src/emu/bus/dmv/dmvbus.c | 2 + src/emu/bus/dmv/dmvbus.h | 5 ++ src/emu/bus/dmv/k803.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++ src/emu/bus/dmv/k803.h | 54 +++++++++++++++++++ src/emu/bus/dmv/k806.c | 17 ++++-- src/emu/bus/dmv/k806.h | 3 +- src/mess/drivers/dmv.c | 44 +++++++++++++--- 9 files changed, 320 insertions(+), 13 deletions(-) create mode 100644 src/emu/bus/dmv/k803.c create mode 100644 src/emu/bus/dmv/k803.h diff --git a/hash/dmv.xml b/hash/dmv.xml index c1620d32ccd..3230286466c 100644 --- a/hash/dmv.xml +++ b/hash/dmv.xml @@ -939,6 +939,74 @@ + + DR Draw (Color) + 1983 + Digital Research + + + + + + + + + + DR Draw (Monochrome) + 1983 + Digital Research + + + + + + + + + + TUTBOGRAPH Demonstration Programs + 198? + <unknown> + + + + + + + + + CP/M-86 1.1 with quad-density FDD support + 1983 + NCR Corporation + + + + + + + + + GSX-86 Test Suite + 198? + <unknown> + + + + + + + + + MS-DOS v2.11 with quad-density FDD support + 1983 + Microsoft + + + + + + + dBASE II v2.38 198? @@ -1043,7 +1111,7 @@ - + AutoCAD 1987 <unknown> @@ -1060,7 +1128,7 @@ - + AutoCAD (Alt 1) 1987 <unknown> @@ -1087,7 +1155,7 @@ - + AutoCAD (Alt 2) 1987 <unknown> diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index 49130a675d8..45cb07c3fe3 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -333,6 +333,7 @@ BUSOBJS += $(BUSOBJ)/dmv/dmvbus.o BUSOBJS += $(BUSOBJ)/dmv/k220.o BUSOBJS += $(BUSOBJ)/dmv/k230.o BUSOBJS += $(BUSOBJ)/dmv/k233.o +BUSOBJS += $(BUSOBJ)/dmv/k803.o BUSOBJS += $(BUSOBJ)/dmv/k806.o BUSOBJS += $(BUSOBJ)/dmv/ram.o endif diff --git a/src/emu/bus/dmv/dmvbus.c b/src/emu/bus/dmv/dmvbus.c index 0484b539752..ba40d69dd30 100644 --- a/src/emu/bus/dmv/dmvbus.c +++ b/src/emu/bus/dmv/dmvbus.c @@ -199,6 +199,7 @@ dmvcart_slot_device::dmvcart_slot_device(const machine_config &mconfig, const ch device_slot_interface(mconfig, *this), m_prog_read_cb(*this), m_prog_write_cb(*this), + m_out_int_cb(*this), m_out_irq_cb(*this), m_out_thold_cb(*this) { @@ -224,6 +225,7 @@ void dmvcart_slot_device::device_start() // resolve callbacks m_prog_read_cb.resolve_safe(0); m_prog_write_cb.resolve_safe(); + m_out_int_cb.resolve_safe(); m_out_irq_cb.resolve_safe(); m_out_thold_cb.resolve_safe(); } diff --git a/src/emu/bus/dmv/dmvbus.h b/src/emu/bus/dmv/dmvbus.h index a5c827402bb..e4a3d035677 100644 --- a/src/emu/bus/dmv/dmvbus.h +++ b/src/emu/bus/dmv/dmvbus.h @@ -58,6 +58,7 @@ public: template static devcb_base &set_prog_read_callback(device_t &device, _Object object) { return downcast(device).m_prog_read_cb.set_callback(object); } template static devcb_base &set_prog_write_callback(device_t &device, _Object object) { return downcast(device).m_prog_write_cb.set_callback(object); } + template static devcb_base &set_out_int_callback(device_t &device, _Object object) { return downcast(device).m_out_int_cb.set_callback(object); } template static devcb_base &set_out_irq_callback(device_t &device, _Object object) { return downcast(device).m_out_irq_cb.set_callback(object); } template static devcb_base &set_out_thold_callback(device_t &device, _Object object) { return downcast(device).m_out_thold_cb.set_callback(object); } @@ -86,6 +87,7 @@ public: // internal state devcb_read8 m_prog_read_cb; devcb_write8 m_prog_write_cb; + devcb_write_line m_out_int_cb; devcb_write_line m_out_irq_cb; devcb_write_line m_out_thold_cb; device_dmvslot_interface* m_cart; @@ -104,6 +106,9 @@ extern const device_type DMVCART_SLOT; devcb = &dmvcart_slot_device::set_prog_read_callback(*device, DEVCB_##_read_devcb); \ devcb = &dmvcart_slot_device::set_prog_write_callback(*device, DEVCB_##_write_devcb); +#define MCFG_DMVCART_SLOT_OUT_INT_CB(_devcb) \ + devcb = &dmvcart_slot_device::set_out_int_callback(*device, DEVCB_##_devcb); + #define MCFG_DMVCART_SLOT_OUT_IRQ_CB(_devcb) \ devcb = &dmvcart_slot_device::set_out_irq_callback(*device, DEVCB_##_devcb); diff --git a/src/emu/bus/dmv/k803.c b/src/emu/bus/dmv/k803.c new file mode 100644 index 00000000000..0c3fb3ff421 --- /dev/null +++ b/src/emu/bus/dmv/k803.c @@ -0,0 +1,133 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +/*************************************************************************** + + K803 RTC module + +***************************************************************************/ + +#include "emu.h" +#include "k803.h" + + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + +static MACHINE_CONFIG_FRAGMENT( dmv_k803 ) + MCFG_DEVICE_ADD("rtc", MM58167, XTAL_32_768kHz) + MCFG_MM58167_IRQ_CALLBACK(WRITELINE(dmv_k803_device, rtc_irq_w)) +MACHINE_CONFIG_END + +static INPUT_PORTS_START( dmv_k803 ) + PORT_START("DSW") + PORT_DIPNAME( 0x0f, 0x09, "K803 IFSEL" ) PORT_DIPLOCATION("S:!4,S:!3,S:!2,S:!1") + PORT_DIPSETTING( 0x00, "0A" ) + PORT_DIPSETTING( 0x01, "0B" ) + PORT_DIPSETTING( 0x02, "1A" ) + PORT_DIPSETTING( 0x03, "1B" ) + PORT_DIPSETTING( 0x04, "2A" ) + PORT_DIPSETTING( 0x05, "2B" ) + PORT_DIPSETTING( 0x06, "3A" ) + PORT_DIPSETTING( 0x07, "3B" ) + PORT_DIPSETTING( 0x08, "4A" ) + PORT_DIPSETTING( 0x09, "4B" ) // default +INPUT_PORTS_END + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type DMV_K803 = &device_creator; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// dmv_k803_device - constructor +//------------------------------------------------- + +dmv_k803_device::dmv_k803_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, DMV_K803, "K803 RTC", tag, owner, clock, "dmv_k803", __FILE__), + device_dmvslot_interface( mconfig, *this ), + m_rtc(*this, "rtc"), + m_dsw(*this, "DWS") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void dmv_k803_device::device_start() +{ + m_bus = static_cast(owner()); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void dmv_k803_device::device_reset() +{ + m_latch = 0; + m_rtc_int = CLEAR_LINE; +} + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor dmv_k803_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( dmv_k803 ); +} + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor dmv_k803_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( dmv_k803 ); +} + +void dmv_k803_device::io_read(address_space &space, int ifsel, offs_t offset, UINT8 &data) +{ + UINT8 dsw = m_dsw->read() & 0x0f; + if ((dsw >> 1) == ifsel && BIT(offset, 3) == BIT(dsw, 0)) + { + if (offset & 0x04) + data = m_rtc->read(space, ((m_latch & 0x07) << 2) | (offset & 0x03)); + } +} + +void dmv_k803_device::io_write(address_space &space, int ifsel, offs_t offset, UINT8 data) +{ + UINT8 dsw = m_dsw->read() & 0x0f; + if ((dsw >> 1) == ifsel && BIT(offset, 3) == BIT(dsw, 0)) + { + if (offset & 0x04) + m_rtc->write(space, ((m_latch & 0x07) << 2) | (offset & 0x03), data); + else + { + m_latch = data; + update_int(); + } + } +} + +WRITE_LINE_MEMBER(dmv_k803_device::rtc_irq_w) +{ + m_rtc_int = state; + update_int(); +} + +void dmv_k803_device::update_int() +{ + bool state = ((m_latch & 0x80) && m_rtc_int); + m_bus->m_out_irq_cb(state ? ASSERT_LINE : CLEAR_LINE); +} diff --git a/src/emu/bus/dmv/k803.h b/src/emu/bus/dmv/k803.h new file mode 100644 index 00000000000..51fd9eaaa9c --- /dev/null +++ b/src/emu/bus/dmv/k803.h @@ -0,0 +1,54 @@ +// license:BSD-3-Clause +// copyright-holders:Sandro Ronco +#pragma once + +#ifndef __DMV_K803_H__ +#define __DMV_K803_H__ + +#include "emu.h" +#include "dmvbus.h" +#include "machine/mm58167.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> dmv_k803_device + +class dmv_k803_device : + public device_t, + public device_dmvslot_interface +{ +public: + // construction/destruction + dmv_k803_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual ioport_constructor device_input_ports() const; + virtual machine_config_constructor device_mconfig_additions() const; + + DECLARE_WRITE_LINE_MEMBER(rtc_irq_w); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + virtual void io_read(address_space &space, int ifsel, offs_t offset, UINT8 &data); + virtual void io_write(address_space &space, int ifsel, offs_t offset, UINT8 data); + + void update_int(); + +private: + required_device m_rtc; + required_ioport m_dsw; + dmvcart_slot_device * m_bus; + UINT8 m_latch; + int m_rtc_int; +}; + + +// device type definition +extern const device_type DMV_K803; + +#endif /* __DMV_K803_H__ */ diff --git a/src/emu/bus/dmv/k806.c b/src/emu/bus/dmv/k806.c index 2fae2b93f3b..66509a0d095 100644 --- a/src/emu/bus/dmv/k806.c +++ b/src/emu/bus/dmv/k806.c @@ -20,7 +20,8 @@ ROM_START( dmv_k806 ) ROM_END static ADDRESS_MAP_START( k806_io, AS_IO, 8, dmv_k806_device ) - AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(port1_r, port1_w) + AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(port1_r) + AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(port2_w) AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(portt1_r) ADDRESS_MAP_END @@ -75,6 +76,7 @@ dmv_k806_device::dmv_k806_device(const machine_config &mconfig, const char *tag, void dmv_k806_device::device_start() { + m_bus = static_cast(owner()); } //------------------------------------------------- @@ -129,6 +131,15 @@ void dmv_k806_device::io_write(address_space &space, int ifsel, offs_t offset, U READ8_MEMBER( dmv_k806_device::port1_r ) { + // ---- ---x Left button + // ---- --x- Middle button + // ---- -x-- Right button + // ---- x--- XA / Y1 + // ---x ---- XB / Y2 + // --x- ---- YA / X2 + // -x-- ---- YB / X1 + // x--- ---- not used + // TODO return 0xff; } @@ -138,7 +149,7 @@ READ8_MEMBER( dmv_k806_device::portt1_r ) return BIT(m_jumpers->read(), 7) ? 0 : 1; } -WRITE8_MEMBER( dmv_k806_device::port1_w ) +WRITE8_MEMBER( dmv_k806_device::port2_w ) { - // TODO + m_bus->m_out_int_cb((data & 1) ? CLEAR_LINE : ASSERT_LINE); }; diff --git a/src/emu/bus/dmv/k806.h b/src/emu/bus/dmv/k806.h index 9fc0ca8712b..af2ce0aae3a 100644 --- a/src/emu/bus/dmv/k806.h +++ b/src/emu/bus/dmv/k806.h @@ -31,7 +31,7 @@ public: DECLARE_READ8_MEMBER(portt1_r); DECLARE_READ8_MEMBER(port1_r); - DECLARE_WRITE8_MEMBER(port1_w); + DECLARE_WRITE8_MEMBER(port2_w); protected: // device-level overrides @@ -44,6 +44,7 @@ protected: private: required_device m_mcu; required_ioport m_jumpers; + dmvcart_slot_device * m_bus; }; diff --git a/src/mess/drivers/dmv.c b/src/mess/drivers/dmv.c index 935c0bf3002..a2da0033da1 100644 --- a/src/mess/drivers/dmv.c +++ b/src/mess/drivers/dmv.c @@ -25,6 +25,7 @@ #include "bus/dmv/k220.h" #include "bus/dmv/k230.h" #include "bus/dmv/k233.h" +#include "bus/dmv/k803.h" #include "bus/dmv/k806.h" #include "bus/dmv/ram.h" @@ -114,7 +115,17 @@ public: DECLARE_READ8_MEMBER(exp_program_r); DECLARE_WRITE8_MEMBER(exp_program_w); DECLARE_WRITE_LINE_MEMBER(thold7_w); - DECLARE_WRITE_LINE_MEMBER(busint_w); + + void update_busint(int slot, int state); + DECLARE_WRITE_LINE_MEMBER(busint2_w) { update_busint(0, state); } + DECLARE_WRITE_LINE_MEMBER(busint2a_w) { update_busint(1, state); } + DECLARE_WRITE_LINE_MEMBER(busint3_w) { update_busint(2, state); } + DECLARE_WRITE_LINE_MEMBER(busint4_w) { update_busint(3, state); } + DECLARE_WRITE_LINE_MEMBER(busint5_w) { update_busint(4, state); } + DECLARE_WRITE_LINE_MEMBER(busint6_w) { update_busint(5, state); } + DECLARE_WRITE_LINE_MEMBER(busint7_w) { update_busint(6, state); } + DECLARE_WRITE_LINE_MEMBER(busint7a_w) { update_busint(7, state); } + DECLARE_FLOPPY_FORMATS( floppy_formats ); UINT8 program_read(address_space &space, int cas, offs_t offset); @@ -146,6 +157,7 @@ public: int m_dack3_line; int m_sd_poll_state; int m_floppy_motor; + int m_busint[8]; }; WRITE8_MEMBER(dmv_state::tc_set_w) @@ -329,6 +341,7 @@ UPD7220_DRAW_TEXT_LINE_MEMBER( dmv_state::hgdc_draw_text ) static SLOT_INTERFACE_START( dmv_floppies ) SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) SLOT_INTERFACE_END @@ -375,10 +388,21 @@ WRITE_LINE_MEMBER( dmv_state::thold7_w ) } } -WRITE_LINE_MEMBER( dmv_state::busint_w ) +void dmv_state::update_busint(int slot, int state) { - m_slot7a->irq2_w(state); - m_slot7->irq2_w(state); + m_busint[slot] = state; + + int new_state = CLEAR_LINE; + for (int i=0; i<8; i++) + if (m_busint[i] != CLEAR_LINE) + { + new_state = ASSERT_LINE; + break; + } + + m_slot7a->irq2_w(new_state); + m_slot7->irq2_w(new_state); + m_maincpu->set_input_line(0, new_state); } void dmv_state::program_write(address_space &space, int cas, offs_t offset, UINT8 data) @@ -505,6 +529,7 @@ void dmv_state::machine_reset() m_switch16 = 0; m_thold7 = 0; m_dma_hrq = 0; + memset(m_busint, 0, sizeof(m_busint)); update_halt_line(); } @@ -606,6 +631,7 @@ SLOT_INTERFACE_END static SLOT_INTERFACE_START(dmv_slot2_6) SLOT_INTERFACE("k233", DMV_K233) // K233 16K Shared RAM + SLOT_INTERFACE("k803", DMV_K803) // K803 RTC module SLOT_INTERFACE("k806", DMV_K806) // K806 Mouse module SLOT_INTERFACE_END @@ -692,27 +718,33 @@ static MACHINE_CONFIG_START( dmv, dmv_state ) MCFG_DEVICE_SLOT_INTERFACE(dmv_slot1, NULL, false) MCFG_DEVICE_ADD("slot2", DMVCART_SLOT, 0) MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint2_w)) MCFG_DEVICE_ADD("slot2a", DMVCART_SLOT, 0) MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2a, NULL, false) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint2a_w)) MCFG_DEVICE_ADD("slot3", DMVCART_SLOT, 0) MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint3_w)) MCFG_DEVICE_ADD("slot4", DMVCART_SLOT, 0) MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint4_w)) MCFG_DEVICE_ADD("slot5", DMVCART_SLOT, 0) MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint5_w)) MCFG_DEVICE_ADD("slot6", DMVCART_SLOT, 0) MCFG_DEVICE_SLOT_INTERFACE(dmv_slot2_6, NULL, false) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint6_w)) MCFG_DEVICE_ADD("slot7", DMVCART_SLOT, 0) MCFG_DEVICE_SLOT_INTERFACE(dmv_slot7, NULL, false) MCFG_DMVCART_SLOT_PROGRAM_READWRITE_CB(READ8(dmv_state, exp_program_r), WRITE8(dmv_state, exp_program_w)) MCFG_DMVCART_SLOT_OUT_THOLD_CB(WRITELINE(dmv_state, thold7_w)) - MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, busint_w)) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint7_w)) MCFG_DEVICE_ADD("slot7a", DMVCART_SLOT, 0) MCFG_DEVICE_SLOT_INTERFACE(dmv_slot7a, "k230", false) MCFG_DMVCART_SLOT_PROGRAM_READWRITE_CB(READ8(dmv_state, exp_program_r), WRITE8(dmv_state, exp_program_w)) MCFG_DMVCART_SLOT_OUT_THOLD_CB(WRITELINE(dmv_state, thold7_w)) - MCFG_DMVCART_SLOT_OUT_IRQ_CB(WRITELINE(dmv_state, busint_w)) + MCFG_DMVCART_SLOT_OUT_INT_CB(WRITELINE(dmv_state, busint7a_w)) MCFG_SOFTWARE_LIST_ADD("flop_list", "dmv") -- cgit v1.2.3