From e3c1dc11fcd7ff065ae8aa8c7601ad00b4a0f669 Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Sun, 11 Dec 2022 22:16:32 +0000 Subject: mt65: Slotified the keyboard port, devicified Microtan Keypad (MT006), Microtan Keyboard (MT009), and ETI Space Invasion Key Unit. - Added cards ETI Real Time Clock, ETI Sound Card, Microtanic Real Time Clock, TUG Combo Card, and TUG EPROM Storage Card. mt6809: Fixed keyboard input, RALBUG commands now work, and promoted to working. - Added support for FLEX and BBC Micro floppy formats. spinveti: Replaced incorrect ROM to load at &F800. --- scripts/src/bus.lua | 16 ++ src/devices/bus/tanbus/etirtc.cpp | 88 ++++++ src/devices/bus/tanbus/etirtc.h | 47 ++++ src/devices/bus/tanbus/etisnd.cpp | 153 +++++++++++ src/devices/bus/tanbus/etisnd.h | 53 ++++ src/devices/bus/tanbus/keyboard/keyboard.cpp | 108 ++++++++ src/devices/bus/tanbus/keyboard/keyboard.h | 82 ++++++ src/devices/bus/tanbus/keyboard/mt006.cpp | 118 ++++++++ src/devices/bus/tanbus/keyboard/mt006.h | 50 ++++ src/devices/bus/tanbus/keyboard/mt009.cpp | 390 +++++++++++++++++++++++++++ src/devices/bus/tanbus/keyboard/mt009.h | 63 +++++ src/devices/bus/tanbus/keyboard/spinveti.cpp | 97 +++++++ src/devices/bus/tanbus/keyboard/spinveti.h | 49 ++++ src/devices/bus/tanbus/ra32k.cpp | 143 +++++----- src/devices/bus/tanbus/ra32k.h | 59 ++-- src/devices/bus/tanbus/radisc.cpp | 77 +++--- src/devices/bus/tanbus/radisc.h | 18 +- src/devices/bus/tanbus/tanbus.cpp | 25 +- src/devices/bus/tanbus/tandos.cpp | 46 ++-- src/devices/bus/tanbus/tandos.h | 16 +- src/devices/bus/tanbus/tanram.cpp | 20 +- src/devices/bus/tanbus/tanrtc.cpp | 86 ++++++ src/devices/bus/tanbus/tanrtc.h | 47 ++++ src/devices/bus/tanbus/tugcombo.cpp | 270 +++++++++++++++++++ src/devices/bus/tanbus/tugcombo.h | 142 ++++++++++ src/mame/tangerine/microtan.cpp | 319 +++++++--------------- src/mame/tangerine/microtan.h | 82 +++--- src/mame/tangerine/microtan_m.cpp | 315 ++++------------------ src/mame/tangerine/microtan_v.cpp | 20 +- 29 files changed, 2261 insertions(+), 738 deletions(-) create mode 100644 src/devices/bus/tanbus/etirtc.cpp create mode 100644 src/devices/bus/tanbus/etirtc.h create mode 100644 src/devices/bus/tanbus/etisnd.cpp create mode 100644 src/devices/bus/tanbus/etisnd.h create mode 100644 src/devices/bus/tanbus/keyboard/keyboard.cpp create mode 100644 src/devices/bus/tanbus/keyboard/keyboard.h create mode 100644 src/devices/bus/tanbus/keyboard/mt006.cpp create mode 100644 src/devices/bus/tanbus/keyboard/mt006.h create mode 100644 src/devices/bus/tanbus/keyboard/mt009.cpp create mode 100644 src/devices/bus/tanbus/keyboard/mt009.h create mode 100644 src/devices/bus/tanbus/keyboard/spinveti.cpp create mode 100644 src/devices/bus/tanbus/keyboard/spinveti.h create mode 100644 src/devices/bus/tanbus/tanrtc.cpp create mode 100644 src/devices/bus/tanbus/tanrtc.h create mode 100644 src/devices/bus/tanbus/tugcombo.cpp create mode 100644 src/devices/bus/tanbus/tugcombo.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 981e7709169..222e88400ee 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -3571,8 +3571,20 @@ end if (BUSES["TANBUS"]~=null) then files { + MAME_DIR .. "src/devices/bus/tanbus/keyboard/keyboard.cpp", + MAME_DIR .. "src/devices/bus/tanbus/keyboard/keyboard.h", + MAME_DIR .. "src/devices/bus/tanbus/keyboard/mt006.cpp", + MAME_DIR .. "src/devices/bus/tanbus/keyboard/mt006.h", + MAME_DIR .. "src/devices/bus/tanbus/keyboard/mt009.cpp", + MAME_DIR .. "src/devices/bus/tanbus/keyboard/mt009.h", + MAME_DIR .. "src/devices/bus/tanbus/keyboard/spinveti.cpp", + MAME_DIR .. "src/devices/bus/tanbus/keyboard/spinveti.h", MAME_DIR .. "src/devices/bus/tanbus/bullsnd.cpp", MAME_DIR .. "src/devices/bus/tanbus/bullsnd.h", + MAME_DIR .. "src/devices/bus/tanbus/etirtc.cpp", + MAME_DIR .. "src/devices/bus/tanbus/etirtc.h", + MAME_DIR .. "src/devices/bus/tanbus/etisnd.cpp", + MAME_DIR .. "src/devices/bus/tanbus/etisnd.h", MAME_DIR .. "src/devices/bus/tanbus/tanbus.cpp", MAME_DIR .. "src/devices/bus/tanbus/tanbus.h", MAME_DIR .. "src/devices/bus/tanbus/tanex.cpp", @@ -3583,6 +3595,8 @@ if (BUSES["TANBUS"]~=null) then MAME_DIR .. "src/devices/bus/tanbus/tanhrg.h", MAME_DIR .. "src/devices/bus/tanbus/tanram.cpp", MAME_DIR .. "src/devices/bus/tanbus/tanram.h", + MAME_DIR .. "src/devices/bus/tanbus/tanrtc.cpp", + MAME_DIR .. "src/devices/bus/tanbus/tanrtc.h", MAME_DIR .. "src/devices/bus/tanbus/mpvdu.cpp", MAME_DIR .. "src/devices/bus/tanbus/mpvdu.h", MAME_DIR .. "src/devices/bus/tanbus/ra32k.cpp", @@ -3595,6 +3609,8 @@ if (BUSES["TANBUS"]~=null) then MAME_DIR .. "src/devices/bus/tanbus/tug64k.h", MAME_DIR .. "src/devices/bus/tanbus/tug8082.cpp", MAME_DIR .. "src/devices/bus/tanbus/tug8082.h", + MAME_DIR .. "src/devices/bus/tanbus/tugcombo.cpp", + MAME_DIR .. "src/devices/bus/tanbus/tugcombo.h", MAME_DIR .. "src/devices/bus/tanbus/tugpgm.cpp", MAME_DIR .. "src/devices/bus/tanbus/tugpgm.h", } diff --git a/src/devices/bus/tanbus/etirtc.cpp b/src/devices/bus/tanbus/etirtc.cpp new file mode 100644 index 00000000000..9875858bd44 --- /dev/null +++ b/src/devices/bus/tanbus/etirtc.cpp @@ -0,0 +1,88 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + ETI Real Time Clock/Calendar + + http://www.microtan.ukpc.net/pageProducts.html#CLOCK + +**********************************************************************/ + + +#include "emu.h" +#include "etirtc.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(TANBUS_ETIRTC, tanbus_etirtc_device, "tanbus_etirtc", "Microtan ETI Real Time Clock") + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void tanbus_etirtc_device::device_add_mconfig(machine_config &config) +{ + MM58174(config, "rtc", 32.768_kHz_XTAL); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// tanbus_etirtc_device - constructor +//------------------------------------------------- + +tanbus_etirtc_device::tanbus_etirtc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, TANBUS_ETIRTC, tag, owner, clock) + , device_tanbus_interface(mconfig, *this) + , m_rtc(*this, "rtc") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tanbus_etirtc_device::device_start() +{ +} + + +//------------------------------------------------- +// read - card read +//------------------------------------------------- + +uint8_t tanbus_etirtc_device::read(offs_t offset, int inhrom, int inhram, int be) +{ + uint8_t data = 0xff; + + switch (offset & 0xfff0) + { + case 0xbc00: + data = m_rtc->read(offset); + break; + } + + return data; +} + + +//------------------------------------------------- +// write - card write +//------------------------------------------------- + +void tanbus_etirtc_device::write(offs_t offset, uint8_t data, int inhrom, int inhram, int be) +{ + switch (offset & 0xfff0) + { + case 0xbc00: + m_rtc->write(offset, data); + break; + } +} diff --git a/src/devices/bus/tanbus/etirtc.h b/src/devices/bus/tanbus/etirtc.h new file mode 100644 index 00000000000..7f7c51eeaea --- /dev/null +++ b/src/devices/bus/tanbus/etirtc.h @@ -0,0 +1,47 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + ETI Real Time Clock/Calendar + +**********************************************************************/ + + +#ifndef MAME_BUS_TANBUS_ETIRTC_H +#define MAME_BUS_TANBUS_ETIRTC_H + +#pragma once + +#include "tanbus.h" +#include "machine/mm58174.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class tanbus_etirtc_device : public device_t, public device_tanbus_interface +{ +public: + // construction/destruction + tanbus_etirtc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + virtual uint8_t read(offs_t offset, int inhrom, int inhram, int be) override; + virtual void write(offs_t offset, uint8_t data, int inhrom, int inhram, int be) override; + +private: + required_device m_rtc; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(TANBUS_ETIRTC, tanbus_etirtc_device) + + +#endif // MAME_BUS_TANBUS_ETIRTC_H diff --git a/src/devices/bus/tanbus/etisnd.cpp b/src/devices/bus/tanbus/etisnd.cpp new file mode 100644 index 00000000000..5bb7a11a75f --- /dev/null +++ b/src/devices/bus/tanbus/etisnd.cpp @@ -0,0 +1,153 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + ETI Sound Card + + http://www.microtan.ukpc.net/pageProducts.html#SOUND + +**********************************************************************/ + + +#include "emu.h" +#include "etisnd.h" +#include "speaker.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(TANBUS_ETISND, tanbus_etisnd_device, "tanbus_etisnd", "Microtan ETI Sound Card") + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void tanbus_etisnd_device::device_add_mconfig(machine_config &config) +{ + PIA6821(config, m_pia[0], 0); + m_pia[0]->writepa_handler().set("dac1", FUNC(dac_byte_interface::data_w)); + m_pia[0]->writepb_handler().set("dac2", FUNC(dac_byte_interface::data_w)); + + PIA6821(config, m_pia[1], 0); + m_pia[1]->writepa_handler().set("dac3", FUNC(dac_byte_interface::data_w)); + m_pia[1]->writepb_handler().set("dac4", FUNC(dac_byte_interface::data_w)); + + PIA6821(config, m_pia[2], 0); + m_pia[2]->writepa_handler().set("dac5", FUNC(dac_byte_interface::data_w)); + m_pia[2]->writepb_handler().set("dac6", FUNC(dac_byte_interface::data_w)); + + PIA6821(config, m_pia[3], 0); + m_pia[2]->writepb_handler().set(FUNC(tanbus_etisnd_device::pia_pb_w)); + + SPEAKER(config, "speaker").front_center(); + DAC0800(config, "dac1", 0).add_route(ALL_OUTPUTS, "speaker", 1.0); + DAC0800(config, "dac2", 0).add_route(ALL_OUTPUTS, "speaker", 1.0); + DAC0800(config, "dac3", 0).add_route(ALL_OUTPUTS, "speaker", 1.0); + DAC0800(config, "dac4", 0).add_route(ALL_OUTPUTS, "speaker", 1.0); + DAC0800(config, "dac5", 0).add_route(ALL_OUTPUTS, "speaker", 1.0); + DAC0800(config, "dac6", 0).add_route(ALL_OUTPUTS, "speaker", 1.0); + + AY8910(config, m_ay8910, DERIVED_CLOCK(1, 4)).add_route(ALL_OUTPUTS, "speaker", 0.5); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// tanbus_etisnd_device - constructor +//------------------------------------------------- + +tanbus_etisnd_device::tanbus_etisnd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, TANBUS_ETISND, tag, owner, clock) + , device_tanbus_interface(mconfig, *this) + , m_pia(*this, "pia%u", 0) + , m_ay8910(*this, "ay8910") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tanbus_etisnd_device::device_start() +{ +} + + +//------------------------------------------------- +// read - card read +//------------------------------------------------- + +uint8_t tanbus_etisnd_device::read(offs_t offset, int inhrom, int inhram, int be) +{ + uint8_t data = 0xff; + + switch (offset & 0xfffc) + { + case 0xbc00: + data = m_pia[0]->read(offset & 3); + break; + case 0xbc04: + data = m_pia[1]->read(offset & 3); + break; + case 0xbc08: + data = m_pia[2]->read(offset & 3); + break; + case 0xbc0c: + data = m_pia[3]->read(offset & 3); + break; + } + + return data; +} + + +//------------------------------------------------- +// write - card write +//------------------------------------------------- + +void tanbus_etisnd_device::write(offs_t offset, uint8_t data, int inhrom, int inhram, int be) +{ + switch (offset & 0xfffc) + { + case 0xbc00: + m_pia[0]->write(offset & 3, data); + break; + case 0xbc04: + m_pia[1]->write(offset & 3, data); + break; + case 0xbc08: + m_pia[2]->write(offset & 3, data); + break; + case 0xbc0c: + m_pia[3]->write(offset & 3, data); + break; + } +} + +void tanbus_etisnd_device::pia_pb_w(uint8_t data) +{ + // PB0 -> BC1 + // PB1 -> BDIR + // +5v -> BC2 + switch (data & 3) + { + case 0: + m_pia[3]->porta_w(0xff); + break; + case 1: + m_pia[3]->porta_w(m_ay8910->data_r()); + break; + case 2: + m_ay8910->data_w(m_pia[3]->a_output()); + break; + case 3: + m_ay8910->address_w(m_pia[3]->a_output()); + break; + } +} diff --git a/src/devices/bus/tanbus/etisnd.h b/src/devices/bus/tanbus/etisnd.h new file mode 100644 index 00000000000..6bc8bead361 --- /dev/null +++ b/src/devices/bus/tanbus/etisnd.h @@ -0,0 +1,53 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + ETI Sound Card + +**********************************************************************/ + + +#ifndef MAME_BUS_TANBUS_ETISND_H +#define MAME_BUS_TANBUS_ETISND_H + +#pragma once + +#include "tanbus.h" +#include "machine/6821pia.h" +#include "sound/ay8910.h" +#include "sound/dac.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class tanbus_etisnd_device : public device_t, public device_tanbus_interface +{ +public: + // construction/destruction + tanbus_etisnd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + virtual uint8_t read(offs_t offset, int inhrom, int inhram, int be) override; + virtual void write(offs_t offset, uint8_t data, int inhrom, int inhram, int be) override; + +private: + required_device_array m_pia; + required_device m_ay8910; + + void pia_pb_w(uint8_t data); +}; + + +// device type definition +DECLARE_DEVICE_TYPE(TANBUS_ETISND, tanbus_etisnd_device) + + +#endif // MAME_BUS_TANBUS_ETISND_H diff --git a/src/devices/bus/tanbus/keyboard/keyboard.cpp b/src/devices/bus/tanbus/keyboard/keyboard.cpp new file mode 100644 index 00000000000..fa0c26d4c7d --- /dev/null +++ b/src/devices/bus/tanbus/keyboard/keyboard.cpp @@ -0,0 +1,108 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Microtan Keyboard Interface + +**********************************************************************/ + +#include "emu.h" +#include "keyboard.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(MICROTAN_KBD_SLOT, microtan_kbd_slot_device, "microtan_kbd_slot", "Microtan Keyboard Interface") + + + +//************************************************************************** +// DEVICE MICROTAN_KBD PORT INTERFACE +//************************************************************************** + +//------------------------------------------------- +// device_microtan_kbd_interface - constructor +//------------------------------------------------- + +device_microtan_kbd_interface::device_microtan_kbd_interface(const machine_config &mconfig, device_t &device) : + device_interface(device, "microtankbd") +{ + m_slot = dynamic_cast(device.owner()); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// microtan_kbd_slot_device - constructor +//------------------------------------------------- + +microtan_kbd_slot_device::microtan_kbd_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, MICROTAN_KBD_SLOT, tag, owner, clock) + , device_single_card_slot_interface(mconfig, *this) + , m_kbd(nullptr) + , m_strobe_handler(*this) + , m_reset_handler(*this) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void microtan_kbd_slot_device::device_start() +{ + m_kbd = get_card_device(); + + // resolve callbacks + m_strobe_handler.resolve_safe(); + m_reset_handler.resolve_safe(); +} + + +//------------------------------------------------- +// kbd_in +//------------------------------------------------- + +u8 microtan_kbd_slot_device::read() +{ + if (m_kbd) + return m_kbd->read() & 0x7f; + else + return 0x7f; +} + +//------------------------------------------------- +// write +//------------------------------------------------- + +void microtan_kbd_slot_device::write(uint8_t data) +{ + if (m_kbd) + m_kbd->write(data); +} + +//------------------------------------------------- +// SLOT_INTERFACE( microtan_kbd_devices ) +//------------------------------------------------- + + +// slot devices +#include "mt006.h" +#include "mt009.h" +//#include "mt0020.h" +#include "spinveti.h" + + +void microtan_kbd_devices(device_slot_interface &device) +{ + device.option_add("mt006", MICROTAN_KBD_MT006); + device.option_add("mt009", MICROTAN_KBD_MT009); + //device.option_add("mt0020", MICROTAN_KBD_MT0020); + device.option_add("spinveti", MICROTAN_KBD_SPINVETI); +} diff --git a/src/devices/bus/tanbus/keyboard/keyboard.h b/src/devices/bus/tanbus/keyboard/keyboard.h new file mode 100644 index 00000000000..3c57807faa5 --- /dev/null +++ b/src/devices/bus/tanbus/keyboard/keyboard.h @@ -0,0 +1,82 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Microtan Keyboard Interface + +**********************************************************************/ + +#ifndef MAME_BUS_TANBUS_KEYBOARD_H +#define MAME_BUS_TANBUS_KEYBOARD_H + +#pragma once + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class device_microtan_kbd_interface; + +// ======================> microtan_kbd_slot_device + +class microtan_kbd_slot_device : public device_t, public device_single_card_slot_interface +{ +public: + // construction/destruction + template + microtan_kbd_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&slot_options, const char *default_option) + : microtan_kbd_slot_device(mconfig, tag, owner, 0) + { + option_reset(); + slot_options(*this); + set_default_option(default_option); + set_fixed(false); + } + + microtan_kbd_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = 0); + + // callbacks + auto strobe_handler() { return m_strobe_handler.bind(); } + auto reset_handler() { return m_reset_handler.bind(); } + + virtual uint8_t read(); + virtual void write(uint8_t data); + + DECLARE_WRITE_LINE_MEMBER(strobe_w) { m_strobe_handler(state); } + DECLARE_WRITE_LINE_MEMBER(reset_w) { m_reset_handler(state); } + +protected: + // device-level overrides + virtual void device_start() override; + +private: + device_microtan_kbd_interface *m_kbd; + + devcb_write_line m_strobe_handler; + devcb_write_line m_reset_handler; +}; + + +// ======================> device_microtan_kbd_interface + +class device_microtan_kbd_interface : public device_interface +{ +public: + virtual uint8_t read() { return 0xff; } + virtual void write(uint8_t data) { } + +protected: + device_microtan_kbd_interface(const machine_config &mconfig, device_t &device); + + microtan_kbd_slot_device *m_slot; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(MICROTAN_KBD_SLOT, microtan_kbd_slot_device) + +void microtan_kbd_devices(device_slot_interface &device); + + +#endif // MAME_BUS_TANBUS_KEYBOARD_H diff --git a/src/devices/bus/tanbus/keyboard/mt006.cpp b/src/devices/bus/tanbus/keyboard/mt006.cpp new file mode 100644 index 00000000000..c46ed6fab76 --- /dev/null +++ b/src/devices/bus/tanbus/keyboard/mt006.cpp @@ -0,0 +1,118 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Microtan Keypad (MT006) + + http://www.microtan.ukpc.net/pageProducts.html#KEYBOARDS + +*********************************************************************/ + +#include "emu.h" +#include "mt006.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(MICROTAN_KBD_MT006, microtan_kbd_mt006, "microtan_kbd_mt006", "Microtan Keypad (MT006)") + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( mt006 ) + PORT_START("KPAD0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("8 P") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("C M") PORT_CODE(KEYCODE_C) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) + + PORT_START("KPAD1") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("5 O") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("9 ESC") PORT_CODE(KEYCODE_9_PAD) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("D G") PORT_CODE(KEYCODE_D) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("LF DEL") PORT_CODE(KEYCODE_DEL_PAD) + + PORT_START("KPAD2") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("6 C") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("A") PORT_CODE(KEYCODE_A) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("E S") PORT_CODE(KEYCODE_E) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("CR SP") PORT_CODE(KEYCODE_ENTER_PAD) + + PORT_START("KPAD3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("3 '") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("7 R") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("B L") PORT_CODE(KEYCODE_B) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F N") PORT_CODE(KEYCODE_F) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) + + PORT_START("RESET") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, microtan_kbd_mt006, trigger_reset, 0) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(microtan_kbd_mt006::trigger_reset) +{ + m_slot->reset_w(newval ? CLEAR_LINE : ASSERT_LINE); +} + +ioport_constructor microtan_kbd_mt006::device_input_ports() const +{ + return INPUT_PORTS_NAME( mt006 ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// microtan_kbd_mt006 - constructor +//------------------------------------------------- + +microtan_kbd_mt006::microtan_kbd_mt006(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, MICROTAN_KBD_MT006, tag, owner, clock) + , device_microtan_kbd_interface(mconfig, *this) + , m_keypad(*this, "KPAD%u", 0U) + , m_column(0) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void microtan_kbd_mt006::device_start() +{ + save_item(NAME(m_column)); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t microtan_kbd_mt006::read() +{ + uint8_t data = 0x00; + + for (int i = 0; i < 4; i++) + if (BIT(m_column, i)) + data |= m_keypad[i]->read(); + + return data; +} + + +void microtan_kbd_mt006::write(uint8_t data) +{ + m_column = data & 0x0f; + + m_slot->strobe_w(BIT(data, 4)); +} diff --git a/src/devices/bus/tanbus/keyboard/mt006.h b/src/devices/bus/tanbus/keyboard/mt006.h new file mode 100644 index 00000000000..02315a94149 --- /dev/null +++ b/src/devices/bus/tanbus/keyboard/mt006.h @@ -0,0 +1,50 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Microtan Keypad (MT006) + +*********************************************************************/ + +#ifndef MAME_BUS_TANBUS_KEYBOARD_MT006_H +#define MAME_BUS_TANBUS_KEYBOARD_MT006_H + +#pragma once + +#include "keyboard.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class microtan_kbd_mt006 : public device_t, public device_microtan_kbd_interface +{ +public: + // construction/destruction + microtan_kbd_mt006(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + + DECLARE_INPUT_CHANGED_MEMBER(trigger_reset); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual ioport_constructor device_input_ports() const override; + + virtual uint8_t read() override; + virtual void write(uint8_t data) override; + +private: + required_ioport_array<4> m_keypad; + + uint8_t m_column; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(MICROTAN_KBD_MT006, microtan_kbd_mt006) + + +#endif // MAME_BUS_TANBUS_KEYBOARD_MT006_H diff --git a/src/devices/bus/tanbus/keyboard/mt009.cpp b/src/devices/bus/tanbus/keyboard/mt009.cpp new file mode 100644 index 00000000000..b805e96c49c --- /dev/null +++ b/src/devices/bus/tanbus/keyboard/mt009.cpp @@ -0,0 +1,390 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Microtan Keyboard (MT009) + + http://www.microtan.ukpc.net/pageProducts.html#KEYBOARDS + + The keyboard is essentially an ordinary ASCII keyboard, with 71 keys, 8 + TTL chips and a 2716 eprom labeled MON V1. We currently use a + generic keyboard because of the lack of a schematic. Unemulated keys are + 'SHIFT LOCK' and 'REPT'. Since all commands must be uppercase, capslock + is defaulted to on. + + TODO: + - use ROM data to determine the returned ASCII code. + +*********************************************************************/ + +#include "emu.h" +#include "mt009.h" +#include "utf8.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(MICROTAN_KBD_MT009, microtan_kbd_mt009, "microtan_kbd_mt009", "Microtan Keyboard (MT009)") + + +static const char keyboard[8][9][8] = { + { /* normal */ + { 27,'1','2','3','4','5','6','7'}, + {'8','9','0',':','-', 12,127,'^'}, + {'q','w','e','r','t','y','u','i'}, + {'o','p','[',']', 13, 3, 0, 0}, + {'a','s','d','f','g','h','j','k'}, + {'l',';','@', 92, 0,'z','x','c'}, + {'v','b','n','m',',','.','/', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, + { /* Shift */ + { 27,'!','"','#','$','%','&', 39}, + {'(',')','~','*','=', 12,127,'_'}, + {'Q','W','E','R','T','Y','U','I'}, + {'O','P','{','}', 13, 3, 0, 0}, + {'A','S','D','F','G','H','J','K'}, + {'L','+','`','|', 0,'Z','X','C'}, + {'V','B','N','M','<','>','?', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, + { /* Control */ + { 27,'1','2','3','4','5','6','7'}, + {'8','9','0',':','-','`',127, 30}, + { 17, 23, 5, 18, 20, 25, 21, 9}, + { 15, 16, 27, 29, 13, 3, 0, 0}, + { 1, 19, 4, 6, 7, 8, 10, 11}, + { 12,';','@', 28, 0, 26, 24, 3}, + { 22, 2, 14, 13,',','.','/', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, + { /* Shift+Control */ + { 27,'!','"','#','$','%','&', 39}, + {'(',')','~','*','=', 12,127, 31}, + { 17, 23, 5, 18, 20, 25, 21, 9}, + { 15, 16, 27, 29, 13,127, 0, 0}, + { 1, 19, 4, 6, 7, 8, 10, 11}, + { 12,'+','`', 28, 0, 26, 24, 3}, + { 22, 2, 14, 13,',','.','/', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, + { /* CapsLock */ + { 27,'1','2','3','4','5','6','7'}, + {'8','9','0',':','-', 12,127,'^'}, + {'Q','W','E','R','T','Y','U','I'}, + {'O','P','[',']', 13, 3, 0, 0}, + {'A','S','D','F','G','H','J','K'}, + {'L',';','@', 92, 0,'Z','X','C'}, + {'V','B','N','M',',','.','/', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, + { /* Shift+CapsLock */ + { 27,'!','"','#','$','%','&', 39}, + {'(',')','~','*','=', 12,127,'_'}, + {'q','w','e','r','t','y','u','i'}, + {'o','p','{','}', 13, 3, 0, 0}, + {'a','s','d','f','g','h','j','k'}, + {'l','+','`','|', 0,'z','x','c'}, + {'v','b','n','m','<','>','?', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, + { /* Control+CapsLock */ + { 27,'1','2','3','4','5','6','7'}, + {'8','9','0',':','-', 12,127, 9}, + { 17, 23, 5, 18, 20, 25, 21, 9}, + { 15, 16, 27, 29, 13,127, 0, 0}, + { 1, 19, 4, 6, 7, 8, 10, 11}, + { 12,';', 39, 28, 0, 26, 24, 3}, + { 22, 2, 14, 13,',','.','/', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, + { /* Shift+Control+CapsLock */ + { 27,'!','"','#','$','%','&', 39}, + {'(',')','~','*','=', 12,127, 9}, + { 17, 23, 5, 18, 20, 25, 21, 9}, + { 15, 16, 27, 29, 13,127, 0, 0}, + { 1, 19, 4, 6, 7, 8, 10, 11}, + { 12,':','"', 28, 0, 26, 24, 3}, + { 22, 2, 14, 13,',','.','/', 0}, + { 10,' ','-',',', 13,'.','0','1'}, + {'2','3','4','5','6','7','8','9'}, + }, +}; + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( kbd_mt009 ) + PORT_START("KBD0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(39) + + PORT_START("KBD1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('~') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": *") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- =") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NEW PAGE") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(12) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RUB OUT") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_TAB) PORT_CHAR('^') PORT_CHAR('_') + + PORT_START("KBD2") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') + + PORT_START("KBD3") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] }") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_DEL) PORT_CHAR(3) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ALFA LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE + + PORT_START("KBD4") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') + + PORT_START("KBD5") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') PORT_CHAR('`') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_CHAR('|') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT (L)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') + + PORT_START("KBD6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT (R)") PORT_CODE(KEYCODE_RSHIFT) + + PORT_START("KBD7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CHAR(10) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- (KP)") PORT_CODE(KEYCODE_MINUS_PAD) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", (KP)") PORT_CODE(KEYCODE_PLUS_PAD) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ENTER (KP)") PORT_CODE(KEYCODE_ENTER_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". (KP)") PORT_CODE(KEYCODE_DEL_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 (KP)") PORT_CODE(KEYCODE_0_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 (KP)") PORT_CODE(KEYCODE_1_PAD) + + PORT_START("KBD8") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 (KP)") PORT_CODE(KEYCODE_2_PAD) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 (KP)") PORT_CODE(KEYCODE_3_PAD) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 (KP)") PORT_CODE(KEYCODE_4_PAD) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 (KP)") PORT_CODE(KEYCODE_5_PAD) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 (KP)") PORT_CODE(KEYCODE_6_PAD) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 (KP)") PORT_CODE(KEYCODE_7_PAD) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (KP)") PORT_CODE(KEYCODE_8_PAD) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 (KP)") PORT_CODE(KEYCODE_9_PAD) + + PORT_START("BRK") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_CHANGED_MEMBER(DEVICE_SELF, microtan_kbd_mt009, trigger_reset, 0) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(microtan_kbd_mt009::trigger_reset) +{ + m_slot->reset_w(newval ? ASSERT_LINE : CLEAR_LINE); +} + +ioport_constructor microtan_kbd_mt009::device_input_ports() const +{ + return INPUT_PORTS_NAME( kbd_mt009 ); +} + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +ROM_START( kbd_mt009 ) + ROM_REGION( 0x0800, "rom", 0 ) + ROM_LOAD("ascii_v1.bin", 0x0000, 0x0800, CRC(17a03a82) SHA1(89dcc0712745ed9ba876a78eefd55e9a54fc4fad)) +ROM_END + +const tiny_rom_entry *microtan_kbd_mt009::device_rom_region() const +{ + return ROM_NAME( kbd_mt009 ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// microtan_kbd_mt009 - constructor +//------------------------------------------------- + +microtan_kbd_mt009::microtan_kbd_mt009(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, MICROTAN_KBD_MT009, tag, owner, clock) + , device_microtan_kbd_interface(mconfig, *this) + , m_rom(*this, "rom") + , m_keyboard(*this, "KBD%u", 0U) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void microtan_kbd_mt009::device_start() +{ + m_kbd_scan_timer = timer_alloc(FUNC(microtan_kbd_mt009::kbd_scan), this); + + m_kbd_scan_timer->adjust(attotime::from_hz(45), 0, attotime::from_hz(45)); + + save_item(NAME(m_kbd_ascii)); + save_item(NAME(m_keyrows)); + save_item(NAME(m_lastrow)); + save_item(NAME(m_mask)); + save_item(NAME(m_key)); + save_item(NAME(m_repeat)); + save_item(NAME(m_repeater)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void microtan_kbd_mt009::device_reset() +{ + for (int i = 1; i < 10; i++) + m_keyrows[i] = m_keyboard[i-1]->read(); +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t microtan_kbd_mt009::read() +{ + return m_kbd_ascii; +} + + +void microtan_kbd_mt009::store_key(int key) +{ + m_kbd_ascii = key; + m_slot->strobe_w(ASSERT_LINE); +} + +TIMER_CALLBACK_MEMBER(microtan_kbd_mt009::kbd_scan) +{ + int mod, row, col, chg, newvar; + + if (m_repeat) + { + if (!--m_repeat) + m_repeater = 4; + } + else if (m_repeater) + m_repeat = m_repeater; + + row = 9; + newvar = m_keyboard[8]->read(); + chg = m_keyrows[--row] ^ newvar; + + while (!chg && row > 0) + { + newvar = m_keyboard[row - 1]->read(); + chg = m_keyrows[--row] ^ newvar; + } + if (!chg) + --row; + + if (row >= 0) + { + m_repeater = 0x00; + m_mask = 0x00; + m_key = 0x00; + m_lastrow = row; + + if (newvar & chg) /* key(s) pressed ? */ + { + mod = 0; + + /* Shift modifier */ + if ((m_keyrows[5] & 0x10) || (m_keyrows[6] & 0x80)) + mod |= 1; + + /* Control modifier */ + if (m_keyrows[3] & 0x40) + mod |= 2; + + /* CapsLock modifier */ + if (m_keyrows[3] & 0x80) + mod |= 4; + + /* find newvar key */ + m_mask = 0x01; + for (col = 0; col < 8; col++) + { + if (chg & m_mask) + { + newvar &= m_mask; + m_key = keyboard[mod][row][col]; + break; + } + m_mask <<= 1; + } + if (m_key) /* normal key */ + { + m_repeater = 30; + store_key(m_key); + } + else + if ((row == 0) && (chg == 0x04)) /* Ctrl-@ (NUL) */ + store_key(0); + m_keyrows[row] |= newvar; + } + else + m_keyrows[row] = newvar; + + m_repeat = m_repeater; + } + else + if (m_key && (m_keyrows[m_lastrow] & m_mask) && m_repeat == 0) + store_key(m_key); +} diff --git a/src/devices/bus/tanbus/keyboard/mt009.h b/src/devices/bus/tanbus/keyboard/mt009.h new file mode 100644 index 00000000000..f9c934f551d --- /dev/null +++ b/src/devices/bus/tanbus/keyboard/mt009.h @@ -0,0 +1,63 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Microtan Keyboard (MT009) + +*********************************************************************/ + +#ifndef MAME_BUS_TANBUS_KEYBOARD_MT009_H +#define MAME_BUS_TANBUS_KEYBOARD_MT009_H + +#pragma once + +#include "keyboard.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class microtan_kbd_mt009 : public device_t, public device_microtan_kbd_interface +{ +public: + // construction/destruction + microtan_kbd_mt009(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + + DECLARE_INPUT_CHANGED_MEMBER(trigger_reset); + TIMER_CALLBACK_MEMBER(kbd_scan); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual const tiny_rom_entry *device_rom_region() const override; + virtual ioport_constructor device_input_ports() const override; + + virtual uint8_t read() override; + +private: + required_memory_region m_rom; + required_ioport_array<9> m_keyboard; + + emu_timer *m_kbd_scan_timer = nullptr; + + uint8_t m_kbd_ascii = 0; + uint8_t m_keyrows[10]{}; + int m_lastrow = 0; + int m_mask = 0; + int m_key = 0; + int m_repeat = 0; + int m_repeater = 0; + + void store_key(int key); +}; + + +// device type definition +DECLARE_DEVICE_TYPE(MICROTAN_KBD_MT009, microtan_kbd_mt009) + + +#endif // MAME_BUS_TANBUS_KEYBOARD_MT009_H diff --git a/src/devices/bus/tanbus/keyboard/spinveti.cpp b/src/devices/bus/tanbus/keyboard/spinveti.cpp new file mode 100644 index 00000000000..143442a31bd --- /dev/null +++ b/src/devices/bus/tanbus/keyboard/spinveti.cpp @@ -0,0 +1,97 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + ETI Space Invasion Key Unit + +*********************************************************************/ + +#include "emu.h" +#include "spinveti.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(MICROTAN_KBD_SPINVETI, microtan_kbd_spinveti, "microtan_kbd_spinveti", "ETI Space Invasion Key Unit") + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( spinveti ) + PORT_START("PB") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Start") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Fire") PORT_CODE(KEYCODE_LCONTROL) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Hold") PORT_CODE(KEYCODE_H) + + PORT_START("SW") + PORT_CONFNAME(0x60, 0x20, "Difficulty") + PORT_CONFSETTING(0x00, "Easy") + PORT_CONFSETTING(0x20, "Normal") + PORT_CONFSETTING(0x40, "Hard") + PORT_CONFSETTING(0x60, "Hardest") + + PORT_START("RS") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Reset") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, microtan_kbd_spinveti, trigger_reset, 0) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(microtan_kbd_spinveti::trigger_reset) +{ + m_slot->reset_w(newval ? CLEAR_LINE : ASSERT_LINE); +} + +ioport_constructor microtan_kbd_spinveti::device_input_ports() const +{ + return INPUT_PORTS_NAME( spinveti ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// microtan_kbd_spinveti - constructor +//------------------------------------------------- + +microtan_kbd_spinveti::microtan_kbd_spinveti(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, MICROTAN_KBD_SPINVETI, tag, owner, clock) + , device_microtan_kbd_interface(mconfig, *this) + , m_pb(*this, "PB") + , m_sw(*this, "SW") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void microtan_kbd_spinveti::device_start() +{ +} + + +//************************************************************************** +// IMPLEMENTATION +//************************************************************************** + +uint8_t microtan_kbd_spinveti::read() +{ + return m_pb->read() | m_sw->read(); +} + + +void microtan_kbd_spinveti::write(uint8_t data) +{ + // TODO: sound effects (heartbeat, fire, saucer, and explosion) + // bit 1 Heartbeat (active high) + // bit 2 Gun firing (active low) + // bit 3 Flying saucer (active high) + // bit 4 Explosion (active high) +} diff --git a/src/devices/bus/tanbus/keyboard/spinveti.h b/src/devices/bus/tanbus/keyboard/spinveti.h new file mode 100644 index 00000000000..941581a5912 --- /dev/null +++ b/src/devices/bus/tanbus/keyboard/spinveti.h @@ -0,0 +1,49 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + ETI Space Invasion Key Unit + +*********************************************************************/ + +#ifndef MAME_BUS_TANBUS_KEYBOARD_SPINVETI_H +#define MAME_BUS_TANBUS_KEYBOARD_SPINVETI_H + +#pragma once + +#include "keyboard.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class microtan_kbd_spinveti : public device_t, public device_microtan_kbd_interface +{ +public: + // construction/destruction + microtan_kbd_spinveti(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + + DECLARE_INPUT_CHANGED_MEMBER(trigger_reset); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual ioport_constructor device_input_ports() const override; + + virtual uint8_t read() override; + virtual void write(uint8_t data) override; + +private: + required_ioport m_pb; + required_ioport m_sw; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(MICROTAN_KBD_SPINVETI, microtan_kbd_spinveti) + + +#endif // MAME_BUS_TANBUS_KEYBOARD_SPINVETI_H diff --git a/src/devices/bus/tanbus/ra32k.cpp b/src/devices/bus/tanbus/ra32k.cpp index 9b83afc96f0..15f3aa25e37 100644 --- a/src/devices/bus/tanbus/ra32k.cpp +++ b/src/devices/bus/tanbus/ra32k.cpp @@ -17,7 +17,8 @@ // DEVICE DEFINITIONS //************************************************************************** -DEFINE_DEVICE_TYPE(TANBUS_RA32K, tanbus_ra32k_device, "tanbus_ra32k", "Ralph Allen 32K EPROM-RAM Card") +DEFINE_DEVICE_TYPE(TANBUS_RA32KRAM, tanbus_ra32kram_device, "tanbus_ra32kram", "Ralph Allen 32K EPROM-RAM Card (RAM)") +DEFINE_DEVICE_TYPE(TANBUS_RA32KROM, tanbus_ra32krom_device, "tanbus_ra32krom", "Ralph Allen 32K EPROM-RAM Card (RALBUG)") //------------------------------------------------- @@ -97,10 +98,9 @@ INPUT_PORTS_START( ra32k ) PORT_DIPSETTING(0x0b, "$F000-$6FFF") PORT_START("LNK1") - PORT_CONFNAME(0x03, 0x00, "Block Enable") - PORT_CONFSETTING(0x00, "RAM (permanent)") - PORT_CONFSETTING(0x01, "RAM (page selectable)") - PORT_CONFSETTING(0x02, "EPROM (page selectable)") + PORT_CONFNAME(0x01, 0x00, "Block Enable") + PORT_CONFSETTING(0x00, "Permanent") + PORT_CONFSETTING(0x01, "Page selectable") INPUT_PORTS_END @@ -114,20 +114,20 @@ ioport_constructor tanbus_ra32k_device::device_input_ports() const } //------------------------------------------------- -// ROM( ra32k ) +// ROM( ra32krom ) //------------------------------------------------- -ROM_START(ra32k) +ROM_START(ra32krom) ROM_REGION(0x8000, "rom", 0) - ROM_LOAD("data_v1.4.rom", 0x0000, 0x0800, CRC(de61f11d) SHA1(3e6ddc5dba47d9136f58abc9475c3e73fc8cc0c2)) - ROM_LOAD("syntax_v1.4.rom", 0x0800, 0x0800, CRC(17438c4c) SHA1(46bf4e33544c19e142b380095736c5c3eb885ba0)) - ROM_LOAD("ascii_v1.4.rom", 0x1000, 0x0800, CRC(93244a81) SHA1(6149eec9904438a0d23529d2c2428a594d5b1fb9)) - ROM_LOAD("graph_v1.4.rom", 0x1800, 0x0800, CRC(159eb1f6) SHA1(5e49edda4b550506aca70d1f7e7de7a352f0359f)) + ROM_LOAD("data_v1.4.rom", 0x2000, 0x0800, CRC(de61f11d) SHA1(3e6ddc5dba47d9136f58abc9475c3e73fc8cc0c2)) + ROM_LOAD("syntax_v1.4.rom", 0x2800, 0x0800, CRC(17438c4c) SHA1(46bf4e33544c19e142b380095736c5c3eb885ba0)) + ROM_LOAD("ascii_v1.4.rom", 0x3000, 0x0800, CRC(93244a81) SHA1(6149eec9904438a0d23529d2c2428a594d5b1fb9)) + ROM_LOAD("graph_v1.4.rom", 0x3800, 0x0800, CRC(159eb1f6) SHA1(5e49edda4b550506aca70d1f7e7de7a352f0359f)) ROM_END -const tiny_rom_entry *tanbus_ra32k_device::device_rom_region() const +const tiny_rom_entry *tanbus_ra32krom_device::device_rom_region() const { - return ROM_NAME(ra32k); + return ROM_NAME(ra32krom); } //************************************************************************** @@ -138,95 +138,50 @@ const tiny_rom_entry *tanbus_ra32k_device::device_rom_region() const // tanbus_ra32k_device - constructor //------------------------------------------------- -tanbus_ra32k_device::tanbus_ra32k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, TANBUS_RA32K, tag, owner, clock) +tanbus_ra32k_device::tanbus_ra32k_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, type, tag, owner, clock) , device_tanbus_interface(mconfig, *this) - , m_rom(*this, "rom") , m_dsw(*this, "DSW%u", 1) , m_link(*this, "LNK1") { } -//------------------------------------------------- -// device_start - device-specific startup -//------------------------------------------------- - -void tanbus_ra32k_device::device_start() +tanbus_ra32kram_device::tanbus_ra32kram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : tanbus_ra32k_device(mconfig, TANBUS_RA32KRAM, tag, owner, clock) { - m_ram = std::make_unique(0x8000); - - save_pointer(NAME(m_ram), 0x8000); } -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void tanbus_ra32k_device::device_reset() +tanbus_ra32krom_device::tanbus_ra32krom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : tanbus_ra32k_device(mconfig, TANBUS_RA32KROM, tag, owner, clock) + , m_rom(*this, "rom") { } //------------------------------------------------- -// read - card read +// device_start - device-specific startup //------------------------------------------------- -uint8_t tanbus_ra32k_device::read(offs_t offset, int inhrom, int inhram, int be) +void tanbus_ra32kram_device::device_start() { - uint8_t data = 0xff; + m_ram = make_unique_clear(0x8000); - switch (m_link->read() & 0x02) - { - case 0x00: - /* 32K dynamic RAM */ - if (block_enabled(offset, inhrom, inhram, be)) - { - //logerror("ram read %04x\n", offset); - data = m_ram[offset & 0x7fff]; - } - break; - case 0x02: - /* ROM selected */ - if (block_enabled(offset, inhrom, inhram, be)) - { - //logerror("rom read %04x\n", offset); - data = m_rom->base()[(offset - m_addr_start) & 0x7fff]; - } - break; - } - - return data; + save_pointer(NAME(m_ram), 0x8000); } -//------------------------------------------------- -// write - card write -//------------------------------------------------- - -void tanbus_ra32k_device::write(offs_t offset, uint8_t data, int inhrom, int inhram, int be) +void tanbus_ra32krom_device::device_start() { - switch (m_link->read() & 0x02) - { - case 0x00: - /* 32K dynamic RAM */ - if (block_enabled(offset, inhrom, inhram, be)) - { - //logerror("ram write %04x %02x\n", offset, data); - m_ram[offset & 0x7fff] = data; - } - break; - case 0x02: - /* ROM selected */ - break; - } } + bool tanbus_ra32k_device::block_enabled(offs_t offset, int inhrom, int inhram, int be) { - m_addr_start = ((bitswap<4>(m_dsw[2]->read(), 1, 0, 3, 2) << 12) + 0x1000) & 0xffff; - m_addr_end = (m_addr_start + 0x7fff) & 0xffff; + offs_t addr_start = ((bitswap<4>(m_dsw[2]->read(), 1, 0, 3, 2) << 12) + 0x1000) & 0xffff; + offs_t addr_end = (addr_start + 0x7fff) & 0xffff; - //uint8_t block_start = (bitswap<4>(m_dsw[2]->read(), 1, 0, 3, 2) + 1) & 0x0f; - uint8_t block = offset >> 12; - //logerror("%04x start %04x current %04x\n", offset, block_start, block); + uint8_t block = (offset & 0x7800) >> 12; + + if (offset < addr_start || offset > addr_end) + return false; if (offset & 0x0800) { @@ -255,3 +210,37 @@ bool tanbus_ra32k_device::block_enabled(offs_t offset, int inhrom, int inhram, i return true; } + +//------------------------------------------------- +// read - card read +//------------------------------------------------- + +uint8_t tanbus_ra32kram_device::read(offs_t offset, int inhrom, int inhram, int be) +{ + if (block_enabled(offset, inhrom, inhram, be)) + { + return m_ram[offset & 0x7fff]; + } + return 0xff; +} + +uint8_t tanbus_ra32krom_device::read(offs_t offset, int inhrom, int inhram, int be) +{ + if (block_enabled(offset, inhrom, inhram, be)) + { + return m_rom[offset & 0x7fff]; + } + return 0xff; +} + +//------------------------------------------------- +// write - card write +//------------------------------------------------- + +void tanbus_ra32kram_device::write(offs_t offset, uint8_t data, int inhrom, int inhram, int be) +{ + if (block_enabled(offset, inhrom, inhram, be)) + { + m_ram[offset & 0x7fff] = data; + } +} diff --git a/src/devices/bus/tanbus/ra32k.h b/src/devices/bus/tanbus/ra32k.h index a67e9c859bb..e92e96452fa 100644 --- a/src/devices/bus/tanbus/ra32k.h +++ b/src/devices/bus/tanbus/ra32k.h @@ -19,41 +19,66 @@ // TYPE DEFINITIONS //************************************************************************** -class tanbus_ra32k_device : - public device_t, - public device_tanbus_interface +class tanbus_ra32k_device : public device_t, public device_tanbus_interface +{ +protected: + tanbus_ra32k_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + // optional information overrides + virtual ioport_constructor device_input_ports() const override; + + required_ioport_array<3> m_dsw; + required_ioport m_link; + + bool block_enabled(offs_t offset, int inhrom, int inhram, int be); +}; + + +// ======================> tanbus_ra32kram_device + +class tanbus_ra32kram_device : public tanbus_ra32k_device { public: // construction/destruction - tanbus_ra32k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + tanbus_ra32kram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); protected: // device-level overrides virtual void device_start() override; - virtual void device_reset() override; - - // optional information overrides - virtual const tiny_rom_entry *device_rom_region() const override; - virtual ioport_constructor device_input_ports() const override; virtual uint8_t read(offs_t offset, int inhrom, int inhram, int be) override; virtual void write(offs_t offset, uint8_t data, int inhrom, int inhram, int be) override; private: - required_memory_region m_rom; - required_ioport_array<3> m_dsw; - required_ioport m_link; - - offs_t m_addr_start; - offs_t m_addr_end; std::unique_ptr m_ram; +}; - bool block_enabled(offs_t offset, int inhrom, int inhram, int be); + +// ======================> tanbus_ra32krom_device + +class tanbus_ra32krom_device : public tanbus_ra32k_device +{ +public: + // construction/destruction + tanbus_ra32krom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual const tiny_rom_entry *device_rom_region() const override; + + virtual uint8_t read(offs_t offset, int inhrom, int inhram, int be) override; + +private: + required_region_ptr m_rom; }; // device type definition -DECLARE_DEVICE_TYPE(TANBUS_RA32K, tanbus_ra32k_device) +DECLARE_DEVICE_TYPE(TANBUS_RA32KRAM, tanbus_ra32kram_device) +DECLARE_DEVICE_TYPE(TANBUS_RA32KROM, tanbus_ra32krom_device) #endif // MAME_BUS_TANBUS_RA32K_H diff --git a/src/devices/bus/tanbus/radisc.cpp b/src/devices/bus/tanbus/radisc.cpp index b302e33c80d..36266d15c65 100644 --- a/src/devices/bus/tanbus/radisc.cpp +++ b/src/devices/bus/tanbus/radisc.cpp @@ -11,6 +11,8 @@ #include "emu.h" #include "radisc.h" +#include "formats/acorn_dsk.h" +#include "formats/flex_dsk.h" #include "speaker.h" @@ -31,24 +33,30 @@ static void tandos_floppies(device_slot_interface &device) device.option_add("525qd", FLOPPY_525_QD); } +void tanbus_radisc_device::floppy_formats(format_registration &fr) +{ + fr.add_mfm_containers(); + fr.add(FLOPPY_FLEX_FORMAT); + fr.add(FLOPPY_ACORN_SSD_FORMAT); +} + //------------------------------------------------- // device_add_mconfig - add device configuration //------------------------------------------------- void tanbus_radisc_device::device_add_mconfig(machine_config &config) { - INPUT_MERGER_ANY_HIGH(config, m_irq_line).output_handler().set(FUNC(tanbus_radisc_device::fdc_irq_w)); + INPUT_MERGER_ANY_HIGH(config, m_irq_line).output_handler().set(FUNC(tanbus_radisc_device::irq_w)); FD1793(config, m_fdc, 4_MHz_XTAL / 4); - m_fdc->intrq_wr_callback().set(m_irq_line, FUNC(input_merger_device::in_w)); + m_fdc->intrq_wr_callback().set(FUNC(tanbus_radisc_device::fdc_irq_w)); m_fdc->drq_wr_callback().set(FUNC(tanbus_radisc_device::fdc_drq_w)); - m_fdc->hld_wr_callback().set(FUNC(tanbus_radisc_device::fdc_hld_w)); m_fdc->set_force_ready(true); - FLOPPY_CONNECTOR(config, m_floppies[0], tandos_floppies, "525qd", floppy_image_device::default_mfm_floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppies[1], tandos_floppies, "525qd", floppy_image_device::default_mfm_floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppies[2], tandos_floppies, nullptr, floppy_image_device::default_mfm_floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppies[3], tandos_floppies, nullptr, floppy_image_device::default_mfm_floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppies[0], tandos_floppies, "525qd", tanbus_radisc_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppies[1], tandos_floppies, "525qd", tanbus_radisc_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppies[2], tandos_floppies, nullptr, tanbus_radisc_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppies[3], tandos_floppies, nullptr, tanbus_radisc_device::floppy_formats).enable_sound(true); MC146818(config, m_rtc, 32.768_kHz_XTAL); m_rtc->irq().set(m_irq_line, FUNC(input_merger_device::in_w)); @@ -56,7 +64,6 @@ void tanbus_radisc_device::device_add_mconfig(machine_config &config) MOS6522(config, m_via, 4_MHz_XTAL / 4); m_via->irq_handler().set(m_irq_line, FUNC(input_merger_device::in_w)); - /* audio hardware */ SPEAKER(config, "mono").front_center(); BEEP(config, m_beeper, 1000); // TODO: unknown frequency m_beeper->add_route(ALL_OUTPUTS, "mono", 1.0); @@ -75,13 +82,14 @@ tanbus_radisc_device::tanbus_radisc_device(const machine_config &mconfig, const , device_tanbus_interface(mconfig, *this) , m_fdc(*this, "fdc") , m_floppies(*this, "fdc:%u", 0) - , m_floppy(nullptr) , m_rtc(*this, "rtc") , m_via(*this, "via") , m_irq_line(*this, "irq_line") , m_beeper(*this, "beeper") , m_beeper_state(0) - , m_drive_control(0) + , m_status(0) + , m_irq_enable(0) + , m_drq_enable(0) { } @@ -94,14 +102,6 @@ void tanbus_radisc_device::device_start() { } -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void tanbus_radisc_device::device_reset() -{ -} - //------------------------------------------------- // read - card read //------------------------------------------------- @@ -119,7 +119,7 @@ uint8_t tanbus_radisc_device::read(offs_t offset, int inhrom, int inhram, int be data = m_fdc->read(offset & 0x03); break; case 0xbf94: - data = control_r(); + data = status_r(); break; case 0xbf98: case 0xbf99: data = m_rtc->read(offset & 0x01); @@ -160,39 +160,38 @@ void tanbus_radisc_device::write(offs_t offset, uint8_t data, int inhrom, int in // IMPLEMENTATION //************************************************************************** -void tanbus_radisc_device::control_w(uint8_t val) +void tanbus_radisc_device::control_w(uint8_t data) { - logerror("control_w %02x\n", val); - m_drive_control = val; + m_status = data & 0x3e; // bit 0: irq enable - m_irq_enable = BIT(val, 0); + m_irq_enable = BIT(data, 0); // bit 1: data select (data stream controller) // bit 2, 3: drive select - m_floppy = m_floppies[(val >> 2) & 0x03]->get_device(); - m_fdc->set_floppy(m_floppy); + floppy_image_device *floppy = m_floppies[BIT(data, 2, 2)]->get_device(); + m_fdc->set_floppy(floppy); // bit 4: side select - if (m_floppy) - m_floppy->ss_w(BIT(val, 4)); + if (floppy) + floppy->ss_w(BIT(data, 4)); // bit 5: density - m_fdc->dden_w(BIT(val, 5)); + m_fdc->dden_w(BIT(data, 5)); - // bit 6: head load - if (m_floppy) - m_floppy->mon_w(BIT(val, 6)); + // bit 6: head load timing + m_fdc->hlt_w(BIT(data, 6)); + if (floppy) + floppy->mon_w(!BIT(data, 6)); // bit 7: drq enable - m_drq_enable = BIT(val, 7); + m_drq_enable = BIT(data, 7); } -uint8_t tanbus_radisc_device::control_r() +uint8_t tanbus_radisc_device::status_r() { - logerror("control_r %02x\n", m_drive_control); - return m_drive_control; + return m_status | (m_fdc->drq_r() << 7) | (m_fdc->hld_r() << 6) | (m_fdc->intrq_r() << 0); } WRITE_LINE_MEMBER(tanbus_radisc_device::fdc_drq_w) @@ -202,12 +201,10 @@ WRITE_LINE_MEMBER(tanbus_radisc_device::fdc_drq_w) WRITE_LINE_MEMBER(tanbus_radisc_device::fdc_irq_w) { - m_tanbus->irq_w((m_irq_enable && state) ? ASSERT_LINE : CLEAR_LINE); + m_irq_line->in_w((m_irq_enable && state) ? ASSERT_LINE : CLEAR_LINE); } -WRITE_LINE_MEMBER(tanbus_radisc_device::fdc_hld_w) +WRITE_LINE_MEMBER(tanbus_radisc_device::irq_w) { - logerror("fdc_hld_w %d\n", state); - if (m_floppy) - m_floppy->mon_w(state); + m_tanbus->irq_w(state ? ASSERT_LINE : CLEAR_LINE); } diff --git a/src/devices/bus/tanbus/radisc.h b/src/devices/bus/tanbus/radisc.h index bbcfc2298ac..8e9445eac19 100644 --- a/src/devices/bus/tanbus/radisc.h +++ b/src/devices/bus/tanbus/radisc.h @@ -13,22 +13,22 @@ #pragma once #include "bus/tanbus/tanbus.h" -#include "imagedev/floppy.h" #include "machine/wd_fdc.h" #include "machine/mc146818.h" #include "machine/6522via.h" #include "machine/input_merger.h" #include "sound/beep.h" +#include "imagedev/floppy.h" //************************************************************************** // TYPE DEFINITIONS //************************************************************************** -class tanbus_radisc_device : - public device_t, - public device_tanbus_interface +class tanbus_radisc_device : public device_t, public device_tanbus_interface { public: + static constexpr feature_type imperfect_features() { return feature::DISK; } + // construction/destruction tanbus_radisc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); @@ -37,7 +37,6 @@ public: protected: // device-level overrides virtual void device_start() override; - virtual void device_reset() override; // optional information overrides virtual void device_add_mconfig(machine_config &config) override; @@ -48,22 +47,21 @@ protected: private: enum { IRQ_FDC, IRQ_VIA, IRQ_RTC }; - void control_w(uint8_t val); - uint8_t control_r(); + void control_w(uint8_t data); + uint8_t status_r(); DECLARE_WRITE_LINE_MEMBER(fdc_irq_w); DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); - DECLARE_WRITE_LINE_MEMBER(fdc_hld_w); + DECLARE_WRITE_LINE_MEMBER(irq_w); required_device m_fdc; required_device_array m_floppies; - floppy_image_device *m_floppy; required_device m_rtc; required_device m_via; required_device m_irq_line; required_device m_beeper; int m_beeper_state; - uint8_t m_drive_control; + uint8_t m_status; int m_irq_enable; int m_drq_enable; }; diff --git a/src/devices/bus/tanbus/tanbus.cpp b/src/devices/bus/tanbus/tanbus.cpp index b84d625c80f..b17199e73c5 100644 --- a/src/devices/bus/tanbus/tanbus.cpp +++ b/src/devices/bus/tanbus/tanbus.cpp @@ -104,9 +104,6 @@ void tanbus_device::device_reset() void tanbus_device::set_inhibit_lines(offs_t offset) { - // prevent debugger from changing inhibit lines - if (machine().side_effects_disabled()) return; - // reset inhibit lines m_inhram = m_inhrom = 0; @@ -134,7 +131,7 @@ uint8_t tanbus_device::read(offs_t offset) while (card) { // set block enable line for current card - if ((card->m_page == 0) || ((m_block_register >> 4) & 7) == card->m_page) + if (BIT(m_block_register, 4, 3) == card->m_page) m_block_enable = 1; else m_block_enable = 0; @@ -155,7 +152,7 @@ void tanbus_device::write(offs_t offset, uint8_t data) { if (offset == 0xffff) { - logerror("write: Memory management control (read %d, write %d)\n", (data >> 4) & 7, data & 7); + logerror("write: Memory management control %02x (read %d, write %d)\n", data, BIT(data, 4, 3), BIT(data, 0, 3)); m_block_register = data; } else if (offset >= 0xf800) @@ -170,7 +167,7 @@ void tanbus_device::write(offs_t offset, uint8_t data) while (card) { // set block enable line for current card - if ((card->m_page == 0) || (m_block_register & 7) == card->m_page) + if (BIT(m_block_register, 0,3) == card->m_page) m_block_enable = 1; else m_block_enable = 0; @@ -204,16 +201,20 @@ device_tanbus_interface::device_tanbus_interface(const machine_config &mconfig, // slot devices #include "bullsnd.h" +#include "etirtc.h" +#include "etisnd.h" #include "mpvdu.h" #include "ra32k.h" #include "radisc.h" #include "ravdu.h" #include "tanram.h" +#include "tanrtc.h" #include "tandos.h" #include "tanex.h" #include "tanhrg.h" #include "tug64k.h" #include "tug8082.h" +#include "tugcombo.h" #include "tugpgm.h" void tanex_devices(device_slot_interface &device) @@ -224,19 +225,29 @@ void tanex_devices(device_slot_interface &device) void tanbus_devices(device_slot_interface &device) { device.option_add("bullsnd", TANBUS_BULLSND); + device.option_add("etirtc", TANBUS_ETIRTC); + device.option_add("etisnd", TANBUS_ETISND); + //device.option_add("intelgraph", TANBUS_INTELGRAPH); device.option_add("mpvdu", TANBUS_MPVDU); device.option_add("tanram", TANBUS_TANRAM); + device.option_add("tanrtc", TANBUS_TANRTC); device.option_add("tandos", TANBUS_TANDOS); device.option_add("tanhrg", TANBUS_TANHRG); device.option_add("tanhrgc", TANBUS_TANHRGC); device.option_add("tug64k", TANBUS_TUG64K); device.option_add("tug8082", TANBUS_TUG8082); + device.option_add("tugesc2716", TANBUS_TUGESC2716); + device.option_add("tugesc2732", TANBUS_TUGESC2732); + device.option_add("tugcombo2716", TANBUS_TUGCOMBO2716); + device.option_add("tugcombo2732", TANBUS_TUGCOMBO2732); + device.option_add("tugcombo6116", TANBUS_TUGCOMBO6116); device.option_add("tugpgm", TANBUS_TUGPGM); } void tanbus6809_devices(device_slot_interface &device) { - device.option_add("ra32k", TANBUS_RA32K); + device.option_add("ra32kram", TANBUS_RA32KRAM); + device.option_add("ra32krom", TANBUS_RA32KROM); device.option_add("radisc", TANBUS_RADISC); device.option_add("ravdu", TANBUS_RAVDU); device.option_add("tanram", TANBUS_TANRAM); diff --git a/src/devices/bus/tanbus/tandos.cpp b/src/devices/bus/tanbus/tandos.cpp index ae971913254..4ac5eaed684 100644 --- a/src/devices/bus/tanbus/tandos.cpp +++ b/src/devices/bus/tanbus/tandos.cpp @@ -59,6 +59,29 @@ void tanbus_tandos_device::device_add_mconfig(machine_config &config) FLOPPY_CONNECTOR(config, m_floppies[1], tandos_floppies, "525qd", floppy_image_device::default_mfm_floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, m_floppies[2], tandos_floppies, nullptr, floppy_image_device::default_mfm_floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, m_floppies[3], tandos_floppies, nullptr, floppy_image_device::default_mfm_floppy_formats).enable_sound(true); + + TMS9914(config, m_tms9914, 8_MHz_XTAL / 2); + m_tms9914->dio_read_cb().set(IEEE488_TAG, FUNC(ieee488_device::dio_r)); + m_tms9914->dio_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_dio_w)); + m_tms9914->eoi_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_eoi_w)); + m_tms9914->dav_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_dav_w)); + m_tms9914->nrfd_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_nrfd_w)); + m_tms9914->ndac_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_ndac_w)); + m_tms9914->ifc_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_ifc_w)); + m_tms9914->srq_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_srq_w)); + m_tms9914->atn_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_atn_w)); + m_tms9914->ren_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_ren_w)); + + IEEE488(config, m_ieee); + m_ieee->eoi_callback().set(m_tms9914, FUNC(tms9914_device::eoi_w)); + m_ieee->dav_callback().set(m_tms9914, FUNC(tms9914_device::dav_w)); + m_ieee->nrfd_callback().set(m_tms9914, FUNC(tms9914_device::nrfd_w)); + m_ieee->ndac_callback().set(m_tms9914, FUNC(tms9914_device::ndac_w)); + m_ieee->ifc_callback().set(m_tms9914, FUNC(tms9914_device::ifc_w)); + m_ieee->srq_callback().set(m_tms9914, FUNC(tms9914_device::srq_w)); + m_ieee->atn_callback().set(m_tms9914, FUNC(tms9914_device::atn_w)); + m_ieee->ren_callback().set(m_tms9914, FUNC(tms9914_device::ren_w)); + IEEE488_SLOT(config, "ieee_dev", 0, cbm_ieee488_devices, nullptr); } const tiny_rom_entry *tanbus_tandos_device::device_rom_region() const @@ -78,10 +101,12 @@ tanbus_tandos_device::tanbus_tandos_device(const machine_config &mconfig, const : device_t(mconfig, TANBUS_TANDOS, tag, owner, clock) , device_tanbus_interface(mconfig, *this) , m_dos_rom(*this, "dos_rom") + , m_ieee(*this, IEEE488_TAG) + , m_tms9914(*this, "hpib") , m_fdc(*this, "fdc") , m_floppies(*this, "fdc:%u", 0) , m_floppy(nullptr) - , m_drive_control(0) + , m_status(0) { } @@ -138,7 +163,7 @@ uint8_t tanbus_tandos_device::read(offs_t offset, int inhrom, int inhram, int be // GPIB PCB Switches break; case 0xbf98: case 0xbf99: case 0xbf9a: case 0xbf9b: case 0xbf9c: case 0xbf9d: case 0xbf9e: case 0xbf9f: - // GPIB (9914) + data = m_tms9914->read(offset & 0x07); break; } break; @@ -169,7 +194,7 @@ void tanbus_tandos_device::write(offs_t offset, uint8_t data, int inhrom, int in control_w(data); break; case 0xbf98: case 0xbf99: case 0xbf9a: case 0xbf9b: case 0xbf9c: case 0xbf9d: case 0xbf9e: case 0xbf9f: - // GPIB (9914) + m_tms9914->write(offset & 0x07, data); break; } break; @@ -195,8 +220,7 @@ void tanbus_tandos_device::set_inhibit_lines(offs_t offset, int &inhram, int &in void tanbus_tandos_device::control_w(uint8_t data) { - logerror("control_w %02x\n", data); - m_drive_control = data; + m_status = data & 0x3e; // bit 0: irq enable m_irq_enable = BIT(data, 0); @@ -204,7 +228,7 @@ void tanbus_tandos_device::control_w(uint8_t data) // bit 1: data select (data stream controller) // bit 2, 3: drive select - m_floppy = m_floppies[(data >> 2) & 0x03]->get_device(); + m_floppy = m_floppies[BIT(data, 2, 2)]->get_device(); m_fdc->set_floppy(m_floppy); // bit 4: side select @@ -225,14 +249,7 @@ void tanbus_tandos_device::control_w(uint8_t data) uint8_t tanbus_tandos_device::status_r() { - uint8_t data = 0x00; - - data |= m_drive_control & 0x3c; - data |= m_fdc->intrq_r() << 0; - data |= m_fdc->hld_r() << 6; - data |= m_fdc->drq_r() << 7; - - return data; + return m_status | (m_fdc->drq_r() << 7) | (m_fdc->hld_r() << 6) | (m_fdc->intrq_r() << 0); } @@ -248,7 +265,6 @@ WRITE_LINE_MEMBER(tanbus_tandos_device::fdc_irq_w) WRITE_LINE_MEMBER(tanbus_tandos_device::fdc_hld_w) { - logerror("fdc_hld_w %d\n", state); if (m_floppy) m_floppy->mon_w(state); } diff --git a/src/devices/bus/tanbus/tandos.h b/src/devices/bus/tanbus/tandos.h index 60a157809f8..a95a87f6215 100644 --- a/src/devices/bus/tanbus/tandos.h +++ b/src/devices/bus/tanbus/tandos.h @@ -12,17 +12,17 @@ #pragma once -#include "bus/tanbus/tanbus.h" -#include "imagedev/floppy.h" +#include "tanbus.h" #include "machine/wd_fdc.h" +#include "machine/tms9914.h" +#include "bus/ieee488/ieee488.h" +#include "imagedev/floppy.h" //************************************************************************** // TYPE DEFINITIONS //************************************************************************** -class tanbus_tandos_device : - public device_t, - public device_tanbus_interface +class tanbus_tandos_device : public device_t, public device_tanbus_interface { public: static constexpr feature_type imperfect_features() { return feature::DISK; } @@ -46,18 +46,20 @@ protected: virtual void set_inhibit_lines(offs_t offset, int &inhram, int &inhrom) override; private: - void control_w(uint8_t val); + void control_w(uint8_t data); uint8_t status_r(); DECLARE_WRITE_LINE_MEMBER(fdc_irq_w); DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); DECLARE_WRITE_LINE_MEMBER(fdc_hld_w); required_memory_region m_dos_rom; + required_device m_ieee; + required_device m_tms9914; required_device m_fdc; required_device_array m_floppies; floppy_image_device *m_floppy; - uint8_t m_drive_control; + uint8_t m_status; int m_irq_enable; int m_drq_enable; diff --git a/src/devices/bus/tanbus/tanram.cpp b/src/devices/bus/tanbus/tanram.cpp index 0e3dadf9d15..253c05f4f24 100644 --- a/src/devices/bus/tanbus/tanram.cpp +++ b/src/devices/bus/tanbus/tanram.cpp @@ -55,17 +55,11 @@ uint8_t tanbus_tanram_device::read(offs_t offset, int inhrom, int inhram, int be if (be && !inhram) { - /* 32K dynamic ram */ - if ((offset >= 0x2000) && (offset < 0xa000)) + /* 32K dynamic ram + 7K static ram */ + if ((offset >= 0x2000) && (offset < 0xbc00)) { data = m_ram[offset - 0x2000]; } - - /* 7K static ram */ - if ((offset >= 0xa000) && (offset < 0xbc00)) - { - data = m_ram[offset - 0xa000]; - } } return data; } @@ -78,16 +72,10 @@ void tanbus_tanram_device::write(offs_t offset, uint8_t data, int inhrom, int in { if (be && !inhram) { - /* 32K dynamic ram */ - if ((offset >= 0x2000) && (offset < 0xa000)) + /* 32K dynamic ram + 7K static ram */ + if ((offset >= 0x2000) && (offset < 0xbc00)) { m_ram[offset - 0x2000] = data; } - - /* 7K static ram */ - if ((offset >= 0xa000) && (offset < 0xbc00)) - { - m_ram[offset - 0xa000] = data; - } } } diff --git a/src/devices/bus/tanbus/tanrtc.cpp b/src/devices/bus/tanbus/tanrtc.cpp new file mode 100644 index 00000000000..5583ac79c4d --- /dev/null +++ b/src/devices/bus/tanbus/tanrtc.cpp @@ -0,0 +1,86 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Microtanic Real Time Clock + +**********************************************************************/ + + +#include "emu.h" +#include "tanrtc.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(TANBUS_TANRTC, tanbus_tanrtc_device, "tanbus_tanrtc", "Microtanic Real Time Clock") + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void tanbus_tanrtc_device::device_add_mconfig(machine_config &config) +{ + MC146818(config, m_rtc, 32.768_kHz_XTAL); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// tanbus_tanrtc_device - constructor +//------------------------------------------------- + +tanbus_tanrtc_device::tanbus_tanrtc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, TANBUS_TANRTC, tag, owner, clock) + , device_tanbus_interface(mconfig, *this) + , m_rtc(*this, "rtc") +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tanbus_tanrtc_device::device_start() +{ +} + + +//------------------------------------------------- +// read - card read +//------------------------------------------------- + +uint8_t tanbus_tanrtc_device::read(offs_t offset, int inhrom, int inhram, int be) +{ + uint8_t data = 0xff; + + switch (offset & 0xffc0) + { + case 0xbc00: + data = m_rtc->read_direct(offset); + break; + } + + return data; +} + + +//------------------------------------------------- +// write - card write +//------------------------------------------------- + +void tanbus_tanrtc_device::write(offs_t offset, uint8_t data, int inhrom, int inhram, int be) +{ + switch (offset & 0xffc0) + { + case 0xbc00: + m_rtc->write_direct(offset, data); + break; + } +} diff --git a/src/devices/bus/tanbus/tanrtc.h b/src/devices/bus/tanbus/tanrtc.h new file mode 100644 index 00000000000..737abf10528 --- /dev/null +++ b/src/devices/bus/tanbus/tanrtc.h @@ -0,0 +1,47 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + Microtanic Real Time Clock + +**********************************************************************/ + + +#ifndef MAME_BUS_TANBUS_TANRTC_H +#define MAME_BUS_TANBUS_TANRTC_H + +#pragma once + +#include "tanbus.h" +#include "machine/mc146818.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class tanbus_tanrtc_device : public device_t, public device_tanbus_interface +{ +public: + // construction/destruction + tanbus_tanrtc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + + virtual uint8_t read(offs_t offset, int inhrom, int inhram, int be) override; + virtual void write(offs_t offset, uint8_t data, int inhrom, int inhram, int be) override; + +private: + required_device m_rtc; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(TANBUS_TANRTC, tanbus_tanrtc_device) + + +#endif // MAME_BUS_TANBUS_TANRTC_H diff --git a/src/devices/bus/tanbus/tugcombo.cpp b/src/devices/bus/tanbus/tugcombo.cpp new file mode 100644 index 00000000000..2c652a45f55 --- /dev/null +++ b/src/devices/bus/tanbus/tugcombo.cpp @@ -0,0 +1,270 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + TUG Combo Card / TUG EPROM Storage Card + + http://www.microtan.ukpc.net/pageProducts.html#ROM + + Usage: + G EFFC + +**********************************************************************/ + + +#include "emu.h" +#include "tugcombo.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(TANBUS_TUGCOMBO2716, tanbus_tugcombo2716_device, "tanbus_tugcombo2716", "TUG Combo Card (2716)") +DEFINE_DEVICE_TYPE(TANBUS_TUGCOMBO2732, tanbus_tugcombo2732_device, "tanbus_tugcombo2732", "TUG Combo Card (2732)") +DEFINE_DEVICE_TYPE(TANBUS_TUGCOMBO6116, tanbus_tugcombo6116_device, "tanbus_tugcombo6116", "TUG Combo Card (6116)") +DEFINE_DEVICE_TYPE(TANBUS_TUGESC2716, tanbus_tugesc2716_device, "tanbus_tugesc2716", "TUG EPROM Storage Card (2716)") +DEFINE_DEVICE_TYPE(TANBUS_TUGESC2732, tanbus_tugesc2732_device, "tanbus_tugesc2732", "TUG EPROM Storage Card (2732)") + + +//------------------------------------------------- +// INPUT_PORTS( tugcombo ) +//------------------------------------------------- + +INPUT_PORTS_START(tugcombo) + PORT_START("LINKS") + PORT_DIPNAME(0x88, 0x00, "I/O Address") + PORT_DIPSETTING(0x00, "$BD00 - $BD07") + PORT_DIPSETTING(0x08, "$BD08 - $BD0F") + PORT_DIPSETTING(0x80, "$BD80 - $BD87") + PORT_DIPSETTING(0x88, "$BD88 - $BD8F") +INPUT_PORTS_END + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor tanbus_tugcombo_device::device_input_ports() const +{ + return INPUT_PORTS_NAME(tugcombo); +} + + +void tanbus_tugcombo2716_device::mem_map(address_map &map) +{ + map(0x0000, 0x07ff).mirror(0x8000).r(m_rom[0], FUNC(generic_slot_device::read_rom)); + map(0x0800, 0x0fff).mirror(0x8000).r(m_rom[1], FUNC(generic_slot_device::read_rom)); + map(0x1000, 0x17ff).mirror(0x8000).r(m_rom[2], FUNC(generic_slot_device::read_rom)); + map(0x1800, 0x1fff).mirror(0x8000).r(m_rom[3], FUNC(generic_slot_device::read_rom)); + map(0x2000, 0x27ff).mirror(0x8000).r(m_rom[4], FUNC(generic_slot_device::read_rom)); + map(0x2800, 0x2fff).mirror(0x8000).r(m_rom[5], FUNC(generic_slot_device::read_rom)); + map(0x3000, 0x37ff).mirror(0x8000).r(m_rom[6], FUNC(generic_slot_device::read_rom)); + map(0x3800, 0x3fff).mirror(0x8000).r(m_rom[7], FUNC(generic_slot_device::read_rom)); + map(0x4000, 0x47ff).mirror(0x8000).r(m_rom[8], FUNC(generic_slot_device::read_rom)); + map(0x4800, 0x4fff).mirror(0x8000).r(m_rom[9], FUNC(generic_slot_device::read_rom)); + map(0x5000, 0x57ff).mirror(0x8000).r(m_rom[10], FUNC(generic_slot_device::read_rom)); + map(0x5800, 0x5fff).mirror(0x8000).r(m_rom[11], FUNC(generic_slot_device::read_rom)); + map(0x6000, 0x67ff).mirror(0x8000).r(m_rom[12], FUNC(generic_slot_device::read_rom)); + map(0x6800, 0x6fff).mirror(0x8000).r(m_rom[13], FUNC(generic_slot_device::read_rom)); + map(0x7000, 0x77ff).mirror(0x8000).r(m_rom[14], FUNC(generic_slot_device::read_rom)); + map(0x7800, 0x7fff).mirror(0x8000).r(m_rom[15], FUNC(generic_slot_device::read_rom)); +} + +void tanbus_tugcombo2732_device::mem_map(address_map &map) +{ + map(0x0000, 0x0fff).r(m_rom[0], FUNC(generic_slot_device::read_rom)); + map(0x1000, 0x1fff).r(m_rom[1], FUNC(generic_slot_device::read_rom)); + map(0x2000, 0x2fff).r(m_rom[2], FUNC(generic_slot_device::read_rom)); + map(0x3000, 0x3fff).r(m_rom[3], FUNC(generic_slot_device::read_rom)); + map(0x4000, 0x4fff).r(m_rom[4], FUNC(generic_slot_device::read_rom)); + map(0x5000, 0x5fff).r(m_rom[5], FUNC(generic_slot_device::read_rom)); + map(0x6000, 0x6fff).r(m_rom[6], FUNC(generic_slot_device::read_rom)); + map(0x7000, 0x7fff).r(m_rom[7], FUNC(generic_slot_device::read_rom)); + map(0x8000, 0x8fff).r(m_rom[8], FUNC(generic_slot_device::read_rom)); + map(0x9000, 0x9fff).r(m_rom[9], FUNC(generic_slot_device::read_rom)); + map(0xa000, 0xafff).r(m_rom[10], FUNC(generic_slot_device::read_rom)); + map(0xb000, 0xbfff).r(m_rom[11], FUNC(generic_slot_device::read_rom)); + map(0xc000, 0xcfff).r(m_rom[12], FUNC(generic_slot_device::read_rom)); + map(0xd000, 0xdfff).r(m_rom[13], FUNC(generic_slot_device::read_rom)); + map(0xe000, 0xefff).r(m_rom[14], FUNC(generic_slot_device::read_rom)); + map(0xf000, 0xffff).r(m_rom[15], FUNC(generic_slot_device::read_rom)); +} + +void tanbus_tugcombo6116_device::mem_map(address_map &map) +{ + map(0x0000, 0x7fff).mirror(0x8000).ram().share("nvram"); +} + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +void tanbus_tugcombo_device::device_add_mconfig(machine_config &config) +{ + PIA6821(config, m_pia[0]); + m_pia[0]->writepa_handler().set([this](uint8_t data) { m_addr = (m_addr & 0xff00) | data; }); + m_pia[0]->writepb_handler().set([this](uint8_t data) { m_addr = (m_addr & 0x00ff) | (data << 8); }); + + PIA6821(config, m_pia[1]); + m_pia[1]->readpb_handler().set([this]() { return m_space->read_byte(m_addr); }); + m_pia[1]->writepb_handler().set([this](uint8_t data) { m_space->write_byte(m_addr, data); }); +} + +void tanbus_tugcombo2716_device::device_add_mconfig(machine_config &config) +{ + tanbus_tugcombo_device::device_add_mconfig(config); + + for (int i = 0; i < 16; i++) + GENERIC_SOCKET(config, m_rom[i], generic_linear_slot, "rom_esc2716", "bin,rom"); +} + +void tanbus_tugcombo2732_device::device_add_mconfig(machine_config &config) +{ + tanbus_tugcombo_device::device_add_mconfig(config); + + for (int i = 0; i < 16; i++) + GENERIC_SOCKET(config, m_rom[i], generic_linear_slot, "rom_esc2732", "bin,rom"); +} + +void tanbus_tugcombo6116_device::device_add_mconfig(machine_config &config) +{ + tanbus_tugcombo_device::device_add_mconfig(config); + + NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// tanbus_tugcombo_device - constructor +//------------------------------------------------- + +tanbus_tugcombo_device::tanbus_tugcombo_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, type, tag, owner, clock) + , device_memory_interface(mconfig, *this) + , device_tanbus_interface(mconfig, *this) + , m_space(nullptr) + , m_links(*this, "LINKS") + , m_pia(*this, "pia%u", 0) + , m_addr(0) +{ +} + + +tanbus_tugcombo2716_device::tanbus_tugcombo2716_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : tanbus_tugcombo_device(mconfig, type, tag, owner, clock) + , m_rom(*this, "rom%u", 0) +{ + m_space_config = address_space_config("memory", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(tanbus_tugcombo2716_device::mem_map), this)); +} + +tanbus_tugcombo2716_device::tanbus_tugcombo2716_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : tanbus_tugcombo2716_device(mconfig, TANBUS_TUGCOMBO2716, tag, owner, clock) +{ +} + +tanbus_tugesc2716_device::tanbus_tugesc2716_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : tanbus_tugcombo2716_device(mconfig, TANBUS_TUGESC2716, tag, owner, clock) +{ +} + + +tanbus_tugcombo2732_device::tanbus_tugcombo2732_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : tanbus_tugcombo_device(mconfig, type, tag, owner, clock) + , m_rom(*this, "rom%u", 0) +{ + m_space_config = address_space_config("memory", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(tanbus_tugcombo2732_device::mem_map), this)); +} + +tanbus_tugcombo2732_device::tanbus_tugcombo2732_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : tanbus_tugcombo2732_device(mconfig, TANBUS_TUGCOMBO2732, tag, owner, clock) +{ +} + +tanbus_tugesc2732_device::tanbus_tugesc2732_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : tanbus_tugcombo2732_device(mconfig, TANBUS_TUGESC2732, tag, owner, clock) +{ +} + + +tanbus_tugcombo6116_device::tanbus_tugcombo6116_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) + : tanbus_tugcombo_device(mconfig, type, tag, owner, clock) +{ +} + +tanbus_tugcombo6116_device::tanbus_tugcombo6116_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : tanbus_tugcombo6116_device(mconfig, TANBUS_TUGCOMBO6116, tag, owner, clock) +{ + m_space_config = address_space_config("memory", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(tanbus_tugcombo6116_device::mem_map), this)); +} + + +device_memory_interface::space_config_vector tanbus_tugcombo_device::memory_space_config() const +{ + return space_config_vector{ std::make_pair(0, &m_space_config) }; +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void tanbus_tugcombo_device::device_start() +{ + m_space = &space(0); + + save_item(NAME(m_addr)); +} + + +//------------------------------------------------- +// read - card read +//------------------------------------------------- + +uint8_t tanbus_tugcombo_device::read(offs_t offset, int inhrom, int inhram, int be) +{ + uint8_t data = 0xff; + + offs_t addr = 0xbd00 | m_links->read(); + + if (addr == (offset & 0xfff8)) + { + switch (offset & 0x04) + { + case 0x00: + data = m_pia[0]->read(offset & 3); + break; + case 0x04: + data = m_pia[1]->read(offset & 3); + break; + } + } + + return data; +} + +//------------------------------------------------- +// write - card write +//------------------------------------------------- + +void tanbus_tugcombo_device::write(offs_t offset, uint8_t data, int inhrom, int inhram, int be) +{ + offs_t addr = 0xbd00 | m_links->read(); + + if (addr == (offset & 0xfff8)) + { + switch (offset & 0x04) + { + case 0x00: + m_pia[0]->write(offset & 3, data); + break; + case 0x04: + m_pia[1]->write(offset & 3, data); + break; + } + } +} diff --git a/src/devices/bus/tanbus/tugcombo.h b/src/devices/bus/tanbus/tugcombo.h new file mode 100644 index 00000000000..66dcfc9e90e --- /dev/null +++ b/src/devices/bus/tanbus/tugcombo.h @@ -0,0 +1,142 @@ +// license:BSD-3-Clause +// copyright-holders:Nigel Barnes +/********************************************************************** + + TUG Combo Card / TUG EPROM Storage Card + +**********************************************************************/ + + +#ifndef MAME_BUS_TANBUS_TUGCOMBO_H +#define MAME_BUS_TANBUS_TUGCOMBO_H + +#pragma once + +#include "tanbus.h" +#include "machine/6821pia.h" +#include "machine/nvram.h" +#include "bus/generic/slot.h" +#include "bus/generic/carts.h" + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class tanbus_tugcombo_device + : public device_t + , public device_memory_interface + , public device_tanbus_interface +{ +protected: + tanbus_tugcombo_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + // device-level overrides + virtual void device_start() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual ioport_constructor device_input_ports() const override; + + // device_memory_interface overrides + virtual space_config_vector memory_space_config() const override; + + virtual uint8_t read(offs_t offset, int inhrom, int inhram, int be) override; + virtual void write(offs_t offset, uint8_t data, int inhrom, int inhram, int be) override; + + address_space_config m_space_config; + address_space *m_space; + +private: + required_ioport m_links; + required_device_array m_pia; + + uint16_t m_addr; +}; + + +// ======================> tanbus_tugcombo2716_device + +class tanbus_tugcombo2716_device : public tanbus_tugcombo_device +{ +public: + tanbus_tugcombo2716_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + tanbus_tugcombo2716_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + +private: + required_device_array m_rom; + + void mem_map(address_map &map); +}; + + +// ======================> tanbus_tugcombo2732_device + +class tanbus_tugcombo2732_device : public tanbus_tugcombo_device +{ +public: + tanbus_tugcombo2732_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + tanbus_tugcombo2732_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + +private: + required_device_array m_rom; + + void mem_map(address_map &map); +}; + + +// ======================> tanbus_tugcombo6116_device + +class tanbus_tugcombo6116_device : public tanbus_tugcombo_device +{ +public: + tanbus_tugcombo6116_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + tanbus_tugcombo6116_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + +private: + void mem_map(address_map &map); +}; + + +// ======================> tanbus_tugesc2716_device + +class tanbus_tugesc2716_device : public tanbus_tugcombo2716_device +{ +public: + tanbus_tugesc2716_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + + +// ======================> tanbus_tugesc2732_device + +class tanbus_tugesc2732_device : public tanbus_tugcombo2732_device +{ +public: + tanbus_tugesc2732_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + + +// device type definition +DECLARE_DEVICE_TYPE(TANBUS_TUGCOMBO2716, tanbus_tugcombo2716_device) +DECLARE_DEVICE_TYPE(TANBUS_TUGCOMBO2732, tanbus_tugcombo2732_device) +DECLARE_DEVICE_TYPE(TANBUS_TUGCOMBO6116, tanbus_tugcombo6116_device) +DECLARE_DEVICE_TYPE(TANBUS_TUGESC2716, tanbus_tugesc2716_device) +DECLARE_DEVICE_TYPE(TANBUS_TUGESC2732, tanbus_tugesc2732_device) + + +#endif // MAME_BUS_TANBUS_TUGCOMBO_H diff --git a/src/mame/tangerine/microtan.cpp b/src/mame/tangerine/microtan.cpp index 7577f2037a3..98bc24ee002 100644 --- a/src/mame/tangerine/microtan.cpp +++ b/src/mame/tangerine/microtan.cpp @@ -3,10 +3,6 @@ /****************************************************************************** * Microtan 65 * - * system driver - * - * Juergen Buchmueller , Jul 2000 - * * Thanks go to Geoff Macdonald * for his site http://www.geoff.org.uk/microtan/index.htm * and to Fabrice Frances @@ -49,11 +45,32 @@ * BAS Start BASIC * WAR Re-enter BASIC (warm start) * - * The keyboard is essentially an ordinary ASCII keyboard, with 71 keys, 8 - * TTL chips and an undumped 2716 eprom labelled MON V1. We currently use a - * generic keyboard because of the lack of a schematic. Unemulated keys are - * 'SHIFT LOCK' and 'REPT'. Since all commands must be uppercase, capslock - * is defaulted to on. + * Ralbug commnds: + * COP Copy + * MEM Modify memory + * SYW Warm start to DOS system + * SYC Cold start to DOS system + * SYB Boot DOS system + * LIS List a line of memory + * JMP Go to address that follows + * JSR JSR to following address + * JMI Jump indirect + * JSI JSR indirect + * TES Memory test + * CLR Clear screen + * COL Colour change + * HEL Help display menu + * VEC List vector jump table + * FIL Fill Memory + * CUR Cursor move + * ASC ASCII table display + * SYN Command syntax + * HOM Home cursor + * WAR Warm start $0003 + * STA Start $0000 + * EXP Expand monitor + * BLE Keyboard bleep + * KIL Kill off the cache * *****************************************************************************/ @@ -72,7 +89,7 @@ void microtan_state::mt65_map(address_map &map) map(0x0000, 0x01ff).ram(); map(0x0200, 0x03ff).ram().w(FUNC(microtan_state::videoram_w)).share(m_videoram); map(0xbff0, 0xbfff).rw(FUNC(microtan_state::bffx_r), FUNC(microtan_state::bffx_w)); - map(0xf800, 0xffff).rom(); + map(0xf800, 0xffff).rom().region("maincpu", 0); } void microtan_state::spinv_map(address_map &map) @@ -80,181 +97,39 @@ void microtan_state::spinv_map(address_map &map) map.unmap_value_high(); map(0x0000, 0x01ff).ram(); map(0x0200, 0x03ff).ram().w(FUNC(microtan_state::videoram_w)).share(m_videoram); - map(0xbc04, 0xbc04).rw(FUNC(microtan_state::sound_r), FUNC(microtan_state::sound_w)); map(0xbff0, 0xbfff).rw(FUNC(microtan_state::bffx_r), FUNC(microtan_state::bffx_w)); - map(0xe800, 0xefff).rom().mirror(0x1000); + map(0xf800, 0xffff).rom().region("maincpu", 0); } void mt6809_state::mt6809_map(address_map &map) { map(0x0000, 0xffff).rw(m_tanbus, FUNC(tanbus_device::read), FUNC(tanbus_device::write)); - map(0xdc00, 0xdfff).ram(); - map(0xdfd8, 0xdfd8).r(FUNC(mt6809_state::keyboard_r)); - map(0xf800, 0xffff).rom(); + map(0x0000, 0x03ff).ram(); + map(0xbff0, 0xbfff).rw(FUNC(mt6809_state::bffx_r), FUNC(mt6809_state::bffx_w)); + map(0xf800, 0xffff).rom().region("maincpu", 0); } -INPUT_CHANGED_MEMBER(microtan_state::trigger_reset) +WRITE_LINE_MEMBER(microtan_state::trigger_reset) { - m_maincpu->set_input_line(INPUT_LINE_RESET, newval ? ASSERT_LINE : CLEAR_LINE); + m_maincpu->set_input_line(INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE); - if (newval) + if (state) + { + machine().schedule_soft_reset(); + } +} + +WRITE_LINE_MEMBER(mt6809_state::trigger_reset) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, state ? ASSERT_LINE : CLEAR_LINE); + + if (state) { machine().schedule_soft_reset(); } } -static INPUT_PORTS_START( microtan ) - PORT_START("CONFIG") - PORT_CONFNAME(0x03, 0x00, "Input") - PORT_CONFSETTING(0x00, "ASCII Keyboard") - PORT_CONFSETTING(0x01, "Hex Keypad") - - PORT_START("KBD0") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 !") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('"') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 #") PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 &") PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 \'") PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR(39) - - PORT_START("KBD1") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR('~') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(": *") PORT_CODE(KEYCODE_MINUS) PORT_CHAR(':') PORT_CHAR('*') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- =") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('-') PORT_CHAR('=') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("NEW PAGE") PORT_CODE(KEYCODE_TILDE) PORT_CHAR(12) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RUB OUT") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_TAB) PORT_CHAR('^') PORT_CHAR('_') - - PORT_START("KBD2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_CHAR('q') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('W') PORT_CHAR('w') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E') PORT_CHAR('e') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i') - - PORT_START("KBD3") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[ {") PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("] }") PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR(']') PORT_CHAR('}') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("BREAK") PORT_CODE(KEYCODE_DEL) PORT_CHAR(3) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("CTRL") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ALFA LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE - - PORT_START("KBD4") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A') PORT_CHAR('a') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('S') PORT_CHAR('s') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D') PORT_CHAR('d') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F') PORT_CHAR('f') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k') - - PORT_START("KBD5") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("; +") PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("@") PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('@') PORT_CHAR('`') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("\\ |") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR('\\') PORT_CHAR('|') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT (L)") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('Z') PORT_CHAR('z') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('X') PORT_CHAR('x') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') PORT_CHAR('c') - - PORT_START("KBD6") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v') - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b') - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n') - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m') - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", <") PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<') - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". >") PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>') - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/ ?") PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SHIFT (R)") PORT_CODE(KEYCODE_RSHIFT) - - PORT_START("KBD7") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CHAR(10) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(32) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("- (KP)") PORT_CODE(KEYCODE_MINUS_PAD) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(", (KP)") PORT_CODE(KEYCODE_PLUS_PAD) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("ENTER (KP)") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(". (KP)") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0 (KP)") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("1 (KP)") PORT_CODE(KEYCODE_1_PAD) - - PORT_START("KBD8") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("2 (KP)") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("3 (KP)") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("4 (KP)") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("5 (KP)") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("6 (KP)") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("7 (KP)") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("8 (KP)") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("9 (KP)") PORT_CODE(KEYCODE_9_PAD) - - PORT_START("KPAD0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("4") PORT_CODE(KEYCODE_4_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("8 P") PORT_CODE(KEYCODE_8_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("C M") PORT_CODE(KEYCODE_C) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("SHIFT") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KPAD1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("5 O") PORT_CODE(KEYCODE_5_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("9 ESC") PORT_CODE(KEYCODE_9_PAD) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("D G") PORT_CODE(KEYCODE_D) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("LF DEL") PORT_CODE(KEYCODE_DEL_PAD) - PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KPAD2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("6 C") PORT_CODE(KEYCODE_6_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("A") PORT_CODE(KEYCODE_A) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("E S") PORT_CODE(KEYCODE_E) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("CR SP") PORT_CODE(KEYCODE_ENTER_PAD) - PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("KPAD3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("3 '") PORT_CODE(KEYCODE_3_PAD) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("7 R") PORT_CODE(KEYCODE_7_PAD) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("B L") PORT_CODE(KEYCODE_B) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("F N") PORT_CODE(KEYCODE_F) - PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNUSED) - - PORT_START("BRK") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) PORT_CHANGED_MEMBER(DEVICE_SELF, microtan_state, trigger_reset, 0) -INPUT_PORTS_END - -static INPUT_PORTS_START( spinveti ) - PORT_START("CONFIG") - PORT_CONFNAME(0x03, 0x02, "Input") - PORT_CONFSETTING(0x02, "ETI Keypad") - PORT_CONFNAME(0x60, 0x20, "Difficulty") - PORT_CONFSETTING(0x00, "Easy") - PORT_CONFSETTING(0x20, "Normal") - PORT_CONFSETTING(0x40, "Hard") - PORT_CONFSETTING(0x60, "Hardest") - - PORT_START("KEYPAD") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Play") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Right") PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Left") PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Fire") PORT_CODE(KEYCODE_LCONTROL) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Hold") PORT_CODE(KEYCODE_H) - - PORT_START("BRK") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("Reset") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, microtan_state, trigger_reset, 0) -INPUT_PORTS_END static const gfx_layout char_layout = { @@ -279,10 +154,12 @@ void microtan_state::mt65(machine_config &config) M6502(config, m_maincpu, 6_MHz_XTAL / 8); m_maincpu->set_addrmap(AS_PROGRAM, µtan_state::mt65_map); - TIMER(config, "kbd_timer").configure_periodic(FUNC(microtan_state::kbd_scan), attotime::from_hz(45)); - INPUT_MERGER_ANY_HIGH(config, m_irq_line).output_handler().set_inputline(m_maincpu, M6502_IRQ_LINE); + MICROTAN_KBD_SLOT(config, m_keyboard, microtan_kbd_devices, "mt009"); + m_keyboard->strobe_handler().set(FUNC(microtan_state::kbd_int)); + m_keyboard->reset_handler().set(FUNC(microtan_state::trigger_reset)); + /* video hardware - include overscan */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_raw(6_MHz_XTAL, 384, 0, 32*8, 312, 0, 16*16); @@ -348,6 +225,10 @@ void microtan_state::spinveti(machine_config &config) INPUT_MERGER_ANY_HIGH(config, m_irq_line).output_handler().set_inputline(m_maincpu, M6502_IRQ_LINE); + MICROTAN_KBD_SLOT(config, m_keyboard, microtan_kbd_devices, "spinveti"); + m_keyboard->strobe_handler().set(FUNC(microtan_state::kbd_int)); + m_keyboard->reset_handler().set(FUNC(microtan_state::trigger_reset)); + /* video hardware - include overscan */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_raw(6_MHz_XTAL, 384, 0, 32*8, 312, 0, 16*16); @@ -357,59 +238,57 @@ void microtan_state::spinveti(machine_config &config) GFXDECODE(config, m_gfxdecode, "palette", gfx_microtan); PALETTE(config, "palette", palette_device::MONOCHROME); - - /* TODO: Sound hardware */ } static DEVICE_INPUT_DEFAULTS_START(ra32k_def_ram0000) /* 32K RAM configured 0x0000-0x7fff */ - DEVICE_INPUT_DEFAULTS("SW1", 0xff, 0xff) // all blocks enabled - DEVICE_INPUT_DEFAULTS("SW2", 0xff, 0xff) // all blocks enabled - DEVICE_INPUT_DEFAULTS("SW3", 0x0f, 0x0f) // start address $0000 - DEVICE_INPUT_DEFAULTS("LNK1", 0x03, 0x01) + DEVICE_INPUT_DEFAULTS("DSW1", 0xff, 0xff) // all blocks enabled + DEVICE_INPUT_DEFAULTS("DSW2", 0xff, 0xff) // all blocks enabled + DEVICE_INPUT_DEFAULTS("DSW3", 0x0f, 0x0f) // start address $0000 + DEVICE_INPUT_DEFAULTS("LNK1", 0x01, 0x01) // paged DEVICE_INPUT_DEFAULTS_END static DEVICE_INPUT_DEFAULTS_START(ra32k_def_ram8000) /* 32K RAM configured 0x8000-0xffff */ - DEVICE_INPUT_DEFAULTS("SW1", 0xff, 0x7f) // disable block $F800 - DEVICE_INPUT_DEFAULTS("SW2", 0xff, 0xff) // all blocks enabled - DEVICE_INPUT_DEFAULTS("SW3", 0x0f, 0x0d) // start address $8000 - DEVICE_INPUT_DEFAULTS("LNK1", 0x03, 0x00) + DEVICE_INPUT_DEFAULTS("DSW1", 0xff, 0x7f) // disable block $F800 + DEVICE_INPUT_DEFAULTS("DSW2", 0xff, 0xff) // all blocks enabled + DEVICE_INPUT_DEFAULTS("DSW3", 0x0f, 0x0d) // start address $8000 + DEVICE_INPUT_DEFAULTS("LNK1", 0x01, 0x00) // permanent DEVICE_INPUT_DEFAULTS_END -static DEVICE_INPUT_DEFAULTS_START(ra32k_def_rom2000) +static DEVICE_INPUT_DEFAULTS_START(ra32k_def_rom0000) /* 8K EPROM configured 0x2000-0x3fff */ - DEVICE_INPUT_DEFAULTS("SW1", 0xff, 0xff) // all blocks enabled - DEVICE_INPUT_DEFAULTS("SW2", 0xff, 0xff) // all blocks enabled - DEVICE_INPUT_DEFAULTS("SW3", 0x0f, 0x04) // start address $2000 - DEVICE_INPUT_DEFAULTS("LNK1", 0x03, 0x02) + DEVICE_INPUT_DEFAULTS("DSW1", 0xff, 0xff) // all blocks enabled + DEVICE_INPUT_DEFAULTS("DSW2", 0xff, 0xff) // all blocks enabled + DEVICE_INPUT_DEFAULTS("DSW3", 0x0f, 0x0f) // start address $0000 + DEVICE_INPUT_DEFAULTS("LNK1", 0x01, 0x01) // paged DEVICE_INPUT_DEFAULTS_END void mt6809_state::mt6809(machine_config &config) { /* Ralph Allen 6809 CPU Board */ - MC6809(config, m_maincpu, 6_MHz_XTAL / 4); // TODO: verify divider + MC6809(config, m_maincpu, 6_MHz_XTAL); m_maincpu->set_addrmap(AS_PROGRAM, &mt6809_state::mt6809_map); - TIMER(config, "kbd_timer").configure_periodic(FUNC(microtan_state::kbd_scan), attotime::from_hz(45)); - - INPUT_MERGER_ANY_HIGH(config, m_irq_line).output_handler().set_inputline(m_maincpu, M6809_IRQ_LINE); + MICROTAN_KBD_SLOT(config, m_keyboard, microtan_kbd_devices, "mt009"); + m_keyboard->strobe_handler().set_inputline(m_maincpu, INPUT_LINE_NMI); + m_keyboard->reset_handler().set(FUNC(mt6809_state::trigger_reset)); /* Microtan Motherboard */ TANBUS(config, m_tanbus, 6_MHz_XTAL); - m_tanbus->out_irq_callback().set(m_irq_line, FUNC(input_merger_device::in_w)); + m_tanbus->out_irq_callback().set_inputline(m_maincpu, M6809_IRQ_LINE); m_tanbus->out_nmi_callback().set_inputline(m_maincpu, M6809_FIRQ_LINE); TANBUS_SLOT(config, "tanbus:tanex", -1, tanex_devices, nullptr); - TANBUS_SLOT(config, "tanbus:0", 0, tanbus6809_devices, "ra32k").set_option_device_input_defaults("ra32k", DEVICE_INPUT_DEFAULTS_NAME(ra32k_def_ram0000)); - TANBUS_SLOT(config, "tanbus:1", 1, tanbus6809_devices, "ra32k").set_option_device_input_defaults("ra32k", DEVICE_INPUT_DEFAULTS_NAME(ra32k_def_ram8000)); + TANBUS_SLOT(config, "tanbus:0", 0, tanbus6809_devices, "ra32kram").set_option_device_input_defaults("ra32kram", DEVICE_INPUT_DEFAULTS_NAME(ra32k_def_ram0000)); + TANBUS_SLOT(config, "tanbus:1", 1, tanbus6809_devices, "ra32kram").set_option_device_input_defaults("ra32kram", DEVICE_INPUT_DEFAULTS_NAME(ra32k_def_ram8000)); TANBUS_SLOT(config, "tanbus:2", 2, tanbus6809_devices, "ravdu"); - TANBUS_SLOT(config, "tanbus:3", 3, tanbus6809_devices, "radisc"); + TANBUS_SLOT(config, "tanbus:3", 3, tanbus6809_devices, nullptr); TANBUS_SLOT(config, "tanbus:4", 4, tanbus6809_devices, nullptr); - TANBUS_SLOT(config, "tanbus:5", 5, tanbus6809_devices, nullptr); + TANBUS_SLOT(config, "tanbus:5", 5, tanbus6809_devices, "radisc"); TANBUS_SLOT(config, "tanbus:6", 6, tanbus6809_devices, nullptr); - TANBUS_SLOT(config, "tanbus:7", 7, tanbus6809_devices, "ra32k").set_option_device_input_defaults("ra32k", DEVICE_INPUT_DEFAULTS_NAME(ra32k_def_rom2000)); + TANBUS_SLOT(config, "tanbus:7", 7, tanbus6809_devices, "ra32krom").set_option_device_input_defaults("ra32krom", DEVICE_INPUT_DEFAULTS_NAME(ra32k_def_rom0000)); TANBUS_SLOT(config, "tanbus:exp", 8, tanbus6809_devices, nullptr); /* software lists */ @@ -418,69 +297,69 @@ void mt6809_state::mt6809(machine_config &config) ROM_START( mt65 ) - ROM_REGION(0x10000, "maincpu", 0) + ROM_REGION(0x0800, "maincpu", 0) ROM_DEFAULT_BIOS("tanbug23") /* Microtan 65 (MT0016 Iss 1) */ ROM_SYSTEM_BIOS(0, "tanbug23", "TANBUG V2.3") - ROMX_LOAD("tanbug23.k3", 0xf800, 0x0800, CRC(7f29845d) SHA1(de277e942eefa11a9a6defe3d7d03071d5100b68), ROM_BIOS(0)) + ROMX_LOAD("tanbug23.k3", 0x0000, 0x0800, CRC(7f29845d) SHA1(de277e942eefa11a9a6defe3d7d03071d5100b68), ROM_BIOS(0)) ROM_SYSTEM_BIOS(1, "tanbug23p", "TANBUG V2.3 (patched)") - ROMX_LOAD("tanbug_2.rom", 0xf800, 0x0400, CRC(7e215313) SHA1(c8fb3d33ce2beaf624dc75ec57d34c216b086274), ROM_BIOS(1)) - ROMX_LOAD("tanbug.rom", 0xfc00, 0x0400, CRC(c8221d9e) SHA1(c7fe4c174523aaaab30be7a8c9baf2bc08b33968), ROM_BIOS(1)) + ROMX_LOAD("tanbug_2.rom", 0x0000, 0x0400, CRC(7e215313) SHA1(c8fb3d33ce2beaf624dc75ec57d34c216b086274), ROM_BIOS(1)) + ROMX_LOAD("tanbug.rom", 0x0400, 0x0400, CRC(c8221d9e) SHA1(c7fe4c174523aaaab30be7a8c9baf2bc08b33968), ROM_BIOS(1)) ROM_SYSTEM_BIOS(2, "tanbug31", "TANBUG V3.1 (TANDOS)") - ROMX_LOAD("tanbug31.k3", 0xf800, 0x0800, CRC(5943e427) SHA1(55fe645363cd5f2015a537be6f7a00de33d1bea5), ROM_BIOS(2)) + ROMX_LOAD("tanbug31.k3", 0x0000, 0x0800, CRC(5943e427) SHA1(55fe645363cd5f2015a537be6f7a00de33d1bea5), ROM_BIOS(2)) ROM_SYSTEM_BIOS(3, "tanbug3b", "TANBUG V.3B (MPVDU)") - ROMX_LOAD("tanbug3b.k3", 0xf800, 0x0800, CRC(5b49f861) SHA1(b37cddf97b6324ab0647479b5b013a9b3d47ddda), ROM_BIOS(3)) + ROMX_LOAD("tanbug3b.k3", 0x0000, 0x0800, CRC(5b49f861) SHA1(b37cddf97b6324ab0647479b5b013a9b3d47ddda), ROM_BIOS(3)) ROM_SYSTEM_BIOS(4, "tugbug11", "TUGBUG V1.1 (VID8082)") - ROMX_LOAD("tugbug11.k3", 0xf800, 0x0800, CRC(23b02439) SHA1(9e56fbd6c07b1dc5c10e7b574a5ea26405781a3d), ROM_BIOS(4)) + ROMX_LOAD("tugbug11.k3", 0x0000, 0x0800, CRC(23b02439) SHA1(9e56fbd6c07b1dc5c10e7b574a5ea26405781a3d), ROM_BIOS(4)) + /* DM8678BWF (upper case) and DM8678CAE (lower case) */ ROM_REGION(0x1000, "gfx1", 0) ROM_LOAD("charset.rom", 0x0000, 0x0800, CRC(3b3c5360) SHA1(a3a2f74149107f8b8f35b15069c71f3aa843d12f)) ROM_RELOAD(0x0800, 0x0800) ROM_REGION(0x1000, "gfx2", ROMREGION_ERASEFF) - // initialized in init_gfx2 ROM_END ROM_START( micron ) - ROM_REGION(0x10000, "maincpu", 0) + ROM_REGION(0x0800, "maincpu", 0) ROM_DEFAULT_BIOS("tanbug1") /* MT65 (Iss 0) */ ROM_SYSTEM_BIOS(0, "tanbug1", "TANBUG V1") - ROMX_LOAD("tanbug1.g2", 0xf800, 0x0400, CRC(6f45aaca) SHA1(c1a020d86830ee475ee75c847e98f7a02d467659), ROM_BIOS(0) | ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO) - ROM_RELOAD(0xfc00, 0x0400) - ROMX_LOAD("tanbug1.h2", 0xf800, 0x0400, CRC(1ccd6b8f) SHA1(49784749599255458ba5513d8c2fc58c4df39515), ROM_BIOS(0) | ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI) - ROM_RELOAD(0xfc00, 0x0400) + ROMX_LOAD("tanbug1.g2", 0x0000, 0x0400, CRC(6f45aaca) SHA1(c1a020d86830ee475ee75c847e98f7a02d467659), ROM_BIOS(0) | ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO) + ROM_RELOAD(0x0400, 0x0400) + ROMX_LOAD("tanbug1.h2", 0x0000, 0x0400, CRC(1ccd6b8f) SHA1(49784749599255458ba5513d8c2fc58c4df39515), ROM_BIOS(0) | ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI) + ROM_RELOAD(0x0400, 0x0400) + /* DM8678BWF (upper case) and DM8678CAE (lower case) */ ROM_REGION(0x1000, "gfx1", 0) ROM_LOAD("charset.rom", 0x0000, 0x0800, CRC(3b3c5360) SHA1(a3a2f74149107f8b8f35b15069c71f3aa843d12f)) ROM_RELOAD(0x0800, 0x0800) ROM_REGION(0x1000, "gfx2", ROMREGION_ERASEFF) - // initialized in init_gfx2 ROM_END ROM_START( spinveti ) - ROM_REGION(0x10000, "maincpu", 0) - ROM_LOAD("spaceinv.ic20", 0xe800, 0x0800, CRC(3e235077) SHA1(ae7d2788125d01a3c5d57ab0d992bd708abd6ade)) + ROM_REGION(0x0800, "maincpu", 0) + ROM_LOAD("spaceinv.ic20", 0x0000, 0x0800, CRC(c0b074e0) SHA1(464be4082bd60d825c0c1e7ae033d7ab095c8e70)) + /* DM8678BWF only */ ROM_REGION(0x1000, "gfx1", 0) ROM_LOAD("charset.rom", 0x0000, 0x0800, CRC(3b3c5360) SHA1(a3a2f74149107f8b8f35b15069c71f3aa843d12f)) ROM_RELOAD(0x0800, 0x0800) ROM_REGION(0x1000, "gfx2", ROMREGION_ERASEFF) - // initialized in init_gfx2 ROM_END ROM_START( mt6809 ) /* 6809 CPU Card (Ralph Allen Engineering) */ - ROM_REGION(0x10000, "maincpu", 0) + ROM_REGION(0x0800, "maincpu", 0) ROM_SYSTEM_BIOS(0, "ralbug14", "RALBUG V1.4") - ROMX_LOAD("ralbug14.rom", 0xf800, 0x0800, CRC(8bbc87d8) SHA1(3d53a6ffd4a8d7c8edf4f2e23946011ed29146ce), ROM_BIOS(0)) + ROMX_LOAD("ralbug14.rom", 0x0000, 0x0800, CRC(8bbc87d8) SHA1(3d53a6ffd4a8d7c8edf4f2e23946011ed29146ce), ROM_BIOS(0)) ROM_END -// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1979, mt65, 0, 0, mt65, microtan, microtan_state, init_microtan, "Tangerine", "Microtan 65", MACHINE_NO_SOUND_HW ) -COMP( 1980, micron, mt65, 0, micron, microtan, microtan_state, init_microtan, "Tangerine", "Micron", MACHINE_NO_SOUND_HW ) -COMP( 1980, spinveti, 0, 0, spinveti, spinveti, microtan_state, init_gfx2, "Tangerine/ETI", "Space Invasion (ETI)", MACHINE_NO_SOUND ) -COMP( 1984, mt6809, mt65, 0, mt6809, microtan, mt6809_state, empty_init, "Tangerine", "Microtan 6809 System", MACHINE_NO_SOUND_HW | MACHINE_NOT_WORKING ) +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS +COMP( 1979, mt65, 0, 0, mt65, 0, microtan_state, empty_init, "Tangerine", "Microtan 65", MACHINE_NO_SOUND_HW ) +COMP( 1980, micron, mt65, 0, micron, 0, microtan_state, empty_init, "Tangerine", "Micron", MACHINE_NO_SOUND_HW ) +COMP( 1980, spinveti, 0, 0, spinveti, 0, microtan_state, empty_init, "Tangerine/ETI", "Space Invasion (ETI)", MACHINE_NO_SOUND ) +COMP( 1984, mt6809, mt65, 0, mt6809, 0, mt6809_state, empty_init, "Tangerine", "Microtan 6809 System", MACHINE_NO_SOUND_HW ) diff --git a/src/mame/tangerine/microtan.h b/src/mame/tangerine/microtan.h index 90c1ebd2928..9c279b303d3 100644 --- a/src/mame/tangerine/microtan.h +++ b/src/mame/tangerine/microtan.h @@ -3,10 +3,6 @@ /****************************************************************************** * Microtan 65 * - * variables and function prototypes - * - * Juergen Buchmueller , Jul 2000 - * * Thanks go to Geoff Macdonald * for his site http://www.geoff.org.uk/microtan/index.htm * and to Fabrice Frances @@ -22,8 +18,8 @@ #include "cpu/m6502/m6502.h" #include "cpu/m6809/m6809.h" #include "machine/input_merger.h" -#include "machine/timer.h" #include "bus/tanbus/tanbus.h" +#include "bus/tanbus/keyboard/keyboard.h" #include "imagedev/snapquik.h" #include "tilemap.h" @@ -34,68 +30,49 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_irq_line(*this, "irq_line") - , m_config(*this, "CONFIG") - , m_io_keyboard(*this, "KBD%u", 0) - , m_io_keypad(*this, "KPAD%u", 0) - , m_keypad(*this, "KEYPAD") + , m_keyboard(*this, "keyboard") , m_tanbus(*this, "tanbus") , m_videoram(*this, "videoram") , m_gfxdecode(*this, "gfxdecode") , m_gfx1(*this, "gfx1") - , m_led(*this, "led1") { } void mt65(machine_config &config); void micron(machine_config &config); void spinveti(machine_config &config); - void init_gfx2(); - void init_microtan(); - - TIMER_DEVICE_CALLBACK_MEMBER(kbd_scan); - uint8_t bffx_r(offs_t offset); - void bffx_w(offs_t offset, uint8_t data); - DECLARE_INPUT_CHANGED_MEMBER(trigger_reset); + DECLARE_WRITE_LINE_MEMBER(trigger_reset); protected: - enum { IRQ_KBD, IRQ_TANBUS }; - virtual void machine_start() override; - virtual void machine_reset() override; virtual void video_start() override; +private: required_device m_maincpu; required_device m_irq_line; - required_ioport m_config; - optional_ioport_array<9> m_io_keyboard; - optional_ioport_array<4> m_io_keypad; - optional_ioport m_keypad; + required_device m_keyboard; optional_device m_tanbus; + required_shared_ptr m_videoram; + required_device m_gfxdecode; + required_memory_region m_gfx1; - uint8_t m_keypad_column = 0; - uint8_t m_keyboard_ascii = 0; emu_timer *m_pulse_nmi_timer = nullptr; - uint8_t m_keyrows[10]{}; - int m_lastrow = 0; - int m_mask = 0; - int m_key = 0; - int m_repeat = 0; - int m_repeater = 0; - virtual void store_key(int key); + enum { IRQ_KBD, IRQ_TANBUS }; -private: - optional_shared_ptr m_videoram; - optional_device m_gfxdecode; - optional_memory_region m_gfx1; - output_finder<> m_led; + uint8_t bffx_r(offs_t offset); + void bffx_w(offs_t offset, uint8_t data); + + void mt65_map(address_map &map); + void spinv_map(address_map &map); + + void kbd_int(int state); + int m_keyboard_int_flag = 0; uint8_t m_chunky_graphics = 0; std::unique_ptr m_chunky_buffer; tilemap_t *m_bg_tilemap = nullptr; - uint8_t sound_r(); - void sound_w(uint8_t data); void videoram_w(offs_t offset, uint8_t data); TILE_GET_INFO_MEMBER(get_bg_tile_info); void pgm_chargen_w(offs_t offset, uint8_t data); @@ -109,28 +86,35 @@ private: void snapshot_copy(uint8_t *snapshot_buff, int snapshot_size); DECLARE_SNAPSHOT_LOAD_MEMBER(snapshot_cb); DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb); - - void mt65_map(address_map &map); - void spinv_map(address_map &map); }; -class mt6809_state : public microtan_state +class mt6809_state : public driver_device { public: - using microtan_state::microtan_state; + mt6809_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_keyboard(*this, "keyboard") + , m_tanbus(*this, "tanbus") + { } void mt6809(machine_config &config); -protected: - virtual void video_start() override; + DECLARE_WRITE_LINE_MEMBER(trigger_reset); - virtual void store_key(int key) override; +protected: + virtual void machine_start() override; private: - uint8_t keyboard_r(); + required_device m_maincpu; + required_device m_keyboard; + required_device m_tanbus; void mt6809_map(address_map &map); + + uint8_t bffx_r(offs_t offset); + void bffx_w(offs_t offset, uint8_t data); }; #endif // MAME_INCLUDES_MICROTAN_H diff --git a/src/mame/tangerine/microtan_m.cpp b/src/mame/tangerine/microtan_m.cpp index dca952e483a..f09a3b24217 100644 --- a/src/mame/tangerine/microtan_m.cpp +++ b/src/mame/tangerine/microtan_m.cpp @@ -3,10 +3,6 @@ /****************************************************************************** * Microtan 65 * - * machine driver - * - * Juergen Buchmueller , Jul 2000 - * * Thanks go to Geoff Macdonald * for his site http://www.geoff.org.uk/microtan/index.htm * and to Fabrice Frances @@ -21,115 +17,13 @@ #include "logmacro.h" -static const char keyboard[8][9][8] = { - { /* normal */ - { 27,'1','2','3','4','5','6','7'}, - {'8','9','0',':','-', 12,127,'^'}, - {'q','w','e','r','t','y','u','i'}, - {'o','p','[',']', 13, 3, 0, 0}, - {'a','s','d','f','g','h','j','k'}, - {'l',';','@', 92, 0,'z','x','c'}, - {'v','b','n','m',',','.','/', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, - { /* Shift */ - { 27,'!','"','#','$','%','&', 39}, - {'(',')','~','*','=', 12,127,'_'}, - {'Q','W','E','R','T','Y','U','I'}, - {'O','P','{','}', 13, 3, 0, 0}, - {'A','S','D','F','G','H','J','K'}, - {'L','+','`','|', 0,'Z','X','C'}, - {'V','B','N','M','<','>','?', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, - { /* Control */ - { 27,'1','2','3','4','5','6','7'}, - {'8','9','0',':','-','`',127, 30}, - { 17, 23, 5, 18, 20, 25, 21, 9}, - { 15, 16, 27, 29, 13, 3, 0, 0}, - { 1, 19, 4, 6, 7, 8, 10, 11}, - { 12,';','@', 28, 0, 26, 24, 3}, - { 22, 2, 14, 13,',','.','/', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, - { /* Shift+Control */ - { 27,'!','"','#','$','%','&', 39}, - {'(',')','~','*','=', 12,127, 31}, - { 17, 23, 5, 18, 20, 25, 21, 9}, - { 15, 16, 27, 29, 13,127, 0, 0}, - { 1, 19, 4, 6, 7, 8, 10, 11}, - { 12,'+','`', 28, 0, 26, 24, 3}, - { 22, 2, 14, 13,',','.','/', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, - { /* CapsLock */ - { 27,'1','2','3','4','5','6','7'}, - {'8','9','0',':','-', 12,127,'^'}, - {'Q','W','E','R','T','Y','U','I'}, - {'O','P','[',']', 13, 3, 0, 0}, - {'A','S','D','F','G','H','J','K'}, - {'L',';','@', 92, 0,'Z','X','C'}, - {'V','B','N','M',',','.','/', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, - { /* Shift+CapsLock */ - { 27,'!','"','#','$','%','&', 39}, - {'(',')','~','*','=', 12,127,'_'}, - {'q','w','e','r','t','y','u','i'}, - {'o','p','{','}', 13, 3, 0, 0}, - {'a','s','d','f','g','h','j','k'}, - {'l','+','`','|', 0,'z','x','c'}, - {'v','b','n','m','<','>','?', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, - { /* Control+CapsLock */ - { 27,'1','2','3','4','5','6','7'}, - {'8','9','0',':','-', 12,127, 9}, - { 17, 23, 5, 18, 20, 25, 21, 9}, - { 15, 16, 27, 29, 13,127, 0, 0}, - { 1, 19, 4, 6, 7, 8, 10, 11}, - { 12,';', 39, 28, 0, 26, 24, 3}, - { 22, 2, 14, 13,',','.','/', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, - { /* Shift+Control+CapsLock */ - { 27,'!','"','#','$','%','&', 39}, - {'(',')','~','*','=', 12,127, 9}, - { 17, 23, 5, 18, 20, 25, 21, 9}, - { 15, 16, 27, 29, 13,127, 0, 0}, - { 1, 19, 4, 6, 7, 8, 10, 11}, - { 12,':','"', 28, 0, 26, 24, 3}, - { 22, 2, 14, 13,',','.','/', 0}, - { 10,' ','-',',', 13,'.','0','1'}, - {'2','3','4','5','6','7','8','9'}, - }, -}; - - -uint8_t microtan_state::sound_r() -{ - int data = 0xff; - LOG("sound_r: -> %02x\n", data); - return data; -} - -void microtan_state::sound_w(uint8_t data) +uint8_t microtan_state::bffx_r(offs_t offset) { - LOG("sound_w: <- %02x\n", data); -} + uint8_t data = 0xff; + if (machine().side_effects_disabled()) return data; -uint8_t microtan_state::bffx_r(offs_t offset) -{ - int data = 0xff; - switch( offset & 3 ) + switch (offset & 3) { case 0: /* BFF0: read enables chunky graphics */ m_chunky_graphics = 1; @@ -142,22 +36,7 @@ uint8_t microtan_state::bffx_r(offs_t offset) LOG("bff2_r: -> %02x\n", data); break; case 3: /* BFF3: read keyboard/keypad */ - switch (m_config->read() & 3) - { - case 0: /* ASCII Keyboard */ - data = m_keyboard_ascii; - break; - case 1: /* Hex Keypad */ - data = 0x00; - for (u8 i = 0; i < 4; i++) - if (BIT(m_keypad_column, i)) - data |= m_io_keypad[i]->read(); - - break; - case 2: /* ETI Keypad */ - data = (m_keypad->read() & 0x1f) | (m_config->read() & 0x60); - break; - } + data = m_keyboard->read() | (m_keyboard_int_flag << 7); LOG("bff3_r: -> %02x (keyboard ASCII)\n", data); break; } @@ -173,21 +52,20 @@ TIMER_CALLBACK_MEMBER(microtan_state::pulse_nmi) void microtan_state::bffx_w(offs_t offset, uint8_t data) { - switch( offset & 3 ) + switch (offset & 3) { case 0: /* BFF0: write reset keyboard interrupt flag */ /* This removes bit 7 from the ASCII value of the last key pressed. */ LOG("bff0_w: %d <- %02x (keyboard IRQ clear )\n", offset, data); - m_keyboard_ascii &= ~0x80; - m_irq_line->in_w(0); + kbd_int(0); break; case 1: /* BFF1: write delayed NMI */ LOG("bff1_w: %d <- %02x (delayed NMI)\n", offset, data); m_pulse_nmi_timer->adjust(m_maincpu->cycles_to_attotime(8)); break; case 2: /* BFF2: write keypad */ - LOG("bff2_w: %d <- %02x (keypad column)\n", offset, data); // 1, 2, 4, 7, f - m_keypad_column = data & 0x0f; + LOG("bff2_w: %d <- %02x (keypad column)\n", offset, data); + m_keyboard->write(data); break; case 3: /* BFF3: write disable chunky graphics */ LOG("bff3_w: %d <- %02x (chunky graphics off)\n", offset, data); @@ -196,110 +74,40 @@ void microtan_state::bffx_w(offs_t offset, uint8_t data) } } -uint8_t mt6809_state::keyboard_r() -{ - uint8_t data = m_keyboard_ascii; - - m_keyboard_ascii = 0x00; - return data; -} - -void mt6809_state::store_key(int key) -{ - m_keyboard_ascii = key | 0x80; -} - -void microtan_state::store_key(int key) -{ - m_keyboard_ascii = key | 0x80; - m_irq_line->in_w(1); -} - -TIMER_DEVICE_CALLBACK_MEMBER(microtan_state::kbd_scan) +uint8_t mt6809_state::bffx_r(offs_t offset) { - /* ASCII Keyboard only */ - if (m_config->read() & 3) - return; + uint8_t data = 0xff; - int mod, row, col, chg, newvar; + if (machine().side_effects_disabled()) return data; - if( m_repeat ) + switch (offset & 3) { - if( !--m_repeat ) - m_repeater = 4; + case 3: /* BFF3: read keyboard */ + data = m_keyboard->read(); + LOG("bff3_r: -> %02x (keyboard ASCII)\n", data); + break; } - else if( m_repeater ) - m_repeat = m_repeater; - - row = 9; - newvar = m_io_keyboard[8]->read(); - chg = m_keyrows[--row] ^ newvar; + return data; +} - while ( !chg && row > 0) +void mt6809_state::bffx_w(offs_t offset, uint8_t data) +{ + switch (offset & 3) { - newvar = m_io_keyboard[row - 1]->read(); - chg = m_keyrows[--row] ^ newvar; + case 0: /* BFF0: write reset keyboard interrupt flag */ + LOG("bff0_w: %d <- %02x (keyboard NMI clear )\n", offset, data); + m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + break; } - if (!chg) - --row; - - if (row >= 0) - { - m_repeater = 0x00; - m_mask = 0x00; - m_key = 0x00; - m_lastrow = row; - /* CapsLock LED */ - if( row == 3 && chg == 0x80 ) - m_led = BIT(~m_keyrows[3], 7); - - if (newvar & chg) /* key(s) pressed ? */ - { - mod = 0; - - /* Shift modifier */ - if ( (m_keyrows[5] & 0x10) || (m_keyrows[6] & 0x80) ) - mod |= 1; - - /* Control modifier */ - if (m_keyrows[3] & 0x40) - mod |= 2; +} - /* CapsLock modifier */ - if (m_keyrows[3] & 0x80) - mod |= 4; - /* find newvar key */ - m_mask = 0x01; - for (col = 0; col < 8; col ++) - { - if (chg & m_mask) - { - newvar &= m_mask; - m_key = keyboard[mod][row][col]; - break; - } - m_mask <<= 1; - } - if( m_key ) /* normal key */ - { - m_repeater = 30; - store_key(m_key); - } - else - if( (row == 0) && (chg == 0x04) ) /* Ctrl-@ (NUL) */ - store_key(0); - m_keyrows[row] |= newvar; - } - else - m_keyrows[row] = newvar; +void microtan_state::kbd_int(int state) +{ + m_keyboard_int_flag = state; - m_repeat = m_repeater; - } - else - if ( m_key && (m_keyrows[m_lastrow] & m_mask) && m_repeat == 0 ) - store_key(m_key); + m_irq_line->in_w(state); } @@ -320,7 +128,8 @@ void microtan_state::pgm_chargen_w(offs_t offset, uint8_t data) } } -void microtan_state::init_gfx2() + +void microtan_state::machine_start() { uint8_t *dst = memregion("gfx2")->base(); @@ -328,67 +137,45 @@ void microtan_state::init_gfx2() { switch (i & 3) { - case 0: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x00; break; - case 1: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xf0; break; - case 2: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x0f; break; - case 3: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xff; break; + case 0: dst[0] = dst[1] = dst[2] = dst[3] = 0x00; break; + case 1: dst[0] = dst[1] = dst[2] = dst[3] = 0xf0; break; + case 2: dst[0] = dst[1] = dst[2] = dst[3] = 0x0f; break; + case 3: dst[0] = dst[1] = dst[2] = dst[3] = 0xff; break; } dst += 4; switch (BIT(i, 2, 2)) { - case 0: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x00; break; - case 1: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xf0; break; - case 2: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x0f; break; - case 3: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xff; break; + case 0: dst[0] = dst[1] = dst[2] = dst[3] = 0x00; break; + case 1: dst[0] = dst[1] = dst[2] = dst[3] = 0xf0; break; + case 2: dst[0] = dst[1] = dst[2] = dst[3] = 0x0f; break; + case 3: dst[0] = dst[1] = dst[2] = dst[3] = 0xff; break; } dst += 4; switch (BIT(i, 4, 2)) { - case 0: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x00; break; - case 1: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xf0; break; - case 2: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x0f; break; - case 3: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xff; break; + case 0: dst[0] = dst[1] = dst[2] = dst[3] = 0x00; break; + case 1: dst[0] = dst[1] = dst[2] = dst[3] = 0xf0; break; + case 2: dst[0] = dst[1] = dst[2] = dst[3] = 0x0f; break; + case 3: dst[0] = dst[1] = dst[2] = dst[3] = 0xff; break; } dst += 4; switch (BIT(i, 6, 2)) { - case 0: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x00; break; - case 1: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xf0; break; - case 2: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0x0f; break; - case 3: dst[ 0] = dst[ 1] = dst[ 2] = dst[ 3] = 0xff; break; + case 0: dst[0] = dst[1] = dst[2] = dst[3] = 0x00; break; + case 1: dst[0] = dst[1] = dst[2] = dst[3] = 0xf0; break; + case 2: dst[0] = dst[1] = dst[2] = dst[3] = 0x0f; break; + case 3: dst[0] = dst[1] = dst[2] = dst[3] = 0xff; break; } dst += 4; } -} - -void microtan_state::init_microtan() -{ - init_gfx2(); m_pulse_nmi_timer = timer_alloc(FUNC(microtan_state::pulse_nmi), this); } -void microtan_state::machine_start() +void mt6809_state::machine_start() { - m_led.resolve(); - - save_item(NAME(m_keypad_column)); - save_item(NAME(m_keyboard_ascii)); - save_item(NAME(m_keyrows)); - save_item(NAME(m_lastrow)); - save_item(NAME(m_mask)); - save_item(NAME(m_key)); - save_item(NAME(m_repeat)); - save_item(NAME(m_repeater)); } -void microtan_state::machine_reset() -{ - for (int i = 1; i < 10; i++) - m_keyrows[i] = m_io_keyboard[i-1].read_safe(0); - - m_led = BIT(~m_keyrows[3], 7); -} image_verify_result microtan_state::verify_snapshot(uint8_t *data, int size) { @@ -639,7 +426,7 @@ void microtan_state::snapshot_copy(uint8_t *snapshot_buff, int snapshot_size) bffx_w(i, snapshot_buff[base++]); } - sound_w(snapshot_buff[base++]); + space.write_byte(0xbc04, snapshot_buff[base++]); m_chunky_graphics = snapshot_buff[base++]; /* first set of AY8910 registers */ diff --git a/src/mame/tangerine/microtan_v.cpp b/src/mame/tangerine/microtan_v.cpp index d023f2ecffa..5bbfbf103ab 100644 --- a/src/mame/tangerine/microtan_v.cpp +++ b/src/mame/tangerine/microtan_v.cpp @@ -3,10 +3,6 @@ /*************************************************************************** * Microtan 65 * - * video hardware - * - * Juergen Buchmueller , Jul 2000 - * * Thanks go to Geoff Macdonald * for his site http://www.geoff.org.uk/microtan/index.htm * and to Fabrice Frances @@ -30,8 +26,8 @@ void microtan_state::videoram_w(offs_t offset, uint8_t data) TILE_GET_INFO_MEMBER(microtan_state::get_bg_tile_info) { - int gfxn = m_chunky_buffer[tile_index]; - int code = m_videoram[tile_index]; + uint8_t gfxn = m_chunky_buffer[tile_index]; + uint8_t code = m_videoram[tile_index]; tileinfo.set(gfxn, code, 0, 0); } @@ -42,13 +38,9 @@ void microtan_state::video_start() for (uint16_t addr = 0; addr < m_videoram.bytes(); addr++) m_videoram[addr] = machine().rand() & 0xff; - m_bg_tilemap = &machine().tilemap().create(* - m_gfxdecode, - tilemap_get_info_delegate(*this, FUNC(microtan_state::get_bg_tile_info)), - TILEMAP_SCAN_ROWS, 8, 16, 32, 16); + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(microtan_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 16, 32, 16); - m_chunky_buffer = std::make_unique(0x200); - memset(m_chunky_buffer.get(), 0, 0x200); + m_chunky_buffer = make_unique_clear(0x200); m_chunky_graphics = 0; save_pointer(NAME(m_chunky_buffer), 0x200); @@ -60,7 +52,3 @@ uint32_t microtan_state::screen_update(screen_device &screen, bitmap_ind16 &bitm m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); return 0; } - -void mt6809_state::video_start() -{ -} -- cgit v1.2.3