diff --git a/src/mame/drivers/supdrapo.c b/src/mame/drivers/supdrapo.c index 2166afa9c9d..84c58873ec1 100644 --- a/src/mame/drivers/supdrapo.c +++ b/src/mame/drivers/supdrapo.c @@ -27,11 +27,11 @@ - Reworked inputs to match the standard poker inputs names/layout. - Hooked the payout switch. - - Hooked a watchdog circuitery, that seems intended to reset + - Hooked a watchdog circuitry, that seems intended to reset the game and/or an external device. - Added machine start & reset. - All clocks pre defined. - - Added ay8910 interfase as a preliminary attempt to analyze the unknown + - Added ay8910 interface as a preliminary attempt to analyze the unknown port writes when these ports are set as input. - Figured out the following DIP switches: Auto Bet (No, Yes). @@ -72,18 +72,24 @@ class supdrapo_state : public driver_device public: supdrapo_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_col_line(*this, "col_line"), - m_videoram(*this, "videoram"), - m_char_bank(*this, "char_bank"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_col_line(*this, "col_line"), + m_videoram(*this, "videoram"), + m_char_bank(*this, "char_bank") { } + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + required_shared_ptr m_col_line; required_shared_ptr m_videoram; required_shared_ptr m_char_bank; + UINT8 m_wdog; - DECLARE_READ8_MEMBER(sdpoker_rng_r); + + DECLARE_READ8_MEMBER(rng_r); DECLARE_WRITE8_MEMBER(wdog8000_w); DECLARE_WRITE8_MEMBER(debug8004_w); DECLARE_WRITE8_MEMBER(debug7c00_w); @@ -91,14 +97,13 @@ public: DECLARE_WRITE8_MEMBER(payout_w); DECLARE_WRITE8_MEMBER(ay8910_outputa_w); DECLARE_WRITE8_MEMBER(ay8910_outputb_w); + virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); DECLARE_PALETTE_INIT(supdrapo); - UINT32 screen_update_supdrapo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_palette; + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); }; @@ -111,7 +116,7 @@ void supdrapo_state::video_start() } -UINT32 supdrapo_state::screen_update_supdrapo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 supdrapo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { int x, y; int count; @@ -171,7 +176,7 @@ PALETTE_INIT_MEMBER(supdrapo_state, supdrapo) R/W Handlers **********************************************************************/ -READ8_MEMBER(supdrapo_state::sdpoker_rng_r) +READ8_MEMBER(supdrapo_state::rng_r) { return machine().rand(); } @@ -251,6 +256,7 @@ WRITE8_MEMBER(supdrapo_state::payout_w) void supdrapo_state::machine_start() { + save_item(NAME(m_wdog)); } @@ -282,7 +288,7 @@ static ADDRESS_MAP_START( sdpoker_mem, AS_PROGRAM, 8, supdrapo_state ) AM_RANGE(0x8005, 0x8005) AM_READ_PORT("SW1") AM_RANGE(0x8006, 0x8006) AM_READ_PORT("SW2") AM_RANGE(0x9000, 0x90ff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0x9400, 0x9400) AM_READ(sdpoker_rng_r) + AM_RANGE(0x9400, 0x9400) AM_READ(rng_r) AM_RANGE(0x9800, 0x9801) AM_DEVWRITE("aysnd", ay8910_device, data_address_w) ADDRESS_MAP_END @@ -453,7 +459,7 @@ static MACHINE_CONFIG_START( supdrapo, supdrapo_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(256, 256) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) - MCFG_SCREEN_UPDATE_DRIVER(supdrapo_state, screen_update_supdrapo) + MCFG_SCREEN_UPDATE_DRIVER(supdrapo_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", supdrapo) @@ -600,6 +606,6 @@ ROM_END **********************************************************************/ /* YEAR NAME PARENT MACHINE INPUT INIT ROT COMPANY FULLNAME FLAGS... */ -GAME( 1983, supdrapo, 0, supdrapo, supdrapo, driver_device, 0, ROT90, "Valadon Automation (Stern Electronics license)", "Super Draw Poker (set 1)", 0 ) -GAME( 1983, supdrapoa, supdrapo, supdrapo, supdrapo, driver_device, 0, ROT90, "Valadon Automation / Jeutel", "Super Draw Poker (set 2)", 0 ) -GAME( 1983, supdrapob, supdrapo, supdrapo, supdrapo, driver_device, 0, ROT90, "bootleg", "Super Draw Poker (bootleg)", 0 ) +GAME( 1983, supdrapo, 0, supdrapo, supdrapo, driver_device, 0, ROT90, "Valadon Automation (Stern Electronics license)", "Super Draw Poker (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1983, supdrapoa, supdrapo, supdrapo, supdrapo, driver_device, 0, ROT90, "Valadon Automation / Jeutel", "Super Draw Poker (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1983, supdrapob, supdrapo, supdrapo, supdrapo, driver_device, 0, ROT90, "bootleg", "Super Draw Poker (bootleg)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/suprgolf.c b/src/mame/drivers/suprgolf.c index 614faaa8052..368fe3ded91 100644 --- a/src/mame/drivers/suprgolf.c +++ b/src/mame/drivers/suprgolf.c @@ -33,14 +33,20 @@ class suprgolf_state : public driver_device public: suprgolf_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), m_maincpu(*this, "maincpu"), m_msm(*this, "msm"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_videoram(*this, "videoram") { } + + required_device m_maincpu; + required_device m_msm; + required_device m_gfxdecode; + required_device m_palette; + + required_shared_ptr m_videoram; tilemap_t *m_tilemap; - required_shared_ptr m_videoram; UINT8 *m_paletteram; UINT8 *m_bg_vram; UINT16 *m_bg_fb; @@ -54,34 +60,33 @@ public: UINT8 m_palette_switch; UINT8 m_bg_vreg_test; UINT8 m_toggle; - DECLARE_READ8_MEMBER(suprgolf_videoram_r); - DECLARE_WRITE8_MEMBER(suprgolf_videoram_w); - DECLARE_READ8_MEMBER(suprgolf_bg_vram_r); - DECLARE_WRITE8_MEMBER(suprgolf_bg_vram_w); - DECLARE_WRITE8_MEMBER(suprgolf_pen_w); + + DECLARE_READ8_MEMBER(videoram_r); + DECLARE_WRITE8_MEMBER(videoram_w); + DECLARE_READ8_MEMBER(bg_vram_r); + DECLARE_WRITE8_MEMBER(bg_vram_w); + DECLARE_WRITE8_MEMBER(pen_w); DECLARE_WRITE8_MEMBER(adpcm_data_w); DECLARE_WRITE8_MEMBER(rom2_bank_select_w); - DECLARE_READ8_MEMBER(suprgolf_vregs_r); - DECLARE_WRITE8_MEMBER(suprgolf_vregs_w); + DECLARE_READ8_MEMBER(vregs_r); + DECLARE_WRITE8_MEMBER(vregs_w); DECLARE_READ8_MEMBER(rom_bank_select_r); DECLARE_WRITE8_MEMBER(rom_bank_select_w); DECLARE_READ8_MEMBER(pedal_extra_bits_r); DECLARE_READ8_MEMBER(p1_r); DECLARE_READ8_MEMBER(p2_r); - DECLARE_WRITE8_MEMBER(suprgolf_writeA); - DECLARE_WRITE8_MEMBER(suprgolf_writeB); - DECLARE_DRIVER_INIT(suprgolf); + DECLARE_WRITE8_MEMBER(writeA); + DECLARE_WRITE8_MEMBER(writeB); + DECLARE_WRITE_LINE_MEMBER(adpcm_int); + TILE_GET_INFO_MEMBER(get_tile_info); + + DECLARE_DRIVER_INIT(suprgolf); virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); - UINT32 screen_update_suprgolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(irqhandler); - DECLARE_WRITE_LINE_MEMBER(adpcm_int); - required_device m_maincpu; - required_device m_msm; - required_device m_gfxdecode; - required_device m_palette; + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); }; TILE_GET_INFO_MEMBER(suprgolf_state::get_tile_info) @@ -104,9 +109,19 @@ void suprgolf_state::video_start() m_fg_fb = auto_alloc_array(machine(), UINT16, 0x2000*0x20); m_tilemap->set_transparent_pen(15); + + save_item(NAME(m_bg_bank)); + save_item(NAME(m_vreg_bank)); + save_item(NAME(m_vreg_pen)); + save_item(NAME(m_palette_switch)); + save_item(NAME(m_bg_vreg_test)); + save_pointer(NAME(m_paletteram), 0x1000); + save_pointer(NAME(m_bg_vram), 0x2000*0x20); + save_pointer(NAME(m_bg_fb), 0x2000*0x20); + save_pointer(NAME(m_fg_fb), 0x2000*0x20); } -UINT32 suprgolf_state::screen_update_suprgolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 suprgolf_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { int x,y,count,color; bitmap.fill(m_palette->black_pen(), cliprect); @@ -150,7 +165,7 @@ UINT32 suprgolf_state::screen_update_suprgolf(screen_device &screen, bitmap_ind1 return 0; } -READ8_MEMBER(suprgolf_state::suprgolf_videoram_r) +READ8_MEMBER(suprgolf_state::videoram_r) { if (m_palette_switch) return m_paletteram[offset]; @@ -158,7 +173,7 @@ READ8_MEMBER(suprgolf_state::suprgolf_videoram_r) return m_videoram[offset]; } -WRITE8_MEMBER(suprgolf_state::suprgolf_videoram_w) +WRITE8_MEMBER(suprgolf_state::videoram_w) { if(m_palette_switch) { @@ -180,12 +195,12 @@ WRITE8_MEMBER(suprgolf_state::suprgolf_videoram_w) } } -READ8_MEMBER(suprgolf_state::suprgolf_vregs_r) +READ8_MEMBER(suprgolf_state::vregs_r) { return m_vreg_bank; } -WRITE8_MEMBER(suprgolf_state::suprgolf_vregs_w) +WRITE8_MEMBER(suprgolf_state::vregs_w) { //printf("%02x\n",data); @@ -200,12 +215,12 @@ WRITE8_MEMBER(suprgolf_state::suprgolf_vregs_w) // printf("Video regs with data %02x activated\n",data); } -READ8_MEMBER(suprgolf_state::suprgolf_bg_vram_r) +READ8_MEMBER(suprgolf_state::bg_vram_r) { return m_bg_vram[offset+m_bg_bank*0x2000]; } -WRITE8_MEMBER(suprgolf_state::suprgolf_bg_vram_w) +WRITE8_MEMBER(suprgolf_state::bg_vram_w) { UINT8 hi_nibble,lo_nibble; UINT8 hi_dirty_dot,lo_dirty_dot; // helpers @@ -254,9 +269,14 @@ void suprgolf_state::machine_start() { membank("bank1")->configure_entries(0, 16, memregion("user2")->base(), 0x4000); membank("bank2")->configure_entries(0, 64, memregion("user1")->base(), 0x4000); + + save_item(NAME(m_rom_bank)); + save_item(NAME(m_msm5205next)); + save_item(NAME(m_msm_nmi_mask)); + save_item(NAME(m_toggle)); } -WRITE8_MEMBER(suprgolf_state::suprgolf_pen_w) +WRITE8_MEMBER(suprgolf_state::pen_w) { m_vreg_pen = data; } @@ -317,9 +337,9 @@ static ADDRESS_MAP_START( suprgolf_map, AS_PROGRAM, 8, suprgolf_state ) AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") AM_RANGE(0x4000, 0x4000) AM_WRITE(rom2_bank_select_w ) AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank2") - AM_RANGE(0xc000, 0xdfff) AM_READWRITE(suprgolf_bg_vram_r, suprgolf_bg_vram_w ) // banked background vram - AM_RANGE(0xe000, 0xefff) AM_READWRITE(suprgolf_videoram_r, suprgolf_videoram_w ) AM_SHARE("videoram") //foreground vram + paletteram - AM_RANGE(0xf000, 0xf000) AM_WRITE(suprgolf_pen_w ) + AM_RANGE(0xc000, 0xdfff) AM_READWRITE(bg_vram_r, bg_vram_w ) // banked background vram + AM_RANGE(0xe000, 0xefff) AM_READWRITE(videoram_r, videoram_w ) AM_SHARE("videoram") //foreground vram + paletteram + AM_RANGE(0xf000, 0xf000) AM_WRITE(pen_w ) AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END @@ -416,21 +436,16 @@ static INPUT_PORTS_START( suprgolf ) PORT_DIPUNUSED_DIPLOC( 0x80, 0x00, "SW2:8" ) INPUT_PORTS_END -WRITE8_MEMBER(suprgolf_state::suprgolf_writeA) +WRITE8_MEMBER(suprgolf_state::writeA) { osd_printf_debug("ymwA\n"); } -WRITE8_MEMBER(suprgolf_state::suprgolf_writeB) +WRITE8_MEMBER(suprgolf_state::writeB) { osd_printf_debug("ymwA\n"); } -WRITE_LINE_MEMBER(suprgolf_state::irqhandler) -{ - //m_maincpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); -} - WRITE_LINE_MEMBER(suprgolf_state::adpcm_int) { m_msm->reset_w(0); @@ -485,8 +500,8 @@ static MACHINE_CONFIG_START( suprgolf, suprgolf_state ) MCFG_I8255_IN_PORTA_CB(IOPORT("SYSTEM")) MCFG_I8255_IN_PORTB_CB(READ8(suprgolf_state, rom_bank_select_r)) MCFG_I8255_OUT_PORTB_CB(WRITE8(suprgolf_state, rom_bank_select_w)) - MCFG_I8255_IN_PORTC_CB(READ8(suprgolf_state, suprgolf_vregs_r)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(suprgolf_state, suprgolf_vregs_w)) + MCFG_I8255_IN_PORTC_CB(READ8(suprgolf_state, vregs_r)) + MCFG_I8255_OUT_PORTC_CB(WRITE8(suprgolf_state, vregs_w)) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -494,7 +509,7 @@ static MACHINE_CONFIG_START( suprgolf, suprgolf_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MCFG_SCREEN_SIZE(256, 256) MCFG_SCREEN_VISIBLE_AREA(0, 255, 0, 191) - MCFG_SCREEN_UPDATE_DRIVER(suprgolf_state, screen_update_suprgolf) + MCFG_SCREEN_UPDATE_DRIVER(suprgolf_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", suprgolf) @@ -504,11 +519,11 @@ static MACHINE_CONFIG_START( suprgolf, suprgolf_state ) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("ymsnd", YM2203, MASTER_CLOCK/4) /* guess */ - MCFG_YM2203_IRQ_HANDLER(WRITELINE(suprgolf_state, irqhandler)) + //MCFG_YM2203_IRQ_HANDLER(INPUTLINE("maincpu", INPUT_LINE_NMI)) MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0")) MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW1")) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(suprgolf_state, suprgolf_writeA)) - MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(suprgolf_state, suprgolf_writeB)) + MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(suprgolf_state, writeA)) + MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(suprgolf_state, writeB)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) MCFG_SOUND_ADD("msm", MSM5205, XTAL_384kHz) /* guess */ @@ -621,5 +636,5 @@ DRIVER_INIT_MEMBER(suprgolf_state,suprgolf) ROM[0x6d72+(0x4000*3)-0x4000] = 0x20; //patch ROM check } -GAME( 1989, suprgolf, 0, suprgolf, suprgolf, suprgolf_state, suprgolf, ROT0, "Nasco", "Super Crowns Golf (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL ) -GAME( 1989, albatross, suprgolf, suprgolf, suprgolf, driver_device, 0, ROT0, "Nasco", "Albatross (US Prototype?)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL ) +GAME( 1989, suprgolf, 0, suprgolf, suprgolf, suprgolf_state, suprgolf, ROT0, "Nasco", "Super Crowns Golf (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) +GAME( 1989, albatross, suprgolf, suprgolf, suprgolf, driver_device, 0, ROT0, "Nasco", "Albatross (US Prototype?)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_COCKTAIL| GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/suprloco.c b/src/mame/drivers/suprloco.c index 3f532300d01..67da4f20978 100644 --- a/src/mame/drivers/suprloco.c +++ b/src/mame/drivers/suprloco.c @@ -5,7 +5,7 @@ Super Locomotive driver by Zsolt Vasvari TODO: -- Bit 5 in suprloco_control_w is pulsed when loco turns "super". This is supposed +- Bit 5 in control_w is pulsed when loco turns "super". This is supposed to make red parts of sprites blink to purple, it's not clear how this is implemented in hardware, there's a hack to support it. @@ -25,7 +25,7 @@ Sega PCB 834-5137 #include "sound/sn76496.h" #include "includes/suprloco.h" -WRITE8_MEMBER(suprloco_state::suprloco_soundport_w) +WRITE8_MEMBER(suprloco_state::soundport_w) { soundlatch_byte_w(space, 0, data); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); @@ -42,11 +42,11 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, suprloco_state ) AM_RANGE(0xd800, 0xd800) AM_READ_PORT("P2") AM_RANGE(0xe000, 0xe000) AM_READ_PORT("DSW1") AM_RANGE(0xe001, 0xe001) AM_READ_PORT("DSW2") - AM_RANGE(0xe800, 0xe800) AM_WRITE(suprloco_soundport_w) - AM_RANGE(0xe801, 0xe801) AM_READWRITE(suprloco_control_r, suprloco_control_w) - AM_RANGE(0xf000, 0xf6ff) AM_RAM_WRITE(suprloco_videoram_w) AM_SHARE("videoram") + AM_RANGE(0xe800, 0xe800) AM_WRITE(soundport_w) + AM_RANGE(0xe801, 0xe801) AM_READWRITE(control_r, control_w) + AM_RANGE(0xf000, 0xf6ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") AM_RANGE(0xf700, 0xf7df) AM_RAM /* unused */ - AM_RANGE(0xf7e0, 0xf7ff) AM_RAM_WRITE(suprloco_scrollram_w) AM_SHARE("scrollram") + AM_RANGE(0xf7e0, 0xf7ff) AM_RAM_WRITE(scrollram_w) AM_SHARE("scrollram") AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END @@ -175,7 +175,7 @@ static MACHINE_CONFIG_START( suprloco, suprloco_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(5000)) MCFG_SCREEN_SIZE(32*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 0*8, 28*8-1) - MCFG_SCREEN_UPDATE_DRIVER(suprloco_state, screen_update_suprloco) + MCFG_SCREEN_UPDATE_DRIVER(suprloco_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", suprloco) @@ -297,5 +297,5 @@ DRIVER_INIT_MEMBER(suprloco_state,suprloco) -GAME( 1982, suprloco, 0, suprloco, suprloco, suprloco_state, suprloco, ROT0, "Sega", "Super Locomotive (Rev.A)", 0 ) -GAME( 1982, suprlocoo, suprloco, suprloco, suprloco, suprloco_state, suprloco, ROT0, "Sega", "Super Locomotive", 0 ) +GAME( 1982, suprloco, 0, suprloco, suprloco, suprloco_state, suprloco, ROT0, "Sega", "Super Locomotive (Rev.A)", GAME_SUPPORTS_SAVE ) +GAME( 1982, suprlocoo, suprloco, suprloco, suprloco, suprloco_state, suprloco, ROT0, "Sega", "Super Locomotive", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/suprridr.c b/src/mame/drivers/suprridr.c index 284d66c2970..98b114908b9 100644 --- a/src/mame/drivers/suprridr.c +++ b/src/mame/drivers/suprridr.c @@ -89,6 +89,12 @@ #include "sound/ay8910.h" +void suprridr_state::machine_start() +{ + save_item(NAME(m_nmi_enable)); + save_item(NAME(m_sound_data)); +} + /************************************* * * Interrupt generation @@ -164,8 +170,8 @@ WRITE8_MEMBER(suprridr_state::coin_lock_w) static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, suprridr_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(suprridr_bgram_w) AM_SHARE("bgram") - AM_RANGE(0x9000, 0x97ff) AM_RAM_WRITE(suprridr_fgram_w) AM_SHARE("fgram") + AM_RANGE(0x8800, 0x8bff) AM_RAM_WRITE(bgram_w) AM_SHARE("bgram") + AM_RANGE(0x9000, 0x97ff) AM_RAM_WRITE(fgram_w) AM_SHARE("fgram") AM_RANGE(0x9800, 0x983f) AM_RAM AM_RANGE(0x9840, 0x987f) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x9880, 0x9bff) AM_RAM @@ -173,12 +179,12 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, suprridr_state ) AM_RANGE(0xa800, 0xa800) AM_READ_PORT("SYSTEM") AM_RANGE(0xb000, 0xb000) AM_READ_PORT("DSW") AM_WRITE(nmi_enable_w) AM_RANGE(0xb002, 0xb003) AM_WRITE(coin_lock_w) - AM_RANGE(0xb006, 0xb006) AM_WRITE(suprridr_flipx_w) - AM_RANGE(0xb007, 0xb007) AM_WRITE(suprridr_flipy_w) + AM_RANGE(0xb006, 0xb006) AM_WRITE(flipx_w) + AM_RANGE(0xb007, 0xb007) AM_WRITE(flipy_w) AM_RANGE(0xb800, 0xb800) AM_WRITE(sound_data_w) - AM_RANGE(0xc801, 0xc801) AM_WRITE(suprridr_fgdisable_w) - AM_RANGE(0xc802, 0xc802) AM_WRITE(suprridr_fgscrolly_w) - AM_RANGE(0xc804, 0xc804) AM_WRITE(suprridr_bgscrolly_w) + AM_RANGE(0xc801, 0xc801) AM_WRITE(fgdisable_w) + AM_RANGE(0xc802, 0xc802) AM_WRITE(fgscrolly_w) + AM_RANGE(0xc804, 0xc804) AM_WRITE(bgscrolly_w) AM_RANGE(0xc000, 0xefff) AM_ROM ADDRESS_MAP_END @@ -223,12 +229,12 @@ ADDRESS_MAP_END #define SUPRRIDR_P1_CONTROL_PORT_TAG ("CONTP1") #define SUPRRIDR_P2_CONTROL_PORT_TAG ("CONTP2") -CUSTOM_INPUT_MEMBER(suprridr_state::suprridr_control_r) +CUSTOM_INPUT_MEMBER(suprridr_state::control_r) { UINT32 ret; /* screen flip multiplexes controls */ - if (suprridr_is_screen_flipped()) + if (is_screen_flipped()) ret = ioport(SUPRRIDR_P2_CONTROL_PORT_TAG)->read(); else ret = ioport(SUPRRIDR_P1_CONTROL_PORT_TAG)->read(); @@ -239,7 +245,7 @@ CUSTOM_INPUT_MEMBER(suprridr_state::suprridr_control_r) static INPUT_PORTS_START( suprridr ) PORT_START("INPUTS") - PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, suprridr_state,suprridr_control_r, NULL) + PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, suprridr_state, control_r, NULL) PORT_START("SYSTEM") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) @@ -353,7 +359,7 @@ static MACHINE_CONFIG_START( suprridr, suprridr_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(32*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(suprridr_state, screen_update_suprridr) + MCFG_SCREEN_UPDATE_DRIVER(suprridr_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", suprridr) @@ -423,4 +429,4 @@ ROM_END * *************************************/ -GAME( 1983, suprridr, 0, suprridr, suprridr, driver_device, 0, ROT90, "Taito Corporation (Venture Line license)", "Super Rider", GAME_IMPERFECT_SOUND ) +GAME( 1983, suprridr, 0, suprridr, suprridr, driver_device, 0, ROT90, "Taito Corporation (Venture Line license)", "Super Rider", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/includes/suprloco.h b/src/mame/includes/suprloco.h index 0d9963dbf92..a04d8166faa 100644 --- a/src/mame/includes/suprloco.h +++ b/src/mame/includes/suprloco.h @@ -3,33 +3,38 @@ class suprloco_state : public driver_device public: suprloco_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_spriteram(*this, "spriteram"), - m_videoram(*this, "videoram"), - m_scrollram(*this, "scrollram"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), - m_gfxdecode(*this, "gfxdecode") { } + m_gfxdecode(*this, "gfxdecode"), + m_spriteram(*this, "spriteram"), + m_videoram(*this, "videoram"), + m_scrollram(*this, "scrollram") { } + + required_device m_maincpu; + required_device m_audiocpu; + required_device m_gfxdecode; required_shared_ptr m_spriteram; required_shared_ptr m_videoram; required_shared_ptr m_scrollram; + tilemap_t *m_bg_tilemap; int m_control; - DECLARE_WRITE8_MEMBER(suprloco_soundport_w); - DECLARE_WRITE8_MEMBER(suprloco_videoram_w); - DECLARE_WRITE8_MEMBER(suprloco_scrollram_w); - DECLARE_WRITE8_MEMBER(suprloco_control_w); - DECLARE_READ8_MEMBER(suprloco_control_r); - DECLARE_DRIVER_INIT(suprloco); + DECLARE_WRITE8_MEMBER(soundport_w); + DECLARE_WRITE8_MEMBER(videoram_w); + DECLARE_WRITE8_MEMBER(scrollram_w); + DECLARE_WRITE8_MEMBER(control_w); + DECLARE_READ8_MEMBER(control_r); + TILE_GET_INFO_MEMBER(get_tile_info); + virtual void video_start(); DECLARE_PALETTE_INIT(suprloco); - UINT32 screen_update_suprloco(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + DECLARE_DRIVER_INIT(suprloco); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); inline void draw_pixel(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int color,int flip); void draw_sprite(bitmap_ind16 &bitmap,const rectangle &cliprect,int spr_number); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - required_device m_maincpu; - required_device m_audiocpu; - required_device m_gfxdecode; }; diff --git a/src/mame/includes/suprridr.h b/src/mame/includes/suprridr.h index ac5ababb02a..fe39170bee4 100644 --- a/src/mame/includes/suprridr.h +++ b/src/mame/includes/suprridr.h @@ -11,47 +11,56 @@ class suprridr_state : public driver_device public: suprridr_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_fgram(*this, "fgram"), - m_bgram(*this, "bgram"), - m_spriteram(*this, "spriteram"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_fgram(*this, "fgram"), + m_bgram(*this, "bgram"), + m_spriteram(*this, "spriteram") { } + + required_device m_maincpu; + required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_palette; + + required_shared_ptr m_fgram; + required_shared_ptr m_bgram; + required_shared_ptr m_spriteram; UINT8 m_nmi_enable; UINT8 m_sound_data; - required_shared_ptr m_fgram; - required_shared_ptr m_bgram; tilemap_t *m_fg_tilemap; tilemap_t *m_bg_tilemap; tilemap_t *m_bg_tilemap_noscroll; UINT8 m_flipx; UINT8 m_flipy; - required_shared_ptr m_spriteram; + DECLARE_WRITE8_MEMBER(nmi_enable_w); DECLARE_WRITE8_MEMBER(sound_data_w); DECLARE_WRITE8_MEMBER(sound_irq_ack_w); DECLARE_WRITE8_MEMBER(coin_lock_w); - DECLARE_WRITE8_MEMBER(suprridr_flipx_w); - DECLARE_WRITE8_MEMBER(suprridr_flipy_w); - DECLARE_WRITE8_MEMBER(suprridr_fgdisable_w); - DECLARE_WRITE8_MEMBER(suprridr_fgscrolly_w); - DECLARE_WRITE8_MEMBER(suprridr_bgscrolly_w); - DECLARE_WRITE8_MEMBER(suprridr_bgram_w); - DECLARE_WRITE8_MEMBER(suprridr_fgram_w); - DECLARE_CUSTOM_INPUT_MEMBER(suprridr_control_r); + DECLARE_WRITE8_MEMBER(flipx_w); + DECLARE_WRITE8_MEMBER(flipy_w); + DECLARE_WRITE8_MEMBER(fgdisable_w); + DECLARE_WRITE8_MEMBER(fgscrolly_w); + DECLARE_WRITE8_MEMBER(bgscrolly_w); + DECLARE_WRITE8_MEMBER(bgram_w); + DECLARE_WRITE8_MEMBER(fgram_w); DECLARE_READ8_MEMBER(sound_data_r); + + DECLARE_CUSTOM_INPUT_MEMBER(control_r); + TILE_GET_INFO_MEMBER(get_tile_info); TILE_GET_INFO_MEMBER(get_tile_info2); - virtual void video_start(); - DECLARE_PALETTE_INIT(suprridr); - UINT32 screen_update_suprridr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(main_nmi_gen); TIMER_CALLBACK_MEMBER(delayed_sound_w); - int suprridr_is_screen_flipped(); - required_device m_maincpu; - required_device m_audiocpu; - required_device m_gfxdecode; - required_device m_palette; + + virtual void machine_start(); + virtual void video_start(); + DECLARE_PALETTE_INIT(suprridr); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + int is_screen_flipped(); }; diff --git a/src/mame/video/suprloco.c b/src/mame/video/suprloco.c index 815a45b25a7..6021a01a2bc 100644 --- a/src/mame/video/suprloco.c +++ b/src/mame/video/suprloco.c @@ -1,6 +1,6 @@ /*************************************************************************** - video.c + suprloco.c Functions to emulate the video hardware of the machine. @@ -98,6 +98,8 @@ void suprloco_state::video_start() m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(suprloco_state::get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32); m_bg_tilemap->set_scroll_rows(32); + + save_item(NAME(m_control)); } @@ -108,13 +110,13 @@ void suprloco_state::video_start() ***************************************************************************/ -WRITE8_MEMBER(suprloco_state::suprloco_videoram_w) +WRITE8_MEMBER(suprloco_state::videoram_w) { m_videoram[offset] = data; m_bg_tilemap->mark_tile_dirty(offset/2); } -WRITE8_MEMBER(suprloco_state::suprloco_scrollram_w) +WRITE8_MEMBER(suprloco_state::scrollram_w) { int adj = flip_screen() ? -8 : 8; @@ -122,7 +124,7 @@ WRITE8_MEMBER(suprloco_state::suprloco_scrollram_w) m_bg_tilemap->set_scrollx(offset, data - adj); } -WRITE8_MEMBER(suprloco_state::suprloco_control_w) +WRITE8_MEMBER(suprloco_state::control_w) { /* There is probably a palette select in here */ @@ -148,7 +150,7 @@ WRITE8_MEMBER(suprloco_state::suprloco_control_w) } -READ8_MEMBER(suprloco_state::suprloco_control_r) +READ8_MEMBER(suprloco_state::control_r) { return m_control; } @@ -256,7 +258,7 @@ void suprloco_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec } } -UINT32 suprloco_state::screen_update_suprloco(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 suprloco_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(screen, bitmap, cliprect, 0,0); draw_sprites(bitmap,cliprect); diff --git a/src/mame/video/suprridr.c b/src/mame/video/suprridr.c index a3e981b6c24..adaa1f4673f 100644 --- a/src/mame/video/suprridr.c +++ b/src/mame/video/suprridr.c @@ -44,6 +44,9 @@ void suprridr_state::video_start() m_bg_tilemap_noscroll = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(suprridr_state::get_tile_info),this), TILEMAP_SCAN_ROWS, 8,8, 32,32); m_fg_tilemap->set_transparent_pen(0); + + save_item(NAME(m_flipx)); + save_item(NAME(m_flipy)); } @@ -91,39 +94,39 @@ PALETTE_INIT_MEMBER(suprridr_state, suprridr) * *************************************/ -WRITE8_MEMBER(suprridr_state::suprridr_flipx_w) +WRITE8_MEMBER(suprridr_state::flipx_w) { m_flipx = data & 1; machine().tilemap().set_flip_all((m_flipx ? TILEMAP_FLIPX : 0) | (m_flipy ? TILEMAP_FLIPY : 0)); } -WRITE8_MEMBER(suprridr_state::suprridr_flipy_w) +WRITE8_MEMBER(suprridr_state::flipy_w) { m_flipy = data & 1; machine().tilemap().set_flip_all((m_flipx ? TILEMAP_FLIPX : 0) | (m_flipy ? TILEMAP_FLIPY : 0)); } -WRITE8_MEMBER(suprridr_state::suprridr_fgdisable_w) +WRITE8_MEMBER(suprridr_state::fgdisable_w) { m_fg_tilemap->enable(~data & 1); } -WRITE8_MEMBER(suprridr_state::suprridr_fgscrolly_w) +WRITE8_MEMBER(suprridr_state::fgscrolly_w) { m_fg_tilemap->set_scrolly(0, data); } -WRITE8_MEMBER(suprridr_state::suprridr_bgscrolly_w) +WRITE8_MEMBER(suprridr_state::bgscrolly_w) { m_bg_tilemap->set_scrolly(0, data); } -int suprridr_state::suprridr_is_screen_flipped() +int suprridr_state::is_screen_flipped() { return m_flipx; /* or is it flipy? */ } @@ -136,7 +139,7 @@ int suprridr_state::suprridr_is_screen_flipped() * *************************************/ -WRITE8_MEMBER(suprridr_state::suprridr_bgram_w) +WRITE8_MEMBER(suprridr_state::bgram_w) { m_bgram[offset] = data; m_bg_tilemap->mark_tile_dirty(offset); @@ -144,7 +147,7 @@ WRITE8_MEMBER(suprridr_state::suprridr_bgram_w) } -WRITE8_MEMBER(suprridr_state::suprridr_fgram_w) +WRITE8_MEMBER(suprridr_state::fgram_w) { m_fgram[offset] = data; m_fg_tilemap->mark_tile_dirty(offset); @@ -158,11 +161,9 @@ WRITE8_MEMBER(suprridr_state::suprridr_fgram_w) * *************************************/ -UINT32 suprridr_state::screen_update_suprridr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 suprridr_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - UINT8 *spriteram = m_spriteram; rectangle subclip; - int i; const rectangle &visarea = screen.visible_area(); /* render left 4 columns with no scroll */ @@ -188,14 +189,14 @@ UINT32 suprridr_state::screen_update_suprridr(screen_device &screen, bitmap_ind1 m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); /* draw the sprites */ - for (i = 0; i < 48; i++) + for (int i = 0; i < 48; i++) { - int code = (spriteram[i*4+1] & 0x3f) | ((spriteram[i*4+2] >> 1) & 0x40); - int color = spriteram[i*4+2] & 0x7f; - int fx = spriteram[i*4+1] & 0x40; - int fy = spriteram[i*4+1] & 0x80; - int x = spriteram[i*4+3]; - int y = 240 - spriteram[i*4+0]; + int code = (m_spriteram[i*4+1] & 0x3f) | ((m_spriteram[i*4+2] >> 1) & 0x40); + int color = m_spriteram[i*4+2] & 0x7f; + int fx = m_spriteram[i*4+1] & 0x40; + int fy = m_spriteram[i*4+1] & 0x80; + int x = m_spriteram[i*4+3]; + int y = 240 - m_spriteram[i*4+0]; if (m_flipx) {