summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/megadrive/jcart.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/megadrive/jcart.cpp')
-rw-r--r--src/devices/bus/megadrive/jcart.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/devices/bus/megadrive/jcart.cpp b/src/devices/bus/megadrive/jcart.cpp
index e3182fca414..43d38e50a60 100644
--- a/src/devices/bus/megadrive/jcart.cpp
+++ b/src/devices/bus/megadrive/jcart.cpp
@@ -40,7 +40,7 @@ const device_type MD_SEPROM_CODEMAST = &device_creator<md_seprom_codemast_device
const device_type MD_SEPROM_MM96 = &device_creator<md_seprom_mm96_device>;
// Sampras, Super Skidmarks?
-md_jcart_device::md_jcart_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
+md_jcart_device::md_jcart_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_md_cart_interface( mconfig, *this ),
m_jcart3(*this, "JCART3"),
@@ -48,7 +48,7 @@ md_jcart_device::md_jcart_device(const machine_config &mconfig, device_type type
{
}
-md_jcart_device::md_jcart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+md_jcart_device::md_jcart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MD_JCART, "MD J-Cart games", tag, owner, clock, "md_jcart", __FILE__),
device_md_cart_interface( mconfig, *this ),
m_jcart3(*this, "JCART3"),
@@ -57,20 +57,20 @@ md_jcart_device::md_jcart_device(const machine_config &mconfig, const char *tag,
}
// Micro Machines 2, Micro Machines Military
-md_seprom_codemast_device::md_seprom_codemast_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
+md_seprom_codemast_device::md_seprom_codemast_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source)
: md_jcart_device(mconfig, type, name, tag, owner, clock, shortname, source),
m_i2cmem(*this, "i2cmem"), m_i2c_mem(0), m_i2c_clk(0)
{
}
-md_seprom_codemast_device::md_seprom_codemast_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+md_seprom_codemast_device::md_seprom_codemast_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: md_jcart_device(mconfig, MD_SEPROM_CODEMAST, "MD J-Cart games + SEPROM", tag, owner, clock, "md_seprom_codemast", __FILE__),
m_i2cmem(*this, "i2cmem"), m_i2c_mem(0), m_i2c_clk(0)
{
}
// Micro Machines 96
-md_seprom_mm96_device::md_seprom_mm96_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+md_seprom_mm96_device::md_seprom_mm96_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: md_seprom_codemast_device(mconfig, MD_SEPROM_MM96, "MD Micro Machine 96", tag, owner, clock, "md_seprom_mm96", __FILE__)
{
}
@@ -176,7 +176,7 @@ READ16_MEMBER(md_jcart_device::read)
{
if (offset == 0x38fffe/2)
{
- UINT8 joy[2];
+ uint8_t joy[2];
if (m_jcart_io_data[0] & 0x40)
{
@@ -219,7 +219,7 @@ READ16_MEMBER(md_seprom_codemast_device::read)
}
if (offset == 0x38fffe/2)
{
- UINT8 joy[2];
+ uint8_t joy[2];
if (m_jcart_io_data[0] & 0x40)
{
='#n218'>218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
/***************************************************************************

  Dec0 Video emulation - Bryan McPhail, mish@tendril.co.uk

*********************************************************************/

#include "emu.h"
#include "includes/dec0.h"
#include "video/decbac06.h"
#include "video/decmxc06.h"

/******************************************************************************/

WRITE16_HANDLER( dec0_update_sprites_w )
{
	dec0_state *state = space->machine().driver_data<dec0_state>();
	memcpy(state->m_buffered_spriteram,state->m_spriteram,0x800);
}

/******************************************************************************/

static void update_24bitcol(running_machine &machine, int offset)
{
	int r,g,b;

	r = (machine.generic.paletteram.u16[offset] >> 0) & 0xff;
	g = (machine.generic.paletteram.u16[offset] >> 8) & 0xff;
	b = (machine.generic.paletteram2.u16[offset] >> 0) & 0xff;

	palette_set_color(machine,offset,MAKE_RGB(r,g,b));
}

WRITE16_HANDLER( dec0_paletteram_rg_w )
{
	COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]);
	update_24bitcol(space->machine(), offset);
}

WRITE16_HANDLER( dec0_paletteram_b_w )
{
	COMBINE_DATA(&space->machine().generic.paletteram2.u16[offset]);
	update_24bitcol(space->machine(), offset);
}

/******************************************************************************/


SCREEN_UPDATE( hbarrel )
{
	dec0_state *state = screen->machine().driver_data<dec0_state>();

	flip_screen_set(screen->machine(), screen->machine().device<deco_bac06_device>("tilegen1")->get_flip_state());

	screen->machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
	screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, 0x08, 0x0f);
	screen->machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);

	/* HB always keeps pf2 on top of pf3, no need explicitly support priority register */

	screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, 0x00, 0x0f);
	screen->machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
	return 0;
}

/******************************************************************************/

SCREEN_UPDATE( baddudes )
{
	dec0_state *state = screen->machine().driver_data<dec0_state>();
	flip_screen_set(screen->machine(), screen->machine().device<deco_bac06_device>("tilegen1")->get_flip_state());

	/* WARNING: inverted wrt Midnight Resistance */
	if ((state->m_pri & 0x01) == 0)
	{
		screen->machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
		screen->machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);

		if (state->m_pri & 2)
			screen->machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */

		screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f);

		if (state->m_pri & 4)
			screen->machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */
	}
	else
	{
		screen->machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
		screen->machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);

		if (state->m_pri & 2)
			screen->machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */

		screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f);

		if (state->m_pri & 4)
			screen->machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */
	}

	screen->machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
	return 0;
}

/******************************************************************************/

SCREEN_UPDATE( robocop )
{
	dec0_state *state = screen->machine().driver_data<dec0_state>();
	int trans;

	flip_screen_set(screen->machine(), screen->machine().device<deco_bac06_device>("tilegen1")->get_flip_state());

	if (state->m_pri & 0x04)
		trans = 0x08;
	else
		trans = 0x00;

	if (state->m_pri & 0x01)
	{
		/* WARNING: inverted wrt Midnight Resistance */
		/* Robocop uses it only for the title screen, so this might be just */
		/* completely wrong. The top 8 bits of the register might mean */
		/* something (they are 0x80 in midres, 0x00 here) */
		screen->machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);

		if (state->m_pri & 0x02)
			screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans, 0x0f);

		screen->machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
	}
	else
	{
		screen->machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);

		if (state->m_pri & 0x02)
			screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans, 0x0f);

		screen->machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
	}

	if (state->m_pri & 0x02)
		screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans^0x08, 0x0f);
	else
		screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f);

	screen->machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
	return 0;
}

/******************************************************************************/

SCREEN_UPDATE( birdtry )
{
	dec0_state *state = screen->machine().driver_data<dec0_state>();

	flip_screen_set(screen->machine(), screen->machine().device<deco_bac06_device>("tilegen1")->get_flip_state());

	/* This game doesn't have the extra playfield chip on the game board, but
    the palette does show through. */
	bitmap_fill(bitmap,cliprect,screen->machine().pens[768]);
	screen->machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
	screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f);
	screen->machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
	return 0;
}

/******************************************************************************/

SCREEN_UPDATE( hippodrm )
{
	dec0_state *state = screen->machine().driver_data<dec0_state>();
	flip_screen_set(screen->machine(), screen->machine().device<deco_bac06_device>("tilegen1")->get_flip_state());

	if (state->m_pri & 0x01)
	{
		screen->machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
		screen->machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
	}
	else
	{
		screen->machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
		screen->machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
	}

	screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f);
	screen->machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
	return 0;
}

/******************************************************************************/

SCREEN_UPDATE( slyspy )
{
	dec0_state *state = screen->machine().driver_data<dec0_state>();
	flip_screen_set(screen->machine(), screen->machine().device<deco_bac06_device>("tilegen1")->get_flip_state());

	screen->machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
	screen->machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);

	screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f);

	/* Redraw top 8 pens of top 8 palettes over sprites */
	if (state->m_pri&0x80)
		screen->machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0,0x08,0x08,0x08,0x08); // upper 8 pens of upper 8 priority marked tiles

	screen->machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
	return 0;
}

/******************************************************************************/

SCREEN_UPDATE( midres )
{
	dec0_state *state = screen->machine().driver_data<dec0_state>();
	int trans;

	flip_screen_set(screen->machine(), screen->machine().device<deco_bac06_device>("tilegen1")->get_flip_state());

	if (state->m_pri & 0x04)
		trans = 0x00;
	else trans = 0x08;

	if (state->m_pri & 0x01)
	{
		screen->machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);

		if (state->m_pri & 0x02)
			screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans, 0x0f);

		screen->machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
	}
	else
	{
		screen->machine().device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);

		if (state->m_pri & 0x02)
			screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans, 0x0f);

		screen->machine().device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
	}

	if (state->m_pri & 0x02)
		screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x08, trans ^ 0x08, 0x0f);
	else
		screen->machine().device<deco_mxc06_device>("spritegen")->draw_sprites(screen->machine(), bitmap, cliprect, state->m_buffered_spriteram, 0x00, 0x00, 0x0f);

	screen->machine().device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen->machine(),bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
	return 0;
}


WRITE16_HANDLER( dec0_priority_w )
{
	dec0_state *state = space->machine().driver_data<dec0_state>();
	COMBINE_DATA(&state->m_pri);
}

VIDEO_START( dec0_nodma )
{
	dec0_state *state = machine.driver_data<dec0_state>();
	state->m_buffered_spriteram = state->m_spriteram;
}

VIDEO_START( dec0 )
{
	dec0_state *state = machine.driver_data<dec0_state>();
	VIDEO_START_CALL(dec0_nodma);
	state->m_buffered_spriteram = auto_alloc_array(machine, UINT16, 0x800/2);
}

/******************************************************************************/