k001604: converted to use devcb2. nw.

This commit is contained in:
Fabio Priuli 2014-04-07 12:19:01 +00:00
parent 8880b92c5f
commit 550822f0dc
6 changed files with 95 additions and 123 deletions

View File

@ -1022,11 +1022,6 @@ UINT32 cobra_state::screen_update_cobra(screen_device &screen, bitmap_rgb32 &bit
/*****************************************************************************/
int cobra_state::decode_debug_state_value(int v)
@ -3130,14 +3125,6 @@ static powerpc_config gfx_ppc_cfg =
};
static const k001604_interface cobra_k001604_intf =
{
0, 1, /* gfx index 1 & 2 */
0, 1, /* layer_size, roz_size */
0 /* slrasslt hack */
};
WRITE_LINE_MEMBER(cobra_state::ide_interrupt)
{
if (state == CLEAR_LINE)
@ -3231,7 +3218,13 @@ static MACHINE_CONFIG_START( cobra, cobra_state )
MCFG_M48T58_ADD("m48t58")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
MCFG_K001604_ADD("k001604", cobra_k001604_intf) // on the LAN board in Racing Jam DX
MCFG_DEVICE_ADD("k001604", K001604, 0) // on the LAN board in Racing Jam DX
MCFG_K001604_GFX_INDEX1(0)
MCFG_K001604_GFX_INDEX2(1)
MCFG_K001604_LAYER_SIZE(0)
MCFG_K001604_ROZ_SIZE(1)
MCFG_K001604_TXT_OFFSET(0) // correct?
MCFG_K001604_ROZ_OFFSET(0) // correct?
MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")

View File

@ -792,38 +792,6 @@ static const k056230_interface thunderh_k056230_intf =
1
};
static const k001604_interface gticlub_k001604_intf =
{
1, 2, /* gfx index 1 & 2 */
1, 1, /* layer_size, roz_size */
0, /* text layer mem offset */
0, /* roz layer mem offset */
};
static const k001604_interface slrasslt_k001604_intf =
{
1, 2, /* gfx index 1 & 2 */
0, 0, /* layer_size, roz_size */
16384, /* text layer mem offset */
0, /* roz layer mem offset */
};
static const k001604_interface hangplt_k001604_intf_l =
{
1, 2, /* gfx index 1 & 2 */
0, 1, /* layer_size, roz_size */
0, /* text layer mem offset */
16384, /* roz layer mem offset */
};
static const k001604_interface hangplt_k001604_intf_r =
{
3, 4, /* gfx index 1 & 2 */
0, 1, /* layer_size, roz_size */
0, /* text layer mem offset */
16384, /* roz layer mem offset */
};
MACHINE_RESET_MEMBER(gticlub_state,gticlub)
{
@ -986,7 +954,13 @@ static MACHINE_CONFIG_START( gticlub, gticlub_state )
MCFG_VIDEO_START_OVERRIDE(gticlub_state,gticlub)
MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
MCFG_K001604_ADD("k001604_1", gticlub_k001604_intf)
MCFG_DEVICE_ADD("k001604_1", K001604, 0)
MCFG_K001604_GFX_INDEX1(1)
MCFG_K001604_GFX_INDEX2(2)
MCFG_K001604_LAYER_SIZE(1)
MCFG_K001604_ROZ_SIZE(1)
MCFG_K001604_TXT_OFFSET(0)
MCFG_K001604_ROZ_OFFSET(0)
MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")
@ -1015,7 +989,13 @@ static MACHINE_CONFIG_DERIVED( slrasslt, gticlub )
MCFG_ADC1038_ADD("adc1038", thunderh_adc1038_intf)
MCFG_DEVICE_REMOVE("k001604_1")
MCFG_K001604_ADD("k001604_1", slrasslt_k001604_intf)
MCFG_DEVICE_ADD("k001604_1", K001604, 0)
MCFG_K001604_GFX_INDEX1(1)
MCFG_K001604_GFX_INDEX2(2)
MCFG_K001604_LAYER_SIZE(0)
MCFG_K001604_ROZ_SIZE(0)
MCFG_K001604_TXT_OFFSET(16384)
MCFG_K001604_ROZ_OFFSET(0)
MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")
MACHINE_CONFIG_END
@ -1109,11 +1089,23 @@ static MACHINE_CONFIG_START( hangplt, gticlub_state )
MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
MCFG_K001604_ADD("k001604_1", hangplt_k001604_intf_l)
MCFG_DEVICE_ADD("k001604_1", K001604, 0)
MCFG_K001604_GFX_INDEX1(1)
MCFG_K001604_GFX_INDEX2(2)
MCFG_K001604_LAYER_SIZE(0)
MCFG_K001604_ROZ_SIZE(1)
MCFG_K001604_TXT_OFFSET(0)
MCFG_K001604_ROZ_OFFSET(16384)
MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")
MCFG_K001604_ADD("k001604_2", hangplt_k001604_intf_r)
MCFG_DEVICE_ADD("k001604_2", K001604, 0)
MCFG_K001604_GFX_INDEX1(3)
MCFG_K001604_GFX_INDEX2(4)
MCFG_K001604_LAYER_SIZE(0)
MCFG_K001604_ROZ_SIZE(1)
MCFG_K001604_TXT_OFFSET(0)
MCFG_K001604_ROZ_OFFSET(16384)
MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")

View File

@ -714,20 +714,6 @@ static const k033906_interface nwktr_k033906_interface =
"voodoo"
};
static const k001604_interface racingj_k001604_intf =
{
0, 1, /* gfx index 1 & 2 */
0, 1, /* layer_size, roz_size */
0 /* slrasslt hack */
};
static const k001604_interface thrilld_k001604_intf =
{
0, 1, /* gfx index 1 & 2 */
1, 1, /* layer_size, roz_size */
0 /* slrasslt hack */
};
void nwktr_state::machine_reset()
{
m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
@ -776,7 +762,13 @@ static MACHINE_CONFIG_START( nwktr, nwktr_state )
MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
MCFG_K001604_ADD("k001604", racingj_k001604_intf)
MCFG_DEVICE_ADD("k001604", K001604, 0)
MCFG_K001604_GFX_INDEX1(0)
MCFG_K001604_GFX_INDEX2(1)
MCFG_K001604_LAYER_SIZE(0)
MCFG_K001604_ROZ_SIZE(1)
MCFG_K001604_TXT_OFFSET(0) // correct?
MCFG_K001604_ROZ_OFFSET(0) // correct?
MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")
@ -793,7 +785,13 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( thrilld, nwktr )
MCFG_DEVICE_REMOVE("k001604")
MCFG_K001604_ADD("k001604", thrilld_k001604_intf)
MCFG_DEVICE_ADD("k001604", K001604, 0)
MCFG_K001604_GFX_INDEX1(0)
MCFG_K001604_GFX_INDEX2(1)
MCFG_K001604_LAYER_SIZE(1)
MCFG_K001604_ROZ_SIZE(1)
MCFG_K001604_TXT_OFFSET(0) // correct?
MCFG_K001604_ROZ_OFFSET(0) // correct?
MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")
MACHINE_CONFIG_END

View File

@ -800,14 +800,6 @@ static MACHINE_CONFIG_START( zr107, zr107_state )
MACHINE_CONFIG_END
static const k001604_interface jetwave_k001604_intf =
{
0, 1, /* gfx index 1 & 2 */
0, 0, /* layer_size, roz_size */
0, /* text layer mem offset */
16384, /* roz layer mem offset */
};
static MACHINE_CONFIG_START( jetwave, zr107_state )
/* basic machine hardware */
@ -841,7 +833,13 @@ static MACHINE_CONFIG_START( jetwave, zr107_state )
MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
MCFG_K001604_ADD("k001604", jetwave_k001604_intf)
MCFG_DEVICE_ADD("k001604", K001604, 0)
MCFG_K001604_GFX_INDEX1(0)
MCFG_K001604_GFX_INDEX2(1)
MCFG_K001604_LAYER_SIZE(0)
MCFG_K001604_ROZ_SIZE(0)
MCFG_K001604_TXT_OFFSET(0)
MCFG_K001604_ROZ_OFFSET(16384)
MCFG_K001604_GFXDECODE("gfxdecode")
MCFG_K001604_PALETTE("palette")

View File

@ -17,6 +17,12 @@ const device_type K001604 = &device_creator<k001604_device>;
k001604_device::k001604_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, K001604, "Konami 001604", tag, owner, clock, "k001604", __FILE__),
m_gfx_index_1(0),
m_gfx_index_2(0),
m_layer_size(0),
m_roz_size(0),
m_txt_mem_offset(0),
m_roz_mem_offset(0),
m_tile_ram(NULL),
m_char_ram(NULL),
m_reg(NULL),
@ -37,31 +43,6 @@ void k001604_device::static_set_gfxdecode_tag(device_t &device, const char *tag)
downcast<k001604_device &>(device).m_gfxdecode.set_tag(tag);
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void k001604_device::device_config_complete()
{
// inherit a copy of the static data
const k001604_interface *intf = reinterpret_cast<const k001604_interface *>(static_config());
if (intf != NULL)
*static_cast<k001604_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
m_gfx_index_1 = 0;
m_gfx_index_2 = 0;
m_layer_size = 0;
m_roz_size = 0;
m_txt_mem_offset = 0;
m_roz_mem_offset = 0;
}
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------

View File

@ -3,19 +3,7 @@
#define __K001604_H__
struct k001604_interface
{
int m_gfx_index_1;
int m_gfx_index_2;
int m_layer_size; // 0 -> width = 128 tiles, 1 -> width = 256 tiles
int m_roz_size; // 0 -> 8x8, 1 -> 16x16
int m_txt_mem_offset;
int m_roz_mem_offset;
};
class k001604_device : public device_t,
public k001604_interface
class k001604_device : public device_t
{
public:
k001604_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
@ -24,7 +12,13 @@ public:
// static configuration
static void static_set_gfxdecode_tag(device_t &device, const char *tag);
static void static_set_palette_tag(device_t &device, const char *tag);
static void set_gfx_index_1(device_t &device, int idx) { downcast<k001604_device &>(device).m_gfx_index_1 = idx; }
static void set_gfx_index_2(device_t &device, int idx) { downcast<k001604_device &>(device).m_gfx_index_2 = idx; }
static void set_layer_size(device_t &device, int size) { downcast<k001604_device &>(device).m_layer_size = size; }
static void set_roz_size(device_t &device, int size) { downcast<k001604_device &>(device).m_roz_size = size; }
static void set_txt_mem_offset(device_t &device, int offs) { downcast<k001604_device &>(device).m_txt_mem_offset = offs; }
static void set_roz_mem_offset(device_t &device, int offs) { downcast<k001604_device &>(device).m_roz_mem_offset = offs; }
void draw_back_layer( bitmap_rgb32 &bitmap, const rectangle &cliprect );
void draw_front_layer( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect );
DECLARE_WRITE32_MEMBER( tile_w );
@ -36,13 +30,19 @@ public:
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
tilemap_t *m_layer_8x8[2];
tilemap_t *m_layer_roz;
int m_gfx_index_1;
int m_gfx_index_2;
int m_layer_size; // 0 -> width = 128 tiles, 1 -> width = 256 tiles
int m_roz_size; // 0 -> 8x8, 1 -> 16x16
int m_txt_mem_offset;
int m_roz_mem_offset;
tilemap_t *m_layer_8x8[2];
tilemap_t *m_layer_roz;
int m_gfx_index[2];
UINT32 * m_tile_ram;
@ -64,13 +64,23 @@ private:
extern const device_type K001604;
#define MCFG_K001604_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, K001604, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K001604_GFX_INDEX1(_idx) \
k001604_device::set_gfx_index_1(*device, _idx);
#define MCFG_K001604_MODIFY(_tag, _interface) \
MCFG_DEVICE_MODIFY(_tag) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_K001604_GFX_INDEX2(_idx) \
k001604_device::set_gfx_index_2(*device, _idx);
#define MCFG_K001604_LAYER_SIZE(_size) \
k001604_device::set_layer_size(*device, _size);
#define MCFG_K001604_ROZ_SIZE(_size) \
k001604_device::set_roz_size(*device, _size);
#define MCFG_K001604_TXT_OFFSET(_offs) \
k001604_device::set_txt_mem_offset(*device, _offs);
#define MCFG_K001604_ROZ_OFFSET(_offs) \
k001604_device::set_roz_mem_offset(*device, _offs);
#define MCFG_K001604_GFXDECODE(_gfxtag) \
k001604_device::static_set_gfxdecode_tag(*device, "^" _gfxtag);