mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
bus/bbc/analogue: Added Microwriter Quinkey input device.
This commit is contained in:
parent
c213897ffc
commit
4a29438376
@ -564,6 +564,8 @@ if (BUSES["BBC_ANALOGUE"]~=null) then
|
||||
MAME_DIR .. "src/devices/bus/bbc/analogue/joystick.h",
|
||||
MAME_DIR .. "src/devices/bus/bbc/analogue/cfa3000a.cpp",
|
||||
MAME_DIR .. "src/devices/bus/bbc/analogue/cfa3000a.h",
|
||||
MAME_DIR .. "src/devices/bus/bbc/analogue/quinkey.cpp",
|
||||
MAME_DIR .. "src/devices/bus/bbc/analogue/quinkey.h",
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -75,6 +75,12 @@ uint8_t bbc_analogue_slot_device::pb_r()
|
||||
return 0x30;
|
||||
}
|
||||
|
||||
void bbc_analogue_slot_device::pb_w(uint8_t data)
|
||||
{
|
||||
if (m_card)
|
||||
m_card->pb_w(data);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// SLOT_INTERFACE( bbc_analogue_devices )
|
||||
@ -86,7 +92,7 @@ uint8_t bbc_analogue_slot_device::pb_r()
|
||||
#include "bitstik.h"
|
||||
//#include "lightpen.h"
|
||||
//#include "micromike.h"
|
||||
//#include "quinkey.h"
|
||||
#include "quinkey.h"
|
||||
#include "cfa3000a.h"
|
||||
|
||||
|
||||
@ -98,6 +104,6 @@ void bbc_analogue_devices(device_slot_interface &device)
|
||||
//device.option_add("lightpen", BBC_LIGHTPEN); /* RH Electronics Lightpen */
|
||||
//device.option_add("micromike", BBC_MICROMIKE); /* Micro Mike */
|
||||
device.option_add("voltmace3b", BBC_VOLTMACE3B); /* Voltmace Delta 3b "Twin" Joysticks */
|
||||
//device.option_add("quinkey", BBC_QUINKEY); /* Microwriter Quinkey */
|
||||
device.option_add("quinkey", BBC_QUINKEY_INTF); /* Microwriter Quinkey */
|
||||
device.option_add_internal("cfa3000a", CFA3000_ANLG); /* Hanson CFA 3000 Analogue */
|
||||
}
|
||||
|
@ -64,9 +64,10 @@ public:
|
||||
|
||||
uint8_t ch_r(int channel);
|
||||
uint8_t pb_r();
|
||||
void pb_w(uint8_t data);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
// device_t overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
device_bbc_analogue_interface *m_card;
|
||||
@ -83,6 +84,7 @@ class device_bbc_analogue_interface : public device_interface
|
||||
public:
|
||||
virtual uint8_t ch_r(int channel) { return 0x00; }
|
||||
virtual uint8_t pb_r() { return 0x30; }
|
||||
virtual void pb_w(uint8_t data) { }
|
||||
|
||||
protected:
|
||||
device_bbc_analogue_interface(const machine_config &mconfig, device_t &device);
|
||||
|
173
src/devices/bus/bbc/analogue/quinkey.cpp
Normal file
173
src/devices/bus/bbc/analogue/quinkey.cpp
Normal file
@ -0,0 +1,173 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Nigel Barnes
|
||||
/**********************************************************************
|
||||
|
||||
Microwriter Quinkey
|
||||
|
||||
The Quinkey is provided with an interface that connects to the BBC Micro
|
||||
analogue port, which provides sockets for connecting upto four Quinkey
|
||||
keyboards.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "quinkey.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
DEFINE_DEVICE_TYPE(BBC_QUINKEY_INTF, bbc_quinkey_intf_device, "bbc_quinkey_intf", "Microwriter Quinkey Interface")
|
||||
DEFINE_DEVICE_TYPE(BBC_QUINKEY_SLOT, bbc_quinkey_slot_device, "bbc_quinkey_slot", "Microwriter Quinkey slot")
|
||||
DEFINE_DEVICE_TYPE(BBC_QUINKEY, bbc_quinkey_device, "bbc_quinkey", "Microwriter Quinkey")
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_add_mconfig - add device configuration
|
||||
//-------------------------------------------------
|
||||
|
||||
void bbc_quinkey_intf_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
BBC_QUINKEY_SLOT(config, "1", bbc_quinkey_devices, "quinkey");
|
||||
BBC_QUINKEY_SLOT(config, "2", bbc_quinkey_devices, nullptr);
|
||||
BBC_QUINKEY_SLOT(config, "3", bbc_quinkey_devices, nullptr);
|
||||
BBC_QUINKEY_SLOT(config, "4", bbc_quinkey_devices, nullptr);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// INPUT_PORTS( quinkey )
|
||||
//-------------------------------------------------
|
||||
|
||||
static INPUT_PORTS_START( quinkey )
|
||||
PORT_START("KEYS")
|
||||
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Command")
|
||||
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Thumb")
|
||||
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Index Finger")
|
||||
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("Middle Finger")
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_NAME("Ring Finger")
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON6) PORT_NAME("Little Finger")
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// input_ports - device-specific input ports
|
||||
//-------------------------------------------------
|
||||
|
||||
ioport_constructor bbc_quinkey_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME(quinkey);
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// bbc_quinkey_intf_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
bbc_quinkey_intf_device::bbc_quinkey_intf_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, BBC_QUINKEY_INTF, tag, owner, clock)
|
||||
, device_bbc_analogue_interface(mconfig, *this)
|
||||
, m_quinkey(*this, "%u", 1)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void bbc_quinkey_intf_device::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
uint8_t bbc_quinkey_intf_device::ch_r(int channel)
|
||||
{
|
||||
return m_quinkey[channel]->read();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_bbc_quinkey_interface - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
device_bbc_quinkey_interface::device_bbc_quinkey_interface(const machine_config &mconfig, device_t &device)
|
||||
: device_interface(device, "bbcquinkey")
|
||||
{
|
||||
m_slot = dynamic_cast<bbc_quinkey_slot_device *>(device.owner());
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// bbc_quinkey_slot_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
bbc_quinkey_slot_device::bbc_quinkey_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, BBC_QUINKEY_SLOT, tag, owner, clock)
|
||||
, device_single_card_slot_interface<device_bbc_quinkey_interface>(mconfig, *this)
|
||||
, m_card(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void bbc_quinkey_slot_device::device_start()
|
||||
{
|
||||
m_card = get_card_device();
|
||||
}
|
||||
|
||||
|
||||
uint8_t bbc_quinkey_slot_device::read()
|
||||
{
|
||||
if (m_card)
|
||||
return m_card->read();
|
||||
else
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// bbc_quinkey_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
bbc_quinkey_device::bbc_quinkey_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, BBC_QUINKEY, tag, owner, clock)
|
||||
, device_bbc_quinkey_interface(mconfig, *this)
|
||||
, m_keys(*this, "KEYS")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void bbc_quinkey_device::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
uint8_t bbc_quinkey_device::read()
|
||||
{
|
||||
return m_keys->read();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// SLOT_INTERFACE( bbc_quinkey_devices )
|
||||
//-------------------------------------------------
|
||||
|
||||
void bbc_quinkey_devices(device_slot_interface &device)
|
||||
{
|
||||
device.option_add("quinkey", BBC_QUINKEY);
|
||||
}
|
120
src/devices/bus/bbc/analogue/quinkey.h
Normal file
120
src/devices/bus/bbc/analogue/quinkey.h
Normal file
@ -0,0 +1,120 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Nigel Barnes
|
||||
/**********************************************************************
|
||||
|
||||
Microwriter Quinkey
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef MAME_BUS_BBC_ANALOGUE_QUINKEY_H
|
||||
#define MAME_BUS_BBC_ANALOGUE_QUINKEY_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "analogue.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// ======================> bbc_quinkey_intf_device
|
||||
|
||||
class bbc_quinkey_slot_device;
|
||||
|
||||
class bbc_quinkey_intf_device : public device_t, public device_bbc_analogue_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
bbc_quinkey_intf_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
protected:
|
||||
// device_t overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
// optional information overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
virtual uint8_t ch_r(int channel) override;
|
||||
|
||||
private:
|
||||
required_device_array<bbc_quinkey_slot_device, 4> m_quinkey;
|
||||
};
|
||||
|
||||
|
||||
// ======================> bbc_quinkey_slot_device
|
||||
|
||||
class device_bbc_quinkey_interface;
|
||||
|
||||
class bbc_quinkey_slot_device : public device_t, public device_single_card_slot_interface<device_bbc_quinkey_interface>
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
template <typename T>
|
||||
bbc_quinkey_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&slot_options, const char *default_option)
|
||||
: bbc_quinkey_slot_device(mconfig, tag, owner)
|
||||
{
|
||||
option_reset();
|
||||
slot_options(*this);
|
||||
set_default_option(default_option);
|
||||
set_fixed(false);
|
||||
}
|
||||
|
||||
bbc_quinkey_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0);
|
||||
|
||||
// callbacks
|
||||
uint8_t read();
|
||||
|
||||
protected:
|
||||
// device_t overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
device_bbc_quinkey_interface *m_card;
|
||||
};
|
||||
|
||||
|
||||
// ======================> device_bbc_quinkey_interface
|
||||
|
||||
class device_bbc_quinkey_interface : public device_interface
|
||||
{
|
||||
public:
|
||||
virtual uint8_t read() { return 0x00; }
|
||||
|
||||
protected:
|
||||
device_bbc_quinkey_interface(const machine_config &mconfig, device_t &device);
|
||||
|
||||
bbc_quinkey_slot_device *m_slot;
|
||||
};
|
||||
|
||||
|
||||
// ======================> bbc_quinkey_device
|
||||
|
||||
class bbc_quinkey_device : public device_t, public device_bbc_quinkey_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
bbc_quinkey_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
protected:
|
||||
// device_t overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
// optional information overrides
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
||||
virtual uint8_t read() override;
|
||||
|
||||
private:
|
||||
required_ioport m_keys;
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(BBC_QUINKEY_INTF, bbc_quinkey_intf_device)
|
||||
DECLARE_DEVICE_TYPE(BBC_QUINKEY_SLOT, bbc_quinkey_slot_device)
|
||||
DECLARE_DEVICE_TYPE(BBC_QUINKEY, bbc_quinkey_device)
|
||||
|
||||
void bbc_quinkey_devices(device_slot_interface &device);
|
||||
|
||||
|
||||
#endif // MAME_BUS_BBC_ANALOGUE_QUINKEY_H
|
Loading…
Reference in New Issue
Block a user