From aea2c5e14aa8a25b73436926cd239084f194cb5e Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Sat, 21 Jan 2017 02:27:18 +0100 Subject: [PATCH] Add A1200 keyboard skeleton device (needs MC68HC05Cx support) --- scripts/target/mame/mess.lua | 2 + src/mame/drivers/amiga.cpp | 18 ++++-- src/mame/machine/a1200kbd.cpp | 117 ++++++++++++++++++++++++++++++++++ src/mame/machine/a1200kbd.h | 76 ++++++++++++++++++++++ 4 files changed, 209 insertions(+), 4 deletions(-) create mode 100644 src/mame/machine/a1200kbd.cpp create mode 100644 src/mame/machine/a1200kbd.h diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index aa7bf43fb49..7d0faee9acd 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -1328,6 +1328,8 @@ createMESSProjects(_target, _subtarget, "amiga") files { MAME_DIR .. "src/mame/drivers/amiga.cpp", MAME_DIR .. "src/mame/includes/amiga.h", + MAME_DIR .. "src/mame/machine/a1200kbd.cpp", + MAME_DIR .. "src/mame/machine/a1200kbd.h", MAME_DIR .. "src/mame/machine/amigakbd.cpp", MAME_DIR .. "src/mame/machine/amigakbd.h", } diff --git a/src/mame/drivers/amiga.cpp b/src/mame/drivers/amiga.cpp index e60f4298d8d..5a85dc94ed0 100644 --- a/src/mame/drivers/amiga.cpp +++ b/src/mame/drivers/amiga.cpp @@ -20,11 +20,13 @@ #include "machine/nvram.h" #include "machine/i2cmem.h" #include "machine/amigafdc.h" +#include "machine/a1200kbd.h" #include "machine/amigakbd.h" #include "machine/cr511b.h" #include "machine/rp5c01.h" #include "softlist.h" + //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -1694,6 +1696,18 @@ static MACHINE_CONFIG_DERIVED_CLASS( a1200, amiga_base, a1200_state ) MCFG_ATA_INTERFACE_ADD("ata", ata_devices, "hdd", nullptr, false) MCFG_ATA_INTERFACE_IRQ_HANDLER(DEVWRITELINE("gayle", gayle_device, ide_interrupt_w)) + // keyboard +#if 0 + MCFG_DEVICE_REMOVE("kbd") + MCFG_DEVICE_ADD("kbd", A1200KBD, 0) + MCFG_A1200_KEYBOARD_KCLK_CALLBACK(DEVWRITELINE("cia_0", mos8520_device, cnt_w)) + MCFG_A1200_KEYBOARD_KDAT_CALLBACK(DEVWRITELINE("cia_0", mos8520_device, sp_w)) + MCFG_A1200_KEYBOARD_KRST_CALLBACK(WRITELINE(amiga_state, kbreset_w)) + + MCFG_DEVICE_MODIFY("cia_0") + MCFG_MOS6526_SP_CALLBACK(DEVWRITELINE("kbd", a1200kbd_device, kdat_w)) +#endif + // todo: pcmcia MACHINE_CONFIG_END @@ -2064,10 +2078,6 @@ ROM_START( a1200 ) ROM_SYSTEM_BIOS(2, "logica2", "Logica Diagnostic 2.0") ROMX_LOAD("logica2.u6a", 0x00000, 0x40000, CRC(566bc3f9) SHA1(891d3b7892843517d800d24593168b1d8f1646ca), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) ROMX_LOAD("logica2.u6b", 0x00002, 0x40000, CRC(aac94759) SHA1(da8a4f9ae1aa84f5e2a5dcc5c9d7e4378a9698b7), ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2) | ROM_BIOS(3)) - - ROM_REGION(0x4000, "keyboard", 0) - ROM_LOAD("391508-01.u13", 0x0000, 0x1040, NO_DUMP) // COMMODORE | 391508-01 REV0 | KEYBOARD MPU (MC68HC05C4AFN) - ROM_LOAD("391508-02.u13", 0x0000, 0x2f40, NO_DUMP) // Amiga Tech REV1 Keyboard MPU (MC68HC05C12FN) ROM_END #define rom_a1200n rom_a1200 diff --git a/src/mame/machine/a1200kbd.cpp b/src/mame/machine/a1200kbd.cpp new file mode 100644 index 00000000000..74bde2898ca --- /dev/null +++ b/src/mame/machine/a1200kbd.cpp @@ -0,0 +1,117 @@ +// license: BSD-3-Clause +// copyright-holders: Dirk Best +/*************************************************************************** + + Amiga 1200 Keyboard + + Skeleton device, needs MC68HC05Cx device support + + 391508-01 = Rev 0 is MC68HC05C4AFN + 391508-02 = Rev 1 is MC68HC05C12FN + +***************************************************************************/ + +#include "a1200kbd.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type A1200KBD = &device_creator; + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +static ADDRESS_MAP_START( mc68hc05c12_map, AS_PROGRAM, 8, a1200kbd_device ) + ADDRESS_MAP_GLOBAL_MASK(0x1fff) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x0000, 0x1fff) AM_ROM AM_REGION("mpu", 0) +ADDRESS_MAP_END + +static MACHINE_CONFIG_FRAGMENT( a1200kbd_rev1 ) + // should be MC68HC05C12 + MCFG_CPU_ADD("mpu", M6805, XTAL_3MHz) + MCFG_CPU_PROGRAM_MAP(mc68hc05c12_map) +MACHINE_CONFIG_END + +machine_config_constructor a1200kbd_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( a1200kbd_rev1 ); +} + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +ROM_START( a1200kbd_rev1 ) + ROM_REGION(0x2000, "mpu", 0) + // should be 0x3000, i assume it was hacked to allow it to be written to a 68hc705c8 + // it was labeled "rev b", so it's probably the rev 1 (a rev 0 is in our queue to be decapped) + ROM_LOAD("391508-02.bin", 0x0000, 0x2000, BAD_DUMP CRC(2a77eec4) SHA1(301ec6a69404457d912c89e3fc54095eda9f0e93)) +ROM_END + +const tiny_rom_entry *a1200kbd_device::device_rom_region() const +{ + return ROM_NAME( a1200kbd_rev1 ); +} + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( a1200_us_keyboard ) +INPUT_PORTS_END + +ioport_constructor a1200kbd_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( a1200_us_keyboard ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// a1200kbd_device - constructor +//------------------------------------------------- + +a1200kbd_device::a1200kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, A1200KBD, "Amiga 1200 Keyboard Rev 1", tag, owner, clock, "a1200kbd_r1", __FILE__), + m_write_kclk(*this), + m_write_kdat(*this), + m_write_krst(*this), + m_mpu(*this, "mpu") +{} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void a1200kbd_device::device_start() +{ + // resolve callbacks + m_write_kclk.resolve_safe(); + m_write_kdat.resolve_safe(); + m_write_krst.resolve_safe(); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void a1200kbd_device::device_reset() +{ +} + + +//************************************************************************** +// INTERFACE +//************************************************************************** + +WRITE_LINE_MEMBER( a1200kbd_device::kdat_w ) +{ +} diff --git a/src/mame/machine/a1200kbd.h b/src/mame/machine/a1200kbd.h new file mode 100644 index 00000000000..b5f4b9de7d5 --- /dev/null +++ b/src/mame/machine/a1200kbd.h @@ -0,0 +1,76 @@ +// license: BSD-3-Clause +// copyright-holders: Dirk Best +/*************************************************************************** + + Amiga 1200 Keyboard + + Skeleton device, needs MC68HC05Cx device support + +***************************************************************************/ + +#pragma once + +#ifndef MAME_MACHINE_A1200KBD_H +#define MAME_MACHINE_A1200KBD_H + +#include "emu.h" +#include "cpu/m6805/m6805.h" + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_A1200_KEYBOARD_KCLK_CALLBACK(_write) \ + devcb = &a1200kbd_device::set_kclk_wr_callback(*device, DEVCB_##_write); + +#define MCFG_A1200_KEYBOARD_KDAT_CALLBACK(_write) \ + devcb = &a1200kbd_device::set_kdat_wr_callback(*device, DEVCB_##_write); + +#define MCFG_A1200_KEYBOARD_KRST_CALLBACK(_write) \ + devcb = &a1200kbd_device::set_krst_wr_callback(*device, DEVCB_##_write); + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> a1200kbd_device + +class a1200kbd_device : public device_t +{ +public: + // construction/destruction + a1200kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + template static devcb_base &set_kclk_wr_callback(device_t &device, _Object object) + { return downcast(device).m_write_kclk.set_callback(object); } + + template static devcb_base &set_kdat_wr_callback(device_t &device, _Object object) + { return downcast(device).m_write_kdat.set_callback(object); } + + template static devcb_base &set_krst_wr_callback(device_t &device, _Object object) + { return downcast(device).m_write_krst.set_callback(object); } + + DECLARE_WRITE_LINE_MEMBER( kdat_w ); + +protected: + // device-level overrides + virtual const tiny_rom_entry *device_rom_region() const override; + virtual machine_config_constructor device_mconfig_additions() const override; + virtual ioport_constructor device_input_ports() const override; + virtual void device_start() override; + virtual void device_reset() override; + +private: + devcb_write_line m_write_kclk; + devcb_write_line m_write_kdat; + devcb_write_line m_write_krst; + + required_device m_mpu; +}; + +// device type definition +extern const device_type A1200KBD; + +#endif // MAME_MACHINE_A1200KBD_H