bus/spectrum: Added ZXBUS Nemo IDE Controller. (#11523)

This commit is contained in:
holub 2023-09-02 13:23:51 -04:00 committed by GitHub
parent 45db59a77c
commit ae1e45853b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 106 additions and 3 deletions

View file

@ -4612,6 +4612,8 @@ if (BUSES["ZXBUS"]~=null) then
files {
MAME_DIR .. "src/devices/bus/spectrum/zxbus.cpp",
MAME_DIR .. "src/devices/bus/spectrum/zxbus.h",
MAME_DIR .. "src/devices/bus/spectrum/nemoide.cpp",
MAME_DIR .. "src/devices/bus/spectrum/nemoide.h",
MAME_DIR .. "src/devices/bus/spectrum/neogs.cpp",
MAME_DIR .. "src/devices/bus/spectrum/neogs.h",
MAME_DIR .. "src/devices/bus/spectrum/smuc.cpp",

View file

@ -0,0 +1,85 @@
// license:BSD-3-Clause
// copyright-holders:Andrei I. Holub
#include "emu.h"
#include "nemoide.h"
#include "bus/ata/ataintf.h"
#include "bus/ata/atapicdr.h"
#include "bus/ata/hdd.h"
namespace bus::spectrum::zxbus {
namespace {
class nemoide_device : public device_t, public device_zxbus_card_interface
{
public:
nemoide_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, ZXBUS_NEMOIDE, tag, owner, clock)
, device_zxbus_card_interface(mconfig, *this)
, m_ata(*this, "ata")
{ }
protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
private:
void map_io(address_map &map);
u8 ata_r(offs_t offset);
void ata_w(offs_t offset, u8 data);
required_device<ata_interface_device> m_ata;
u8 m_ata_data_latch;
};
u8 nemoide_device::ata_r(offs_t offset)
{
const u16 data = m_ata->cs0_r((offset >> 5) & 7);
if (!machine().side_effects_disabled())
m_ata_data_latch = data >> 8;
return data & 0xff;
}
void nemoide_device::ata_w(offs_t offset, u8 data)
{
const u16 ata_data = (m_ata_data_latch << 8) | data;
m_ata->cs0_w((offset >> 5) & 7, ata_data);
}
void nemoide_device::map_io(address_map &map)
{
map(0x00011, 0x00011).mirror(0xff00).lrw8(NAME([this]() { return m_ata_data_latch; })
, NAME([this](offs_t offset, u8 data) { m_ata_data_latch = data; }));
map(0x00010, 0x00010).select(0xffe0).rw(FUNC(nemoide_device::ata_r), FUNC(nemoide_device::ata_w));
map(0x000c8, 0x000c8).mirror(0xff00).lrw8(NAME([this]() { return m_ata->cs1_r(6); })
, NAME([this](offs_t offset, u8 data) { m_ata->cs1_w(6, data); }));
}
static void nemoide_ata_devices(device_slot_interface &device)
{
device.option_add("hdd", IDE_HARDDISK);
device.option_add("cdrom", ATAPI_CDROM);
}
void nemoide_device::device_add_mconfig(machine_config &config)
{
ATA_INTERFACE(config, m_ata).options(nemoide_ata_devices, "hdd", "hdd", false);
}
void nemoide_device::device_start()
{
save_item(NAME(m_ata_data_latch));
m_zxbus->install_device(0x00000, 0x1ffff, *this, &nemoide_device::map_io);
}
} // anonymous namespace
} // namespace bus::spectrum::zxbus
DEFINE_DEVICE_TYPE_PRIVATE(ZXBUS_NEMOIDE, device_zxbus_card_interface, bus::spectrum::zxbus::nemoide_device, "nemoide", "Nemo IDE Controller")

View file

@ -0,0 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:Andrei I. Holub
#ifndef MAME_SINCLAIR_NEMOIDE_H
#define MAME_SINCLAIR_NEMOIDE_H
#pragma once
#include "zxbus.h"
DECLARE_DEVICE_TYPE(ZXBUS_NEMOIDE, device_zxbus_card_interface)
#endif // MAME_SINCLAIR_NEMOIDE_H

View file

@ -426,9 +426,9 @@ const tiny_rom_entry *neogs_device::device_rom_region() const
void neogs_device::neogsmap(address_map &map)
{
map(0x00bb, 0x00bb).mirror(0xff00).rw(FUNC(neogs_device::neogs_status_r), FUNC(neogs_device::neogs_command_w));
map(0x00b3, 0x00b3).mirror(0xff00).rw(FUNC(neogs_device::neogs_data_r), FUNC(neogs_device::neogs_data_w));
map(0x0033, 0x0033).mirror(0xff00).w(FUNC(neogs_device::neogs_ctrl_w));
map(0x000bb, 0x000bb).mirror(0xff00).rw(FUNC(neogs_device::neogs_status_r), FUNC(neogs_device::neogs_command_w));
map(0x000b3, 0x000b3).mirror(0xff00).rw(FUNC(neogs_device::neogs_data_r), FUNC(neogs_device::neogs_data_w));
map(0x00033, 0x00033).mirror(0xff00).w(FUNC(neogs_device::neogs_ctrl_w));
}
void neogs_device::device_start()

View file

@ -66,11 +66,13 @@ void device_zxbus_card_interface::interface_pre_start()
}
#include "nemoide.h"
#include "neogs.h"
#include "smuc.h"
void zxbus_cards(device_slot_interface &device)
{
device.option_add("nemoide", ZXBUS_NEMOIDE);
device.option_add("neogs", ZXBUS_NEOGS);
device.option_add("smuc", ZXBUS_SMUC);
}