summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine/naomi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/machine/naomi.cpp')
-rw-r--r--src/mame/machine/naomi.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/mame/machine/naomi.cpp b/src/mame/machine/naomi.cpp
index 477cd889962..dcaf49d86ac 100644
--- a/src/mame/machine/naomi.cpp
+++ b/src/mame/machine/naomi.cpp
@@ -229,6 +229,7 @@ INPUT_CHANGED_MEMBER(naomi_state::naomi_mp_w)
{
m_mp_mux = newval;
}
+
CUSTOM_INPUT_MEMBER(naomi_state::naomi_mp_r)
{
const char *tagptr = (const char *)param;
@@ -247,6 +248,39 @@ CUSTOM_INPUT_MEMBER(naomi_state::naomi_mp_r)
return retval;
}
+CUSTOM_INPUT_MEMBER(naomi_state::naomi_kb_r)
+{
+ // TODO: player 2 input reading
+// const int *tagptr = (const int *)param;
+ uint8_t retval = 0;
+ static const char *const keynames[] =
+ {
+ "P1.ROW0", "P1.ROW1", "P1.ROW2", "P1.ROW3", "P1.ROW4"
+ };
+
+ for(int i=0;i<5;i++)
+ {
+ uint32_t row;
+
+ // read the current row
+ row = ioport(keynames[i])->read();
+
+ // if anything is pressed, convert the 32-bit raw value to keycode
+ if(row != 0)
+ {
+ // base value x20
+ retval = i * 0x20;
+ for(int j=0;j<32;j++)
+ {
+ if(row & 1 << j)
+ return retval + j;
+ }
+ }
+ }
+
+ return retval;
+}
+
void naomi_state::init_naomi_mp()
{
//m_maincpu->space(AS_PROGRAM).install_read_handler(0xc2ad238, 0xc2ad23f, read64_delegate(FUNC(naomi_state::naomi_biose_idle_skip_r),this); // rev e bios