Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to Technics KN5000 #12684

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions scripts/src/bus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2577,6 +2577,21 @@ if (BUSES["SS50"]~=null) then
end


---------------------------------------------------
--
--@src/devices/bus/technics/hdae5000.h,BUSES["TECHNICS"] = true
---------------------------------------------------

if (BUSES["TECHNICS"]~=null) then
files {
MAME_DIR .. "src/devices/bus/technics/kn5000_extension.cpp",
MAME_DIR .. "src/devices/bus/technics/kn5000_extension.h",
MAME_DIR .. "src/devices/bus/technics/hdae5000.cpp",
MAME_DIR .. "src/devices/bus/technics/hdae5000.h",
}
end
Comment on lines +2580 to +2592
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want to trigger this on inclusion of the slot header, not one specific card.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean it should be like this, instead?

--@src/devices/bus/technics/kn5000_extension.h,BUSES["TECHNICS"] = true

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Look at any of the other optional buses.

Think about this logically:

  • You need to trigger it for anything that may instantiate the slot, as that will require it whether any cards are used or not.
  • The card headers #include the slot header anyway, so something trying to use a card without the slot would still trigger it.
  • The slot header does not #include the card headers, so triggering on a card header won’t work if that particular card is not used.



---------------------------------------------------
--
--@src/devices/bus/tiki100/exp.h,BUSES["TIKI100"] = true
Expand Down
2 changes: 2 additions & 0 deletions scripts/src/cpu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2938,6 +2938,8 @@ if CPUS["TLCS900"] then
MAME_DIR .. "src/devices/cpu/tlcs900/tlcs900.h",
MAME_DIR .. "src/devices/cpu/tlcs900/900tbl.hxx",
MAME_DIR .. "src/devices/cpu/tlcs900/900htbl.hxx",
MAME_DIR .. "src/devices/cpu/tlcs900/tmp94c241.cpp",
MAME_DIR .. "src/devices/cpu/tlcs900/tmp94c241.h",
MAME_DIR .. "src/devices/cpu/tlcs900/tmp95c061.cpp",
MAME_DIR .. "src/devices/cpu/tlcs900/tmp95c061.h",
MAME_DIR .. "src/devices/cpu/tlcs900/tmp95c063.cpp",
Expand Down
110 changes: 110 additions & 0 deletions src/devices/bus/technics/hdae5000.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// license:BSD-3-Clause
// copyright-holders:Antoine Mine, Olivier Galibert, Felipe Sanches
//
// HD-AE5000, Hard Disk & Audio Extension for Technics KN5000 emulation
//
// The HD-AE5000 was an extension board for the Technics KN5000 musical keyboard.
// It provided a hard-disk, additional audio outputs and a serial port to interface
// with a computer to transfer files to/from the hard-drive.

#include "emu.h"
#include "bus/ata/hdd.h"
#include "hdae5000.h"
#include "machine/i8255.h"
Comment on lines +10 to +13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The modules own header should come immediately after the prefix header, before headers for other things it uses.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by "the prefix header"? Are you referring to the "emu.h" one?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


namespace {

class hdae5000_device : public device_t, public kn5000_extension_interface
{
public:
static constexpr feature_type unemulated_features() { return feature::DISK | feature::SOUND; }

hdae5000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

virtual void rom_map(address_map &map) override;
virtual void io_map(address_map &map) override;

protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
virtual const tiny_rom_entry *device_rom_region() const override;

private:
required_device<ide_hdd_device> m_hdd;
required_device<i8255_device> m_ppi;
required_memory_region m_rom;
};

hdae5000_device::hdae5000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, HDAE5000, tag, owner, clock)
, kn5000_extension_interface(mconfig, *this)
, m_hdd(*this, "hdd")
, m_ppi(*this, "ppi")
, m_rom(*this, "rom")
{
}

ROM_START(hdae5000)
ROM_REGION16_LE(0x80000, "rom" , 0)
ROM_DEFAULT_BIOS("v2.01i")

ROM_SYSTEM_BIOS(0, "v1.10i", "Version 1.10i - July 6th, 1998")
ROMX_LOAD("hd-ae5000_v1_10i.ic4", 0x000000, 0x80000, CRC(7461374b) SHA1(6019f3c28b6277730418974dde4dc6893fced00e), ROM_BIOS(0))

ROM_SYSTEM_BIOS(1, "v1.15i", "Version 1.15i - October 13th, 1998")
ROMX_LOAD("hd-ae5000_v1_15i.ic4", 0x000000, 0x80000, CRC(e76d4b9f) SHA1(581fa58e2cd6fe381cfc312c73771d25ff2e662c), ROM_BIOS(1))

// Version 2.01i is described as having "additions like lyrics display etc."
ROM_SYSTEM_BIOS(2, "v2.01i", "Version 2.01i - January 15th, 1999") // installation file indicated "v2.0i" but signature inside the ROM is "v2.01i"
ROMX_LOAD("hd-ae5000_v2_01i.ic4", 0x000000, 0x80000, CRC(961e6dcd) SHA1(0160c17baa7b026771872126d8146038a19ef53b), ROM_BIOS(2))
ROM_END

void hdae5000_device::rom_map(address_map &map)
{
map(0x00000, 0x7ffff).rom().region(m_rom, 0);
}

void hdae5000_device::io_map(address_map &map)
{
//map(0x130000, 0x13ffff).m(m_hddc, FUNC(?_device::?)); // Hard-drive Controller (model?) IC? on HD-AE5000 board
//map(0x160000, 0x16ffff) ... Optional parallel port interface (NEC uPD71055) IC9
map(0x160000, 0x160000).lrw8([this](offs_t a) { return m_ppi->read(0); }, "ppi_r0", [this](offs_t a, u8 data) { m_ppi->write(0, data); }, "ppi_w0");
map(0x160002, 0x160002).lrw8([this](offs_t a) { return m_ppi->read(1); }, "ppi_r1", [this](offs_t a, u8 data) { m_ppi->write(1, data); }, "ppi_w1");
map(0x160004, 0x160004).lrw8([this](offs_t a) { return m_ppi->read(2); }, "ppi_r2", [this](offs_t a, u8 data) { m_ppi->write(2, data); }, "ppi_w2");
map(0x160006, 0x160006).lrw8([this](offs_t a) { return m_ppi->read(3); }, "ppi_r3", [this](offs_t a, u8 data) { m_ppi->write(3, data); }, "ppi_w3");
Comment on lines +72 to +75
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be clearer and less error-prone if you make helpers like:

	template <unsigned Offset> u8 ppi_r() { return m_ppi->read(Offset); }
	template <unsigned Offset> void ppi_w(u8 data) { m_ppi->write(Offset, data); }

Then installed it like:

	map(0x160000, 0x160000).rw(FUNC(hdae5000_device::ppi_r<0>), FUNC(hdae5000_device::ppi_w<0>));
	map(0x160002, 0x160002).rw(FUNC(hdae5000_device::ppi_r<1>), FUNC(hdae5000_device::ppi_w<1>));
	map(0x160004, 0x160004).rw(FUNC(hdae5000_device::ppi_r<2>), FUNC(hdae5000_device::ppi_w<2>));
	map(0x160006, 0x160006).rw(FUNC(hdae5000_device::ppi_r<3>), FUNC(hdae5000_device::ppi_w<3>));

But taking a step back, is this a case of installing an 8-bit device on half the width of a 16-bt bus? If it is, that’s what umask is for:

	map(0x160000, 0x160007).umask(0x00ff).rw(m_ppi, FUNC(i8255_device::read), FUNC(i8255_device::write));

}

const tiny_rom_entry *hdae5000_device::device_rom_region() const
{
return ROM_NAME(hdae5000);
}

void hdae5000_device::device_add_mconfig(machine_config &config)
{
/* Optional Hard Disk - HD-AE5000 */
IDE_HARDDISK(config, m_hdd, 0);

/* Optional Parallel Port */
I8255(config, m_ppi); // actual chip is a NEC uPD71055 @ IC9 on the HD-AE5000 board
// m_ppi->in_pa_callback().set(FUNC(?_device::ppi_in_a));
// m_ppi->out_pb_callback().set(FUNC(?_device::ppi_out_b));
// m_ppi->in_pc_callback().set(FUNC(?_device::ppi_in_c));
// m_ppi->out_pc_callback().set(FUNC(?_device::ppi_out_c));

// we may later add this, for the auxiliary audio output provided by this extension board:
// SPEAKER(config, "mono").front_center();
}

void hdae5000_device::device_start()
{
// save_item(NAME(m_...));
}

void hdae5000_device::device_reset()
{
}

} // anonymous namespace

DEFINE_DEVICE_TYPE_PRIVATE(HDAE5000, kn5000_extension_interface, hdae5000_device, "hdae5000", "HD-AE5000, Hard Disk & Audio Extension")
16 changes: 16 additions & 0 deletions src/devices/bus/technics/hdae5000.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// license:BSD-3-Clause
// copyright-holders:Antoine Mine, Olivier Galibert, Felipe Sanches
//
// HD-AE5000 emulation
//
#ifndef MAME_BUS_TECHNICS_HDAE5000_H
#define MAME_BUS_TECHNICS_HDAE5000_H

#pragma once

#include "kn5000_extension.h"

// device type declaration
DECLARE_DEVICE_TYPE(HDAE5000, kn5000_extension_interface)

#endif // MAME_BUS_TECHNICS_HDAE5000_H
56 changes: 56 additions & 0 deletions src/devices/bus/technics/kn5000_extension.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert, Felipe Sanches

// Generic Technics KN5000 extension slot


#include "emu.h"
#include "kn5000_extension.h"

DEFINE_DEVICE_TYPE(KN5000_EXTENSION, kn5000_extension_device, "kn5000_extension", "Technics KN5000 extension port")

kn5000_extension_device::kn5000_extension_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, KN5000_EXTENSION, tag, owner, clock),
device_single_card_slot_interface<kn5000_extension_interface>(mconfig, *this)
// FIXME: do we need these?
// m_firq_callback(*this),
// m_irq_callback(*this)
{
}

void kn5000_extension_device::rom_map(address_space_installer &space, offs_t start, offs_t end)
{
auto dev = get_card_device();
if(dev)
space.install_device(start, end, *dev, &kn5000_extension_interface::rom_map);
}

void kn5000_extension_device::io_map(address_space_installer &space, offs_t start, offs_t end)
{
auto dev = get_card_device();
if(dev)
space.install_device(start, end, *dev, &kn5000_extension_interface::io_map);
}

void kn5000_extension_device::device_start()
{
}

kn5000_extension_interface::kn5000_extension_interface(const machine_config &mconfig, device_t &device) :
device_interface(device, "extension"),
m_ext(dynamic_cast<kn5000_extension_device *>(device.owner()))
{
}

// FIXME: do we need these?
//WRITE_LINE_MEMBER(kn5000_extension_interface::firq_w)
//{
// if(m_ext)
// m_ext->m_firq_callback(state);
//}
//
//WRITE_LINE_MEMBER(kn5000_extension_interface::irq_w)
//{
// if(m_ext)
// m_ext->m_irq_callback(state);
//}
47 changes: 47 additions & 0 deletions src/devices/bus/technics/kn5000_extension.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert, Felipe Sanches
//
// Generic Technics KN5000 extension slot

#ifndef MAME_BUS_TECHNICS_KN5000_EXTENSION_H
#define MAME_BUS_TECHNICS_KN5000_EXTENSION_H

#pragma once

class kn5000_extension_device;

class kn5000_extension_interface : public device_interface
{
public:
kn5000_extension_interface(const machine_config &mconfig, device_t &device);

virtual void rom_map(address_map &map) = 0;
virtual void io_map(address_map &map) = 0;

// FIXME: do we need these?
//protected:
// DECLARE_WRITE_LINE_MEMBER(firq_w);
// DECLARE_WRITE_LINE_MEMBER(irq_w);

private:
kn5000_extension_device *const m_ext;
};


class kn5000_extension_device : public device_t, public device_single_card_slot_interface<kn5000_extension_interface>
{
friend class kn5000_extension_interface;

public:
kn5000_extension_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

void rom_map(address_space_installer &space, offs_t start, offs_t end);
void io_map(address_space_installer &space, offs_t start, offs_t end);

protected:
virtual void device_start() override;
};

DECLARE_DEVICE_TYPE(KN5000_EXTENSION, kn5000_extension_device)

#endif // MAME_BUS_TECHNICS_KN5000_EXTENSION_H
Loading
Loading