From 888b26da776c96a56e61f51b565060f7431e395c Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Mon, 23 Feb 2015 17:25:40 +0100 Subject: retofinv.c, thedeep.c: added save state support (nw) --- src/mame/drivers/retofinv.c | 59 +++++++++++++++++++++++---------- src/mame/drivers/seicross.c | 1 + src/mame/drivers/thedeep.c | 79 +++++++++++++++++++++++--------------------- src/mame/includes/retofinv.h | 67 ++++++++++++++++++++----------------- src/mame/includes/thedeep.h | 73 +++++++++++++++++++++------------------- src/mame/machine/retofinv.c | 24 +++++++------- src/mame/video/retofinv.c | 11 +++--- src/mame/video/thedeep.c | 6 ++-- 8 files changed, 182 insertions(+), 138 deletions(-) diff --git a/src/mame/drivers/retofinv.c b/src/mame/drivers/retofinv.c index fef30114219..a0e78b17adc 100644 --- a/src/mame/drivers/retofinv.c +++ b/src/mame/drivers/retofinv.c @@ -35,6 +35,29 @@ Notes: #include "includes/retofinv.h" +void retofinv_state::machine_start() +{ + save_item(NAME(m_main_irq_mask)); + save_item(NAME(m_sub_irq_mask)); + save_item(NAME(m_cpu2_m6000)); + + if (m_68705 != NULL) // only for the parent (with MCU) + { + save_item(NAME(m_from_main)); + save_item(NAME(m_from_mcu)); + save_item(NAME(m_mcu_sent)); + save_item(NAME(m_main_sent)); + save_item(NAME(m_portA_in)); + save_item(NAME(m_portA_out)); + save_item(NAME(m_ddrA)); + save_item(NAME(m_portB_in)); + save_item(NAME(m_portB_out)); + save_item(NAME(m_ddrB)); + save_item(NAME(m_portC_in)); + save_item(NAME(m_portC_out)); + save_item(NAME(m_ddrC)); + } +} WRITE8_MEMBER(retofinv_state::cpu1_reset_w) { @@ -99,14 +122,14 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, retofinv_state ) AM_RANGE(0x7fff, 0x7fff) AM_WRITE(coincounter_w) AM_RANGE(0x7b00, 0x7bff) AM_ROM /* space for diagnostic ROM? The code looks */ /* for a string here, and jumps if it's present */ - AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(retofinv_fg_videoram_w) AM_SHARE("fg_videoram") + AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(fg_videoram_w) AM_SHARE("fg_videoram") AM_RANGE(0x8800, 0x9fff) AM_RAM AM_SHARE("sharedram") - AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(retofinv_bg_videoram_w) AM_SHARE("bg_videoram") - AM_RANGE(0xb800, 0xb802) AM_WRITE(retofinv_gfx_ctrl_w) + AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(bg_videoram_w) AM_SHARE("bg_videoram") + AM_RANGE(0xb800, 0xb802) AM_WRITE(gfx_ctrl_w) AM_RANGE(0xc000, 0xc000) AM_READ_PORT("P1") AM_RANGE(0xc001, 0xc001) AM_READ_PORT("P2") AM_RANGE(0xc002, 0xc002) AM_READNOP /* bit 7 must be 0, otherwise game resets */ - AM_RANGE(0xc003, 0xc003) AM_READ(retofinv_mcu_status_r) + AM_RANGE(0xc003, 0xc003) AM_READ(mcu_status_r) AM_RANGE(0xc004, 0xc004) AM_READ_PORT("SYSTEM") AM_RANGE(0xc005, 0xc005) AM_READ_PORT("DSW1") AM_RANGE(0xc006, 0xc006) AM_READ_PORT("DSW2") @@ -119,16 +142,16 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, retofinv_state ) AM_RANGE(0xc805, 0xc805) AM_WRITE(cpu1_reset_w) AM_RANGE(0xd000, 0xd000) AM_WRITE(watchdog_reset_w) AM_RANGE(0xd800, 0xd800) AM_WRITE(soundcommand_w) - AM_RANGE(0xe000, 0xe000) AM_READ(retofinv_mcu_r) - AM_RANGE(0xe800, 0xe800) AM_WRITE(retofinv_mcu_w) + AM_RANGE(0xe000, 0xe000) AM_READ(mcu_r) + AM_RANGE(0xe800, 0xe800) AM_WRITE(mcu_w) AM_RANGE(0xf800, 0xf800) AM_READ(cpu0_mf800_r) ADDRESS_MAP_END static ADDRESS_MAP_START( sub_map, AS_PROGRAM, 8, retofinv_state ) AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(retofinv_fg_videoram_w) AM_SHARE("fg_videoram") + AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(fg_videoram_w) AM_SHARE("fg_videoram") AM_RANGE(0x8800, 0x9fff) AM_RAM AM_SHARE("sharedram") - AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(retofinv_bg_videoram_w) AM_SHARE("bg_videoram") + AM_RANGE(0xa000, 0xa7ff) AM_RAM_WRITE(bg_videoram_w) AM_SHARE("bg_videoram") AM_RANGE(0xc804, 0xc804) AM_WRITE(irq1_ack_w) ADDRESS_MAP_END @@ -144,12 +167,12 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( mcu_map, AS_PROGRAM, 8, retofinv_state ) ADDRESS_MAP_GLOBAL_MASK(0x7ff) - AM_RANGE(0x0000, 0x0000) AM_READWRITE(retofinv_68705_portA_r, retofinv_68705_portA_w) - AM_RANGE(0x0001, 0x0001) AM_READWRITE(retofinv_68705_portB_r, retofinv_68705_portB_w) - AM_RANGE(0x0002, 0x0002) AM_READWRITE(retofinv_68705_portC_r, retofinv_68705_portC_w) - AM_RANGE(0x0004, 0x0004) AM_WRITE(retofinv_68705_ddrA_w) - AM_RANGE(0x0005, 0x0005) AM_WRITE(retofinv_68705_ddrB_w) - AM_RANGE(0x0006, 0x0006) AM_WRITE(retofinv_68705_ddrC_w) + AM_RANGE(0x0000, 0x0000) AM_READWRITE(mcu_portA_r, mcu_portA_w) + AM_RANGE(0x0001, 0x0001) AM_READWRITE(mcu_portB_r, mcu_portB_w) + AM_RANGE(0x0002, 0x0002) AM_READWRITE(mcu_portC_r, mcu_portC_w) + AM_RANGE(0x0004, 0x0004) AM_WRITE(mcu_ddrA_w) + AM_RANGE(0x0005, 0x0005) AM_WRITE(mcu_ddrB_w) + AM_RANGE(0x0006, 0x0006) AM_WRITE(mcu_ddrC_w) AM_RANGE(0x0010, 0x007f) AM_RAM AM_RANGE(0x0080, 0x07ff) AM_ROM ADDRESS_MAP_END @@ -367,7 +390,7 @@ static MACHINE_CONFIG_START( retofinv, retofinv_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(36*8, 28*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 0*8, 28*8-1) - MCFG_SCREEN_UPDATE_DRIVER(retofinv_state, screen_update_retofinv) + MCFG_SCREEN_UPDATE_DRIVER(retofinv_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", retofinv) @@ -501,6 +524,6 @@ ROM_END -GAME( 1985, retofinv, 0, retofinv, retofinv, driver_device, 0, ROT90, "Taito Corporation", "Return of the Invaders", 0 ) -GAME( 1985, retofinv1,retofinv, retofinb, retofinv, driver_device, 0, ROT90, "bootleg", "Return of the Invaders (bootleg set 1)", 0 ) -GAME( 1985, retofinv2,retofinv, retofinb, retofin2, driver_device, 0, ROT90, "bootleg", "Return of the Invaders (bootleg set 2)", 0 ) +GAME( 1985, retofinv, 0, retofinv, retofinv, driver_device, 0, ROT90, "Taito Corporation", "Return of the Invaders", GAME_SUPPORTS_SAVE ) +GAME( 1985, retofinv1,retofinv, retofinb, retofinv, driver_device, 0, ROT90, "bootleg", "Return of the Invaders (bootleg set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1985, retofinv2,retofinv, retofinb, retofin2, driver_device, 0, ROT90, "bootleg", "Return of the Invaders (bootleg set 2)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/seicross.c b/src/mame/drivers/seicross.c index d6e5ac58e21..0a381a64337 100644 --- a/src/mame/drivers/seicross.c +++ b/src/mame/drivers/seicross.c @@ -86,6 +86,7 @@ WRITE8_MEMBER(seicross_state::portB_w) m_irq_mask = data & 1; /* bit 1 flips screen */ + flip_screen_set(data & 2); /* bit 2 resets the microcontroller */ if (((m_portb & 4) == 0) && (data & 4)) diff --git a/src/mame/drivers/thedeep.c b/src/mame/drivers/thedeep.c index 254b7d0b85e..86e04014489 100644 --- a/src/mame/drivers/thedeep.c +++ b/src/mame/drivers/thedeep.c @@ -38,17 +38,27 @@ Notes: ***************************************************************************/ -WRITE8_MEMBER(thedeep_state::thedeep_nmi_w) +WRITE8_MEMBER(thedeep_state::nmi_w) { m_nmi_enable = data; } -WRITE8_MEMBER(thedeep_state::thedeep_sound_w) +WRITE8_MEMBER(thedeep_state::sound_w) { soundlatch_byte_w(space, 0, data); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } +void thedeep_state::machine_start() +{ + save_item(NAME(m_nmi_enable)); + save_item(NAME(m_protection_command)); + save_item(NAME(m_protection_data)); + save_item(NAME(m_protection_index)); + save_item(NAME(m_protection_irq)); + save_item(NAME(m_rombank)); + save_item(NAME(m_mcu_p3_reg)); +} void thedeep_state::machine_reset() { @@ -63,7 +73,7 @@ void thedeep_state::machine_reset() m_rombank = -1; } -WRITE8_MEMBER(thedeep_state::thedeep_protection_w) +WRITE8_MEMBER(thedeep_state::protection_w) { m_protection_command = data; switch (m_protection_command) @@ -126,18 +136,18 @@ WRITE8_MEMBER(thedeep_state::thedeep_protection_w) } } -READ8_MEMBER(thedeep_state::thedeep_e004_r) +READ8_MEMBER(thedeep_state::e004_r) { return m_protection_irq ? 1 : 0; } -READ8_MEMBER(thedeep_state::thedeep_protection_r) +READ8_MEMBER(thedeep_state::protection_r) { m_protection_irq = 0; return m_protection_data; } -WRITE8_MEMBER(thedeep_state::thedeep_e100_w) +WRITE8_MEMBER(thedeep_state::e100_w) { if (data != 1) logerror("pc %04x: e100 = %02x\n", space.device().safe_pc(),data); @@ -148,18 +158,18 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, thedeep_state ) AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") // ROM (banked) AM_RANGE(0xc000, 0xcfff) AM_RAM AM_RANGE(0xd000, 0xdfff) AM_RAM // RAM (MCU data copied here) - AM_RANGE(0xe000, 0xe000) AM_READWRITE(thedeep_protection_r, thedeep_protection_w) // To MCU - AM_RANGE(0xe004, 0xe004) AM_READWRITE(thedeep_e004_r, thedeep_nmi_w) // + AM_RANGE(0xe000, 0xe000) AM_READWRITE(protection_r, protection_w) // To MCU + AM_RANGE(0xe004, 0xe004) AM_READWRITE(e004_r, nmi_w) // AM_RANGE(0xe008, 0xe008) AM_READ_PORT("e008") // P1 (Inputs) AM_RANGE(0xe009, 0xe009) AM_READ_PORT("e009") // P2 AM_RANGE(0xe00a, 0xe00a) AM_READ_PORT("e00a") // DSW1 AM_RANGE(0xe00b, 0xe00b) AM_READ_PORT("e00b") // DSW2 - AM_RANGE(0xe00c, 0xe00c) AM_WRITE(thedeep_sound_w) // To Sound CPU - AM_RANGE(0xe100, 0xe100) AM_WRITE(thedeep_e100_w) // ? + AM_RANGE(0xe00c, 0xe00c) AM_WRITE(sound_w) // To Sound CPU + AM_RANGE(0xe100, 0xe100) AM_WRITE(e100_w) // ? AM_RANGE(0xe210, 0xe213) AM_WRITEONLY AM_SHARE("scroll") // Scroll AM_RANGE(0xe400, 0xe7ff) AM_RAM AM_SHARE("spriteram") // Sprites - AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(thedeep_vram_1_w) AM_SHARE("vram_1") // Text Layer - AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(thedeep_vram_0_w) AM_SHARE("vram_0") // Background Layer + AM_RANGE(0xe800, 0xefff) AM_RAM_WRITE(vram_1_w) AM_SHARE("vram_1") // Text Layer + AM_RANGE(0xf000, 0xf7ff) AM_RAM_WRITE(vram_0_w) AM_SHARE("vram_0") // Background Layer AM_RANGE(0xf800, 0xf83f) AM_RAM AM_SHARE("scroll2") // Column Scroll AM_RANGE(0xf840, 0xffff) AM_RAM ADDRESS_MAP_END @@ -185,7 +195,7 @@ ADDRESS_MAP_END ***************************************************************************/ -void thedeep_state::thedeep_maincpu_bankswitch(UINT8 bank_trig) +void thedeep_state::maincpu_bankswitch(UINT8 bank_trig) { UINT8 *rom; int new_rombank = bank_trig & 3; @@ -198,14 +208,14 @@ void thedeep_state::thedeep_maincpu_bankswitch(UINT8 bank_trig) } -WRITE8_MEMBER(thedeep_state::thedeep_p1_w) +WRITE8_MEMBER(thedeep_state::p1_w) { flip_screen_set((data & 1) ^ 1); - thedeep_maincpu_bankswitch((data & 6) >> 1); + maincpu_bankswitch((data & 6) >> 1); logerror("P1 %02x\n",data); } -READ8_MEMBER(thedeep_state::thedeep_from_main_r) +READ8_MEMBER(thedeep_state::from_main_r) { static UINT8 res; @@ -215,12 +225,12 @@ READ8_MEMBER(thedeep_state::thedeep_from_main_r) return 0x20; } -WRITE8_MEMBER(thedeep_state::thedeep_to_main_w) +WRITE8_MEMBER(thedeep_state::to_main_w) { // ... } -WRITE8_MEMBER(thedeep_state::thedeep_p3_w) +WRITE8_MEMBER(thedeep_state::p3_w) { /* bit 0 0->1 transition IRQ0 to main */ if((!(m_mcu_p3_reg & 0x01)) && data & 0x01) @@ -238,7 +248,7 @@ WRITE8_MEMBER(thedeep_state::thedeep_p3_w) logerror("P3 %02x\n",data); } -READ8_MEMBER(thedeep_state::thedeep_p0_r) +READ8_MEMBER(thedeep_state::p0_r) { UINT8 coin_mux; @@ -249,10 +259,10 @@ READ8_MEMBER(thedeep_state::thedeep_p0_r) static ADDRESS_MAP_START( mcu_io_map, AS_IO, 8, thedeep_state ) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(MCS51_PORT_P0,MCS51_PORT_P0) AM_READ(thedeep_p0_r) - AM_RANGE(MCS51_PORT_P1,MCS51_PORT_P1) AM_WRITE(thedeep_p1_w) - AM_RANGE(MCS51_PORT_P2,MCS51_PORT_P2) AM_READWRITE(thedeep_from_main_r,thedeep_to_main_w) - AM_RANGE(MCS51_PORT_P3,MCS51_PORT_P3) AM_WRITE(thedeep_p3_w) + AM_RANGE(MCS51_PORT_P0,MCS51_PORT_P0) AM_READ(p0_r) + AM_RANGE(MCS51_PORT_P1,MCS51_PORT_P1) AM_WRITE(p1_w) + AM_RANGE(MCS51_PORT_P2,MCS51_PORT_P2) AM_READWRITE(from_main_r,to_main_w) + AM_RANGE(MCS51_PORT_P3,MCS51_PORT_P3) AM_WRITE(p3_w) ADDRESS_MAP_END @@ -382,12 +392,7 @@ GFXDECODE_END ***************************************************************************/ -WRITE_LINE_MEMBER(thedeep_state::irqhandler) -{ - m_audiocpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE); -} - -TIMER_DEVICE_CALLBACK_MEMBER(thedeep_state::thedeep_interrupt) +TIMER_DEVICE_CALLBACK_MEMBER(thedeep_state::interrupt) { int scanline = param; @@ -417,7 +422,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(thedeep_state::thedeep_interrupt) } } -INTERRUPT_GEN_MEMBER(thedeep_state::thedeep_mcu_irq) +INTERRUPT_GEN_MEMBER(thedeep_state::mcu_irq) { m_mcu->set_input_line(MCS51_INT1_LINE, ASSERT_LINE); } @@ -427,7 +432,7 @@ static MACHINE_CONFIG_START( thedeep, thedeep_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz/2) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", thedeep_state, thedeep_interrupt, "screen", 0, 1) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", thedeep_state, interrupt, "screen", 0, 1) MCFG_CPU_ADD("audiocpu", M65C02, XTAL_12MHz/8) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(audio_map) @@ -436,7 +441,7 @@ static MACHINE_CONFIG_START( thedeep, thedeep_state ) /* MCU is a i8751 running at 8Mhz (8mhz xtal)*/ MCFG_CPU_ADD("mcu", I8751, XTAL_8MHz) MCFG_CPU_IO_MAP(mcu_io_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", thedeep_state, thedeep_mcu_irq) // unknown source, but presumably vblank + MCFG_CPU_VBLANK_INT_DRIVER("screen", thedeep_state, mcu_irq) // unknown source, but presumably vblank MCFG_DEVICE_DISABLE() @@ -446,7 +451,7 @@ static MACHINE_CONFIG_START( thedeep, thedeep_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(0x100, 0xf8) MCFG_SCREEN_VISIBLE_AREA(0, 0x100-1, 0, 0xf8-1) - MCFG_SCREEN_UPDATE_DRIVER(thedeep_state, screen_update_thedeep) + MCFG_SCREEN_UPDATE_DRIVER(thedeep_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", thedeep) @@ -458,7 +463,7 @@ static MACHINE_CONFIG_START( thedeep, thedeep_state ) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("ymsnd", YM2203, XTAL_12MHz/4) /* verified on pcb */ - MCFG_YM2203_IRQ_HANDLER(WRITELINE(thedeep_state, irqhandler)) + MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END @@ -474,7 +479,7 @@ MACHINE_CONFIG_END Here are the proms for The Deep! NOTE: This game is Vertical. -I couldn't test this board so I don't know the manufakturer, sorry. +I couldn't test this board so I don't know the manufacturer, sorry. 1 Z80 1 R6502 1 YM 2203 @@ -553,5 +558,5 @@ ROM_START( rundeep ) ROM_LOAD( "fi-3", 0x400, 0x200, CRC(f61a9686) SHA1(24082f60b72268d240ceca6999bdf18872625cd2) ) ROM_END -GAME( 1987, thedeep, 0, thedeep, thedeep, driver_device, 0, ROT270, "Wood Place Inc.", "The Deep (Japan)", 0 ) -GAME( 1988, rundeep, thedeep,thedeep, thedeep, driver_device, 0, ROT270, "bootleg (Cream)", "Run Deep", 0 ) +GAME( 1987, thedeep, 0, thedeep, thedeep, driver_device, 0, ROT270, "Wood Place Inc.", "The Deep (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1988, rundeep, thedeep,thedeep, thedeep, driver_device, 0, ROT270, "bootleg (Cream)", "Run Deep", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/includes/retofinv.h b/src/mame/includes/retofinv.h index 66310d14fa2..b4f1f9534a3 100644 --- a/src/mame/includes/retofinv.h +++ b/src/mame/includes/retofinv.h @@ -3,20 +3,30 @@ class retofinv_state : public driver_device public: retofinv_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_fg_videoram(*this, "fg_videoram"), - m_sharedram(*this, "sharedram"), - m_bg_videoram(*this, "bg_videoram"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_subcpu(*this, "sub"), m_68705(*this, "68705"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_fg_videoram(*this, "fg_videoram"), + m_sharedram(*this, "sharedram"), + m_bg_videoram(*this, "bg_videoram") { } - UINT8 m_cpu2_m6000; + required_device m_maincpu; + required_device m_audiocpu; + required_device m_subcpu; + optional_device m_68705; + required_device m_gfxdecode; + required_device m_palette; + required_shared_ptr m_fg_videoram; required_shared_ptr m_sharedram; required_shared_ptr m_bg_videoram; + + UINT8 m_main_irq_mask; + UINT8 m_sub_irq_mask; + UINT8 m_cpu2_m6000; UINT8 m_from_main; UINT8 m_from_mcu; int m_mcu_sent; @@ -35,8 +45,6 @@ public: tilemap_t *m_bg_tilemap; tilemap_t *m_fg_tilemap; - UINT8 m_main_irq_mask; - UINT8 m_sub_irq_mask; DECLARE_WRITE8_MEMBER(cpu1_reset_w); DECLARE_WRITE8_MEMBER(cpu2_reset_w); DECLARE_WRITE8_MEMBER(mcu_reset_w); @@ -47,34 +55,33 @@ public: DECLARE_WRITE8_MEMBER(irq1_ack_w); DECLARE_WRITE8_MEMBER(coincounter_w); DECLARE_WRITE8_MEMBER(coinlockout_w); - DECLARE_READ8_MEMBER(retofinv_68705_portA_r); - DECLARE_WRITE8_MEMBER(retofinv_68705_portA_w); - DECLARE_WRITE8_MEMBER(retofinv_68705_ddrA_w); - DECLARE_READ8_MEMBER(retofinv_68705_portB_r); - DECLARE_WRITE8_MEMBER(retofinv_68705_portB_w); - DECLARE_WRITE8_MEMBER(retofinv_68705_ddrB_w); - DECLARE_READ8_MEMBER(retofinv_68705_portC_r); - DECLARE_WRITE8_MEMBER(retofinv_68705_portC_w); - DECLARE_WRITE8_MEMBER(retofinv_68705_ddrC_w); - DECLARE_WRITE8_MEMBER(retofinv_mcu_w); - DECLARE_READ8_MEMBER(retofinv_mcu_r); - DECLARE_READ8_MEMBER(retofinv_mcu_status_r); - DECLARE_WRITE8_MEMBER(retofinv_bg_videoram_w); - DECLARE_WRITE8_MEMBER(retofinv_fg_videoram_w); - DECLARE_WRITE8_MEMBER(retofinv_gfx_ctrl_w); + DECLARE_READ8_MEMBER(mcu_portA_r); + DECLARE_WRITE8_MEMBER(mcu_portA_w); + DECLARE_WRITE8_MEMBER(mcu_ddrA_w); + DECLARE_READ8_MEMBER(mcu_portB_r); + DECLARE_WRITE8_MEMBER(mcu_portB_w); + DECLARE_WRITE8_MEMBER(mcu_ddrB_w); + DECLARE_READ8_MEMBER(mcu_portC_r); + DECLARE_WRITE8_MEMBER(mcu_portC_w); + DECLARE_WRITE8_MEMBER(mcu_ddrC_w); + DECLARE_WRITE8_MEMBER(mcu_w); + DECLARE_READ8_MEMBER(mcu_r); + DECLARE_READ8_MEMBER(mcu_status_r); + DECLARE_WRITE8_MEMBER(bg_videoram_w); + DECLARE_WRITE8_MEMBER(fg_videoram_w); + DECLARE_WRITE8_MEMBER(gfx_ctrl_w); + TILEMAP_MAPPER_MEMBER(tilemap_scan); TILE_GET_INFO_MEMBER(bg_get_tile_info); TILE_GET_INFO_MEMBER(fg_get_tile_info); + + virtual void machine_start(); virtual void video_start(); DECLARE_PALETTE_INIT(retofinv); - UINT32 screen_update_retofinv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap); + INTERRUPT_GEN_MEMBER(main_vblank_irq); INTERRUPT_GEN_MEMBER(sub_vblank_irq); - void draw_sprites(bitmap_ind16 &bitmap); - required_device m_maincpu; - required_device m_audiocpu; - required_device m_subcpu; - optional_device m_68705; - required_device m_gfxdecode; - required_device m_palette; }; diff --git a/src/mame/includes/thedeep.h b/src/mame/includes/thedeep.h index 1f77092a4ba..d074b169fdf 100644 --- a/src/mame/includes/thedeep.h +++ b/src/mame/includes/thedeep.h @@ -3,61 +3,66 @@ class thedeep_state : public driver_device public: thedeep_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_spriteram(*this, "spriteram"), - m_vram_0(*this, "vram_0"), - m_vram_1(*this, "vram_1"), - m_scroll(*this, "scroll"), - m_scroll2(*this, "scroll2"), m_maincpu(*this,"maincpu"), m_audiocpu(*this, "audiocpu"), m_mcu(*this, "mcu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_spriteram(*this, "spriteram"), + m_vram_0(*this, "vram_0"), + m_vram_1(*this, "vram_1"), + m_scroll(*this, "scroll"), + m_scroll2(*this, "scroll2") { } + + required_device m_maincpu; + required_device m_audiocpu; + required_device m_mcu; + required_device m_gfxdecode; + required_device m_palette; required_shared_ptr m_spriteram; + required_shared_ptr m_vram_0; + required_shared_ptr m_vram_1; + required_shared_ptr m_scroll; + required_shared_ptr m_scroll2; + int m_nmi_enable; UINT8 m_protection_command; UINT8 m_protection_data; int m_protection_index; int m_protection_irq; int m_rombank; - required_shared_ptr m_vram_0; - required_shared_ptr m_vram_1; - required_shared_ptr m_scroll; - required_shared_ptr m_scroll2; tilemap_t *m_tilemap_0; tilemap_t *m_tilemap_1; UINT8 m_mcu_p3_reg; - required_device m_maincpu; - required_device m_audiocpu; - required_device m_mcu; - required_device m_gfxdecode; - required_device m_palette; - - DECLARE_WRITE8_MEMBER(thedeep_nmi_w); - DECLARE_WRITE8_MEMBER(thedeep_sound_w); - DECLARE_WRITE8_MEMBER(thedeep_protection_w); - DECLARE_READ8_MEMBER(thedeep_e004_r); - DECLARE_READ8_MEMBER(thedeep_protection_r); - DECLARE_WRITE8_MEMBER(thedeep_e100_w); - DECLARE_WRITE8_MEMBER(thedeep_p1_w); - DECLARE_READ8_MEMBER(thedeep_from_main_r); - DECLARE_WRITE8_MEMBER(thedeep_to_main_w); - DECLARE_WRITE8_MEMBER(thedeep_p3_w); - DECLARE_READ8_MEMBER(thedeep_p0_r); - DECLARE_WRITE8_MEMBER(thedeep_vram_0_w); - DECLARE_WRITE8_MEMBER(thedeep_vram_1_w); + DECLARE_WRITE8_MEMBER(nmi_w); + DECLARE_WRITE8_MEMBER(sound_w); + DECLARE_WRITE8_MEMBER(protection_w); + DECLARE_READ8_MEMBER(e004_r); + DECLARE_READ8_MEMBER(protection_r); + DECLARE_WRITE8_MEMBER(e100_w); + DECLARE_WRITE8_MEMBER(p1_w); + DECLARE_READ8_MEMBER(from_main_r); + DECLARE_WRITE8_MEMBER(to_main_w); + DECLARE_WRITE8_MEMBER(p3_w); + DECLARE_READ8_MEMBER(p0_r); + DECLARE_WRITE8_MEMBER(vram_0_w); + DECLARE_WRITE8_MEMBER(vram_1_w); + TILEMAP_MAPPER_MEMBER(tilemap_scan_rows_back); TILE_GET_INFO_MEMBER(get_tile_info_0); TILE_GET_INFO_MEMBER(get_tile_info_1); + + virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); DECLARE_PALETTE_INIT(thedeep); - UINT32 screen_update_thedeep(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(thedeep_mcu_irq); - TIMER_DEVICE_CALLBACK_MEMBER(thedeep_interrupt); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - void thedeep_maincpu_bankswitch(UINT8 bank_trig); - DECLARE_WRITE_LINE_MEMBER(irqhandler); + + void maincpu_bankswitch(UINT8 bank_trig); + INTERRUPT_GEN_MEMBER(mcu_irq); + TIMER_DEVICE_CALLBACK_MEMBER(interrupt); }; diff --git a/src/mame/machine/retofinv.c b/src/mame/machine/retofinv.c index 43c6ba1031b..0f67392d177 100644 --- a/src/mame/machine/retofinv.c +++ b/src/mame/machine/retofinv.c @@ -10,19 +10,19 @@ ***************************************************************************/ -READ8_MEMBER(retofinv_state::retofinv_68705_portA_r) +READ8_MEMBER(retofinv_state::mcu_portA_r) { //logerror("%04x: 68705 port A read %02x\n",space.device().safe_pc(),m_portA_in); return (m_portA_out & m_ddrA) | (m_portA_in & ~m_ddrA); } -WRITE8_MEMBER(retofinv_state::retofinv_68705_portA_w) +WRITE8_MEMBER(retofinv_state::mcu_portA_w) { //logerror("%04x: 68705 port A write %02x\n",space.device().safe_pc(),data); m_portA_out = data; } -WRITE8_MEMBER(retofinv_state::retofinv_68705_ddrA_w) +WRITE8_MEMBER(retofinv_state::mcu_ddrA_w) { m_ddrA = data; } @@ -39,12 +39,12 @@ WRITE8_MEMBER(retofinv_state::retofinv_68705_ddrA_w) */ -READ8_MEMBER(retofinv_state::retofinv_68705_portB_r) +READ8_MEMBER(retofinv_state::mcu_portB_r) { return (m_portB_out & m_ddrB) | (m_portB_in & ~m_ddrB); } -WRITE8_MEMBER(retofinv_state::retofinv_68705_portB_w) +WRITE8_MEMBER(retofinv_state::mcu_portB_w) { //logerror("%04x: 68705 port B write %02x\n",space.device().safe_pc(),data); @@ -65,7 +65,7 @@ WRITE8_MEMBER(retofinv_state::retofinv_68705_portB_w) m_portB_out = data; } -WRITE8_MEMBER(retofinv_state::retofinv_68705_ddrB_w) +WRITE8_MEMBER(retofinv_state::mcu_ddrB_w) { m_ddrB = data; } @@ -81,7 +81,7 @@ WRITE8_MEMBER(retofinv_state::retofinv_68705_ddrB_w) */ -READ8_MEMBER(retofinv_state::retofinv_68705_portC_r) +READ8_MEMBER(retofinv_state::mcu_portC_r) { m_portC_in = 0; if (m_main_sent) m_portC_in |= 0x01; @@ -90,19 +90,19 @@ READ8_MEMBER(retofinv_state::retofinv_68705_portC_r) return (m_portC_out & m_ddrC) | (m_portC_in & ~m_ddrC); } -WRITE8_MEMBER(retofinv_state::retofinv_68705_portC_w) +WRITE8_MEMBER(retofinv_state::mcu_portC_w) { logerror("%04x: 68705 port C write %02x\n",space.device().safe_pc(),data); m_portC_out = data; } -WRITE8_MEMBER(retofinv_state::retofinv_68705_ddrC_w) +WRITE8_MEMBER(retofinv_state::mcu_ddrC_w) { m_ddrC = data; } -WRITE8_MEMBER(retofinv_state::retofinv_mcu_w) +WRITE8_MEMBER(retofinv_state::mcu_w) { logerror("%04x: mcu_w %02x\n",space.device().safe_pc(),data); m_from_main = data; @@ -110,14 +110,14 @@ logerror("%04x: mcu_w %02x\n",space.device().safe_pc(),data); m_68705->set_input_line(0, ASSERT_LINE); } -READ8_MEMBER(retofinv_state::retofinv_mcu_r) +READ8_MEMBER(retofinv_state::mcu_r) { logerror("%04x: mcu_r %02x\n",space.device().safe_pc(),m_from_mcu); m_mcu_sent = 0; return m_from_mcu; } -READ8_MEMBER(retofinv_state::retofinv_mcu_status_r) +READ8_MEMBER(retofinv_state::mcu_status_r) { int res = 0; diff --git a/src/mame/video/retofinv.c b/src/mame/video/retofinv.c index ab0dc69c808..9c327ad483a 100644 --- a/src/mame/video/retofinv.c +++ b/src/mame/video/retofinv.c @@ -103,6 +103,9 @@ void retofinv_state::video_start() m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(retofinv_state::fg_get_tile_info),this),tilemap_mapper_delegate(FUNC(retofinv_state::tilemap_scan),this),8,8,36,28); m_fg_tilemap->configure_groups(*m_gfxdecode->gfx(0), 0); + + save_item(NAME(m_fg_bank)); + save_item(NAME(m_bg_bank)); } @@ -113,19 +116,19 @@ void retofinv_state::video_start() ***************************************************************************/ -WRITE8_MEMBER(retofinv_state::retofinv_bg_videoram_w) +WRITE8_MEMBER(retofinv_state::bg_videoram_w) { m_bg_videoram[offset] = data; m_bg_tilemap->mark_tile_dirty(offset & 0x3ff); } -WRITE8_MEMBER(retofinv_state::retofinv_fg_videoram_w) +WRITE8_MEMBER(retofinv_state::fg_videoram_w) { m_fg_videoram[offset] = data; m_fg_tilemap->mark_tile_dirty(offset & 0x3ff); } -WRITE8_MEMBER(retofinv_state::retofinv_gfx_ctrl_w) +WRITE8_MEMBER(retofinv_state::gfx_ctrl_w) { switch (offset) { @@ -214,7 +217,7 @@ void retofinv_state::draw_sprites(bitmap_ind16 &bitmap) -UINT32 retofinv_state::screen_update_retofinv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 retofinv_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(screen, bitmap, cliprect, 0,0); draw_sprites(bitmap); diff --git a/src/mame/video/thedeep.c b/src/mame/video/thedeep.c index 01e6dea8fe9..f810cb7da58 100644 --- a/src/mame/video/thedeep.c +++ b/src/mame/video/thedeep.c @@ -63,13 +63,13 @@ TILE_GET_INFO_MEMBER(thedeep_state::get_tile_info_1) 0); } -WRITE8_MEMBER(thedeep_state::thedeep_vram_0_w) +WRITE8_MEMBER(thedeep_state::vram_0_w) { m_vram_0[offset] = data; m_tilemap_0->mark_tile_dirty(offset / 2); } -WRITE8_MEMBER(thedeep_state::thedeep_vram_1_w) +WRITE8_MEMBER(thedeep_state::vram_1_w) { m_vram_1[offset] = data; m_tilemap_1->mark_tile_dirty(offset / 2); @@ -202,7 +202,7 @@ void thedeep_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ***************************************************************************/ -UINT32 thedeep_state::screen_update_thedeep(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 thedeep_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { int scrollx = m_scroll[0] + (m_scroll[1]<<8); int scrolly = m_scroll[2] + (m_scroll[3]<<8); -- cgit v1.2.3