From 74dbffb0ba06932dc921d34c755f5ac686aa73df Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Tue, 25 Mar 2014 11:40:17 +0000 Subject: [PATCH] removed some more dead code + cleaned up some function names to clarify their usage. nw. --- src/mame/drivers/megaplay.c | 87 ++++++++---------------------------- src/mame/drivers/megatech.c | 21 +++------ src/mame/includes/megadriv.h | 8 ++-- src/mame/machine/segamsys.c | 26 ++--------- 4 files changed, 31 insertions(+), 111 deletions(-) diff --git a/src/mame/drivers/megaplay.c b/src/mame/drivers/megaplay.c index 3bafe403a81..39e85d80c78 100644 --- a/src/mame/drivers/megaplay.c +++ b/src/mame/drivers/megaplay.c @@ -57,54 +57,6 @@ Bugs: #define MASTER_CLOCK 53693100 -// Interrupt handler - from drivers/segasyse.c -#if 0 -static UINT8 segae_vintpending; -static UINT8 segae_hintpending; -static UINT8 *segae_vdp_regs[]; /* pointer to vdp's registers */ - -static UINT8 hintcount; /* line interrupt counter, decreased each scanline */ - -static INTERRUPT_GEN (megaplay_bios_irq) -{ - int sline; - sline = device->m_screen->vpos(); - - if (sline ==0) { - hintcount = segae_vdp_regs[0][10]; - } - - if (sline <= 192) { -// if (sline != 192) segae_drawscanline(sline,1,1); - - if (sline == 192) - segae_vintpending = 1; - - if (hintcount == 0) { - hintcount = segae_vdp_regs[0][10]; - segae_hintpending = 1; - - if ((segae_vdp_regs[0][0] & 0x10)) { - device->execute().set_input_line(0, HOLD_LINE); - return; - } - - } else { - hintcount--; - } - } - - if (sline > 192) { - hintcount = segae_vdp_regs[0][10]; - - if ( (sline<0xe0) && (segae_vintpending) ) { - device->execute().set_input_line(0, HOLD_LINE); - } - } - -} -#endif - static INPUT_PORTS_START ( megaplay ) PORT_INCLUDE( md_common ) @@ -372,12 +324,12 @@ INPUT_PORTS_END /*MEGAPLAY specific*/ -READ8_MEMBER(mplay_state::megaplay_bios_banksel_r ) +READ8_MEMBER(mplay_state::megaplay_bios_banksel_r) { return m_bios_bank; } -WRITE8_MEMBER(mplay_state::megaplay_bios_banksel_w ) +WRITE8_MEMBER(mplay_state::megaplay_bios_banksel_w) { /* Multi-slot note: Bits 0 and 1 appear to determine the selected game slot. @@ -389,12 +341,12 @@ WRITE8_MEMBER(mplay_state::megaplay_bios_banksel_w ) // logerror("BIOS: ROM bank %i selected [0x%02x]\n",bios_bank >> 6, data); } -READ8_MEMBER(mplay_state::megaplay_bios_gamesel_r ) +READ8_MEMBER(mplay_state::megaplay_bios_gamesel_r) { return m_bios_6403; } -WRITE8_MEMBER(mplay_state::megaplay_bios_gamesel_w ) +WRITE8_MEMBER(mplay_state::megaplay_bios_gamesel_w) { m_bios_6403 = data; @@ -402,7 +354,7 @@ WRITE8_MEMBER(mplay_state::megaplay_bios_gamesel_w ) m_bios_mode = data & 0x10; } -WRITE16_MEMBER(mplay_state::megaplay_io_write ) +WRITE16_MEMBER(mplay_state::megaplay_io_write) { if (offset == 0x03) m_megadrive_io_data_regs[2] = (data & m_megadrive_io_ctrl_regs[2]) | (m_megadrive_io_data_regs[2] & ~m_megadrive_io_ctrl_regs[2]); @@ -410,7 +362,7 @@ WRITE16_MEMBER(mplay_state::megaplay_io_write ) megadriv_68k_io_write(space, offset & 0x1f, data, 0xffff); } -READ16_MEMBER(mplay_state::megaplay_io_read ) +READ16_MEMBER(mplay_state::megaplay_io_read) { if (offset == 0x03) return m_megadrive_io_data_regs[2]; @@ -418,7 +370,7 @@ READ16_MEMBER(mplay_state::megaplay_io_read ) return megadriv_68k_io_read(space, offset & 0x1f, 0xffff); } -READ8_MEMBER(mplay_state::bank_r ) +READ8_MEMBER(mplay_state::bank_r) { UINT8* bank = memregion("mtbios")->base(); UINT32 fulladdress = m_mp_bios_bank_addr + offset; @@ -458,7 +410,7 @@ READ8_MEMBER(mplay_state::bank_r ) } -WRITE8_MEMBER(mplay_state::bank_w ) +WRITE8_MEMBER(mplay_state::bank_w) { UINT32 fulladdress = m_mp_bios_bank_addr + offset; @@ -489,38 +441,38 @@ WRITE8_MEMBER(mplay_state::bank_w ) /* Megaplay BIOS handles regs[2] at start in a different way compared to megadrive */ /* other io data/ctrl regs are dealt with exactly like in the console */ -READ8_MEMBER(mplay_state::megaplay_bios_6402_r ) +READ8_MEMBER(mplay_state::megaplay_bios_6402_r) { return m_megadrive_io_data_regs[2];// & 0xfe; } -WRITE8_MEMBER(mplay_state::megaplay_bios_6402_w ) +WRITE8_MEMBER(mplay_state::megaplay_bios_6402_w) { m_megadrive_io_data_regs[2] = (m_megadrive_io_data_regs[2] & 0x07) | ((data & 0x70) >> 1); // logerror("BIOS: 0x6402 write: 0x%02x\n", data); } -READ8_MEMBER(mplay_state::megaplay_bios_6204_r ) +READ8_MEMBER(mplay_state::megaplay_bios_6204_r) { return m_megadrive_io_data_regs[2]; // return (m_bios_width & 0xf8) + (m_bios_6204 & 0x07); } -WRITE8_MEMBER(mplay_state::megaplay_bios_width_w ) +WRITE8_MEMBER(mplay_state::megaplay_bios_width_w) { m_bios_width = data; m_megadrive_io_data_regs[2] = (m_megadrive_io_data_regs[2] & 0x07) | ((data & 0xf8)); // logerror("BIOS: 0x6204 - Width write: %02x\n", data); } -READ8_MEMBER(mplay_state::megaplay_bios_6404_r ) +READ8_MEMBER(mplay_state::megaplay_bios_6404_r) { // logerror("BIOS: 0x6404 read: returned 0x%02x\n",bios_6404 | (bios_6403 & 0x10) >> 4); return (m_bios_6404 & 0xfe) | ((m_bios_6403 & 0x10) >> 4); // return m_bios_6404 | (m_bios_6403 & 0x10) >> 4; } -WRITE8_MEMBER(mplay_state::megaplay_bios_6404_w ) +WRITE8_MEMBER(mplay_state::megaplay_bios_6404_w) { if(((m_bios_6404 & 0x0c) == 0x00) && ((data & 0x0c) == 0x0c)) m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); @@ -529,7 +481,7 @@ WRITE8_MEMBER(mplay_state::megaplay_bios_6404_w ) // logerror("BIOS: 0x6404 write: 0x%02x\n", data); } -READ8_MEMBER(mplay_state::megaplay_bios_6600_r ) +READ8_MEMBER(mplay_state::megaplay_bios_6600_r) { /* Multi-slot note: 0x6600 appears to be used to check for extra slots being used. @@ -540,13 +492,13 @@ READ8_MEMBER(mplay_state::megaplay_bios_6600_r ) return m_bios_6600;// & 0xfe; } -WRITE8_MEMBER(mplay_state::megaplay_bios_6600_w ) +WRITE8_MEMBER(mplay_state::megaplay_bios_6600_w) { m_bios_6600 = data; // logerror("BIOS: 0x6600 write: 0x%02x\n",data); } -WRITE8_MEMBER(mplay_state::megaplay_game_w ) +WRITE8_MEMBER(mplay_state::megaplay_game_w) { if (m_readpos == 1) m_game_banksel = 0; @@ -600,14 +552,12 @@ VIDEO_START_MEMBER(mplay_state,megplay) { //printf("megplay vs\n"); VIDEO_START_CALL_MEMBER(megadriv); -// VIDEO_START_CALL_MEMBER(megaplay_normal); } UINT32 mplay_state::screen_update_megplay(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { //printf("megplay vu\n"); screen_update_megadriv(screen,bitmap,cliprect); -// screen_update_megaplay_normal(screen,bitmap,cliprect); screen_update_megaplay_bios(screen,bitmap,cliprect); return 0; } @@ -871,8 +821,7 @@ DRIVER_INIT_MEMBER(mplay_state,megaplay) /* instead of a RAM mirror the 68k sees the extra ram of the 2nd z80 too */ m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xa02000, 0xa03fff, read16_delegate(FUNC(mplay_state::megadriv_68k_read_z80_extra_ram),this), write16_delegate(FUNC(mplay_state::megadriv_68k_write_z80_extra_ram),this)); - init_megatech_bios(); - + init_megaplay_legacy_overlay(); } /* diff --git a/src/mame/drivers/megatech.c b/src/mame/drivers/megatech.c index f0b02f0ca5f..d2414af5924 100644 --- a/src/mame/drivers/megatech.c +++ b/src/mame/drivers/megatech.c @@ -273,15 +273,13 @@ TIMER_CALLBACK_MEMBER(mtech_state::megatech_z80_stop_state ) machine().device("ymsnd")->reset(); megadriv_stop_scanline_timer();// stop the scanline timer for the genesis vdp... it can be restarted in video eof when needed - segae_md_sms_stop_scanline_timer();// stop the scanline timer for the sms vdp + megatech_sms_stop_scanline_timer();// stop the scanline timer for the sms vdp /* if the regions exist we're fine */ if (game_region) { - { - timer_set(attotime::zero, TIMER_Z80_RUN_STATE, param); - } + timer_set(attotime::zero, TIMER_Z80_RUN_STATE, param); } else { @@ -324,13 +322,11 @@ WRITE8_MEMBER(mtech_state::bios_ctrl_w ) { if (offset == 1) { - output_set_value("Alarm_sound", data>>7 & 0x01); + output_set_value("Alarm_sound", BIT(data, 7)); m_bios_ctrl_inputs = data & 0x04; // Genesis/SMS input ports disable bit } else if (offset == 2) - { - output_set_value("Flash_screen", data>>1 & 0x01); - } + output_set_value("Flash_screen", BIT(data, 1)); m_bios_ctrl[offset] = data; } @@ -351,14 +347,9 @@ WRITE8_MEMBER(mtech_state::megatech_z80_write_68k_banked_data ) space68k.write_byte(m_mt_bank_addr + offset,data); } -void mtech_state::megatech_z80_bank_w(UINT16 data) -{ - m_mt_bank_addr = ((m_mt_bank_addr >> 1) | (data << 23)) & 0xff8000; -} - WRITE8_MEMBER(mtech_state::mt_z80_bank_w ) { - megatech_z80_bank_w(data & 1); + m_mt_bank_addr = ((m_mt_bank_addr >> 1) | (data << 23)) & 0xff8000; } READ8_MEMBER(mtech_state::megatech_banked_ram_r ) @@ -452,7 +443,7 @@ UINT32 mtech_state::screen_update_mtnew(screen_device &screen, bitmap_rgb32 &bit if (!m_current_game_is_sms) screen_update_megadriv(screen, bitmap, cliprect); else - screen_update_megatech_md_sms(screen, bitmap, cliprect); + screen_update_megatech_sms(screen, bitmap, cliprect); return 0; } diff --git a/src/mame/includes/megadriv.h b/src/mame/includes/megadriv.h index 1a0bb5be246..c9925356d3e 100644 --- a/src/mame/includes/megadriv.h +++ b/src/mame/includes/megadriv.h @@ -335,10 +335,9 @@ public: }; - UINT32 screen_update_megatech_bios(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_megaplay_bios(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - UINT32 screen_update_megatech_md_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - void init_megatech_bios(); + UINT32 screen_update_megatech_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void init_megaplay_legacy_overlay(); DECLARE_MACHINE_RESET(megatech_bios); DECLARE_MACHINE_RESET(megatech_md_sms); void screen_eof_megatech_bios(screen_device &screen, bool state); @@ -351,7 +350,7 @@ public: DECLARE_WRITE8_MEMBER( sms_vdp_ctrl_w ); void init_for_megadrive(); - void segae_md_sms_stop_scanline_timer(); + void megatech_sms_stop_scanline_timer(); void megatech_set_genz80_as_sms_standard_map(const char* tag); private: @@ -516,7 +515,6 @@ public: DECLARE_WRITE8_MEMBER( bios_ctrl_w ); DECLARE_READ8_MEMBER( megatech_z80_read_68k_banked_data ); DECLARE_WRITE8_MEMBER( megatech_z80_write_68k_banked_data ); - void megatech_z80_bank_w(UINT16 data); DECLARE_WRITE8_MEMBER( mt_z80_bank_w ); DECLARE_READ8_MEMBER( megatech_banked_ram_r ); DECLARE_WRITE8_MEMBER( megatech_banked_ram_w ); diff --git a/src/mame/machine/segamsys.c b/src/mame/machine/segamsys.c index 65d339909ab..f902c80de8c 100644 --- a/src/mame/machine/segamsys.c +++ b/src/mame/machine/segamsys.c @@ -320,7 +320,7 @@ void *segamsys_state::start_vdp(int type) } /* stop timer and clear ram.. used on megatech when we switch between genesis and sms mode */ -void segamsys_state::segae_md_sms_stop_scanline_timer() +void segamsys_state::megatech_sms_stop_scanline_timer() { md_sms_vdp->sms_scanline_timer->adjust(attotime::never); memset(md_sms_vdp->vram,0x00,0x4000); @@ -974,7 +974,7 @@ void segamsys_state::screen_eof_megatech_bios(screen_device &screen, bool state) end_of_frame(screen, vdp1); } -UINT32 segamsys_state::screen_update_megatech_md_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +UINT32 segamsys_state::screen_update_megatech_sms(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { int x,y; @@ -993,24 +993,6 @@ UINT32 segamsys_state::screen_update_megatech_md_sms(screen_device &screen, bitm } -UINT32 segamsys_state::screen_update_megatech_bios(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - int x,y; - - for (y=0;y<224;y++) - { - UINT32* lineptr = &bitmap.pix32(y); - UINT32* srcptr = &vdp1->r_bitmap->pix32(y); - - for (x=0;x<256;x++) - { - lineptr[x]=srcptr[x]; - } - } - - return 0; -} - UINT32 segamsys_state::screen_update_megaplay_bios(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { int x,y; @@ -1045,7 +1027,7 @@ void segamsys_state::init_for_megadrive() -void segamsys_state::init_megatech_bios() +void segamsys_state::init_megaplay_legacy_overlay() { vdp1 = (struct sms_vdp *)start_vdp(SMS2_VDP); vdp1->set_irq = segamsys_state::sms_vdp_cpu2_irq_callback; @@ -1142,7 +1124,7 @@ void segamsys_state::megatech_set_genz80_as_sms_standard_ports(const char* tag) io.install_readwrite_handler(0x0000, 0xffff, read8_delegate(FUNC(segamsys_state::z80_unmapped_port_r),this), write8_delegate(FUNC(segamsys_state::sms_z80_unmapped_port_w),this)); io.install_read_handler (0x7e, 0x7e, read8_delegate(FUNC(segamsys_state::md_sms_vdp_vcounter_r),this)); - io.install_write_handler (0x7e, 0x7f, write8_delegate(FUNC(sn76496_device::write),sn)); + io.install_write_handler (0x7e, 0x7f, write8_delegate(FUNC(sn76496_device::write),sn)); io.install_readwrite_handler (0xbe, 0xbe, read8_delegate(FUNC(segamsys_state::md_sms_vdp_data_r),this), write8_delegate(FUNC(segamsys_state::md_sms_vdp_data_w),this)); io.install_readwrite_handler (0xbf, 0xbf, read8_delegate(FUNC(segamsys_state::md_sms_vdp_ctrl_r),this), write8_delegate(FUNC(segamsys_state::md_sms_vdp_ctrl_w),this));