small cleanup

This commit is contained in:
Michaël Banaan Ananas 2014-03-26 22:41:32 +00:00
parent 5335791f57
commit 7a761c77aa
3 changed files with 97 additions and 108 deletions

View File

@ -736,14 +736,14 @@ INTERRUPT_GEN_MEMBER(slapfght_state::vblank_irq)
static MACHINE_CONFIG_START( perfrman, slapfght_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz/4) /* 4MHz ???, 16MHz Oscillator */
MCFG_CPU_ADD("maincpu", Z80, XTAL_16MHz/4) // 4MHz? XTAL is known, divider is guessed
MCFG_CPU_PROGRAM_MAP(perfrman_map)
MCFG_CPU_IO_MAP(slapfght_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", slapfght_state, vblank_irq)
MCFG_CPU_ADD("audiocpu", Z80, XTAL_16MHz/8) /* 2MHz ???, 16MHz Oscillator */
MCFG_CPU_ADD("audiocpu", Z80, XTAL_16MHz/8) // 2MHz? XTAL is known, divider is guessed
MCFG_CPU_PROGRAM_MAP(perfrman_sound_map)
MCFG_CPU_PERIODIC_INT_DRIVER(slapfght_state, getstar_interrupt, 240) /* music speed, verified */
MCFG_CPU_PERIODIC_INT_DRIVER(slapfght_state, getstar_interrupt, 240) // music speed, verified
MCFG_QUANTUM_PERFECT_CPU("maincpu")
@ -781,16 +781,16 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_START( tigerh, slapfght_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, XTAL_36MHz/6) /* verified on pcb */
MCFG_CPU_ADD("maincpu", Z80, XTAL_36MHz/6) // 6MHz
MCFG_CPU_PROGRAM_MAP(tigerh_map)
MCFG_CPU_IO_MAP(tigerh_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", slapfght_state, vblank_irq)
MCFG_CPU_ADD("audiocpu", Z80, XTAL_36MHz/12) /* verified on pcb */
MCFG_CPU_ADD("audiocpu", Z80, XTAL_36MHz/12) // 3MHz
MCFG_CPU_PROGRAM_MAP(slapfght_sound_map)
MCFG_CPU_PERIODIC_INT_DRIVER(slapfght_state, nmi_line_pulse, 360) // music speed, verfied with pcb recording
MCFG_CPU_PERIODIC_INT_DRIVER(slapfght_state, nmi_line_pulse, 360) // music speed, verified with pcb recording
MCFG_CPU_ADD("mcu", M68705, XTAL_36MHz/12) /* verified on pcb */
MCFG_CPU_ADD("mcu", M68705, XTAL_36MHz/12) // 3MHz
MCFG_CPU_PROGRAM_MAP(tigerh_m68705_map)
MCFG_QUANTUM_PERFECT_CPU("maincpu")
@ -816,11 +816,11 @@ static MACHINE_CONFIG_START( tigerh, slapfght_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("ay1", AY8910, XTAL_36MHz/24) /* verified on pcb */
MCFG_SOUND_ADD("ay1", AY8910, XTAL_36MHz/24) // 1.5MHz
MCFG_SOUND_CONFIG(ay8910_interface_1)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_SOUND_ADD("ay2", AY8910, XTAL_36MHz/24) /* verified on pcb */
MCFG_SOUND_ADD("ay2", AY8910, XTAL_36MHz/24) // 1.5MHz
MCFG_SOUND_CONFIG(ay8910_interface_2)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MACHINE_CONFIG_END
@ -828,14 +828,14 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_START( tigerhb, slapfght_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, 6000000) // ?
MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz/2) // 6MHz? XTAL is known, divider is guessed
MCFG_CPU_PROGRAM_MAP(tigerh_map)
MCFG_CPU_IO_MAP(tigerhb_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", slapfght_state, vblank_irq)
MCFG_CPU_ADD("audiocpu", Z80, 6000000) // ?
MCFG_CPU_ADD("audiocpu", Z80, XTAL_12MHz/4) // 3MHz? XTAL is known, divider is guessed
MCFG_CPU_PROGRAM_MAP(slapfght_sound_map)
MCFG_CPU_PERIODIC_INT_DRIVER(slapfght_state, nmi_line_pulse, 360) // ?
MCFG_CPU_PERIODIC_INT_DRIVER(slapfght_state, nmi_line_pulse, 360)
MCFG_QUANTUM_PERFECT_CPU("maincpu")
@ -860,11 +860,11 @@ static MACHINE_CONFIG_START( tigerhb, slapfght_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("ay1", AY8910, 1500000)
MCFG_SOUND_ADD("ay1", AY8910, XTAL_12MHz/8)
MCFG_SOUND_CONFIG(ay8910_interface_1)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_SOUND_ADD("ay2", AY8910, 1500000)
MCFG_SOUND_ADD("ay2", AY8910, XTAL_12MHz/8)
MCFG_SOUND_CONFIG(ay8910_interface_2)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MACHINE_CONFIG_END
@ -873,16 +873,16 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_START( slapfigh, slapfght_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu",Z80, XTAL_36MHz/6) /* verified on pcb */
MCFG_CPU_ADD("maincpu",Z80, XTAL_36MHz/6) // 6MHz
MCFG_CPU_PROGRAM_MAP(slapfght_map)
MCFG_CPU_IO_MAP(slapfght_io_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", slapfght_state, vblank_irq)
MCFG_CPU_ADD("audiocpu", Z80, XTAL_36MHz/12) /* verified on pcb */
MCFG_CPU_ADD("audiocpu", Z80, XTAL_36MHz/12) // 3MHz
MCFG_CPU_PROGRAM_MAP(slapfght_sound_map)
MCFG_CPU_PERIODIC_INT_DRIVER(slapfght_state, getstar_interrupt, 180)
MCFG_CPU_ADD("mcu", M68705, XTAL_36MHz/12) /* verified on pcb */
MCFG_CPU_ADD("mcu", M68705, XTAL_36MHz/12) // 3MHz
MCFG_CPU_PROGRAM_MAP(slapfight_m68705_map)
MCFG_QUANTUM_PERFECT_CPU("maincpu")
@ -908,11 +908,11 @@ static MACHINE_CONFIG_START( slapfigh, slapfght_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("ay1", AY8910, XTAL_36MHz/24) /* verified on pcb */
MCFG_SOUND_ADD("ay1", AY8910, XTAL_36MHz/24) // 1.5MHz
MCFG_SOUND_CONFIG(ay8910_interface_1)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MCFG_SOUND_ADD("ay2", AY8910, XTAL_36MHz/24) /* verified on pcb */
MCFG_SOUND_ADD("ay2", AY8910, XTAL_36MHz/24) // 1.5MHz
MCFG_SOUND_CONFIG(ay8910_interface_2)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
MACHINE_CONFIG_END

View File

@ -150,6 +150,6 @@ public:
INTERRUPT_GEN_MEMBER(vblank_irq);
INTERRUPT_GEN_MEMBER(getstar_interrupt);
void slapfght_log_vram();
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority_to_display );
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority_to_display);
void getstar_init();
};

View File

@ -16,42 +16,29 @@
***************************************************************************/
TILE_GET_INFO_MEMBER(slapfght_state::get_pf_tile_info)/* For Performan only */
TILE_GET_INFO_MEMBER(slapfght_state::get_pf_tile_info)
{
int tile,color;
/* For Performan only */
int tile = m_slapfight_videoram[tile_index] | ((m_slapfight_colorram[tile_index] & 0x03) << 8);
int color = (m_slapfight_colorram[tile_index] >> 3) & 0x0f;
tile=m_slapfight_videoram[tile_index] + ((m_slapfight_colorram[tile_index] & 0x03) << 8);
color=(m_slapfight_colorram[tile_index] >> 3) & 0x0f;
SET_TILE_INFO_MEMBER(0,
tile,
color,
0);
SET_TILE_INFO_MEMBER(0, tile, color, 0);
}
TILE_GET_INFO_MEMBER(slapfght_state::get_pf1_tile_info)
{
int tile,color;
int tile = m_slapfight_videoram[tile_index] | ((m_slapfight_colorram[tile_index] & 0x0f) << 8);
int color = (m_slapfight_colorram[tile_index] & 0xf0) >> 4;
tile=m_slapfight_videoram[tile_index] + ((m_slapfight_colorram[tile_index] & 0x0f) << 8);
color=(m_slapfight_colorram[tile_index] & 0xf0) >> 4;
SET_TILE_INFO_MEMBER(1,
tile,
color,
0);
SET_TILE_INFO_MEMBER(1, tile, color, 0);
}
TILE_GET_INFO_MEMBER(slapfght_state::get_fix_tile_info)
{
int tile,color;
int tile = m_slapfight_fixvideoram[tile_index] | ((m_slapfight_fixcolorram[tile_index] & 0x03) << 8);
int color = (m_slapfight_fixcolorram[tile_index] & 0xfc) >> 2;
tile=m_slapfight_fixvideoram[tile_index] + ((m_slapfight_fixcolorram[tile_index] & 0x03) << 8);
color=(m_slapfight_fixcolorram[tile_index] & 0xfc) >> 2;
SET_TILE_INFO_MEMBER(0,
tile,
color,
0);
SET_TILE_INFO_MEMBER(0, tile, color, 0);
}
@ -63,15 +50,15 @@ TILE_GET_INFO_MEMBER(slapfght_state::get_fix_tile_info)
VIDEO_START_MEMBER(slapfght_state,perfrman)
{
m_pf1_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(slapfght_state::get_pf_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32);
m_pf1_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(slapfght_state::get_pf_tile_info), this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_pf1_tilemap->set_transparent_pen(0);
}
VIDEO_START_MEMBER(slapfght_state,slapfight)
{
m_pf1_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(slapfght_state::get_pf1_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32);
m_fix_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(slapfght_state::get_fix_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32);
m_pf1_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(slapfght_state::get_pf1_tile_info), this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_fix_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(slapfght_state::get_fix_tile_info), this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_fix_tilemap->set_transparent_pen(0);
}
@ -85,33 +72,34 @@ VIDEO_START_MEMBER(slapfght_state,slapfight)
WRITE8_MEMBER(slapfght_state::slapfight_videoram_w)
{
m_slapfight_videoram[offset]=data;
m_slapfight_videoram[offset] = data;
m_pf1_tilemap->mark_tile_dirty(offset);
}
WRITE8_MEMBER(slapfght_state::slapfight_colorram_w)
{
m_slapfight_colorram[offset]=data;
m_slapfight_colorram[offset] = data;
m_pf1_tilemap->mark_tile_dirty(offset);
}
WRITE8_MEMBER(slapfght_state::slapfight_fixram_w)
{
m_slapfight_fixvideoram[offset]=data;
m_slapfight_fixvideoram[offset] = data;
m_fix_tilemap->mark_tile_dirty(offset);
}
WRITE8_MEMBER(slapfght_state::slapfight_fixcol_w)
{
m_slapfight_fixcolorram[offset]=data;
m_slapfight_fixcolorram[offset] = data;
m_fix_tilemap->mark_tile_dirty(offset);
}
WRITE8_MEMBER(slapfght_state::slapfight_flipscreen_w)
{
logerror("Writing %02x to flipscreen\n",offset);
if (offset==0) m_flipscreen=1; /* Port 0x2 is flipscreen */
else m_flipscreen=0; /* Port 0x3 is normal */
logerror("Writing %02x to flipscreen\n", offset);
// port 2 is flipscreen, port 3 is normal
m_flipscreen = (offset == 0);
}
WRITE8_MEMBER(slapfght_state::slapfight_palette_bank_w)
@ -124,10 +112,9 @@ void slapfght_state::slapfght_log_vram()
#ifdef MAME_DEBUG
if ( machine().input().code_pressed_once(KEYCODE_B) )
{
int i;
for (i=0; i<0x800; i++)
for (int i = 0; i < 0x800; i++)
{
logerror("Offset:%03x TileRAM:%02x AttribRAM:%02x SpriteRAM:%02x\n",i, m_slapfight_videoram[i],m_slapfight_colorram[i],m_spriteram->live()[i]);
logerror("Offset:%03x TileRAM:%02x AttribRAM:%02x SpriteRAM:%02x\n", i, m_slapfight_videoram[i], m_slapfight_colorram[i], m_spriteram->live()[i]);
}
}
#endif
@ -138,34 +125,35 @@ void slapfght_state::slapfght_log_vram()
Render the Sprites
***************************************************************************/
void slapfght_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority_to_display )
{
UINT8 *buffered_spriteram = m_spriteram->buffer();
int offs;
for (offs = 0;offs < m_spriteram->bytes();offs += 4)
void slapfght_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority_to_display)
{
UINT8 *src = m_spriteram->buffer();
for (int offs = 0; offs < m_spriteram->bytes(); offs += 4)
{
int sx, sy;
if ((buffered_spriteram[offs+2] & 0x80) == priority_to_display)
if ((src[offs + 2] & 0x80) == priority_to_display)
{
if (m_flipscreen)
{
sx = 265 - buffered_spriteram[offs+1];
sy = 239 - buffered_spriteram[offs+3];
sx = 265 - src[offs + 1];
sy = 239 - src[offs + 3];
sy &= 0xff;
}
else
{
sx = buffered_spriteram[offs+1] + 3;
sy = buffered_spriteram[offs+3] - 1;
sx = src[offs + 1] + 3;
sy = src[offs + 3] - 1;
}
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
buffered_spriteram[offs],
((buffered_spriteram[offs+2] >> 1) & 3) |
((buffered_spriteram[offs+2] << 2) & 4) | (m_slapfight_palette_bank << 3),
m_gfxdecode->gfx(1)->transpen(bitmap, cliprect,
src[offs],
((src[offs + 2] >> 1) & 3) | ((src[offs + 2] << 2) & 4) | (m_slapfight_palette_bank << 3),
m_flipscreen, m_flipscreen,
sx, sy,0);
sx, sy, 0
);
}
}
}
@ -174,18 +162,16 @@ void slapfght_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
UINT32 slapfght_state::screen_update_perfrman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_pf1_tilemap->set_flip(m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
m_pf1_tilemap ->set_scrolly(0 , 0 );
if (m_flipscreen) {
m_pf1_tilemap ->set_scrollx(0 , 264 );
}
else {
m_pf1_tilemap ->set_scrollx(0 , -16 );
}
m_pf1_tilemap->set_scrolly(0, 0);
if (m_flipscreen)
m_pf1_tilemap->set_scrollx(0, 264);
else
m_pf1_tilemap->set_scrollx(0, -16);
m_pf1_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
draw_sprites(bitmap,cliprect,0);
m_pf1_tilemap->draw(screen, bitmap, cliprect, 0,0);
draw_sprites(bitmap,cliprect,0x80);
m_pf1_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
draw_sprites(bitmap,cliprect, 0);
m_pf1_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap,cliprect, 0x80);
slapfght_log_vram();
return 0;
@ -194,43 +180,46 @@ UINT32 slapfght_state::screen_update_perfrman(screen_device &screen, bitmap_ind1
UINT32 slapfght_state::screen_update_slapfight(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
UINT8 *buffered_spriteram = m_spriteram->buffer();
int offs;
UINT8 *src = m_spriteram->buffer();
machine().tilemap().set_flip_all(m_flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
if (m_flipscreen) {
m_fix_tilemap->set_scrollx(0,296);
m_pf1_tilemap->set_scrollx(0,(*m_slapfight_scrollx_lo + 256 * *m_slapfight_scrollx_hi)+296 );
m_pf1_tilemap->set_scrolly(0, (*m_slapfight_scrolly)+15 );
m_fix_tilemap->set_scrolly(0, -1 ); /* Glitch in Tiger Heli otherwise */
if (m_flipscreen)
{
m_fix_tilemap->set_scrollx(0, 296);
m_pf1_tilemap->set_scrollx(0, (*m_slapfight_scrollx_lo + 256 * *m_slapfight_scrollx_hi) + 296);
m_pf1_tilemap->set_scrolly(0, (*m_slapfight_scrolly) + 15);
m_fix_tilemap->set_scrolly(0, -1); /* Glitch in Tiger Heli otherwise */
}
else {
m_fix_tilemap->set_scrollx(0,0);
m_pf1_tilemap->set_scrollx(0,(*m_slapfight_scrollx_lo + 256 * *m_slapfight_scrollx_hi) );
m_pf1_tilemap->set_scrolly(0, (*m_slapfight_scrolly)-1 );
m_fix_tilemap->set_scrolly(0, -1 ); /* Glitch in Tiger Heli otherwise */
else
{
m_fix_tilemap->set_scrollx(0, 0);
m_pf1_tilemap->set_scrollx(0, (*m_slapfight_scrollx_lo + 256 * *m_slapfight_scrollx_hi));
m_pf1_tilemap->set_scrolly(0, (*m_slapfight_scrolly) - 1);
m_fix_tilemap->set_scrolly(0, -1); /* Glitch in Tiger Heli otherwise */
}
m_pf1_tilemap->draw(screen, bitmap, cliprect, 0,0);
m_pf1_tilemap->draw(screen, bitmap, cliprect, 0, 0);
/* Draw the sprites */
for (offs = 0;offs < m_spriteram->bytes();offs += 4)
for (int offs = 0; offs < m_spriteram->bytes(); offs += 4)
{
if (m_flipscreen)
m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
buffered_spriteram[offs] + ((buffered_spriteram[offs+2] & 0xc0) << 2),
(buffered_spriteram[offs+2] & 0x1e) >> 1,
1,1,
288-(buffered_spriteram[offs+1] + ((buffered_spriteram[offs+2] & 0x01) << 8)) +18,240-buffered_spriteram[offs+3],0);
m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
src[offs] + ((src[offs + 2] & 0xc0) << 2),
(src[offs + 2] & 0x1e) >> 1,
1, 1,
288 - (src[offs + 1] + ((src[offs + 2] & 0x01) << 8)) + 18, 240 - src[offs + 3], 0
);
else
m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
buffered_spriteram[offs] + ((buffered_spriteram[offs+2] & 0xc0) << 2),
(buffered_spriteram[offs+2] & 0x1e) >> 1,
0,0,
(buffered_spriteram[offs+1] + ((buffered_spriteram[offs+2] & 0x01) << 8)) - 13,buffered_spriteram[offs+3],0);
m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
src[offs] + ((src[offs + 2] & 0xc0) << 2),
(src[offs + 2] & 0x1e) >> 1,
0, 0,
(src[offs + 1] + ((src[offs + 2] & 0x01) << 8)) - 13, src[offs + 3],0
);
}
m_fix_tilemap->draw(screen, bitmap, cliprect, 0,0);
m_fix_tilemap->draw(screen, bitmap, cliprect, 0, 0);
slapfght_log_vram();
return 0;