Modernized Taito PC090OJ video device. [Osso]

This commit is contained in:
Fabio Priuli 2013-06-14 08:13:00 +00:00
parent 6e49f5e42e
commit 52423e5879
12 changed files with 123 additions and 168 deletions

View File

@ -328,7 +328,7 @@ static ADDRESS_MAP_START( bonzeadv_map, AS_PROGRAM, 16, asuka_state )
AM_RANGE(0x800c00, 0x800c01) AM_WRITE(bonzeadv_cchip_bank_w)
AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w) /* tilemaps */
AM_RANGE(0xc20000, 0xc2000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w) /* sprite ram */
AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w) /* sprite ram */
ADDRESS_MAP_END
static ADDRESS_MAP_START( asuka_map, AS_PROGRAM, 16, asuka_state )
@ -343,7 +343,7 @@ static ADDRESS_MAP_START( asuka_map, AS_PROGRAM, 16, asuka_state )
AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w) /* tilemaps */
AM_RANGE(0xc10000, 0xc103ff) AM_WRITENOP /* error in Asuka init code */
AM_RANGE(0xc20000, 0xc2000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w) /* sprite ram */
AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w) /* sprite ram */
ADDRESS_MAP_END
static ADDRESS_MAP_START( cadash_map, AS_PROGRAM, 16, asuka_state )
@ -355,7 +355,7 @@ static ADDRESS_MAP_START( cadash_map, AS_PROGRAM, 16, asuka_state )
AM_RANGE(0x800000, 0x800fff) AM_READWRITE(cadash_share_r,cadash_share_w) /* network ram */
AM_RANGE(0x900000, 0x90000f) AM_DEVREADWRITE8("tc0220ioc", tc0220ioc_device, read, write, 0x00ff)
AM_RANGE(0xa00000, 0xa0000f) AM_DEVREADWRITE_LEGACY("tc0110pcr", tc0110pcr_word_r, tc0110pcr_step1_4bpg_word_w)
AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w) /* sprite ram */
AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w) /* sprite ram */
AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w) /* tilemaps */
AM_RANGE(0xc20000, 0xc2000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
ADDRESS_MAP_END
@ -369,7 +369,7 @@ static ADDRESS_MAP_START( eto_map, AS_PROGRAM, 16 /* N.B. tc100scn mirror over
AM_RANGE(0x4a0000, 0x4a0003) AM_WRITE(asuka_spritectrl_w)
AM_RANGE(0x4e0000, 0x4e0001) AM_READNOP AM_DEVWRITE8("tc0140syt", tc0140syt_device, tc0140syt_port_w, 0x00ff)
AM_RANGE(0x4e0002, 0x4e0003) AM_DEVREADWRITE8("tc0140syt", tc0140syt_device, tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w) /* sprite ram */
AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w) /* sprite ram */
AM_RANGE(0xc00000, 0xc0ffff) AM_DEVWRITE_LEGACY("tc0100scn", tc0100scn_word_w)
AM_RANGE(0xd00000, 0xd0ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w) /* tilemaps */
AM_RANGE(0xd20000, 0xd2000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
@ -859,7 +859,7 @@ void asuka_state::screen_eof_asuka(screen_device &screen, bool state)
// rising edge
if (state)
{
pc090oj_eof_callback(m_pc090oj);
m_pc090oj->eof_callback();
}
}

View File

@ -374,7 +374,7 @@ static ADDRESS_MAP_START( opwolf_map, AS_PROGRAM, 16, opwolf_state )
AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE("pc080sn", pc080sn_device, yscroll_word_w)
AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE("pc080sn", pc080sn_device, xscroll_word_w)
AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE("pc080sn", pc080sn_device, ctrl_word_w)
AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w) /* sprite ram */
AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w) /* sprite ram */
ADDRESS_MAP_END
@ -395,7 +395,7 @@ static ADDRESS_MAP_START( opwolfb_map, AS_PROGRAM, 16, opwolf_state )
AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE("pc080sn", pc080sn_device, yscroll_word_w)
AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE("pc080sn", pc080sn_device, xscroll_word_w)
AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE("pc080sn", pc080sn_device, ctrl_word_w)
AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w) /* sprite ram */
AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w) /* sprite ram */
ADDRESS_MAP_END

View File

@ -361,7 +361,7 @@ static ADDRESS_MAP_START( rbisland_map, AS_PROGRAM, 16, rbisland_state )
AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE("pc080sn", pc080sn_device, yscroll_word_w)
AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE("pc080sn", pc080sn_device, xscroll_word_w)
AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE("pc080sn", pc080sn_device, ctrl_word_w)
AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w) /* sprite ram + other stuff */
AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w) /* sprite ram + other stuff */
ADDRESS_MAP_END
static ADDRESS_MAP_START( jumping_map, AS_PROGRAM, 16, rbisland_state )

View File

@ -219,7 +219,7 @@ static ADDRESS_MAP_START( rastan_map, AS_PROGRAM, 16, rastan_state )
AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE("pc080sn", pc080sn_device, yscroll_word_w)
AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE("pc080sn", pc080sn_device, xscroll_word_w)
AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE("pc080sn", pc080sn_device, ctrl_word_w)
AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w) /* sprite ram */
AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w) /* sprite ram */
ADDRESS_MAP_END

View File

@ -65,7 +65,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, volfied_state )
AM_RANGE(0x000000, 0x03ffff) AM_ROM /* program */
AM_RANGE(0x080000, 0x0fffff) AM_ROM /* tiles */
AM_RANGE(0x100000, 0x103fff) AM_RAM /* main */
AM_RANGE(0x200000, 0x203fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)
AM_RANGE(0x200000, 0x203fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w)
AM_RANGE(0x400000, 0x47ffff) AM_READWRITE(volfied_video_ram_r, volfied_video_ram_w)
AM_RANGE(0x500000, 0x503fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
AM_RANGE(0x600000, 0x600001) AM_WRITE(volfied_video_mask_w)

View File

@ -9,7 +9,7 @@
WRITE16_MEMBER(asuka_state::asuka_spritectrl_w)
{
/* Bits 2-5 are color bank; in asuka games bit 0 is global priority */
pc090oj_set_sprite_ctrl(m_pc090oj, ((data & 0x3c) >> 2) | ((data & 0x1) << 15));
m_pc090oj->set_sprite_ctrl(((data & 0x3c) >> 2) | ((data & 0x1) << 15));
}
@ -37,7 +37,7 @@ UINT32 asuka_state::screen_update_asuka(screen_device &screen, bitmap_ind16 &bit
tc0100scn_tilemap_draw(m_tc0100scn, bitmap, cliprect, layer[2], 0, 4);
/* Sprites may be over or under top bg layer */
pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 2);
m_pc090oj->draw_sprites(bitmap, cliprect, 2);
return 0;
}
@ -62,6 +62,6 @@ UINT32 asuka_state::screen_update_bonzeadv(screen_device &screen, bitmap_ind16 &
tc0100scn_tilemap_draw(m_tc0100scn, bitmap, cliprect, layer[2], 0, 4);
/* Sprites are always over both bg layers */
pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 0);
m_pc090oj->draw_sprites(bitmap, cliprect, 0);
return 0;
}

View File

@ -18,7 +18,7 @@ WRITE16_MEMBER(opwolf_state::opwolf_spritectrl_w)
/* bits 5-7 are the sprite palette bank */
/* other bits unknown */
pc090oj_set_sprite_ctrl(m_pc090oj, (data & 0xe0) >> 5);
m_pc090oj->set_sprite_ctrl((data & 0xe0) >> 5);
/* If data = 4, the Piston Motor is off, otherwise it's on. */
if (data == 4)
@ -48,7 +48,7 @@ UINT32 opwolf_state::screen_update_opwolf(screen_device &screen, bitmap_ind16 &b
m_pc080sn->tilemap_draw(bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
m_pc080sn->tilemap_draw(bitmap, cliprect, layer[1], 0, 2);
pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 1);
m_pc090oj->draw_sprites(bitmap, cliprect, 1);
// if (ioport("P1X")->read())
// popmessage("%d %d", machine(), "P1X"), ioport("P1Y")->read());

View File

@ -20,7 +20,7 @@ WRITE16_MEMBER(rbisland_state::rbisland_spritectrl_w)
/* bits 5-7 are the sprite palette bank */
/* other bits unknown */
pc090oj_set_sprite_ctrl(m_pc090oj, (data & 0xe0) >> 5);
m_pc090oj->set_sprite_ctrl((data & 0xe0) >> 5);
}
}
@ -52,7 +52,7 @@ UINT32 rbisland_state::screen_update_rainbow(screen_device &screen, bitmap_ind16
m_pc080sn->tilemap_draw(bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
m_pc080sn->tilemap_draw(bitmap, cliprect, layer[1], 0, 2);
pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 1);
m_pc090oj->draw_sprites(bitmap, cliprect, 1);
return 0;
}

View File

@ -14,7 +14,7 @@
WRITE16_MEMBER(rastan_state::rastan_spritectrl_w)
{
/* bits 5-7 are the sprite palette bank */
pc090oj_set_sprite_ctrl(m_pc090oj, (data & 0xe0) >> 5);
m_pc090oj->set_sprite_ctrl((data & 0xe0) >> 5);
/* bit 4 unused */
@ -43,6 +43,6 @@ UINT32 rastan_state::screen_update_rastan(screen_device &screen, bitmap_ind16 &b
m_pc080sn->tilemap_draw(bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
m_pc080sn->tilemap_draw(bitmap, cliprect, layer[1], 0, 2);
pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 0);
m_pc090oj->draw_sprites(bitmap, cliprect, 0);
return 0;
}

View File

@ -990,78 +990,94 @@ void pc080sn_device::restore_scroll()
/* */
/***************************************************************************/
struct pc090oj_state
{
/* NB: pc090oj_ctrl is the internal register controlling flipping
pc090oj_sprite_ctrl is a representation of the hardware OUTSIDE the pc090oj
which impacts on sprite plotting, and which varies between games. It
includes color banking and (optionally) priority. It allows each game to
control these aspects of the sprites in different ways, while keeping the
routines here modular.
*/
UINT16 ctrl, buffer, gfxnum;
UINT16 sprite_ctrl;
UINT16 * ram;
UINT16 * ram_buffered;
int xoffs, yoffs;
};
#define PC090OJ_RAM_SIZE 0x4000
#define PC090OJ_ACTIVE_RAM_SIZE 0x800
/*****************************************************************************
INLINE FUNCTIONS
DEVICE INTERFACE
*****************************************************************************/
INLINE pc090oj_state *pc090oj_get_safe_token( device_t *device )
{
assert(device != NULL);
assert(device->type() == PC090OJ);
return (pc090oj_state *)downcast<pc090oj_device *>(device)->token();
const device_type PC090OJ = &device_creator<pc090oj_device>;
pc090oj_device::pc090oj_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, PC090OJ, "Taito PC090OJ", tag, owner, clock)
{
}
INLINE const pc090oj_interface *pc090oj_get_interface( device_t *device )
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void pc090oj_device::device_config_complete()
{
assert(device != NULL);
assert((device->type() == PC090OJ));
return (const pc090oj_interface *) device->static_config();
// inherit a copy of the static data
const pc090oj_interface *intf = reinterpret_cast<const pc090oj_interface *>(static_config());
if (intf != NULL)
*static_cast<pc090oj_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
}
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void pc090oj_device::device_start()
{
m_ram = auto_alloc_array_clear(machine(), UINT16, PC090OJ_RAM_SIZE / 2);
m_ram_buffered = auto_alloc_array_clear(machine(), UINT16, PC090OJ_RAM_SIZE / 2);
save_pointer(NAME(m_ram), PC090OJ_RAM_SIZE / 2);
save_pointer(NAME(m_ram_buffered), PC090OJ_RAM_SIZE / 2);
save_item(NAME(m_ctrl));
save_item(NAME(m_sprite_ctrl)); // should this be set in intf?!?
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void pc090oj_device::device_reset()
{
m_ctrl = 0;
}
/*****************************************************************************
DEVICE HANDLERS
*****************************************************************************/
void pc090oj_set_sprite_ctrl( device_t *device, UINT16 sprctrl )
void pc090oj_device::set_sprite_ctrl( UINT16 sprctrl )
{
pc090oj_state *pc090oj = pc090oj_get_safe_token(device);
pc090oj->sprite_ctrl = sprctrl;
m_sprite_ctrl = sprctrl;
}
READ16_DEVICE_HANDLER( pc090oj_word_r )
READ16_MEMBER( pc090oj_device::word_r )
{
pc090oj_state *pc090oj = pc090oj_get_safe_token(device);
return pc090oj->ram[offset];
return m_ram[offset];
}
WRITE16_DEVICE_HANDLER( pc090oj_word_w )
WRITE16_MEMBER( pc090oj_device::word_w )
{
pc090oj_state *pc090oj = pc090oj_get_safe_token(device);
COMBINE_DATA(&pc090oj->ram[offset]);
COMBINE_DATA(&m_ram[offset]);
/* If we're not buffering sprite ram, write it straight through... */
if (!pc090oj->buffer)
pc090oj->ram_buffered[offset] = pc090oj->ram[offset];
if (!m_use_buffer)
m_ram_buffered[offset] = m_ram[offset];
if (offset == 0xdff)
{
/* Bit 0 is flip control, others seem unused */
pc090oj->ctrl = data;
m_ctrl = data;
#if 0
popmessage("pc090oj ctrl = %4x", data);
@ -1069,23 +1085,21 @@ WRITE16_DEVICE_HANDLER( pc090oj_word_w )
}
}
void pc090oj_eof_callback( device_t *device )
void pc090oj_device::eof_callback( )
{
pc090oj_state *pc090oj = pc090oj_get_safe_token(device);
if (pc090oj->buffer)
if (m_use_buffer)
{
int i;
for (i = 0; i < PC090OJ_ACTIVE_RAM_SIZE / 2; i++)
pc090oj->ram_buffered[i] = pc090oj->ram[i];
m_ram_buffered[i] = m_ram[i];
}
}
void pc090oj_draw_sprites( device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri_type )
void pc090oj_device::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri_type )
{
pc090oj_state *pc090oj = pc090oj_get_safe_token(device);
int offs, priority = 0;
int sprite_colbank = (pc090oj->sprite_ctrl & 0xf) << 4; /* top nibble */
int sprite_colbank = (m_sprite_ctrl & 0xf) << 4; /* top nibble */
switch (pri_type)
{
@ -1098,7 +1112,7 @@ void pc090oj_draw_sprites( device_t *device, bitmap_ind16 &bitmap, const rectang
break;
case 0x02:
priority = pc090oj->sprite_ctrl >> 15; /* variable sprite/tile priority */
priority = m_sprite_ctrl >> 15; /* variable sprite/tile priority */
}
for (offs = 0; offs < PC090OJ_ACTIVE_RAM_SIZE / 2; offs += 4)
@ -1107,20 +1121,20 @@ void pc090oj_draw_sprites( device_t *device, bitmap_ind16 &bitmap, const rectang
int x, y;
int data, code, color;
data = pc090oj->ram_buffered[offs];
data = m_ram_buffered[offs];
flipy = (data & 0x8000) >> 15;
flipx = (data & 0x4000) >> 14;
color = (data & 0x000f) | sprite_colbank;
code = pc090oj->ram_buffered[offs + 2] & 0x1fff;
x = pc090oj->ram_buffered[offs + 3] & 0x1ff; /* mask verified with Rainbowe board */
y = pc090oj->ram_buffered[offs + 1] & 0x1ff; /* mask verified with Rainbowe board */
code = m_ram_buffered[offs + 2] & 0x1fff;
x = m_ram_buffered[offs + 3] & 0x1ff; /* mask verified with Rainbowe board */
y = m_ram_buffered[offs + 1] & 0x1ff; /* mask verified with Rainbowe board */
/* treat coords as signed */
if (x > 0x140) x -= 0x200;
if (y > 0x140) y -= 0x200;
if (!(pc090oj->ctrl & 1)) /* sprites flipscreen */
if (!(m_ctrl & 1)) /* sprites flipscreen */
{
x = 320 - x - 16;
y = 256 - y - 16;
@ -1128,90 +1142,20 @@ void pc090oj_draw_sprites( device_t *device, bitmap_ind16 &bitmap, const rectang
flipy = !flipy;
}
x += pc090oj->xoffs;
y += pc090oj->yoffs;
x += m_x_offset;
y += m_y_offset;
pdrawgfx_transpen(bitmap,cliprect,device->machine().gfx[pc090oj->gfxnum],
pdrawgfx_transpen(bitmap,cliprect,machine().gfx[m_gfxnum],
code,
color,
flipx,flipy,
x,y,
device->machine().priority_bitmap,
machine().priority_bitmap,
priority ? 0xfc : 0xf0,0);
}
}
/*****************************************************************************
DEVICE INTERFACE
*****************************************************************************/
static DEVICE_START( pc090oj )
{
pc090oj_state *pc090oj = pc090oj_get_safe_token(device);
const pc090oj_interface *intf = pc090oj_get_interface(device);
/* use the given gfx set */
pc090oj->gfxnum = intf->gfxnum;
pc090oj->xoffs = intf->x_offset;
pc090oj->yoffs = intf->y_offset;
pc090oj->buffer = intf->use_buffer;
pc090oj->ram = auto_alloc_array_clear(device->machine(), UINT16, PC090OJ_RAM_SIZE / 2);
pc090oj->ram_buffered = auto_alloc_array_clear(device->machine(), UINT16, PC090OJ_RAM_SIZE / 2);
device->save_pointer(NAME(pc090oj->ram), PC090OJ_RAM_SIZE / 2);
device->save_pointer(NAME(pc090oj->ram_buffered), PC090OJ_RAM_SIZE / 2);
device->save_item(NAME(pc090oj->ctrl));
device->save_item(NAME(pc090oj->sprite_ctrl)); // should this be set in intf?!?
}
static DEVICE_RESET( pc090oj )
{
pc090oj_state *pc090oj = pc090oj_get_safe_token(device);
pc090oj->ctrl = 0;
}
const device_type PC090OJ = &device_creator<pc090oj_device>;
pc090oj_device::pc090oj_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, PC090OJ, "Taito PC090OJ", tag, owner, clock)
{
m_token = global_alloc_clear(pc090oj_state);
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void pc090oj_device::device_config_complete()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void pc090oj_device::device_start()
{
DEVICE_START_NAME( pc090oj )(this);
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void pc090oj_device::device_reset()
{
DEVICE_RESET_NAME( pc090oj )(this);
}
/***************************************************************************/
/* */

View File

@ -27,10 +27,10 @@ struct pc080sn_interface
struct pc090oj_interface
{
int gfxnum;
int m_gfxnum;
int x_offset, y_offset;
int use_buffer;
int m_x_offset, m_y_offset;
int m_use_buffer;
};
@ -152,22 +152,42 @@ public:
extern const device_type PC080SN;
class pc090oj_device : public device_t
class pc090oj_device : public device_t,
public pc090oj_interface
{
public:
pc090oj_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~pc090oj_device() { global_free(m_token); }
~pc090oj_device() {}
// access to legacy token
void *token() const { assert(m_token != NULL); return m_token; }
DECLARE_READ16_MEMBER( word_r );
DECLARE_WRITE16_MEMBER( word_w );
void set_sprite_ctrl(UINT16 sprctrl);
void eof_callback();
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri_type);
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
void *m_token;
/* NB: pc090oj_ctrl is the internal register controlling flipping
pc090oj_sprite_ctrl is a representation of the hardware OUTSIDE the pc090oj
which impacts on sprite plotting, and which varies between games. It
includes color banking and (optionally) priority. It allows each game to
control these aspects of the sprites in different ways, while keeping the
routines here modular.
*/
UINT16 m_ctrl;
UINT16 m_sprite_ctrl;
UINT16 * m_ram;
UINT16 * m_ram_buffered;
};
extern const device_type PC090OJ;
@ -408,15 +428,6 @@ extern const device_type TC0180VCU;
DEVICE I/O FUNCTIONS
***************************************************************************/
/** PC090OJ **/
DECLARE_READ16_DEVICE_HANDLER( pc090oj_word_r );
DECLARE_WRITE16_DEVICE_HANDLER( pc090oj_word_w );
void pc090oj_set_sprite_ctrl(device_t *device, UINT16 sprctrl);
void pc090oj_eof_callback(device_t *device);
void pc090oj_draw_sprites(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri_type);
/** TC0080VCO **/
DECLARE_READ16_DEVICE_HANDLER( tc0080vco_word_r );
DECLARE_WRITE16_DEVICE_HANDLER( tc0080vco_word_w );

View File

@ -58,7 +58,7 @@ WRITE16_MEMBER(volfied_state::volfied_video_mask_w)
WRITE16_MEMBER(volfied_state::volfied_sprite_ctrl_w)
{
pc090oj_set_sprite_ctrl(m_pc090oj, (data & 0x3c) >> 2);
m_pc090oj->set_sprite_ctrl((data & 0x3c) >> 2);
}
@ -124,6 +124,6 @@ UINT32 volfied_state::screen_update_volfied(screen_device &screen, bitmap_ind16
{
machine().priority_bitmap.fill(0, cliprect);
refresh_pixel_layer(bitmap);
pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 0);
m_pc090oj->draw_sprites(bitmap, cliprect, 0);
return 0;
}