diff --git a/.gitattributes b/.gitattributes index 380224354f5..6439d251205 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4305,6 +4305,8 @@ src/mame/video/seibuspi.c svneol=native#text/plain src/mame/video/seicross.c svneol=native#text/plain src/mame/video/senjyo.c svneol=native#text/plain src/mame/video/seta.c svneol=native#text/plain +src/mame/video/seta001.c svneol=native#text/plain +src/mame/video/seta001.h svneol=native#text/plain src/mame/video/seta2.c svneol=native#text/plain src/mame/video/sf.c svneol=native#text/plain src/mame/video/shadfrce.c svneol=native#text/plain diff --git a/src/mame/drivers/cchance.c b/src/mame/drivers/cchance.c index 7127cc01974..b57f284eeb4 100644 --- a/src/mame/drivers/cchance.c +++ b/src/mame/drivers/cchance.c @@ -36,7 +36,7 @@ cha3 $10d8 #include "cpu/z80/z80.h" #include "includes/tnzs.h" #include "sound/ay8910.h" - +#include "video/seta001.h" class cchance_state : public tnzs_state { @@ -80,9 +80,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8 ) AM_RANGE(0xc000, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xe1ff) AM_RAM AM_BASE_MEMBER(cchance_state, m_vdcram) - AM_RANGE(0xe200, 0xe2ff) AM_RAM AM_BASE_MEMBER(cchance_state, m_scrollram) /* scrolling info */ - AM_RANGE(0xe300, 0xe303) AM_RAM AM_MIRROR(0xfc) AM_BASE_MEMBER(cchance_state, m_objctrl) /* control registers (0x80 mirror used by Arkanoid 2) */ + AM_RANGE(0xe000, 0xe2ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r8, spriteylow_w8) + AM_RANGE(0xe300, 0xe303) AM_RAM AM_MIRROR(0xfc) AM_MIRROR(0xfc) AM_DEVWRITE("spritegen", spritectrl_w8) /* control registers (0x80 mirror used by Arkanoid 2) */ AM_RANGE(0xe800, 0xe800) AM_WRITEONLY AM_BASE_MEMBER(cchance_state, m_bg_flag) /* enable / disable background transparency */ AM_RANGE(0xf000, 0xf000) AM_READNOP AM_WRITENOP //??? @@ -225,6 +224,8 @@ static MACHINE_CONFIG_START( cchance, cchance_state ) MCFG_GFXDECODE(cchance) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(57.5) diff --git a/src/mame/drivers/champbwl.c b/src/mame/drivers/champbwl.c index eda66e51339..23a582925d0 100644 --- a/src/mame/drivers/champbwl.c +++ b/src/mame/drivers/champbwl.c @@ -155,7 +155,7 @@ Notes: #include "sound/x1_010.h" #include "machine/nvram.h" #include "includes/tnzs.h" - +#include "video/seta001.h" class champbwl_state : public tnzs_state { @@ -195,24 +195,14 @@ static WRITE8_HANDLER( champbwl_misc_w ) memory_set_bank(space->machine(), "bank1", (data & 0x30) >> 4); } -static WRITE8_HANDLER( champbwl_objctrl_w ) -{ - champbwl_state *state = space->machine().driver_data(); - if(offset != 0) - data ^= 0xff; - - state->m_objctrl[offset] = data; -} - static ADDRESS_MAP_START( champbwl_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_REGION("maincpu", 0x10000) AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1") AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("nvram") AM_RANGE(0xa000, 0xbfff) AM_RAM AM_BASE_MEMBER(champbwl_state, m_objram) AM_RANGE(0xc000, 0xdfff) AM_DEVREADWRITE("x1snd", seta_sound_r, seta_sound_w) - AM_RANGE(0xe000, 0xe1ff) AM_RAM AM_BASE_MEMBER(champbwl_state, m_vdcram) - AM_RANGE(0xe200, 0xe2ff) AM_RAM AM_BASE_MEMBER(champbwl_state, m_scrollram) /* scrolling info */ - AM_RANGE(0xe300, 0xe303) AM_MIRROR(0xfc) AM_WRITE(champbwl_objctrl_w) AM_BASE_MEMBER(champbwl_state, m_objctrl) /* control registers (0x80 mirror used by Arkanoid 2) */ + AM_RANGE(0xe000, 0xe2ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r8, spriteylow_w8) + AM_RANGE(0xe300, 0xe303) AM_MIRROR(0xfc) AM_DEVWRITE("spritegen", spritectrl_w8_champbwl) /* control registers (0x80 mirror used by Arkanoid 2) */ AM_RANGE(0xe800, 0xe800) AM_WRITEONLY AM_BASE_MEMBER(champbwl_state, m_bg_flag) /* enable / disable background transparency */ AM_RANGE(0xf000, 0xf000) AM_READ(trackball_r) @@ -379,6 +369,8 @@ static MACHINE_CONFIG_START( champbwl, champbwl_state ) MCFG_MACHINE_START(champbwl) MCFG_MACHINE_RESET(champbwl) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(57.5) diff --git a/src/mame/drivers/seta.c b/src/mame/drivers/seta.c index e6fd9ceb433..bcfb02dbc36 100644 --- a/src/mame/drivers/seta.c +++ b/src/mame/drivers/seta.c @@ -1315,7 +1315,7 @@ Note: on screen copyright is (c)1998 Coinmaster. #include "sound/okim6295.h" #include "sound/x1_010.h" #include "sound/2151intf.h" - +#include "video/seta001.h" #if __uPD71054_TIMER @@ -1548,18 +1548,7 @@ static READ8_DEVICE_HANDLER( dsw2_r ) static SCREEN_EOF( seta_buffer_sprites ) { seta_state *state = machine.driver_data(); - UINT16 *spriteram16 = state->m_spriteram; - int ctrl2 = spriteram16[ 0x602/2 ]; - - if (~ctrl2 & 0x20) - { - UINT16 *spriteram2 = state->m_spriteram2; - - if (ctrl2 & 0x40) - memcpy(&spriteram2[0x0000/2],&spriteram2[0x2000/2],0x2000/2); - else - memcpy(&spriteram2[0x2000/2],&spriteram2[0x0000/2],0x2000/2); - } + machine.device("spritegen")->setac_eof( state->m_spriteram2); } @@ -1596,7 +1585,9 @@ static ADDRESS_MAP_START( tndrcade_map, AS_PROGRAM, 16 ) AM_RANGE(0x300000, 0x300001) AM_WRITENOP // ? 0 / 1 AM_RANGE(0x380000, 0x3803ff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, m_paletteram, m_paletteram_size) // Palette /**/AM_RANGE(0x400000, 0x400001) AM_WRITENOP // ? $4000 -/**/AM_RANGE(0x600000, 0x600607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0x600000, 0x6005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0x600600, 0x600607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) + AM_RANGE(0x800000, 0x800007) AM_WRITE(sub_ctrl_w) // Sub CPU Control? AM_RANGE(0xa00000, 0xa00fff) AM_READWRITE(sharedram_68000_r,sharedram_68000_w) // Shared RAM AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr @@ -1624,7 +1615,8 @@ static ADDRESS_MAP_START( downtown_map, AS_PROGRAM, 16 ) AM_RANGE(0xa00000, 0xa00007) AM_WRITE(sub_ctrl_w) // Sub CPU Control? AM_RANGE(0xb00000, 0xb00fff) AM_READWRITE(sharedram_68000_r,sharedram_68000_w) // Shared RAM AM_RANGE(0xc00000, 0xc00001) AM_WRITENOP // ? $4000 - AM_RANGE(0xd00000, 0xd00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xf00000, 0xffffff) AM_RAM // RAM ADDRESS_MAP_END @@ -1683,7 +1675,8 @@ static ADDRESS_MAP_START( calibr50_map, AS_PROGRAM, 16 ) AM_RANGE(0x904000, 0x904fff) AM_RAM // AM_RANGE(0xa00000, 0xa00019) AM_READ(calibr50_ip_r) // Input Ports -/**/AM_RANGE(0xd00000, 0xd00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xb00000, 0xb00001) AM_READWRITE(soundlatch2_word_r,calibr50_soundlatch_w) // From Sub CPU /**/AM_RANGE(0xc00000, 0xc00001) AM_RAM // ? $4000 @@ -1754,7 +1747,8 @@ static WRITE16_HANDLER( usclssic_lockout_w ) static ADDRESS_MAP_START( usclssic_map, AS_PROGRAM, 16 ) AM_RANGE(0x000000, 0x07ffff) AM_ROM // ROM AM_RANGE(0xff0000, 0xffffff) AM_RAM // RAM - AM_RANGE(0x800000, 0x800607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0x800000, 0x8005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0x800600, 0x800607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) /**/AM_RANGE(0x900000, 0x900001) AM_RAM // ? $4000 AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_0) // VRAM Ctrl /**/AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, m_paletteram, m_paletteram_size) // Palette @@ -1787,7 +1781,8 @@ static ADDRESS_MAP_START( atehate_map, AS_PROGRAM, 16 ) AM_RANGE(0x500000, 0x500001) AM_WRITENOP // ? (end of lev 1: bit 4 goes 1,0,1) AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r) // DSW AM_RANGE(0x700000, 0x7003ff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, m_paletteram, m_paletteram_size) // Palette - AM_RANGE(0xa00000, 0xa00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1") // P1 AM_RANGE(0xb00002, 0xb00003) AM_READ_PORT("P2") // P2 AM_RANGE(0xb00004, 0xb00005) AM_READ_PORT("COINS") // Coins @@ -1813,7 +1808,8 @@ static ADDRESS_MAP_START( blandia_map, AS_PROGRAM, 16 ) AM_RANGE(0x700000, 0x7003ff) AM_RAM // (rezon,jjsquawk) AM_RANGE(0x700400, 0x700fff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, m_paletteram, m_paletteram_size) // Palette AM_RANGE(0x703c00, 0x7047ff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, m_paletteram2, m_paletteram2_size) // 2nd Palette for the palette offset effect -/**/AM_RANGE(0x800000, 0x800607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0x800000, 0x8005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0x800600, 0x800607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0x880000, 0x880001) AM_RAM // ? 0xc000 AM_RANGE(0x900000, 0x903fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr /**/AM_RANGE(0xa00000, 0xa00005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_0) // VRAM 0&1 Ctrl @@ -1853,7 +1849,8 @@ static ADDRESS_MAP_START( blandiap_map, AS_PROGRAM, 16 ) AM_RANGE(0x884000, 0x88ffff) AM_RAM // (jjsquawk) /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_0) // VRAM 0&1 Ctrl /**/AM_RANGE(0x980000, 0x980005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_2) // VRAM 2&3 Ctrl -/**/AM_RANGE(0xa00000, 0xa00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) /**/AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound @@ -1935,7 +1932,8 @@ static ADDRESS_MAP_START( wrofaero_map, AS_PROGRAM, 16 ) AM_RANGE(0x884000, 0x88ffff) AM_RAM // (jjsquawk) /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_0) // VRAM 0&1 Ctrl /**/AM_RANGE(0x980000, 0x980005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_2) // VRAM 2&3 Ctrl -/**/AM_RANGE(0xa00000, 0xa00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) /**/AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound @@ -1977,7 +1975,8 @@ static ADDRESS_MAP_START( zingzipbl_map, AS_PROGRAM, 16 ) AM_RANGE(0x902010, 0x902013) AM_READ( zingzipbl_unknown_r ) /**/AM_RANGE(0x980000, 0x980005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_2) // VRAM 2&3 Ctrl -/**/AM_RANGE(0xa00000, 0xa00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) /**/AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xc00000, 0xc03fff) AM_RAM // soundram on original @@ -2009,7 +2008,8 @@ static ADDRESS_MAP_START( jjsquawb_map, AS_PROGRAM, 16 ) AM_RANGE(0x884000, 0x88ffff) AM_RAM // (jjsquawk) AM_RANGE(0x908000, 0x908005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_0) // VRAM 0&1 Ctrl AM_RANGE(0x909000, 0x909005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_2) // VRAM 2&3 Ctrl - AM_RANGE(0xa0a000, 0xa0a607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // RZ: Sprites Y + AM_RANGE(0xa0a000, 0xa0a5ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // RZ: Sprites Y + AM_RANGE(0xa0a600, 0xa0a607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) // AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 AM_RANGE(0xb0c000, 0xb0ffff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // RZ: Sprites Code + X + Attr AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound @@ -2043,7 +2043,8 @@ static ADDRESS_MAP_START( orbs_map, AS_PROGRAM, 16 ) AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, m_paletteram, m_paletteram_size) // Palette AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr /**/AM_RANGE(0xd00000, 0xd00001) AM_RAM // ? 0x4000 -/**/AM_RANGE(0xe00000, 0xe00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xe00000, 0xe005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xe00600, 0xe00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) ADDRESS_MAP_END /*************************************************************************** @@ -2128,7 +2129,8 @@ static ADDRESS_MAP_START( keroppi_map, AS_PROGRAM, 16 ) AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, m_paletteram, m_paletteram_size) // Palette AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr /**/AM_RANGE(0xd00000, 0xd00001) AM_RAM // ? 0x4000 -/**/AM_RANGE(0xe00000, 0xe00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xe00000, 0xe005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xe00600, 0xe00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) ADDRESS_MAP_END static MACHINE_START( keroppi ) @@ -2159,7 +2161,8 @@ static ADDRESS_MAP_START( blockcar_map, AS_PROGRAM, 16 ) AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, m_paletteram, m_paletteram_size) // Palette AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr /**/AM_RANGE(0xd00000, 0xd00001) AM_RAM // ? 0x4000 -/**/AM_RANGE(0xe00000, 0xe00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xe00000, 0xe005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xe00600, 0xe00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) ADDRESS_MAP_END @@ -2185,7 +2188,9 @@ static ADDRESS_MAP_START( daioh_map, AS_PROGRAM, 16 ) AM_RANGE(0x884000, 0x88ffff) AM_RAM // AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_0) // VRAM 0&1 Ctrl AM_RANGE(0x980000, 0x980005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_2) // VRAM 2&3 Ctrl - AM_RANGE(0xa00000, 0xa00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) + AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xb04000, 0xb13fff) AM_RAM @@ -2216,7 +2221,8 @@ static ADDRESS_MAP_START( drgnunit_map, AS_PROGRAM, 16 ) AM_RANGE(0xb00004, 0xb00005) AM_READ_PORT("COINS") // Coins AM_RANGE(0xb00006, 0xb00007) AM_READNOP // unused (qzkklogy) /**/AM_RANGE(0xc00000, 0xc00001) AM_RAM // ? $4000 -/**/AM_RANGE(0xd00000, 0xd00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr ADDRESS_MAP_END @@ -2259,10 +2265,11 @@ static READ16_HANDLER( setaroul_d4_10_r ) return 0x00;// space->machine().rand(); } - +#if 0 // ?? looks like sprite ram access is 8-bit not 16? static WRITE16_HANDLER( setaroul_spr_w ) { + seta_state *state = space->machine().driver_data(); UINT16 *spriteram16 = state->m_spriteram; int realoffs = offset; @@ -2276,7 +2283,9 @@ static WRITE16_HANDLER( setaroul_spr_w ) } COMBINE_DATA(&spriteram16[realoffs]); + } +#endif static ADDRESS_MAP_START( setaroul_map, AS_PROGRAM, 16 ) AM_RANGE(0x000000, 0x01ffff) AM_ROM // ROM @@ -2302,7 +2311,8 @@ static ADDRESS_MAP_START( setaroul_map, AS_PROGRAM, 16 ) AM_RANGE(0xe00000, 0xe03fff) AM_RAM_WRITE(seta_vram_0_w) AM_BASE_MEMBER(seta_state, m_vram_0 ) // VRAM - draws wheel if you reset enough times.. AM_RANGE(0xe40000, 0xe40005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_0) // VRAM Ctrl AM_RANGE(0xf00000, 0xf03fff) AM_RAM - AM_RANGE(0xf40000, 0xf40c11) AM_WRITE(setaroul_spr_w) AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0xf40000, 0xf40bff) AM_RAM // AM_WRITE(setaroul_spr_w) AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0xf40c00, 0xf40c11) AM_RAM // AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) // probably wrong hookup ADDRESS_MAP_END /*************************************************************************** @@ -2330,7 +2340,8 @@ static ADDRESS_MAP_START( extdwnhl_map, AS_PROGRAM, 16 ) AM_RANGE(0x884000, 0x88ffff) AM_RAM // /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_0) // VRAM 0&1 Ctrl /**/AM_RANGE(0x980000, 0x980005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_2) // VRAM 2&3 Ctrl -/**/AM_RANGE(0xa00000, 0xa00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) /**/AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xb04000, 0xb13fff) AM_RAM // @@ -2361,7 +2372,8 @@ static ADDRESS_MAP_START( kamenrid_map, AS_PROGRAM, 16 ) AM_RANGE(0x884000, 0x887fff) AM_RAM // tested AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_0) // VRAM 0&1 Ctrl AM_RANGE(0x980000, 0x980005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_2) // VRAM 2&3 Ctrl - AM_RANGE(0xa00000, 0xa00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? $4000 AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xb04000, 0xb07fff) AM_RAM // tested @@ -2390,7 +2402,8 @@ static ADDRESS_MAP_START( madshark_map, AS_PROGRAM, 16 ) AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_0) // VRAM 0&1 Ctrl AM_RANGE(0x980000, 0x980005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_2) // VRAM 2&3 Ctrl - AM_RANGE(0xa00000, 0xa00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? $4000 AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr #if __uPD71054_TIMER @@ -2447,7 +2460,8 @@ static ADDRESS_MAP_START( krzybowl_map, AS_PROGRAM, 16 ) AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, m_paletteram, m_paletteram_size) // Palette AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr /**/AM_RANGE(0xd00000, 0xd00001) AM_RAM // ? 0x4000 -/**/AM_RANGE(0xe00000, 0xe00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xe00000, 0xe005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xe00600, 0xe00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) ADDRESS_MAP_END @@ -2480,7 +2494,8 @@ static ADDRESS_MAP_START( msgundam_map, AS_PROGRAM, 16 ) AM_RANGE(0x500000, 0x500005) AM_RAM_WRITE(msgundam_vregs_w) AM_BASE_MEMBER(seta_state, m_vregs) // Coin Lockout + Video Registers AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r) // DSW AM_RANGE(0x700400, 0x700fff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, m_paletteram, m_paletteram_size) // Palette - AM_RANGE(0x800000, 0x800607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0x800000, 0x8005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0x800600, 0x800607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0x880000, 0x880001) AM_RAM // ? 0x4000 AM_RANGE(0x900000, 0x903fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xa00000, 0xa03fff) AM_RAM_WRITE(seta_vram_0_w) AM_BASE_MEMBER(seta_state, m_vram_0) // VRAM 0&1 @@ -2516,7 +2531,8 @@ static ADDRESS_MAP_START( oisipuzl_map, AS_PROGRAM, 16 ) AM_RANGE(0x880000, 0x883fff) AM_RAM_WRITE(seta_vram_2_w) AM_BASE_MEMBER(seta_state, m_vram_2) // VRAM 2&3 /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_0) // VRAM 0&1 Ctrl /**/AM_RANGE(0x980000, 0x980005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_2) // VRAM 2&3 Ctrl -/**/AM_RANGE(0xa00000, 0xa00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) /**/AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xc00400, 0xc00fff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, m_paletteram, m_paletteram_size) // Palette @@ -2544,7 +2560,8 @@ static ADDRESS_MAP_START( triplfun_map, AS_PROGRAM, 16 ) AM_RANGE(0x880000, 0x883fff) AM_RAM_WRITE(seta_vram_2_w) AM_BASE_MEMBER(seta_state, m_vram_2) // VRAM 2&3 /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_0) // VRAM 0&1 Ctrl /**/AM_RANGE(0x980000, 0x980005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_2) // VRAM 2&3 Ctrl -/**/AM_RANGE(0xa00000, 0xa00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) /**/AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xc00400, 0xc00fff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, m_paletteram, m_paletteram_size) // Palette @@ -2599,7 +2616,8 @@ static ADDRESS_MAP_START( kiwame_map, AS_PROGRAM, 16 ) AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE(kiwame_nvram_r, kiwame_nvram_w) AM_BASE_MEMBER(seta_state, m_kiwame_nvram) // NVRAM + Regs ? AM_RANGE(0x800000, 0x803fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr /**/AM_RANGE(0x900000, 0x900001) AM_RAM // ? 0x4000 -/**/AM_RANGE(0xa00000, 0xa00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, m_paletteram, m_paletteram_size) // Palette AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound AM_RANGE(0xd00000, 0xd00009) AM_READ(kiwame_input_r) // mahjong panel @@ -2640,7 +2658,8 @@ static ADDRESS_MAP_START( thunderl_map, AS_PROGRAM, 16 ) AM_RANGE(0xb00008, 0xb00009) AM_READ_PORT("P3") // P3 (wits) AM_RANGE(0xb0000a, 0xb0000b) AM_READ_PORT("P4") // P4 (wits) /**/AM_RANGE(0xc00000, 0xc00001) AM_RAM // ? 0x4000 -/**/AM_RANGE(0xd00000, 0xd00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xe04000, 0xe07fff) AM_RAM // (wits) ADDRESS_MAP_END @@ -2663,7 +2682,8 @@ static ADDRESS_MAP_START( thunderlbl_map, AS_PROGRAM, 16 ) AM_RANGE(0xb00008, 0xb00009) AM_READ_PORT("P3") // P3 (wits) AM_RANGE(0xb0000a, 0xb0000b) AM_READ_PORT("P4") // P4 (wits) /**/AM_RANGE(0xc00000, 0xc00001) AM_RAM // ? 0x4000 -/**/AM_RANGE(0xd00000, 0xd00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xe04000, 0xe07fff) AM_RAM // (wits) ADDRESS_MAP_END @@ -2704,7 +2724,8 @@ static ADDRESS_MAP_START( wiggie_map, AS_PROGRAM, 16 ) AM_RANGE(0xb00008, 0xb00009) AM_READ_PORT("P3") // P3 (wits) AM_RANGE(0xb0000a, 0xb0000b) AM_READ_PORT("P4") // P4 (wits) /**/AM_RANGE(0xc00000, 0xc00001) AM_RAM // ? 0x4000 -/**/AM_RANGE(0xd00000, 0xd00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y +/**/AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xe04000, 0xe07fff) AM_RAM // (wits) ADDRESS_MAP_END @@ -2733,7 +2754,8 @@ static ADDRESS_MAP_START( umanclub_map, AS_PROGRAM, 16 ) AM_RANGE(0x400004, 0x400005) AM_WRITENOP // ? (end of lev 2) AM_RANGE(0x500000, 0x500001) AM_RAM_WRITE(seta_vregs_w) AM_BASE_MEMBER(seta_state, m_vregs) // Coin Lockout + Video Registers AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r) // DSW - AM_RANGE(0xa00000, 0xa00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) /**/AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound @@ -2766,7 +2788,8 @@ static ADDRESS_MAP_START( utoukond_map, AS_PROGRAM, 16 ) AM_RANGE(0x880000, 0x883fff) AM_RAM_WRITE(seta_vram_2_w) AM_BASE_MEMBER(seta_state, m_vram_2) // VRAM 2&3 AM_RANGE(0x900000, 0x900005) AM_WRITEONLY AM_BASE_MEMBER(seta_state, m_vctrl_0)// VRAM 0&1 Ctrl AM_RANGE(0x980000, 0x980005) AM_WRITEONLY AM_BASE_MEMBER(seta_state, m_vctrl_2)// VRAM 2&3 Ctrl - AM_RANGE(0xa00000, 0xa00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xc00000, 0xc00001) AM_WRITE(utoukond_soundlatch_w) // To Sound CPU (cause an IRQ) AM_RANGE(0xe00000, 0xe00001) AM_WRITENOP // ? ack @@ -2809,7 +2832,8 @@ static ADDRESS_MAP_START( pairlove_map, AS_PROGRAM, 16 ) AM_RANGE(0xb00000, 0xb00fff) AM_RAM AM_BASE_SIZE_MEMBER(seta_state, m_paletteram, m_paletteram_size) // Palette AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xd00000, 0xd00001) AM_RAM // ? 0x4000 - AM_RANGE(0xe00000, 0xe00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0xe00000, 0xe005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xe00600, 0xe00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xf00000, 0xf0ffff) AM_RAM // RAM ADDRESS_MAP_END @@ -2835,7 +2859,8 @@ static ADDRESS_MAP_START( crazyfgt_map, AS_PROGRAM, 16 ) AM_RANGE(0x880000, 0x883fff) AM_WRITE(seta_vram_0_w) AM_BASE_MEMBER(seta_state, m_vram_0) // VRAM 0 AM_RANGE(0x900000, 0x900005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_2) // VRAM 2&3 Ctrl AM_RANGE(0x980000, 0x980005) AM_RAM AM_BASE_MEMBER(seta_state, m_vctrl_0) // VRAM 0&1 Ctrl - AM_RANGE(0xa00000, 0xa00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xa80000, 0xa80001) AM_WRITENOP // ? 0x4000 AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr ADDRESS_MAP_END @@ -2904,7 +2929,9 @@ static ADDRESS_MAP_START( inttoote_map, AS_PROGRAM, 16 ) AM_RANGE(0xc00000, 0xc00001) AM_RAM // ? 0x4000 - AM_RANGE(0xd00000, 0xd00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) + AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xffc000, 0xffffff) AM_RAM // RAM @@ -2969,7 +2996,9 @@ static ADDRESS_MAP_START( jockeyc_map, AS_PROGRAM, 16 ) AM_RANGE(0xc00000, 0xc00001) AM_RAM // ? 0x4000 - AM_RANGE(0xd00000, 0xd00607) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram) // Sprites Y + AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) + AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE_MEMBER(seta_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xffc000, 0xffffff) AM_RAM // RAM @@ -6974,6 +7003,8 @@ static MACHINE_CONFIG_START( tndrcade, seta_state ) MCFG_CPU_PROGRAM_MAP(tndrcade_sub_map) MCFG_CPU_VBLANK_INT_HACK(tndrcade_sub_interrupt,TNDRCADE_SUB_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7023,6 +7054,8 @@ static MACHINE_CONFIG_START( twineagl, seta_state ) MCFG_CPU_PROGRAM_MAP(twineagl_sub_map) MCFG_CPU_VBLANK_INT_HACK(seta_sub_interrupt,SETA_SUB_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7064,6 +7097,8 @@ static MACHINE_CONFIG_START( downtown, seta_state ) MCFG_CPU_PROGRAM_MAP(downtown_sub_map) MCFG_CPU_VBLANK_INT_HACK(seta_sub_interrupt,SETA_SUB_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(57.42) /* verified on pcb */ @@ -7123,6 +7158,8 @@ static MACHINE_CONFIG_START( usclssic, seta_state ) MCFG_MACHINE_RESET(calibr50) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7171,6 +7208,8 @@ static MACHINE_CONFIG_START( calibr50, seta_state ) MCFG_MACHINE_RESET(calibr50) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(57.42) /* verified on pcb */ @@ -7210,6 +7249,8 @@ static MACHINE_CONFIG_START( metafox, seta_state ) MCFG_CPU_PROGRAM_MAP(metafox_sub_map) MCFG_CPU_VBLANK_INT_HACK(seta_sub_interrupt,SETA_SUB_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7245,6 +7286,8 @@ static MACHINE_CONFIG_START( atehate, seta_state ) MCFG_CPU_PROGRAM_MAP(atehate_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7286,6 +7329,8 @@ static MACHINE_CONFIG_START( blandia, seta_state ) MCFG_CPU_PROGRAM_MAP(blandia_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_2_and_4,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7318,6 +7363,8 @@ static MACHINE_CONFIG_START( blandiap, seta_state ) MCFG_CPU_PROGRAM_MAP(blandiap_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_2_and_4,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7355,6 +7402,8 @@ static MACHINE_CONFIG_START( blockcar, seta_state ) MCFG_CPU_PROGRAM_MAP(blockcar_map) MCFG_CPU_VBLANK_INT("screen", irq3_line_hold) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7390,6 +7439,8 @@ static MACHINE_CONFIG_START( daioh, seta_state ) MCFG_CPU_PROGRAM_MAP(daioh_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7430,6 +7481,8 @@ static MACHINE_CONFIG_START( drgnunit, seta_state ) MCFG_CPU_PROGRAM_MAP(drgnunit_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7464,6 +7517,8 @@ static MACHINE_CONFIG_START( qzkklgy2, seta_state ) MCFG_CPU_PROGRAM_MAP(drgnunit_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7510,6 +7565,8 @@ static MACHINE_CONFIG_START( setaroul, seta_state ) MCFG_CPU_PROGRAM_MAP(setaroul_map) MCFG_CPU_VBLANK_INT_HACK(setaroul_interrupt,SETAROUL_INTERRUPTS_NUM) // and 6? + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7547,6 +7604,8 @@ static MACHINE_CONFIG_START( eightfrc, seta_state ) MCFG_CPU_PROGRAM_MAP(wrofaero_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7587,6 +7646,8 @@ static MACHINE_CONFIG_START( extdwnhl, seta_state ) MCFG_CPU_PROGRAM_MAP(extdwnhl_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7648,6 +7709,8 @@ static MACHINE_CONFIG_START( gundhara, seta_state ) MCFG_MACHINE_START( wrofaero ) #endif // __uPD71054_TIMER + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7688,6 +7751,8 @@ static MACHINE_CONFIG_START( jjsquawk, seta_state ) MCFG_CPU_PROGRAM_MAP(wrofaero_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7719,6 +7784,8 @@ static MACHINE_CONFIG_START( jjsquawb, seta_state ) MCFG_CPU_PROGRAM_MAP(jjsquawb_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7759,6 +7826,8 @@ static MACHINE_CONFIG_START( kamenrid, seta_state ) MCFG_MACHINE_START( wrofaero ) #endif // __uPD71054_TIMER + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7795,6 +7864,8 @@ static MACHINE_CONFIG_START( orbs, seta_state ) MCFG_CPU_PROGRAM_MAP(orbs_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7832,6 +7903,8 @@ static MACHINE_CONFIG_START( keroppi, seta_state ) MCFG_MACHINE_START(keroppi) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7867,6 +7940,8 @@ static MACHINE_CONFIG_START( krzybowl, seta_state ) MCFG_CPU_PROGRAM_MAP(krzybowl_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7907,6 +7982,8 @@ static MACHINE_CONFIG_START( madshark, seta_state ) MCFG_MACHINE_START( wrofaero ) #endif // __uPD71054_TIMER + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -7953,6 +8030,8 @@ static MACHINE_CONFIG_START( msgundam, seta_state ) MCFG_MACHINE_START( wrofaero ) #endif // __uPD71054_TIMER + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(56.66) /* between 56 and 57 to match a real PCB's game speed */ @@ -7990,6 +8069,8 @@ static MACHINE_CONFIG_START( oisipuzl, seta_state ) MCFG_CPU_PROGRAM_MAP(oisipuzl_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -8026,6 +8107,8 @@ static MACHINE_CONFIG_START( triplfun, seta_state ) MCFG_CPU_PROGRAM_MAP(triplfun_map) MCFG_CPU_VBLANK_INT("screen", irq3_line_hold) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -8060,6 +8143,8 @@ static MACHINE_CONFIG_START( kiwame, seta_state ) MCFG_CPU_VBLANK_INT("screen", irq1_line_hold)/* lev 1-7 are the same. WARNING: the interrupt table is written to. */ + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -8098,6 +8183,8 @@ static MACHINE_CONFIG_START( rezon, seta_state ) MCFG_CPU_PROGRAM_MAP(wrofaero_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -8136,6 +8223,8 @@ static MACHINE_CONFIG_START( thunderl, seta_state ) MCFG_CPU_PROGRAM_MAP(thunderl_map) MCFG_CPU_VBLANK_INT("screen", irq2_line_hold) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -8206,6 +8295,8 @@ static MACHINE_CONFIG_START( wiggie, seta_state ) MCFG_CPU_ADD("audiocpu", Z80, 16000000/4) /* 4 MHz */ MCFG_CPU_PROGRAM_MAP(wiggie_sound_map) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -8239,6 +8330,8 @@ static MACHINE_CONFIG_START( wits, seta_state ) MCFG_CPU_PROGRAM_MAP(thunderl_map) MCFG_CPU_VBLANK_INT("screen", irq2_line_hold) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -8274,6 +8367,8 @@ static MACHINE_CONFIG_START( umanclub, seta_state ) MCFG_CPU_PROGRAM_MAP(umanclub_map) MCFG_CPU_VBLANK_INT("screen", irq3_line_hold) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -8313,6 +8408,8 @@ static MACHINE_CONFIG_START( utoukond, seta_state ) MCFG_CPU_PROGRAM_MAP(utoukond_sound_map) MCFG_CPU_IO_MAP(utoukond_sound_io_map) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -8361,6 +8458,8 @@ static MACHINE_CONFIG_START( wrofaero, seta_state ) MCFG_MACHINE_START( wrofaero ) #endif // __uPD71054_TIMER + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -8403,6 +8502,8 @@ static MACHINE_CONFIG_START( zingzip, seta_state ) MCFG_CPU_PROGRAM_MAP(wrofaero_map) MCFG_CPU_VBLANK_INT("screen", irq3_line_hold) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -8453,6 +8554,8 @@ static MACHINE_CONFIG_START( pairlove, seta_state ) MCFG_CPU_PROGRAM_MAP(pairlove_map) MCFG_CPU_VBLANK_INT_HACK(seta_interrupt_1_and_2,SETA_INTERRUPTS_NUM) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -8497,6 +8600,8 @@ static MACHINE_CONFIG_START( crazyfgt, seta_state ) MCFG_CPU_PROGRAM_MAP(crazyfgt_map) MCFG_CPU_VBLANK_INT_HACK(crazyfgt_interrupt,1+5) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -8590,6 +8695,8 @@ static MACHINE_CONFIG_START( inttoote, seta_state ) MCFG_PIA6821_ADD("pia0", inttoote_pia0_intf) MCFG_PIA6821_ADD("pia1", inttoote_pia1_intf) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) diff --git a/src/mame/drivers/srmp2.c b/src/mame/drivers/srmp2.c index 972613cf108..5a38574f2c2 100644 --- a/src/mame/drivers/srmp2.c +++ b/src/mame/drivers/srmp2.c @@ -62,6 +62,7 @@ Note: #include "sound/msm5205.h" #include "includes/srmp2.h" #include "machine/nvram.h" +#include "video/seta001.h" /*************************************************************************** @@ -394,7 +395,8 @@ static ADDRESS_MAP_START( srmp2_map, AS_PROGRAM, 16 ) AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x0c0000, 0x0c3fff) AM_RAM AM_SHARE("nvram") AM_RANGE(0x140000, 0x143fff) AM_RAM AM_BASE_MEMBER(srmp2_state,m_spriteram2.u16) /* Sprites Code + X + Attr */ - AM_RANGE(0x180000, 0x180609) AM_RAM AM_BASE_MEMBER(srmp2_state,m_spriteram1.u16) /* Sprites Y */ + AM_RANGE(0x180000, 0x1805ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) /* Sprites Y */ + AM_RANGE(0x180600, 0x180607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0x1c0000, 0x1c0001) AM_WRITENOP /* ??? */ AM_RANGE(0x800000, 0x800001) AM_WRITE(srmp2_flags_w) /* ADPCM bank, Color bank, etc. */ AM_RANGE(0x900000, 0x900001) AM_READ_PORT("SYSTEM") /* Coinage */ @@ -441,7 +443,9 @@ static ADDRESS_MAP_START( mjyuugi_map, AS_PROGRAM, 16 ) AM_RANGE(0xb00000, 0xb00001) AM_DEVREAD8("aysnd", ay8910_r, 0x00ff) AM_RANGE(0xb00000, 0xb00003) AM_DEVWRITE8("aysnd", ay8910_address_data_w, 0x00ff) AM_RANGE(0xc00000, 0xc00001) AM_WRITENOP /* ??? */ - AM_RANGE(0xd00000, 0xd00609) AM_RAM AM_BASE_MEMBER(srmp2_state,m_spriteram1.u16) /* Sprites Y */ + AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) /* Sprites Y */ + AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) + AM_RANGE(0xd02000, 0xd023ff) AM_RAM /* ??? only writes $00fa */ AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE_MEMBER(srmp2_state,m_spriteram2.u16) /* Sprites Code + X + Attr */ AM_RANGE(0xffc000, 0xffffff) AM_RAM AM_SHARE("nvram") @@ -472,7 +476,8 @@ static ADDRESS_MAP_START( srmp3_map, AS_PROGRAM, 8 ) AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank1") /* rom bank */ AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE("nvram") /* work ram */ AM_RANGE(0xa800, 0xa800) AM_WRITENOP /* flag ? */ - AM_RANGE(0xb000, 0xb303) AM_RAM AM_BASE_MEMBER(srmp2_state,m_spriteram1.u8) /* Sprites Y */ + AM_RANGE(0xb000, 0xb2ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r8, spriteylow_w8) + AM_RANGE(0xb300, 0xb303) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r8, spritectrl_w8) AM_RANGE(0xb800, 0xb800) AM_WRITENOP /* flag ? */ AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE_MEMBER(srmp2_state,m_spriteram2.u8) /* Sprites Code + X + Attr */ AM_RANGE(0xe000, 0xffff) AM_RAM AM_BASE_MEMBER(srmp2_state,m_spriteram3.u8) @@ -495,7 +500,8 @@ static ADDRESS_MAP_START( rmgoldyh_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank1") /* rom bank */ AM_RANGE(0xa000, 0xafff) AM_RAM AM_SHARE("nvram") /* work ram */ - AM_RANGE(0xb000, 0xb303) AM_RAM AM_BASE_MEMBER(srmp2_state,m_spriteram1.u8) /* Sprites Y */ + AM_RANGE(0xb000, 0xb2ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r8, spriteylow_w8) + AM_RANGE(0xb300, 0xb303) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r8, spritectrl_w8) AM_RANGE(0xb800, 0xb800) AM_WRITENOP /* flag ? */ AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE_MEMBER(srmp2_state,m_spriteram2.u8) /* Sprites Code + X + Attr */ AM_RANGE(0xe000, 0xffff) AM_RAM AM_BASE_MEMBER(srmp2_state,m_spriteram3.u8) @@ -1176,6 +1182,8 @@ static MACHINE_CONFIG_START( srmp2, srmp2_state ) MCFG_MACHINE_START(srmp2) MCFG_NVRAM_ADD_0FILL("nvram") + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -1216,6 +1224,8 @@ static MACHINE_CONFIG_START( srmp3, srmp2_state ) MCFG_MACHINE_START(srmp3) MCFG_NVRAM_ADD_0FILL("nvram") + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -1265,6 +1275,8 @@ static MACHINE_CONFIG_START( mjyuugi, srmp2_state ) MCFG_NVRAM_ADD_0FILL("nvram") + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) diff --git a/src/mame/drivers/taito_x.c b/src/mame/drivers/taito_x.c index 4a4a4bd2194..13784ce7ba5 100644 --- a/src/mame/drivers/taito_x.c +++ b/src/mame/drivers/taito_x.c @@ -319,7 +319,7 @@ Stephh's notes (based on the game M68000 code and some tests) : #include "sound/2610intf.h" #include "sound/2151intf.h" #include "includes/cchip.h" - +#include "video/seta001.h" class taitox_state : public seta_state { @@ -433,7 +433,8 @@ static ADDRESS_MAP_START( superman_map, AS_PROGRAM, 16 ) AM_RANGE(0x900802, 0x900803) AM_READWRITE(cchip1_ctrl_r, cchip1_ctrl_w) AM_RANGE(0x900c00, 0x900c01) AM_WRITE(cchip1_bank_w) AM_RANGE(0xb00000, 0xb00fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE_GENERIC(paletteram) - AM_RANGE(0xd00000, 0xd007ff) AM_RAM AM_BASE_MEMBER(taitox_state, m_spriteram) // Sprites Y + AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE_MEMBER(taitox_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xf00000, 0xf03fff) AM_RAM /* Main RAM */ ADDRESS_MAP_END @@ -447,7 +448,8 @@ static ADDRESS_MAP_START( daisenpu_map, AS_PROGRAM, 16 ) AM_RANGE(0x800002, 0x800003) AM_DEVREADWRITE8("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff) AM_RANGE(0x900000, 0x90000f) AM_READWRITE(daisenpu_input_r, daisenpu_input_w) AM_RANGE(0xb00000, 0xb00fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE_GENERIC(paletteram) - AM_RANGE(0xd00000, 0xd007ff) AM_RAM AM_BASE_MEMBER(taitox_state, m_spriteram) // Sprites Y + AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE_MEMBER(taitox_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xf00000, 0xf03fff) AM_RAM /* Main RAM */ ADDRESS_MAP_END @@ -461,7 +463,8 @@ static ADDRESS_MAP_START( gigandes_map, AS_PROGRAM, 16 ) AM_RANGE(0x800002, 0x800003) AM_DEVREADWRITE8("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff) AM_RANGE(0x900000, 0x90000f) AM_READWRITE(daisenpu_input_r, daisenpu_input_w) AM_RANGE(0xb00000, 0xb00fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE_GENERIC(paletteram) - AM_RANGE(0xd00000, 0xd007ff) AM_RAM AM_BASE_MEMBER(taitox_state, m_spriteram) // Sprites Y + AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE_MEMBER(taitox_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xf00000, 0xf03fff) AM_RAM /* Main RAM */ ADDRESS_MAP_END @@ -475,7 +478,8 @@ static ADDRESS_MAP_START( ballbros_map, AS_PROGRAM, 16 ) AM_RANGE(0x800002, 0x800003) AM_DEVREADWRITE8("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff) AM_RANGE(0x900000, 0x90000f) AM_READWRITE(daisenpu_input_r, daisenpu_input_w) AM_RANGE(0xb00000, 0xb00fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE_GENERIC(paletteram) - AM_RANGE(0xd00000, 0xd007ff) AM_RAM AM_BASE_MEMBER(taitox_state, m_spriteram) // Sprites Y + AM_RANGE(0xd00000, 0xd005ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r16, spriteylow_w16) // Sprites Y + AM_RANGE(0xd00600, 0xd00607) AM_RAM AM_DEVREADWRITE("spritegen", spritectrl_r16, spritectrl_w16) AM_RANGE(0xe00000, 0xe03fff) AM_RAM AM_BASE_MEMBER(taitox_state, m_spriteram2) // Sprites Code + X + Attr AM_RANGE(0xf00000, 0xf03fff) AM_RAM /* Main RAM */ ADDRESS_MAP_END @@ -927,6 +931,8 @@ static MACHINE_CONFIG_START( superman, taitox_state ) MCFG_MACHINE_START(taitox) MCFG_MACHINE_RESET(cchip1) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(57.43) @@ -968,6 +974,8 @@ static MACHINE_CONFIG_START( daisenpu, taitox_state ) MCFG_MACHINE_START(taitox) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -1007,6 +1015,8 @@ static MACHINE_CONFIG_START( gigandes, taitox_state ) MCFG_MACHINE_START(taitox) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -1048,6 +1058,8 @@ static MACHINE_CONFIG_START( ballbros, taitox_state ) MCFG_MACHINE_START(taitox) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) diff --git a/src/mame/drivers/tnzs.c b/src/mame/drivers/tnzs.c index 688ad2bb62f..24431077770 100644 --- a/src/mame/drivers/tnzs.c +++ b/src/mame/drivers/tnzs.c @@ -628,6 +628,7 @@ Driver by Takahiro Nogi (nogi@kt.rim.or.jp) 1999/11/06 #include "sound/samples.h" #include "includes/tnzs.h" #include "sound/2151intf.h" +#include "video/seta001.h" static SAMPLES_START( kageki_init_samples ) { @@ -751,9 +752,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8 ) AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank1") /* ROM + RAM */ AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE_MEMBER(tnzs_state, m_objram) AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1") - AM_RANGE(0xf000, 0xf1ff) AM_RAM AM_BASE_MEMBER(tnzs_state, m_vdcram) - AM_RANGE(0xf200, 0xf2ff) AM_WRITEONLY AM_BASE_MEMBER(tnzs_state, m_scrollram) /* scrolling info */ - AM_RANGE(0xf300, 0xf303) AM_MIRROR(0xfc) AM_WRITEONLY AM_BASE_MEMBER(tnzs_state, m_objctrl) /* control registers (0x80 mirror used by Arkanoid 2) */ + AM_RANGE(0xf000, 0xf2ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r8, spriteylow_w8) + AM_RANGE(0xf300, 0xf303) AM_MIRROR(0xfc) AM_DEVWRITE("spritegen", spritectrl_w8) /* control registers (0x80 mirror used by Arkanoid 2) */ AM_RANGE(0xf400, 0xf400) AM_WRITEONLY AM_BASE_MEMBER(tnzs_state, m_bg_flag) /* enable / disable background transparency */ AM_RANGE(0xf600, 0xf600) AM_READNOP AM_WRITE(tnzs_bankswitch_w) /* arknoid2, extrmatn, plumppop and drtoppel have PROMs instead of RAM */ @@ -767,9 +767,8 @@ static ADDRESS_MAP_START( cpu0_type2, AS_PROGRAM, 8 ) AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank1") /* ROM + RAM */ AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE_MEMBER(tnzs_state, m_objram) AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1") - AM_RANGE(0xf000, 0xf1ff) AM_RAM AM_BASE_MEMBER(tnzs_state, m_vdcram) - AM_RANGE(0xf200, 0xf2ff) AM_WRITEONLY AM_BASE_MEMBER(tnzs_state, m_scrollram) /* scrolling info */ - AM_RANGE(0xf300, 0xf303) AM_MIRROR(0xfc) AM_WRITEONLY AM_BASE_MEMBER(tnzs_state, m_objctrl) /* control registers (0x80 mirror used by Arkanoid 2) */ + AM_RANGE(0xf000, 0xf2ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r8, spriteylow_w8) + AM_RANGE(0xf300, 0xf303) AM_MIRROR(0xfc) AM_DEVWRITE("spritegen", spritectrl_w8) /* control registers (0x80 mirror used by Arkanoid 2) */ AM_RANGE(0xf400, 0xf400) AM_WRITEONLY AM_BASE_MEMBER(tnzs_state, m_bg_flag) /* enable / disable background transparency */ AM_RANGE(0xf600, 0xf600) AM_WRITE(tnzs_bankswitch_w) /* kabukiz still writes here but it's not used (it's paletteram in type1 map) */ @@ -889,9 +888,8 @@ static ADDRESS_MAP_START( jpopnics_main_map, AS_PROGRAM, 8 ) AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0xc000, 0xdfff) AM_RAM AM_BASE_MEMBER(tnzs_state, m_objram) AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("share1") /* WORK RAM (shared by the 2 z80's) */ - AM_RANGE(0xf000, 0xf1ff) AM_RAM AM_BASE_MEMBER(tnzs_state, m_vdcram) /* VDC RAM */ - AM_RANGE(0xf200, 0xf2ff) AM_RAM AM_BASE_MEMBER(tnzs_state, m_scrollram) /* scrolling info */ - AM_RANGE(0xf300, 0xf303) AM_MIRROR(0xfc) AM_WRITEONLY AM_BASE_MEMBER(tnzs_state, m_objctrl) /* control registers (0x80 mirror used by Arkanoid 2) */ + AM_RANGE(0xf000, 0xf2ff) AM_RAM AM_DEVREADWRITE("spritegen", spriteylow_r8, spriteylow_w8) + AM_RANGE(0xf300, 0xf303) AM_MIRROR(0xfc) AM_DEVWRITE("spritegen", spritectrl_w8) /* control registers (0x80 mirror used by Arkanoid 2) */ AM_RANGE(0xf400, 0xf400) AM_WRITEONLY AM_BASE_MEMBER(tnzs_state, m_bg_flag) /* enable / disable background transparency */ AM_RANGE(0xf600, 0xf600) AM_READNOP AM_WRITE(tnzs_bankswitch_w) AM_RANGE(0xf800, 0xffff) AM_RAM_WRITE(jpopnics_palette_w) AM_BASE_GENERIC(paletteram) @@ -1623,6 +1621,8 @@ static MACHINE_CONFIG_START( arknoid2, tnzs_state ) MCFG_MACHINE_START(tnzs) MCFG_MACHINE_RESET(tnzs) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -1663,6 +1663,8 @@ static MACHINE_CONFIG_START( drtoppel, tnzs_state ) MCFG_MACHINE_START(tnzs) MCFG_MACHINE_RESET(tnzs) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -1706,6 +1708,8 @@ static MACHINE_CONFIG_START( tnzs, tnzs_state ) MCFG_MACHINE_START(tnzs) MCFG_MACHINE_RESET(tnzs) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(59.15) /* it should be the same as the newer pcb vsync */ @@ -1745,6 +1749,8 @@ static MACHINE_CONFIG_START( insectx, tnzs_state ) MCFG_MACHINE_START(tnzs) MCFG_MACHINE_RESET(tnzs) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -1783,6 +1789,8 @@ static MACHINE_CONFIG_START( kageki, tnzs_state ) MCFG_MACHINE_START(tnzs) MCFG_MACHINE_RESET(tnzs) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) @@ -1832,6 +1840,8 @@ static MACHINE_CONFIG_START( tnzsb, tnzs_state ) MCFG_MACHINE_START(tnzs) MCFG_MACHINE_RESET(tnzs) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(59.15) /* verified on pcb */ @@ -1894,6 +1904,8 @@ static MACHINE_CONFIG_START( jpopnics, tnzs_state ) MCFG_MACHINE_START(jpopnics) MCFG_MACHINE_RESET(jpopnics) + MCFG_DEVICE_ADD("spritegen", SETA001_SPRITE, 0) + /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) diff --git a/src/mame/includes/seta.h b/src/mame/includes/seta.h index 27ae2b1dd98..dba4bdce150 100644 --- a/src/mame/includes/seta.h +++ b/src/mame/includes/seta.h @@ -37,7 +37,6 @@ public: UINT16 *m_vctrl_0; UINT16 *m_vram_2; UINT16 *m_vctrl_2; - UINT16 *m_spriteram; UINT16 *m_spriteram2; UINT16 *m_paletteram; size_t m_paletteram_size; diff --git a/src/mame/includes/srmp2.h b/src/mame/includes/srmp2.h index d5dc7d68b9a..6ac71be000c 100644 --- a/src/mame/includes/srmp2.h +++ b/src/mame/includes/srmp2.h @@ -26,7 +26,7 @@ public: { UINT8 *u8; UINT16 *u16; - } m_spriteram1, m_spriteram2, m_spriteram3; + } m_spriteram2, m_spriteram3; iox_t m_iox; }; diff --git a/src/mame/includes/tnzs.h b/src/mame/includes/tnzs.h index 81352d2c71c..e640edd0ee3 100644 --- a/src/mame/includes/tnzs.h +++ b/src/mame/includes/tnzs.h @@ -23,9 +23,6 @@ public: /* memory pointers */ UINT8 * m_objram; - UINT8 * m_vdcram; - UINT8 * m_scrollram; - UINT8 * m_objctrl; UINT8 * m_bg_flag; // UINT8 * m_paletteram; // currently this uses generic palette handling diff --git a/src/mame/video/seta.c b/src/mame/video/seta.c index 16dd799f78b..b2fde512238 100644 --- a/src/mame/video/seta.c +++ b/src/mame/video/seta.c @@ -138,7 +138,7 @@ Note: if MAME_DEBUG is defined, pressing Z with: #include "emu.h" #include "sound/x1_010.h" #include "includes/seta.h" - +#include "video/seta001.h" /* note that drgnunit, stg and qzkklogy run on the same board, yet they need different alignment */ static const game_offset game_offsets[] = @@ -752,178 +752,6 @@ static void usclssic_set_pens(running_machine &machine) -/*************************************************************************** - - - Sprites Drawing - - -***************************************************************************/ - - -static void draw_sprites_map(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) -{ - seta_state *state = machine.driver_data(); - UINT16 *spriteram16 = state->m_spriteram; - int offs, col; - int xoffs, yoffs; - - int total_color_codes = machine.config().m_gfxdecodeinfo[0].total_color_codes; - - int ctrl = spriteram16[ 0x600/2 ]; - int ctrl2 = spriteram16[ 0x602/2 ]; - - int flip = ctrl & 0x40; - int numcol = ctrl2 & 0x000f; - - /* Sprites Banking and/or Sprites Buffering */ - UINT16 *src = state->m_spriteram2 + ( ((ctrl2 ^ (~ctrl2<<1)) & 0x40) ? 0x2000/2 : 0 ); - - int upper = ( spriteram16[ 0x604/2 ] & 0xFF ) + - ( spriteram16[ 0x606/2 ] & 0xFF ) * 256; - - int max_y = 0xf0; - - int col0; /* Kludge, needed for krzybowl and kiwame */ - switch (ctrl & 0x0f) - { - case 0x01: col0 = 0x4; break; // krzybowl - case 0x06: col0 = 0x8; break; // kiwame - - default: col0 = 0x0; - } - - xoffs = 0; - yoffs = flip ? 1 : -1; - - /* Number of columns to draw - the value 1 seems special, meaning: - draw every column */ - if (numcol == 1) - numcol = 16; - - - /* The first column is the frontmost, see twineagl test mode - BM 071204 - first column frontmost breaks superman. - */ -// for ( col = numcol - 1 ; col >= 0; col -- ) - for ( col = 0 ; col < numcol; col ++ ) - { - int x = spriteram16[(col * 0x20 + 0x08 + 0x400)/2] & 0xff; - int y = spriteram16[(col * 0x20 + 0x00 + 0x400)/2] & 0xff; - - /* draw this column */ - for ( offs = 0 ; offs < 0x40/2; offs += 2/2 ) - { - int code = src[((col+col0)&0xf) * 0x40/2 + offs + 0x800/2]; - int color = src[((col+col0)&0xf) * 0x40/2 + offs + 0xc00/2]; - - int flipx = code & 0x8000; - int flipy = code & 0x4000; - - int bank = (color & 0x0600) >> 9; - -/* -twineagl: 010 02d 0f 10 (ship) -tndrcade: 058 02d 07 18 (start of game - yes, flip on!) -arbalest: 018 02d 0f 10 (logo) -metafox : 018 021 0f f0 (bomb) -zingzip : 010 02c 00 0f (bomb) -wrofaero: 010 021 00 ff (test mode) -thunderl: 010 06c 00 ff (always?) -krzybowl: 011 028 c0 ff (game) -kiwame : 016 021 7f 00 (logo) -oisipuzl: 059 020 00 00 (game - yes, flip on!) - -superman: 010 021 07 38 (game) -twineagl: 000 027 00 0f (test mode) -*/ - - int sx = x + xoffs + (offs & 1) * 16; - int sy = -(y + yoffs) + (offs / 2) * 16; - - if (upper & (1 << col)) sx += 256; - - if (flip) - { - sy = max_y - sy; - flipx = !flipx; - flipy = !flipy; - } - - color = ( color >> (16-5) ) % total_color_codes; - code = (code & 0x3fff) + (bank * 0x4000); - - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], - code, - color, - flipx, flipy, - ((sx + 0x10) & 0x1ff) - 0x10,((sy + 8) & 0x0ff) - 8,0); - } - /* next column */ - } - -} - - - -static void draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) -{ - seta_state *state = machine.driver_data(); - UINT16 *spriteram16 = state->m_spriteram; - int offs; - int xoffs, yoffs; - - int total_color_codes = machine.config().m_gfxdecodeinfo[0].total_color_codes; - - int ctrl = spriteram16[ 0x600/2 ]; - int ctrl2 = spriteram16[ 0x602/2 ]; - - int flip = ctrl & 0x40; - - /* Sprites Banking and/or Sprites Buffering */ - UINT16 *src = state->m_spriteram2 + ( ((ctrl2 ^ (~ctrl2<<1)) & 0x40) ? 0x2000/2 : 0 ); - - int max_y = 0xf0; - - - draw_sprites_map(machine,bitmap,cliprect); - - - xoffs = state->m_global_offsets->sprite_offs[flip ? 1 : 0]; - yoffs = -2; - - for ( offs = (0x400-2)/2 ; offs >= 0/2; offs -= 2/2 ) - { - int code = src[offs + 0x000/2]; - int x = src[offs + 0x400/2]; - - int y = spriteram16[offs + 0x000/2] & 0xff; - - int flipx = code & 0x8000; - int flipy = code & 0x4000; - - int bank = (x & 0x0600) >> 9; - int color = ( x >> (16-5) ) % total_color_codes; - - if (flip) - { - y = (0x100 - machine.primary_screen->height()) + max_y - y; - flipx = !flipx; - flipy = !flipy; - } - - code = (code & 0x3fff) + (bank * 0x4000); - - y = max_y - y; - - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], - code, - color, - flipx, flipy, - ((x + xoffs + 0x10) & 0x1ff) - 0x10,((y - yoffs + 8) & 0x0ff) - 8,0); - } - -} static void draw_tilemap_palette_effect(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, tilemap_t *tilemap, int scrollx, int scrolly, int gfxnum, int flipscreen) { @@ -984,9 +812,10 @@ static void draw_tilemap_palette_effect(running_machine &machine, bitmap_t *bitm /* For games without tilemaps */ SCREEN_UPDATE( seta_no_layers ) { + seta_state *state = screen->machine().driver_data(); set_pens(screen->machine()); bitmap_fill(bitmap,cliprect,0x1f0); - draw_sprites(screen->machine(),bitmap,cliprect); + screen->machine().device("spritegen")->setac_draw_sprites(screen->machine(),bitmap,cliprect, state->m_spriteram2, state->m_global_offsets->sprite_offs[1], state->m_global_offsets->sprite_offs[0]); return 0; } @@ -999,7 +828,7 @@ static SCREEN_UPDATE( seta_layers ) int enab_0, enab_1, x_0, x_1=0, y_0, y_1=0; int order = 0; - int flip = (state->m_spriteram[ 0x600/2 ] & 0x40) >> 6; + int flip = 0;//reenable (state->m_spriteram[ 0x600/2 ] & 0x40) >> 6; const rectangle &visarea = screen->visible_area(); int vis_dimy = visarea.max_y - visarea.min_y + 1; @@ -1109,7 +938,7 @@ if (input_code_pressed(screen->machine(), KEYCODE_Z)) if (order & 2) // layer-sprite priority? { - if (layers_ctrl & 8) draw_sprites(screen->machine(),bitmap,cliprect); + if (layers_ctrl & 8) screen->machine().device("spritegen")->setac_draw_sprites(screen->machine(),bitmap,cliprect, state->m_spriteram2, state->m_global_offsets->sprite_offs[1], state->m_global_offsets->sprite_offs[0]); if(order & 4) { @@ -1129,7 +958,7 @@ if (input_code_pressed(screen->machine(), KEYCODE_Z)) if (layers_ctrl & 1) tilemap_draw(bitmap, cliprect, state->m_tilemap_0, 0, 0); if (layers_ctrl & 1) tilemap_draw(bitmap, cliprect, state->m_tilemap_1, 0, 0); - if (layers_ctrl & 8) draw_sprites(screen->machine(), bitmap,cliprect); + if (layers_ctrl & 8) screen->machine().device("spritegen")->setac_draw_sprites(screen->machine(), bitmap,cliprect, state->m_spriteram2, state->m_global_offsets->sprite_offs[1], state->m_global_offsets->sprite_offs[0]); } } else @@ -1139,7 +968,7 @@ if (input_code_pressed(screen->machine(), KEYCODE_Z)) if (order & 2) // layer-sprite priority? { - if (layers_ctrl & 8) draw_sprites(screen->machine(), bitmap,cliprect); + if (layers_ctrl & 8) screen->machine().device("spritegen")->setac_draw_sprites(screen->machine(), bitmap,cliprect, state->m_spriteram2, state->m_global_offsets->sprite_offs[1], state->m_global_offsets->sprite_offs[0]); if((order & 4) && state->m_paletteram2 != NULL) { @@ -1193,7 +1022,7 @@ if (input_code_pressed(screen->machine(), KEYCODE_Z)) } } - if (layers_ctrl & 8) draw_sprites(screen->machine(), bitmap,cliprect); + if (layers_ctrl & 8) screen->machine().device("spritegen")->setac_draw_sprites(screen->machine(), bitmap,cliprect, state->m_spriteram2, state->m_global_offsets->sprite_offs[1], state->m_global_offsets->sprite_offs[0]); } } return 0; diff --git a/src/mame/video/seta001.c b/src/mame/video/seta001.c new file mode 100644 index 00000000000..6f770bd4967 --- /dev/null +++ b/src/mame/video/seta001.c @@ -0,0 +1,864 @@ + /* + emulation of Seta sprite chips + X1-001A X1-002A (SDIP64) + + these always seem to be used as a pair, some board have been seen without the + 'A', so it's probably a chip revision / bugfix. + + used by: + + seta.c + taito_x.c + tnzs.c + srmp2.c + champbwl.c + cchance.c + + note: the data bus is almost certainly 8-bit, dating back to the earliest + hardware the games were used on. the RAM arrangements changes + slightly between games depending on how the RAM is hooked up to the + main cpu. + + + todo: unify implementation, there are currently 5 different ones when there should only be one! + + + 'y' low bits are NEVER buffered? + + */ + +#include "emu.h" +#include "seta001.h" + + +const device_type SETA001_SPRITE = &device_creator; + +seta001_device::seta001_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, SETA001_SPRITE, "seta001_device", tag, owner, clock) +{ +} + +void seta001_device::device_start() +{ + +} + +void seta001_device::device_reset() +{ + +} + +READ16_DEVICE_HANDLER( spritectrl_r16 ) +{ + seta001_device *dev = (seta001_device *)device; + return dev->m_spritectrl[offset]; +} + +WRITE16_DEVICE_HANDLER( spritectrl_w16 ) +{ + seta001_device *dev = (seta001_device *)device; + + if (ACCESSING_BITS_0_7) + { + dev->m_spritectrl[offset] = data; + } +} + +READ8_DEVICE_HANDLER( spritectrl_r8 ) +{ + seta001_device *dev = (seta001_device *)device; + return dev->m_spritectrl[offset]; +} + +WRITE8_DEVICE_HANDLER( spritectrl_w8 ) +{ + seta001_device *dev = (seta001_device *)device; + dev->m_spritectrl[offset] = data; +} + +WRITE8_DEVICE_HANDLER( spritectrl_w8_champbwl ) +{ + seta001_device *dev = (seta001_device *)device; + + // hack?? + if (offset!=0) data ^=0xff; + + dev->m_spritectrl[offset] = data; +} + +READ16_DEVICE_HANDLER( spriteylow_r16 ) +{ + seta001_device *dev = (seta001_device *)device; + return dev->m_spriteylow[offset]; +} + +WRITE16_DEVICE_HANDLER( spriteylow_w16 ) +{ + seta001_device *dev = (seta001_device *)device; + + if (ACCESSING_BITS_0_7) + { + dev->m_spriteylow[offset] = data; + } +} + +READ8_DEVICE_HANDLER( spriteylow_r8 ) +{ + seta001_device *dev = (seta001_device *)device; + return dev->m_spriteylow[offset]; +} + +WRITE8_DEVICE_HANDLER( spriteylow_w8 ) +{ + seta001_device *dev = (seta001_device *)device; + dev->m_spriteylow[offset] = data; +} + + +/*************************************************************************** + + + Sprites Drawing + + +***************************************************************************/ + + +void seta001_device::setac_draw_sprites_map(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram16_2) +{ + int offs, col; + int xoffs, yoffs; + + int total_color_codes = machine.config().m_gfxdecodeinfo[0].total_color_codes; + + int ctrl = m_spritectrl[0]; + int ctrl2 = m_spritectrl[1]; + + int flip = ctrl & 0x40; + int numcol = ctrl2 & 0x000f; + + /* Sprites Banking and/or Sprites Buffering */ + UINT16 *src = spriteram16_2 + ( ((ctrl2 ^ (~ctrl2<<1)) & 0x40) ? 0x2000/2 : 0 ); + + int upper = ( m_spritectrl[2] ) + + ( m_spritectrl[3] ) * 256; + + int max_y = 0xf0; + + int col0; /* Kludge, needed for krzybowl and kiwame */ + switch (ctrl & 0x0f) + { + case 0x01: col0 = 0x4; break; // krzybowl + case 0x06: col0 = 0x8; break; // kiwame + + default: col0 = 0x0; + } + + xoffs = 0; + yoffs = flip ? 1 : -1; + + /* Number of columns to draw - the value 1 seems special, meaning: + draw every column */ + if (numcol == 1) + numcol = 16; + + + /* The first column is the frontmost, see twineagl test mode + BM 071204 - first column frontmost breaks superman. + */ +// for ( col = numcol - 1 ; col >= 0; col -- ) + for ( col = 0 ; col < numcol; col ++ ) + { + int x = m_spriteylow[(col * 0x20 + 0x08 + 0x400)/2] & 0xff; + int y = m_spriteylow[(col * 0x20 + 0x00 + 0x400)/2] & 0xff; + + /* draw this column */ + for ( offs = 0 ; offs < 0x40/2; offs += 2/2 ) + { + int code = src[((col+col0)&0xf) * 0x40/2 + offs + 0x800/2]; + int color = src[((col+col0)&0xf) * 0x40/2 + offs + 0xc00/2]; + + int flipx = code & 0x8000; + int flipy = code & 0x4000; + + int bank = (color & 0x0600) >> 9; + +/* +twineagl: 010 02d 0f 10 (ship) +tndrcade: 058 02d 07 18 (start of game - yes, flip on!) +arbalest: 018 02d 0f 10 (logo) +metafox : 018 021 0f f0 (bomb) +zingzip : 010 02c 00 0f (bomb) +wrofaero: 010 021 00 ff (test mode) +thunderl: 010 06c 00 ff (always?) +krzybowl: 011 028 c0 ff (game) +kiwame : 016 021 7f 00 (logo) +oisipuzl: 059 020 00 00 (game - yes, flip on!) + +superman: 010 021 07 38 (game) +twineagl: 000 027 00 0f (test mode) +*/ + + int sx = x + xoffs + (offs & 1) * 16; + int sy = -(y + yoffs) + (offs / 2) * 16; + + if (upper & (1 << col)) sx += 256; + + if (flip) + { + sy = max_y - sy; + flipx = !flipx; + flipy = !flipy; + } + + color = ( color >> (16-5) ) % total_color_codes; + code = (code & 0x3fff) + (bank * 0x4000); + + drawgfx_transpen(bitmap,cliprect,machine.gfx[0], + code, + color, + flipx, flipy, + ((sx + 0x10) & 0x1ff) - 0x10,((sy + 8) & 0x0ff) - 8,0); + } + /* next column */ + } + +} + + + +void seta001_device::setac_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram16_2, int flipxoffs, int noflipxoffs) +{ + int offs; + int xoffs, yoffs; + + int total_color_codes = machine.config().m_gfxdecodeinfo[0].total_color_codes; + + int ctrl = m_spritectrl[0]; + int ctrl2 = m_spritectrl[1]; + + int flip = ctrl & 0x40; + + /* Sprites Banking and/or Sprites Buffering */ + UINT16 *src = spriteram16_2 + ( ((ctrl2 ^ (~ctrl2<<1)) & 0x40) ? 0x2000/2 : 0 ); + + int max_y = 0xf0; + + + setac_draw_sprites_map(machine,bitmap,cliprect, spriteram16_2); + + xoffs = flip ? flipxoffs:noflipxoffs; + yoffs = -2; + + for ( offs = (0x400-2)/2 ; offs >= 0/2; offs -= 2/2 ) + { + int code = src[offs + 0x000/2]; + int x = src[offs + 0x400/2]; + + int y = m_spriteylow[offs + 0x000/2] & 0xff; + + int flipx = code & 0x8000; + int flipy = code & 0x4000; + + int bank = (x & 0x0600) >> 9; + int color = ( x >> (16-5) ) % total_color_codes; + + if (flip) + { + y = (0x100 - machine.primary_screen->height()) + max_y - y; + flipx = !flipx; + flipy = !flipy; + } + + code = (code & 0x3fff) + (bank * 0x4000); + + y = max_y - y; + + drawgfx_transpen(bitmap,cliprect,machine.gfx[0], + code, + color, + flipx, flipy, + ((x + xoffs + 0x10) & 0x1ff) - 0x10,((y - yoffs + 8) & 0x0ff) - 8,0); + } + +} + + + + +void seta001_device::tnzs_draw_background( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *m, UINT8* scrollram, UINT8* bg_flag, int screenflip) +{ + int x, y, column, tot, transpen; + int scrollx, scrolly; + UINT32 upperbits; + int ctrl2 = m_spritectrl[1]; + + + if ((ctrl2 ^ (~ctrl2 << 1)) & 0x40) + m += 0x800; + + if (bg_flag[0] & 0x80) + transpen = -1; + else + transpen = 0; + + + /* The byte at f200 is the y-scroll value for the first column. + The byte at f204 is the LSB of x-scroll value for the first column. + + The other columns follow at 16-byte intervals. + + The 9th bit of each x-scroll value is combined into 2 bytes + at f302-f303 */ + + /* f301 controls how many columns are drawn. */ + tot = m_spritectrl[1] & 0x1f; + if (tot == 1) + tot = 16; + + upperbits = m_spritectrl[2] + m_spritectrl[3] * 256; + + for (column = 0; column < tot; column++) + { + scrollx = scrollram[column * 16 + 4] - ((upperbits & 0x01) * 256); + if (screenflip) + scrolly = scrollram[column * 16] + 1 - 256; + else + scrolly = -scrollram[column * 16] + 1; + + for (y = 0; y < 16; y++) + { + for (x = 0; x < 2; x++) + { + int code, color, flipx, flipy, sx, sy; + int i = 32 * (column ^ 8) + 2 * y + x; + + code = m[i] + ((m[i + 0x1000] & 0x3f) << 8); + color = (m[i + 0x1200] & 0xf8) >> 3; /* colours at d600-d7ff */ + sx = x * 16; + sy = y * 16; + flipx = m[i + 0x1000] & 0x80; + flipy = m[i + 0x1000] & 0x40; + if (screenflip) + { + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + drawgfx_transpen(bitmap,cliprect,machine.gfx[0], + code, + color, + flipx,flipy, + sx + scrollx,(sy + scrolly) & 0xff, + transpen); + + /* wrap around x */ + drawgfx_transpen(bitmap,cliprect,machine.gfx[0], + code, + color, + flipx,flipy, + sx + 512 + scrollx,(sy + scrolly) & 0xff, + transpen); + } + } + + upperbits >>= 1; + } +} + +void seta001_device::setac_eof( UINT16* spriteram2) +{ + int ctrl2 = m_spritectrl[1]; + + if (~ctrl2 & 0x20) + { + if (ctrl2 & 0x40) + memcpy(&spriteram2[0x0000/2],&spriteram2[0x2000/2],0x2000/2); + else + memcpy(&spriteram2[0x2000/2],&spriteram2[0x0000/2],0x2000/2); + } +} + +void seta001_device::tnzs_draw_foreground( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, + UINT8 *char_pointer, UINT8 *x_pointer, UINT8 *y_pointer, UINT8 *ctrl_pointer, UINT8 *color_pointer, int screenflip) +{ + int i; + int ctrl2 = m_spritectrl[1]; + + + if ((ctrl2 ^ (~ctrl2 << 1)) & 0x40) + { + char_pointer += 0x800; + x_pointer += 0x800; + ctrl_pointer += 0x800; + color_pointer += 0x800; + } + + + /* Draw all 512 sprites */ + for (i = 0x1ff; i >= 0; i--) + { + int code, color, sx, sy, flipx, flipy; + + code = char_pointer[i] + ((ctrl_pointer[i] & 0x3f) << 8); + color = (color_pointer[i] & 0xf8) >> 3; + sx = x_pointer[i] - ((color_pointer[i] & 1) << 8); + sy = 240 - y_pointer[i]; + flipx = ctrl_pointer[i] & 0x80; + flipy = ctrl_pointer[i] & 0x40; + if (screenflip) + { + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + /* hack to hide Chuka Taisens grey line, top left corner */ + if ((sy == 0) && (code == 0)) sy += 240; + } + + drawgfx_transpen(bitmap,cliprect,machine.gfx[0], + code, + color, + flipx,flipy, + sx,sy+2,0); + + /* wrap around x */ + drawgfx_transpen(bitmap,cliprect,machine.gfx[0], + code, + color, + flipx,flipy, + sx + 512,sy+2,0); + } +} + +void seta001_device::tnzs_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8* objram, UINT8* bg_flag ) +{ + /* Fill the background */ + bitmap_fill(bitmap, cliprect, 0x1f0); + + /* If the byte at f300 has bit 6 set, flip the screen + (I'm not 100% sure about this) */ + int screenflip = (m_spritectrl[0] & 0x40) >> 6; + + /* Redraw the background tiles (c400-c5ff) */ + tnzs_draw_background(machine, bitmap, cliprect, objram + 0x400, m_spriteylow+0x200, bg_flag, screenflip); + + /* Draw the sprites on top */ + tnzs_draw_foreground(machine, bitmap, cliprect, + objram + 0x0000, /* chars : c000 */ + objram + 0x0200, /* x : c200 */ + m_spriteylow, /* y : f000 */ + objram + 0x1000, /* ctrl : d000 */ + objram + 0x1200, /* color : d200 */ + screenflip); +} + +void seta001_device::tnzs_eof( UINT8* objram) +{ + int ctrl2 = m_spritectrl[1]; + if (~ctrl2 & 0x20) + { + // note I copy sprites only. setac implementation also copies the "floating tilemap" + if (ctrl2 & 0x40) + { + memcpy(&objram[0x0000], &objram[0x0800], 0x0400); + memcpy(&objram[0x1000], &objram[0x1800], 0x0400); + } + else + { + memcpy(&objram[0x0800], &objram[0x0000], 0x0400); + memcpy(&objram[0x1800], &objram[0x1000], 0x0400); + } + + // and I copy the "floating tilemap" BACKWARDS - this fixes kabukiz + memcpy(&objram[0x0400], &objram[0x0c00], 0x0400); + memcpy(&objram[0x1400], &objram[0x1c00], 0x0400); + } + +} + + + +// no bgmap stuff? +void seta001_device::srmp2_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram16_2, int color_bank) +{ +/* + Sprite RAM A: spriteram16_2 + ============== + + 0x000 - 0x3ff + x--- ---- ---- ---- : Flip X + -x-- ---- ---- ---- : Flip Y + --xx xxxx xxxx xxxx : Tile number + + + 0x400 - 0x7ff + xxxx x--- ---- ---- : Color + ---- ---x xxxx xxxx : X coords + + Sprite RAM B: spriteram16 + ============== + + 0x000 - 0x3ff + ---- ---- xxxx xxxx : Y coords + + + 0x600 + ---- ---- -x-- ---- : Flip screen +*/ + + int offs; + int xoffs, yoffs; + + int ctrl = m_spritectrl[ 0 ]; + int ctrl2 = m_spritectrl[ 1 ]; + + int flip = ctrl & 0x40; + + /* Sprites Banking and/or Sprites Buffering */ + UINT16 *src = spriteram16_2 + ( ((ctrl2 ^ (~ctrl2<<1)) & 0x40) ? 0x2000/2 : 0 ); + + int max_y = machine.primary_screen->height(); + + xoffs = flip ? 0x10 : 0x10; + yoffs = flip ? 0x05 : 0x07; + + for (offs = (0x400-2)/2; offs >= 0/2; offs -= 2/2) + { + int code = src[offs + 0x000/2]; + + int x = src[offs + 0x400/2]; + int y = m_spriteylow[offs + 0x000/2] & 0xff; + + int flipx = code & 0x8000; + int flipy = code & 0x4000; + + int color = (x >> 11) & 0x1f; + + if (flip) + { + y = max_y - y; + flipx = !flipx; + flipy = !flipy; + } + + code = code & 0x3fff; + + if (color_bank) color |= 0x20; + + drawgfx_transpen(bitmap, cliprect, machine.gfx[0], + code, + color, + flipx, flipy, + (x + xoffs) & 0x1ff, + max_y - ((y + yoffs) & 0x0ff), 15); + } +} + + +void seta001_device::srmp3_draw_sprites_map(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8* spriteram_2, UINT8* spriteram_3) +{ + int offs, col; + int xoffs, yoffs; + + int ctrl = m_spritectrl[ 0 ]; + int ctrl2 = m_spritectrl[ 1 ]; + + int flip = ctrl & 0x40; + int numcol = ctrl2 & 0x0f; + + int upper = ( m_spritectrl[ 2 ] ) + + ( m_spritectrl[ 3 ] ) * 256; + + int max_y = 0xf0; + + xoffs = flip ? 0x10 : 0x10; + yoffs = flip ? -0x01 : -0x01; + + /* Number of columns to draw - the value 1 seems special, meaning: + draw every column */ + if (numcol == 1) numcol = 16; + + /* The first column is the frontmost, see twineagl test mode */ + for (col = numcol - 1; col >= 0; col--) + { + int x = m_spriteylow[(col * 0x20 + 0x08 + 0x400)/2] & 0xff; + int y = m_spriteylow[(col * 0x20 + 0x00 + 0x400)/2] & 0xff; + + /* draw this column */ + for (offs = 0; offs < 0x40/2; offs += 2/2) + { + int code = (((spriteram_3[((col)&0x0f) * 0x40/2 + offs + 0x800/2] & 0xff) << 8) + (spriteram_2[((col)&0xf) * 0x40/2 + offs + 0x800/2] & 0xff)); + + int color = ((spriteram_3[((col)&0x0f) * 0x40/2 + offs + 0xc00/2] & 0xf8) >> 3); + + int flipx = code & 0x8000; + int flipy = code & 0x4000; + + int sx = x + xoffs + (offs & 1) * 16; + int sy = -(y + yoffs) + (offs / 2) * 16 - + (machine.primary_screen->height() - (machine.primary_screen->visible_area().max_y + 1)); + + if (upper & (1 << col)) sx += 256; + + if (flip) + { + sy = max_y - 14 - sy - 0x100; + flipx = !flipx; + flipy = !flipy; + } + + code = code & 0x1fff; + +#define DRAWTILE(_x_, _y_) \ + drawgfx_transpen(bitmap, \ + cliprect, machine.gfx[0], \ + code, \ + color, \ + flipx, flipy, \ + _x_, _y_, 0); + + DRAWTILE(sx - 0x000, sy + 0x000) + DRAWTILE(sx - 0x200, sy + 0x000) + DRAWTILE(sx - 0x000, sy + 0x100) + DRAWTILE(sx - 0x200, sy + 0x100) + + } + /* next column */ + } +} + + +void seta001_device::srmp3_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8* spriteram_2, UINT8* spriteram_3, int gfx_bank) +{ +/* + Sprite RAM A: spriteram_2 + ============== + + 0x000 - 0x1ff + xxxx xxxx : Tile number (low) + + + 0x200 - 0x3ff + xxxx xxxx : X coords (low) + + + Sprite RAM B: spriteram_3 + ============== + + 0x000 - 0x1ff + x--- ---- : Flip X ? + -x-- ---- : Flip Y ? + --x- ---- : Use GFX bank flag + ---x xxxx : Tile number (high) + + + 0x200 - 0x3ff + xxxx x--- : Color + ---- ---x : X coords (high) + + + Sprite RAM C: spriteram + ============== + + 0x000 - 0x1ff + xxxx xxxx : Y coords (low) + + + 0x300 + -x-- ---- : Flip screen +*/ + + int offs; + int xoffs, yoffs; + + int max_y = machine.primary_screen->height(); + + int ctrl = m_spritectrl[ 0 ]; + //int ctrl2 = m_spritectrl[ 1 ]; + + int flip = ctrl & 0x40; + + srmp3_draw_sprites_map(machine, bitmap, cliprect, spriteram_2, spriteram_3); + + xoffs = flip ? 0x10 : 0x10; + yoffs = flip ? 0x06 : 0x06; + + for (offs = 0x200 - 1; offs >= 0; offs--) + { + int code = (((spriteram_3[offs + 0x000] & 0xff) << 8) + (spriteram_2[offs + 0x000] & 0xff)); + int gfxbank = (spriteram_3[offs + 0x000] & 0x20); + + int color = ((spriteram_3[offs + 0x200] & 0xf8) >> 3); + + int x = (((spriteram_3[offs + 0x200] & 0x01) << 8) + (spriteram_2[offs + 0x200] & 0xff)); + int y = (m_spriteylow[offs + 0x000] & 0xff); + + int flipx = code & 0x8000; + int flipy = code & 0x4000; + + code = (code & 0x1fff); + if (gfxbank) code += ((gfx_bank + 1) * 0x2000); + + if (flip) + { + y = max_y - y; + flipx = !flipx; + flipy = !flipy; + } + + drawgfx_transpen(bitmap,cliprect, machine.gfx[0], + code, + color, + flipx, flipy, + (x + xoffs) & 0x1ff, + max_y - ((y + yoffs) & 0x0ff), 0); + } +} + + +void seta001_device::mjyuugi_draw_sprites_map(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram16_2) +{ + int offs, col; + int xoffs, yoffs; + + int total_color_codes = machine.config().m_gfxdecodeinfo[0].total_color_codes; + + int ctrl = m_spritectrl[ 0 ]; + int ctrl2 = m_spritectrl[ 1 ]; + + int flip = ctrl & 0x40; + int numcol = ctrl2 & 0x000f; + + /* Sprites Banking and/or Sprites Buffering */ + UINT16 *src = spriteram16_2 + ( ((ctrl2 ^ (~ctrl2<<1)) & 0x40) ? 0x2000/2 : 0 ); + + int upper = ( m_spritectrl[2] ) + + ( m_spritectrl[3] ) * 256; + + int max_y = 0xf0; + + xoffs = flip ? 0x10 : 0x10; + yoffs = flip ? 0x09 : 0x07; + + /* Number of columns to draw - the value 1 seems special, meaning: + draw every column */ + if (numcol == 1) numcol = 16; + + /* The first column is the frontmost, see twineagl test mode */ + for (col = numcol - 1; col >= 0; col--) + { + int x = m_spriteylow[(col * 0x20 + 0x08 + 0x400)/2] & 0xff; + int y = m_spriteylow[(col * 0x20 + 0x00 + 0x400)/2] & 0xff; + + /* draw this column */ + for (offs = 0; offs < 0x40/2; offs += 2/2) + { + int code = src[((col)&0xf) * 0x40/2 + offs + 0x800/2]; + int color = src[((col)&0xf) * 0x40/2 + offs + 0xc00/2]; + + int gfxbank = color & 0x0200; + + int flipx = code & 0x8000; + int flipy = code & 0x4000; + + int sx = x + xoffs + (offs & 1) * 16; + int sy = -(y + yoffs) + (offs / 2) * 16 - + (machine.primary_screen->height() - (machine.primary_screen->visible_area().max_y + 1)); + + if (upper & (1 << col)) sx += 256; + + if (flip) + { + sy = max_y - 16 - sy - 0x100; + flipx = !flipx; + flipy = !flipy; + } + + color = ((color >> (16-5)) % total_color_codes); + code = (code & 0x3fff) + (gfxbank ? 0x4000 : 0); + +#define DRAWTILE(_x_, _y_) \ + drawgfx_transpen(bitmap, \ + cliprect, machine.gfx[0], \ + code, \ + color, \ + flipx, flipy, \ + _x_, _y_, 0); + + DRAWTILE(sx - 0x000, sy + 0x000) + DRAWTILE(sx - 0x200, sy + 0x000) + DRAWTILE(sx - 0x000, sy + 0x100) + DRAWTILE(sx - 0x200, sy + 0x100) + + } + /* next column */ + } +} + + +void seta001_device::mjyuugi_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram16_2, int gfx_bank) +{ +/* + Sprite RAM A: spriteram16_2 + ============== + + 0x000 - 0x3ff + x--- ---- ---- ---- : Flip X + -x-- ---- ---- ---- : Flip Y + --x- ---- ---- ---- : Use GFX bank flag + ---x xxxx xxxx xxxx : Tile number + + + 0x400 - 0x7ff + xxxx x--- ---- ---- : Color + ---- ---x xxxx xxxx : X coords + + Sprite RAM B: spriteram16 + ============== + + 0x000 - 0x3ff + ---- ---- xxxx xxxx : Y coords + + + 0x600 + ---- ---- -x-- ---- : Flip screen +*/ + + int offs; + int xoffs, yoffs; + + int ctrl = m_spritectrl[ 0 ]; + int ctrl2 = m_spritectrl[ 1 ]; + + int flip = ctrl & 0x40; + + /* Sprites Banking and/or Sprites Buffering */ + UINT16 *src = spriteram16_2 + ( ((ctrl2 ^ (~ctrl2<<1)) & 0x40) ? 0x2000/2 : 0 ); + + int max_y = machine.primary_screen->height(); + + mjyuugi_draw_sprites_map(machine, bitmap, cliprect, spriteram16_2); + + xoffs = flip ? 0x10 : 0x10; + yoffs = flip ? 0x06 : 0x06; + + for (offs = (0x400 - 6) / 2; offs >= 0 / 2; offs -= 2 / 2) + { + int code = src[offs + 0x000 / 2]; + int gfxbank = code & 0x2000; + + int color = ((src[offs + 0x400 / 2] >> 11) & 0x1f); + + int x = (src[offs + 0x400 / 2] & 0x1ff); + int y = (m_spriteylow[offs + 0x000 / 2] & 0xff); + + int flipx = code & 0x8000; + int flipy = code & 0x4000; + + code = (code & 0x1fff); + if (gfxbank) code += ((gfx_bank + 1) * 0x2000); + + if (flip) + { + y = max_y - y + +(machine.primary_screen->height() - (machine.primary_screen->visible_area().max_y + 1)); + flipx = !flipx; + flipy = !flipy; + } + + drawgfx_transpen(bitmap,cliprect, machine.gfx[0], + code, + color, + flipx, flipy, + (x + xoffs) & 0x1ff, + max_y - ((y + yoffs) & 0x0ff), 0); + } +} + diff --git a/src/mame/video/seta001.h b/src/mame/video/seta001.h new file mode 100644 index 00000000000..5e1fc2f7846 --- /dev/null +++ b/src/mame/video/seta001.h @@ -0,0 +1,57 @@ + + +class seta001_device : public device_t +{ +public: + seta001_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + void setac_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram16_2, int flipxoffs, int noflipxoffs); + void setac_eof( UINT16* spriteram2); + + void tnzs_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8* objram, UINT8* bg_flag ); + void tnzs_eof( UINT8* objram); + + void srmp2_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram16_2, int color_bank); + + void srmp3_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8* spriteram_2, UINT8* spriteram_3, int gfx_bank); + + void mjyuugi_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram16_2, int gfx_bank); + + UINT8 m_spritectrl[4]; + UINT8 m_spriteylow[0x300]; // 0x200 low y + 0x100 bg stuff + +protected: + virtual void device_start(); + virtual void device_reset(); + private: + +private: + + void setac_draw_sprites_map(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram16_2); + + void tnzs_draw_foreground( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *char_pointer, UINT8 *x_pointer, UINT8 *y_pointer, UINT8 *ctrl_pointer, UINT8 *color_pointer, int screenflip); + void tnzs_draw_background( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *m, UINT8* scrollram, UINT8* bg_flag, int screenflip); + + void srmp3_draw_sprites_map(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8* spriteram_2, UINT8* spriteram_3); + + void mjyuugi_draw_sprites_map(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram16_2); +}; + +READ16_DEVICE_HANDLER( spritectrl_r16 ); +WRITE16_DEVICE_HANDLER( spritectrl_w16 ); +READ8_DEVICE_HANDLER( spritectrl_r8 ); +WRITE8_DEVICE_HANDLER( spritectrl_w8 ); +WRITE8_DEVICE_HANDLER( spritectrl_w8_champbwl ); + +READ16_DEVICE_HANDLER( spriteylow_r16 ); +WRITE16_DEVICE_HANDLER( spriteylow_w16 ); +READ8_DEVICE_HANDLER( spriteylow_r8 ); +WRITE8_DEVICE_HANDLER( spriteylow_w8 ); + +extern const device_type SETA001_SPRITE; + + + + + + diff --git a/src/mame/video/srmp2.c b/src/mame/video/srmp2.c index 0bca6ed037c..7ac6105b2d5 100644 --- a/src/mame/video/srmp2.c +++ b/src/mame/video/srmp2.c @@ -2,13 +2,12 @@ Functions to emulate the video hardware of the machine. - Video hardware is very similar with "seta" hardware except color PROM. - ***************************************************************************/ #include "emu.h" #include "includes/srmp2.h" +#include "video/seta001.h" PALETTE_INIT( srmp2 ) { @@ -38,426 +37,26 @@ PALETTE_INIT( srmp3 ) } -static void srmp2_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) -{ -/* - Sprite RAM A: spriteram16_2 - ============== - + 0x000 - 0x3ff - x--- ---- ---- ---- : Flip X - -x-- ---- ---- ---- : Flip Y - --xx xxxx xxxx xxxx : Tile number - - + 0x400 - 0x7ff - xxxx x--- ---- ---- : Color - ---- ---x xxxx xxxx : X coords - - Sprite RAM B: spriteram16 - ============== - + 0x000 - 0x3ff - ---- ---- xxxx xxxx : Y coords - - + 0x600 - ---- ---- -x-- ---- : Flip screen -*/ - - srmp2_state *state = machine.driver_data(); - UINT16 *spriteram16 = state->m_spriteram1.u16; - UINT16 *spriteram16_2 = state->m_spriteram2.u16; - int offs; - int xoffs, yoffs; - - int ctrl = spriteram16[ 0x600/2 ]; - int ctrl2 = spriteram16[ 0x602/2 ]; - - int flip = ctrl & 0x40; - - /* Sprites Banking and/or Sprites Buffering */ - UINT16 *src = spriteram16_2 + ( ((ctrl2 ^ (~ctrl2<<1)) & 0x40) ? 0x2000/2 : 0 ); - - int max_y = machine.primary_screen->height(); - - xoffs = flip ? 0x10 : 0x10; - yoffs = flip ? 0x05 : 0x07; - - for (offs = (0x400-2)/2; offs >= 0/2; offs -= 2/2) - { - int code = src[offs + 0x000/2]; - - int x = src[offs + 0x400/2]; - int y = spriteram16[offs + 0x000/2] & 0xff; - - int flipx = code & 0x8000; - int flipy = code & 0x4000; - - int color = (x >> 11) & 0x1f; - - if (flip) - { - y = max_y - y; - flipx = !flipx; - flipy = !flipy; - } - - code = code & 0x3fff; - - if (state->m_color_bank) color |= 0x20; - - drawgfx_transpen(bitmap, cliprect, machine.gfx[0], - code, - color, - flipx, flipy, - (x + xoffs) & 0x1ff, - max_y - ((y + yoffs) & 0x0ff), 15); - } -} - - -static void srmp3_draw_sprites_map(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) -{ - srmp2_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram1.u8; - UINT8 *spriteram_2 = state->m_spriteram2.u8; - UINT8 *spriteram_3 = state->m_spriteram3.u8; - int offs, col; - int xoffs, yoffs; - - int ctrl = spriteram[ 0x600/2 ]; - int ctrl2 = spriteram[ 0x602/2 ]; - - int flip = ctrl & 0x40; - int numcol = ctrl2 & 0x0f; - - int upper = ( spriteram[ 0x604/2 ] & 0xFF ) + - ( spriteram[ 0x606/2 ] & 0xFF ) * 256; - - int max_y = 0xf0; - - xoffs = flip ? 0x10 : 0x10; - yoffs = flip ? -0x01 : -0x01; - - /* Number of columns to draw - the value 1 seems special, meaning: - draw every column */ - if (numcol == 1) numcol = 16; - - /* The first column is the frontmost, see twineagl test mode */ - for (col = numcol - 1; col >= 0; col--) - { - int x = spriteram[(col * 0x20 + 0x08 + 0x400)/2] & 0xff; - int y = spriteram[(col * 0x20 + 0x00 + 0x400)/2] & 0xff; - - /* draw this column */ - for (offs = 0; offs < 0x40/2; offs += 2/2) - { - int code = (((spriteram_3[((col)&0x0f) * 0x40/2 + offs + 0x800/2] & 0xff) << 8) + (spriteram_2[((col)&0xf) * 0x40/2 + offs + 0x800/2] & 0xff)); - - int color = ((spriteram_3[((col)&0x0f) * 0x40/2 + offs + 0xc00/2] & 0xf8) >> 3); - - int flipx = code & 0x8000; - int flipy = code & 0x4000; - - int sx = x + xoffs + (offs & 1) * 16; - int sy = -(y + yoffs) + (offs / 2) * 16 - - (machine.primary_screen->height() - (machine.primary_screen->visible_area().max_y + 1)); - - if (upper & (1 << col)) sx += 256; - - if (flip) - { - sy = max_y - 14 - sy - 0x100; - flipx = !flipx; - flipy = !flipy; - } - - code = code & 0x1fff; - -#define DRAWTILE(_x_, _y_) \ - drawgfx_transpen(bitmap, \ - cliprect, machine.gfx[0], \ - code, \ - color, \ - flipx, flipy, \ - _x_, _y_, 0); - - DRAWTILE(sx - 0x000, sy + 0x000) - DRAWTILE(sx - 0x200, sy + 0x000) - DRAWTILE(sx - 0x000, sy + 0x100) - DRAWTILE(sx - 0x200, sy + 0x100) - - } - /* next column */ - } -} - - -static void srmp3_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) -{ -/* - Sprite RAM A: spriteram_2 - ============== - + 0x000 - 0x1ff - xxxx xxxx : Tile number (low) - - + 0x200 - 0x3ff - ---- ---- : Color - xxxx xxxx : X coords (low) - - - Sprite RAM B: spriteram_3 - ============== - + 0x000 - 0x1ff - x--- ---- : Flip X ? - -x-- ---- : Flip Y ? - --x- ---- : Use GFX bank flag - ---x xxxx : Tile number (high) - - + 0x200 - 0x3ff - xxxx x--- : Color - ---- ---x : X coords (high) - - - Sprite RAM C: spriteram - ============== - + 0x000 - 0x1ff - xxxx xxxx : Y coords (low) - - + 0x300 - -x-- ---- : Flip screen -*/ - - srmp2_state *state = machine.driver_data(); - UINT8 *spriteram = state->m_spriteram1.u8; - UINT8 *spriteram_2 = state->m_spriteram2.u8; - UINT8 *spriteram_3 = state->m_spriteram3.u8; - int offs; - int xoffs, yoffs; - - int max_y = machine.primary_screen->height(); - - int ctrl = spriteram[ 0x600/2 ]; - //int ctrl2 = spriteram[ 0x602/2 ]; - - int flip = ctrl & 0x40; - - srmp3_draw_sprites_map(machine, bitmap, cliprect); - - xoffs = flip ? 0x10 : 0x10; - yoffs = flip ? 0x06 : 0x06; - - for (offs = 0x200 - 1; offs >= 0; offs--) - { - int code = (((spriteram_3[offs + 0x000] & 0xff) << 8) + (spriteram_2[offs + 0x000] & 0xff)); - int gfxbank = (spriteram_3[offs + 0x000] & 0x20); - - int color = ((spriteram_3[offs + 0x200] & 0xf8) >> 3); - - int x = (((spriteram_3[offs + 0x200] & 0x01) << 8) + (spriteram_2[offs + 0x200] & 0xff)); - int y = (spriteram[offs + 0x000] & 0xff); - - int flipx = code & 0x8000; - int flipy = code & 0x4000; - - code = (code & 0x1fff); - if (gfxbank) code += ((state->m_gfx_bank + 1) * 0x2000); - - if (flip) - { - y = max_y - y; - flipx = !flipx; - flipy = !flipy; - } - - drawgfx_transpen(bitmap,cliprect, machine.gfx[0], - code, - color, - flipx, flipy, - (x + xoffs) & 0x1ff, - max_y - ((y + yoffs) & 0x0ff), 0); - } -} - - -static void mjyuugi_draw_sprites_map(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) -{ - srmp2_state *state = machine.driver_data(); - UINT16 *spriteram16 = state->m_spriteram1.u16; - UINT16 *spriteram16_2 = state->m_spriteram2.u16; - int offs, col; - int xoffs, yoffs; - - int total_color_codes = machine.config().m_gfxdecodeinfo[0].total_color_codes; - - int ctrl = spriteram16[ 0x600/2 ]; - int ctrl2 = spriteram16[ 0x602/2 ]; - - int flip = ctrl & 0x40; - int numcol = ctrl2 & 0x000f; - - /* Sprites Banking and/or Sprites Buffering */ - UINT16 *src = spriteram16_2 + ( ((ctrl2 ^ (~ctrl2<<1)) & 0x40) ? 0x2000/2 : 0 ); - - int upper = ( spriteram16[ 0x604/2 ] & 0xFF ) + - ( spriteram16[ 0x606/2 ] & 0xFF ) * 256; - - int max_y = 0xf0; - - xoffs = flip ? 0x10 : 0x10; - yoffs = flip ? 0x09 : 0x07; - - /* Number of columns to draw - the value 1 seems special, meaning: - draw every column */ - if (numcol == 1) numcol = 16; - - /* The first column is the frontmost, see twineagl test mode */ - for (col = numcol - 1; col >= 0; col--) - { - int x = spriteram16[(col * 0x20 + 0x08 + 0x400)/2] & 0xff; - int y = spriteram16[(col * 0x20 + 0x00 + 0x400)/2] & 0xff; - - /* draw this column */ - for (offs = 0; offs < 0x40/2; offs += 2/2) - { - int code = src[((col)&0xf) * 0x40/2 + offs + 0x800/2]; - int color = src[((col)&0xf) * 0x40/2 + offs + 0xc00/2]; - - int gfxbank = color & 0x0200; - - int flipx = code & 0x8000; - int flipy = code & 0x4000; - - int sx = x + xoffs + (offs & 1) * 16; - int sy = -(y + yoffs) + (offs / 2) * 16 - - (machine.primary_screen->height() - (machine.primary_screen->visible_area().max_y + 1)); - - if (upper & (1 << col)) sx += 256; - - if (flip) - { - sy = max_y - 16 - sy - 0x100; - flipx = !flipx; - flipy = !flipy; - } - - color = ((color >> (16-5)) % total_color_codes); - code = (code & 0x3fff) + (gfxbank ? 0x4000 : 0); - -#define DRAWTILE(_x_, _y_) \ - drawgfx_transpen(bitmap, \ - cliprect, machine.gfx[0], \ - code, \ - color, \ - flipx, flipy, \ - _x_, _y_, 0); - - DRAWTILE(sx - 0x000, sy + 0x000) - DRAWTILE(sx - 0x200, sy + 0x000) - DRAWTILE(sx - 0x000, sy + 0x100) - DRAWTILE(sx - 0x200, sy + 0x100) - - } - /* next column */ - } -} - - -static void mjyuugi_draw_sprites(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect) -{ -/* - Sprite RAM A: spriteram16_2 - ============== - + 0x000 - 0x3ff - x--- ---- ---- ---- : Flip X - -x-- ---- ---- ---- : Flip Y - --x- ---- ---- ---- : Use GFX bank flag - ---x xxxx xxxx xxxx : Tile number - - + 0x400 - 0x7ff - xxxx x--- ---- ---- : Color - ---- ---x xxxx xxxx : X coords - - Sprite RAM B: spriteram16 - ============== - + 0x000 - 0x3ff - ---- ---- xxxx xxxx : Y coords - - + 0x600 - ---- ---- -x-- ---- : Flip screen -*/ - - srmp2_state *state = machine.driver_data(); - UINT16 *spriteram16 = state->m_spriteram1.u16; - UINT16 *spriteram16_2 = state->m_spriteram2.u16; - int offs; - int xoffs, yoffs; - - int ctrl = spriteram16[ 0x600/2 ]; - int ctrl2 = spriteram16[ 0x602/2 ]; - - int flip = ctrl & 0x40; - - /* Sprites Banking and/or Sprites Buffering */ - UINT16 *src = spriteram16_2 + ( ((ctrl2 ^ (~ctrl2<<1)) & 0x40) ? 0x2000/2 : 0 ); - - int max_y = machine.primary_screen->height(); - - mjyuugi_draw_sprites_map(machine, bitmap, cliprect); - - xoffs = flip ? 0x10 : 0x10; - yoffs = flip ? 0x06 : 0x06; - - for (offs = (0x400 - 6) / 2; offs >= 0 / 2; offs -= 2 / 2) - { - int code = src[offs + 0x000 / 2]; - int gfxbank = code & 0x2000; - - int color = ((src[offs + 0x400 / 2] >> 11) & 0x1f); - - int x = (src[offs + 0x400 / 2] & 0x1ff); - int y = (spriteram16[offs + 0x000 / 2] & 0xff); - - int flipx = code & 0x8000; - int flipy = code & 0x4000; - - code = (code & 0x1fff); - if (gfxbank) code += ((state->m_gfx_bank + 1) * 0x2000); - - if (flip) - { - y = max_y - y - +(machine.primary_screen->height() - (machine.primary_screen->visible_area().max_y + 1)); - flipx = !flipx; - flipy = !flipy; - } - - drawgfx_transpen(bitmap,cliprect, machine.gfx[0], - code, - color, - flipx, flipy, - (x + xoffs) & 0x1ff, - max_y - ((y + yoffs) & 0x0ff), 0); - } -} - - SCREEN_UPDATE( srmp2 ) { + srmp2_state *state = screen->machine().driver_data(); bitmap_fill(bitmap, cliprect, 0x1ff); - srmp2_draw_sprites(screen->machine(), bitmap, cliprect); + screen->machine().device("spritegen")->srmp2_draw_sprites(screen->machine(), bitmap, cliprect, state->m_spriteram2.u16, state->m_color_bank); return 0; } - SCREEN_UPDATE( srmp3 ) { + srmp2_state *state = screen->machine().driver_data(); bitmap_fill(bitmap, cliprect, 0x1f0); - srmp3_draw_sprites(screen->machine(), bitmap, cliprect); + screen->machine().device("spritegen")->srmp3_draw_sprites(screen->machine(), bitmap, cliprect, state->m_spriteram2.u8, state->m_spriteram3.u8, state->m_gfx_bank); return 0; } - SCREEN_UPDATE( mjyuugi ) { + srmp2_state *state = screen->machine().driver_data(); bitmap_fill(bitmap, cliprect, 0x1f0); - mjyuugi_draw_sprites(screen->machine(), bitmap, cliprect); + screen->machine().device("spritegen")->mjyuugi_draw_sprites(screen->machine(), bitmap, cliprect, state->m_spriteram2.u16, state->m_gfx_bank); return 0; } diff --git a/src/mame/video/tnzs.c b/src/mame/video/tnzs.c index 2a1f2fceadd..b2ab87884b9 100644 --- a/src/mame/video/tnzs.c +++ b/src/mame/video/tnzs.c @@ -8,7 +8,7 @@ #include "emu.h" #include "includes/tnzs.h" - +#include "video/seta001.h" /*************************************************************************** @@ -42,187 +42,15 @@ PALETTE_INIT( arknoid2 ) } - -static void draw_background( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *m ) -{ - tnzs_state *state = machine.driver_data(); - int x, y, column, tot, transpen; - int scrollx, scrolly; - UINT32 upperbits; - int ctrl2 = state->m_objctrl[1]; - - - if ((ctrl2 ^ (~ctrl2 << 1)) & 0x40) - m += 0x800; - - if (state->m_bg_flag[0] & 0x80) - transpen = -1; - else - transpen = 0; - - - /* The byte at f200 is the y-scroll value for the first column. - The byte at f204 is the LSB of x-scroll value for the first column. - - The other columns follow at 16-byte intervals. - - The 9th bit of each x-scroll value is combined into 2 bytes - at f302-f303 */ - - /* f301 controls how many columns are drawn. */ - tot = state->m_objctrl[1] & 0x1f; - if (tot == 1) - tot = 16; - - upperbits = state->m_objctrl[2] + state->m_objctrl[3] * 256; - - for (column = 0; column < tot; column++) - { - scrollx = state->m_scrollram[column * 16 + 4] - ((upperbits & 0x01) * 256); - if (state->m_screenflip) - scrolly = state->m_scrollram[column * 16] + 1 - 256; - else - scrolly = -state->m_scrollram[column * 16] + 1; - - for (y = 0; y < 16; y++) - { - for (x = 0; x < 2; x++) - { - int code, color, flipx, flipy, sx, sy; - int i = 32 * (column ^ 8) + 2 * y + x; - - code = m[i] + ((m[i + 0x1000] & 0x3f) << 8); - color = (m[i + 0x1200] & 0xf8) >> 3; /* colours at d600-d7ff */ - sx = x * 16; - sy = y * 16; - flipx = m[i + 0x1000] & 0x80; - flipy = m[i + 0x1000] & 0x40; - if (state->m_screenflip) - { - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - } - - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], - code, - color, - flipx,flipy, - sx + scrollx,(sy + scrolly) & 0xff, - transpen); - - /* wrap around x */ - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], - code, - color, - flipx,flipy, - sx + 512 + scrollx,(sy + scrolly) & 0xff, - transpen); - } - } - - upperbits >>= 1; - } -} - - -static void draw_foreground( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, - UINT8 *char_pointer, UINT8 *x_pointer, UINT8 *y_pointer, UINT8 *ctrl_pointer, UINT8 *color_pointer) -{ - tnzs_state *state = machine.driver_data(); - int i; - int ctrl2 = state->m_objctrl[1]; - - - if ((ctrl2 ^ (~ctrl2 << 1)) & 0x40) - { - char_pointer += 0x800; - x_pointer += 0x800; - ctrl_pointer += 0x800; - color_pointer += 0x800; - } - - - /* Draw all 512 sprites */ - for (i = 0x1ff; i >= 0; i--) - { - int code, color, sx, sy, flipx, flipy; - - code = char_pointer[i] + ((ctrl_pointer[i] & 0x3f) << 8); - color = (color_pointer[i] & 0xf8) >> 3; - sx = x_pointer[i] - ((color_pointer[i] & 1) << 8); - sy = 240 - y_pointer[i]; - flipx = ctrl_pointer[i] & 0x80; - flipy = ctrl_pointer[i] & 0x40; - if (state->m_screenflip) - { - sy = 240 - sy; - flipx = !flipx; - flipy = !flipy; - /* hack to hide Chuka Taisens grey line, top left corner */ - if ((sy == 0) && (code == 0)) sy += 240; - } - - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], - code, - color, - flipx,flipy, - sx,sy+2,0); - - /* wrap around x */ - drawgfx_transpen(bitmap,cliprect,machine.gfx[0], - code, - color, - flipx,flipy, - sx + 512,sy+2,0); - } -} - SCREEN_UPDATE( tnzs ) { tnzs_state *state = screen->machine().driver_data(); - /* If the byte at f300 has bit 6 set, flip the screen - (I'm not 100% sure about this) */ - state->m_screenflip = (state->m_objctrl[0] & 0x40) >> 6; - - - /* Fill the background */ - bitmap_fill(bitmap, cliprect, 0x1f0); - - /* Redraw the background tiles (c400-c5ff) */ - draw_background(screen->machine(), bitmap, cliprect, state->m_objram + 0x400); - - /* Draw the sprites on top */ - draw_foreground(screen->machine(), bitmap, cliprect, - state->m_objram + 0x0000, /* chars : c000 */ - state->m_objram + 0x0200, /* x : c200 */ - state->m_vdcram + 0x0000, /* y : f000 */ - state->m_objram + 0x1000, /* ctrl : d000 */ - state->m_objram + 0x1200); /* color : d200 */ + screen->machine().device("spritegen")->tnzs_draw_sprites(screen->machine(), bitmap, cliprect, state->m_objram, state->m_bg_flag ); return 0; } SCREEN_EOF( tnzs ) { tnzs_state *state = machine.driver_data(); - int ctrl2 = state->m_objctrl[1]; - if (~ctrl2 & 0x20) - { - // note I copy sprites only. seta.c also copies the "floating tilemap" - if (ctrl2 & 0x40) - { - memcpy(&state->m_objram[0x0000], &state->m_objram[0x0800], 0x0400); - memcpy(&state->m_objram[0x1000], &state->m_objram[0x1800], 0x0400); - } - else - { - memcpy(&state->m_objram[0x0800], &state->m_objram[0x0000], 0x0400); - memcpy(&state->m_objram[0x1800], &state->m_objram[0x1000], 0x0400); - } - - // and I copy the "floating tilemap" BACKWARDS - this fixes kabukiz - memcpy(&state->m_objram[0x0400], &state->m_objram[0x0c00], 0x0400); - memcpy(&state->m_objram[0x1400], &state->m_objram[0x1c00], 0x0400); - } + machine.device("spritegen")->tnzs_eof( state->m_objram); } -