From 01c02ac4b87757e5aa9874553732206c44ede620 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Sun, 14 Dec 2014 20:38:27 +0100 Subject: [PATCH] SMPC: added crude repeat key support in keyboard handling, makes typing more comfortable [Angelo Salese] --- src/emu/cpu/sh2/sh2comn.c | 3 ++- src/emu/machine/smpc.c | 20 +++++++++++++++++--- src/mame/includes/stv.h | 2 ++ src/mess/drivers/pc6001.c | 4 ++-- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/emu/cpu/sh2/sh2comn.c b/src/emu/cpu/sh2/sh2comn.c index 27f5920b3a2..760e2106081 100644 --- a/src/emu/cpu/sh2/sh2comn.c +++ b/src/emu/cpu/sh2/sh2comn.c @@ -699,7 +699,8 @@ READ32_MEMBER( sh2_device::sh2_internal_r ) case 0x00: break; case 0x01: - return m_m[1] | 0; // bit31 is TDRE: Trasmit Data Register Empty. Forcing it to be '1' breaks Saturn. + return m_m[1] | 0; // bit31 is TDRE: Trasmit Data Register Empty. Forcing it to be '1' breaks Saturn ... +// return m_m[1] | (0x84 << 24); // ... but this is actually needed to make EGWord on SS to boot? case 0x04: // TIER, FTCSR, FRC if ( mem_mask == 0x00ff0000 ) diff --git a/src/emu/machine/smpc.c b/src/emu/machine/smpc.c index add9009417c..93ffa7a0533 100644 --- a/src/emu/machine/smpc.c +++ b/src/emu/machine/smpc.c @@ -171,7 +171,7 @@ void saturn_state::stv_select_game(int gameno) if (m_cart_reg[gameno] && m_cart_reg[gameno]->base()) memcpy(memregion("abus")->base(), m_cart_reg[gameno]->base(), 0x3000000); else - memset(memregion("abus")->base(), 0x00, 0x3000000); + memset(memregion("abus")->base(), 0x00, 0x3000000); // TODO: 1-filled? m_prev_bankswitch = gameno; } @@ -393,7 +393,7 @@ void saturn_state::smpc_analog_pad( UINT8 pad_num, UINT8 offset, UINT8 id) void saturn_state::smpc_keyboard(UINT8 pad_num, UINT8 offset) { UINT16 game_key; - + game_key = 0xffff; game_key ^= ((ioport("KEYS_1")->read() & 0x80) << 8); // right @@ -415,6 +415,8 @@ void saturn_state::smpc_keyboard(UINT8 pad_num, UINT8 offset) m_smpc.OREG[2+pad_num*offset] = game_key>>8; // game buttons, TODO m_smpc.OREG[3+pad_num*offset] = game_key & 0xff; /* + Keyboard Status hook-up + TODO: how shift key actually works? EGWord uses it in order to switch between hiragana and katakana modes. x--- ---- 0 -x-- ---- caps lock --x- ---- num lock @@ -425,7 +427,19 @@ void saturn_state::smpc_keyboard(UINT8 pad_num, UINT8 offset) ---- ---x Break key */ m_smpc.OREG[4+pad_num*offset] = m_keyb.status | 6; - m_smpc.OREG[5+pad_num*offset] = m_keyb.data; + if(m_keyb.prev_data != m_keyb.data) + { + m_smpc.OREG[5+pad_num*offset] = m_keyb.data; + m_keyb.repeat_count = 0; + m_keyb.prev_data = m_keyb.data; + } + else + { + /* Very crude repeat support */ + m_keyb.repeat_count ++; + m_keyb.repeat_count = m_keyb.repeat_count > 32 ? 32 : m_keyb.repeat_count; + m_smpc.OREG[5+pad_num*offset] = (m_keyb.repeat_count == 32) ? m_keyb.data : 0; + } } void saturn_state::smpc_mouse(UINT8 pad_num, UINT8 offset, UINT8 id) diff --git a/src/mame/includes/stv.h b/src/mame/includes/stv.h index 4fafe420c46..f748baa5693 100644 --- a/src/mame/includes/stv.h +++ b/src/mame/includes/stv.h @@ -142,6 +142,8 @@ public: struct { UINT8 status; UINT8 data; + UINT8 prev_data; + UINT16 repeat_count; }m_keyb; /* Saturn specific*/ diff --git a/src/mess/drivers/pc6001.c b/src/mess/drivers/pc6001.c index f86f592bd36..d1b451e3635 100644 --- a/src/mess/drivers/pc6001.c +++ b/src/mess/drivers/pc6001.c @@ -13,7 +13,7 @@ do some tight synch between the master CPU and a code simulation,but I think it's not worth the effort... - Identify and hook-up the FDC device, apparently PC-6001 and PC-6601 doesn't even use the same thing; - - PC-6601: mon r-0 type games doesn't seem to work at all on this version? + - PC-6601: mon r-0 type games doesn't seem to work at all on this system? - PC-6001SR: get it to boot, also implement MK-2 compatibility mode (it changes the memory map to behave like the older versions) - Currently rewriting the video part without the MC6847 for two reasons: A) the later models have a custom video chip in the place of the MC6847, @@ -29,7 +29,7 @@ nothing is shown on screen, other emus behaves the same, bad dump? - Dawn Patrol (cart): presumably too slow; (Mk2 mode 5 games) - - 3D Golf Simulation Super Version: gameplay / inputs looks broken + - 3D Golf Simulation Super Version: gameplay / inputs seems broken - American Truck: Screen is offset at the loading screen, loading bug? - Castle Excellent: copyright text drawing is quite bogus, scans text in vertical instead of horizontal? - Dezeni Land (ALL versions) / Hurry Fox 1/2: asks you to "load something", can't do it with current cassette kludge, also, for Dezeni Land(s) keyboard irqs