technos/renegade.cpp: Corrected sprite RAM size (GitHub #10163). [jotego]

Also combined source files and cleaned up a little.
This commit is contained in:
Vas Crabb 2022-08-02 03:03:29 +10:00
parent f5193fabfa
commit e44d4ccddb
4 changed files with 258 additions and 271 deletions

View File

@ -23,7 +23,7 @@
The fun part is that game doesn't even access the chip at all during gameplay
(or at least not until stage 6, where game disallows continues) while the specific
"delta" registers are instead challenged by Vendetta OTG attacks (cfr. MT#06393, MT#07839).
"delta" registers are instead challenged by Vendetta OTG attacks (cfr. MT06393, MT07839).
**************************************************************************************************/

View File

@ -115,14 +115,224 @@ $8000 - $ffff ROM
******************************************************************************/
#include "emu.h"
#include "renegade.h"
#include "taito68705.h"
#include "cpu/m6502/m6502.h"
#include "cpu/m6809/m6809.h"
#include "machine/gen_latch.h"
#include "machine/timer.h"
#include "sound/msm5205.h"
#include "sound/ymopl.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"
namespace {
class renegade_state : public driver_device
{
public:
renegade_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this,"maincpu")
, m_audiocpu(*this, "audiocpu")
, m_mcu(*this, "mcu")
, m_msm(*this, "msm")
, m_screen(*this, "screen")
, m_gfxdecode(*this, "gfxdecode")
, m_soundlatch(*this, "soundlatch")
, m_fg_videoram(*this, "fg_videoram")
, m_bg_videoram(*this, "bg_videoram")
, m_spriteram(*this, "spriteram")
, m_rombank(*this, "rombank")
, m_adpcmrom(*this, "adpcm")
{
}
void renegade(machine_config &config);
void kuniokunb(machine_config &config);
DECLARE_CUSTOM_INPUT_MEMBER(mcu_status_r);
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
optional_device<taito68705_mcu_device> m_mcu;
required_device<msm5205_device> m_msm;
required_device<screen_device> m_screen;
required_device<gfxdecode_device> m_gfxdecode;
required_device<generic_latch_8_device> m_soundlatch;
required_shared_ptr<uint8_t> m_fg_videoram;
required_shared_ptr<uint8_t> m_bg_videoram;
required_shared_ptr<uint8_t> m_spriteram;
required_memory_bank m_rombank;
required_region_ptr<uint8_t> m_adpcmrom;
uint32_t m_adpcm_pos = 0;
uint32_t m_adpcm_end = 0;
bool m_adpcm_playing = false;
int32_t m_scrollx = 0;
tilemap_t *m_bg_tilemap = nullptr;
tilemap_t *m_fg_tilemap = nullptr;
uint8_t mcu_reset_r();
void bankswitch_w(uint8_t data);
void irq_ack_w(uint8_t data);
void nmi_ack_w(uint8_t data);
void fg_videoram_w(offs_t offset, uint8_t data);
void bg_videoram_w(offs_t offset, uint8_t data);
void flipscreen_w(uint8_t data);
void scroll_lsb_w(uint8_t data);
void scroll_msb_w(uint8_t data);
void adpcm_start_w(uint8_t data);
void adpcm_addr_w(uint8_t data);
void adpcm_stop_w(uint8_t data);
DECLARE_WRITE_LINE_MEMBER(adpcm_int);
TILE_GET_INFO_MEMBER(get_bg_tilemap_info);
TILE_GET_INFO_MEMBER(get_fg_tilemap_info);
TIMER_DEVICE_CALLBACK_MEMBER(interrupt);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void renegade_map(address_map &map);
void renegade_nomcu_map(address_map &map);
void renegade_sound_map(address_map &map);
};
/***************************************************************************
Renegade Video Hardware
***************************************************************************/
void renegade_state::bg_videoram_w(offs_t offset, uint8_t data)
{
m_bg_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset & 0x3ff);
}
void renegade_state::fg_videoram_w(offs_t offset, uint8_t data)
{
m_fg_videoram[offset] = data;
m_fg_tilemap->mark_tile_dirty(offset & 0x3ff);
}
void renegade_state::flipscreen_w(uint8_t data)
{
flip_screen_set(~data & 0x01);
}
void renegade_state::scroll_lsb_w(uint8_t data)
{
m_scrollx = (m_scrollx & 0xff00) | data;
}
void renegade_state::scroll_msb_w(uint8_t data)
{
m_scrollx = (m_scrollx & 0xff) | (data << 8);
}
TILE_GET_INFO_MEMBER(renegade_state::get_bg_tilemap_info)
{
uint8_t const *const source = &m_bg_videoram[tile_index];
uint8_t const attributes = source[0x400]; // CCC??BBB
tileinfo.set(
1 + (attributes & 0x7),
source[0],
attributes >> 5,
0);
}
TILE_GET_INFO_MEMBER(renegade_state::get_fg_tilemap_info)
{
uint8_t const *const source = &m_fg_videoram[tile_index];
uint8_t const attributes = source[0x400];
tileinfo.set(
0,
((attributes & 3) << 8) | source[0],
attributes >> 6,
0);
}
void renegade_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
for (unsigned offset = 0; m_spriteram.length() > offset; offset += 4)
{
uint8_t const *const source = &m_spriteram[offset];
// reference: stage 1 boss in kuniokun is aligned with the train door
int sy = 234 - source[0];
//if (sy >= 0)
{
int const attributes = source[1]; // SFCCBBBB
int sx = source[3];
int const sprite_number = source[2];
int const sprite_bank = 9 + (attributes & 0xf);
int const color = (attributes >> 4) & 0x3;
bool xflip = attributes & 0x40;
if (sx > 248)
sx -= 256;
// wrap-around (stage 2 bike tires)
if (sy < 0)
sy += 256;
if (flip_screen())
{
sx = 240 - sx;
sy = 260 - sy;
xflip = !xflip;
}
if (attributes & 0x80) // big sprite
{
m_gfxdecode->gfx(sprite_bank)->transpen(
bitmap, cliprect,
sprite_number | 1,
color,
xflip, flip_screen(),
sx, sy + (flip_screen() ? -16 : 16), 0);
}
else
{
sy += (flip_screen() ? -16 : 16);
}
m_gfxdecode->gfx(sprite_bank)->transpen(
bitmap, cliprect,
sprite_number,
color,
xflip, flip_screen(),
sx, sy, 0);
}
}
}
uint32_t renegade_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->set_scrollx(0, m_scrollx);
m_bg_tilemap->draw(screen, bitmap, cliprect, 0 , 0);
draw_sprites(bitmap, cliprect);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0 , 0);
return 0;
}
/**************************************************************************/
@ -196,6 +406,16 @@ void renegade_state::machine_start()
{
m_rombank->configure_entries(0, 2, memregion("maincpu")->base(), 0x4000);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(renegade_state::get_bg_tilemap_info)), TILEMAP_SCAN_ROWS, 16, 16, 64, 16);
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(renegade_state::get_fg_tilemap_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_fg_tilemap->set_transparent_pen(0);
m_bg_tilemap->set_scrolldx(256, 0);
m_fg_tilemap->set_scrolldy(10, 10);
m_bg_tilemap->set_scrolldy(10, 10);
save_item(NAME(m_scrollx));
save_item(NAME(m_adpcm_pos));
save_item(NAME(m_adpcm_end));
save_item(NAME(m_adpcm_playing));
@ -241,13 +461,13 @@ void renegade_state::bankswitch_w(uint8_t data)
TIMER_DEVICE_CALLBACK_MEMBER(renegade_state::interrupt)
{
int scanline = param;
int const scanline = param;
// nmi 8 lines before vsync
// NMI 8 lines before vsync
if (scanline == 265)
m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
// irq 16 clks per frame: once every 16 lines, but increases to 24 lines during vblank
// IRQ 16 clocks per frame: once every 16 lines, but increases to 24 lines during vblank
// (lines 16,40,56,72,88,104,120,136,152,168,184,200,216,232,248,264)
if (scanline == 0x10 || (scanline > 0x20 && (scanline & 0xf) == 8))
m_maincpu->set_input_line(0, ASSERT_LINE);
@ -269,20 +489,20 @@ void renegade_state::irq_ack_w(uint8_t data)
void renegade_state::renegade_nomcu_map(address_map &map)
{
map(0x0000, 0x17ff).ram();
map(0x1800, 0x1fff).ram().w(FUNC(renegade_state::fg_videoram_w)).share("fg_videoram");
map(0x2000, 0x27ff).ram().share("spriteram");
map(0x2800, 0x2fff).ram().w(FUNC(renegade_state::bg_videoram_w)).share("bg_videoram");
map(0x1800, 0x1fff).ram().w(FUNC(renegade_state::fg_videoram_w)).share(m_fg_videoram);
map(0x2000, 0x20ff).mirror(0x0700).ram().share(m_spriteram);
map(0x2800, 0x2fff).ram().w(FUNC(renegade_state::bg_videoram_w)).share(m_bg_videoram);
map(0x3000, 0x30ff).ram().w("palette", FUNC(palette_device::write8)).share("palette");
map(0x3100, 0x31ff).ram().w("palette", FUNC(palette_device::write8_ext)).share("palette_ext");
map(0x3800, 0x3800).portr("IN0").w(FUNC(renegade_state::scroll_lsb_w)); /* Player#1 controls, P1,P2 start */
map(0x3801, 0x3801).portr("IN1").w(FUNC(renegade_state::scroll_msb_w)); /* Player#2 controls, coin triggers */
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(0x3800, 0x3800).portr("IN0").w(FUNC(renegade_state::scroll_lsb_w)); // Player 1 controls, P1,P2 start
map(0x3801, 0x3801).portr("IN1").w(FUNC(renegade_state::scroll_msb_w)); // Player 2 controls, coin triggers
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).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();
map(0x4000, 0x7fff).bankr(m_rombank);
map(0x8000, 0xffff).rom().region("maincpu", 0x8000);
}
void renegade_state::renegade_map(address_map &map)
@ -301,7 +521,7 @@ void renegade_state::renegade_sound_map(address_map &map)
map(0x2800, 0x2fff).rw("ymsnd", FUNC(ym3526_device::read), FUNC(ym3526_device::write));
map(0x3000, 0x37ff).w(FUNC(renegade_state::adpcm_stop_w));
map(0x3800, 0x7fff).nopr(); // misc reads in service mode during sound test
map(0x8000, 0xffff).rom();
map(0x8000, 0xffff).rom().region("audiocpu", 0);
}
INPUT_CHANGED_MEMBER(renegade_state::coin_inserted)
@ -554,18 +774,18 @@ void renegade_state::kuniokunb(machine_config &config)
ROM_START( renegade )
ROM_REGION( 0x10000, "maincpu", 0 ) /* 64k for code + bank switched ROM */
ROM_LOAD( "na-5.ic52", 0x00000, 0x8000, CRC(de7e7df4) SHA1(7d26ac29e0b5858d9a0c0cdc86c864e464145260) )
ROM_LOAD( "nb-5.ic51", 0x08000, 0x8000, CRC(ba683ddf) SHA1(7516fac1c4fd14cbf43481e94c0c26c662c4cd28) )
ROM_REGION( 0x10000, "maincpu", 0 ) // 64k for code + bank switched ROM
ROM_LOAD( "na-5.ic52", 0x00000, 0x8000, CRC(de7e7df4) SHA1(7d26ac29e0b5858d9a0c0cdc86c864e464145260) ) // two banks at 0x4000
ROM_LOAD( "nb-5.ic51", 0x08000, 0x8000, CRC(ba683ddf) SHA1(7516fac1c4fd14cbf43481e94c0c26c662c4cd28) ) // fixed at 0x8000
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "n0-5.ic13", 0x8000, 0x8000, CRC(3587de3b) SHA1(f82e758254b21eb0c5a02469c72adb86d9577065) )
ROM_REGION( 0x08000, "audiocpu", 0 )
ROM_LOAD( "n0-5.ic13", 0x00000, 0x8000, CRC(3587de3b) SHA1(f82e758254b21eb0c5a02469c72adb86d9577065) )
ROM_REGION( 0x0800, "mcu:mcu", 0 ) /* MC68705P5 */
ROM_REGION( 0x00800, "mcu:mcu", 0 ) /* MC68705P5 */
ROM_LOAD( "nz-5.ic97", 0x0000, 0x0800, CRC(32e47560) SHA1(93a386b3f3c8eb35a53487612147a877dc7453ff) )
ROM_REGION( 0x08000, "chars", 0 )
ROM_LOAD( "nc-5.bin", 0x0000, 0x8000, CRC(9adfaa5d) SHA1(7bdb7bd4387b49e0489f9539161e1ed9d8f9f6a0) )
ROM_LOAD( "nc-5.bin", 0x00000, 0x8000, CRC(9adfaa5d) SHA1(7bdb7bd4387b49e0489f9539161e1ed9d8f9f6a0) )
ROM_REGION( 0x30000, "tiles", 0 )
ROM_LOAD( "n1-5.ic1", 0x00000, 0x8000, CRC(4a9f47f3) SHA1(01c94bc4c85314f1e0caa3afe91705875d118c13) )
@ -596,15 +816,15 @@ ROM_START( renegade )
ROM_END
ROM_START( renegadeb )
ROM_REGION( 0x10000, "maincpu", 0 ) /* 64k for code + bank switched ROM */
ROM_LOAD( "na-5.ic52", 0x00000, 0x8000, CRC(de7e7df4) SHA1(7d26ac29e0b5858d9a0c0cdc86c864e464145260) )
ROM_LOAD( "40.ic51", 0x08000, 0x8000, CRC(3dbaac11) SHA1(a40470514f01a1a9c159de0aa416ea3940be76e8) ) // bootleg
ROM_REGION( 0x10000, "maincpu", 0 ) // 64k for code + bank switched ROM
ROM_LOAD( "na-5.ic52", 0x00000, 0x8000, CRC(de7e7df4) SHA1(7d26ac29e0b5858d9a0c0cdc86c864e464145260) )
ROM_LOAD( "40.ic51", 0x08000, 0x8000, CRC(3dbaac11) SHA1(a40470514f01a1a9c159de0aa416ea3940be76e8) ) // bootleg
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "n0-5.ic13", 0x8000, 0x8000, CRC(3587de3b) SHA1(f82e758254b21eb0c5a02469c72adb86d9577065) )
ROM_REGION( 0x08000, "audiocpu", 0 )
ROM_LOAD( "n0-5.ic13", 0x00000, 0x8000, CRC(3587de3b) SHA1(f82e758254b21eb0c5a02469c72adb86d9577065) )
ROM_REGION( 0x08000, "chars", 0 )
ROM_LOAD( "nc-5.bin", 0x0000, 0x8000, CRC(9adfaa5d) SHA1(7bdb7bd4387b49e0489f9539161e1ed9d8f9f6a0) )
ROM_LOAD( "nc-5.bin", 0x00000, 0x8000, CRC(9adfaa5d) SHA1(7bdb7bd4387b49e0489f9539161e1ed9d8f9f6a0) )
ROM_REGION( 0x30000, "tiles", 0 )
ROM_LOAD( "n1-5.ic1", 0x00000, 0x8000, CRC(4a9f47f3) SHA1(01c94bc4c85314f1e0caa3afe91705875d118c13) )
@ -635,15 +855,15 @@ ROM_START( renegadeb )
ROM_END
ROM_START( kuniokun )
ROM_REGION( 0x10000, "maincpu", 0 ) /* 64k for code + bank switched ROM */
ROM_REGION( 0x10000, "maincpu", 0 ) // 64k for code + bank switched ROM
ROM_LOAD( "ta18-11.bin", 0x00000, 0x8000, CRC(f240f5cd) SHA1(ed6875e8ad2988e88389d4f63ff448d0823c195f) )
ROM_LOAD( "nb-01.bin", 0x08000, 0x8000, CRC(93fcfdf5) SHA1(51cdb9377544ae17895e427f21d150ce195ab8e7) ) // original
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "n0-5.bin", 0x8000, 0x8000, CRC(3587de3b) SHA1(f82e758254b21eb0c5a02469c72adb86d9577065) )
ROM_REGION( 0x08000, "audiocpu", 0 )
ROM_LOAD( "n0-5.bin", 0x00000, 0x8000, CRC(3587de3b) SHA1(f82e758254b21eb0c5a02469c72adb86d9577065) )
ROM_REGION( 0x0800, "mcu:mcu", 0 ) // MC68705P3
ROM_LOAD( "nz-0.bin", 0x0000, 0x0800, CRC(98a39880) SHA1(3bca7ba73bd9dba5d32e56a48e80b1f1e8257ed8) )
ROM_REGION( 0x00800, "mcu:mcu", 0 ) // MC68705P3
ROM_LOAD( "nz-0.bin", 0x00000, 0x0800, CRC(98a39880) SHA1(3bca7ba73bd9dba5d32e56a48e80b1f1e8257ed8) )
ROM_REGION( 0x08000, "chars", 0 )
ROM_LOAD( "ta18-25.bin", 0x0000, 0x8000, CRC(9bd2bea3) SHA1(fa79c9d4c71c1dbbf0e14cb8d6870f1f94b9af88) )
@ -677,15 +897,15 @@ ROM_START( kuniokun )
ROM_END
ROM_START( kuniokunb )
ROM_REGION( 0x10000, "maincpu", 0 ) /* 64k for code + bank switched ROM */
ROM_REGION( 0x10000, "maincpu", 0 ) // 64k for code + bank switched ROM
ROM_LOAD( "ta18-11.bin", 0x00000, 0x8000, CRC(f240f5cd) SHA1(ed6875e8ad2988e88389d4f63ff448d0823c195f) )
ROM_LOAD( "ta18-10.bin", 0x08000, 0x8000, CRC(a90cf44a) SHA1(6d63d9c29da7b8c5bc391e074b6b8fe6ae3892ae) ) // bootleg
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "n0-5.bin", 0x8000, 0x8000, CRC(3587de3b) SHA1(f82e758254b21eb0c5a02469c72adb86d9577065) )
ROM_REGION( 0x08000, "audiocpu", 0 )
ROM_LOAD( "n0-5.bin", 0x00000, 0x8000, CRC(3587de3b) SHA1(f82e758254b21eb0c5a02469c72adb86d9577065) )
ROM_REGION( 0x08000, "chars", 0 )
ROM_LOAD( "ta18-25.bin", 0x0000, 0x8000, CRC(9bd2bea3) SHA1(fa79c9d4c71c1dbbf0e14cb8d6870f1f94b9af88) )
ROM_LOAD( "ta18-25.bin", 0x00000, 0x8000, CRC(9bd2bea3) SHA1(fa79c9d4c71c1dbbf0e14cb8d6870f1f94b9af88) )
ROM_REGION( 0x30000, "tiles", 0 )
ROM_LOAD( "ta18-01.bin", 0x00000, 0x8000, CRC(daf15024) SHA1(f37de97275f52dfbbad7bf8c82f8108e84bcf63e) )
@ -715,6 +935,7 @@ ROM_START( kuniokunb )
ROM_LOAD( "ta18-07.bin", 0x10000, 0x8000, CRC(02e3f3ed) SHA1(ab09b3af2c4ab9a36eb1273bcc7c788350048554) )
ROM_END
} // anonymous namespace
GAME( 1986, renegade, 0, renegade, renegade, renegade_state, empty_init, ROT0, "Technos Japan (Taito America license)", "Renegade (US)", MACHINE_SUPPORTS_SAVE )

View File

@ -1,100 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Phil Stroffolino, Carlos A. Lozano, Rob Rosenbrock
#ifndef MAME_TECHNOS_RENEGADE_H
#define MAME_TECHNOS_RENEGADE_H
#pragma once
#include "taito68705.h"
#include "machine/gen_latch.h"
#include "machine/timer.h"
#include "sound/msm5205.h"
#include "tilemap.h"
#include "screen.h"
class renegade_state : public driver_device
{
public:
renegade_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this,"maincpu")
, m_audiocpu(*this, "audiocpu")
, m_mcu(*this, "mcu")
, m_msm(*this, "msm")
, m_screen(*this, "screen")
, m_gfxdecode(*this, "gfxdecode")
, m_soundlatch(*this, "soundlatch")
, m_fg_videoram(*this, "fg_videoram")
, m_bg_videoram(*this, "bg_videoram")
, m_spriteram(*this, "spriteram")
, m_rombank(*this, "rombank")
, m_adpcmrom(*this, "adpcm")
{
}
void renegade(machine_config &config);
void kuniokunb(machine_config &config);
DECLARE_CUSTOM_INPUT_MEMBER(mcu_status_r);
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
optional_device<taito68705_mcu_device> m_mcu;
required_device<msm5205_device> m_msm;
required_device<screen_device> m_screen;
required_device<gfxdecode_device> m_gfxdecode;
required_device<generic_latch_8_device> m_soundlatch;
required_shared_ptr<uint8_t> m_fg_videoram;
required_shared_ptr<uint8_t> m_bg_videoram;
required_shared_ptr<uint8_t> m_spriteram;
required_memory_bank m_rombank;
required_region_ptr<uint8_t> m_adpcmrom;
uint32_t m_adpcm_pos = 0;
uint32_t m_adpcm_end = 0;
bool m_adpcm_playing = false;
int32_t m_scrollx = 0;
tilemap_t *m_bg_tilemap = nullptr;
tilemap_t *m_fg_tilemap = nullptr;
uint8_t mcu_reset_r();
void bankswitch_w(uint8_t data);
void irq_ack_w(uint8_t data);
void nmi_ack_w(uint8_t data);
void fg_videoram_w(offs_t offset, uint8_t data);
void bg_videoram_w(offs_t offset, uint8_t data);
void flipscreen_w(uint8_t data);
void scroll_lsb_w(uint8_t data);
void scroll_msb_w(uint8_t data);
void adpcm_start_w(uint8_t data);
void adpcm_addr_w(uint8_t data);
void adpcm_stop_w(uint8_t data);
DECLARE_WRITE_LINE_MEMBER(adpcm_int);
TILE_GET_INFO_MEMBER(get_bg_tilemap_info);
TILE_GET_INFO_MEMBER(get_fg_tilemap_info);
TIMER_DEVICE_CALLBACK_MEMBER(interrupt);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void renegade_map(address_map &map);
void renegade_nomcu_map(address_map &map);
void renegade_sound_map(address_map &map);
};
#endif // MAME_TECHNOS_RENEGADE_H

View File

@ -1,134 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Phil Stroffolino, Carlos A. Lozano, Rob Rosenbrock
/***************************************************************************
Renegade Video Hardware
***************************************************************************/
#include "emu.h"
#include "renegade.h"
void renegade_state::bg_videoram_w(offs_t offset, uint8_t data)
{
m_bg_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset & 0x3ff);
}
void renegade_state::fg_videoram_w(offs_t offset, uint8_t data)
{
m_fg_videoram[offset] = data;
m_fg_tilemap->mark_tile_dirty(offset & 0x3ff);
}
void renegade_state::flipscreen_w(uint8_t data)
{
flip_screen_set(~data & 0x01);
}
void renegade_state::scroll_lsb_w(uint8_t data)
{
m_scrollx = (m_scrollx & 0xff00) | data;
}
void renegade_state::scroll_msb_w(uint8_t data)
{
m_scrollx = (m_scrollx & 0xff) | (data << 8);
}
TILE_GET_INFO_MEMBER(renegade_state::get_bg_tilemap_info)
{
const uint8_t *source = &m_bg_videoram[tile_index];
uint8_t attributes = source[0x400]; /* CCC??BBB */
tileinfo.set(1 + (attributes & 0x7),
source[0],
attributes >> 5,
0);
}
TILE_GET_INFO_MEMBER(renegade_state::get_fg_tilemap_info)
{
const uint8_t *source = &m_fg_videoram[tile_index];
uint8_t attributes = source[0x400];
tileinfo.set(0,
((attributes & 3) << 8) | source[0],
attributes >> 6,
0);
}
void renegade_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(renegade_state::get_bg_tilemap_info)), TILEMAP_SCAN_ROWS, 16, 16, 64, 16);
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(renegade_state::get_fg_tilemap_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_fg_tilemap->set_transparent_pen(0);
m_bg_tilemap->set_scrolldx(256, 0);
m_fg_tilemap->set_scrolldy(10, 10);
m_bg_tilemap->set_scrolldy(10, 10);
save_item(NAME(m_scrollx));
}
void renegade_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
uint8_t *source = m_spriteram;
uint8_t *finish = source + 96 * 4;
while (source < finish)
{
// reference: stage 1 boss in kuniokun is aligned with the train door
int sy = 234 - source[0];
//if (sy >= 0)
{
int attributes = source[1]; /* SFCCBBBB */
int sx = source[3];
int sprite_number = source[2];
int sprite_bank = 9 + (attributes & 0xf);
int color = (attributes >> 4) & 0x3;
int xflip = attributes & 0x40;
if (sx > 248)
sx -= 256;
// wrap-around (stage 2 bike tires)
if (sy < 0)
sy += 256;
if (flip_screen())
{
sx = 240 - sx;
sy = 260 - sy;
xflip = !xflip;
}
if (attributes & 0x80) /* big sprite */
{
m_gfxdecode->gfx(sprite_bank)->transpen(bitmap,cliprect,
sprite_number | 1,
color,
xflip, flip_screen(),
sx, sy + (flip_screen() ? -16 : 16), 0);
}
else
{
sy += (flip_screen() ? -16 : 16);
}
m_gfxdecode->gfx(sprite_bank)->transpen(bitmap,cliprect,
sprite_number,
color,
xflip, flip_screen(),
sx, sy, 0);
}
source += 4;
}
}
uint32_t renegade_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->set_scrollx(0, m_scrollx);
m_bg_tilemap->draw(screen, bitmap, cliprect, 0 , 0);
draw_sprites(bitmap, cliprect);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0 , 0);
return 0;
}