Previous 199869 Revisions Next

r20540 Sunday 27th January, 2013 at 17:16:57 UTC by David Haywood
4enraya tagman cleanup (nw)
this is a good example of where the tagmaps are significantly slowing things down.  Simple driver but because it is using the actual prom to do address decoding, it was incurring a tag lookup on every mem access (2 in the case of ROM) and was running at 200%, when it can actually run at 1200% just by doing the region tag lookup on startup instead.
[src/mame/drivers]4enraya.c
[src/mame/includes]4enraya.h

trunk/src/mame/drivers/4enraya.c
r20539r20540
5656
5757#include "emu.h"
5858#include "cpu/z80/z80.h"
59#include "sound/ay8910.h"
6059#include "machine/nvram.h"
6160#include "includes/4enraya.h"
6261
r20539r20540
6968
7069WRITE8_MEMBER(_4enraya_state::sound_control_w)
7170{
72   device_t *device = machine().device("aysnd");
73
7471   if ((m_last_snd_ctrl & m_snd_latch_bit ) == m_snd_latch_bit && (data & m_snd_latch_bit) == 0x00)
75      ay8910_data_address_w(device, space, m_last_snd_ctrl, m_soundlatch);
72      ay8910_data_address_w(m_ay, space, m_last_snd_ctrl, m_soundlatch);
7673
7774   m_last_snd_ctrl = data;
7875}
7976
8077READ8_MEMBER(_4enraya_state::fenraya_custom_map_r)
8178{
82   UINT8 *prom = memregion("pal_prom")->base();
83   UINT8 prom_routing = (prom[offset >> 12] & 0xf) ^ 0xf;
79   UINT8 prom_routing = (m_prom[offset >> 12] & 0xf) ^ 0xf;
8480   UINT8 res;
8581
8682   res = 0;
8783
8884   if(prom_routing & 1) //ROM5
8985   {
90      UINT8 *rom = memregion("maincpu")->base();
91      res |= rom[offset & 0x7fff];
86      res |= m_rom[offset & 0x7fff];
9287   }
9388
9489   if(prom_routing & 2) //ROM4
9590   {
96      UINT8 *rom = memregion("maincpu")->base();
97      res |= rom[(offset & 0x7fff) | 0x8000];
91      res |= m_rom[(offset & 0x7fff) | 0x8000];
9892   }
9993
10094   if(prom_routing & 4) //RAM
r20539r20540
112106
113107WRITE8_MEMBER(_4enraya_state::fenraya_custom_map_w)
114108{
115   UINT8 *prom = memregion("pal_prom")->base();
116   UINT8 prom_routing = (prom[offset >> 12] & 0xf) ^ 0xf;
109   UINT8 prom_routing = (m_prom[offset >> 12] & 0xf) ^ 0xf;
117110
118111   if(prom_routing & 1) //ROM5
119112   {
r20539r20540
296289{
297290   save_item(NAME(m_soundlatch));
298291   save_item(NAME(m_last_snd_ctrl));
292
293   m_prom = memregion("pal_prom")->base();
294   m_rom = memregion("maincpu")->base();
295
299296}
300297
301298void _4enraya_state::machine_reset()
trunk/src/mame/includes/4enraya.h
r20539r20540
44
55*************************************************************************/
66
7#include "sound/ay8910.h"
8
79class _4enraya_state : public driver_device
810{
911public:
1012   _4enraya_state(const machine_config &mconfig, device_type type, const char *tag)
1113      : driver_device(mconfig, type, tag),
12      m_snd_latch_bit(4) { }
14      m_ay(*this, "aysnd"),
15      m_snd_latch_bit(4)
16   { }
1317
18   
19   required_device<ay8910_device> m_ay;
20
1421   /* memory pointers */
1522   UINT8      m_videoram[0x1000];
1623   UINT8      m_workram[0x1000];
r20539r20540
3037   DECLARE_WRITE8_MEMBER(sound_control_w);
3138   DECLARE_DRIVER_INIT(unkpacg);
3239   TILE_GET_INFO_MEMBER(get_tile_info);
40
41   UINT8* m_prom;
42   UINT8* m_rom;
43
3344   virtual void machine_start();
3445   virtual void machine_reset();
3546   virtual void video_start();

Previous 199869 Revisions Next


© 1997-2024 The MAME Team