renegade.cpp: fix sprite vertical alignment, add irq acks [Angelo Salese]

(out of whatsnew: also demoted driver to MIS given it has clear sound
issues)
This commit is contained in:
angelosa 2020-04-19 18:17:06 +02:00
parent 20748b5093
commit 0dec5b71a3
3 changed files with 52 additions and 32 deletions

View File

@ -1,6 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Phil Stroffolino, Carlos A. Lozano, Rob Rosenbrock
/***************************************************************************
/******************************************************************************
Renegade
(c)1986 Taito
@ -18,7 +18,18 @@ NMI is used to refresh the sprites
IRQ is used to handle coin inputs
Known issues:
- coin counter isn't working properly (interrupt related?)
- Knockdown samples farts (coming from YM3526 DAC);
- Static ADPCM sound, end trigger not understood.
Most likely ends when specific data format is encountered during playback
cfr. jantotsu.cpp;
- Verify irq sources;
- Unemulated partial update bg scrolling, which should effectively add layer
tearing at line ~12 according to the refs. Scrolling triggers at line 54 with
current timings so we are quite off;
- None of the refs has the top 8 pixels shown but 256x232 isn't a valid
resolution. Do they show garbage on real HW by any chance?
- coin counter isn't working properly (was tied to $3807, which is actually
irq ack. Most likely unconnected for this -AS)
Memory Map (Preliminary):
@ -99,7 +110,7 @@ ROM
$4000 - $7fff bankswitched ROM
$8000 - $ffff ROM
***************************************************************************/
******************************************************************************/
#include "emu.h"
#include "includes/renegade.h"
@ -221,15 +232,22 @@ TIMER_DEVICE_CALLBACK_MEMBER(renegade_state::interrupt)
{
int scanline = param;
if (scanline == 112) // ???
m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
// sprite DMA
// TODO: what actually generates this?
if (scanline == 16)
m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
else if(scanline == 240)
m_maincpu->set_input_line(0, HOLD_LINE);
m_maincpu->set_input_line(0, ASSERT_LINE);
}
WRITE8_MEMBER(renegade_state::coincounter_w)
WRITE8_MEMBER(renegade_state::nmi_ack_w)
{
//coin_counter_w(offset, data);
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
WRITE8_MEMBER(renegade_state::irq_ack_w)
{
m_maincpu->set_input_line(0, CLEAR_LINE);
}
@ -248,8 +266,8 @@ void renegade_state::renegade_nomcu_map(address_map &map)
map(0x3802, 0x3802).portr("DSW2").w(m_soundlatch, FUNC(generic_latch_8_device::write)); /* DIP2 various IO ports */
map(0x3803, 0x3803).portr("DSW1").w(FUNC(renegade_state::flipscreen_w)); /* DIP1 */
map(0x3805, 0x3805).nopr().w(FUNC(renegade_state::bankswitch_w));
map(0x3806, 0x3806).nopw(); // ?? watchdog
map(0x3807, 0x3807).w(FUNC(renegade_state::coincounter_w));
map(0x3806, 0x3806).w(FUNC(renegade_state::nmi_ack_w));
map(0x3807, 0x3807).w(FUNC(renegade_state::irq_ack_w));
map(0x4000, 0x7fff).bankr("rombank");
map(0x8000, 0xffff).rom();
}
@ -269,6 +287,7 @@ void renegade_state::renegade_sound_map(address_map &map)
map(0x2000, 0x2000).w(FUNC(renegade_state::adpcm_addr_w));
map(0x2800, 0x2801).rw("ymsnd", FUNC(ym3526_device::read), FUNC(ym3526_device::write));
map(0x3000, 0x3000).w(FUNC(renegade_state::adpcm_stop_w));
// map(0x2000, 0x7fff) read in service mode during sound test
map(0x8000, 0xffff).rom();
}
@ -279,8 +298,8 @@ static INPUT_PORTS_START( renegade )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) /* attack left */
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) /* jump */
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Left Attack")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Jump")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
@ -289,8 +308,8 @@ static INPUT_PORTS_START( renegade )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(2) /* attack left */
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2) /* jump */
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Left Attack")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Jump")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
@ -300,10 +319,9 @@ static INPUT_PORTS_START( renegade )
PORT_DIPSETTING( 0x03, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x01, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) /* attack right */
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) /* attack right */
PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_CUSTOM_MEMBER(renegade_state, mcu_status_r)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Right Attack")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Right Attack")
PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(renegade_state, mcu_status_r)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
@ -321,7 +339,7 @@ static INPUT_PORTS_START( renegade )
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:5")
PORT_DIPSETTING( 0x10, "1" )
PORT_DIPSETTING( 0x00, "2" )
PORT_DIPNAME( 0x20, 0x20, "Bonus" ) PORT_DIPLOCATION("SW1:6")
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:6")
PORT_DIPSETTING( 0x20, "30k" )
PORT_DIPSETTING( 0x00, DEF_STR( None ) )
PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:7")
@ -485,15 +503,12 @@ void renegade_state::renegade(machine_config &config)
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)*2); /* not accurate */
screen.set_size(32*8, 32*8);
screen.set_visarea(1*8, 31*8-1, 0, 30*8-1);
screen.set_raw(12000000/2, 384, 0, 256, 272, 0, 240); // assume same as ddragon.cpp
screen.set_screen_update(FUNC(renegade_state::screen_update));
screen.set_palette("palette");
GFXDECODE(config, m_gfxdecode, "palette", gfx_renegade);
PALETTE(config, "palette").set_format(palette_device::xBGR_444, 256);
PALETTE(config, "palette", palette_device::BLACK).set_format(palette_device::xBGR_444, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@ -684,7 +699,7 @@ ROM_END
GAME( 1986, renegade, 0, renegade, renegade, renegade_state, empty_init, ROT0, "Technos Japan (Taito America license)", "Renegade (US)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, renegadeb, renegade, kuniokunb, renegade, renegade_state, empty_init, ROT0, "bootleg", "Renegade (US bootleg)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, kuniokun, renegade, renegade, renegade, renegade_state, empty_init, ROT0, "Technos Japan", "Nekketsu Kouha Kunio-kun (Japan)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, kuniokunb, renegade, kuniokunb, renegade, renegade_state, empty_init, ROT0, "bootleg", "Nekketsu Kouha Kunio-kun (Japan bootleg)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, renegade, 0, renegade, renegade, renegade_state, empty_init, ROT0, "Technos Japan (Taito America license)", "Renegade (US)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND )
GAME( 1986, renegadeb, renegade, kuniokunb, renegade, renegade_state, empty_init, ROT0, "bootleg", "Renegade (US bootleg)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND )
GAME( 1986, kuniokun, renegade, renegade, renegade, renegade_state, empty_init, ROT0, "Technos Japan", "Nekketsu Kouha Kunio-kun (Japan)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND )
GAME( 1986, kuniokunb, renegade, kuniokunb, renegade, renegade_state, empty_init, ROT0, "bootleg", "Nekketsu Kouha Kunio-kun (Japan bootleg)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND )

View File

@ -67,7 +67,8 @@ private:
DECLARE_READ8_MEMBER(mcu_reset_r);
DECLARE_WRITE8_MEMBER(bankswitch_w);
DECLARE_WRITE8_MEMBER(coincounter_w);
DECLARE_WRITE8_MEMBER(irq_ack_w);
DECLARE_WRITE8_MEMBER(nmi_ack_w);
DECLARE_WRITE8_MEMBER(fg_videoram_w);
DECLARE_WRITE8_MEMBER(bg_videoram_w);
DECLARE_WRITE8_MEMBER(flipscreen_w);

View File

@ -75,9 +75,10 @@ void renegade_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
while (source < finish)
{
int sy = 240 - source[0];
// 224 matches reference (stage 1 boss in kuniokun is aligned with the train door)
int sy = 224 - source[0];
if (sy >= 16)
//if (sy >= 0)
{
int attributes = source[1]; /* SFCCBBBB */
int sx = source[3];
@ -88,11 +89,14 @@ void renegade_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
if (sx > 248)
sx -= 256;
// wrap-around (stage 2 bike tires)
if (sy < 0)
sy += 256;
if (flip_screen())
{
sx = 240 - sx;
sy = 240 - sy;
sy = 224 - sy;
xflip = !xflip;
}