From cd3890e11022ba77f82677c6cbd0a4e1a821280b Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Sat, 1 Feb 2014 12:30:58 +0000 Subject: [PATCH] Add support for the Acculogic sIDE-1/16 8-bit ISA card. --- .gitattributes | 2 + src/mess/machine/isa_cards.c | 2 + src/mess/machine/isa_cards.h | 1 + src/mess/machine/isa_side116.c | 191 +++++++++++++++++++++++++++++++++ src/mess/machine/isa_side116.h | 60 +++++++++++ src/mess/mess.mak | 1 + 6 files changed, 257 insertions(+) create mode 100644 src/mess/machine/isa_side116.c create mode 100644 src/mess/machine/isa_side116.h diff --git a/.gitattributes b/.gitattributes index b3bd97f6b4a..e744c303ed3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7990,6 +7990,8 @@ src/mess/machine/isa_mpu401.c svneol=native#text/plain src/mess/machine/isa_mpu401.h svneol=native#text/plain src/mess/machine/isa_sblaster.c svneol=native#text/plain src/mess/machine/isa_sblaster.h svneol=native#text/plain +src/mess/machine/isa_side116.c svneol=native#text/plain +src/mess/machine/isa_side116.h svneol=native#text/plain src/mess/machine/isa_ssi2001.c svneol=native#text/plain src/mess/machine/isa_ssi2001.h svneol=native#text/plain src/mess/machine/isa_stereo_fx.c svneol=native#text/plain diff --git a/src/mess/machine/isa_cards.c b/src/mess/machine/isa_cards.c index 7e88eda5d67..3b8e7da1812 100644 --- a/src/mess/machine/isa_cards.c +++ b/src/mess/machine/isa_cards.c @@ -24,6 +24,7 @@ SLOT_INTERFACE_START( pc_isa8_cards ) SLOT_INTERFACE("wdxt_gen", ISA8_WDXT_GEN) SLOT_INTERFACE("finalchs", ISA8_FINALCHS) SLOT_INTERFACE("xtide", ISA8_XTIDE) + SLOT_INTERFACE("side116", ISA8_SIDE116) SLOT_INTERFACE("hdc", ISA8_HDC) SLOT_INTERFACE("adlib", ISA8_ADLIB) SLOT_INTERFACE("hercules", ISA8_HERCULES) @@ -53,6 +54,7 @@ SLOT_INTERFACE_START( pc_isa16_cards ) SLOT_INTERFACE("comat", ISA8_COM_AT) SLOT_INTERFACE("fdc", ISA8_FDC_AT) SLOT_INTERFACE("hdc", ISA8_HDC) + SLOT_INTERFACE("side116", ISA8_SIDE116) SLOT_INTERFACE("adlib", ISA8_ADLIB) SLOT_INTERFACE("hercules", ISA8_HERCULES) SLOT_INTERFACE("gblaster", ISA8_GAME_BLASTER) diff --git a/src/mess/machine/isa_cards.h b/src/mess/machine/isa_cards.h index 686a7812622..07cfcf025a7 100644 --- a/src/mess/machine/isa_cards.h +++ b/src/mess/machine/isa_cards.h @@ -30,6 +30,7 @@ #include "machine/isa_wdxt_gen.h" #include "machine/isa_ide.h" #include "machine/isa_xtide.h" +#include "machine/isa_side116.h" #include "machine/isa_aha1542.h" #include "machine/isa_wd1002a_wx1.h" diff --git a/src/mess/machine/isa_side116.c b/src/mess/machine/isa_side116.c new file mode 100644 index 00000000000..31cbdc04def --- /dev/null +++ b/src/mess/machine/isa_side116.c @@ -0,0 +1,191 @@ +/*************************************************************************** + + Acculogic sIDE-1/16 + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + IDE Disk Controller for IBM PC, XT and compatibles + +***************************************************************************/ + +#include "isa_side116.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type ISA8_SIDE116 = &device_creator; + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( side116 ) + MCFG_ATA_INTERFACE_ADD("ata", ata_devices, "hdd", NULL, false) + MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(side116_device, ide_interrupt)) +MACHINE_CONFIG_END + +machine_config_constructor side116_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( side116 ); +} + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( side116 ) + PORT_START("configuration") + PORT_DIPNAME(0x01, 0x00, "sIDE-1/16 ROM") + PORT_DIPLOCATION("JP:1") + PORT_DIPSETTING(0x00, "Enabled") + PORT_DIPSETTING(0x01, "Disabled") + PORT_DIPNAME(0x06, 0x00, "sIDE-1/16 ROM Address") + PORT_DIPLOCATION("JP:2,3") + PORT_DIPSETTING(0x00, "Range C800h") + PORT_DIPSETTING(0x04, "Range CC00h") + PORT_DIPSETTING(0x02, "Range D800h") + PORT_DIPSETTING(0x06, "Range DC00h") + PORT_DIPNAME(0x18, 0x10, "sIDE-1/16 IDE IRQ") + PORT_DIPLOCATION("JP:4,5") + PORT_DIPSETTING(0x10, "Level 5") + PORT_DIPSETTING(0x08, "Level 2") + PORT_DIPNAME(0x20, 0x20, "sIDE-1/16 IDE") + PORT_DIPLOCATION("JP:6") + PORT_DIPSETTING(0x00, "Disabled") + PORT_DIPSETTING(0x20, "Enabled") +INPUT_PORTS_END + +ioport_constructor side116_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( side116 ); +} + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +ROM_START( side116 ) + ROM_REGION(0x2000, "option", 0) + ROM_LOAD("bios12.u2", 0x0000, 0x2000, CRC(c202a0e6) SHA1(a5b130a6d17c972d6c378cb2cd8113a4039631fe)) +ROM_END + +const rom_entry *side116_device::device_rom_region() const +{ + return ROM_NAME( side116 ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// side116_device - constructor +//------------------------------------------------- + +side116_device::side116_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, ISA8_SIDE116, "Acculogic sIDE-1/16 IDE Disk Controller", tag, owner, clock, "side116", __FILE__), + device_isa8_card_interface( mconfig, *this ), + m_ata(*this, "ata"), + m_config(*this, "configuration"), + m_latch(0xff) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void side116_device::device_start() +{ + set_isa_device(); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void side116_device::device_reset() +{ + // install option rom + if ((m_config->read() & 0x01) == 0x00) + { + switch ((m_config->read() >> 1) & 0x03) + { + case 0: m_isa->install_rom(this, 0xc8000, 0xc9fff, 0, 0, "side116", "option"); break; + case 1: m_isa->install_rom(this, 0xd8000, 0xd9fff, 0, 0, "side116", "option"); break; + case 2: m_isa->install_rom(this, 0xcc000, 0xcdfff, 0, 0, "side116", "option"); break; + case 3: m_isa->install_rom(this, 0xdc000, 0xddfff, 0, 0, "side116", "option"); break; + } + } + + // install io access + if ((m_config->read() & 0x20) == 0x20) + m_isa->install_device(0x360, 0x36f, 0, 0, read8_delegate(FUNC(side116_device::read), this), write8_delegate(FUNC(side116_device::write), this)); +} + + +//************************************************************************** +// IDE INTERFACE +//************************************************************************** + +READ8_MEMBER( side116_device::read ) +{ + UINT8 data; + + if (offset == 0) + { + UINT16 ide_data = m_ata->read_cs0(space, 0, 0xffff); + data = ide_data & 0xff; + m_latch = ide_data >> 8; + } + else if (offset < 8) + { + data = m_ata->read_cs0(space, offset & 7, 0xff); + } + else if (offset == 8) + { + data = m_latch; + } + else + { + data = m_ata->read_cs1(space, offset & 7, 0xff); + } + + return data; +} + +WRITE8_MEMBER( side116_device::write ) +{ + if (offset == 0) + { + UINT16 ide_data = (m_latch << 8) | data; + m_ata->write_cs0(space, 0, ide_data, 0xffff); + } + else if (offset < 8) + { + m_ata->write_cs0(space, offset & 7, data, 0xff); + } + else if (offset == 8) + { + m_latch = data; + } + else + { + m_ata->write_cs1(space, offset & 7, data, 0xff); + } +} + +WRITE_LINE_MEMBER( side116_device::ide_interrupt ) +{ + UINT8 level = m_config->read() & 0x18; + + if (level == 0x08) + m_isa->irq2_w(state); + else if (level == 0x10) + m_isa->irq5_w(state); +} diff --git a/src/mess/machine/isa_side116.h b/src/mess/machine/isa_side116.h new file mode 100644 index 00000000000..588d0b2aedb --- /dev/null +++ b/src/mess/machine/isa_side116.h @@ -0,0 +1,60 @@ +/*************************************************************************** + + Acculogic sIDE-1/16 + + license: MAME, GPL-2.0+ + copyright-holders: Dirk Best + + IDE Disk Controller for IBM PC, XT and compatibles + +***************************************************************************/ + +#pragma once + +#ifndef __ISA_SIDE116_H__ +#define __ISA_SIDE116_H__ + +#include "emu.h" +#include "machine/ataintf.h" +#include "isa.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> side116_device + +class side116_device : public device_t, + public device_isa8_card_interface +{ +public: + // construction/destruction + side116_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; + virtual const rom_entry *device_rom_region() const; + + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); + DECLARE_WRITE_LINE_MEMBER( ide_interrupt ); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_reset(); + virtual void device_config_complete() { m_shortname = "side116"; } + +private: + required_device m_ata; + required_ioport m_config; + UINT8 m_latch; +}; + + +// device type definition +extern const device_type ISA8_SIDE116; + +#endif diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 46a80c080b3..44064da44c9 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -846,6 +846,7 @@ $(MESSOBJ)/isa.a: \ $(MESS_MACHINE)/isa_ssi2001.o \ $(MESS_MACHINE)/isa_ide.o \ $(MESS_MACHINE)/isa_xtide.o \ + $(MESS_MACHINE)/isa_side116.o \ $(MESS_MACHINE)/isa_aha1542.o \ $(MESS_MACHINE)/isa_wd1002a_wx1.o\ $(MESS_MACHINE)/isa_dectalk.o \