misc/nabupc_kbd.cpp: Fully emulated NABU PC keyboard. (#11220)
This commit is contained in:
parent
69f7e7b103
commit
b29b71071f
@ -5267,20 +5267,6 @@ if (BUSES["NABU"]~=null) then
|
||||
}
|
||||
end
|
||||
|
||||
---------------------------------------------------
|
||||
--
|
||||
--@src/devices/bus/nabupc/keyboard/keyboard.h,BUSES["NABU_KEYBOARD"] = true
|
||||
---------------------------------------------------
|
||||
|
||||
if (BUSES["NABU_KEYBOARD"]~=null) then
|
||||
files {
|
||||
MAME_DIR .. "src/devices/bus/nabupc/keyboard/hlekeyboard.cpp",
|
||||
MAME_DIR .. "src/devices/bus/nabupc/keyboard/hlekeyboard.h",
|
||||
MAME_DIR .. "src/devices/bus/nabupc/keyboard/keyboard.cpp",
|
||||
MAME_DIR .. "src/devices/bus/nabupc/keyboard/keyboard.h",
|
||||
}
|
||||
end
|
||||
|
||||
---------------------------------------------------
|
||||
--
|
||||
--@src/devices/bus/mc68000/sysbus.h,BUSES["MC68000_SYSBUS"] = true
|
||||
|
@ -1,372 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Brian Johnson
|
||||
/*****************************************************************************
|
||||
|
||||
NABU PC HLE Keyboard Interface
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "hlekeyboard.h"
|
||||
|
||||
#include "machine/keyboard.h"
|
||||
#include "machine/keyboard.ipp"
|
||||
|
||||
#include "diserial.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
class hle_keyboard_device
|
||||
: public device_t
|
||||
, public device_buffered_serial_interface<16U>
|
||||
, public device_rs232_port_interface
|
||||
, protected device_matrix_keyboard_interface<16U>
|
||||
{
|
||||
public:
|
||||
// constructor/destructor
|
||||
hle_keyboard_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
|
||||
|
||||
protected:
|
||||
// device overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
||||
// device_buffered_serial_interface overrides
|
||||
virtual void tra_callback() override;
|
||||
|
||||
// device_matrix_keyboard_interface overrides
|
||||
virtual void key_make(uint8_t row, uint8_t column) override;
|
||||
virtual void key_break(uint8_t row, uint8_t column) override;
|
||||
virtual void scan_complete() override;
|
||||
|
||||
uint8_t translate(uint8_t row, uint8_t column);
|
||||
|
||||
private:
|
||||
static constexpr int START_BIT_COUNT = 1;
|
||||
static constexpr int DATA_BIT_COUNT = 8;
|
||||
static constexpr device_serial_interface::parity_t PARITY = device_serial_interface::PARITY_NONE;
|
||||
static constexpr device_serial_interface::stop_bits_t STOP_BITS = device_serial_interface::STOP_BITS_1;
|
||||
static constexpr int BAUD = 6'993;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(watchdog_tick);
|
||||
|
||||
virtual void received_byte(uint8_t byte) override {}
|
||||
|
||||
required_ioport m_modifiers;
|
||||
required_ioport m_gameport1;
|
||||
required_ioport m_gameport2;
|
||||
|
||||
emu_timer *m_watchdog_timer;
|
||||
uint8_t m_prev_gameport1;
|
||||
uint8_t m_prev_gameport2;
|
||||
};
|
||||
|
||||
namespace {
|
||||
//**************************************************************************
|
||||
// TRANSLATION TABLE
|
||||
//**************************************************************************
|
||||
|
||||
uint8_t const TRANSLATION_TABLE[3][16][4] =
|
||||
{
|
||||
// unshifted
|
||||
{
|
||||
{ 0x00, 0x38, 0x67, 0x6e }, // 0
|
||||
{ 0x1b, 0x32, 0x09, 0x63 }, // 1
|
||||
{ 0xe0, 0xe2, 0xe6, 0xe4 }, // 2
|
||||
{ 0x70, 0x3d, 0x6c, 0x2e }, // 3
|
||||
{ 0x77, 0x34, 0x61, 0x62 }, // 4
|
||||
{ 0x72, 0x36, 0x64, 0x7a }, // 5
|
||||
{ 0x69, 0x30, 0x6a, 0x6d }, // 6
|
||||
{ 0x5d, 0xea, 0x27, 0x00 }, // 7
|
||||
{ 0x75, 0x37, 0x20, 0x68 }, // 8
|
||||
{ 0x71, 0x31, 0x78, 0x79 }, // 9
|
||||
{ 0xe1, 0xe7, 0xe5, 0xe3 }, // 10
|
||||
{ 0x5b, 0x2d, 0x2f, 0x3b }, // 11
|
||||
{ 0x65, 0x33, 0x76, 0x73 }, // 12
|
||||
{ 0x74, 0x35, 0x00, 0x66 }, // 13
|
||||
{ 0x6f, 0x39, 0x2c, 0x6b }, // 14
|
||||
{ 0x7f, 0xe9, 0xe8, 0x0d }, // 15
|
||||
},
|
||||
// shifted
|
||||
{
|
||||
{ 0x00, 0x2a, 0x47, 0x4e }, // 0
|
||||
{ 0x1b, 0x40, 0x09, 0x43 }, // 1
|
||||
{ 0xe0, 0xe2, 0xe6, 0xe4 }, // 2
|
||||
{ 0x50, 0x2b, 0x4c, 0x3e }, // 3
|
||||
{ 0x57, 0x24, 0x41, 0x42 }, // 4
|
||||
{ 0x52, 0x5e, 0x44, 0x5a }, // 5
|
||||
{ 0x49, 0x29, 0x4a, 0x4d }, // 6
|
||||
{ 0x7d, 0xea, 0x22, 0x00 }, // 7
|
||||
{ 0x55, 0x26, 0x20, 0x48 }, // 8
|
||||
{ 0x51, 0x21, 0x58, 0x59 }, // 9
|
||||
{ 0xe1, 0xe7, 0xe5, 0xe3 }, // 10
|
||||
{ 0x5b, 0x5f, 0x3f, 0x3a }, // 11
|
||||
{ 0x45, 0x23, 0x56, 0x53 }, // 12
|
||||
{ 0x54, 0x25, 0x00, 0x46 }, // 13
|
||||
{ 0x4f, 0x28, 0x3c, 0x4b }, // 14
|
||||
{ 0x7f, 0xe9, 0xe8, 0x0d }, // 15
|
||||
},
|
||||
// control
|
||||
{
|
||||
{ 0x00, 0x38, 0x07, 0x0e }, // 0
|
||||
{ 0x1b, 0x00, 0x09, 0x03 }, // 1
|
||||
{ 0xe0, 0xe2, 0xe6, 0xe4 }, // 2
|
||||
{ 0x10, 0x3d, 0x0c, 0x2e }, // 3
|
||||
{ 0x17, 0x34, 0x01, 0x02 }, // 4
|
||||
{ 0x12, 0x1e, 0x04, 0x1a }, // 5
|
||||
{ 0x09, 0x30, 0x0a, 0x0d }, // 6
|
||||
{ 0x1d, 0xea, 0x27, 0x00 }, // 7
|
||||
{ 0x15, 0x37, 0x20, 0x08 }, // 8
|
||||
{ 0x11, 0x31, 0x18, 0x19 }, // 9
|
||||
{ 0xe1, 0xe7, 0xe5, 0xe3 }, // 10
|
||||
{ 0x1b, 0x1f, 0x2f, 0x3b }, // 11
|
||||
{ 0x05, 0x33, 0x16, 0x13 }, // 12
|
||||
{ 0x14, 0x35, 0x00, 0x06 }, // 13
|
||||
{ 0x0f, 0x39, 0x1c, 0x0b }, // 14
|
||||
{ 0x7f, 0xe9, 0xe8, 0x0d }, // 15
|
||||
}
|
||||
};
|
||||
|
||||
//**************************************************************************
|
||||
// KEYBOARD MATRIX
|
||||
//**************************************************************************
|
||||
|
||||
INPUT_PORTS_START(nabu_hle_keyboard)
|
||||
PORT_START("MODIFIERS")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_NAME("Control") PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("Shift") PORT_CHAR(UCHAR_SHIFT_1)
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("Caps Lock") PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
|
||||
PORT_START("ROW0")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) // "Alt Mode"
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
|
||||
PORT_START("ROW1")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_NAME("Esc") PORT_CHAR(UCHAR_MAMEKEY(ESC))
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('2')
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_NAME("Tab") PORT_CHAR(9)
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
|
||||
PORT_START("ROW2")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right") PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("Up") PORT_CHAR(UCHAR_MAMEKEY(UP))
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("No") PORT_CHAR(UCHAR_MAMEKEY(F2))
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("|||>") PORT_CHAR(UCHAR_MAMEKEY(PGDN))
|
||||
PORT_START("ROW3")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
|
||||
PORT_START("ROW4")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
|
||||
PORT_START("ROW5")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^')
|
||||
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_Z) PORT_CHAR('z') PORT_CHAR('Z')
|
||||
PORT_START("ROW6")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
|
||||
PORT_START("ROW7")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("TV") PORT_CHAR(UCHAR_MAMEKEY(F3))
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) // "Alt Mode"
|
||||
PORT_START("ROW8")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&')
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
|
||||
PORT_START("ROW9")
|
||||
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_1) PORT_CHAR('1') PORT_CHAR('!')
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
|
||||
PORT_START("ROWA")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("Left") PORT_CHAR(UCHAR_MAMEKEY(LEFT))
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("Yes") PORT_CHAR(UCHAR_MAMEKEY(F1))
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("<|||") PORT_CHAR(UCHAR_MAMEKEY(PGUP))
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Down") PORT_CHAR(UCHAR_MAMEKEY(DOWN))
|
||||
PORT_START("ROWB")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
|
||||
PORT_START("ROWC")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
|
||||
PORT_START("ROWD")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) // "Alt Mode"
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
|
||||
PORT_START("ROWE")
|
||||
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_9) PORT_CHAR('9') PORT_CHAR('(')
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
|
||||
PORT_START("ROWF")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Delete") PORT_CHAR(UCHAR_MAMEKEY(BACKSPACE))
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PAUSE) PORT_NAME("Pause") PORT_CHAR(UCHAR_MAMEKEY(PAUSE))
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("SYM") PORT_CHAR(UCHAR_MAMEKEY(F4))
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Go") PORT_CHAR(13)
|
||||
|
||||
PORT_START("JOYSTICK1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CODE(KEYCODE_4_PAD)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CODE(KEYCODE_2_PAD)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CODE(KEYCODE_6_PAD)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CODE(KEYCODE_8_PAD)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CODE(KEYCODE_ENTER_PAD)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_START("JOYSTICK2")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
INPUT_PORTS_END
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// KEYBOARD DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// keyboard_device - constructor
|
||||
//-------------------------------------------------
|
||||
hle_keyboard_device::hle_keyboard_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, NABUPC_HLE_KEYBOARD, tag, owner, clock)
|
||||
, device_buffered_serial_interface(mconfig, *this)
|
||||
, device_rs232_port_interface(mconfig, *this)
|
||||
, device_matrix_keyboard_interface(mconfig, *this, "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7", "ROW8", "ROW9", "ROWA", "ROWB", "ROWC", "ROWD", "ROWE", "ROWF")
|
||||
, m_modifiers(*this, "MODIFIERS")
|
||||
, m_gameport1(*this, "JOYSTICK1")
|
||||
, m_gameport2(*this, "JOYSTICK2")
|
||||
, m_watchdog_timer(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
ioport_constructor hle_keyboard_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME(nabu_hle_keyboard);
|
||||
}
|
||||
|
||||
void hle_keyboard_device::device_start()
|
||||
{
|
||||
m_watchdog_timer = timer_alloc(FUNC(hle_keyboard_device::watchdog_tick), this);
|
||||
|
||||
save_item(NAME(m_prev_gameport1));
|
||||
save_item(NAME(m_prev_gameport2));
|
||||
}
|
||||
|
||||
void hle_keyboard_device::device_reset()
|
||||
{
|
||||
m_prev_gameport1 = m_prev_gameport2 = 0xa0;
|
||||
|
||||
// initialise state
|
||||
clear_fifo();
|
||||
|
||||
// configure device_buffered_serial_interface
|
||||
set_data_frame(START_BIT_COUNT, DATA_BIT_COUNT, PARITY, STOP_BITS);
|
||||
set_rate(BAUD);
|
||||
receive_register_reset();
|
||||
transmit_register_reset();
|
||||
|
||||
m_watchdog_timer->adjust(attotime::from_msec(500), 1, attotime::never);
|
||||
|
||||
// kick the base
|
||||
reset_key_state();
|
||||
start_processing(attotime::from_hz(BAUD));
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(hle_keyboard_device::watchdog_tick)
|
||||
{
|
||||
if (param == 1) {
|
||||
transmit_byte(0x95);
|
||||
m_watchdog_timer->adjust(attotime::from_msec(500), 0, attotime::from_msec(3700));
|
||||
} else {
|
||||
transmit_byte(0x94);
|
||||
}
|
||||
}
|
||||
|
||||
void hle_keyboard_device::tra_callback()
|
||||
{
|
||||
output_rxd(transmit_register_get_data_bit());
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// KEYBOARD SCANNING
|
||||
//**************************************************************************
|
||||
|
||||
void hle_keyboard_device::key_make(uint8_t row, uint8_t column)
|
||||
{
|
||||
transmit_byte(translate(row,column));
|
||||
}
|
||||
|
||||
void hle_keyboard_device::key_break(uint8_t row, uint8_t column)
|
||||
{
|
||||
uint8_t key = translate(row, column);
|
||||
if ((key & 0xe0) == 0xe0) {
|
||||
transmit_byte(key | 0x10);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t hle_keyboard_device::translate(uint8_t row, uint8_t column)
|
||||
{
|
||||
uint8_t const modifiers(m_modifiers->read());
|
||||
|
||||
bool const ctrl(modifiers & 0x01);
|
||||
bool const shift(bool(modifiers & 0x02));
|
||||
unsigned const map(ctrl ? 2 : shift ? 1 : 0);
|
||||
uint8_t scancode = TRANSLATION_TABLE[map][row][column];
|
||||
|
||||
if ((scancode >= 0x61 && scancode <= 0x7a) && (modifiers & 0x04)) {
|
||||
scancode -= 0x20;
|
||||
}
|
||||
|
||||
return scancode;
|
||||
}
|
||||
|
||||
void hle_keyboard_device::scan_complete()
|
||||
{
|
||||
uint8_t gameport1 = m_gameport1->read();
|
||||
uint8_t gameport2 = m_gameport2->read();
|
||||
|
||||
if (gameport1 != m_prev_gameport1) {
|
||||
m_prev_gameport1 = gameport1;
|
||||
transmit_byte(0x80);
|
||||
transmit_byte(gameport1);
|
||||
}
|
||||
|
||||
if (gameport2 != m_prev_gameport2) {
|
||||
m_prev_gameport2 = gameport2;
|
||||
transmit_byte(0x81);
|
||||
transmit_byte(gameport2);
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
DEFINE_DEVICE_TYPE_PRIVATE(NABUPC_HLE_KEYBOARD, device_rs232_port_interface, hle_keyboard_device, "nabu_hle_keyboard", "NABU PC Keyboard (HLE)")
|
@ -1,19 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Brian Johnson
|
||||
/***************************************************************************
|
||||
|
||||
NABU PC HLE Keyboard Interface
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef MAME_BUS_NABU_KEYBOARD_HLE_H
|
||||
#define MAME_BUS_NABU_KEYBOARD_HLE_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "bus/rs232/rs232.h"
|
||||
|
||||
DECLARE_DEVICE_TYPE(NABUPC_HLE_KEYBOARD, device_rs232_port_interface)
|
||||
|
||||
#endif // MAME_BUS_NABU_KEYBOARD_HLE_H
|
@ -1,147 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Brian Johnson
|
||||
/*****************************************************************************
|
||||
* NABU PC Keyboard Interface
|
||||
*
|
||||
* 0x40 -> ctrl
|
||||
* 0x41 -> shift?
|
||||
* 0x42 -> caps?
|
||||
*
|
||||
* They keyboard also contains 4 read-only gameport registers with 0 meaning
|
||||
* the digital contact is set (Only two ports are populated)
|
||||
* 0x5000 - Port 1
|
||||
* 0x5100 - Port 2
|
||||
* 0x5200 - Port 3
|
||||
* 0x5300 - Port 4
|
||||
*
|
||||
* 7 6 5 4 3 2 1 0
|
||||
* ---------------------------------
|
||||
* | F | - | - | - | U | R | D | L |
|
||||
* --------------------------------
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
#include "cpu/m6800/m6801.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
class keyboard_device: public device_t, public device_rs232_port_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
keyboard_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual tiny_rom_entry const *device_rom_region() const override;
|
||||
private:
|
||||
void nabu_kb_mem(address_map &map);
|
||||
|
||||
uint8_t port1_r();
|
||||
void port1_w(uint8_t data);
|
||||
|
||||
uint8_t gameport_r(offs_t offset);
|
||||
|
||||
required_device<m6803_cpu_device> m_mcu;
|
||||
|
||||
uint8_t m_port1;
|
||||
uint8_t m_gameport[4];
|
||||
};
|
||||
|
||||
//**************************************************************************
|
||||
// KEYBOARD ROM
|
||||
//**************************************************************************
|
||||
|
||||
ROM_START(nabu_keyboard_rom)
|
||||
ROM_REGION( 0x800, "mcu", 0 )
|
||||
ROM_LOAD( "nabukeyboard-90020070-reva-2716.bin", 0x000, 0x800, CRC(eead3abc) SHA1(2f6ff63ca2f2ac90f3e03ef4f2b79883205e8a4e) )
|
||||
ROM_END
|
||||
|
||||
//**************************************************************************
|
||||
// KEYBOARD DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// keyboard_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
keyboard_device::keyboard_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, NABUPC_KEYBOARD, tag, owner, clock)
|
||||
, device_rs232_port_interface(mconfig, *this)
|
||||
, m_mcu(*this, "mcu")
|
||||
, m_port1(0)
|
||||
, m_gameport{ 0xff, 0xff, 0xff, 0xff }
|
||||
{
|
||||
}
|
||||
|
||||
void keyboard_device::device_start()
|
||||
{
|
||||
save_item(NAME(m_port1));
|
||||
save_item(NAME(m_gameport));
|
||||
}
|
||||
|
||||
void keyboard_device::device_reset()
|
||||
{
|
||||
m_port1 &= 0x7f;
|
||||
m_gameport[0] = 0xff;
|
||||
m_gameport[1] = 0xff;
|
||||
m_gameport[2] = 0xff;
|
||||
m_gameport[3] = 0xff;
|
||||
|
||||
output_rxd(1);
|
||||
}
|
||||
|
||||
void keyboard_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
M6803(config, m_mcu, XTAL(3'579'545)); // Crystal verified from schematics and visual inspection
|
||||
m_mcu->set_addrmap(AS_PROGRAM, &keyboard_device::nabu_kb_mem);
|
||||
m_mcu->in_p1_cb().set(FUNC(keyboard_device::port1_r));
|
||||
m_mcu->out_p1_cb().set(FUNC(keyboard_device::port1_w));
|
||||
m_mcu->out_ser_tx_cb().set(FUNC(keyboard_device::output_rxd));
|
||||
}
|
||||
|
||||
void keyboard_device::nabu_kb_mem(address_map &map)
|
||||
{
|
||||
map(0x5000, 0x5300).r(FUNC(keyboard_device::gameport_r));
|
||||
map(0xf800, 0xffff).rom().region("mcu", 0);
|
||||
}
|
||||
|
||||
const tiny_rom_entry *keyboard_device::device_rom_region() const
|
||||
{
|
||||
return ROM_NAME(nabu_keyboard_rom);
|
||||
}
|
||||
|
||||
uint8_t keyboard_device::port1_r()
|
||||
{
|
||||
return m_port1;
|
||||
}
|
||||
|
||||
void keyboard_device::port1_w(uint8_t data)
|
||||
{
|
||||
m_port1 = data & 0x7f;
|
||||
}
|
||||
|
||||
uint8_t keyboard_device::gameport_r(offs_t offset)
|
||||
{
|
||||
uint8_t port = (offset >> 8) & 0x03;
|
||||
return m_gameport[port];
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
DEFINE_DEVICE_TYPE_PRIVATE(NABUPC_KEYBOARD, device_rs232_port_interface, keyboard_device, "nabu_keyboard", "NABU PC keyboard")
|
@ -1,19 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Brian Johnson
|
||||
/***************************************************************************
|
||||
|
||||
NABU PC Keyboard Interface
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef MAME_BUS_NABUPC_KEYBOARD_H
|
||||
#define MAME_BUS_NABUPC_KEYBOARD_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "bus/rs232/rs232.h"
|
||||
|
||||
DECLARE_DEVICE_TYPE(NABUPC_KEYBOARD, device_rs232_port_interface)
|
||||
|
||||
#endif // MAME_BUS_NABUPC_KEYBOARD_H
|
@ -5,17 +5,15 @@
|
||||
*
|
||||
* https://nabu.ca/
|
||||
*
|
||||
* TODO:
|
||||
* - Original keyboard support
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
#include "nabupc_kbd.h"
|
||||
|
||||
#include "bus/centronics/ctronics.h"
|
||||
#include "bus/nabupc/adapter.h"
|
||||
#include "bus/nabupc/keyboard/hlekeyboard.h"
|
||||
#include "bus/nabupc/keyboard/keyboard.h"
|
||||
#include "bus/nabupc/option.h"
|
||||
#include "bus/rs232/null_modem.h"
|
||||
#include "bus/rs232/pty.h"
|
||||
@ -268,13 +266,6 @@ static void hcca_devices(device_slot_interface &device)
|
||||
device.option_add("hcca_adapter", NABUPC_NETWORK_ADAPTER);
|
||||
}
|
||||
|
||||
// Keyboard Devices
|
||||
static void keyboard_devices(device_slot_interface &device)
|
||||
{
|
||||
device.option_add("nabu", NABUPC_KEYBOARD);
|
||||
device.option_add("nabu_hle", NABUPC_HLE_KEYBOARD);
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// MACHINE CONFIGURATION
|
||||
//**************************************************************************
|
||||
@ -311,8 +302,8 @@ void nabupc_state::nabupc(machine_config &config)
|
||||
I8251(config, m_kbduart, 10.738635_MHz_XTAL / 6);
|
||||
m_kbduart->rxrdy_handler().set(*this, FUNC(nabupc_state::int_w<5>));
|
||||
|
||||
rs232_port_device &kbd(RS232_PORT(config, "kbd", keyboard_devices, "nabu"));
|
||||
kbd.rxd_handler().set(m_kbduart, FUNC(i8251_device::write_rxd));
|
||||
nabupc_keyboard_device &kbd(NABUPC_KEYBOARD(config, "kbd"));
|
||||
kbd.rxd_cb().set(m_kbduart, FUNC(i8251_device::write_rxd));
|
||||
|
||||
// HCCA
|
||||
AY31015(config, m_hccauart);
|
||||
|
351
src/mame/misc/nabupc_kbd.cpp
Normal file
351
src/mame/misc/nabupc_kbd.cpp
Normal file
@ -0,0 +1,351 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Brian Johnson
|
||||
/*****************************************************************************
|
||||
* NABU PC Keyboard Interface
|
||||
*
|
||||
* Matrix
|
||||
* | | Col 0 | Col 1 | Col 2 | Col 3 | Col 4 | Col 5 | Col 6 | Col 7 |
|
||||
* |-------|-------|-------|-------|-------|-------|-------|-------|-------|
|
||||
* | Row 0 | N/A | ESC | Right | P | W | R | I | ] |
|
||||
* | Row 1 | U | Q | Left | [ | E | T | O | DEL |
|
||||
* | Row 2 | 8 | 2 | Up | = | 4 | 6 | 0 | TV |
|
||||
* | Row 3 | 7 | 1 | Yes | - | 3 | 5 | 9 | PAUSE |
|
||||
* | Row 4 | G | TAB | No | L | A | D | J | ' |
|
||||
* | Row 5 | SPACE | X | <||| | / | V | N/A | , | SYM |
|
||||
* | Row 6 | N | C | |||> | . | B | Z | M | N/A |
|
||||
* | Row 7 | H | Y | Down | ; | S | F | K | GO |
|
||||
* |-------|-------|-------|-------|-------|-------|-------|-------|-------|
|
||||
* | Mod | Ctrl | Caps | Shift | N/A | N/A | N/A | N/A | N/A |
|
||||
*
|
||||
* Port 1 on the 6803 MCU is used to scan the keyboard matrix. The low six bits contain the row/col,
|
||||
* bit 6 is set when scanning the modifiers, and bit 7 is read to determine if the addressed key is pressed.
|
||||
*
|
||||
* 7 6 5 4 3 2 1 0
|
||||
* --------------------------------
|
||||
* | Pressed | Mod | Row | Col |
|
||||
* --------------------------------
|
||||
*
|
||||
* The modifier keys are handled internally by the keyboard and are never sent to the
|
||||
* computer.
|
||||
*
|
||||
* They keyboard also contains 4 read-only gameport registers with 0 meaning
|
||||
* the digital contact is set (Only two ports are populated)
|
||||
* * 0x5X00 - a read from these addresses reads the gameport data from port X (where X is 0-3)
|
||||
*
|
||||
* 7 6 5 4 3 2 1 0
|
||||
* ---------------------------------
|
||||
* | B | - | - | - | U | R | D | L |
|
||||
* --------------------------------
|
||||
*
|
||||
* The ADC is used to decode the analog paddle data on pins 5 and 9 of the gameports
|
||||
* * 0xBX00 - A write to these addresses latches the ADC address to the value of X (where X is 0-7)
|
||||
* * 0x7000 - A write to this address starts the conversion for the currently latched ADC address, an IRQ will trigger on EOC
|
||||
* * 0xD000 - A read from here will read the curently converted value from the ADC
|
||||
* * 0x9000 - a write to this address will acknowledge the EOC interrupt.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "nabupc_kbd.h"
|
||||
|
||||
|
||||
DEFINE_DEVICE_TYPE(NABUPC_KEYBOARD, nabupc_keyboard_device, "nabupc_keyboard", "NABU PC keyboard")
|
||||
|
||||
namespace {
|
||||
|
||||
//**************************************************************************
|
||||
// KEYBOARD ROM
|
||||
//**************************************************************************
|
||||
|
||||
ROM_START(nabu_keyboard_rom)
|
||||
ROM_REGION( 0x800, "mcu", 0 )
|
||||
ROM_LOAD( "nabukeyboard-90020070-reva-2716.bin", 0x000, 0x800, CRC(eead3abc) SHA1(2f6ff63ca2f2ac90f3e03ef4f2b79883205e8a4e) )
|
||||
ROM_END
|
||||
|
||||
//**************************************************************************
|
||||
// KEYBOARD PORTS
|
||||
//**************************************************************************
|
||||
|
||||
INPUT_PORTS_START( keyboard_ports )
|
||||
// Keyboard Matrix
|
||||
PORT_START("ROW0")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC) PORT_NAME("Esc") PORT_CHAR(UCHAR_MAMEKEY(ESC))
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right") PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_NAME("P") PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10)
|
||||
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_NAME("W") PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x17)
|
||||
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_NAME("R") PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12)
|
||||
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_NAME("I") PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x09)
|
||||
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_NAME("]") PORT_CHAR(']') PORT_CHAR('}') PORT_CHAR(0x1D)
|
||||
PORT_START("ROW1")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_NAME("U") PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15)
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_NAME("Q") PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x11)
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_NAME("Left") PORT_CHAR(UCHAR_MAMEKEY(LEFT))
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) PORT_NAME("[") PORT_CHAR('[') PORT_CHAR('{') PORT_CHAR(0x1B)
|
||||
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_NAME("E") PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05)
|
||||
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_NAME("T") PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x14)
|
||||
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_NAME("O") PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0F)
|
||||
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("Delete") PORT_CHAR(0x08)
|
||||
PORT_START("ROW2")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_NAME("8") PORT_CHAR('8') PORT_CHAR('*')
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_NAME("2") PORT_CHAR('2') PORT_CHAR('@') PORT_CHAR(0x00)
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_NAME("Up") PORT_CHAR(UCHAR_MAMEKEY(UP))
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_NAME("=") PORT_CHAR('=') PORT_CHAR('+')
|
||||
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_NAME("4") PORT_CHAR('4') PORT_CHAR('$')
|
||||
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_NAME("6") PORT_CHAR('6') PORT_CHAR('^') PORT_CHAR(0x1E)
|
||||
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_NAME("0") PORT_CHAR('0') PORT_CHAR(')')
|
||||
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_NAME("TV/NABU") PORT_CHAR(UCHAR_MAMEKEY(F3))
|
||||
PORT_START("ROW3")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_NAME("7") PORT_CHAR('7') PORT_CHAR('&')
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_NAME("1") PORT_CHAR('1') PORT_CHAR('!')
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_NAME("Yes") PORT_CHAR(UCHAR_MAMEKEY(F1))
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_NAME("-") PORT_CHAR('-') PORT_CHAR('_') PORT_CHAR(0x1F)
|
||||
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_NAME("3") PORT_CHAR('3') PORT_CHAR('#')
|
||||
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_NAME("5") PORT_CHAR('5') PORT_CHAR('%')
|
||||
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_NAME("9") PORT_CHAR('9') PORT_CHAR('(')
|
||||
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PAUSE) PORT_NAME("Pause") PORT_CHAR(UCHAR_MAMEKEY(PAUSE))
|
||||
PORT_START("ROW4")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_NAME("G") PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07)
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_NAME("Tab") PORT_CHAR(0x09)
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_NAME("No") PORT_CHAR(UCHAR_MAMEKEY(F2))
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_NAME("L") PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x0C)
|
||||
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_NAME("A") PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01)
|
||||
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_NAME("D") PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04)
|
||||
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_NAME("J") PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0A)
|
||||
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_NAME("'") PORT_CHAR('\'') PORT_CHAR('"')
|
||||
PORT_START("ROW5")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Space") PORT_CHAR(' ')
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_NAME("X") PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18)
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGUP) PORT_NAME("<|||") PORT_CHAR(UCHAR_MAMEKEY(PGUP))
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_NAME("/") PORT_CHAR('/') PORT_CHAR('?')
|
||||
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_NAME("V") PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x16)
|
||||
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
|
||||
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_NAME(",") PORT_CHAR(',') PORT_CHAR('<') PORT_CHAR(0x1C)
|
||||
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_NAME("SYM") PORT_CHAR(UCHAR_MAMEKEY(F4))
|
||||
PORT_START("ROW6")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_NAME("N") PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0E)
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_NAME("C") PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03)
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_PGDN) PORT_NAME("|||>") PORT_CHAR(UCHAR_MAMEKEY(PGDN))
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_NAME(".") PORT_CHAR('.') PORT_CHAR('>')
|
||||
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_NAME("B") PORT_CHAR('b') PORT_CHAR('B') PORT_CHAR(0x02)
|
||||
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_NAME("Z") PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x1A)
|
||||
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_NAME("M") PORT_CHAR('m') PORT_CHAR('M') PORT_CHAR(0x0D)
|
||||
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
|
||||
PORT_START("ROW7")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_NAME("H") PORT_CHAR('h') PORT_CHAR('H') PORT_CHAR(0x08)
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_NAME("Y") PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x19)
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("Down") PORT_CHAR(UCHAR_MAMEKEY(DOWN))
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_NAME(";") PORT_CHAR(';') PORT_CHAR(':')
|
||||
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_NAME("S") PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13)
|
||||
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) PORT_NAME("F") PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06)
|
||||
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_NAME("K") PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0B)
|
||||
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_NAME("Go") PORT_CHAR(0x0D)
|
||||
|
||||
PORT_START("MODIFIERS")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL) PORT_CODE(KEYCODE_RCONTROL) PORT_NAME("Control") PORT_CHAR(UCHAR_SHIFT_2)
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK) PORT_NAME("Caps Lock") PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_NAME("Shift") PORT_CHAR(UCHAR_SHIFT_1)
|
||||
PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
|
||||
PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
|
||||
PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
|
||||
PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
|
||||
PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
|
||||
|
||||
// Joystick Ports
|
||||
PORT_START("JOYSTICK1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_CODE(KEYCODE_4_PAD)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_CODE(KEYCODE_2_PAD)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_CODE(KEYCODE_6_PAD)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_CODE(KEYCODE_8_PAD)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CODE(KEYCODE_ENTER_PAD)
|
||||
PORT_START("JOYSTICK2")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_START("JOYSTICK3")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_START("JOYSTICK4")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(4) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(4) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(4) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(4) PORT_CODE(INPUT_CODE_INVALID)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) PORT_CODE(INPUT_CODE_INVALID)
|
||||
|
||||
// Analog Paddles
|
||||
PORT_START("PADDLE1")
|
||||
PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(1) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255) PORT_REVERSE PORT_CODE(INPUT_CODE_INVALID) PORT_CODE_DEC(INPUT_CODE_INVALID) PORT_CODE_INC(INPUT_CODE_INVALID) // pin 9
|
||||
PORT_START("PADDLE2")
|
||||
PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(2) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255) PORT_REVERSE PORT_CODE(INPUT_CODE_INVALID) PORT_CODE_DEC(INPUT_CODE_INVALID) PORT_CODE_INC(INPUT_CODE_INVALID) // pin 5
|
||||
PORT_START("PADDLE3")
|
||||
PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(3) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255) PORT_REVERSE PORT_CODE(INPUT_CODE_INVALID) PORT_CODE_DEC(INPUT_CODE_INVALID) PORT_CODE_INC(INPUT_CODE_INVALID) // pin 9
|
||||
PORT_START("PADDLE4")
|
||||
PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(4) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255) PORT_REVERSE PORT_CODE(INPUT_CODE_INVALID) PORT_CODE_DEC(INPUT_CODE_INVALID) PORT_CODE_INC(INPUT_CODE_INVALID) // pin 5
|
||||
PORT_START("PADDLE5")
|
||||
PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(5) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255) PORT_REVERSE PORT_CODE(INPUT_CODE_INVALID) PORT_CODE_DEC(INPUT_CODE_INVALID) PORT_CODE_INC(INPUT_CODE_INVALID) // pin 9
|
||||
PORT_START("PADDLE6")
|
||||
PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(6) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255) PORT_REVERSE PORT_CODE(INPUT_CODE_INVALID) PORT_CODE_DEC(INPUT_CODE_INVALID) PORT_CODE_INC(INPUT_CODE_INVALID) // pin 5
|
||||
PORT_START("PADDLE7")
|
||||
PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(7) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255) PORT_REVERSE PORT_CODE(INPUT_CODE_INVALID) PORT_CODE_DEC(INPUT_CODE_INVALID) PORT_CODE_INC(INPUT_CODE_INVALID) // pin 9
|
||||
PORT_START("PADDLE8")
|
||||
PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_PLAYER(8) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_MINMAX(0, 255) PORT_REVERSE PORT_CODE(INPUT_CODE_INVALID) PORT_CODE_DEC(INPUT_CODE_INVALID) PORT_CODE_INC(INPUT_CODE_INVALID) // pin 5
|
||||
INPUT_PORTS_END
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
//**************************************************************************
|
||||
// KEYBOARD DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// nabupc_keyboard_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
nabupc_keyboard_device::nabupc_keyboard_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, NABUPC_KEYBOARD, tag, owner, clock)
|
||||
, m_mcu(*this, "mcu")
|
||||
, m_adc(*this, "adc")
|
||||
, m_rxd_cb(*this)
|
||||
, m_modifiers(*this, "MODIFIERS")
|
||||
, m_keyboard(*this, "ROW%u", 0U)
|
||||
, m_gameport(*this, "JOYSTICK%u", 1U)
|
||||
, m_port1(0)
|
||||
, m_eoc(0)
|
||||
{
|
||||
}
|
||||
|
||||
void nabupc_keyboard_device::device_start()
|
||||
{
|
||||
m_rxd_cb.resolve_safe();
|
||||
|
||||
save_item(NAME(m_port1));
|
||||
save_item(NAME(m_eoc));
|
||||
}
|
||||
|
||||
void nabupc_keyboard_device::device_reset()
|
||||
{
|
||||
m_port1 &= 0x7f;
|
||||
m_rxd_cb(1);
|
||||
}
|
||||
|
||||
void nabupc_keyboard_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
M6803(config, m_mcu, 3.579545_MHz_XTAL); // Crystal verified from schematics and visual inspection
|
||||
m_mcu->set_addrmap(AS_PROGRAM, &nabupc_keyboard_device::nabu_kb_mem);
|
||||
m_mcu->in_p1_cb().set(FUNC(nabupc_keyboard_device::port1_r));
|
||||
m_mcu->out_p1_cb().set(FUNC(nabupc_keyboard_device::port1_w));
|
||||
m_mcu->out_ser_tx_cb().set(FUNC(nabupc_keyboard_device::ser_tx_w));
|
||||
|
||||
ADC0809(config, m_adc, 3.579545_MHz_XTAL / 4);
|
||||
m_adc->eoc_callback().set(FUNC(nabupc_keyboard_device::irq_w));
|
||||
m_adc->in_callback<0>().set_ioport("PADDLE1");
|
||||
m_adc->in_callback<1>().set_ioport("PADDLE2");
|
||||
m_adc->in_callback<2>().set_ioport("PADDLE3");
|
||||
m_adc->in_callback<3>().set_ioport("PADDLE4");
|
||||
m_adc->in_callback<4>().set_ioport("PADDLE5");
|
||||
m_adc->in_callback<5>().set_ioport("PADDLE6");
|
||||
m_adc->in_callback<6>().set_ioport("PADDLE7");
|
||||
m_adc->in_callback<7>().set_ioport("PADDLE8");
|
||||
}
|
||||
|
||||
void nabupc_keyboard_device::nabu_kb_mem(address_map &map)
|
||||
{
|
||||
map(0x5000, 0x5300).r(FUNC(nabupc_keyboard_device::gameport_r));
|
||||
map(0x7000, 0x7000).w(FUNC(nabupc_keyboard_device::adc_start_w));
|
||||
map(0x9000, 0x9000).w(FUNC(nabupc_keyboard_device::cpu_ack_irq_w));
|
||||
map(0xb000, 0xb700).w(FUNC(nabupc_keyboard_device::adc_latch_w));
|
||||
map(0xd000, 0xd000).r(m_adc, FUNC(adc0809_device::data_r));
|
||||
map(0xf800, 0xffff).rom().region("mcu", 0);
|
||||
}
|
||||
|
||||
const tiny_rom_entry *nabupc_keyboard_device::device_rom_region() const
|
||||
{
|
||||
return ROM_NAME(nabu_keyboard_rom);
|
||||
}
|
||||
|
||||
ioport_constructor nabupc_keyboard_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME( keyboard_ports );
|
||||
}
|
||||
|
||||
uint8_t nabupc_keyboard_device::port1_r()
|
||||
{
|
||||
uint8_t data;
|
||||
uint8_t column_mask = 1 << (m_port1 & 7);
|
||||
uint8_t row = (m_port1 >> 3) & 7;
|
||||
|
||||
if (m_port1 & 0x40) {
|
||||
data = m_modifiers->read();
|
||||
} else {
|
||||
data = m_keyboard[row]->read();
|
||||
}
|
||||
|
||||
if (data & column_mask) {
|
||||
return 0x80 | m_port1;
|
||||
}
|
||||
|
||||
return m_port1;
|
||||
}
|
||||
|
||||
void nabupc_keyboard_device::port1_w(uint8_t data)
|
||||
{
|
||||
m_port1 = data & 0x7f;
|
||||
}
|
||||
|
||||
void nabupc_keyboard_device::irq_w(uint8_t data)
|
||||
{
|
||||
if (data && !m_eoc) {
|
||||
m_mcu->set_input_line(0, ASSERT_LINE);
|
||||
}
|
||||
m_eoc = data;
|
||||
}
|
||||
|
||||
uint8_t nabupc_keyboard_device::gameport_r(offs_t offset)
|
||||
{
|
||||
uint8_t port = (offset >> 8) & 0x03;
|
||||
return m_gameport[port]->read();
|
||||
}
|
||||
|
||||
void nabupc_keyboard_device::adc_latch_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
uint8_t addr = (offset >> 8) & 0x07;
|
||||
m_adc->address_w(addr);
|
||||
}
|
||||
|
||||
void nabupc_keyboard_device::adc_start_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
m_adc->start_w(1);
|
||||
m_adc->start_w(0);
|
||||
}
|
||||
|
||||
void nabupc_keyboard_device::cpu_ack_irq_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
m_mcu->set_input_line(0, CLEAR_LINE);
|
||||
}
|
||||
|
||||
void nabupc_keyboard_device::ser_tx_w(uint8_t data)
|
||||
{
|
||||
m_rxd_cb(data & 1);
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
67
src/mame/misc/nabupc_kbd.h
Normal file
67
src/mame/misc/nabupc_kbd.h
Normal file
@ -0,0 +1,67 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Brian Johnson
|
||||
/***************************************************************************
|
||||
|
||||
NABU PC Keyboard Interface
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef MAME_NABUPC_KEYBOARD_DEVICE_H
|
||||
#define MAME_NABUPC_KEYBOARD_DEVICE_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cpu/m6800/m6801.h"
|
||||
#include "machine/adc0808.h"
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
class nabupc_keyboard_device: public device_t
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
nabupc_keyboard_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0);
|
||||
|
||||
auto rxd_cb() { return m_rxd_cb.bind(); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
// optional information overrides
|
||||
virtual tiny_rom_entry const *device_rom_region() const override;
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
private:
|
||||
void nabu_kb_mem(address_map &map);
|
||||
|
||||
uint8_t port1_r();
|
||||
void port1_w(uint8_t data);
|
||||
|
||||
void irq_w(uint8_t data);
|
||||
|
||||
uint8_t gameport_r(offs_t offset);
|
||||
void adc_latch_w(offs_t offset, uint8_t data);
|
||||
void adc_start_w(offs_t offset, uint8_t data);
|
||||
void cpu_ack_irq_w(offs_t offset, uint8_t data);
|
||||
void ser_tx_w(uint8_t data);
|
||||
|
||||
required_device<m6803_cpu_device> m_mcu;
|
||||
required_device<adc0809_device> m_adc;
|
||||
devcb_write_line m_rxd_cb;
|
||||
|
||||
required_ioport m_modifiers;
|
||||
required_ioport_array<8> m_keyboard;
|
||||
required_ioport_array<4> m_gameport;
|
||||
|
||||
uint8_t m_port1;
|
||||
uint8_t m_eoc;
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(NABUPC_KEYBOARD, nabupc_keyboard_device)
|
||||
|
||||
#endif // MAME_NABUPC_KEYBOARD_DEVICE_H
|
Loading…
Reference in New Issue
Block a user