mirror of
https://github.com/holub/mame
synced 2025-05-15 10:28:16 +03:00
Implemented karnov style sprites in its own file, shared with karnov and dec8 drivers [David Haywood]
This commit is contained in:
parent
9443be8017
commit
49eeca47b4
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -3850,6 +3850,8 @@ src/mame/video/dec0.c svneol=native#text/plain
|
||||
src/mame/video/dec8.c svneol=native#text/plain
|
||||
src/mame/video/decbac06.c svneol=native#text/plain
|
||||
src/mame/video/decbac06.h svneol=native#text/plain
|
||||
src/mame/video/deckarn.c svneol=native#text/plain
|
||||
src/mame/video/deckarn.h svneol=native#text/plain
|
||||
src/mame/video/decmxc06.c svneol=native#text/plain
|
||||
src/mame/video/decmxc06.h svneol=native#text/plain
|
||||
src/mame/video/deco16ic.c svneol=native#text/plain
|
||||
|
@ -49,14 +49,26 @@ To do:
|
||||
#include "includes/dec8.h"
|
||||
#include "video/decbac06.h"
|
||||
#include "video/decmxc06.h"
|
||||
#include "video/deckarn.h"
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static WRITE8_HANDLER( dec8_mxc06_karn_buffer_spriteram_w)
|
||||
{
|
||||
dec8_state *state = space->machine().driver_data<dec8_state>();
|
||||
UINT8* spriteram = space->machine().generic.spriteram.u8;
|
||||
// copy to a 16-bit region for the sprite chip
|
||||
for (int i=0;i<0x800/2;i++)
|
||||
{
|
||||
state->buffered_spriteram16[i] = spriteram[(i*2)+1] | (spriteram[(i*2)+0] <<8);
|
||||
}
|
||||
}
|
||||
|
||||
/* Only used by ghostb, gondo, garyoret, other games can control buffering */
|
||||
static SCREEN_EOF( dec8 )
|
||||
{
|
||||
address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
|
||||
buffer_spriteram_w(space, 0, 0);
|
||||
dec8_mxc06_karn_buffer_spriteram_w(space, 0, 0);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( i8751_h_r )
|
||||
@ -488,16 +500,7 @@ static WRITE8_HANDLER( flip_screen_w ) { flip_screen_set(space->machine(), data)
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static WRITE8_HANDLER( dec8_mxc06_buffer_spriteram_w)
|
||||
{
|
||||
dec8_state *state = space->machine().driver_data<dec8_state>();
|
||||
UINT8* spriteram = space->machine().generic.spriteram.u8;
|
||||
// copy to a 16-bit region for the sprite chip
|
||||
for (int i=0;i<0x800/2;i++)
|
||||
{
|
||||
state->buffered_spriteram16[i] = spriteram[(i*2)+1] | (spriteram[(i*2)+0] <<8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( cobra_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM
|
||||
@ -518,7 +521,7 @@ static ADDRESS_MAP_START( cobra_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x3a00, 0x3a07) AM_DEVWRITE("tilegen2", deco_bac06_pf_control0_8bit_w)
|
||||
AM_RANGE(0x3a10, 0x3a1f) AM_DEVWRITE("tilegen2", deco_bac06_pf_control1_8bit_w)
|
||||
AM_RANGE(0x3c00, 0x3c00) AM_WRITE(dec8_bank_w)
|
||||
AM_RANGE(0x3c02, 0x3c02) AM_WRITE(dec8_mxc06_buffer_spriteram_w) /* DMA */
|
||||
AM_RANGE(0x3c02, 0x3c02) AM_WRITE(dec8_mxc06_karn_buffer_spriteram_w) /* DMA */
|
||||
AM_RANGE(0x3e00, 0x3e00) AM_WRITE(dec8_sound_w)
|
||||
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0x8000, 0xffff) AM_ROM
|
||||
@ -609,7 +612,7 @@ static ADDRESS_MAP_START( oscar_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x3c04, 0x3c04) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0x3c00, 0x3c07) AM_DEVWRITE("tilegen1", deco_bac06_pf_control0_8bit_w)
|
||||
AM_RANGE(0x3c10, 0x3c1f) AM_DEVWRITE("tilegen1", deco_bac06_pf_control1_8bit_w)
|
||||
AM_RANGE(0x3c80, 0x3c80) AM_WRITE(dec8_mxc06_buffer_spriteram_w) /* DMA */
|
||||
AM_RANGE(0x3c80, 0x3c80) AM_WRITE(dec8_mxc06_karn_buffer_spriteram_w) /* DMA */
|
||||
AM_RANGE(0x3d00, 0x3d00) AM_WRITE(dec8_bank_w) /* BNKS */
|
||||
AM_RANGE(0x3d80, 0x3d80) AM_WRITE(dec8_sound_w) /* SOUN */
|
||||
AM_RANGE(0x3e00, 0x3e00) AM_WRITENOP /* COINCL */
|
||||
@ -636,7 +639,7 @@ static ADDRESS_MAP_START( lastmisn_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x1803, 0x1803) AM_READ_PORT("DSW0") /* Dip 1 */
|
||||
AM_RANGE(0x1804, 0x1804) AM_READ_PORT("DSW1") /* Dip 2 */
|
||||
AM_RANGE(0x1800, 0x1804) AM_WRITE(shackled_int_w)
|
||||
AM_RANGE(0x1805, 0x1805) AM_WRITE(buffer_spriteram_w) /* DMA */
|
||||
AM_RANGE(0x1805, 0x1805) AM_WRITE(dec8_mxc06_karn_buffer_spriteram_w) /* DMA */
|
||||
AM_RANGE(0x1806, 0x1806) AM_READ(i8751_h_r)
|
||||
AM_RANGE(0x1807, 0x1807) AM_READWRITE(i8751_l_r, flip_screen_w)
|
||||
AM_RANGE(0x1809, 0x1809) AM_WRITE(lastmisn_scrollx_w) /* Scroll LSB */
|
||||
@ -662,7 +665,7 @@ static ADDRESS_MAP_START( lastmisn_sub_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x1803, 0x1803) AM_READ_PORT("DSW0") /* Dip 1 */
|
||||
AM_RANGE(0x1804, 0x1804) AM_READ_PORT("DSW1") /* Dip 2 */
|
||||
AM_RANGE(0x1800, 0x1804) AM_WRITE(shackled_int_w)
|
||||
AM_RANGE(0x1805, 0x1805) AM_WRITE(buffer_spriteram_w) /* DMA */
|
||||
AM_RANGE(0x1805, 0x1805) AM_WRITE(dec8_mxc06_karn_buffer_spriteram_w) /* DMA */
|
||||
AM_RANGE(0x1807, 0x1807) AM_WRITE(flip_screen_w)
|
||||
AM_RANGE(0x180c, 0x180c) AM_WRITE(dec8_sound_w)
|
||||
AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(dec8_videoram_w)
|
||||
@ -682,7 +685,7 @@ static ADDRESS_MAP_START( shackled_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x1803, 0x1803) AM_READ_PORT("DSW0")
|
||||
AM_RANGE(0x1804, 0x1804) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0x1800, 0x1804) AM_WRITE(shackled_int_w)
|
||||
AM_RANGE(0x1805, 0x1805) AM_WRITE(buffer_spriteram_w) /* DMA */
|
||||
AM_RANGE(0x1805, 0x1805) AM_WRITE(dec8_mxc06_karn_buffer_spriteram_w) /* DMA */
|
||||
AM_RANGE(0x1807, 0x1807) AM_WRITE(flip_screen_w)
|
||||
AM_RANGE(0x1809, 0x1809) AM_WRITE(lastmisn_scrollx_w) /* Scroll LSB */
|
||||
AM_RANGE(0x180b, 0x180b) AM_WRITE(lastmisn_scrolly_w) /* Scroll LSB */
|
||||
@ -706,7 +709,7 @@ static ADDRESS_MAP_START( shackled_sub_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x1803, 0x1803) AM_READ_PORT("DSW0")
|
||||
AM_RANGE(0x1804, 0x1804) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0x1800, 0x1804) AM_WRITE(shackled_int_w)
|
||||
AM_RANGE(0x1805, 0x1805) AM_WRITE(buffer_spriteram_w) /* DMA */
|
||||
AM_RANGE(0x1805, 0x1805) AM_WRITE(dec8_mxc06_karn_buffer_spriteram_w) /* DMA */
|
||||
AM_RANGE(0x1806, 0x1806) AM_READ(i8751_h_r)
|
||||
AM_RANGE(0x1807, 0x1807) AM_READWRITE(i8751_l_r, flip_screen_w)
|
||||
AM_RANGE(0x1809, 0x1809) AM_WRITE(lastmisn_scrollx_w) /* Scroll LSB */
|
||||
@ -730,7 +733,7 @@ static ADDRESS_MAP_START( csilver_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x1803, 0x1803) AM_READ_PORT("IN2")
|
||||
AM_RANGE(0x1804, 0x1804) AM_READ_PORT("DSW1") /* Dip 2 */
|
||||
AM_RANGE(0x1800, 0x1804) AM_WRITE(shackled_int_w)
|
||||
AM_RANGE(0x1805, 0x1805) AM_READ_PORT("DSW0") AM_WRITE(buffer_spriteram_w) /* Dip 1, DMA */
|
||||
AM_RANGE(0x1805, 0x1805) AM_READ_PORT("DSW0") AM_WRITE(dec8_mxc06_karn_buffer_spriteram_w) /* Dip 1, DMA */
|
||||
AM_RANGE(0x1807, 0x1807) AM_WRITE(flip_screen_w)
|
||||
AM_RANGE(0x1808, 0x180b) AM_WRITE(dec8_scroll2_w)
|
||||
AM_RANGE(0x180c, 0x180c) AM_WRITE(dec8_sound_w)
|
||||
@ -753,7 +756,7 @@ static ADDRESS_MAP_START( csilver_sub_map, AS_PROGRAM, 8 )
|
||||
AM_RANGE(0x1803, 0x1803) AM_READ_PORT("IN2")
|
||||
AM_RANGE(0x1804, 0x1804) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0x1800, 0x1804) AM_WRITE(shackled_int_w)
|
||||
AM_RANGE(0x1805, 0x1805) AM_READ_PORT("DSW0") AM_WRITE(buffer_spriteram_w) /* DMA */
|
||||
AM_RANGE(0x1805, 0x1805) AM_READ_PORT("DSW0") AM_WRITE(dec8_mxc06_karn_buffer_spriteram_w) /* DMA */
|
||||
AM_RANGE(0x180c, 0x180c) AM_WRITE(dec8_sound_w)
|
||||
AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(dec8_videoram_w) AM_BASE_SIZE_MEMBER(dec8_state, videoram, videoram_size)
|
||||
AM_RANGE(0x2800, 0x2fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
@ -2064,6 +2067,9 @@ static MACHINE_CONFIG_START( ghostb, dec8_state )
|
||||
MCFG_DEVICE_ADD("tilegen1", deco_bac06_, 0)
|
||||
deco_bac06_device_config::set_gfx_region_wide(device, 2,2,0);
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen", deco_karnovsprites_, 0)
|
||||
deco_karnovsprites_device_config::set_gfx_region(device, 1);
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(58)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* 58Hz, 529ms Vblank duration */)
|
||||
@ -2213,6 +2219,9 @@ static MACHINE_CONFIG_START( gondo, dec8_state )
|
||||
/* video hardware */
|
||||
MCFG_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen", deco_karnovsprites_, 0)
|
||||
deco_karnovsprites_device_config::set_gfx_region(device, 1);
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(58)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 58Hz, 529ms Vblank duration */)
|
||||
@ -2261,6 +2270,9 @@ static MACHINE_CONFIG_START( lastmisn, dec8_state )
|
||||
/* video hardware */
|
||||
MCFG_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen", deco_karnovsprites_, 0)
|
||||
deco_karnovsprites_device_config::set_gfx_region(device, 1);
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(58)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* 58Hz, 529ms Vblank duration */)
|
||||
@ -2308,6 +2320,9 @@ static MACHINE_CONFIG_START( shackled, dec8_state )
|
||||
/* video hardware */
|
||||
MCFG_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen", deco_karnovsprites_, 0)
|
||||
deco_karnovsprites_device_config::set_gfx_region(device, 1);
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(58)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* 58Hz, 529ms Vblank duration */)
|
||||
@ -2356,6 +2371,9 @@ static MACHINE_CONFIG_START( csilver, dec8_state )
|
||||
/* video hardware */
|
||||
MCFG_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen", deco_karnovsprites_, 0)
|
||||
deco_karnovsprites_device_config::set_gfx_region(device, 1);
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(58)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 58Hz, 529ms Vblank duration */)
|
||||
@ -2404,6 +2422,9 @@ static MACHINE_CONFIG_START( garyoret, dec8_state )
|
||||
/* video hardware */
|
||||
MCFG_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen", deco_karnovsprites_, 0)
|
||||
deco_karnovsprites_device_config::set_gfx_region(device, 1);
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(58)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 58Hz, 529ms Vblank duration */)
|
||||
|
@ -23,6 +23,7 @@
|
||||
There is another Karnov rom set - a bootleg version of the Japanese roms with
|
||||
the Data East copyright removed - not supported because the original Japanese
|
||||
roms work fine.
|
||||
^^ This should be added (DH, 30/03/11)
|
||||
|
||||
One of the two color PROMs for chelnov and chelnoj is different; one is most
|
||||
likely a bad read, but I don't know which one.
|
||||
@ -81,7 +82,7 @@ Stephh's notes (based on the games M68000 code and some tests) :
|
||||
#include "sound/2203intf.h"
|
||||
#include "sound/3526intf.h"
|
||||
#include "includes/karnov.h"
|
||||
|
||||
#include "video/deckarn.h"
|
||||
|
||||
/*************************************
|
||||
*
|
||||
@ -837,6 +838,9 @@ static MACHINE_CONFIG_START( karnov, karnov_state )
|
||||
MCFG_GFXDECODE(karnov)
|
||||
MCFG_PALETTE_LENGTH(1024)
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen", deco_karnovsprites_, 0)
|
||||
deco_karnovsprites_device_config::set_gfx_region(device, 2);
|
||||
|
||||
MCFG_PALETTE_INIT(karnov)
|
||||
MCFG_VIDEO_START(karnov)
|
||||
|
||||
@ -879,6 +883,9 @@ static MACHINE_CONFIG_START( wndrplnt, karnov_state )
|
||||
MCFG_GFXDECODE(karnov)
|
||||
MCFG_PALETTE_LENGTH(1024)
|
||||
|
||||
MCFG_DEVICE_ADD("spritegen", deco_karnovsprites_, 0)
|
||||
deco_karnovsprites_device_config::set_gfx_region(device, 2);
|
||||
|
||||
MCFG_PALETTE_INIT(karnov)
|
||||
MCFG_VIDEO_START(wndrplnt)
|
||||
|
||||
@ -912,6 +919,9 @@ ROM_START( karnov )
|
||||
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 6502 Sound CPU */
|
||||
ROM_LOAD( "dn05-5", 0x8000, 0x8000, CRC(fa1a31a8) SHA1(5007a625be03c546d2a78444d72c28761b10cdb0) )
|
||||
|
||||
ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 MCU */
|
||||
ROM_LOAD( "karnov_i8751", 0x0000, 0x1000, NO_DUMP )
|
||||
|
||||
ROM_REGION( 0x08000, "gfx1", 0 )
|
||||
ROM_LOAD( "dn00-", 0x00000, 0x08000, CRC(0ed77c6d) SHA1(4ec86ac56c01c158a580dc13dea3e5cbdf90d0e9) ) /* Characters */
|
||||
|
||||
@ -948,6 +958,9 @@ ROM_START( karnovj )
|
||||
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 6502 Sound CPU */
|
||||
ROM_LOAD( "kar5", 0x8000, 0x8000, CRC(7c9158f1) SHA1(dfba7b3abd6b8d6991f0207cd252ee652a6050c2) )
|
||||
|
||||
ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 MCU */
|
||||
ROM_LOAD( "karnovj_i8751", 0x0000, 0x1000, NO_DUMP )
|
||||
|
||||
ROM_REGION( 0x08000, "gfx1", 0 )
|
||||
ROM_LOAD( "dn00-", 0x00000, 0x08000, CRC(0ed77c6d) SHA1(4ec86ac56c01c158a580dc13dea3e5cbdf90d0e9) ) /* Characters */
|
||||
|
||||
@ -984,6 +997,9 @@ ROM_START( wndrplnt )
|
||||
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 6502 Sound CPU */
|
||||
ROM_LOAD( "ea05.bin", 0x8000, 0x8000, CRC(8dbb6231) SHA1(342faa020448ce916e820b3df18d44191983f7a6) )
|
||||
|
||||
ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 MCU */
|
||||
ROM_LOAD( "wndrplnt_i8751", 0x0000, 0x1000, NO_DUMP )
|
||||
|
||||
ROM_REGION( 0x08000, "gfx1", 0 )
|
||||
ROM_LOAD( "ea00.bin", 0x00000, 0x08000, CRC(9f3cac4c) SHA1(af8a275ff531029dbada3c820c9f660fef383100) ) /* Characters */
|
||||
|
||||
@ -1020,6 +1036,9 @@ ROM_START( chelnov )
|
||||
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 6502 Sound CPU */
|
||||
ROM_LOAD( "ee05-.f3", 0x8000, 0x8000, CRC(6a8936b4) SHA1(2b72cb749e6bddb67c2bd3d27b3a92511f9ef016) )
|
||||
|
||||
ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 MCU */
|
||||
ROM_LOAD( "chelnov_i8751", 0x0000, 0x1000, NO_DUMP )
|
||||
|
||||
ROM_REGION( 0x08000, "gfx1", 0 )
|
||||
ROM_LOAD( "ee00-e.c5", 0x00000, 0x08000, CRC(e06e5c6b) SHA1(70166257da5be428cb8404d8e1063c59c7722365) ) /* Characters */
|
||||
|
||||
@ -1053,6 +1072,9 @@ ROM_START( chelnovu )
|
||||
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 6502 Sound CPU */
|
||||
ROM_LOAD( "ee05-.f3", 0x8000, 0x8000, CRC(6a8936b4) SHA1(2b72cb749e6bddb67c2bd3d27b3a92511f9ef016) )
|
||||
|
||||
ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 MCU */
|
||||
ROM_LOAD( "chelnovu_i8751", 0x0000, 0x1000, NO_DUMP )
|
||||
|
||||
ROM_REGION( 0x08000, "gfx1", 0 )
|
||||
ROM_LOAD( "ee00-e.c5", 0x00000, 0x08000, CRC(e06e5c6b) SHA1(70166257da5be428cb8404d8e1063c59c7722365) ) /* Characters */
|
||||
|
||||
@ -1086,6 +1108,9 @@ ROM_START( chelnovj )
|
||||
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 6502 Sound CPU */
|
||||
ROM_LOAD( "ee05-.f3", 0x8000, 0x8000, CRC(6a8936b4) SHA1(2b72cb749e6bddb67c2bd3d27b3a92511f9ef016) )
|
||||
|
||||
ROM_REGION( 0x1000, "mcu", 0 ) /* i8751 MCU */
|
||||
ROM_LOAD( "chelnovj_i8751", 0x0000, 0x1000, NO_DUMP )
|
||||
|
||||
ROM_REGION( 0x08000, "gfx1", 0 )
|
||||
ROM_LOAD( "a-c5.bin", 0x00000, 0x08000, CRC(1abf2c6d) SHA1(86d625ae94cd9ea69e4e613895410640efb175b3) ) /* Characters */
|
||||
|
||||
|
@ -613,6 +613,7 @@ $(MAMEOBJ)/dataeast.a: \
|
||||
$(VIDEO)/decocomn.o \
|
||||
$(VIDEO)/decospr.o \
|
||||
$(VIDEO)/decmxc06.o \
|
||||
$(VIDEO)/deckarn.o \
|
||||
|
||||
$(MAMEOBJ)/dooyong.a: \
|
||||
$(DRIVERS)/dooyong.o $(VIDEO)/dooyong.o \
|
||||
|
@ -45,6 +45,7 @@ sprites.
|
||||
#include "includes/dec8.h"
|
||||
#include "video/decbac06.h"
|
||||
#include "video/decmxc06.h"
|
||||
#include "video/deckarn.h"
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -220,70 +221,6 @@ WRITE8_HANDLER( gondo_scroll_w )
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/* 'Karnov' sprites, used by Gondomania, Last Mission, Shackled, Ghostbusters */
|
||||
static void draw_sprites1( running_machine& machine, bitmap_t *bitmap, const rectangle *cliprect, int priority )
|
||||
{
|
||||
UINT8 *buffered_spriteram = machine.generic.buffered_spriteram.u8;
|
||||
int offs, x, y, sprite, sprite2, colour, extra, fx, fy;
|
||||
|
||||
for (offs = 0; offs < 0x800; offs += 8)
|
||||
{
|
||||
y = buffered_spriteram[offs + 1] + (buffered_spriteram[offs] << 8);
|
||||
if ((y & 0x8000) == 0) continue;
|
||||
|
||||
fx = buffered_spriteram[offs + 3];
|
||||
|
||||
if ((fx & 0x1) == 0) continue;
|
||||
|
||||
extra = fx & 0x10;
|
||||
fy = fx & 0x2;
|
||||
fx = fx & 0x4;
|
||||
|
||||
x = buffered_spriteram[offs + 5] + (buffered_spriteram[offs + 4] << 8);
|
||||
colour = buffered_spriteram[offs + 6] >> 4;
|
||||
if (priority == 1 && (colour & 8)) continue;
|
||||
if (priority == 2 && !(colour & 8)) continue;
|
||||
sprite = buffered_spriteram[offs + 7] + (buffered_spriteram[offs + 6] << 8);
|
||||
sprite &= 0x0fff;
|
||||
|
||||
if (extra) {y = y + 16; sprite &= 0xffe;}
|
||||
|
||||
x = x & 0x01ff;
|
||||
y = y & 0x01ff;
|
||||
x = (x + 16) % 0x200;
|
||||
y = (y + 16) % 0x200;
|
||||
x = 256 - x;
|
||||
y = 256 - y;
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 240 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
if (extra) y = y - 16;
|
||||
}
|
||||
|
||||
/* Y Flip determines order of multi-sprite */
|
||||
if (extra && fy)
|
||||
{
|
||||
sprite2 = sprite;
|
||||
sprite++;
|
||||
}
|
||||
else
|
||||
sprite2 = sprite + 1;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
sprite,
|
||||
colour,fx,fy,x,y,0);
|
||||
|
||||
/* 1 more sprite drawn underneath */
|
||||
if (extra)
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
|
||||
sprite2,
|
||||
colour,fx,fy,x,y+16,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void srdarwin_draw_sprites( running_machine& machine, bitmap_t *bitmap, const rectangle *cliprect, int pri )
|
||||
{
|
||||
@ -385,7 +322,7 @@ SCREEN_UPDATE( ghostb )
|
||||
{
|
||||
dec8_state *state = screen->machine().driver_data<dec8_state>();
|
||||
screen->machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
|
||||
draw_sprites1(screen->machine(), bitmap, cliprect, 0);
|
||||
screen->machine().device<deco_karnovsprites_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->buffered_spriteram16, 0x400, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->fix_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
@ -464,7 +401,7 @@ SCREEN_UPDATE( lastmisn )
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, ((state->scroll2[2] << 8)+ state->scroll2[3]));
|
||||
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites1(screen->machine(), bitmap, cliprect, 0);
|
||||
screen->machine().device<deco_karnovsprites_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->buffered_spriteram16, 0x400, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->fix_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
@ -478,7 +415,7 @@ SCREEN_UPDATE( shackled )
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1 | 1, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 0, 0);
|
||||
draw_sprites1(screen->machine(), bitmap, cliprect, 0);
|
||||
screen->machine().device<deco_karnovsprites_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->buffered_spriteram16, 0x400, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0 | 1, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->fix_tilemap, 0, 0);
|
||||
return 0;
|
||||
@ -618,9 +555,9 @@ SCREEN_UPDATE( gondo )
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, ((state->scroll2[2] << 8) + state->scroll2[3]));
|
||||
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1, 0);
|
||||
draw_sprites1(screen->machine(), bitmap, cliprect, 2);
|
||||
screen->machine().device<deco_karnovsprites_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->buffered_spriteram16, 0x400, 2);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0, 0);
|
||||
draw_sprites1(screen->machine(), bitmap, cliprect, 1);
|
||||
screen->machine().device<deco_karnovsprites_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->buffered_spriteram16, 0x400, 1);
|
||||
tilemap_draw(bitmap, cliprect, state->fix_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
@ -632,7 +569,7 @@ SCREEN_UPDATE( garyoret )
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, ((state->scroll2[2] << 8) + state->scroll2[3]));
|
||||
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites1(screen->machine(), bitmap, cliprect, 0);
|
||||
screen->machine().device<deco_karnovsprites_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->buffered_spriteram16, 0x400, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 1, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->fix_tilemap, 0, 0);
|
||||
return 0;
|
||||
|
117
src/mame/video/deckarn.c
Normal file
117
src/mame/video/deckarn.c
Normal file
@ -0,0 +1,117 @@
|
||||
/* Data East 'Karnov style' sprites */
|
||||
/* Custom Chip ??? */
|
||||
|
||||
#include "emu.h"
|
||||
#include "deckarn.h"
|
||||
|
||||
deco_karnovsprites_device_config::deco_karnovsprites_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
|
||||
: device_config(mconfig, static_alloc_device_config, "karnovsprites_device", tag, owner, clock)
|
||||
{
|
||||
m_gfxregion = 0;
|
||||
}
|
||||
|
||||
device_config *deco_karnovsprites_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
|
||||
{
|
||||
return global_alloc(deco_karnovsprites_device_config(mconfig, tag, owner, clock));
|
||||
}
|
||||
|
||||
device_t *deco_karnovsprites_device_config::alloc_device(running_machine &machine) const
|
||||
{
|
||||
return auto_alloc(machine, deco_karnovsprites_device(machine, *this));
|
||||
}
|
||||
|
||||
void deco_karnovsprites_device_config::set_gfx_region(device_config *device, int region)
|
||||
{
|
||||
deco_karnovsprites_device_config *dev = downcast<deco_karnovsprites_device_config *>(device);
|
||||
dev->m_gfxregion = region;
|
||||
}
|
||||
|
||||
|
||||
deco_karnovsprites_device::deco_karnovsprites_device(running_machine &_machine, const deco_karnovsprites_device_config &config)
|
||||
: device_t(_machine, config),
|
||||
m_config(config),
|
||||
m_gfxregion(m_config.m_gfxregion)
|
||||
{
|
||||
}
|
||||
|
||||
void deco_karnovsprites_device::device_start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void deco_karnovsprites_device::device_reset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void deco_karnovsprites_device::draw_sprites( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram, int size, int priority )
|
||||
{
|
||||
int offs;
|
||||
|
||||
for (offs = 0; offs < size; offs += 4)
|
||||
{
|
||||
int x, y, sprite, sprite2, colour, fx, fy, extra;
|
||||
|
||||
y = spriteram[offs];
|
||||
if (!(y & 0x8000))
|
||||
continue;
|
||||
|
||||
y = y & 0x1ff;
|
||||
sprite = spriteram[offs + 3];
|
||||
colour = sprite >> 12;
|
||||
|
||||
if (priority == 1 && (colour & 8)) continue;
|
||||
if (priority == 2 && !(colour & 8)) continue;
|
||||
|
||||
sprite = sprite & 0xfff;
|
||||
x = spriteram[offs + 2] & 0x1ff;
|
||||
|
||||
fx = spriteram[offs + 1];
|
||||
|
||||
// the 8-bit implementation had this, why?
|
||||
//if ((fx & 0x1) == 0) continue;
|
||||
|
||||
extra = (fx & 0x10) ? 1 : 0;
|
||||
fy = fx & 0x2;
|
||||
fx = fx & 0x4;
|
||||
|
||||
if (extra)
|
||||
{
|
||||
y = y + 16;
|
||||
sprite &= 0xffe; // taken from 8-bit version
|
||||
}
|
||||
|
||||
/* Convert the co-ords..*/
|
||||
x = (x + 16) % 0x200;
|
||||
y = (y + 16) % 0x200;
|
||||
x = 256 - x;
|
||||
y = 256 - y;
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 240 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
if (extra) y = y - 16;
|
||||
}
|
||||
|
||||
/* Y Flip determines order of multi-sprite */
|
||||
if (extra && fy)
|
||||
{
|
||||
sprite2 = sprite;
|
||||
sprite++;
|
||||
}
|
||||
else
|
||||
sprite2 = sprite + 1;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[m_gfxregion],
|
||||
sprite,
|
||||
colour,fx,fy,x,y,0);
|
||||
|
||||
/* 1 more sprite drawn underneath */
|
||||
if (extra)
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[m_gfxregion],
|
||||
sprite2,
|
||||
colour,fx,fy,x,y+16,0);
|
||||
}
|
||||
}
|
36
src/mame/video/deckarn.h
Normal file
36
src/mame/video/deckarn.h
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
|
||||
class deco_karnovsprites_device_config : public device_config
|
||||
{
|
||||
friend class deco_karnovsprites_device;
|
||||
deco_karnovsprites_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
|
||||
public:
|
||||
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
|
||||
virtual device_t *alloc_device(running_machine &machine) const;
|
||||
static void set_gfx_region(device_config *device, int region);
|
||||
|
||||
protected:
|
||||
UINT8 m_gfxregion;
|
||||
};
|
||||
|
||||
class deco_karnovsprites_device : public device_t
|
||||
{
|
||||
friend class deco_karnovsprites_device_config;
|
||||
deco_karnovsprites_device(running_machine &_machine, const deco_karnovsprites_device_config &config);
|
||||
public:
|
||||
void set_gfxregion(int region) { m_gfxregion = region; };
|
||||
void draw_sprites( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16* spriteram, int size, int priority );
|
||||
|
||||
protected:
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
const deco_karnovsprites_device_config &m_config;
|
||||
|
||||
UINT8 m_gfxregion;
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
const device_type deco_karnovsprites_ = deco_karnovsprites_device_config::static_alloc_device_config;
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "includes/karnov.h"
|
||||
#include "video/deckarn.h"
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -120,76 +121,13 @@ static void draw_background( running_machine &machine, bitmap_t *bitmap, const r
|
||||
copyscrollbitmap(bitmap, state->bitmap_f, 1, &scrollx, 1, &scrolly, cliprect);
|
||||
}
|
||||
|
||||
static void draw_sprites( running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
karnov_state *state = machine.driver_data<karnov_state>();
|
||||
UINT16 *buffered_spriteram16 = machine.generic.buffered_spriteram.u16;
|
||||
int offs;
|
||||
|
||||
for (offs = 0; offs <0x800; offs += 4)
|
||||
{
|
||||
int x, y, sprite, sprite2, colour, fx, fy, extra;
|
||||
|
||||
y = buffered_spriteram16[offs];
|
||||
if (!(y & 0x8000))
|
||||
continue;
|
||||
|
||||
y = y & 0x1ff;
|
||||
sprite = buffered_spriteram16[offs + 3];
|
||||
colour = sprite >> 12;
|
||||
sprite = sprite & 0xfff;
|
||||
x = buffered_spriteram16[offs + 2] & 0x1ff;
|
||||
|
||||
fx = buffered_spriteram16[offs + 1];
|
||||
extra = (fx & 0x10) ? 1 : 0;
|
||||
fy = fx & 0x2;
|
||||
fx = fx & 0x4;
|
||||
|
||||
if (extra)
|
||||
y = y + 16;
|
||||
|
||||
/* Convert the co-ords..*/
|
||||
x = (x + 16) % 0x200;
|
||||
y = (y + 16) % 0x200;
|
||||
x = 256 - x;
|
||||
y = 256 - y;
|
||||
if (state->flipscreen)
|
||||
{
|
||||
y = 240 - y;
|
||||
x = 240 - x;
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
if (extra) y = y - 16;
|
||||
}
|
||||
|
||||
/* Y Flip determines order of multi-sprite */
|
||||
if (extra && fy)
|
||||
{
|
||||
sprite2 = sprite;
|
||||
sprite++;
|
||||
}
|
||||
else
|
||||
sprite2 = sprite + 1;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
|
||||
sprite,
|
||||
colour,fx,fy,x,y,0);
|
||||
|
||||
/* 1 more sprite drawn underneath */
|
||||
if (extra)
|
||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
|
||||
sprite2,
|
||||
colour,fx,fy,x,y+16,0);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
SCREEN_UPDATE( karnov )
|
||||
{
|
||||
karnov_state *state = screen->machine().driver_data<karnov_state>();
|
||||
draw_background(screen->machine(), bitmap, cliprect);
|
||||
draw_sprites(screen->machine(), bitmap, cliprect);
|
||||
screen->machine().device<deco_karnovsprites_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, screen->machine().generic.buffered_spriteram.u16, 0x800, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->fix_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user