diff --git a/src/mame/drivers/argus.c b/src/mame/drivers/argus.c index b62a00f4b93..12b6fae8956 100644 --- a/src/mame/drivers/argus.c +++ b/src/mame/drivers/argus.c @@ -107,7 +107,7 @@ Known issues : =============== - Half transparent color (50% alpha blending) is not emulated. - Sprite priority switch of Butasan is shown in test mode. What will be - happened when set it ? JFF is not implemented this mistery switch too. + happened when set it ? JFF is not implemented this mystery switch too. - Data proms of Butasan does exist. But I don't know what is used for. - Though clock speed of Argus is actually 4 MHz, major sprite problems are broken out in the middle of slowdown. So, it is set 5 MHz now. @@ -123,13 +123,18 @@ Known issues : #include "includes/argus.h" +void argus_state::machine_start() +{ + membank("mainbank")->configure_entries(0, 8, memregion("maincpu")->base() + 0x10000, 0x4000); +} + /*************************************************************************** Interrupt(s) ***************************************************************************/ -TIMER_DEVICE_CALLBACK_MEMBER(argus_state::argus_scanline) +TIMER_DEVICE_CALLBACK_MEMBER(argus_state::scanline) { int scanline = param; @@ -151,11 +156,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(argus_state::butasan_scanline) m_maincpu->set_input_line_and_vector(0, HOLD_LINE,0xcf); /* RST 08h */ } -/* Handler called by the YM2203 emulator when the internal timers cause an IRQ */ -WRITE_LINE_MEMBER(argus_state::irqhandler) -{ - m_audiocpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE); -} /*************************************************************************** @@ -163,13 +163,9 @@ WRITE_LINE_MEMBER(argus_state::irqhandler) ***************************************************************************/ -WRITE8_MEMBER(argus_state::argus_bankselect_w) +WRITE8_MEMBER(argus_state::bankselect_w) { - UINT8 *RAM = memregion("maincpu")->base(); - int bankaddress; - - bankaddress = 0x10000 + ((data & 7) * 0x4000); - membank("bank1")->set_base(&RAM[bankaddress]); /* Select 8 banks of 16k */ + membank("mainbank")->set_entry(data & 7); /* Select 8 banks of 16k */ } @@ -181,23 +177,23 @@ WRITE8_MEMBER(argus_state::argus_bankselect_w) static ADDRESS_MAP_START( argus_map, AS_PROGRAM, 8, argus_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank1") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("mainbank") AM_RANGE(0xc000, 0xc000) AM_READ_PORT("SYSTEM") AM_RANGE(0xc001, 0xc001) AM_READ_PORT("P1") AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P2") AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW1") AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW2") AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_byte_w) - AM_RANGE(0xc201, 0xc201) AM_WRITE(argus_flipscreen_w) - AM_RANGE(0xc202, 0xc202) AM_WRITE(argus_bankselect_w) + AM_RANGE(0xc201, 0xc201) AM_WRITE(flipscreen_w) + AM_RANGE(0xc202, 0xc202) AM_WRITE(bankselect_w) AM_RANGE(0xc300, 0xc301) AM_RAM AM_SHARE("bg0_scrollx") AM_RANGE(0xc302, 0xc303) AM_RAM AM_SHARE("bg0_scrolly") AM_RANGE(0xc308, 0xc309) AM_RAM AM_SHARE("bg1_scrollx") AM_RANGE(0xc30a, 0xc30b) AM_RAM AM_SHARE("bg1_scrolly") AM_RANGE(0xc30c, 0xc30c) AM_WRITE(argus_bg_status_w) - AM_RANGE(0xc400, 0xcfff) AM_READWRITE(argus_paletteram_r, argus_paletteram_w) AM_SHARE("paletteram") - AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(argus_txram_r, argus_txram_w) AM_SHARE("txram") - AM_RANGE(0xd800, 0xdfff) AM_READWRITE(argus_bg1ram_r, argus_bg1ram_w) AM_SHARE("bg1ram") + AM_RANGE(0xc400, 0xcfff) AM_RAM_WRITE(argus_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(txram_w) AM_SHARE("txram") + AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(bg1ram_w) AM_SHARE("bg1ram") AM_RANGE(0xe000, 0xf1ff) AM_RAM AM_RANGE(0xf200, 0xf7ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0xf800, 0xffff) AM_RAM @@ -205,23 +201,23 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( valtric_map, AS_PROGRAM, 8, argus_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank1") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("mainbank") AM_RANGE(0xc000, 0xc000) AM_READ_PORT("SYSTEM") AM_RANGE(0xc001, 0xc001) AM_READ_PORT("P1") AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P2") AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW1") AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW2") AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_byte_w) - AM_RANGE(0xc201, 0xc201) AM_WRITE(argus_flipscreen_w) - AM_RANGE(0xc202, 0xc202) AM_WRITE(argus_bankselect_w) + AM_RANGE(0xc201, 0xc201) AM_WRITE(flipscreen_w) + AM_RANGE(0xc202, 0xc202) AM_WRITE(bankselect_w) AM_RANGE(0xc300, 0xc300) AM_WRITE(valtric_unknown_w) AM_RANGE(0xc308, 0xc309) AM_RAM AM_SHARE("bg1_scrollx") AM_RANGE(0xc30a, 0xc30b) AM_RAM AM_SHARE("bg1_scrolly") AM_RANGE(0xc30c, 0xc30c) AM_WRITE(valtric_bg_status_w) AM_RANGE(0xc30d, 0xc30d) AM_WRITE(valtric_mosaic_w) - AM_RANGE(0xc400, 0xcfff) AM_READWRITE(argus_paletteram_r, valtric_paletteram_w) AM_SHARE("paletteram") - AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(argus_txram_r, argus_txram_w) AM_SHARE("txram") - AM_RANGE(0xd800, 0xdfff) AM_READWRITE(argus_bg1ram_r, argus_bg1ram_w) AM_SHARE("bg1ram") + AM_RANGE(0xc400, 0xcfff) AM_RAM_WRITE(valtric_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(txram_w) AM_SHARE("txram") + AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(bg1ram_w) AM_SHARE("bg1ram") AM_RANGE(0xe000, 0xf1ff) AM_RAM AM_RANGE(0xf200, 0xf7ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0xf800, 0xffff) AM_RAM @@ -229,7 +225,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( butasan_map, AS_PROGRAM, 8, argus_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank1") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("mainbank") AM_RANGE(0xc000, 0xc000) AM_READ_PORT("SYSTEM") AM_RANGE(0xc001, 0xc001) AM_READ_PORT("P1") AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P2") @@ -237,8 +233,8 @@ static ADDRESS_MAP_START( butasan_map, AS_PROGRAM, 8, argus_state ) AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW2") AM_RANGE(0xc100, 0xc100) AM_WRITE(butasan_unknown_w) AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_byte_w) - AM_RANGE(0xc201, 0xc201) AM_WRITE(argus_flipscreen_w) - AM_RANGE(0xc202, 0xc202) AM_WRITE(argus_bankselect_w) + AM_RANGE(0xc201, 0xc201) AM_WRITE(flipscreen_w) + AM_RANGE(0xc202, 0xc202) AM_WRITE(bankselect_w) AM_RANGE(0xc203, 0xc203) AM_WRITE(butasan_pageselect_w) AM_RANGE(0xc300, 0xc301) AM_RAM AM_SHARE("bg0_scrollx") AM_RANGE(0xc302, 0xc303) AM_RAM AM_SHARE("bg0_scrolly") @@ -246,8 +242,8 @@ static ADDRESS_MAP_START( butasan_map, AS_PROGRAM, 8, argus_state ) AM_RANGE(0xc308, 0xc309) AM_RAM AM_SHARE("bg1_scrollx") AM_RANGE(0xc30a, 0xc30b) AM_RAM AM_SHARE("bg1_scrolly") AM_RANGE(0xc30c, 0xc30c) AM_WRITE(butasan_bg1_status_w) - AM_RANGE(0xc400, 0xc7ff) AM_READWRITE(butasan_bg1ram_r, butasan_bg1ram_w) AM_SHARE("butasan_bg1ram") - AM_RANGE(0xc800, 0xcfff) AM_READWRITE(argus_paletteram_r, butasan_paletteram_w) AM_SHARE("paletteram") + AM_RANGE(0xc400, 0xc7ff) AM_RAM_WRITE(butasan_bg1ram_w) AM_SHARE("butasan_bg1ram") + AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(butasan_paletteram_w) AM_SHARE("paletteram") AM_RANGE(0xd000, 0xdfff) AM_READWRITE(butasan_pagedram_r, butasan_pagedram_w) AM_RANGE(0xe000, 0xefff) AM_RAM AM_RANGE(0xf000, 0xf67f) AM_RAM AM_SHARE("spriteram") @@ -534,7 +530,7 @@ static MACHINE_CONFIG_START( argus, argus_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, 5000000) /* 4 MHz */ MCFG_CPU_PROGRAM_MAP(argus_map) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", argus_state, argus_scanline, "screen", 0, 1) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", argus_state, scanline, "screen", 0, 1) MCFG_CPU_ADD("audiocpu", Z80, 5000000) MCFG_CPU_PROGRAM_MAP(sound_map_a) @@ -560,7 +556,7 @@ static MACHINE_CONFIG_START( argus, argus_state ) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("ym1", YM2203, 6000000 / 4) - MCFG_YM2203_IRQ_HANDLER(WRITELINE(argus_state, irqhandler)) + MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(0, "mono", 0.15) MCFG_SOUND_ROUTE(1, "mono", 0.15) MCFG_SOUND_ROUTE(2, "mono", 0.15) @@ -578,7 +574,7 @@ static MACHINE_CONFIG_START( valtric, argus_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, 5000000) /* 5 MHz */ MCFG_CPU_PROGRAM_MAP(valtric_map) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", argus_state, argus_scanline, "screen", 0, 1) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", argus_state, scanline, "screen", 0, 1) MCFG_CPU_ADD("audiocpu", Z80, 5000000) MCFG_CPU_PROGRAM_MAP(sound_map_a) @@ -604,7 +600,7 @@ static MACHINE_CONFIG_START( valtric, argus_state ) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("ym1", YM2203, 6000000 / 4) - MCFG_YM2203_IRQ_HANDLER(WRITELINE(argus_state, irqhandler)) + MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(0, "mono", 0.15) MCFG_SOUND_ROUTE(1, "mono", 0.15) MCFG_SOUND_ROUTE(2, "mono", 0.15) @@ -648,7 +644,7 @@ static MACHINE_CONFIG_START( butasan, argus_state ) MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("ym1", YM2203, 6000000 / 4) - MCFG_YM2203_IRQ_HANDLER(WRITELINE(argus_state, irqhandler)) + MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(0, "mono", 0.30) MCFG_SOUND_ROUTE(1, "mono", 0.30) MCFG_SOUND_ROUTE(2, "mono", 0.30) @@ -796,7 +792,7 @@ ROM_END /* ( YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME ) */ -GAME( 1986, argus, 0, argus, argus, driver_device, 0, ROT270, "NMK (Jaleco license)", "Argus", GAME_IMPERFECT_GRAPHICS ) -GAME( 1986, valtric, 0, valtric, valtric, driver_device, 0, ROT270, "NMK (Jaleco license)", "Valtric", GAME_IMPERFECT_GRAPHICS ) -GAME( 1987, butasan, 0, butasan, butasan, driver_device, 0, ROT0, "NMK (Jaleco license)", "Butasan - Pig's & Bomber's (Japan, English)", GAME_IMPERFECT_GRAPHICS ) -GAME( 1987, butasanj, butasan,butasan, butasan, driver_device, 0, ROT0, "NMK (Jaleco license)", "Butasan (Japan, Japanese)", GAME_IMPERFECT_GRAPHICS ) +GAME( 1986, argus, 0, argus, argus, driver_device, 0, ROT270, "NMK (Jaleco license)", "Argus", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) +GAME( 1986, valtric, 0, valtric, valtric, driver_device, 0, ROT270, "NMK (Jaleco license)", "Valtric", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) +GAME( 1987, butasan, 0, butasan, butasan, driver_device, 0, ROT0, "NMK (Jaleco license)", "Butasan - Pig's & Bomber's (Japan, English)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) +GAME( 1987, butasanj, butasan,butasan, butasan, driver_device, 0, ROT0, "NMK (Jaleco license)", "Butasan (Japan, Japanese)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/includes/argus.h b/src/mame/includes/argus.h index ccf30f01392..695dc528c6a 100644 --- a/src/mame/includes/argus.h +++ b/src/mame/includes/argus.h @@ -3,6 +3,11 @@ class argus_state : public driver_device public: argus_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), m_bg0_scrollx(*this, "bg0_scrollx"), m_bg0_scrolly(*this, "bg0_scrolly"), m_bg1_scrollx(*this, "bg1_scrollx"), @@ -11,12 +16,13 @@ public: m_txram(*this, "txram"), m_bg1ram(*this, "bg1ram"), m_spriteram(*this, "spriteram"), - m_butasan_bg1ram(*this, "butasan_bg1ram"), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_butasan_bg1ram(*this, "butasan_bg1ram") { } + + required_device m_maincpu; + required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; optional_shared_ptr m_bg0_scrollx; optional_shared_ptr m_bg0_scrolly; @@ -28,49 +34,63 @@ public: required_shared_ptr m_spriteram; optional_shared_ptr m_butasan_bg1ram; + // common + UINT8 m_bg_status; + UINT8 m_flipscreen; + UINT16 m_palette_intensity; + + // argus specific UINT8 *m_dummy_bg0ram; + int m_lowbitscroll; + int m_prvscrollx; + + // butasan specific UINT8 *m_butasan_txram; UINT8 *m_butasan_bg0ram; UINT8 *m_butasan_bg0backram; UINT8 *m_butasan_txbackram; UINT8 *m_butasan_pagedram[2]; UINT8 m_butasan_page_latch; - tilemap_t *m_tx_tilemap; - tilemap_t *m_bg0_tilemap; - tilemap_t *m_bg1_tilemap; - UINT8 m_bg_status; UINT8 m_butasan_bg1_status; - UINT8 m_flipscreen; - UINT16 m_palette_intensity; - int m_lowbitscroll; - int m_prvscrollx; + UINT8 m_butasan_unknown; + + // valtric specific UINT8 m_valtric_mosaic; bitmap_rgb32 m_mosaicbitmap; UINT8 m_valtric_unknown; - UINT8 m_butasan_unknown; int m_mosaic; - DECLARE_WRITE8_MEMBER(argus_bankselect_w); + + tilemap_t *m_tx_tilemap; + tilemap_t *m_bg0_tilemap; + tilemap_t *m_bg1_tilemap; + + // common + DECLARE_WRITE8_MEMBER(bankselect_w); DECLARE_WRITE8_MEMBER(valtric_mosaic_w); - DECLARE_READ8_MEMBER(argus_txram_r); - DECLARE_WRITE8_MEMBER(argus_txram_w); - DECLARE_READ8_MEMBER(argus_bg1ram_r); - DECLARE_WRITE8_MEMBER(argus_bg1ram_w); + DECLARE_WRITE8_MEMBER(txram_w); + DECLARE_WRITE8_MEMBER(bg1ram_w); + DECLARE_WRITE8_MEMBER(flipscreen_w); + + // argus specific DECLARE_WRITE8_MEMBER(argus_bg_status_w); - DECLARE_WRITE8_MEMBER(valtric_bg_status_w); + DECLARE_WRITE8_MEMBER(argus_paletteram_w); + + // butasan specific DECLARE_WRITE8_MEMBER(butasan_bg0_status_w); DECLARE_WRITE8_MEMBER(butasan_bg1_status_w); - DECLARE_WRITE8_MEMBER(argus_flipscreen_w); - DECLARE_READ8_MEMBER(argus_paletteram_r); - DECLARE_WRITE8_MEMBER(argus_paletteram_w); - DECLARE_WRITE8_MEMBER(valtric_paletteram_w); DECLARE_WRITE8_MEMBER(butasan_paletteram_w); DECLARE_READ8_MEMBER(butasan_bg1ram_r); DECLARE_WRITE8_MEMBER(butasan_bg1ram_w); DECLARE_WRITE8_MEMBER(butasan_pageselect_w); DECLARE_READ8_MEMBER(butasan_pagedram_r); DECLARE_WRITE8_MEMBER(butasan_pagedram_w); - DECLARE_WRITE8_MEMBER(valtric_unknown_w); DECLARE_WRITE8_MEMBER(butasan_unknown_w); + + // valtric specific + DECLARE_WRITE8_MEMBER(valtric_bg_status_w); + DECLARE_WRITE8_MEMBER(valtric_paletteram_w); + DECLARE_WRITE8_MEMBER(valtric_unknown_w); + TILE_GET_INFO_MEMBER(argus_get_tx_tile_info); TILE_GET_INFO_MEMBER(argus_get_bg0_tile_info); TILE_GET_INFO_MEMBER(argus_get_bg1_tile_info); @@ -79,32 +99,37 @@ public: TILE_GET_INFO_MEMBER(butasan_get_tx_tile_info); TILE_GET_INFO_MEMBER(butasan_get_bg0_tile_info); TILE_GET_INFO_MEMBER(butasan_get_bg1_tile_info); + + virtual void machine_start(); DECLARE_VIDEO_START(argus); DECLARE_VIDEO_RESET(argus); DECLARE_VIDEO_START(valtric); DECLARE_VIDEO_RESET(valtric); DECLARE_VIDEO_START(butasan); DECLARE_VIDEO_RESET(butasan); + UINT32 screen_update_argus(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_valtric(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_butasan(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(argus_scanline); + + TIMER_DEVICE_CALLBACK_MEMBER(scanline); TIMER_DEVICE_CALLBACK_MEMBER(butasan_scanline); + void reset_common(); - void argus_write_dummy_rams(int dramoffs, int vromoffs); - void argus_change_palette(int color, int lo_offs, int hi_offs); - void argus_change_bg_palette(int color, int lo_offs, int hi_offs); + void change_palette(int color, int lo_offs, int hi_offs); + void change_bg_palette(int color, int lo_offs, int hi_offs); void bg_setting(); + + // argus specific void argus_bg0_scroll_handle(); + void argus_write_dummy_rams(int dramoffs, int vromoffs); void argus_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority); - void valtric_draw_mosaic(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - void valtric_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect); + + // butasan specific void butasan_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect); void butasan_log_vram(); - DECLARE_WRITE_LINE_MEMBER(irqhandler); - required_device m_maincpu; - required_device m_audiocpu; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; + + // valtric specific + void valtric_draw_mosaic(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void valtric_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect); }; diff --git a/src/mame/video/argus.c b/src/mame/video/argus.c index 6a4761a08ad..395d8fba4ea 100644 --- a/src/mame/video/argus.c +++ b/src/mame/video/argus.c @@ -89,7 +89,7 @@ Video effect RAM ( $C30C ) ----------------------------------------------------------------------------- +0 ---- ---x = BG enable bit - ---- --x- = gray scale effect or tile bank select. + ---- --x- = grey scale effect or tile bank select. Flip screen controller @@ -109,7 +109,7 @@ BG0 palette intensity ( $C47F, $C4FF ) (*) Things which are not emulated. - Color $000 - 00f, $01e, $02e ... are half transparent color. - Sprite priority bit may be present in Butasan. But I don't know - what is happened when it is set. + what happens when it is set. ***************************************************************************/ @@ -272,6 +272,13 @@ VIDEO_START_MEMBER(argus_state,argus) m_dummy_bg0ram = auto_alloc_array(machine(), UINT8, 0x800); jal_blend_init(machine(), 1); + + save_item(NAME(m_bg_status)); + save_item(NAME(m_flipscreen)); + save_item(NAME(m_palette_intensity)); + save_pointer(NAME(m_dummy_bg0ram), 0x800); + save_item(NAME(m_lowbitscroll)); + save_item(NAME(m_prvscrollx)); } VIDEO_RESET_MEMBER(argus_state,argus) @@ -295,6 +302,13 @@ VIDEO_START_MEMBER(argus_state,valtric) m_screen->register_screen_bitmap(m_mosaicbitmap); jal_blend_init(machine(), 1); + + save_item(NAME(m_bg_status)); + save_item(NAME(m_flipscreen)); + save_item(NAME(m_palette_intensity)); + save_item(NAME(m_valtric_mosaic)); + save_item(NAME(m_valtric_unknown)); + save_item(NAME(m_mosaic)); } VIDEO_RESET_MEMBER(argus_state,valtric) @@ -322,6 +336,15 @@ VIDEO_START_MEMBER(argus_state,butasan) m_butasan_txbackram = &m_butasan_pagedram[1][0x800]; jal_blend_init(machine(), 1); + + save_item(NAME(m_bg_status)); + save_item(NAME(m_flipscreen)); + save_item(NAME(m_palette_intensity)); + save_pointer(NAME(m_butasan_pagedram[0]), 0x1000); + save_pointer(NAME(m_butasan_pagedram[1]), 0x1000); + save_item(NAME(m_butasan_page_latch)); + save_item(NAME(m_butasan_bg1_status)); + save_item(NAME(m_butasan_unknown)); } VIDEO_RESET_MEMBER(argus_state,butasan) @@ -363,7 +386,7 @@ void argus_state::argus_write_dummy_rams(int dramoffs, int vromoffs) } } -void argus_state::argus_change_palette(int color, int lo_offs, int hi_offs) +void argus_state::change_palette(int color, int lo_offs, int hi_offs) { UINT8 lo = m_paletteram[lo_offs]; UINT8 hi = m_paletteram[hi_offs]; @@ -371,7 +394,7 @@ void argus_state::argus_change_palette(int color, int lo_offs, int hi_offs) m_palette->set_pen_color(color, pal4bit(lo >> 4), pal4bit(lo), pal4bit(hi >> 4)); } -void argus_state::argus_change_bg_palette(int color, int lo_offs, int hi_offs) +void argus_state::change_bg_palette(int color, int lo_offs, int hi_offs) { UINT8 r,g,b,lo,hi,ir,ig,ib,ix; rgb_t rgb,irgb; @@ -418,23 +441,13 @@ WRITE8_MEMBER(argus_state::valtric_mosaic_w) m_valtric_mosaic = data; } -READ8_MEMBER(argus_state::argus_txram_r) -{ - return m_txram[offset]; -} - -WRITE8_MEMBER(argus_state::argus_txram_w) +WRITE8_MEMBER(argus_state::txram_w) { m_txram[offset] = data; m_tx_tilemap->mark_tile_dirty(offset >> 1); } -READ8_MEMBER(argus_state::argus_bg1ram_r) -{ - return m_bg1ram[offset]; -} - -WRITE8_MEMBER(argus_state::argus_bg1ram_w) +WRITE8_MEMBER(argus_state::bg1ram_w) { m_bg1ram[offset] = data; m_bg1_tilemap->mark_tile_dirty(offset >> 1); @@ -453,7 +466,7 @@ WRITE8_MEMBER(argus_state::argus_bg_status_w) for (offs = 0x400; offs < 0x500; offs++) { - argus_change_bg_palette((offs - 0x400) + 0x080, offs, offs + 0x400); + change_bg_palette((offs - 0x400) + 0x080, offs, offs + 0x400); } } } @@ -472,7 +485,7 @@ WRITE8_MEMBER(argus_state::valtric_bg_status_w) for (offs = 0x400; offs < 0x600; offs += 2) { - argus_change_bg_palette(((offs - 0x400) >> 1) + 0x100, offs & ~1, offs | 1); + change_bg_palette(((offs - 0x400) >> 1) + 0x100, offs & ~1, offs | 1); } } } @@ -494,16 +507,11 @@ WRITE8_MEMBER(argus_state::butasan_bg1_status_w) } } -WRITE8_MEMBER(argus_state::argus_flipscreen_w) +WRITE8_MEMBER(argus_state::flipscreen_w) { m_flipscreen = data & 0x80; } -READ8_MEMBER(argus_state::argus_paletteram_r) -{ - return m_paletteram[offset]; -} - WRITE8_MEMBER(argus_state::argus_paletteram_w) { int offs; @@ -514,14 +522,14 @@ WRITE8_MEMBER(argus_state::argus_paletteram_w) { offset &= 0x07f; - argus_change_palette(offset, offset, offset + 0x080); + change_palette(offset, offset, offset + 0x080); if (offset == 0x07f || offset == 0x0ff) { m_palette_intensity = m_paletteram[0x0ff] | (m_paletteram[0x07f] << 8); for (offs = 0x400; offs < 0x500; offs++) - argus_change_bg_palette((offs & 0xff) + 0x080, offs, offs + 0x400); + change_bg_palette((offs & 0xff) + 0x080, offs, offs + 0x400); } } else if ((offset >= 0x400 && offset <= 0x4ff) || @@ -530,7 +538,7 @@ WRITE8_MEMBER(argus_state::argus_paletteram_w) offs = offset & 0xff; offset = offs | 0x400; - argus_change_bg_palette(offs + 0x080, offset, offset + 0x400); + change_bg_palette(offs + 0x080, offset, offset + 0x400); } else if ((offset >= 0x500 && offset <= 0x5ff) || (offset >= 0x900 && offset <= 0x9ff)) /* BG1 color */ @@ -538,7 +546,7 @@ WRITE8_MEMBER(argus_state::argus_paletteram_w) offs = offset & 0xff; offset = offs | 0x500; - argus_change_palette(offs + 0x180, offset, offset + 0x400); + change_palette(offs + 0x180, offset, offset + 0x400); } else if ((offset >= 0x700 && offset <= 0x7ff) || (offset >= 0xb00 && offset <= 0xbff)) /* text color */ @@ -546,7 +554,7 @@ WRITE8_MEMBER(argus_state::argus_paletteram_w) offs = offset & 0xff; offset = offs | 0x700; - argus_change_palette(offs + 0x280, offset, offset + 0x400); + change_palette(offs + 0x280, offset, offset + 0x400); } } @@ -556,7 +564,7 @@ WRITE8_MEMBER(argus_state::valtric_paletteram_w) if (offset <= 0x1ff) /* Sprite color */ { - argus_change_palette(offset >> 1, offset & ~1, offset | 1); + change_palette(offset >> 1, offset & ~1, offset | 1); if (offset == 0x1fe || offset == 0x1ff) { @@ -565,16 +573,16 @@ WRITE8_MEMBER(argus_state::valtric_paletteram_w) m_palette_intensity = m_paletteram[0x1ff] | (m_paletteram[0x1fe] << 8); for (offs = 0x400; offs < 0x600; offs += 2) - argus_change_bg_palette(((offs & 0x1ff) >> 1) + 0x100, offs & ~1, offs | 1); + change_bg_palette(((offs & 0x1ff) >> 1) + 0x100, offs & ~1, offs | 1); } } else if (offset >= 0x400 && offset <= 0x5ff) /* BG color */ { - argus_change_bg_palette(((offset & 0x1ff) >> 1) + 0x100, offset & ~1, offset | 1); + change_bg_palette(((offset & 0x1ff) >> 1) + 0x100, offset & ~1, offset | 1); } else if (offset >= 0x600 && offset <= 0x7ff) /* Text color */ { - argus_change_palette(((offset & 0x1ff) >> 1) + 0x200, offset & ~1, offset | 1); + change_palette(((offset & 0x1ff) >> 1) + 0x200, offset & ~1, offset | 1); } } @@ -584,36 +592,31 @@ WRITE8_MEMBER(argus_state::butasan_paletteram_w) if (offset <= 0x1ff) /* BG0 color */ { - argus_change_palette((offset >> 1) + 0x100, offset & ~1, offset | 1); + change_palette((offset >> 1) + 0x100, offset & ~1, offset | 1); } else if (offset <= 0x23f) /* BG1 color */ { - argus_change_palette(((offset & 0x3f) >> 1) + 0x0c0, offset & ~1, offset | 1); + change_palette(((offset & 0x3f) >> 1) + 0x0c0, offset & ~1, offset | 1); } else if (offset >= 0x400 && offset <= 0x47f) /* Sprite color */ { /* 16 colors */ - argus_change_palette((offset & 0x7f) >> 1, offset & ~1, offset | 1); + change_palette((offset & 0x7f) >> 1, offset & ~1, offset | 1); } else if (offset >= 0x480 && offset <= 0x4ff) /* Sprite color */ { /* 8 colors */ int offs = (offset & 0x070) | ((offset & 0x00f) >> 1); - argus_change_palette(offs + 0x040, offset & ~1, offset | 1); - argus_change_palette(offs + 0x048, offset & ~1, offset | 1); + change_palette(offs + 0x040, offset & ~1, offset | 1); + change_palette(offs + 0x048, offset & ~1, offset | 1); } else if (offset >= 0x600 && offset <= 0x7ff) /* Text color */ { - argus_change_palette(((offset & 0x1ff) >> 1) + 0x200, offset & ~1, offset | 1); + change_palette(((offset & 0x1ff) >> 1) + 0x200, offset & ~1, offset | 1); } else if (offset >= 0x240 && offset <= 0x25f) // dummy - argus_change_palette(((offset & 0x1f) >> 1) + 0xe0, offset & ~1, offset | 1); + change_palette(((offset & 0x1f) >> 1) + 0xe0, offset & ~1, offset | 1); else if (offset >= 0x500 && offset <= 0x51f) // dummy - argus_change_palette(((offset & 0x1f) >> 1) + 0xf0, offset & ~1, offset | 1); -} - -READ8_MEMBER(argus_state::butasan_bg1ram_r) -{ - return m_butasan_bg1ram[offset]; + change_palette(((offset & 0x1f) >> 1) + 0xf0, offset & ~1, offset | 1); } WRITE8_MEMBER(argus_state::butasan_bg1ram_w) @@ -804,24 +807,21 @@ void argus_state::argus_bg0_scroll_handle() void argus_state::argus_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority) { - UINT8 *spriteram = m_spriteram; - int offs; - /* Draw the sprites */ - for (offs = 0; offs < m_spriteram.bytes(); offs += 16) + for (int offs = 0; offs < m_spriteram.bytes(); offs += 16) { - if (!(spriteram[offs+15] == 0 && spriteram[offs+11] == 0xf0)) + if (!(m_spriteram[offs+15] == 0 && m_spriteram[offs+11] == 0xf0)) { int sx, sy, tile, flipx, flipy, color, pri; - sx = spriteram[offs+12]; if (spriteram[offs+13] & 0x01) sx -= 256; - sy = spriteram[offs+11]; if (!(spriteram[offs+13] & 0x02)) sy -= 256; + sx = m_spriteram[offs+12]; if (m_spriteram[offs+13] & 0x01) sx -= 256; + sy = m_spriteram[offs+11]; if (!(m_spriteram[offs+13] & 0x02)) sy -= 256; - tile = spriteram[offs+14] | ((spriteram[offs+13] & 0xc0) << 2); - flipx = spriteram[offs+13] & 0x10; - flipy = spriteram[offs+13] & 0x20; - color = spriteram[offs+15] & 0x07; - pri = (spriteram[offs+15] & 0x08) >> 3; + tile = m_spriteram[offs+14] | ((m_spriteram[offs+13] & 0xc0) << 2); + flipx = m_spriteram[offs+13] & 0x10; + flipy = m_spriteram[offs+13] & 0x20; + color = m_spriteram[offs+15] & 0x07; + pri = (m_spriteram[offs+15] & 0x08) >> 3; if (m_flipscreen) { @@ -933,23 +933,20 @@ void argus_state::valtric_draw_mosaic(screen_device &screen, bitmap_rgb32 &bitma void argus_state::valtric_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - UINT8 *spriteram = m_spriteram; - int offs; - /* Draw the sprites */ - for (offs = 0; offs < m_spriteram.bytes(); offs += 16) + for (int offs = 0; offs < m_spriteram.bytes(); offs += 16) { - if (!(spriteram[offs+15] == 0 && spriteram[offs+11] == 0xf0)) + if (!(m_spriteram[offs+15] == 0 && m_spriteram[offs+11] == 0xf0)) { int sx, sy, tile, flipx, flipy, color; - sx = spriteram[offs+12]; if (spriteram[offs+13] & 0x01) sx -= 256; - sy = spriteram[offs+11]; if (!(spriteram[offs+13] & 0x02)) sy -= 256; + sx = m_spriteram[offs+12]; if (m_spriteram[offs+13] & 0x01) sx -= 256; + sy = m_spriteram[offs+11]; if (!(m_spriteram[offs+13] & 0x02)) sy -= 256; - tile = spriteram[offs+14] | ((spriteram[offs+13] & 0xc0) << 2); - flipx = spriteram[offs+13] & 0x10; - flipy = spriteram[offs+13] & 0x20; - color = spriteram[offs+15] & 0x0f; + tile = m_spriteram[offs+14] | ((m_spriteram[offs+13] & 0xc0) << 2); + flipx = m_spriteram[offs+13] & 0x10; + flipy = m_spriteram[offs+13] & 0x20; + color = m_spriteram[offs+15] & 0x0f; if (m_flipscreen) { @@ -972,25 +969,22 @@ void argus_state::valtric_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cl void argus_state::butasan_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - UINT8 *spriteram = m_spriteram; - int offs; - /* Draw the sprites */ - for (offs = 0; offs < m_spriteram.bytes(); offs += 16) + for (int offs = 0; offs < m_spriteram.bytes(); offs += 16) { int sx, sy, tile, flipx, flipy, color; int fx, fy; - tile = spriteram[offs+14] | ((spriteram[offs+15] & 0x0f) << 8); - flipx = spriteram[offs+8] & 0x01; - flipy = spriteram[offs+8] & 0x04; - color = spriteram[offs+9] & 0x0f; + tile = m_spriteram[offs+14] | ((m_spriteram[offs+15] & 0x0f) << 8); + flipx = m_spriteram[offs+8] & 0x01; + flipy = m_spriteram[offs+8] & 0x04; + color = m_spriteram[offs+9] & 0x0f; - sx = spriteram[offs+10]; - sy = spriteram[offs+12]; + sx = m_spriteram[offs+10]; + sy = m_spriteram[offs+12]; - if (spriteram[offs+11] & 0x01) sx-=256; - if (spriteram[offs+13] & 0x01) sy-=256; + if (m_spriteram[offs+11] & 0x01) sx-=256; + if (m_spriteram[offs+13] & 0x01) sy-=256; sy = 240 - sy;