nascom1.c: ioport_array (nw)

This commit is contained in:
Ivan Vangelista 2014-05-17 07:38:14 +00:00
parent ab56cf54d6
commit a1abf1f47d
3 changed files with 26 additions and 26 deletions

View File

@ -162,11 +162,11 @@ GFXDECODE_END
*************************************/
static INPUT_PORTS_START( nascom1 )
PORT_START("KEY0")
PORT_START("KEY.0")
PORT_BIT(0x6f, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
PORT_START("KEY1")
PORT_START("KEY.1")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('H') PORT_CHAR('h')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_CHAR('b')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
@ -175,7 +175,7 @@ static INPUT_PORTS_START( nascom1 )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('T') PORT_CHAR('t')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
PORT_START("KEY2")
PORT_START("KEY.2")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('J') PORT_CHAR('j')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('N') PORT_CHAR('n')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
@ -184,7 +184,7 @@ static INPUT_PORTS_START( nascom1 )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('Y') PORT_CHAR('y')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
PORT_START("KEY3")
PORT_START("KEY.3")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('K') PORT_CHAR('k')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('M') PORT_CHAR('m')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('\'')
@ -193,7 +193,7 @@ static INPUT_PORTS_START( nascom1 )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('U') PORT_CHAR('u')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
PORT_START("KEY4")
PORT_START("KEY.4")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) PORT_CHAR('L') PORT_CHAR('l')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
@ -202,7 +202,7 @@ static INPUT_PORTS_START( nascom1 )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('I') PORT_CHAR('i')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
PORT_START("KEY5")
PORT_START("KEY.5")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR('+')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR(')')
@ -211,7 +211,7 @@ static INPUT_PORTS_START( nascom1 )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('O') PORT_CHAR('o')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_START("KEY6")
PORT_START("KEY.6")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR(':') PORT_CHAR('*')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
@ -220,7 +220,7 @@ static INPUT_PORTS_START( nascom1 )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('P') PORT_CHAR('p')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_START("KEY7")
PORT_START("KEY.7")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('G') PORT_CHAR('g')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('V') PORT_CHAR('v')
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
@ -229,7 +229,7 @@ static INPUT_PORTS_START( nascom1 )
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('R') PORT_CHAR('r')
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_START("KEY8")
PORT_START("KEY.8")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Backspace ClearScreen") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(8)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("New Line") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('=')
@ -240,13 +240,13 @@ INPUT_PORTS_END
static INPUT_PORTS_START( nascom2 )
PORT_INCLUDE(nascom1)
PORT_MODIFY("KEY6")
PORT_MODIFY("KEY.6")
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('[') PORT_CHAR('\\')
PORT_MODIFY("KEY7")
PORT_MODIFY("KEY.7")
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(']') PORT_CHAR('_')
PORT_MODIFY("KEY8")
PORT_MODIFY("KEY.8")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Back CS") PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(8)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Enter Escape") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13) PORT_CHAR(27)
INPUT_PORTS_END

View File

@ -38,17 +38,23 @@ public:
m_maincpu(*this, "maincpu"),
m_hd6402(*this, "hd6402"),
m_cassette(*this, "cassette"),
m_fdc(*this, "wd1793"),
m_ram(*this, RAM_TAG),
m_videoram(*this, "videoram"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette")
m_palette(*this, "palette"),
m_videoram(*this, "videoram"),
m_keyboard(*this, "KEY")
{ }
required_device<cpu_device> m_maincpu;
required_device<ay31015_device> m_hd6402;
required_device<cassette_image_device> m_cassette;
optional_device<fd1793_device> m_fdc;
required_device<ram_device> m_ram;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_shared_ptr<UINT8> m_videoram;
required_ioport_array<9> m_keyboard;
int m_tape_size;
UINT8 *m_tape_image;
int m_tape_index;
@ -73,8 +79,6 @@ public:
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( nascom1_cassette );
DECLARE_DEVICE_IMAGE_UNLOAD_MEMBER( nascom1_cassette );
DECLARE_SNAPSHOT_LOAD_MEMBER( nascom1 );
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
};

View File

@ -10,7 +10,6 @@
#include "emu.h"
#include "includes/nascom1.h"
#include "cpu/z80/z80.h"
#include "machine/wd17xx.h"
#include "machine/ay31015.h"
#include "imagedev/snapquik.h"
#include "imagedev/cassette.h"
@ -45,16 +44,15 @@ READ8_MEMBER(nascom1_state::nascom2_fdc_select_r)
WRITE8_MEMBER(nascom1_state::nascom2_fdc_select_w)
{
fd1793_device *fdc = machine().device<fd1793_device>("wd179x");
m_nascom2_fdc.select = data;
logerror("nascom2_fdc_select_w: %02x\n", data);
if (data & 0x01) fdc->set_drive(0);
if (data & 0x02) fdc->set_drive(1);
if (data & 0x04) fdc->set_drive(2);
if (data & 0x08) fdc->set_drive(3);
if (data & 0x10) fdc->set_side((data & 0x10) >> 4);
if (data & 0x01) m_fdc->set_drive(0);
if (data & 0x02) m_fdc->set_drive(1);
if (data & 0x04) m_fdc->set_drive(2);
if (data & 0x08) m_fdc->set_drive(3);
if (data & 0x10) m_fdc->set_side((data & 0x10) >> 4);
}
@ -78,10 +76,8 @@ READ8_MEMBER(nascom1_state::nascom2_fdc_status_r)
READ8_MEMBER(nascom1_state::nascom1_port_00_r)
{
static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7", "KEY8" };
if (m_portstat.stat_count < 9)
return (ioport(keynames[m_portstat.stat_count])->read() | ~0x7f);
return ((m_keyboard[m_portstat.stat_count])->read() | ~0x7f);
return (0xff);
}