midtunit.c, midwunit.c, midyunit.c: reduced tagmap lookups (nw)

This commit is contained in:
Osso 2015-01-08 18:41:40 +01:00
parent 50ea0b3706
commit 35642262d8
6 changed files with 397 additions and 375 deletions

View File

@ -17,20 +17,30 @@ public:
midtunit_state(const machine_config &mconfig, device_type type, const char *tag) midtunit_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_nvram(*this, "nvram"),
m_gfxrom(*this, "gfxrom"),
m_cvsd_sound(*this, "cvsd"),
m_adpcm_sound(*this, "adpcm") ,
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_palette(*this, "palette"), m_palette(*this, "palette"),
m_dcs(*this, "dcs"), m_dcs(*this, "dcs"),
m_generic_paletteram_16(*this, "paletteram") { } m_cvsd_sound(*this, "cvsd"),
m_adpcm_sound(*this, "adpcm") ,
m_generic_paletteram_16(*this, "paletteram"),
m_nvram(*this, "nvram"),
m_gfxrom(*this, "gfxrom"),
m_ports(*this, tunit_ports) { }
required_shared_ptr<UINT16> m_nvram; required_device<cpu_device> m_maincpu;
required_memory_region m_gfxrom; required_device<palette_device> m_palette;
optional_device<dcs_audio_device> m_dcs;
optional_device<williams_cvsd_sound_device> m_cvsd_sound; optional_device<williams_cvsd_sound_device> m_cvsd_sound;
optional_device<williams_adpcm_sound_device> m_adpcm_sound; optional_device<williams_adpcm_sound_device> m_adpcm_sound;
required_shared_ptr<UINT16> m_generic_paletteram_16;
required_shared_ptr<UINT16> m_nvram;
required_memory_region m_gfxrom;
required_ioport_array<4> m_ports;
DECLARE_IOPORT_ARRAY(tunit_ports);
DECLARE_WRITE16_MEMBER(midtunit_cmos_enable_w); DECLARE_WRITE16_MEMBER(midtunit_cmos_enable_w);
DECLARE_WRITE16_MEMBER(midtunit_cmos_w); DECLARE_WRITE16_MEMBER(midtunit_cmos_w);
DECLARE_READ16_MEMBER(midtunit_cmos_r); DECLARE_READ16_MEMBER(midtunit_cmos_r);
@ -66,44 +76,43 @@ public:
DECLARE_READ16_MEMBER(midxunit_paletteram_r); DECLARE_READ16_MEMBER(midxunit_paletteram_r);
DECLARE_READ16_MEMBER(midtunit_dma_r); DECLARE_READ16_MEMBER(midtunit_dma_r);
DECLARE_WRITE16_MEMBER(midtunit_dma_w); DECLARE_WRITE16_MEMBER(midtunit_dma_w);
TMS340X0_TO_SHIFTREG_CB_MEMBER(to_shiftreg); TMS340X0_TO_SHIFTREG_CB_MEMBER(to_shiftreg);
TMS340X0_FROM_SHIFTREG_CB_MEMBER(from_shiftreg); TMS340X0_FROM_SHIFTREG_CB_MEMBER(from_shiftreg);
TMS340X0_SCANLINE_IND16_CB_MEMBER(scanline_update); TMS340X0_SCANLINE_IND16_CB_MEMBER(scanline_update);
DECLARE_DRIVER_INIT(mktunit); DECLARE_DRIVER_INIT(mktunit);
DECLARE_DRIVER_INIT(mkturbo); DECLARE_DRIVER_INIT(mkturbo);
DECLARE_DRIVER_INIT(nbajamte); DECLARE_DRIVER_INIT(nbajamte);
DECLARE_DRIVER_INIT(nbajam); DECLARE_DRIVER_INIT(nbajam);
DECLARE_DRIVER_INIT(jdreddp); DECLARE_DRIVER_INIT(jdreddp);
DECLARE_DRIVER_INIT(mk2); DECLARE_DRIVER_INIT(mk2);
DECLARE_MACHINE_RESET(midtunit); DECLARE_MACHINE_RESET(midtunit);
DECLARE_VIDEO_START(midtunit); DECLARE_VIDEO_START(midtunit);
required_device<cpu_device> m_maincpu;
required_device<palette_device> m_palette;
optional_device<dcs_audio_device> m_dcs;
required_shared_ptr<UINT16> m_generic_paletteram_16;
void register_state_saving(); void register_state_saving();
void init_tunit_generic(int sound); void init_tunit_generic(int sound);
void init_nbajam_common(int te_protection); void init_nbajam_common(int te_protection);
/* CMOS-related variables */ /* CMOS-related variables */
UINT8 cmos_write_enable; UINT8 m_cmos_write_enable;
/* sound-related variables */ /* sound-related variables */
UINT8 chip_type; UINT8 m_chip_type;
UINT8 fake_sound_state; UINT8 m_fake_sound_state;
/* protection */ /* protection */
UINT8 mk_prot_index; UINT8 m_mk_prot_index;
UINT16 mk2_prot_data; UINT16 m_mk2_prot_data;
const UINT32 *nbajam_prot_table; const UINT32 *m_nbajam_prot_table;
UINT16 nbajam_prot_queue[5]; UINT16 m_nbajam_prot_queue[5];
UINT8 nbajam_prot_index; UINT8 m_nbajam_prot_index;
const UINT8 *jdredd_prot_table; const UINT8 *m_jdredd_prot_table;
UINT8 jdredd_prot_index; UINT8 m_jdredd_prot_index;
UINT8 jdredd_prot_max; UINT8 m_jdredd_prot_max;
UINT8 m_gfx_rom_large; UINT8 m_gfx_rom_large;

View File

@ -13,17 +13,24 @@ class midwunit_state : public midtunit_state
public: public:
midwunit_state(const machine_config &mconfig, device_type type, const char *tag) midwunit_state(const machine_config &mconfig, device_type type, const char *tag)
: midtunit_state(mconfig, type, tag), : midtunit_state(mconfig, type, tag),
m_midway_serial_pic(*this, "serial_pic"),
m_nvram(*this, "nvram"), m_nvram(*this, "nvram"),
m_midway_serial_pic(*this, "serial_pic") { } m_ports(*this, wunit_ports)
{ }
required_shared_ptr<UINT16> m_nvram;
required_device<midway_serial_pic_device> m_midway_serial_pic; required_device<midway_serial_pic_device> m_midway_serial_pic;
required_shared_ptr<UINT16> m_nvram;
required_ioport_array<4> m_ports;
DECLARE_IOPORT_ARRAY(wunit_ports);
UINT8 m_cmos_write_enable; UINT8 m_cmos_write_enable;
UINT16 m_iodata[8]; UINT16 m_iodata[8];
UINT8 m_ioshuffle[16]; UINT8 m_ioshuffle[16];
UINT8 m_uart[8]; UINT8 m_uart[8];
UINT8 m_security_bits; UINT8 m_security_bits;
UINT16 *m_umk3_palette; UINT16 *m_umk3_palette;
DECLARE_WRITE16_MEMBER(midwunit_cmos_enable_w); DECLARE_WRITE16_MEMBER(midwunit_cmos_enable_w);
DECLARE_WRITE16_MEMBER(midwunit_cmos_w); DECLARE_WRITE16_MEMBER(midwunit_cmos_w);
DECLARE_READ16_MEMBER(midwunit_cmos_r); DECLARE_READ16_MEMBER(midwunit_cmos_r);
@ -36,6 +43,7 @@ public:
DECLARE_WRITE16_MEMBER(midwunit_sound_w); DECLARE_WRITE16_MEMBER(midwunit_sound_w);
DECLARE_WRITE16_MEMBER(umk3_palette_hack_w); DECLARE_WRITE16_MEMBER(umk3_palette_hack_w);
DECLARE_WRITE16_MEMBER(wwfmania_io_0_w); DECLARE_WRITE16_MEMBER(wwfmania_io_0_w);
DECLARE_DRIVER_INIT(mk3r10); DECLARE_DRIVER_INIT(mk3r10);
DECLARE_DRIVER_INIT(nbahangt); DECLARE_DRIVER_INIT(nbahangt);
DECLARE_DRIVER_INIT(wwfmania); DECLARE_DRIVER_INIT(wwfmania);
@ -45,8 +53,10 @@ public:
DECLARE_DRIVER_INIT(rmpgwt); DECLARE_DRIVER_INIT(rmpgwt);
DECLARE_DRIVER_INIT(umk3r11); DECLARE_DRIVER_INIT(umk3r11);
DECLARE_DRIVER_INIT(mk3r20); DECLARE_DRIVER_INIT(mk3r20);
DECLARE_MACHINE_RESET(midwunit); DECLARE_MACHINE_RESET(midwunit);
DECLARE_VIDEO_START(midwunit); DECLARE_VIDEO_START(midwunit);
void register_state_saving(); void register_state_saving();
void init_wunit_generic(); void init_wunit_generic();
void init_mk3_common(); void init_mk3_common();

View File

@ -48,7 +48,8 @@ public:
m_cvsd_sound(*this, "cvsd"), m_cvsd_sound(*this, "cvsd"),
m_adpcm_sound(*this, "adpcm"), m_adpcm_sound(*this, "adpcm"),
m_generic_paletteram_16(*this, "paletteram"), m_generic_paletteram_16(*this, "paletteram"),
m_gfx_rom(*this, "gfx_rom", 16) { } m_gfx_rom(*this, "gfx_rom", 16),
m_ports(*this, ports) { }
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu; optional_device<cpu_device> m_audiocpu;
@ -61,6 +62,10 @@ public:
required_shared_ptr<UINT16> m_generic_paletteram_16; required_shared_ptr<UINT16> m_generic_paletteram_16;
optional_shared_ptr<UINT8> m_gfx_rom; optional_shared_ptr<UINT8> m_gfx_rom;
optional_ioport_array<6> m_ports;
DECLARE_IOPORT_ARRAY(ports);
UINT16 *m_cmos_ram; UINT16 *m_cmos_ram;
UINT32 m_cmos_page; UINT32 m_cmos_page;
UINT16 m_prot_result; UINT16 m_prot_result;

View File

@ -28,14 +28,14 @@
void midtunit_state::register_state_saving() void midtunit_state::register_state_saving()
{ {
save_item(NAME(cmos_write_enable)); save_item(NAME(m_cmos_write_enable));
save_item(NAME(fake_sound_state)); save_item(NAME(m_fake_sound_state));
save_item(NAME(mk_prot_index)); save_item(NAME(m_mk_prot_index));
save_item(NAME(mk2_prot_data)); save_item(NAME(m_mk2_prot_data));
save_item(NAME(nbajam_prot_queue)); save_item(NAME(m_nbajam_prot_queue));
save_item(NAME(nbajam_prot_index)); save_item(NAME(m_nbajam_prot_index));
save_item(NAME(jdredd_prot_index)); save_item(NAME(m_jdredd_prot_index));
save_item(NAME(jdredd_prot_max)); save_item(NAME(m_jdredd_prot_max));
} }
@ -48,16 +48,16 @@ void midtunit_state::register_state_saving()
WRITE16_MEMBER(midtunit_state::midtunit_cmos_enable_w) WRITE16_MEMBER(midtunit_state::midtunit_cmos_enable_w)
{ {
cmos_write_enable = 1; m_cmos_write_enable = 1;
} }
WRITE16_MEMBER(midtunit_state::midtunit_cmos_w) WRITE16_MEMBER(midtunit_state::midtunit_cmos_w)
{ {
if (1)/*cmos_write_enable)*/ if (1)/*m_cmos_write_enable*/
{ {
COMBINE_DATA(m_nvram+offset); COMBINE_DATA(m_nvram+offset);
cmos_write_enable = 0; m_cmos_write_enable = 0;
} }
else else
{ {
@ -80,11 +80,11 @@ READ16_MEMBER(midtunit_state::midtunit_cmos_r)
* *
*************************************/ *************************************/
IOPORT_ARRAY_MEMBER(midtunit_state::tunit_ports) { "IN0", "IN1", "IN2", "DSW" };
READ16_MEMBER(midtunit_state::midtunit_input_r) READ16_MEMBER(midtunit_state::midtunit_input_r)
{ {
static const char *const portnames[] = { "IN0", "IN1", "IN2", "DSW" }; return m_ports[offset]->read();
return ioport(portnames[offset])->read();
} }
@ -109,16 +109,16 @@ static const UINT8 mk_prot_values[] =
READ16_MEMBER(midtunit_state::mk_prot_r) READ16_MEMBER(midtunit_state::mk_prot_r)
{ {
logerror("%08X:Protection R @ %05X = %04X\n", space.device().safe_pc(), offset, mk_prot_values[mk_prot_index] << 9); logerror("%08X:Protection R @ %05X = %04X\n", space.device().safe_pc(), offset, mk_prot_values[m_mk_prot_index] << 9);
/* just in case */ /* just in case */
if (mk_prot_index >= sizeof(mk_prot_values)) if (m_mk_prot_index >= sizeof(mk_prot_values))
{ {
logerror("%08X:Unexpected protection R @ %05X\n", space.device().safe_pc(), offset); logerror("%08X:Unexpected protection R @ %05X\n", space.device().safe_pc(), offset);
mk_prot_index = 0; m_mk_prot_index = 0;
} }
return mk_prot_values[mk_prot_index++] << 9; return mk_prot_values[m_mk_prot_index++] << 9;
} }
WRITE16_MEMBER(midtunit_state::mk_prot_w) WRITE16_MEMBER(midtunit_state::mk_prot_w)
@ -132,7 +132,7 @@ WRITE16_MEMBER(midtunit_state::mk_prot_w)
for (i = 0; i < sizeof(mk_prot_values); i++) for (i = 0; i < sizeof(mk_prot_values); i++)
if (mk_prot_values[i] == first_val) if (mk_prot_values[i] == first_val)
{ {
mk_prot_index = i; m_mk_prot_index = i;
break; break;
} }
@ -140,7 +140,7 @@ WRITE16_MEMBER(midtunit_state::mk_prot_w)
if (i == sizeof(mk_prot_values)) if (i == sizeof(mk_prot_values))
{ {
logerror("%08X:Unhandled protection W @ %05X = %04X\n", space.device().safe_pc(), offset, data); logerror("%08X:Unhandled protection W @ %05X = %04X\n", space.device().safe_pc(), offset, data);
mk_prot_index = 0; m_mk_prot_index = 0;
} }
logerror("%08X:Protection W @ %05X = %04X\n", space.device().safe_pc(), offset, data); logerror("%08X:Protection W @ %05X = %04X\n", space.device().safe_pc(), offset, data);
@ -177,17 +177,17 @@ READ16_MEMBER(midtunit_state::mk2_prot_const_r)
READ16_MEMBER(midtunit_state::mk2_prot_r) READ16_MEMBER(midtunit_state::mk2_prot_r)
{ {
return mk2_prot_data; return m_mk2_prot_data;
} }
READ16_MEMBER(midtunit_state::mk2_prot_shift_r) READ16_MEMBER(midtunit_state::mk2_prot_shift_r)
{ {
return mk2_prot_data >> 1; return m_mk2_prot_data >> 1;
} }
WRITE16_MEMBER(midtunit_state::mk2_prot_w) WRITE16_MEMBER(midtunit_state::mk2_prot_w)
{ {
COMBINE_DATA(&mk2_prot_data); COMBINE_DATA(&m_mk2_prot_data);
} }
@ -240,23 +240,23 @@ static const UINT32 nbajamte_prot_values[128] =
READ16_MEMBER(midtunit_state::nbajam_prot_r) READ16_MEMBER(midtunit_state::nbajam_prot_r)
{ {
int result = nbajam_prot_queue[nbajam_prot_index]; int result = m_nbajam_prot_queue[m_nbajam_prot_index];
if (nbajam_prot_index < 4) if (m_nbajam_prot_index < 4)
nbajam_prot_index++; m_nbajam_prot_index++;
return result; return result;
} }
WRITE16_MEMBER(midtunit_state::nbajam_prot_w) WRITE16_MEMBER(midtunit_state::nbajam_prot_w)
{ {
int table_index = (offset >> 6) & 0x7f; int table_index = (offset >> 6) & 0x7f;
UINT32 protval = nbajam_prot_table[table_index]; UINT32 protval = m_nbajam_prot_table[table_index];
nbajam_prot_queue[0] = data; m_nbajam_prot_queue[0] = data;
nbajam_prot_queue[1] = ((protval >> 24) & 0xff) << 9; m_nbajam_prot_queue[1] = ((protval >> 24) & 0xff) << 9;
nbajam_prot_queue[2] = ((protval >> 16) & 0xff) << 9; m_nbajam_prot_queue[2] = ((protval >> 16) & 0xff) << 9;
nbajam_prot_queue[3] = ((protval >> 8) & 0xff) << 9; m_nbajam_prot_queue[3] = ((protval >> 8) & 0xff) << 9;
nbajam_prot_queue[4] = ((protval >> 0) & 0xff) << 9; m_nbajam_prot_queue[4] = ((protval >> 0) & 0xff) << 9;
nbajam_prot_index = 0; m_nbajam_prot_index = 0;
} }
@ -316,37 +316,37 @@ WRITE16_MEMBER(midtunit_state::jdredd_prot_w)
switch (offset) switch (offset)
{ {
case TOWORD(0x10740): case TOWORD(0x10740):
jdredd_prot_index = 0; m_jdredd_prot_index = 0;
jdredd_prot_table = jdredd_prot_values_10740; m_jdredd_prot_table = jdredd_prot_values_10740;
jdredd_prot_max = sizeof(jdredd_prot_values_10740); m_jdredd_prot_max = sizeof(jdredd_prot_values_10740);
logerror("-- reset prot table 10740\n"); logerror("-- reset prot table 10740\n");
break; break;
case TOWORD(0x13240): case TOWORD(0x13240):
jdredd_prot_index = 0; m_jdredd_prot_index = 0;
jdredd_prot_table = jdredd_prot_values_13240; m_jdredd_prot_table = jdredd_prot_values_13240;
jdredd_prot_max = sizeof(jdredd_prot_values_13240); m_jdredd_prot_max = sizeof(jdredd_prot_values_13240);
logerror("-- reset prot table 13240\n"); logerror("-- reset prot table 13240\n");
break; break;
case TOWORD(0x76540): case TOWORD(0x76540):
jdredd_prot_index = 0; m_jdredd_prot_index = 0;
jdredd_prot_table = jdredd_prot_values_76540; m_jdredd_prot_table = jdredd_prot_values_76540;
jdredd_prot_max = sizeof(jdredd_prot_values_76540); m_jdredd_prot_max = sizeof(jdredd_prot_values_76540);
logerror("-- reset prot table 76540\n"); logerror("-- reset prot table 76540\n");
break; break;
case TOWORD(0x77760): case TOWORD(0x77760):
jdredd_prot_index = 0; m_jdredd_prot_index = 0;
jdredd_prot_table = jdredd_prot_values_77760; m_jdredd_prot_table = jdredd_prot_values_77760;
jdredd_prot_max = sizeof(jdredd_prot_values_77760); m_jdredd_prot_max = sizeof(jdredd_prot_values_77760);
logerror("-- reset prot table 77760\n"); logerror("-- reset prot table 77760\n");
break; break;
case TOWORD(0x80020): case TOWORD(0x80020):
jdredd_prot_index = 0; m_jdredd_prot_index = 0;
jdredd_prot_table = jdredd_prot_values_80020; m_jdredd_prot_table = jdredd_prot_values_80020;
jdredd_prot_max = sizeof(jdredd_prot_values_80020); m_jdredd_prot_max = sizeof(jdredd_prot_values_80020);
logerror("-- reset prot table 80020\n"); logerror("-- reset prot table 80020\n");
break; break;
} }
@ -356,8 +356,8 @@ READ16_MEMBER(midtunit_state::jdredd_prot_r)
{ {
UINT16 result = 0xffff; UINT16 result = 0xffff;
if (jdredd_prot_table && jdredd_prot_index < jdredd_prot_max) if (m_jdredd_prot_table && m_jdredd_prot_index < m_jdredd_prot_max)
result = jdredd_prot_table[jdredd_prot_index++] << 9; result = m_jdredd_prot_table[m_jdredd_prot_index++] << 9;
logerror("%08X:jdredd_prot_r(%04X) = %04X\n", space.device().safe_pcbase(), offset*16, result); logerror("%08X:jdredd_prot_r(%04X) = %04X\n", space.device().safe_pcbase(), offset*16, result);
return result; return result;
@ -392,7 +392,7 @@ void midtunit_state::init_tunit_generic(int sound)
register_state_saving(); register_state_saving();
/* load sound ROMs and set up sound handlers */ /* load sound ROMs and set up sound handlers */
chip_type = sound; m_chip_type = sound;
/* default graphics functionality */ /* default graphics functionality */
@ -437,12 +437,12 @@ void midtunit_state::init_nbajam_common(int te_protection)
/* protection */ /* protection */
if (!te_protection) if (!te_protection)
{ {
nbajam_prot_table = nbajam_prot_values; m_nbajam_prot_table = nbajam_prot_values;
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1b14020, 0x1b2503f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),this), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),this)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1b14020, 0x1b2503f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),this), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),this));
} }
else else
{ {
nbajam_prot_table = nbajamte_prot_values; m_nbajam_prot_table = nbajamte_prot_values;
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1b15f40, 0x1b37f5f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),this), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),this)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1b15f40, 0x1b37f5f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),this), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),this));
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1b95f40, 0x1bb7f5f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),this), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),this)); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1b95f40, 0x1bb7f5f, read16_delegate(FUNC(midtunit_state::nbajam_prot_r),this), write16_delegate(FUNC(midtunit_state::nbajam_prot_w),this));
} }
@ -523,7 +523,7 @@ DRIVER_INIT_MEMBER(midtunit_state,mk2)
MACHINE_RESET_MEMBER(midtunit_state,midtunit) MACHINE_RESET_MEMBER(midtunit_state,midtunit)
{ {
/* reset sound */ /* reset sound */
switch (chip_type) switch (m_chip_type)
{ {
case SOUND_ADPCM: case SOUND_ADPCM:
case SOUND_ADPCM_LARGE: case SOUND_ADPCM_LARGE:
@ -550,12 +550,12 @@ READ16_MEMBER(midtunit_state::midtunit_sound_state_r)
{ {
/* logerror("%08X:Sound status read\n", space.device().safe_pc());*/ /* logerror("%08X:Sound status read\n", space.device().safe_pc());*/
if (chip_type == SOUND_DCS) if (m_chip_type == SOUND_DCS)
return m_dcs->control_r() >> 4; return m_dcs->control_r() >> 4;
if (fake_sound_state) if (m_fake_sound_state)
{ {
fake_sound_state--; m_fake_sound_state--;
return 0; return 0;
} }
return ~0; return ~0;
@ -565,7 +565,7 @@ READ16_MEMBER(midtunit_state::midtunit_sound_r)
{ {
logerror("%08X:Sound data read\n", space.device().safe_pc()); logerror("%08X:Sound data read\n", space.device().safe_pc());
if (chip_type == SOUND_DCS) if (m_chip_type == SOUND_DCS)
return m_dcs->data_r() & 0xff; return m_dcs->data_r() & 0xff;
return ~0; return ~0;
@ -582,7 +582,7 @@ WRITE16_MEMBER(midtunit_state::midtunit_sound_w)
/* call through based on the sound type */ /* call through based on the sound type */
if (ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15) if (ACCESSING_BITS_0_7 && ACCESSING_BITS_8_15)
switch (chip_type) switch (m_chip_type)
{ {
case SOUND_ADPCM: case SOUND_ADPCM:
case SOUND_ADPCM_LARGE: case SOUND_ADPCM_LARGE:
@ -590,7 +590,7 @@ WRITE16_MEMBER(midtunit_state::midtunit_sound_w)
m_adpcm_sound->write(space, offset, data & 0xff); m_adpcm_sound->write(space, offset, data & 0xff);
/* the games seem to check for $82 loops, so this should be just barely enough */ /* the games seem to check for $82 loops, so this should be just barely enough */
fake_sound_state = 128; m_fake_sound_state = 128;
break; break;
case SOUND_DCS: case SOUND_DCS:
@ -598,7 +598,7 @@ WRITE16_MEMBER(midtunit_state::midtunit_sound_w)
m_dcs->reset_w(~data & 0x100); m_dcs->reset_w(~data & 0x100);
m_dcs->data_w(data & 0xff); m_dcs->data_w(data & 0xff);
/* the games seem to check for $82 loops, so this should be just barely enough */ /* the games seem to check for $82 loops, so this should be just barely enough */
fake_sound_state = 128; m_fake_sound_state = 128;
break; break;
} }
} }

View File

@ -113,10 +113,10 @@ WRITE16_MEMBER(midwunit_state::midwunit_io_w)
* *
*************************************/ *************************************/
IOPORT_ARRAY_MEMBER(midwunit_state::wunit_ports) { "IN0", "IN1", "DSW", "IN2" };
READ16_MEMBER(midwunit_state::midwunit_io_r) READ16_MEMBER(midwunit_state::midwunit_io_r)
{ {
static const char *const portnames[] = { "IN0", "IN1", "DSW", "IN2" };
/* apply I/O shuffling */ /* apply I/O shuffling */
offset = m_ioshuffle[offset % 16]; offset = m_ioshuffle[offset % 16];
@ -126,7 +126,7 @@ READ16_MEMBER(midwunit_state::midwunit_io_r)
case 1: case 1:
case 2: case 2:
case 3: case 3:
return ioport(portnames[offset])->read(); return m_ports[offset]->read();
case 4: case 4:
return (m_midway_serial_pic->status_r(space,0) << 12) | midwunit_sound_state_r(space,0,0xffff); return (m_midway_serial_pic->status_r(space,0) << 12) | midwunit_sound_state_r(space,0,0xffff);

View File

@ -110,11 +110,11 @@ READ16_MEMBER(midyunit_state::midyunit_protection_r)
* *
*************************************/ *************************************/
IOPORT_ARRAY_MEMBER(midyunit_state::ports) { "IN0", "IN1", "IN2", "DSW", "UNK0", "UNK1" };
READ16_MEMBER(midyunit_state::midyunit_input_r) READ16_MEMBER(midyunit_state::midyunit_input_r)
{ {
static const char *const portnames[] = { "IN0", "IN1", "IN2", "DSW", "UNK0", "UNK1" }; return m_ports[offset]->read();
return ioport(portnames[offset])->read();
} }
@ -127,10 +127,8 @@ READ16_MEMBER(midyunit_state::midyunit_input_r)
READ16_MEMBER(midyunit_state::term2_input_r) READ16_MEMBER(midyunit_state::term2_input_r)
{ {
static const char *const portnames[] = { "IN0", "IN1", NULL, "DSW", "UNK0", "UNK1" };
if (offset != 2) if (offset != 2)
return ioport(portnames[offset])->read(); return m_ports[offset]->read();
switch (m_term2_analog_select) switch (m_term2_analog_select)
{ {
@ -502,7 +500,7 @@ void midyunit_state::term2_init_common(write16_delegate hack_w)
m_maincpu->space(AS_PROGRAM).install_write_handler(0x01e00000, 0x01e0001f, write16_delegate(FUNC(midyunit_state::term2_sound_w), this)); m_maincpu->space(AS_PROGRAM).install_write_handler(0x01e00000, 0x01e0001f, write16_delegate(FUNC(midyunit_state::term2_sound_w), this));
/* HACK: this prevents the freeze on the movies */ /* HACK: this prevents the freeze on the movies */
/* until we figure whats causing it, this is better than nothing */ /* until we figure what's causing it, this is better than nothing */
m_t2_hack_mem = m_maincpu->space(AS_PROGRAM).install_write_handler(0x010aa0e0, 0x010aa0ff, hack_w); m_t2_hack_mem = m_maincpu->space(AS_PROGRAM).install_write_handler(0x010aa0e0, 0x010aa0ff, hack_w);
} }