(MESS) irisha.c: Reduce tagmap lookups (nw)

This commit is contained in:
Wilbert Pol 2013-02-07 21:50:11 +00:00
parent 07b57e8bc0
commit 07cee7a7e7
3 changed files with 20 additions and 11 deletions

View File

@ -19,11 +19,13 @@ class irisha_state : public driver_device
{
public:
irisha_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_pit(*this, "pit8253"),
m_speaker(*this, SPEAKER_TAG)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_pit(*this, "pit8253")
, m_speaker(*this, SPEAKER_TAG)
{ }
required_device<cpu_device> m_maincpu;
required_device<pit8253_device> m_pit;
required_device<speaker_sound_device> m_speaker;
@ -49,6 +51,8 @@ public:
UINT32 screen_update_irisha(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(irisha_key);
DECLARE_WRITE_LINE_MEMBER(irisha_pic_set_int_line);
ioport_port *m_io_ports[10];
};

View File

@ -26,6 +26,16 @@ TIMER_CALLBACK_MEMBER(irisha_state::irisha_key)
void irisha_state::machine_start()
{
static const char *const keynames[] = {
"LINE0", "LINE1", "LINE2", "LINE3", "LINE4",
"LINE5", "LINE6", "LINE7", "LINE8", "LINE9"
};
for ( int i = 0; i < 10; i++ )
{
m_io_ports[i] = ioport( keynames[i] );
}
machine().scheduler().timer_pulse(attotime::from_msec(30), timer_expired_delegate(FUNC(irisha_state::irisha_key),this));
}
@ -41,11 +51,6 @@ void irisha_state::update_speaker()
speaker_level_w(m_speaker, level);
}
static const char *const keynames[] = {
"LINE0", "LINE1", "LINE2", "LINE3",
"LINE4", "LINE5", "LINE6", "LINE7",
"LINE8", "LINE9"
};
READ8_MEMBER(irisha_state::irisha_8255_portb_r)
{
@ -67,7 +72,7 @@ READ8_MEMBER(irisha_state::irisha_keyboard_r)
{
UINT8 keycode;
if (m_keyboard_cnt!=0 && m_keyboard_cnt<11) {
keycode = ioport(keynames[m_keyboard_cnt-1])->read() ^ 0xff;
keycode = m_io_ports[m_keyboard_cnt-1]->read() ^ 0xff;
} else {
keycode = 0xff;
}
@ -119,7 +124,7 @@ I8255A_INTERFACE( irisha_ppi8255_interface )
WRITE_LINE_MEMBER(irisha_state::irisha_pic_set_int_line)
{
machine().device("maincpu")->execute().set_input_line(0, state ? HOLD_LINE : CLEAR_LINE);
m_maincpu->set_input_line(0, state ? HOLD_LINE : CLEAR_LINE);
}
const struct pic8259_interface irisha_pic8259_config =

View File

@ -20,7 +20,7 @@ UINT32 irisha_state::screen_update_irisha(screen_device &screen, bitmap_ind16 &b
UINT8 code1; //, code2;
UINT8 col;
int y, x, b;
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
address_space &space = m_maincpu->space(AS_PROGRAM);
// draw image
for (y = 0; y < 200; y++)