From 60d08590a130b1b09e9b38c18e308315899fa12c Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Wed, 14 Oct 2015 22:55:09 +0300 Subject: [PATCH] tiki100: Added skeleton for Winchester controller. [Curt Coder] --- hash/tiki100.xml | 3 +- scripts/src/bus.lua | 2 + src/devices/bus/tiki100/exp.c | 2 + src/devices/bus/tiki100/hdc.c | 118 ++++++++++++++++++++++++++++++++++ src/devices/bus/tiki100/hdc.h | 55 ++++++++++++++++ src/mame/drivers/tiki100.c | 2 +- 6 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 src/devices/bus/tiki100/hdc.c create mode 100644 src/devices/bus/tiki100/hdc.h diff --git a/hash/tiki100.xml b/hash/tiki100.xml index 7b32d3422d1..c8817080216 100644 --- a/hash/tiki100.xml +++ b/hash/tiki100.xml @@ -542,10 +542,10 @@ - MS-DOS v2.11 (Nor) 198? <unknown> + @@ -859,6 +859,7 @@ TIKOS systemdiskett v2.0/24 (Nor) 198? <unknown> + diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 777862802dc..becd3f0cc2e 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -1110,6 +1110,8 @@ if (BUSES["TIKI100"]~=null) then MAME_DIR .. "src/devices/bus/tiki100/exp.h", MAME_DIR .. "src/devices/bus/tiki100/8088.c", MAME_DIR .. "src/devices/bus/tiki100/8088.h", + MAME_DIR .. "src/devices/bus/tiki100/hdc.c", + MAME_DIR .. "src/devices/bus/tiki100/hdc.h", } end diff --git a/src/devices/bus/tiki100/exp.c b/src/devices/bus/tiki100/exp.c index 8f3d570f101..5a35a8d3d10 100644 --- a/src/devices/bus/tiki100/exp.c +++ b/src/devices/bus/tiki100/exp.c @@ -171,7 +171,9 @@ device_tiki100bus_card_interface::device_tiki100bus_card_interface(const machine // slot devices #include "8088.h" +#include "hdc.h" SLOT_INTERFACE_START( tiki100_cards ) SLOT_INTERFACE("8088", TIKI100_8088) + SLOT_INTERFACE("hdc", TIKI100_HDC) SLOT_INTERFACE_END diff --git a/src/devices/bus/tiki100/hdc.c b/src/devices/bus/tiki100/hdc.c new file mode 100644 index 00000000000..2b978635ead --- /dev/null +++ b/src/devices/bus/tiki100/hdc.c @@ -0,0 +1,118 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + TIKI-100 Winchester controller card emulation + +**********************************************************************/ + +#include "hdc.h" + + + +//************************************************************************** +// MACROS/CONSTANTS +//************************************************************************** + +#define WD1010_TAG "hdc" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type TIKI100_HDC = &device_creator; + + +//------------------------------------------------- +// MACHINE_CONFIG_FRAGMENT( tiki100_hdc ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( tiki100_hdc ) + MCFG_DEVICE_ADD(WD1010_TAG, WD2010, 5000000) + //MCFG_WD2010_OUT_INTRQ_CB() + MCFG_WD2010_IN_DRDY_CB(VCC) + MCFG_WD2010_IN_INDEX_CB(VCC) + MCFG_WD2010_IN_WF_CB(VCC) + MCFG_WD2010_IN_TK000_CB(VCC) + MCFG_WD2010_IN_SC_CB(VCC) + + MCFG_HARDDISK_ADD("hard0") + MCFG_HARDDISK_ADD("hard1") +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor tiki100_hdc_t::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( tiki100_hdc ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// tiki100_hdc_t - constructor +//------------------------------------------------- + +tiki100_hdc_t::tiki100_hdc_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, TIKI100_HDC, "TIKI-100 Winchester controller", tag, owner, clock, "tiki100_hdc", __FILE__), + device_tiki100bus_card_interface(mconfig, *this), + m_hdc(*this, WD1010_TAG) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tiki100_hdc_t::device_start() +{ +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void tiki100_hdc_t::device_reset() +{ + m_hdc->reset(); +} + + +//------------------------------------------------- +// tiki100bus_iorq_r - I/O read +//------------------------------------------------- + +UINT8 tiki100_hdc_t::iorq_r(address_space &space, offs_t offset, UINT8 data) +{ + if ((offset & 0xf8) == 0x20) + { + data = m_hdc->read(space, offset & 0x07); + } + + return data; +} + + +//------------------------------------------------- +// tiki100bus_iorq_w - I/O write +//------------------------------------------------- + +void tiki100_hdc_t::iorq_w(address_space &space, offs_t offset, UINT8 data) +{ + if ((offset & 0xf8) == 0x20) + { + m_hdc->write(space, offset, data); + } +} diff --git a/src/devices/bus/tiki100/hdc.h b/src/devices/bus/tiki100/hdc.h new file mode 100644 index 00000000000..d06342fc66c --- /dev/null +++ b/src/devices/bus/tiki100/hdc.h @@ -0,0 +1,55 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + TIKI-100 Winchester controller card emulation + +**********************************************************************/ + +#pragma once + +#ifndef __TIKI100_HDC__ +#define __TIKI100_HDC__ + +#include "emu.h" +#include "bus/tiki100/exp.h" +#include "imagedev/harddriv.h" +#include "machine/wd2010.h" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> tiki100_hdc_t + +class tiki100_hdc_t : public device_t, + public device_tiki100bus_card_interface +{ +public: + // construction/destruction + tiki100_hdc_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + + // device_tiki100bus_card_interface overrides + virtual UINT8 iorq_r(address_space &space, offs_t offset, UINT8 data); + virtual void iorq_w(address_space &space, offs_t offset, UINT8 data); + +private: + required_device m_hdc; +}; + + +// device type definition +extern const device_type TIKI100_HDC; + + +#endif diff --git a/src/mame/drivers/tiki100.c b/src/mame/drivers/tiki100.c index f61136dda92..d9e3e501f91 100644 --- a/src/mame/drivers/tiki100.c +++ b/src/mame/drivers/tiki100.c @@ -709,7 +709,7 @@ static MACHINE_CONFIG_START( tiki100, tiki100_state ) //MCFG_TIKI100_BUS_IRQ_CALLBACK() //MCFG_TIKI100_BUS_NMI_CALLBACK() MCFG_TIKI100_BUS_SLOT_ADD("slot1", "8088") - MCFG_TIKI100_BUS_SLOT_ADD("slot2", NULL) + MCFG_TIKI100_BUS_SLOT_ADD("slot2", "hdc") MCFG_TIKI100_BUS_SLOT_ADD("slot3", NULL) /* devices */