s2636: converted to use inline configs. nw.

This commit is contained in:
Fabio Priuli 2014-04-13 07:33:30 +00:00
parent 61aef59a21
commit 6046351372
9 changed files with 105 additions and 189 deletions

View File

@ -94,32 +94,13 @@ s2636_device::s2636_device(const machine_config &mconfig, const char *tag, devic
m_channel(NULL),
m_size(0),
m_pos(0),
m_level(0)
m_level(0),
m_work_ram_size(0),
m_y_offset(0),
m_x_offset(0)
{
for (int i = 0; i < 1; i++)
m_reg[i] = 0;
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void s2636_device::device_config_complete()
{
// inherit a copy of the static data
const s2636_interface *intf = reinterpret_cast<const s2636_interface *>(static_config());
if (intf != NULL)
*static_cast<s2636_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
m_work_ram_size = 0;
m_y_offset = 0;
m_x_offset = 0;
}
m_reg[i] = 0;
}
//-------------------------------------------------
@ -135,20 +116,15 @@ void s2636_device::device_start()
m_bitmap.resize(width, height);
m_collision_bitmap.resize(width, height);
save_item(NAME(m_x_offset));
save_item(NAME(m_y_offset));
save_item(NAME(m_work_ram));
save_item(NAME(m_bitmap));
save_item(NAME(m_collision_bitmap));
m_channel = machine().sound().stream_alloc(*this, 0, 1, machine().sample_rate(), this);
save_item(NAME(m_size));
save_item(NAME(m_pos));
save_item(NAME(m_level));
for (int i = 0; i < 1; i++)
save_item(NAME(m_reg[i]), i);
save_item(NAME(m_reg));
}
/*************************************
@ -171,24 +147,16 @@ static const int sprite_offsets[4] = { 0x00, 0x10, 0x20, 0x40 };
static void draw_sprite( UINT8 *gfx, int color, int y, int x, int expand, int or_mode, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
int sy;
/* for each row */
for (sy = 0; sy < SPRITE_HEIGHT; sy++)
for (int sy = 0; sy < SPRITE_HEIGHT; sy++)
{
int sx;
/* for each pixel on the row */
for (sx = 0; sx < SPRITE_WIDTH; sx++)
for (int sx = 0; sx < SPRITE_WIDTH; sx++)
{
int ey;
/* each pixel can be expanded */
for (ey = 0; ey <= expand; ey++)
for (int ey = 0; ey <= expand; ey++)
{
int ex;
for (ex = 0; ex <= expand; ex++)
for (int ex = 0; ex <= expand; ex++)
{
/* compute effective destination pixel */
int ty = y + sy * (expand + 1) + ey;
@ -213,7 +181,6 @@ static void draw_sprite( UINT8 *gfx, int color, int y, int x, int expand, int or
}
/*************************************
*
* Collision detection

View File

@ -8,23 +8,9 @@
#define __S2636_H__
#define S2636_IS_PIXEL_DRAWN(p) (((p) & 0x08) ? TRUE : FALSE)
#define S2636_PIXEL_COLOR(p) ((p) & 0x07)
/*************************************
*
* Type definitions
*
*************************************/
struct s2636_interface
{
int m_work_ram_size;
int m_y_offset;
int m_x_offset;
};
/*************************************
*
* Device configuration macros
@ -33,26 +19,32 @@ struct s2636_interface
class s2636_device : public device_t,
public device_video_interface,
public device_sound_interface,
public s2636_interface
public device_sound_interface
{
public:
s2636_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~s2636_device() {}
/* returns a BITMAP_FORMAT_IND16 bitmap the size of the screen
D0-D2 of each pixel is the pixel color
D3 indicates whether the S2636 drew this pixel - 0 = not drawn, 1 = drawn */
static void set_workram_size(device_t &device, int size) { downcast<s2636_device &>(device).m_work_ram_size = size; }
static void set_offsets(device_t &device, int y_offset, int x_offset)
{
s2636_device &dev = downcast<s2636_device &>(device);
dev.m_x_offset = x_offset;
dev.m_y_offset = y_offset;
}
// returns a BITMAP_FORMAT_IND16 bitmap the size of the screen
// D0-D2 of each pixel is the pixel color
// D3 indicates whether the S2636 drew this pixel - 0 = not drawn, 1 = drawn
bitmap_ind16 &update(const rectangle &cliprect);
bitmap_ind16 &update( const rectangle &cliprect );
DECLARE_WRITE8_MEMBER( work_ram_w );
DECLARE_READ8_MEMBER( work_ram_r );
void soundport_w (int mode, int data);
void soundport_w(int mode, int data);
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
// sound stream update overrides
@ -65,20 +57,26 @@ private:
bitmap_ind16 m_collision_bitmap;
sound_stream *m_channel;
UINT8 m_reg[1];
int m_size;
int m_pos;
unsigned m_level;
UINT8 m_reg[1];
int m_size;
int m_pos;
unsigned m_level;
int m_work_ram_size;
int m_y_offset;
int m_x_offset;
int check_collision( int spriteno1, int spriteno2, const rectangle &cliprect );
};
extern const device_type S2636;
#define MCFG_S2636_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, S2636, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_S2636_OFFSETS(_yoffs, _xoffs) \
s2636_device::set_offsets(*device, _yoffs, _xoffs);
#define MCFG_S2636_WORKRAM_SIZE(_size) \
s2636_device::set_workram_size(*device, _size);
#endif /* __S2636_H__ */

View File

@ -936,25 +936,6 @@ GFXDECODE_END
*
*************************************/
static const s2636_interface s2636_0_config =
{
0x100,
CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
};
static const s2636_interface s2636_1_config =
{
0x100,
CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
};
static const s2636_interface s2636_2_config =
{
0x100,
CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
};
MACHINE_START_MEMBER(cvs_state,cvs)
{
/* allocate memory */
@ -1032,9 +1013,17 @@ static MACHINE_CONFIG_START( cvs, cvs_state )
MCFG_SCREEN_UPDATE_DRIVER(cvs_state, screen_update_cvs)
MCFG_SCREEN_PALETTE("palette")
MCFG_S2636_ADD("s2636_0", s2636_0_config)
MCFG_S2636_ADD("s2636_1", s2636_1_config)
MCFG_S2636_ADD("s2636_2", s2636_2_config)
MCFG_DEVICE_ADD("s2636_0", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET)
MCFG_DEVICE_ADD("s2636_1", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET)
MCFG_DEVICE_ADD("s2636_2", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET)
/* audio hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -272,20 +272,6 @@ static GFXDECODE_START( astrowar )
GFXDECODE_END
static const s2636_interface galaxia_s2636_config[3] =
{
{ 0x100, 3, -26 },
{ 0x100, 3, -26 },
{ 0x100, 3, -26 }
};
static const s2636_interface astrowar_s2636_config =
{
0x100,
3, 0
};
static MACHINE_CONFIG_START( galaxia, galaxia_state )
/* basic machine hardware */
@ -311,11 +297,19 @@ static MACHINE_CONFIG_START( galaxia, galaxia_state )
MCFG_PALETTE_INIT_OWNER(galaxia_state,galaxia)
MCFG_VIDEO_START_OVERRIDE(galaxia_state,galaxia)
MCFG_S2636_ADD("s2636_0", galaxia_s2636_config[0])
MCFG_DEVICE_ADD("s2636_0", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(3, -26)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_S2636_ADD("s2636_1", galaxia_s2636_config[1])
MCFG_DEVICE_ADD("s2636_1", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(3, -26)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_S2636_ADD("s2636_2", galaxia_s2636_config[2])
MCFG_DEVICE_ADD("s2636_2", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(3, -26)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
/* sound hardware */
@ -348,7 +342,9 @@ static MACHINE_CONFIG_START( astrowar, galaxia_state )
MCFG_PALETTE_INIT_OWNER(galaxia_state,astrowar)
MCFG_VIDEO_START_OVERRIDE(galaxia_state,astrowar)
MCFG_S2636_ADD("s2636_0", astrowar_s2636_config)
MCFG_DEVICE_ADD("s2636_0", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(3, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
/* sound hardware */

View File

@ -634,25 +634,6 @@ INTERRUPT_GEN_MEMBER(laserbat_state::zaccaria_cb1_toggle)
m_cb1_toggle ^= 1;
}
static const s2636_interface s2636_1_config =
{
0x100,
0, -19
};
static const s2636_interface s2636_2_config =
{
0x100,
0, -19
};
static const s2636_interface s2636_3_config =
{
0x100,
0, -19
};
void laserbat_state::machine_start()
{
m_pia = machine().device<pia6821_device>("pia");
@ -726,10 +707,17 @@ static MACHINE_CONFIG_START( laserbat, laserbat_state )
MCFG_GFXDECODE_ADD("gfxdecode", "palette", laserbat)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_S2636_ADD("s2636_1", s2636_1_config)
MCFG_S2636_ADD("s2636_2", s2636_2_config)
MCFG_S2636_ADD("s2636_3", s2636_3_config)
MCFG_DEVICE_ADD("s2636_1", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(0, -19)
MCFG_DEVICE_ADD("s2636_2", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(0, -19)
MCFG_DEVICE_ADD("s2636_3", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(0, -19)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
@ -775,10 +763,17 @@ static MACHINE_CONFIG_START( catnmous, laserbat_state )
MCFG_GFXDECODE_ADD("gfxdecode", "palette", laserbat)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_S2636_ADD("s2636_1", s2636_1_config)
MCFG_S2636_ADD("s2636_2", s2636_2_config)
MCFG_S2636_ADD("s2636_3", s2636_3_config)
MCFG_DEVICE_ADD("s2636_1", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(0, -19)
MCFG_DEVICE_ADD("s2636_2", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(0, -19)
MCFG_DEVICE_ADD("s2636_3", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(0, -19)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -298,19 +298,6 @@ static const sn76477_interface sn76477_intf =
1 /* 9 enable */
};
static const s2636_interface malzac_s2636_0_config =
{
0x100,
0, -16 /* -8, -16 */
};
static const s2636_interface malzac_s2636_1_config =
{
0x100,
0, -16 /* -9, -16 */
};
READ8_MEMBER(malzak_state::videoram_r)
{
return m_videoram[offset];
@ -342,7 +329,6 @@ static MACHINE_CONFIG_START( malzak, malzak_state )
MCFG_CPU_PROGRAM_MAP(malzak_map)
MCFG_CPU_IO_MAP(malzak_io_map)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(50)
@ -355,9 +341,14 @@ static MACHINE_CONFIG_START( malzak, malzak_state )
MCFG_PALETTE_ADD("palette", 128)
MCFG_PALETTE_INIT_OWNER(malzak_state, malzak)
MCFG_S2636_ADD("s2636_0", malzac_s2636_0_config)
MCFG_DEVICE_ADD("s2636_0", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(0, -16) // -8, -16
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_S2636_ADD("s2636_1", malzac_s2636_1_config)
MCFG_DEVICE_ADD("s2636_1", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(0, -16) // -9, -16
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_DEVICE_ADD("saa5050", SAA5050, 6000000)

View File

@ -270,24 +270,6 @@ INTERRUPT_GEN_MEMBER(quasar_state::quasar_interrupt)
device.execute().set_input_line_and_vector(0, HOLD_LINE, 0x03);
}
static const s2636_interface s2636_0_config =
{
0x100,
CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
};
static const s2636_interface s2636_1_config =
{
0x100,
CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
};
static const s2636_interface s2636_2_config =
{
0x100,
CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET
};
// ****************************************
// Quasar S2650 Main CPU, I8035 sound board
// ****************************************
@ -342,9 +324,17 @@ static MACHINE_CONFIG_START( quasar, quasar_state )
MCFG_PALETTE_INDIRECT_ENTRIES(0x500)
MCFG_PALETTE_INIT_OWNER(quasar_state,quasar)
MCFG_S2636_ADD("s2636_0", s2636_0_config)
MCFG_S2636_ADD("s2636_1", s2636_1_config)
MCFG_S2636_ADD("s2636_2", s2636_2_config)
MCFG_DEVICE_ADD("s2636_0", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET)
MCFG_DEVICE_ADD("s2636_1", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET)
MCFG_DEVICE_ADD("s2636_2", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET)
MCFG_VIDEO_START_OVERRIDE(quasar_state,quasar)

View File

@ -472,13 +472,6 @@ static GFXDECODE_START( seabattl )
GFXDECODE_ENTRY( "gfx3", 0, tiles8x8_layout, 24, 1 )
GFXDECODE_END
static const s2636_interface s2636_config =
{
0x100,
3, -21,
//"s2636snd"
};
static MACHINE_CONFIG_START( seabattl, seabattl_state )
/* basic machine hardware */
@ -487,7 +480,9 @@ static MACHINE_CONFIG_START( seabattl, seabattl_state )
MCFG_CPU_IO_MAP(seabattl_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", seabattl_state, seabattl_interrupt)
MCFG_S2636_ADD("s2636", s2636_config)
MCFG_DEVICE_ADD("s2636", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_S2636_OFFSETS(3, -21)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
MCFG_DEVICE_ADD("sc_thousand", DM9368, 0)

View File

@ -193,12 +193,6 @@ PALETTE_INIT_MEMBER(zac2650_state, zac2650)
palette.set_pen_color(3,rgb_t::black);
}
static const s2636_interface s2636_config =
{
0x100,
0, 0
};
/************************************************************************************************
Video is slightly odd on these zac boards
@ -264,7 +258,8 @@ static MACHINE_CONFIG_START( tinvader, zac2650_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_S2636_ADD("s2636", s2636_config)
MCFG_DEVICE_ADD("s2636", S2636, 0)
MCFG_S2636_WORKRAM_SIZE(0x100)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MACHINE_CONFIG_END