Converted Namco C40 road chip to a device. Updated users.

Added support for tilemaps to be passed a gfx pointer
instead of a gfxnum.
This commit is contained in:
Aaron Giles 2012-09-05 21:42:51 +00:00
parent 57384dee8d
commit 9532f488fc
10 changed files with 277 additions and 185 deletions

View File

@ -233,6 +233,7 @@ public:
void set_default_bios(UINT8 bios) { m_default_bios = bios; }
void set_system_bios(UINT8 bios) { m_system_bios = bios; }
protected:
// internal helper classes (defined below)
class finder_base;

View File

@ -415,6 +415,14 @@ struct tile_data
flags = _flags;
gfxnum = _gfxnum;
}
void set(running_machine &machine, const gfx_element &gfx, int rawcode, int rawcolor, int _flags)
{
int code = rawcode % gfx.total_elements;
pen_data = gfx_element_get_data(&gfx, code);
palette_base = gfx.color_base + gfx.color_granularity * rawcolor;
flags = _flags;
}
};

View File

@ -2,6 +2,15 @@
#include "includes/namcos2.h" /* for game-specific hacks */
#include "includes/namcoic.h"
//****************************************************************************
// CONSTANTS
//****************************************************************************
// device type definition
const device_type NAMCO_C45_ROAD = &device_creator<namco_c45_road_device>;
/**************************************************************************************/
static struct
{
@ -1278,185 +1287,193 @@ WRITE16_MEMBER( namcos2_shared_state::c169_roz_videoram_w )
* 0x1fe00..0x1ffdf ---- --xx xxxx xxxx zoomx
* 0x1fffd always 0xffff 0xffff?
*/
static UINT16 *mpRoadRAM; /* at 0x880000 in Final Lap; at 0xa00000 in Lucky&Wild */
static int mRoadGfxBank;
static tilemap_t *mpRoadTilemap;
static pen_t mRoadTransparentColor;
static int mbRoadNeedTransparent;
#define ROAD_COLS 64
#define ROAD_ROWS 512
#define ROAD_TILE_SIZE 16
#define ROAD_TILEMAP_WIDTH (ROAD_TILE_SIZE*ROAD_COLS)
#define ROAD_TILEMAP_HEIGHT (ROAD_TILE_SIZE*ROAD_ROWS)
#define ROAD_TILE_COUNT_MAX (0xfa00/0x40) /* 0x3e8 */
#define WORDS_PER_ROAD_TILE (0x40/2)
static const gfx_layout RoadTileLayout =
const gfx_layout namco_c45_road_device::s_tile_layout =
{
ROAD_TILE_SIZE, ROAD_TILE_SIZE,
ROAD_TILE_COUNT_MAX,
2,
{ NATIVE_ENDIAN_VALUE_LE_BE(8,0), NATIVE_ENDIAN_VALUE_LE_BE(0,8) },
{/* x offset */
{// x offset
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17
},
{/* y offset */
{// y offset
0x000,0x020,0x040,0x060,0x080,0x0a0,0x0c0,0x0e0,
0x100,0x120,0x140,0x160,0x180,0x1a0,0x1c0,0x1e0
},
0x200, /* offset to next tile */
0x200 // offset to next tile
};
static TILE_GET_INFO( get_road_info )
{
UINT16 data = mpRoadRAM[tile_index];
/* ------xx xxxxxxxx tile number
* xxxxxx-- -------- palette select
*/
int tile = (data&0x3ff);
int color = (data>>10);
//-------------------------------------------------
// namco_c45_road_device -- constructor
//-------------------------------------------------
SET_TILE_INFO( mRoadGfxBank, tile, color , 0 );
} /* get_road_info */
READ16_HANDLER( namco_road16_r )
namco_c45_road_device::namco_c45_road_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, NAMCO_C45_ROAD, "Namco C45 Road", tag, owner, clock),
m_transparent_color(~0),
m_gfx(NULL),
m_tilemap(NULL)
{
return mpRoadRAM[offset];
}
WRITE16_HANDLER( namco_road16_w )
//-------------------------------------------------
// read -- read from RAM
//-------------------------------------------------
READ16_MEMBER( namco_c45_road_device::read )
{
COMBINE_DATA( &mpRoadRAM[offset] );
if( offset<0x10000/2 )
{
mpRoadTilemap->mark_tile_dirty( offset );
}
return m_ram[offset];
}
//-------------------------------------------------
// write -- write to RAM
//-------------------------------------------------
WRITE16_MEMBER( namco_c45_road_device::write )
{
COMBINE_DATA(&m_ram[offset]);
// first half maps to the tilemap
if (offset < 0x10000/2)
m_tilemap->mark_tile_dirty(offset);
// second half maps to the gfx elements
else
{
offset -= 0x10000/2;
gfx_element_mark_dirty(space->machine().gfx[mRoadGfxBank], offset/WORDS_PER_ROAD_TILE);
gfx_element_mark_dirty(m_gfx, offset / WORDS_PER_ROAD_TILE);
}
}
void
namco_road_init(running_machine &machine, int gfxbank )
//-------------------------------------------------
// draw -- render to the target bitmap
//-------------------------------------------------
void namco_c45_road_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri)
{
gfx_element *pGfx;
const UINT8 *clut = (const UINT8 *)memregion("clut")->base();
bitmap_ind16 &source_bitmap = m_tilemap->pixmap();
unsigned yscroll = m_ram[0x1fdfe/2];
mbRoadNeedTransparent = 0;
mRoadGfxBank = gfxbank;
// loop over scanlines
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
{
// skip if we are not the right priority
int screenx = m_ram[0x1fa00/2 + y + 15];
if (pri != ((screenx & 0xf000) >> 12))
continue;
mpRoadRAM = auto_alloc_array(machine, UINT16, 0x20000/2);
// skip if we don't have a valid zoom factor
unsigned zoomx = m_ram[0x1fe00/2 + y + 15] & 0x3ff;
if (zoomx == 0)
continue;
pGfx = gfx_element_alloc( machine, &RoadTileLayout, 0x10000+(UINT8 *)mpRoadRAM, 0x3f, 0xf00);
// skip if we don't have a valid source increment
unsigned sourcey = m_ram[0x1fc00/2 + y + 15] + yscroll;
const UINT16 *source_gfx = &source_bitmap.pix(sourcey & (ROAD_TILEMAP_HEIGHT - 1));
unsigned dsourcex = (ROAD_TILEMAP_WIDTH << 16) / zoomx;
if (dsourcex == 0)
continue;
machine.gfx[gfxbank] = pGfx;
mpRoadTilemap = tilemap_create(machine,
get_road_info,TILEMAP_SCAN_ROWS,
ROAD_TILE_SIZE,ROAD_TILE_SIZE,
ROAD_COLS,ROAD_ROWS);
// mask off priority bits and sign-extend
screenx &= 0x0fff;
if (screenx & 0x0800)
screenx |= ~0x7ff;
state_save_register_global_pointer(machine, mpRoadRAM, 0x20000 / 2);
} /* namco_road_init */
// adjust the horizontal placement
screenx -= 64; // needs adjustment to left
void
namco_road_set_transparent_color(pen_t pen)
{
mbRoadNeedTransparent = 1;
mRoadTransparentColor = pen;
int numpixels = (44 * ROAD_TILE_SIZE << 16) / dsourcex;
unsigned sourcex = 0;
// crop left
int clip_pixels = cliprect.min_x - screenx;
if (clip_pixels > 0)
{
numpixels -= clip_pixels;
sourcex += dsourcex*clip_pixels;
screenx = cliprect.min_x;
}
// crop right
clip_pixels = (screenx + numpixels) - (cliprect.max_x + 1);
if (clip_pixels > 0)
numpixels -= clip_pixels;
// TBA: work out palette mapping for Final Lap, Suzuka
// BUT: support transparent color for Thunder Ceptor
UINT16 *dest = &bitmap.pix(y);
if (m_transparent_color != ~0)
{
while (numpixels-- > 0)
{
int pen = source_gfx[sourcex >> 16];
if (colortable_entry_get_value(machine().colortable, pen) != m_transparent_color)
{
if (clut != NULL)
pen = (pen & ~0xff) | clut[pen & 0xff];
dest[screenx] = pen;
}
screenx++;
sourcex += dsourcex;
}
}
else
{
while (numpixels-- > 0)
{
int pen = source_gfx[sourcex >> 16];
if (clut != NULL)
pen = (pen & ~0xff) | clut[pen & 0xff];
dest[screenx++] = pen;
sourcex += dsourcex;
}
}
}
}
void
namco_road_draw(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri )
//-------------------------------------------------
// device_start -- device startup
//-------------------------------------------------
void namco_c45_road_device::device_start()
{
const UINT8 *clut = (const UINT8 *)machine.root_device().memregion("user3")->base();
unsigned yscroll;
int i;
// create a gfx_element describing the road graphics
m_gfx = gfx_element_alloc(machine(), &s_tile_layout, 0x10000 + (UINT8 *)&m_ram[0], 0x3f, 0xf00);
bitmap_ind16 &SourceBitmap = mpRoadTilemap->pixmap();
yscroll = mpRoadRAM[0x1fdfe/2];
// create a tilemap for the road
m_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(namco_c45_road_device::get_road_info), this),
TILEMAP_SCAN_ROWS, ROAD_TILE_SIZE, ROAD_TILE_SIZE, ROAD_COLS, ROAD_ROWS);
}
for( i=cliprect.min_y; i<=cliprect.max_y; i++ )
{
int screenx = mpRoadRAM[0x1fa00/2+i+15];
if( pri == ((screenx&0xf000)>>12) )
{
unsigned zoomx = mpRoadRAM[0x1fe00/2+i+15]&0x3ff;
if( zoomx )
{
unsigned sourcey = mpRoadRAM[0x1fc00/2+i+15]+yscroll;
const UINT16 *pSourceGfx = &SourceBitmap.pix16(sourcey&(ROAD_TILEMAP_HEIGHT-1));
unsigned dsourcex = (ROAD_TILEMAP_WIDTH<<16)/zoomx;
if( dsourcex )
{
UINT16 *pDest = &bitmap.pix16(i);
unsigned sourcex = 0;
int numpixels = (44*ROAD_TILE_SIZE<<16)/dsourcex;
int clipPixels;
screenx &= 0x0fff; /* mask off priority bits */
if( screenx&0x0800 )
{
/* sign extend */
screenx |= ~0x7ff;
}
//-------------------------------------------------
// device_stop -- device shutdown
//-------------------------------------------------
/* adjust the horizontal placement */
screenx -= 64; /*needs adjustment to left*/
void namco_c45_road_device::device_stop()
{
gfx_element_free(m_gfx);
}
clipPixels = cliprect.min_x - screenx;
if( clipPixels>0 )
{ /* crop left */
numpixels -= clipPixels;
sourcex += dsourcex*clipPixels;
screenx = cliprect.min_x;
}
clipPixels = (screenx+numpixels) - (cliprect.max_x+1);
if( clipPixels>0 )
{ /* crop right */
numpixels -= clipPixels;
}
//-------------------------------------------------
// get_road_info -- tilemap callback
//-------------------------------------------------
/* TBA: work out palette mapping for Final Lap, Suzuka */
TILE_GET_INFO_MEMBER( namco_c45_road_device::get_road_info )
{
// ------xx xxxxxxxx tile number
// xxxxxx-- -------- palette select
UINT16 data = m_ram[tile_index];
int tile = data & 0x3ff;
int color = data >> 10;
SET_TILE_INFO_MEMBER(*m_gfx, tile, color, 0);
}
/* BUT: support transparent color for Thunder Ceptor */
if( mbRoadNeedTransparent )
{
while( numpixels-- > 0 )
{
int pen = pSourceGfx[sourcex>>16];
if(colortable_entry_get_value(machine.colortable, pen) != mRoadTransparentColor)
{
if( clut )
{
pen = (pen&~0xff)|clut[pen&0xff];
}
pDest[screenx] = pen;
}
screenx++;
sourcex += dsourcex;
}
}
else
{
while( numpixels-- > 0 )
{
int pen = pSourceGfx[sourcex>>16];
if( clut )
{
pen = (pen&~0xff)|clut[pen&0xff];
}
pDest[screenx++] = pen;
sourcex += dsourcex;
}
}
} /* dsourcex!=0 */
} /* zoomx!=0 */
} /* priority */
} /* next scanline */
} /* namco_road_draw */

View File

@ -631,7 +631,7 @@ static ADDRESS_MAP_START( common_finallap_am, AS_PROGRAM, 16, namcos2_state )
AM_RANGE(0x300000, 0x33ffff) AM_READ_LEGACY(namcos2_flap_prot_r)
AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0x840000, 0x840001) AM_READWRITE(gfx_ctrl_r, gfx_ctrl_w)
AM_RANGE(0x880000, 0x89ffff) AM_READ_LEGACY(namco_road16_r) AM_WRITE_LEGACY(namco_road16_w)
AM_RANGE(0x880000, 0x89ffff) AM_DEVREADWRITE("c45_road", namco_c45_road_device, read, write)
AM_RANGE(0x8c0000, 0x8c0001) AM_WRITENOP
AM_IMPORT_FROM( namcos2_68k_default_cpu_board_am )
ADDRESS_MAP_END
@ -708,7 +708,7 @@ static ADDRESS_MAP_START( common_luckywld_am, AS_PROGRAM, 16, namcos2_state )
AM_RANGE(0x81a000, 0x81a001) AM_WRITENOP /* enable? */
AM_RANGE(0x840000, 0x840001) AM_READNOP
AM_RANGE(0x900000, 0x900007) AM_READWRITE(c355_obj_position_r,c355_obj_position_w)
AM_RANGE(0xa00000, 0xa1ffff) AM_READWRITE_LEGACY(namco_road16_r,namco_road16_w)
AM_RANGE(0xa00000, 0xa1ffff) AM_DEVREADWRITE("c45_road", namco_c45_road_device, read, write)
AM_RANGE(0xc00000, 0xc0ffff) AM_READWRITE(c169_roz_videoram_r,c169_roz_videoram_w) AM_SHARE("rozvideoram")
AM_RANGE(0xd00000, 0xd0001f) AM_READWRITE(c169_roz_control_r,c169_roz_control_w)
AM_RANGE(0xf00000, 0xf00007) AM_READWRITE_LEGACY(namcos2_68k_key_r,namcos2_68k_key_w)
@ -1761,6 +1761,8 @@ static MACHINE_CONFIG_START( finallap, namcos2_state )
MCFG_VIDEO_START_OVERRIDE(namcos2_state, video_start_finallap)
MCFG_NAMCO_C45_ROAD_ADD("c45_road")
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_SOUND_ADD("c140", C140, C140_SOUND_CLOCK) /* 21.333kHz */
@ -1859,6 +1861,8 @@ static MACHINE_CONFIG_START( luckywld, namcos2_state )
MCFG_VIDEO_START_OVERRIDE(namcos2_state, video_start_luckywld)
MCFG_NAMCO_C45_ROAD_ADD("c45_road")
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_SOUND_ADD("c140", C140, C140_SOUND_CLOCK) /* 21.333kHz */
@ -2509,7 +2513,7 @@ ROM_START( finallap )
ROM_REGION16_BE( 0x200000, "user1", ROMREGION_ERASEFF ) /* Shared data roms */
/* No DAT files present in ZIP archive */
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "fl1-3.5b", 0, 0x100, CRC(d179d99a) SHA1(4e64f284c74d2b77f893bd28aaa6489084056aa2) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -2564,7 +2568,7 @@ ROM_START( finallapd )
ROM_REGION16_BE( 0x200000, "user1", ROMREGION_ERASEFF ) /* Shared data roms */
/* No DAT files present in ZIP archive */
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "fl1-3.5b", 0, 0x100, CRC(d179d99a) SHA1(4e64f284c74d2b77f893bd28aaa6489084056aa2) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -2619,7 +2623,7 @@ ROM_START( finallapc )
ROM_REGION16_BE( 0x200000, "user1", ROMREGION_ERASEFF ) /* Shared data roms */
/* No DAT files present in ZIP archive */
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "fl1-3.5b", 0, 0x100, CRC(d179d99a) SHA1(4e64f284c74d2b77f893bd28aaa6489084056aa2) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -2674,7 +2678,7 @@ ROM_START( finallapjc )
ROM_REGION16_BE( 0x200000, "user1", ROMREGION_ERASEFF ) /* Shared data roms */
/* No DAT files present in ZIP archive */
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "fl1-3.5b", 0, 0x100, CRC(d179d99a) SHA1(4e64f284c74d2b77f893bd28aaa6489084056aa2) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -2729,7 +2733,7 @@ ROM_START( finallapjb )
ROM_REGION16_BE( 0x200000, "user1", ROMREGION_ERASEFF ) /* Shared data roms */
/* No DAT files present in ZIP archive */
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "fl1-3.5b", 0, 0x100, CRC(d179d99a) SHA1(4e64f284c74d2b77f893bd28aaa6489084056aa2) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -2788,7 +2792,7 @@ ROM_START( finalap2 )
NAMCOS2_DATA_LOAD_E_256K( "fls2dat0", 0x000000, CRC(f1af432c) SHA1(c514261a49ceb5c3ba0246519ba5d02e9a20d950) )
NAMCOS2_DATA_LOAD_O_256K( "fls2dat1", 0x000000, CRC(8719533e) SHA1(98d2767da6f7f67da7af15e8cfed95adb04b7427) )
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "fl1-3.5b", 0, 0x100, CRC(d179d99a) SHA1(4e64f284c74d2b77f893bd28aaa6489084056aa2) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -2845,7 +2849,7 @@ ROM_START( finalap2j )
NAMCOS2_DATA_LOAD_E_256K( "fls2dat0", 0x000000, CRC(f1af432c) SHA1(c514261a49ceb5c3ba0246519ba5d02e9a20d950) )
NAMCOS2_DATA_LOAD_O_256K( "fls2dat1", 0x000000, CRC(8719533e) SHA1(98d2767da6f7f67da7af15e8cfed95adb04b7427) )
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "fl1-3.5b", 0, 0x100, CRC(d179d99a) SHA1(4e64f284c74d2b77f893bd28aaa6489084056aa2) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -2902,7 +2906,7 @@ ROM_START( finalap3 ) // this set displays MOTION (Ver. 3) in the test mode menu
NAMCOS2_DATA_LOAD_E_128K( "flt1d0", 0x000000, CRC(80004966) SHA1(112b2a9b0ea792d5dbff1b9cf904da788aeede29) )
NAMCOS2_DATA_LOAD_O_128K( "flt1d1", 0x000000, CRC(a2e93e8c) SHA1(9c8a5431a79153a70eb6939d16e0a5a6be235e75) )
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "fl1-3.5b", 0, 0x100, CRC(d179d99a) SHA1(4e64f284c74d2b77f893bd28aaa6489084056aa2) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -2963,7 +2967,7 @@ ROM_START( finalap3a )
NAMCOS2_DATA_LOAD_E_128K( "flt1d0", 0x000000, CRC(80004966) SHA1(112b2a9b0ea792d5dbff1b9cf904da788aeede29) )
NAMCOS2_DATA_LOAD_O_128K( "flt1d1", 0x000000, CRC(a2e93e8c) SHA1(9c8a5431a79153a70eb6939d16e0a5a6be235e75) )
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "fl1-3.5b", 0, 0x100, CRC(d179d99a) SHA1(4e64f284c74d2b77f893bd28aaa6489084056aa2) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -3027,7 +3031,7 @@ ROM_START( finalap3j )
NAMCOS2_DATA_LOAD_E_128K( "flt1d0", 0x000000, CRC(80004966) SHA1(112b2a9b0ea792d5dbff1b9cf904da788aeede29) )
NAMCOS2_DATA_LOAD_O_128K( "flt1d1", 0x000000, CRC(a2e93e8c) SHA1(9c8a5431a79153a70eb6939d16e0a5a6be235e75) )
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "fl1-3.5b", 0, 0x100, CRC(d179d99a) SHA1(4e64f284c74d2b77f893bd28aaa6489084056aa2) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -3089,7 +3093,7 @@ ROM_START( finalap3jc )
NAMCOS2_DATA_LOAD_E_128K( "flt1_d0.13s", 0x000000, CRC(80004966) SHA1(112b2a9b0ea792d5dbff1b9cf904da788aeede29) )
NAMCOS2_DATA_LOAD_O_128K( "flt1_d1.13p", 0x000000, CRC(a2e93e8c) SHA1(9c8a5431a79153a70eb6939d16e0a5a6be235e75) )
ROM_REGION( 0x100, "user3", 0 ) /* PROM for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* PROM for road colors */
ROM_LOAD( "fl1_3.5b", 0, 0x100, CRC(d179d99a) SHA1(4e64f284c74d2b77f893bd28aaa6489084056aa2) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -3376,7 +3380,7 @@ ROM_START( fourtrax )
NAMCOS2_DATA_LOAD_E_256K( "fx_dat2.13p", 0x100000, CRC(71e4a5a0) SHA1(a0188c920a43c5e69e25464627094b6b6ed26a59) )
NAMCOS2_DATA_LOAD_O_256K( "fx_dat3.13n", 0x100000, CRC(605725f7) SHA1(b94ce0ec37f879a5e46a097058cb2dd57e2281f1) )
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "fx1_1.5b", 0, 0x100, CRC(85ffd753) SHA1(7dbc8c295204877f41289141a146aa4f5f9f9c96) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -4383,7 +4387,7 @@ ROM_START( suzuka8h )
NAMCOS2_DATA_LOAD_O_256K( "eh1-d1.bin", 0x000000, CRC(9825D5BF) SHA1(720F0E90C69A2E0C48889D510A15102768226A67) )
NAMCOS2_DATA_LOAD_O_256K( "eh1-d3.bin", 0x100000, CRC(F46D301F) SHA1(70797FD584735844539553EFCAD53E11239EC10E) )
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "ehs1_landdt.10w", 0, 0x100, CRC(cde7e8a6) SHA1(860273daf2e649418746adf50a67ae33f9f3740c) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -4435,7 +4439,7 @@ ROM_START( suzuka8hj )
NAMCOS2_DATA_LOAD_O_256K( "eh1-d1.bin", 0x000000, CRC(9825d5bf) SHA1(720f0e90c69a2e0c48889d510a15102768226a67) )
NAMCOS2_DATA_LOAD_O_256K( "eh1-d3.bin", 0x100000, CRC(f46d301f) SHA1(70797fd584735844539553efcad53e11239ec10e) )
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "ehs1_landdt.10w", 0, 0x100, CRC(cde7e8a6) SHA1(860273daf2e649418746adf50a67ae33f9f3740c) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -4495,7 +4499,7 @@ ROM_START( suzuk8h2 )
NAMCOS2_DATA_LOAD_E_512K( "ehs1-dat2.13p", 0x100000, CRC(087da1f3) SHA1(e9c4ba0383e883502c0f45ae6e6d5daba4eccb01) )
NAMCOS2_DATA_LOAD_O_512K( "ehs1-dat3.13n", 0x100000, CRC(85aecb3f) SHA1(00ab6104dee0cd0fbdb0235b88b41e4d26794f98) )
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "ehs1-landdt.10w", 0, 0x100, CRC(cde7e8a6) SHA1(860273daf2e649418746adf50a67ae33f9f3740c) )
ROM_REGION( 0x100000, "c140", 0 ) /* Sound voices */
@ -4928,7 +4932,7 @@ ROM_START( luckywld )
ROM_LOAD( "lw1voi1.3m", 0x000000, 0x080000, CRC(b3e57993) SHA1(ff7071fc2e2c00f0cf819860c2a9be353474920a) )
ROM_LOAD( "lw1voi2.3l", 0x080000, 0x080000, CRC(cd8b86a2) SHA1(54bbc91e995ea0c33874ce6fe5c3f014e173da07) )
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "lw1ld8.10w", 0, 0x100, CRC(29058c73) SHA1(4916d6bdb7f78e6803698cab32d1586ea457dfc8) )
ROM_REGION( 0x2000, "nvram", 0 ) /* default settings, including calibration - see notes with inputs */
@ -4994,7 +4998,7 @@ ROM_START( luckywldj )
ROM_LOAD( "lw1voi1.3m", 0x000000, 0x080000, CRC(b3e57993) SHA1(ff7071fc2e2c00f0cf819860c2a9be353474920a) )
ROM_LOAD( "lw1voi2.3l", 0x080000, 0x080000, CRC(cd8b86a2) SHA1(54bbc91e995ea0c33874ce6fe5c3f014e173da07) )
ROM_REGION( 0x100, "user3", 0 ) /* prom for road colors */
ROM_REGION( 0x100, "c45_road:clut", 0 ) /* prom for road colors */
ROM_LOAD( "lw1ld8.10w", 0, 0x100, CRC(29058c73) SHA1(4916d6bdb7f78e6803698cab32d1586ea457dfc8) )
ROM_REGION( 0x2000, "nvram", 0 ) /* default settings, including calibration - see notes with inputs */

View File

@ -204,7 +204,7 @@ static ADDRESS_MAP_START( m68k_map, AS_PROGRAM, 16, tceptor_state )
AM_RANGE(0x200000, 0x203fff) AM_RAM // M68K ERROR 0
AM_RANGE(0x300000, 0x300001) AM_WRITEONLY
AM_RANGE(0x400000, 0x4001ff) AM_WRITEONLY AM_SHARE("sprite_ram")
AM_RANGE(0x500000, 0x51ffff) AM_WRITE_LEGACY(namco_road16_w)
AM_RANGE(0x500000, 0x51ffff) AM_DEVWRITE("c45_road", namco_c45_road_device, write)
AM_RANGE(0x600000, 0x600001) AM_WRITE(m68k_irq_enable_w) // not sure
AM_RANGE(0x700000, 0x703fff) AM_READWRITE(m68k_shared_word_r, m68k_shared_word_w) AM_SHARE("m68k_shared_ram")
ADDRESS_MAP_END
@ -395,6 +395,8 @@ static MACHINE_CONFIG_START( tceptor, tceptor_state )
MCFG_PALETTE_LENGTH(4096)
MCFG_DEFAULT_LAYOUT(layout_horizont)
MCFG_NAMCO_C45_ROAD_ADD("c45_road")
MCFG_SCREEN_ADD("2dscreen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60.606060)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))

View File

@ -88,6 +88,74 @@ C102 - Controls CPU access to ROZ Memory Area.
/***********************************************************************************/
#pragma once
#ifndef __NAMCOIC_H__
#define __NAMCOIC_H__
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_NAMCO_C45_ROAD_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, NAMCO_C45_ROAD, 0) \
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> namco_c45_road_device
class namco_c45_road_device : public device_t
{
// constants
static const int ROAD_COLS = 64;
static const int ROAD_ROWS = 512;
static const int ROAD_TILE_SIZE = 16;
static const int ROAD_TILEMAP_WIDTH = ROAD_TILE_SIZE * ROAD_COLS;
static const int ROAD_TILEMAP_HEIGHT = ROAD_TILE_SIZE * ROAD_ROWS;
static const int ROAD_TILE_COUNT_MAX = 0xfa00 / 0x40; // 0x3e8
static const int WORDS_PER_ROAD_TILE = 0x40/2;
public:
// construction/destruction
namco_c45_road_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// read/write handlers
DECLARE_READ16_MEMBER( read );
DECLARE_WRITE16_MEMBER( write );
// C45 Land (Road) Emulation
void set_transparent_color(pen_t pen) { m_transparent_color = pen; }
void draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri);
protected:
// device-level overrides
virtual void device_start();
virtual void device_stop();
// internal helpers
TILE_GET_INFO_MEMBER( get_road_info );
// internal state
pen_t m_transparent_color;
gfx_element * m_gfx;
tilemap_t * m_tilemap;
UINT16 m_ram[0x20000/2]; // at 0x880000 in Final Lap; at 0xa00000 in Lucky&Wild
static const gfx_layout s_tile_layout;
};
// device type definition
extern const device_type NAMCO_C45_ROAD;
/*----------- defined in drivers/namcoic.c -----------*/
void namco_tilemap_init(
@ -112,14 +180,4 @@ WRITE32_HANDLER( namco_tilemapcontrol32_le_w );
/***********************************************************************************/
/***********************************************************************************/
/* C45 Land (Road) Emulation */
void namco_road_init( running_machine &machine, int gfxbank );
void namco_road_set_transparent_color(pen_t pen);
void namco_road_draw( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri );
READ16_HANDLER( namco_road16_r );
WRITE16_HANDLER( namco_road16_w );
/***********************************************************************************/
#endif

View File

@ -6,6 +6,8 @@
***************************************************************************/
#include "namcoic.h"
/* CPU reference numbers */
#define CPU_MASTER 0
@ -85,6 +87,7 @@ enum
NAMCOFL_FINAL_LAP_R
};
// fix me -- most of this should be devices eventually
class namcos2_shared_state : public driver_device
{
@ -165,7 +168,6 @@ protected:
int m_c355_obj_palxor;
UINT16 m_c355_obj_position[4];
public:
// general
void zdrawgfxzoom(bitmap_ind16 &dest_bmp, const rectangle &clip, const gfx_element *gfx, UINT32 code, UINT32 color, int flipx, int flipy, int sx, int sy, int scalex, int scaley, int zpos);
@ -181,7 +183,8 @@ public:
m_paletteram(*this, "paletteram"),
m_spriteram(*this, "spriteram"),
m_rozram(*this, "rozram"),
m_roz_ctrl(*this, "rozctrl")
m_roz_ctrl(*this, "rozctrl"),
m_c45_road(*this, "c45_road")
{ }
DECLARE_READ16_MEMBER(dpram_word_r);
DECLARE_WRITE16_MEMBER(dpram_word_w);
@ -260,6 +263,7 @@ public:
tilemap_t *m_tilemap_roz;
UINT16 m_gfx_ctrl;
optional_device<namco_c45_road_device> m_c45_road;
};
/*----------- defined in video/namcos2.c -----------*/

View File

@ -1,3 +1,5 @@
#include "namcos2.h"
class tceptor_state : public driver_device
{
public:
@ -7,7 +9,8 @@ public:
m_tile_attr(*this, "tile_attr"),
m_bg_ram(*this, "bg_ram"),
m_m68k_shared_ram(*this, "m68k_shared_ram"),
m_sprite_ram(*this, "sprite_ram"){ }
m_sprite_ram(*this, "sprite_ram"),
m_c45_road(*this, "c45_road") { }
UINT8 m_m6809_irq_enable;
UINT8 m_m68k_irq_enable;
@ -48,6 +51,8 @@ public:
DECLARE_WRITE8_MEMBER(tceptor_bg_scroll_w);
void tile_mark_dirty(int offset);
DECLARE_WRITE8_MEMBER(voice_w);
optional_device<namco_c45_road_device> m_c45_road;
};

View File

@ -448,7 +448,6 @@ void namcos2_state::video_start_finallap()
{
namco_tilemap_init(machine(),2,memregion("gfx4")->base(),TilemapCB);
draw_sprite_init();
namco_road_init(machine(), 3);
}
UINT32 namcos2_state::screen_update_finallap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@ -466,7 +465,7 @@ UINT32 namcos2_state::screen_update_finallap(screen_device &screen, bitmap_ind16
{
namco_tilemap_draw( bitmap, clip, pri/2 );
}
namco_road_draw(machine(), bitmap,clip,pri );
m_c45_road->draw(bitmap,clip,pri);
draw_sprites(bitmap,clip,pri,m_gfx_ctrl );
}
return 0;
@ -482,10 +481,6 @@ void namcos2_state::video_start_luckywld()
{
c169_roz_init(1, "gfx5");
}
if( m_gametype!=NAMCOS2_STEEL_GUNNER_2 )
{
namco_road_init(machine(), 3);
}
} /* luckywld */
UINT32 namcos2_state::screen_update_luckywld(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@ -503,7 +498,7 @@ UINT32 namcos2_state::screen_update_luckywld(screen_device &screen, bitmap_ind16
{
namco_tilemap_draw( bitmap, clip, pri/2 );
}
namco_road_draw(machine(), bitmap,clip,pri );
m_c45_road->draw(bitmap,clip,pri);
if( m_gametype==NAMCOS2_LUCKY_AND_WILD )
{
c169_roz_draw(bitmap, clip, pri);

View File

@ -393,9 +393,7 @@ VIDEO_START( tceptor )
/* allocate temp bitmaps */
machine.primary_screen->register_screen_bitmap(state->m_temp_bitmap);
namco_road_init(machine, gfx_index);
namco_road_set_transparent_color(colortable_entry_get_value(machine.colortable, 0xfff));
state->m_c45_road->set_transparent_color(colortable_entry_get_value(machine.colortable, 0xfff));
state->m_tx_tilemap = tilemap_create(machine, get_tx_tile_info, TILEMAP_SCAN_COLS, 8, 8, 34, 28);
@ -540,8 +538,8 @@ SCREEN_UPDATE_IND16( tceptor_2d )
for (pri = 0; pri < 8; pri++)
{
namco_road_draw(screen.machine(), bitmap, cliprect, pri * 2);
namco_road_draw(screen.machine(), bitmap, cliprect, pri * 2 + 1);
state->m_c45_road->draw(bitmap, cliprect, pri * 2);
state->m_c45_road->draw(bitmap, cliprect, pri * 2 + 1);
draw_sprites(screen.machine(), bitmap, cliprect, pri);
}