summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar Wilbert Pol <wilbert@jdg.info>2013-02-10 19:44:28 +0000
committerGravatarGravatar Wilbert Pol <wilbert@jdg.info>2013-02-10 19:44:28 +0000
commite4fc128bd2493ea1bd97889f281118371cedc152 (patch) (github)
treebb50ebc0c22cc591c16d5f3dd783f737883c92b2
parente40e0da8c1bef88a341423100bcaa4271ef41858 (diff)
downloadmame-e4fc128bd2493ea1bd97889f281118371cedc152.tar.bz2
mame-e4fc128bd2493ea1bd97889f281118371cedc152.zip
(MESS) mikro80.c: Reduce tagmap lookups (nw)
-rw-r--r--src/mess/drivers/mikro80.c2
-rw-r--r--src/mess/includes/mikro80.h38
-rw-r--r--src/mess/machine/mikro80.c40
-rw-r--r--src/mess/video/mikro80.c2
4 files changed, 54 insertions, 28 deletions
diff --git a/src/mess/drivers/mikro80.c b/src/mess/drivers/mikro80.c
index 8cf524dc14a..f6303fcce49 100644
--- a/src/mess/drivers/mikro80.c
+++ b/src/mess/drivers/mikro80.c
@@ -10,9 +10,7 @@
#include "emu.h"
#include "cpu/i8085/i8085.h"
#include "sound/wave.h"
-#include "machine/i8255.h"
#include "includes/mikro80.h"
-#include "imagedev/cassette.h"
#include "imagedev/cartslot.h"
#include "formats/rk_cas.h"
#include "sound/dac.h"
diff --git a/src/mess/includes/mikro80.h b/src/mess/includes/mikro80.h
index 70f1d34783a..a4ed37cf05a 100644
--- a/src/mess/includes/mikro80.h
+++ b/src/mess/includes/mikro80.h
@@ -8,14 +8,30 @@
#define MIKRO80_H_
#include "machine/i8255.h"
+#include "imagedev/cassette.h"
class mikro80_state : public driver_device
{
public:
mikro80_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag) ,
- m_cursor_ram(*this, "cursor_ram"),
- m_video_ram(*this, "video_ram"){ }
+ : driver_device(mconfig, type, tag)
+ , m_cursor_ram(*this, "cursor_ram")
+ , m_video_ram(*this, "video_ram")
+ , m_ppi8255(*this, "ppi8255")
+ , m_cassette(*this, CASSETTE_TAG)
+ , m_region_maincpu(*this, "maincpu")
+ , m_region_gfx1(*this, "gfx1")
+ , m_bank1(*this, "bank1")
+ , m_io_line0(*this, "LINE0")
+ , m_io_line1(*this, "LINE1")
+ , m_io_line2(*this, "LINE2")
+ , m_io_line3(*this, "LINE3")
+ , m_io_line4(*this, "LINE4")
+ , m_io_line5(*this, "LINE5")
+ , m_io_line6(*this, "LINE6")
+ , m_io_line7(*this, "LINE7")
+ , m_io_line8(*this, "LINE8")
+ { }
required_shared_ptr<UINT8> m_cursor_ram;
required_shared_ptr<UINT8> m_video_ram;
@@ -35,6 +51,22 @@ public:
virtual void video_start();
UINT32 screen_update_mikro80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(mikro80_reset);
+
+protected:
+ required_device<i8255_device> m_ppi8255;
+ required_device<cassette_image_device> m_cassette;
+ required_memory_region m_region_maincpu;
+ required_memory_region m_region_gfx1;
+ required_memory_bank m_bank1;
+ required_ioport m_io_line0;
+ required_ioport m_io_line1;
+ required_ioport m_io_line2;
+ required_ioport m_io_line3;
+ required_ioport m_io_line4;
+ required_ioport m_io_line5;
+ required_ioport m_io_line6;
+ required_ioport m_io_line7;
+ required_ioport m_io_line8;
};
diff --git a/src/mess/machine/mikro80.c b/src/mess/machine/mikro80.c
index 9cf46e44016..ec0d24319a2 100644
--- a/src/mess/machine/mikro80.c
+++ b/src/mess/machine/mikro80.c
@@ -9,18 +9,16 @@
#include "emu.h"
#include "cpu/i8085/i8085.h"
-#include "imagedev/cassette.h"
-#include "machine/i8255.h"
#include "includes/mikro80.h"
/* Driver initialization */
DRIVER_INIT_MEMBER(mikro80_state,mikro80)
{
/* set initialy ROM to be visible on first bank */
- UINT8 *RAM = memregion("maincpu")->base();
+ UINT8 *RAM = m_region_maincpu->base();
memset(RAM,0x0000,0x0800); // make frist page empty by default
- membank("bank1")->configure_entries(1, 2, RAM, 0x0000);
- membank("bank1")->configure_entries(0, 2, RAM, 0xf800);
+ m_bank1->configure_entries(1, 2, RAM, 0x0000);
+ m_bank1->configure_entries(0, 2, RAM, 0xf800);
m_key_mask = 0x7f;
}
@@ -33,20 +31,20 @@ DRIVER_INIT_MEMBER(mikro80_state,radio99)
READ8_MEMBER(mikro80_state::mikro80_8255_portb_r)
{
UINT8 key = 0xff;
- if ((m_keyboard_mask & 0x01)!=0) { key &= ioport("LINE0")->read(); }
- if ((m_keyboard_mask & 0x02)!=0) { key &= ioport("LINE1")->read(); }
- if ((m_keyboard_mask & 0x04)!=0) { key &= ioport("LINE2")->read(); }
- if ((m_keyboard_mask & 0x08)!=0) { key &= ioport("LINE3")->read(); }
- if ((m_keyboard_mask & 0x10)!=0) { key &= ioport("LINE4")->read(); }
- if ((m_keyboard_mask & 0x20)!=0) { key &= ioport("LINE5")->read(); }
- if ((m_keyboard_mask & 0x40)!=0) { key &= ioport("LINE6")->read(); }
- if ((m_keyboard_mask & 0x80)!=0) { key &= ioport("LINE7")->read(); }
+ if ((m_keyboard_mask & 0x01)!=0) { key &= m_io_line0->read(); }
+ if ((m_keyboard_mask & 0x02)!=0) { key &= m_io_line1->read(); }
+ if ((m_keyboard_mask & 0x04)!=0) { key &= m_io_line2->read(); }
+ if ((m_keyboard_mask & 0x08)!=0) { key &= m_io_line3->read(); }
+ if ((m_keyboard_mask & 0x10)!=0) { key &= m_io_line4->read(); }
+ if ((m_keyboard_mask & 0x20)!=0) { key &= m_io_line5->read(); }
+ if ((m_keyboard_mask & 0x40)!=0) { key &= m_io_line6->read(); }
+ if ((m_keyboard_mask & 0x80)!=0) { key &= m_io_line7->read(); }
return key & m_key_mask;
}
READ8_MEMBER(mikro80_state::mikro80_8255_portc_r)
{
- return ioport("LINE8")->read();
+ return m_io_line8->read();
}
WRITE8_MEMBER(mikro80_state::mikro80_8255_porta_w)
@@ -71,39 +69,37 @@ I8255_INTERFACE( mikro80_ppi8255_interface )
TIMER_CALLBACK_MEMBER(mikro80_state::mikro80_reset)
{
- membank("bank1")->set_entry(0);
+ m_bank1->set_entry(0);
}
void mikro80_state::machine_reset()
{
machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(mikro80_state::mikro80_reset),this));
- membank("bank1")->set_entry(1);
+ m_bank1->set_entry(1);
m_keyboard_mask = 0;
}
READ8_MEMBER(mikro80_state::mikro80_keyboard_r)
{
- i8255_device *ppi = machine().device<i8255_device>("ppi8255");
- return ppi->read(space, offset^0x03);
+ return m_ppi8255->read(space, offset^0x03);
}
WRITE8_MEMBER(mikro80_state::mikro80_keyboard_w)
{
- i8255_device *ppi = machine().device<i8255_device>("ppi8255");
- ppi->write(space, offset^0x03, data);
+ m_ppi8255->write(space, offset^0x03, data);
}
WRITE8_MEMBER(mikro80_state::mikro80_tape_w)
{
- machine().device<cassette_image_device>(CASSETTE_TAG)->output(data & 0x01 ? 1 : -1);
+ m_cassette->output(data & 0x01 ? 1 : -1);
}
READ8_MEMBER(mikro80_state::mikro80_tape_r)
{
- double level = machine().device<cassette_image_device>(CASSETTE_TAG)->input();
+ double level = m_cassette->input();
if (level < 0) {
return 0x00;
}
diff --git a/src/mess/video/mikro80.c b/src/mess/video/mikro80.c
index 209dca9b4b0..0f0deb96b06 100644
--- a/src/mess/video/mikro80.c
+++ b/src/mess/video/mikro80.c
@@ -17,7 +17,7 @@ void mikro80_state::video_start()
UINT32 mikro80_state::screen_update_mikro80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- UINT8 *gfx = memregion("gfx1")->base();
+ UINT8 *gfx = m_region_gfx1->base();
int x,y,b;
for(y = 0; y < 32*8; y++ )