mirror of
https://github.com/holub/mame
synced 2025-04-16 05:24:54 +03:00
cit220p: Emulate serial keyboard, hooking up MCU and identifying most keys
This commit is contained in:
parent
712bd80fe6
commit
5cf1925789
@ -2003,6 +2003,8 @@ files {
|
||||
MAME_DIR .. "src/mame/machine/cit101_kbd.cpp",
|
||||
MAME_DIR .. "src/mame/machine/cit101_kbd.h",
|
||||
MAME_DIR .. "src/mame/drivers/cit220.cpp",
|
||||
MAME_DIR .. "src/mame/machine/cit220_kbd.cpp",
|
||||
MAME_DIR .. "src/mame/machine/cit220_kbd.h",
|
||||
}
|
||||
|
||||
createMESSProjects(_target, _subtarget, "coleco")
|
||||
|
@ -15,7 +15,7 @@ and the SCN2674 video timing parameters appear to be identical.
|
||||
#include "emu.h"
|
||||
//#include "bus/rs232/rs232.h"
|
||||
#include "cpu/i8085/i8085.h"
|
||||
#include "cpu/mcs48/mcs48.h"
|
||||
#include "machine/cit220_kbd.h"
|
||||
//#include "machine/eeprompar.h"
|
||||
#include "machine/i8251.h"
|
||||
#include "machine/mc68681.h"
|
||||
@ -52,8 +52,6 @@ private:
|
||||
void vp122_io_map(address_map &map);
|
||||
void char_map(address_map &map);
|
||||
void attr_map(address_map &map);
|
||||
void keyboard_map(address_map &map);
|
||||
void kbd_io_map(address_map &map);
|
||||
|
||||
required_device<i8085a_cpu_device> m_maincpu;
|
||||
required_device<screen_device> m_screen;
|
||||
@ -130,6 +128,10 @@ SCN2674_DRAW_CHARACTER_MEMBER(cit220_state::draw_character)
|
||||
|
||||
if (BIT(dots, 2))
|
||||
dots |= 3;
|
||||
if (BIT(attrcode, 2))
|
||||
dots = ~dots;
|
||||
if (cursor)
|
||||
dots = ~dots;
|
||||
|
||||
for (int i = 0; i < width; i++)
|
||||
{
|
||||
@ -148,15 +150,6 @@ void cit220_state::attr_map(address_map &map)
|
||||
map(0x0000, 0x2fff).ram();
|
||||
}
|
||||
|
||||
void cit220_state::keyboard_map(address_map &map)
|
||||
{
|
||||
map(0x000, 0xfff).rom().region("keyboard", 0);
|
||||
}
|
||||
|
||||
void cit220_state::kbd_io_map(address_map &map)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static INPUT_PORTS_START( cit220p )
|
||||
INPUT_PORTS_END
|
||||
@ -184,15 +177,15 @@ void cit220_state::cit220p(machine_config &config)
|
||||
|
||||
scn2681_device &duart(SCN2681(config, "duart", 3'686'400));
|
||||
duart.irq_cb().set_inputline("maincpu", I8085_RST55_LINE);
|
||||
duart.outport_cb().set("usart", FUNC(i8251_device::write_txc)).bit(3); // 9600 baud?
|
||||
duart.outport_cb().set("usart", FUNC(i8251_device::write_txc)).bit(3);
|
||||
duart.outport_cb().append("usart", FUNC(i8251_device::write_rxc)).bit(3);
|
||||
duart.outport_cb().append(FUNC(cit220_state::cols_w)).bit(7);
|
||||
|
||||
I8251(config, "usart", 4'000'000);
|
||||
i8251_device &usart(I8251(config, "usart", 4'000'000));
|
||||
usart.txd_handler().set("keyboard", FUNC(cit220p_keyboard_device::write_rxd));
|
||||
|
||||
mcs48_cpu_device &kbdmcu(I8035(config, "kbdmcu", 4'608'000));
|
||||
kbdmcu.set_addrmap(AS_PROGRAM, &cit220_state::keyboard_map);
|
||||
kbdmcu.set_addrmap(AS_IO, &cit220_state::kbd_io_map);
|
||||
cit220p_keyboard_device &keyboard(CIT220P_KEYBOARD(config, "keyboard"));
|
||||
keyboard.txd_callback().set("usart", FUNC(i8251_device::write_rxd));
|
||||
}
|
||||
|
||||
void cit220_state::vp122(machine_config &config)
|
||||
@ -224,7 +217,7 @@ void cit220_state::vp122(machine_config &config)
|
||||
|
||||
I8251(config, "usart", 8_MHz_XTAL / 2);
|
||||
|
||||
PIT8253(config, "pit", 0);
|
||||
PIT8253(config, "pit");
|
||||
// Input clocks are video-related and should differ for 80-column and 132-column modes
|
||||
}
|
||||
|
||||
@ -239,9 +232,6 @@ ROM_START( cit220p )
|
||||
|
||||
ROM_REGION(0x1000, "chargen", 0)
|
||||
ROM_LOAD( "v20_cg.ic17", 0x0000, 0x1000, CRC(76ef7ca9) SHA1(6e7799ca0a41350fbc369bbbd4ab581150f37b10) )
|
||||
|
||||
ROM_REGION(0x1000, "keyboard", 0)
|
||||
ROM_LOAD( "v00_kbd.bin", 0x0000, 0x1000, CRC(f9d24190) SHA1(c4e9ef8188afb18de373f2a537ca9b7a315bfb76) )
|
||||
ROM_END
|
||||
|
||||
/**************************************************************************************************************
|
||||
@ -262,5 +252,5 @@ ROM_START( vp122 )
|
||||
ROM_LOAD( "223-48700.uk4", 0x0000, 0x2000, CRC(4dbab4bd) SHA1(18e9a23ba22e2096fa529541fa329f5a56740e62) )
|
||||
ROM_END
|
||||
|
||||
COMP(1984, cit220p, 0, 0, cit220p, cit220p, cit220_state, empty_init, "C. Itoh Electronics", "CIT-220+ Video Terminal", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND)
|
||||
COMP(1984, cit220p, 0, 0, cit220p, cit220p, cit220_state, empty_init, "C. Itoh Electronics", "CIT-220+ Video Terminal", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND)
|
||||
COMP(1985, vp122, 0, 0, vp122, cit220p, cit220_state, empty_init, "ADDS", "Viewpoint 122", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND)
|
||||
|
259
src/mame/machine/cit220_kbd.cpp
Normal file
259
src/mame/machine/cit220_kbd.cpp
Normal file
@ -0,0 +1,259 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:AJR
|
||||
/**********************************************************************
|
||||
|
||||
CIT-220+ keyboard
|
||||
|
||||
This uses more or less the same protocol as the CIT-101 keyboard:
|
||||
alternating asynchronous serial communication at 4800 baud. In
|
||||
this case, however, the scancodes are translated by the host
|
||||
(though letters and digits use ASCII codes by coincidence).
|
||||
|
||||
The Lock key is programmable as either Caps Lock or Shift Lock.
|
||||
|
||||
TODO: figure out what the remaining two dozen keys are
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "cit220_kbd.h"
|
||||
|
||||
#include "speaker.h"
|
||||
|
||||
//**************************************************************************
|
||||
// LLE KEYBOARD DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
DEFINE_DEVICE_TYPE(CIT220P_KEYBOARD, cit220p_keyboard_device, "cit220p_kbd", "CIT-220+ Keyboard")
|
||||
|
||||
cit220p_keyboard_device::cit220p_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
|
||||
: device_t(mconfig, CIT220P_KEYBOARD, tag, owner, clock)
|
||||
, m_mcu(*this, "mcu")
|
||||
, m_beeper(*this, "beeper")
|
||||
, m_rows(*this, "ROW%X", 0U)
|
||||
, m_modifiers(*this, "MODIFIERS")
|
||||
, m_txd_callback(*this)
|
||||
{
|
||||
}
|
||||
|
||||
void cit220p_keyboard_device::device_resolve_objects()
|
||||
{
|
||||
m_txd_callback.resolve_safe();
|
||||
}
|
||||
|
||||
void cit220p_keyboard_device::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(cit220p_keyboard_device::write_rxd)
|
||||
{
|
||||
m_mcu->set_input_line(MCS48_INPUT_IRQ, state ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
||||
u8 cit220p_keyboard_device::mcu_bus_r()
|
||||
{
|
||||
u16 scan = m_mcu->p1_r() | (m_mcu->p2_r() ^ 0x10) << 8;
|
||||
u8 ret = 0xff;
|
||||
|
||||
for (int i = 0; i < 13; i++)
|
||||
if (!BIT(scan, i))
|
||||
ret &= m_rows[i]->read();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
u8 cit220p_keyboard_device::mcu_p2_r()
|
||||
{
|
||||
return BIT(m_modifiers->read(), 1) ? 0xff : 0xbf;
|
||||
}
|
||||
|
||||
void cit220p_keyboard_device::mcu_p2_w(u8 data)
|
||||
{
|
||||
m_beeper->set_state(BIT(data, 5));
|
||||
m_txd_callback(!BIT(data, 7));
|
||||
}
|
||||
|
||||
void cit220p_keyboard_device::mcu_movx_w(u8 data)
|
||||
{
|
||||
// TODO: LEDs?
|
||||
}
|
||||
|
||||
void cit220p_keyboard_device::prog_map(address_map &map)
|
||||
{
|
||||
map(0x000, 0xfff).rom().region("program", 0);
|
||||
}
|
||||
|
||||
void cit220p_keyboard_device::ext_map(address_map &map)
|
||||
{
|
||||
map(0x00, 0x00).mirror(0xff).w(FUNC(cit220p_keyboard_device::mcu_movx_w));
|
||||
}
|
||||
|
||||
|
||||
INPUT_PORTS_START(cit220p_keyboard)
|
||||
PORT_START("MODIFIERS") // Shift keys might be the other way around
|
||||
PORT_BIT(1, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CHAR(UCHAR_SHIFT_2) PORT_CODE(KEYCODE_LCONTROL)
|
||||
PORT_BIT(2, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Left Shift") PORT_CHAR(UCHAR_SHIFT_1) PORT_CODE(KEYCODE_LSHIFT)
|
||||
PORT_BIT(4, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Right Shift") PORT_CODE(KEYCODE_RSHIFT)
|
||||
|
||||
PORT_START("ROW0")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 0, Key 0")
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 0, Key 1")
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Set-Up") PORT_CHAR(UCHAR_MAMEKEY(F3)) PORT_CODE(KEYCODE_F3)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 0, Key 3")
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 0, Key 4")
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 0, Key 5")
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 0, Key 6")
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 0, Key 7")
|
||||
|
||||
PORT_START("ROW1")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back Space") PORT_CHAR(0x08) PORT_CODE(KEYCODE_BACKSPACE)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Tab") PORT_CHAR(0x09) PORT_CODE(KEYCODE_TAB)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line Feed") PORT_CHAR(0x0a) PORT_CODE(KEYCODE_RALT)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 1, Key 3")
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 1, Key 4")
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CHAR(0x0d) PORT_CODE(KEYCODE_ENTER)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 1, Key 6")
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 1, Key 7")
|
||||
|
||||
PORT_START("ROW2")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD)) PORT_CODE(KEYCODE_0_PAD)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD)) PORT_CODE(KEYCODE_1_PAD)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD)) PORT_CODE(KEYCODE_2_PAD)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD)) PORT_CODE(KEYCODE_3_PAD)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD)) PORT_CODE(KEYCODE_4_PAD)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD)) PORT_CODE(KEYCODE_5_PAD)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD)) PORT_CODE(KEYCODE_6_PAD)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD)) PORT_CODE(KEYCODE_7_PAD)
|
||||
|
||||
PORT_START("ROW3")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD)) PORT_CODE(KEYCODE_8_PAD)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD)) PORT_CODE(KEYCODE_9_PAD)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF1") PORT_CODE(KEYCODE_NUMLOCK)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF2") PORT_CODE(KEYCODE_EQUALS_PAD)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF3") PORT_CODE(KEYCODE_SLASH_PAD)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("PF4") PORT_CODE(KEYCODE_ASTERISK)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD)) PORT_CODE(KEYCODE_MINUS_PAD)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(COMMA_PAD)) PORT_CODE(KEYCODE_PLUS_PAD)
|
||||
|
||||
PORT_START("ROW4")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD)) PORT_CODE(KEYCODE_ENTER_PAD)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD)) PORT_CODE(KEYCODE_DEL_PAD)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Esc") PORT_CHAR(0x1b) PORT_CODE(KEYCODE_ESC)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space Bar") PORT_CHAR(0x20) PORT_CODE(KEYCODE_SPACE)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 4, Key 4")
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 4, Key 5")
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 4, Key 6")
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 4, Key 7")
|
||||
|
||||
PORT_START("ROW5")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('`') PORT_CHAR('~') PORT_CODE(KEYCODE_TILDE)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('-') PORT_CHAR('_') PORT_CODE(KEYCODE_MINUS)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('=') PORT_CHAR('+') PORT_CODE(KEYCODE_EQUALS)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(';') PORT_CHAR(':') PORT_CODE(KEYCODE_COLON)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('\'') PORT_CHAR('"') PORT_CODE(KEYCODE_QUOTE)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('<') PORT_CHAR('>') PORT_CODE(KEYCODE_BACKSLASH2)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(',') PORT_CODE(KEYCODE_COMMA)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('.') PORT_CODE(KEYCODE_STOP)
|
||||
|
||||
PORT_START("ROW6")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('0') PORT_CHAR(')') PORT_CODE(KEYCODE_0)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('1') PORT_CHAR('!') PORT_CODE(KEYCODE_1)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('2') PORT_CHAR('@') PORT_CODE(KEYCODE_2)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('3') PORT_CHAR('#') PORT_CODE(KEYCODE_3)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('4') PORT_CHAR('$') PORT_CODE(KEYCODE_4)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('5') PORT_CHAR('%') PORT_CODE(KEYCODE_5)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('6') PORT_CHAR('^') PORT_CODE(KEYCODE_6)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('7') PORT_CHAR('&') PORT_CODE(KEYCODE_7)
|
||||
|
||||
PORT_START("ROW7")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('8') PORT_CHAR('*') PORT_CODE(KEYCODE_8)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('9') PORT_CHAR('(') PORT_CODE(KEYCODE_9)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 7, Key 2")
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 7, Key 3")
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 7, Key 4")
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Lock") PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_CODE(KEYCODE_CAPSLOCK)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Compose Character") PORT_CHAR(UCHAR_MAMEKEY(LALT)) PORT_CODE(KEYCODE_LALT)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('/') PORT_CHAR('?') PORT_CODE(KEYCODE_SLASH)
|
||||
|
||||
PORT_START("ROW8")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row 8, Key 0")
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('a') PORT_CHAR('A') PORT_CODE(KEYCODE_A)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('b') PORT_CHAR('B') PORT_CODE(KEYCODE_B)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('c') PORT_CHAR('C') PORT_CODE(KEYCODE_C)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('d') PORT_CHAR('D') PORT_CODE(KEYCODE_D)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('e') PORT_CHAR('E') PORT_CODE(KEYCODE_E)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('f') PORT_CHAR('F') PORT_CODE(KEYCODE_F)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('g') PORT_CHAR('G') PORT_CODE(KEYCODE_G)
|
||||
|
||||
PORT_START("ROW9")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('h') PORT_CHAR('H') PORT_CODE(KEYCODE_H)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('i') PORT_CHAR('I') PORT_CODE(KEYCODE_I)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('j') PORT_CHAR('J') PORT_CODE(KEYCODE_J)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('k') PORT_CHAR('K') PORT_CODE(KEYCODE_K)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('l') PORT_CHAR('L') PORT_CODE(KEYCODE_L)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('m') PORT_CHAR('M') PORT_CODE(KEYCODE_M)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('n') PORT_CHAR('N') PORT_CODE(KEYCODE_N)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('o') PORT_CHAR('O') PORT_CODE(KEYCODE_O)
|
||||
|
||||
PORT_START("ROWA")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('p') PORT_CHAR('P') PORT_CODE(KEYCODE_P)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('q') PORT_CHAR('Q') PORT_CODE(KEYCODE_Q)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('r') PORT_CHAR('R') PORT_CODE(KEYCODE_R)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('s') PORT_CHAR('S') PORT_CODE(KEYCODE_S)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('t') PORT_CHAR('T') PORT_CODE(KEYCODE_T)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('u') PORT_CHAR('U') PORT_CODE(KEYCODE_U)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('v') PORT_CHAR('V') PORT_CODE(KEYCODE_V)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('w') PORT_CHAR('W') PORT_CODE(KEYCODE_W)
|
||||
|
||||
PORT_START("ROWB")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('x') PORT_CHAR('X') PORT_CODE(KEYCODE_X)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('y') PORT_CHAR('Y') PORT_CODE(KEYCODE_Y)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('z') PORT_CHAR('Z') PORT_CODE(KEYCODE_Z)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('[') PORT_CHAR('{') PORT_CODE(KEYCODE_OPENBRACE)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('\\') PORT_CHAR('|') PORT_CODE(KEYCODE_BACKSLASH)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(']') PORT_CHAR('}') PORT_CODE(KEYCODE_CLOSEBRACE)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row B, Key 6")
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row B, Key 7")
|
||||
|
||||
PORT_START("ROWC")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row C, Key 0")
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row C, Key 1")
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Row C, Key 2")
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(UP)) PORT_CODE(KEYCODE_UP)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(LEFT)) PORT_CODE(KEYCODE_LEFT)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_CODE(KEYCODE_DOWN)
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) PORT_CODE(KEYCODE_RIGHT)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
INPUT_PORTS_END
|
||||
|
||||
ioport_constructor cit220p_keyboard_device::device_input_ports() const
|
||||
{
|
||||
return INPUT_PORTS_NAME(cit220p_keyboard);
|
||||
}
|
||||
|
||||
void cit220p_keyboard_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
I8035(config, m_mcu, 2376000); // type and clock guessed
|
||||
m_mcu->set_addrmap(AS_PROGRAM, &cit220p_keyboard_device::prog_map);
|
||||
m_mcu->set_addrmap(AS_IO, &cit220p_keyboard_device::ext_map);
|
||||
m_mcu->bus_in_cb().set(FUNC(cit220p_keyboard_device::mcu_bus_r));
|
||||
m_mcu->p2_in_cb().set(FUNC(cit220p_keyboard_device::mcu_p2_r));
|
||||
m_mcu->p2_out_cb().set(FUNC(cit220p_keyboard_device::mcu_p2_w));
|
||||
m_mcu->t0_in_cb().set_ioport("MODIFIERS").bit(2);
|
||||
m_mcu->t1_in_cb().set_ioport("MODIFIERS").bit(0);
|
||||
|
||||
SPEAKER(config, "mono").front_center();
|
||||
BEEP(config, m_beeper, 1000).add_route(ALL_OUTPUTS, "mono", 1.0); // unknown frequency
|
||||
}
|
||||
|
||||
|
||||
ROM_START(cit220p_kbd)
|
||||
ROM_REGION(0x1000, "program", 0)
|
||||
ROM_LOAD("v00_kbd.bin", 0x0000, 0x1000, CRC(f9d24190) SHA1(c4e9ef8188afb18de373f2a537ca9b7a315bfb76))
|
||||
ROM_END
|
||||
|
||||
const tiny_rom_entry *cit220p_keyboard_device::device_rom_region() const
|
||||
{
|
||||
return ROM_NAME(cit220p_kbd);
|
||||
}
|
63
src/mame/machine/cit220_kbd.h
Normal file
63
src/mame/machine/cit220_kbd.h
Normal file
@ -0,0 +1,63 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:AJR
|
||||
|
||||
#ifndef MAME_MACHINE_CIT220_KBD_H
|
||||
#define MAME_MACHINE_CIT220_KBD_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cpu/mcs48/mcs48.h"
|
||||
#include "sound/beep.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// ======================> cit220p_keyboard_device
|
||||
|
||||
class cit220p_keyboard_device : public device_t
|
||||
{
|
||||
public:
|
||||
// device type constructor
|
||||
cit220p_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
|
||||
|
||||
// callback configuration
|
||||
auto txd_callback() { return m_txd_callback.bind(); }
|
||||
|
||||
// serial line input
|
||||
DECLARE_WRITE_LINE_MEMBER(write_rxd);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_resolve_objects() override;
|
||||
virtual void device_start() override;
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
||||
private:
|
||||
// MCU handlers
|
||||
u8 mcu_bus_r();
|
||||
u8 mcu_p2_r();
|
||||
void mcu_p2_w(u8 data);
|
||||
void mcu_movx_w(u8 data);
|
||||
|
||||
// address maps
|
||||
void prog_map(address_map &map);
|
||||
void ext_map(address_map &map);
|
||||
|
||||
// object finders
|
||||
required_device<mcs48_cpu_device> m_mcu;
|
||||
required_device<beep_device> m_beeper;
|
||||
required_ioport_array<13> m_rows;
|
||||
required_ioport m_modifiers;
|
||||
|
||||
// output callback
|
||||
devcb_write_line m_txd_callback;
|
||||
};
|
||||
|
||||
// device type declaration
|
||||
DECLARE_DEVICE_TYPE(CIT220P_KEYBOARD, cit220p_keyboard_device)
|
||||
|
||||
#endif // MAME_MACHINE_CIT220_KBD_H
|
Loading…
Reference in New Issue
Block a user