hec2hrp.c converted to ioport_array (nw)

This commit is contained in:
Ivan Vangelista 2014-06-02 07:01:58 +00:00
parent 5cc842ad44
commit 94bbfe2103
3 changed files with 22 additions and 21 deletions

View File

@ -197,7 +197,7 @@ ADDRESS_MAP_END
/* Input ports */
static INPUT_PORTS_START( hec2hrp )
/* keyboard input */
PORT_START("KEY0") /* [0] - port 3000 @ 0 */
PORT_START("KEY.0") /* [0] - port 3000 @ 0 */
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Space") PORT_CODE(KEYCODE_SPACE)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Return") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
@ -206,7 +206,7 @@ static INPUT_PORTS_START( hec2hrp )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
PORT_START("KEY1") /* [1] - port 3000 @ 1 */ /* touches => 2 1 0 / . - , + */
PORT_START("KEY.1") /* [1] - port 3000 @ 1 */ /* touches => 2 1 0 / . - , + */
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 >") PORT_CODE(KEYCODE_1) PORT_CHAR('1')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 <") PORT_CODE(KEYCODE_0) PORT_CHAR('0')
@ -216,7 +216,7 @@ static INPUT_PORTS_START( hec2hrp )
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
PORT_START("KEY2") /* [1] - port 3000 @ 2 */ /* touches => .. 9 8 7 6 5 4 3 */
PORT_START("KEY.2") /* [1] - port 3000 @ 2 */ /* touches => .. 9 8 7 6 5 4 3 */
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8')
@ -225,7 +225,7 @@ static INPUT_PORTS_START( hec2hrp )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4')
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 /") PORT_CODE(KEYCODE_3) PORT_CHAR('3')
PORT_START("KEY3") /* [1] - port 3000 @ 3 */ /* touches => B A .. ? .. = .. ; */
PORT_START("KEY.3") /* [1] - port 3000 @ 3 */ /* touches => B A .. ? .. = .. ; */
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
@ -234,7 +234,7 @@ static INPUT_PORTS_START( hec2hrp )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
PORT_START("KEY4") /* [1] - port 3000 @ 4 */
PORT_START("KEY.4") /* [1] - port 3000 @ 4 */
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H')
@ -244,7 +244,7 @@ static INPUT_PORTS_START( hec2hrp )
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
PORT_START("KEY5") /* [1] - port 3000 @ 5 */
PORT_START("KEY.5") /* [1] - port 3000 @ 5 */
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Q") PORT_CODE(KEYCODE_A) PORT_CHAR('A')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P')
@ -254,7 +254,7 @@ static INPUT_PORTS_START( hec2hrp )
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L')
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K')
PORT_START("KEY6") /* [1] - port 3000 @ 6 */
PORT_START("KEY.6") /* [1] - port 3000 @ 6 */
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Z") PORT_CODE(KEYCODE_W) PORT_CHAR('W')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("X") PORT_CODE(KEYCODE_X) PORT_CHAR('X')
@ -264,7 +264,7 @@ static INPUT_PORTS_START( hec2hrp )
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T')
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('S')
PORT_START("KEY7") /* [1] - port 3000 @ 7 JOYSTICK */
PORT_START("KEY.7") /* [1] - port 3000 @ 7 JOYSTICK */
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) LEFT") PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) RIGHT") PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) UP") PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
@ -274,7 +274,7 @@ static INPUT_PORTS_START( hec2hrp )
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) UP") PORT_CODE(KEYCODE_5_PAD)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) DOWN") PORT_CODE(KEYCODE_2_PAD)
PORT_START("KEY8") /* [1] - port 3000 @ 8 not for the real machine, but to emulate the analog signal of the joystick */
PORT_START("KEY.8") /* [1] - port 3000 @ 8 not for the real machine, but to emulate the analog signal of the joystick */
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RESET") PORT_CODE(KEYCODE_ESC) PORT_CHAR(27)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(0) FIRE") PORT_CODE(KEYCODE_TILDE)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Joy(1) FIRE") PORT_CODE(KEYCODE_PLUS_PAD)

View File

@ -74,16 +74,24 @@ class hec2hrp_state : public driver_device
public:
hec2hrp_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_videoram(*this,"videoram"),
m_hector_videoram(*this,"hector_videoram") ,
m_maincpu(*this, "maincpu"),
m_disc2cpu(*this, "disc2cpu"),
m_cassette(*this, "cassette"),
m_sn(*this, "sn76477"),
m_palette(*this, "palette") { }
m_palette(*this, "palette"),
m_videoram(*this,"videoram"),
m_hector_videoram(*this,"hector_videoram") ,
m_keyboard(*this, "KEY") { }
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_disc2cpu;
required_device<cassette_image_device> m_cassette;
required_device<sn76477_device> m_sn;
required_device<palette_device> m_palette;
optional_shared_ptr<UINT8> m_videoram;
optional_shared_ptr<UINT8> m_hector_videoram;
required_ioport_array<9> m_keyboard;
UINT8 m_hector_flag_hr;
UINT8 m_hector_flag_80c;
UINT8 m_hector_color[4];
@ -148,11 +156,6 @@ public:
DECLARE_WRITE_LINE_MEMBER( disc2_fdc_interrupt );
DECLARE_WRITE_LINE_MEMBER( disc2_fdc_dma_irq );
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_disc2cpu;
required_device<cassette_image_device> m_cassette;
required_device<sn76477_device> m_sn;
required_device<palette_device> m_palette;
int isHectorWithDisc2();
int isHectorWithMiniDisc();
int isHectorHR();

View File

@ -231,12 +231,10 @@ READ8_MEMBER(hec2hrp_state::hector_keyboard_r)
{
UINT8 data = 0xff;
static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7", "KEY8" };
if (offset ==7) /* Only when joy reading*/
{
/* Read special key for analog joystick emulation only (button and pot are analog signal!) and the reset */
data=ioport(keynames[8])->read();
data=m_keyboard[8]->read();
if (data & 0x01) /* Reset machine ! (on ESC key)*/
{
@ -294,7 +292,7 @@ READ8_MEMBER(hec2hrp_state::hector_keyboard_r)
}
/* in all case return the request value*/
return ioport(keynames[offset])->read();
return m_keyboard[offset]->read();
}
WRITE8_MEMBER(hec2hrp_state::hector_sn_2000_w)