eurit30: Add preliminary inputs

This commit is contained in:
AJR 2020-05-14 18:07:30 -04:00
parent 5b09aec8b8
commit 4b654dc9c0

View File

@ -19,21 +19,37 @@ public:
eurit_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_keys(*this, "KEY%c", 'A')
, m_key_scan(0x1f)
{
}
void eurit30(machine_config &mconfig);
protected:
virtual void machine_start() override;
private:
HD44780_PIXEL_UPDATE(lcd_pixel_update);
void key_scan_w(u8 data);
u8 key_matrix_r();
void mem_map(address_map &map);
void palette_init(palette_device &palette);
required_device<m37730s2_device> m_maincpu;
required_ioport_array<5> m_keys;
u8 m_key_scan;
};
void eurit_state::machine_start()
{
save_item(NAME(m_key_scan));
}
HD44780_PIXEL_UPDATE(eurit_state::lcd_pixel_update)
{
if (x < 5 && y < 8 && line < 2 && pos < 20)
@ -41,6 +57,22 @@ HD44780_PIXEL_UPDATE(eurit_state::lcd_pixel_update)
}
void eurit_state::key_scan_w(u8 data)
{
m_key_scan = data >> 3;
}
u8 eurit_state::key_matrix_r()
{
u8 ret = 0xff;
for (int i = 0; i < 5; i++)
if (!BIT(m_key_scan, i))
ret &= m_keys[i]->read();
return ret;
}
void eurit_state::mem_map(address_map &map)
{
map(0x000480, 0x007fff).ram(); // probably NVRAM (0x000480 counts seconds for software RTC)
@ -51,6 +83,55 @@ void eurit_state::mem_map(address_map &map)
static INPUT_PORTS_START(eurit30)
PORT_START("KEYA")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Unknown Key A0")
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Unknown Key A1")
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("#") PORT_CODE(KEYCODE_EQUALS)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("0 0...9") PORT_CODE(KEYCODE_0)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("*") PORT_CODE(KEYCODE_MINUS)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("ESC") PORT_CODE(KEYCODE_BACKSPACE)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Unknown Key A7") // phone off hook?
PORT_START("KEYB")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Z2") PORT_CODE(KEYCODE_X)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Menu") PORT_CODE(KEYCODE_ENTER)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("9 YZ") PORT_CODE(KEYCODE_9)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("8 VWX") PORT_CODE(KEYCODE_8)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("7 STU") PORT_CODE(KEYCODE_7)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Unknown Key B5")
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("MIC") PORT_CODE(KEYCODE_M)
PORT_START("KEYC")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Z6") PORT_CODE(KEYCODE_N)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Z3") PORT_CODE(KEYCODE_C)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("6 PQR") PORT_CODE(KEYCODE_6)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("5 MNO") PORT_CODE(KEYCODE_5)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("4 JKL") PORT_CODE(KEYCODE_4)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Unknown Key C5")
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Unknown Key C6")
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Unknown Key C7")
PORT_START("KEYD")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Z4") PORT_CODE(KEYCODE_V)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Z5") PORT_CODE(KEYCODE_B)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("3 GHI") PORT_CODE(KEYCODE_3)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("2 DEF") PORT_CODE(KEYCODE_2)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("1 ABC") PORT_CODE(KEYCODE_1)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Unknown Key D5")
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Unknown Key D6")
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Unknown Key D7")
PORT_START("KEYE")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Unknown Key E0")
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Fox Key Next to Left") PORT_CODE(KEYCODE_S)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Unknown Key E2")
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Fox Key Next to Right") PORT_CODE(KEYCODE_F)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Fox Key Right") PORT_CODE(KEYCODE_G)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Fox Key Center") PORT_CODE(KEYCODE_D)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Fox Key Left") PORT_CODE(KEYCODE_A)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("Z1") PORT_CODE(KEYCODE_Z)
INPUT_PORTS_END
void eurit_state::palette_init(palette_device &palette)
@ -65,6 +146,8 @@ void eurit_state::eurit30(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &eurit_state::mem_map);
m_maincpu->p4_in_cb().set("lcdc", FUNC(hd44780_device::db_r)); // not actually used for input?
m_maincpu->p4_out_cb().set("lcdc", FUNC(hd44780_device::db_w));
m_maincpu->p4_out_cb().append(FUNC(eurit_state::key_scan_w));
m_maincpu->p5_in_cb().set(FUNC(eurit_state::key_matrix_r));
m_maincpu->p6_out_cb().set("lcdc", FUNC(hd44780_device::e_w)).bit(6);
m_maincpu->p6_out_cb().append("lcdc", FUNC(hd44780_device::rw_w)).bit(5); // not actually used for read mode?
m_maincpu->p6_out_cb().append("lcdc", FUNC(hd44780_device::rs_w)).bit(4);
@ -94,4 +177,4 @@ ROM_START(eurit30)
ROM_END
SYST(1996, eurit30, 0, 0, eurit30, eurit30, eurit_state, empty_init, "Ascom", "Eurit 30", MACHINE_IS_SKELETON)
SYST(1996, eurit30, 0, 0, eurit30, eurit30, eurit_state, empty_init, "Ascom", "Eurit 30", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_SOUND)