technos/mystston.cpp, technos/shadfrce.cpp, technos/ssozumo.cpp, technos/tagteam.cpp: consolidated drivers in single files, minor cleanups

This commit is contained in:
Ivan Vangelista 2022-08-19 05:50:58 +02:00
parent e5a902f4b4
commit 19c91d2631
12 changed files with 1238 additions and 1401 deletions

View File

@ -16,11 +16,358 @@
***************************************************************************/
#include "emu.h"
#include "mystston.h"
#include "cpu/m6502/m6502.h"
#include "speaker.h"
#include "sound/ay8910.h"
#include "video/resnet.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"
namespace {
class mystston_state : public driver_device
{
public:
mystston_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_ay8910(*this, "ay%u", 1U),
m_ay8910_data(*this, "ay8910_data"),
m_ay8910_select(*this, "ay8910_select"),
m_dsw1(*this, "DSW1"),
m_bg_videoram(*this, "bg_videoram"),
m_fg_videoram(*this, "fg_videoram"),
m_spriteram(*this, "spriteram"),
m_paletteram(*this, "paletteram"),
m_scroll(*this, "scroll"),
m_video_control(*this, "video_control"),
m_color_prom(*this, "proms"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette") { }
void mystston(machine_config &config);
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
protected:
virtual void video_start() override;
virtual void video_reset() override;
private:
static constexpr XTAL MASTER_CLOCK = XTAL(12'000'000);
// machine state
required_device<cpu_device> m_maincpu;
required_device_array<ay8910_device, 2> m_ay8910;
required_shared_ptr<uint8_t> m_ay8910_data;
required_shared_ptr<uint8_t> m_ay8910_select;
required_ioport m_dsw1;
// video state
tilemap_t *m_fg_tilemap = nullptr;
tilemap_t *m_bg_tilemap = nullptr;
emu_timer *m_interrupt_timer = nullptr;
required_shared_ptr<uint8_t> m_bg_videoram;
required_shared_ptr<uint8_t> m_fg_videoram;
required_shared_ptr<uint8_t> m_spriteram;
required_shared_ptr<uint8_t> m_paletteram;
required_shared_ptr<uint8_t> m_scroll;
required_shared_ptr<uint8_t> m_video_control;
required_region_ptr<uint8_t> m_color_prom;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
// HMC20
// set_raw(MASTER_CLOCK / 2, 384, 0, 256, 272, 8, 248)
static constexpr XTAL PIXEL_CLOCK = (MASTER_CLOCK / 2);
static constexpr int HTOTAL = (384);
static constexpr int HBEND = (0);
static constexpr int HBSTART = (256);
static constexpr int VTOTAL = (272); // counts from 0x08-0xff, then from 0xe8-0xff
static constexpr int VBEND = (8);
static constexpr int VBSTART = (248);
static constexpr int FIRST_INT_VPOS = (0x008);
static constexpr int INT_HPOS = (0x100);
void irq_clear_w(uint8_t data);
void ay8910_select_w(uint8_t data);
void video_control_w(uint8_t data);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(interrupt_callback);
void set_palette();
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int flip);
void on_scanline_interrupt();
void main_map(address_map &map);
};
// video
/***************************************************************************
There are only a few differences between the video hardware of Mysterious
Stones and Mat Mania. The tile bank select bit is different and the sprite
selection seems to be different as well. Additionally, the palette is stored
differently. I'm also not sure that the 2nd tile page is really used in
Mysterious Stones.
***************************************************************************/
/*************************************
*
* Scanline interrupt system
*
* There is an interrupt every 16
* scanlines, starting with 8.
*
*************************************/
TIMER_CALLBACK_MEMBER(mystston_state::interrupt_callback)
{
int scanline = param;
on_scanline_interrupt();
scanline = scanline + 16;
if (scanline >= VTOTAL)
scanline = FIRST_INT_VPOS;
// the vertical synch chain is clocked by H256 -- this is probably not important, but oh well
m_interrupt_timer->adjust(m_screen->time_until_pos(scanline - 1, INT_HPOS), scanline);
}
/*************************************
*
* Palette handling
*
*************************************/
void mystston_state::set_palette()
{
static const int resistances_rg[3] = { 4700, 3300, 1500 };
static const int resistances_b [2] = { 3300, 1500 };
double weights_rg[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_rg, 0, 4700,
2, resistances_b, weights_b, 0, 4700,
0, nullptr, nullptr, 0, 0);
for (int i = 0; i < 0x40; i++)
{
uint8_t data;
// first half is dynamic, second half is from the PROM
if (i & 0x20)
data = m_color_prom[i & 0x1f];
else
data = m_paletteram[i];
// red component
int bit0 = (data >> 0) & 0x01;
int bit1 = (data >> 1) & 0x01;
int bit2 = (data >> 2) & 0x01;
int r = combine_weights(weights_rg, bit0, bit1, bit2);
// green component
bit0 = (data >> 3) & 0x01;
bit1 = (data >> 4) & 0x01;
bit2 = (data >> 5) & 0x01;
int g = combine_weights(weights_rg, bit0, bit1, bit2);
// blue component
bit0 = (data >> 6) & 0x01;
bit1 = (data >> 7) & 0x01;
int b = combine_weights(weights_b, bit0, bit1);
m_palette->set_pen_color(i, rgb_t(r, g, b));
}
}
/*************************************
*
* Video control register
*
*************************************/
void mystston_state::video_control_w(uint8_t data)
{
*m_video_control = data;
// D0-D1 - foreground text color
// D2 - background page select
// D3 - unused
// D4-D5 - coin counters in flipped order
machine().bookkeeping().coin_counter_w(0, data & 0x20);
machine().bookkeeping().coin_counter_w(1, data & 0x10);
// D6 - unused
// D7 - screen flip
}
/*************************************
*
* Tilemap callbacks
*
*************************************/
TILE_GET_INFO_MEMBER(mystston_state::get_bg_tile_info)
{
int page = (*m_video_control & 0x04) << 8;
int code = ((m_bg_videoram[page | 0x200 | tile_index] & 0x01) << 8) | m_bg_videoram[page | tile_index];
int flags = (tile_index & 0x10) ? TILE_FLIPY : 0;
tileinfo.set(1, code, 0, flags);
}
TILE_GET_INFO_MEMBER(mystston_state::get_fg_tile_info)
{
int code = ((m_fg_videoram[0x400 | tile_index] & 0x07) << 8) | m_fg_videoram[tile_index];
int color = ((*m_video_control & 0x01) << 1) | ((*m_video_control & 0x02) >> 1);
tileinfo.set(0, code, color, 0);
}
/*************************************
*
* Sprite drawing
*
*************************************/
void mystston_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int flip)
{
for (int offs = 0; offs < 0x60; offs += 4)
{
int const attr = m_spriteram[offs];
if (attr & 0x01)
{
int const code = ((attr & 0x10) << 4) | m_spriteram[offs + 1];
int const color = (attr & 0x08) >> 3;
int flipx = attr & 0x04;
int flipy = attr & 0x02;
int x = 240 - m_spriteram[offs + 3];
int y = (240 - m_spriteram[offs + 2]) & 0xff;
if (flip)
{
x = 240 - x;
y = 240 - y;
flipx = !flipx;
flipy = !flipy;
}
gfx->transpen(bitmap, cliprect, code, color, flipx, flipy, x, y, 0);
}
}
}
/*************************************
*
* Start
*
*************************************/
void mystston_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mystston_state::get_bg_tile_info)), TILEMAP_SCAN_COLS_FLIP_X, 16, 16, 16, 32);
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mystston_state::get_fg_tile_info)), TILEMAP_SCAN_COLS_FLIP_X, 8, 8, 32, 32);
m_fg_tilemap->set_transparent_pen(0);
// create the interrupt timer
m_interrupt_timer = timer_alloc(FUNC(mystston_state::interrupt_callback), this);
}
/*************************************
*
* Reset
*
*************************************/
void mystston_state::video_reset()
{
m_interrupt_timer->adjust(m_screen->time_until_pos(FIRST_INT_VPOS - 1, INT_HPOS), FIRST_INT_VPOS);
}
/*************************************
*
* Update
*
*************************************/
uint32_t mystston_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int const flip = (*m_video_control & 0x80) ^ ((m_dsw1->read() & 0x20) << 2);
set_palette();
machine().tilemap().mark_all_dirty();
m_bg_tilemap->set_scrolly(0, *m_scroll);
machine().tilemap().set_flip_all(flip ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect, m_gfxdecode->gfx(2), flip);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
}
/*************************************
*
* Graphics decoding
*
*************************************/
static const gfx_layout spritelayout =
{
16,16,
RGN_FRAC(1,3),
3,
{ RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) },
{ 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
16*0+0, 16*0+1, 16*0+2, 16*0+3, 16*0+4, 16*0+5, 16*0+6, 16*0+7 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
32*8
};
static GFXDECODE_START( gfx_mystston )
GFXDECODE_ENTRY( "fgtiles_sprites", 0, gfx_8x8x3_planar, 4*8, 4 )
GFXDECODE_ENTRY( "bgtiles", 0, spritelayout, 2*8, 1 )
GFXDECODE_ENTRY( "fgtiles_sprites", 0, spritelayout, 0*8, 2 )
GFXDECODE_END
// machine
/*************************************
*
@ -180,8 +527,6 @@ static INPUT_PORTS_START( myststonoi )
PORT_DIPSETTING( 0x00, "3" )
INPUT_PORTS_END
/*************************************
*
* Machine driver
@ -195,7 +540,13 @@ void mystston_state::mystston(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &mystston_state::main_map);
// video hardware
video(config);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_mystston);
PALETTE(config, m_palette).set_entries(0x40);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART);
m_screen->set_screen_update(FUNC(mystston_state::screen_update));
m_screen->set_palette(m_palette);
// audio hardware
SPEAKER(config, "mono").front_center();
@ -222,7 +573,7 @@ ROM_START( mystston )
ROM_LOAD( "rom2.bin", 0xc000, 0x2000, CRC(bfd22cfc) SHA1(137cd61c8b1e997e7e50edd57f1671031d8e3ac5) )
ROM_LOAD( "rom1.bin", 0xe000, 0x2000, CRC(fb163e38) SHA1(d6f02e90bfd9badd7751bc0a87fdfdd1d0a7e202) )
ROM_REGION( 0x0c000, "gfx1", 0 )
ROM_REGION( 0x0c000, "fgtiles_sprites", 0 )
ROM_LOAD( "ms6", 0x00000, 0x2000, CRC(85c83806) SHA1(cdfed6c224754e8f79b154533b06b7de4a44b4d3) )
ROM_LOAD( "ms9", 0x02000, 0x2000, CRC(b146c6ab) SHA1(712c0c17780f222be5c8b09185a22e900ab23944) )
ROM_LOAD( "ms7", 0x04000, 0x2000, CRC(d025f84d) SHA1(eaaaa0bde3db850098d04a0af85993026e503fc5) )
@ -230,7 +581,7 @@ ROM_START( mystston )
ROM_LOAD( "ms8", 0x08000, 0x2000, CRC(53765d89) SHA1(c8bfc311123b076dccae9f7e3b95460bf9fc843d) )
ROM_LOAD( "ms11", 0x0a000, 0x2000, CRC(919ee527) SHA1(609ee854ab3a4fdbf3404a68a4a657b85250f742) )
ROM_REGION( 0x0c000, "gfx2", 0 )
ROM_REGION( 0x0c000, "bgtiles", 0 )
ROM_LOAD( "ms12", 0x00000, 0x2000, CRC(72d8331d) SHA1(f0a3bc6c9d9966f169f4721c2453f7ee210f0feb) )
ROM_LOAD( "ms13", 0x02000, 0x2000, CRC(845a1f9b) SHA1(aa2eabd2a5e89e150b5d2fb3d88f91902e5ebb48) )
ROM_LOAD( "ms14", 0x04000, 0x2000, CRC(822874b0) SHA1(9376d48045bf67df91d103effd1d08bd8debad26) )
@ -262,7 +613,7 @@ ROM_START( myststono ) // TA-0010-P1-1 + TA-0010-P2-1 PCBs
ROM_LOAD( "bw04.ic62", 0xc000, 0x2000, CRC(47cefe9b) SHA1(49422b664b1322373a9cd3cb2907f8f5492faf87) )
ROM_LOAD( "bw05.ic61", 0xe000, 0x2000, CRC(b37ae12b) SHA1(55ee1193088145c85adddd377d9e5ee58aca922f) )
ROM_REGION( 0xc000, "gfx1", 0 )
ROM_REGION( 0xc000, "fgtiles_sprites", 0 )
ROM_LOAD( "bw06.ic105", 0x00000, 0x2000, CRC(85c83806) SHA1(cdfed6c224754e8f79b154533b06b7de4a44b4d3) )
ROM_LOAD( "bw09.ic93", 0x02000, 0x2000, CRC(b146c6ab) SHA1(712c0c17780f222be5c8b09185a22e900ab23944) )
ROM_LOAD( "bw07.ic107", 0x04000, 0x2000, CRC(d025f84d) SHA1(eaaaa0bde3db850098d04a0af85993026e503fc5) )
@ -270,7 +621,7 @@ ROM_START( myststono ) // TA-0010-P1-1 + TA-0010-P2-1 PCBs
ROM_LOAD( "bw08.ic109", 0x08000, 0x2000, CRC(53765d89) SHA1(c8bfc311123b076dccae9f7e3b95460bf9fc843d) )
ROM_LOAD( "bw11.ic97", 0x0a000, 0x2000, CRC(919ee527) SHA1(609ee854ab3a4fdbf3404a68a4a657b85250f742) )
ROM_REGION( 0x0c000, "gfx2", 0 )
ROM_REGION( 0x0c000, "bgtiles", 0 )
ROM_LOAD( "bw12.ic15", 0x00000, 0x2000, CRC(72d8331d) SHA1(f0a3bc6c9d9966f169f4721c2453f7ee210f0feb) )
ROM_LOAD( "bw13.ic20", 0x02000, 0x2000, CRC(845a1f9b) SHA1(aa2eabd2a5e89e150b5d2fb3d88f91902e5ebb48) )
ROM_LOAD( "bw14.ic24", 0x04000, 0x2000, CRC(822874b0) SHA1(9376d48045bf67df91d103effd1d08bd8debad26) )
@ -292,7 +643,7 @@ ROM_START( myststonoi )
ROM_LOAD( "8.bin", 0xc000, 0x2000, CRC(47cefe9b) SHA1(49422b664b1322373a9cd3cb2907f8f5492faf87) )
ROM_LOAD( "7.bin", 0xe000, 0x2000, CRC(b37ae12b) SHA1(55ee1193088145c85adddd377d9e5ee58aca922f) )
ROM_REGION( 0x0c000, "gfx1", 0 )
ROM_REGION( 0x0c000, "fgtiles_sprites", 0 )
ROM_LOAD( "18.bin", 0x00000, 0x2000, CRC(85c83806) SHA1(cdfed6c224754e8f79b154533b06b7de4a44b4d3) )
ROM_LOAD( "15.bin", 0x02000, 0x2000, CRC(b146c6ab) SHA1(712c0c17780f222be5c8b09185a22e900ab23944) )
ROM_LOAD( "19.bin", 0x04000, 0x2000, CRC(d025f84d) SHA1(eaaaa0bde3db850098d04a0af85993026e503fc5) )
@ -300,7 +651,7 @@ ROM_START( myststonoi )
ROM_LOAD( "20.bin", 0x08000, 0x2000, CRC(53765d89) SHA1(c8bfc311123b076dccae9f7e3b95460bf9fc843d) )
ROM_LOAD( "17.bin", 0x0a000, 0x2000, CRC(919ee527) SHA1(609ee854ab3a4fdbf3404a68a4a657b85250f742) )
ROM_REGION( 0x0c000, "gfx2", 0 )
ROM_REGION( 0x0c000, "bgtiles", 0 )
ROM_LOAD( "1.bin", 0x00000, 0x2000, CRC(72d8331d) SHA1(f0a3bc6c9d9966f169f4721c2453f7ee210f0feb) )
ROM_LOAD( "2.bin", 0x02000, 0x2000, CRC(845a1f9b) SHA1(aa2eabd2a5e89e150b5d2fb3d88f91902e5ebb48) )
ROM_LOAD( "3.bin", 0x04000, 0x2000, CRC(822874b0) SHA1(9376d48045bf67df91d103effd1d08bd8debad26) )
@ -317,6 +668,7 @@ ROM_START( myststonoi )
ROM_LOAD( "pal16r4-2.bin", 0x0000, 0x0104, CRC(c57555d0) SHA1(c1cda869de8457b9f8ca4f41f0ed49916110ff2e) )
ROM_END
} // anonymous namespace
/*************************************

View File

@ -1,83 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria
/***************************************************************************
Technos Mysterious Stones hardware
driver by Nicola Salmoria
***************************************************************************/
#include "sound/ay8910.h"
#include "emupal.h"
#include "screen.h"
#include "tilemap.h"
class mystston_state : public driver_device
{
public:
mystston_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_ay8910(*this, "ay%u", 1U),
m_ay8910_data(*this, "ay8910_data"),
m_ay8910_select(*this, "ay8910_select"),
m_dsw1(*this, "DSW1"),
m_bg_videoram(*this, "bg_videoram"),
m_fg_videoram(*this, "fg_videoram"),
m_spriteram(*this, "spriteram"),
m_paletteram(*this, "paletteram"),
m_scroll(*this, "scroll"),
m_video_control(*this, "video_control"),
m_color_prom(*this, "proms"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette") { }
void mystston(machine_config &config);
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
protected:
virtual void video_start() override;
virtual void video_reset() override;
private:
static constexpr XTAL MASTER_CLOCK = XTAL(12'000'000);
// machine state
required_device_array<ay8910_device, 2> m_ay8910;
required_shared_ptr<uint8_t> m_ay8910_data;
required_shared_ptr<uint8_t> m_ay8910_select;
required_ioport m_dsw1;
// video state
tilemap_t *m_fg_tilemap = nullptr;
tilemap_t *m_bg_tilemap = nullptr;
emu_timer *m_interrupt_timer = nullptr;
required_shared_ptr<uint8_t> m_bg_videoram;
required_shared_ptr<uint8_t> m_fg_videoram;
required_shared_ptr<uint8_t> m_spriteram;
required_shared_ptr<uint8_t> m_paletteram;
required_shared_ptr<uint8_t> m_scroll;
required_shared_ptr<uint8_t> m_video_control;
required_region_ptr<uint8_t> m_color_prom;
void irq_clear_w(uint8_t data);
void ay8910_select_w(uint8_t data);
void video_control_w(uint8_t data);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(interrupt_callback);
void set_palette();
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int flip);
void on_scanline_interrupt();
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
void video(machine_config &config);
void main_map(address_map &map);
};

View File

@ -1,303 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria
/***************************************************************************
Technos Mysterious Stones hardware
driver by Nicola Salmoria
There are only a few differences between the video hardware of Mysterious
Stones and Mat Mania. The tile bank select bit is different and the sprite
selection seems to be different as well. Additionally, the palette is stored
differently. I'm also not sure that the 2nd tile page is really used in
Mysterious Stones.
***************************************************************************/
#include "emu.h"
#include "video/resnet.h"
#include "mystston.h"
/*************************************
*
* Video timing constants
*
*************************************/
// HMC20
// set_raw(MASTER_CLOCK / 2, 384, 0, 256, 272, 8, 248)
#define PIXEL_CLOCK (MASTER_CLOCK / 2)
#define HTOTAL (384)
#define HBEND (0)
#define HBSTART (256)
#define VTOTAL (272) /* counts from 0x08-0xff, then from 0xe8-0xff */
#define VBEND (8)
#define VBSTART (248)
#define FIRST_INT_VPOS (0x008)
#define INT_HPOS (0x100)
/*************************************
*
* Scanline interrupt system
*
* There is an interrupt every 16
* scanlines, starting with 8.
*
*************************************/
TIMER_CALLBACK_MEMBER(mystston_state::interrupt_callback)
{
int scanline = param;
on_scanline_interrupt();
scanline = scanline + 16;
if (scanline >= VTOTAL)
scanline = FIRST_INT_VPOS;
// the vertical synch chain is clocked by H256 -- this is probably not important, but oh well
m_interrupt_timer->adjust(m_screen->time_until_pos(scanline - 1, INT_HPOS), scanline);
}
/*************************************
*
* Palette handling
*
*************************************/
void mystston_state::set_palette()
{
static const int resistances_rg[3] = { 4700, 3300, 1500 };
static const int resistances_b [2] = { 3300, 1500 };
double weights_rg[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_rg, 0, 4700,
2, resistances_b, weights_b, 0, 4700,
0, nullptr, nullptr, 0, 0);
for (int i = 0; i < 0x40; i++)
{
uint8_t data;
// first half is dynamic, second half is from the PROM
if (i & 0x20)
data = m_color_prom[i & 0x1f];
else
data = m_paletteram[i];
// red component
int bit0 = (data >> 0) & 0x01;
int bit1 = (data >> 1) & 0x01;
int bit2 = (data >> 2) & 0x01;
int r = combine_weights(weights_rg, bit0, bit1, bit2);
// green component
bit0 = (data >> 3) & 0x01;
bit1 = (data >> 4) & 0x01;
bit2 = (data >> 5) & 0x01;
int g = combine_weights(weights_rg, bit0, bit1, bit2);
// blue component
bit0 = (data >> 6) & 0x01;
bit1 = (data >> 7) & 0x01;
int b = combine_weights(weights_b, bit0, bit1);
m_palette->set_pen_color(i, rgb_t(r, g, b));
}
}
/*************************************
*
* Video control register
*
*************************************/
void mystston_state::video_control_w(uint8_t data)
{
*m_video_control = data;
// D0-D1 - foreground text color
// D2 - background page select
// D3 - unused
// D4-D5 - coin counters in flipped order
machine().bookkeeping().coin_counter_w(0, data & 0x20);
machine().bookkeeping().coin_counter_w(1, data & 0x10);
// D6 - unused
// D7 - screen flip
}
/*************************************
*
* Tilemap callbacks
*
*************************************/
TILE_GET_INFO_MEMBER(mystston_state::get_bg_tile_info)
{
int page = (*m_video_control & 0x04) << 8;
int code = ((m_bg_videoram[page | 0x200 | tile_index] & 0x01) << 8) | m_bg_videoram[page | tile_index];
int flags = (tile_index & 0x10) ? TILE_FLIPY : 0;
tileinfo.set(1, code, 0, flags);
}
TILE_GET_INFO_MEMBER(mystston_state::get_fg_tile_info)
{
int code = ((m_fg_videoram[0x400 | tile_index] & 0x07) << 8) | m_fg_videoram[tile_index];
int color = ((*m_video_control & 0x01) << 1) | ((*m_video_control & 0x02) >> 1);
tileinfo.set(0, code, color, 0);
}
/*************************************
*
* Sprite drawing
*
*************************************/
void mystston_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int flip)
{
for (int offs = 0; offs < 0x60; offs += 4)
{
int attr = m_spriteram[offs];
if (attr & 0x01)
{
int code = ((attr & 0x10) << 4) | m_spriteram[offs + 1];
int color = (attr & 0x08) >> 3;
int flipx = attr & 0x04;
int flipy = attr & 0x02;
int x = 240 - m_spriteram[offs + 3];
int y = (240 - m_spriteram[offs + 2]) & 0xff;
if (flip)
{
x = 240 - x;
y = 240 - y;
flipx = !flipx;
flipy = !flipy;
}
gfx->transpen(bitmap,cliprect, code, color, flipx, flipy, x, y, 0);
}
}
}
/*************************************
*
* Start
*
*************************************/
void mystston_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mystston_state::get_bg_tile_info)), TILEMAP_SCAN_COLS_FLIP_X, 16, 16, 16, 32);
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mystston_state::get_fg_tile_info)), TILEMAP_SCAN_COLS_FLIP_X, 8, 8, 32, 32);
m_fg_tilemap->set_transparent_pen(0);
// create the interrupt timer
m_interrupt_timer = timer_alloc(FUNC(mystston_state::interrupt_callback), this);
}
/*************************************
*
* Reset
*
*************************************/
void mystston_state::video_reset()
{
m_interrupt_timer->adjust(m_screen->time_until_pos(FIRST_INT_VPOS - 1, INT_HPOS), FIRST_INT_VPOS);
}
/*************************************
*
* Update
*
*************************************/
uint32_t mystston_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int flip = (*m_video_control & 0x80) ^ ((m_dsw1->read() & 0x20) << 2);
set_palette();
machine().tilemap().mark_all_dirty();
m_bg_tilemap->set_scrolly(0, *m_scroll);
machine().tilemap().set_flip_all(flip ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect, m_gfxdecode->gfx(2), flip);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
}
/*************************************
*
* Graphics decoding
*
*************************************/
static const gfx_layout spritelayout =
{
16,16,
RGN_FRAC(1,3),
3,
{ RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) },
{ 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
16*0+0, 16*0+1, 16*0+2, 16*0+3, 16*0+4, 16*0+5, 16*0+6, 16*0+7 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
32*8
};
static GFXDECODE_START( gfx_mystston )
GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x3_planar, 4*8, 4 )
GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 2*8, 1 )
GFXDECODE_ENTRY( "gfx1", 0, spritelayout, 0*8, 2 )
GFXDECODE_END
/*************************************
*
* Machine driver
*
*************************************/
void mystston_state::video(machine_config &config)
{
GFXDECODE(config, m_gfxdecode, m_palette, gfx_mystston);
PALETTE(config, m_palette).set_entries(0x40);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART);
m_screen->set_screen_update(FUNC(mystston_state::screen_update));
m_screen->set_palette(m_palette);
}

View File

@ -1,5 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
/*******************************************************************************
Shadow Force (c)1993 Technos
Preliminary Driver by David Haywood
@ -140,14 +141,248 @@ lev 7 : 0x7c : 0000 11d0 - just rte
*/
#include "emu.h"
#include "shadfrce.h"
#include "cpu/m68000/m68000.h"
#include "cpu/z80/z80.h"
#include "machine/gen_latch.h"
#include "machine/timer.h"
#include "machine/watchdog.h"
#include "sound/okim6295.h"
#include "sound/ymopm.h"
#include "speaker.h"
#include "video/bufsprite.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"
namespace {
class shadfrce_state : public driver_device
{
public:
shadfrce_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_oki(*this, "oki"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch"),
m_io_p(*this, "P%u", 1U),
m_io_dsw(*this, "DSW%u", 1U),
m_io_other(*this, "OTHER"),
m_io_extra(*this, "EXTRA"),
m_io_misc(*this, "MISC"),
m_io_system(*this, "SYSTEM"),
m_fgvideoram(*this, "fgvideoram"),
m_bgvideoram(*this, "bgvideoram%u", 0U),
m_spvideoram(*this, "spvideoram")
{ }
void shadfrce(machine_config &config);
protected:
virtual void video_start() override;
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<okim6295_device> m_oki;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
required_ioport_array<2> m_io_p;
required_ioport_array<2> m_io_dsw;
required_ioport m_io_other;
required_ioport m_io_extra;
required_ioport m_io_misc;
required_ioport m_io_system;
required_shared_ptr<uint16_t> m_fgvideoram;
required_shared_ptr_array<uint16_t, 2> m_bgvideoram;
required_device<buffered_spriteram16_device> m_spvideoram;
tilemap_t *m_fgtilemap = nullptr;
tilemap_t *m_bgtilemap[2]{};
uint8_t m_video_enable = 0U;
uint8_t m_irqs_enable = 0U;
uint16_t m_raster_scanline = 0U;
uint8_t m_raster_irq_enable = 0U;
uint8_t m_vblank = 0U;
uint16_t m_prev_value = 0U;
void flip_screen(uint16_t data);
uint16_t input_ports_r(offs_t offset);
void screen_brt_w(uint8_t data);
void irq_ack_w(offs_t offset, uint16_t data);
void irq_w(uint16_t data);
void scanline_w(uint16_t data);
void fgvideoram_w(offs_t offset, uint16_t data);
template <uint8_t Which> void bgvideoram_w(offs_t offset, uint16_t data);
template <uint8_t Which> void bgscrollx_w(uint16_t data);
template <uint8_t Which> void bgscrolly_w(uint16_t data);
void oki_bankswitch_w(uint8_t data);
TILE_GET_INFO_MEMBER(get_fgtile_info);
TILE_GET_INFO_MEMBER(get_bg0tile_info);
TILE_GET_INFO_MEMBER(get_bg1tile_info);
TIMER_DEVICE_CALLBACK_MEMBER(scanline);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void main_map(address_map &map);
void sound_map(address_map &map);
};
TILE_GET_INFO_MEMBER(shadfrce_state::get_fgtile_info)
{
// ---- ---- tttt tttt ---- ---- pppp TTTT
int tileno = (m_fgvideoram[tile_index *2] & 0x00ff) | ((m_fgvideoram[tile_index * 2 + 1] & 0x000f) << 8);
int colour = (m_fgvideoram[tile_index *2 + 1] & 0x00f0) >> 4;
tileinfo.set(0, tileno, colour * 4, 0);
}
void shadfrce_state::fgvideoram_w(offs_t offset, uint16_t data)
{
m_fgvideoram[offset] = data;
m_fgtilemap->mark_tile_dirty(offset / 2);
}
TILE_GET_INFO_MEMBER(shadfrce_state::get_bg0tile_info)
{
// ---- ---- ---- cccc --TT TTTT TTTT TTTT
int tileno = (m_bgvideoram[0][tile_index * 2 + 1] & 0x3fff);
int colour = m_bgvideoram[0][tile_index * 2] & 0x001f;
if (colour & 0x10) colour ^= 0x30; // skip hole
int fyx = (m_bgvideoram[0][tile_index * 2] & 0x00c0) >> 6;
tileinfo.set(2, tileno, colour, TILE_FLIPYX(fyx));
}
template <uint8_t Which>
void shadfrce_state::bgvideoram_w(offs_t offset, uint16_t data)
{
m_bgvideoram[Which][offset] = data;
m_bgtilemap[Which]->mark_tile_dirty(Which ? offset : offset / 2);
}
TILE_GET_INFO_MEMBER(shadfrce_state::get_bg1tile_info)
{
int tileno = (m_bgvideoram[1][tile_index] & 0x0fff);
int colour = (m_bgvideoram[1][tile_index] & 0xf000) >> 12;
tileinfo.set(2, tileno, colour + 64, 0);
}
void shadfrce_state::video_start()
{
m_fgtilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(shadfrce_state::get_fgtile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_fgtilemap->set_transparent_pen(0);
m_bgtilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(shadfrce_state::get_bg0tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_bgtilemap[0]->set_transparent_pen(0);
m_bgtilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(shadfrce_state::get_bg1tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
save_item(NAME(m_video_enable));
save_item(NAME(m_irqs_enable));
save_item(NAME(m_raster_scanline));
save_item(NAME(m_raster_irq_enable));
save_item(NAME(m_vblank));
save_item(NAME(m_prev_value));
}
template <uint8_t Which>
void shadfrce_state::bgscrollx_w(uint16_t data)
{
m_bgtilemap[Which]->set_scrollx(0, data & 0x1ff);
}
template <uint8_t Which>
void shadfrce_state::bgscrolly_w(uint16_t data)
{
m_bgtilemap[Which]->set_scrolly(0, data & 0x1ff);
}
void shadfrce_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
/* | ---- ---- hhhf Fe-Y | ---- ---- yyyy yyyy | ---- ---- TTTT TTTT | ---- ---- tttt tttt |
| ---- ---- -pCc cccX | ---- ---- xxxx xxxx | ---- ---- ---- ---- | ---- ---- ---- ---- | */
/* h = height
f = flipx
F = flipy
e = enable
Yy = Y Position
Tt = Tile No.
Xx = X Position
Cc = color
P = priority
*/
gfx_element *gfx = m_gfxdecode->gfx(1);
uint16_t *finish = m_spvideoram->buffer();
uint16_t *source = finish + 0x2000 / 2 - 8;
while (source >= finish)
{
int const ypos = 0x100 - (((source[0] & 0x0003) << 8) | (source[1] & 0x00ff));
int const xpos = (((source[4] & 0x0001) << 8) | (source[5] & 0x00ff)) + 1;
int const tile = ((source[2] & 0x00ff) << 8) | (source[3] & 0x00ff);
int height = (source[0] & 0x00e0) >> 5;
int const enable = ((source[0] & 0x0004));
int const flipx = ((source[0] & 0x0010) >> 4);
int const flipy = ((source[0] & 0x0008) >> 3);
int pal = ((source[4] & 0x003e));
int const pri_mask = (source[4] & 0x0040) ? 0x02 : 0x00;
if (pal & 0x20) pal ^= 0x60; // skip hole
height++;
if (enable)
{
for (int hcount = 0; hcount < height; hcount++)
{
gfx->prio_transpen(bitmap, cliprect, tile + hcount, pal, flipx, flipy, xpos, ypos - hcount * 16 - 16, screen.priority(), pri_mask, 0);
gfx->prio_transpen(bitmap, cliprect, tile + hcount, pal, flipx, flipy, xpos - 0x200, ypos - hcount * 16 - 16, screen.priority(), pri_mask, 0);
gfx->prio_transpen(bitmap, cliprect, tile + hcount, pal, flipx, flipy, xpos, ypos - hcount * 16 - 16 + 0x200, screen.priority(), pri_mask, 0);
gfx->prio_transpen(bitmap, cliprect, tile + hcount, pal, flipx, flipy, xpos - 0x200, ypos - hcount * 16 - 16 + 0x200, screen.priority(), pri_mask, 0);
}
}
source -= 8;
}
}
uint32_t shadfrce_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0, cliprect);
if (m_video_enable)
{
m_bgtilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
m_bgtilemap[0]->draw(screen, bitmap, cliprect, 0, 1);
draw_sprites(screen, bitmap, cliprect);
m_fgtilemap->draw(screen, bitmap, cliprect, 0, 0);
}
else
{
bitmap.fill(m_palette->black_pen(), cliprect);
}
return 0;
}
// machine/gen_latch
void shadfrce_state::flip_screen(uint16_t data)
{
@ -241,16 +476,16 @@ uint16_t shadfrce_state::input_ports_r(offs_t offset)
switch (offset)
{
case 0 :
data = (m_io_p1->read() & 0xff) | ((m_io_dsw2->read() & 0xc0) << 6) | ((m_io_system->read() & 0x0f) << 8);
data = (m_io_p[0]->read() & 0xff) | ((m_io_dsw[1]->read() & 0xc0) << 6) | ((m_io_system->read() & 0x0f) << 8);
break;
case 1 :
data = (m_io_p2->read() & 0xff) | ((m_io_dsw2->read() & 0x3f) << 8);
data = (m_io_p[1]->read() & 0xff) | ((m_io_dsw[1]->read() & 0x3f) << 8);
break;
case 2 :
data = (m_io_extra->read() & 0xff) | ((m_io_dsw1->read() & 0x3f) << 8);
data = (m_io_extra->read() & 0xff) | ((m_io_dsw[0]->read() & 0x3f) << 8);
break;
case 3 :
data = (m_io_other->read() & 0xff) | ((m_io_dsw1->read() & 0xc0) << 2) | ((m_io_misc->read() & 0x38) << 8) | (m_vblank << 8);
data = (m_io_other->read() & 0xff) | ((m_io_dsw[0]->read() & 0xc0) << 2) | ((m_io_misc->read() & 0x38) << 8) | (m_vblank << 8);
break;
}
@ -260,7 +495,7 @@ uint16_t shadfrce_state::input_ports_r(offs_t offset)
void shadfrce_state::screen_brt_w(uint8_t data)
{
double brt = (data & 0xff) / 255.0;
double const brt = (data & 0xff) / 255.0;
for (int i = 0; i < 0x4000; i++)
m_palette->set_pen_contrast(i, brt);
@ -273,17 +508,17 @@ void shadfrce_state::irq_ack_w(offs_t offset, uint16_t data)
void shadfrce_state::irq_w(uint16_t data)
{
m_irqs_enable = data & 1; /* maybe, it's set/unset inside every trap instruction which is executed */
m_video_enable = data & 8; /* probably */
m_irqs_enable = data & 1; // maybe, it's set/unset inside every trap instruction which is executed
m_video_enable = data & 8; // probably
/* check if there's a high transition to enable the raster IRQ */
if((~m_prev_value & 4) && (data & 4))
// check if there's a high transition to enable the raster IRQ
if ((~m_prev_value & 4) && (data & 4))
{
m_raster_irq_enable = 1;
}
/* check if there's a low transition to disable the raster IRQ */
if((m_prev_value & 4) && (~data & 4))
// check if there's a low transition to disable the raster IRQ
if ((m_prev_value & 4) && (~data & 4))
{
m_raster_irq_enable = 0;
}
@ -293,25 +528,25 @@ void shadfrce_state::irq_w(uint16_t data)
void shadfrce_state::scanline_w(uint16_t data)
{
m_raster_scanline = data; /* guess, 0 is always written */
m_raster_scanline = data; // guess, 0 is always written
}
TIMER_DEVICE_CALLBACK_MEMBER(shadfrce_state::scanline)
{
int scanline = param;
/* Vblank is lowered on scanline 0 */
// Vblank is lowered on scanline 0
if (scanline == 0)
{
m_vblank = 0;
}
/* Hack */
else if (scanline == (248-1)) /* -1 is an hack needed to avoid deadlocks */
// Hack
else if (scanline == (248 - 1)) // -1 is an hack needed to avoid deadlocks
{
m_vblank = 4;
}
/* Raster interrupt - Perform raster effect on given scanline */
// Raster interrupt - Perform raster effect on given scanline
if (m_raster_irq_enable)
{
if (scanline == m_raster_scanline)
@ -323,7 +558,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(shadfrce_state::scanline)
}
}
/* An interrupt is generated every 16 scanlines */
// An interrupt is generated every 16 scanlines
if (m_irqs_enable)
{
if (scanline % 16 == 0)
@ -334,7 +569,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(shadfrce_state::scanline)
}
}
/* Vblank is raised on scanline 248 */
// Vblank is raised on scanline 248
if (m_irqs_enable)
{
if (scanline == 248)
@ -347,47 +582,47 @@ TIMER_DEVICE_CALLBACK_MEMBER(shadfrce_state::scanline)
/* Memory Maps */
// Memory Maps
void shadfrce_state::shadfrce_map(address_map &map)
void shadfrce_state::main_map(address_map &map)
{
map(0x000000, 0x0fffff).rom();
map(0x100000, 0x100fff).ram().w(FUNC(shadfrce_state::bg0videoram_w)).share("bg0videoram"); /* video */
map(0x100000, 0x100fff).ram().w(FUNC(shadfrce_state::bgvideoram_w<0>)).share(m_bgvideoram[0]);
map(0x101000, 0x101fff).ram();
map(0x102000, 0x1027ff).ram().w(FUNC(shadfrce_state::bg1videoram_w)).share("bg1videoram"); /* bg 2 */
map(0x102000, 0x1027ff).ram().w(FUNC(shadfrce_state::bgvideoram_w<1>)).share(m_bgvideoram[1]);
map(0x102800, 0x103fff).ram();
map(0x140000, 0x141fff).ram().w(FUNC(shadfrce_state::fgvideoram_w)).share("fgvideoram");
map(0x142000, 0x143fff).ram().share("spvideoram"); /* sprites */
map(0x140000, 0x141fff).ram().w(FUNC(shadfrce_state::fgvideoram_w)).share(m_fgvideoram);
map(0x142000, 0x143fff).ram().share("spvideoram");
map(0x180000, 0x187fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x1c0000, 0x1c0001).w(FUNC(shadfrce_state::bg0scrollx_w)); /* SCROLL X */
map(0x1c0002, 0x1c0003).w(FUNC(shadfrce_state::bg0scrolly_w)); /* SCROLL Y */
map(0x1c0004, 0x1c0005).w(FUNC(shadfrce_state::bg1scrollx_w)); /* SCROLL X */
map(0x1c0006, 0x1c0007).w(FUNC(shadfrce_state::bg1scrolly_w)); /* SCROLL Y */
map(0x1c0008, 0x1c0009).nopw(); /* ?? */
map(0x1c0000, 0x1c0001).w(FUNC(shadfrce_state::bgscrollx_w<0>));
map(0x1c0002, 0x1c0003).w(FUNC(shadfrce_state::bgscrolly_w<0>));
map(0x1c0004, 0x1c0005).w(FUNC(shadfrce_state::bgscrollx_w<1>));
map(0x1c0006, 0x1c0007).w(FUNC(shadfrce_state::bgscrolly_w<1>));
map(0x1c0008, 0x1c0009).nopw(); // ??
map(0x1c000a, 0x1c000b).nopr().w(FUNC(shadfrce_state::flip_screen));
map(0x1c000c, 0x1c000d).nopw(); /* ?? */
map(0x1c000c, 0x1c000d).nopw(); // ??
map(0x1d0000, 0x1d0005).w(FUNC(shadfrce_state::irq_ack_w));
map(0x1d0006, 0x1d0007).w(FUNC(shadfrce_state::irq_w));
map(0x1d0008, 0x1d0009).w(FUNC(shadfrce_state::scanline_w));
map(0x1d000c, 0x1d000d).nopr();
map(0x1d000c, 0x1d000c).w(m_soundlatch, FUNC(generic_latch_8_device::write));
map(0x1d000d, 0x1d000d).w(FUNC(shadfrce_state::screen_brt_w));
map(0x1d0010, 0x1d0011).nopw(); /* ?? */
map(0x1d0012, 0x1d0013).nopw(); /* ?? */
map(0x1d0014, 0x1d0015).nopw(); /* ?? */
map(0x1d0010, 0x1d0011).nopw(); // ??
map(0x1d0012, 0x1d0013).nopw(); // ??
map(0x1d0014, 0x1d0015).nopw(); // ??
map(0x1d0016, 0x1d0017).w("watchdog", FUNC(watchdog_timer_device::reset16_w));
map(0x1d0020, 0x1d0027).r(FUNC(shadfrce_state::input_ports_r));
map(0x1f0000, 0x1fffff).ram();
}
/* and the sound cpu */
// and the sound CPU
void shadfrce_state::oki_bankswitch_w(uint8_t data)
{
m_oki->set_rom_bank(data & 1);
}
void shadfrce_state::shadfrce_sound_map(address_map &map)
void shadfrce_state::sound_map(address_map &map)
{
map(0x0000, 0xbfff).rom();
map(0xc000, 0xc7ff).ram();
@ -399,9 +634,9 @@ void shadfrce_state::shadfrce_sound_map(address_map &map)
}
/* Input Ports */
// Input Ports
// Similar to MUGSMASH_PLAYER_INPUT in drivers/mugsmash.cpp
// Similar to MUGSMASH_PLAYER_INPUT in edevices/mugsmash.cpp
#define SHADFRCE_PLAYER_INPUT( player, start ) \
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(player) PORT_8WAY \
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(player) PORT_8WAY \
@ -414,13 +649,13 @@ void shadfrce_state::shadfrce_sound_map(address_map &map)
static INPUT_PORTS_START( shadfrce )
PORT_START("P1") /* Fake IN0 (player 1 inputs) */
PORT_START("P1") // Fake IN0 (player 1 inputs)
SHADFRCE_PLAYER_INPUT( 1, IPT_START1 )
PORT_START("P2") /* Fake IN1 (player 2 inputs) */
PORT_START("P2") // Fake IN1 (player 2 inputs)
SHADFRCE_PLAYER_INPUT( 2, IPT_START2 )
PORT_START("EXTRA") /* Fake IN2 (players 1 & 2 extra inputs */
PORT_START("EXTRA") // Fake IN2 (players 1 & 2 extra inputs
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
@ -430,21 +665,21 @@ static INPUT_PORTS_START( shadfrce )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("OTHER") /* Fake IN3 (other extra inputs ?) */
PORT_START("OTHER") // Fake IN3 (other extra inputs ?)
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("SYSTEM") /* Fake IN4 (system inputs) */
PORT_START("SYSTEM") // Fake IN4 (system inputs)
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) /* only in "test mode" ? */
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) /* only in "test mode" ? */
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) // only in "test mode" ?
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) // only in "test mode" ?
PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("MISC") /* Fake IN5 (misc) */
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) /* guess */
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* must be ACTIVE_LOW or 'shadfrcj' jumps to the end (code at 0x04902e) */
PORT_START("MISC") // Fake IN5 (misc)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_CUSTOM ) // guess
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // must be ACTIVE_LOW or 'shadfrcj' jumps to the end (code at 0x04902e) */
PORT_BIT( 0xeb, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("DSW1") /*DSW1, not mapped directly */
PORT_START("DSW1") // not mapped directly
PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:1")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
@ -467,7 +702,7 @@ static INPUT_PORTS_START( shadfrce )
PORT_DIPSETTING( 0x40, DEF_STR( On ) )
PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) PORT_DIPLOCATION("SW1:8")
PORT_START("DSW2") /* DSW2, not mapped directly */
PORT_START("DSW2") // not mapped directly
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2")
PORT_DIPSETTING( 0x01, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x03, DEF_STR( Normal ) )
@ -494,7 +729,7 @@ static INPUT_PORTS_START( shadfrce )
// PCB has 3rd DIP switch "SW3" listed in manual as 1:OFF & 2:OFF & 3:OFF (ALL "NOT USED"), 4:ON & 5:ON (ALL "DON'T TOUCH"), 6:OFF, 7:OFF, 8:OFF (ALL "NOT USED")
INPUT_PORTS_END
/* Graphic Decoding */
// Graphic Decoding
static const gfx_layout fg8x8x4_layout =
{
@ -535,135 +770,139 @@ static GFXDECODE_START( gfx_shadfrce )
GFXDECODE_ENTRY( "tiles", 0, bg16x16x6_layout, 0x2000, 128 )
GFXDECODE_END
/* Machine Driver Bits */
// Machine Driver Bits
void shadfrce_state::shadfrce(machine_config &config)
{
M68000(config, m_maincpu, XTAL(28'000'000) / 2); /* verified on pcb */
m_maincpu->set_addrmap(AS_PROGRAM, &shadfrce_state::shadfrce_map);
M68000(config, m_maincpu, XTAL(28'000'000) / 2); // verified on PCB
m_maincpu->set_addrmap(AS_PROGRAM, &shadfrce_state::main_map);
TIMER(config, "scantimer").configure_scanline(FUNC(shadfrce_state::scanline), "screen", 0, 1);
Z80(config, m_audiocpu, XTAL(3'579'545)); /* verified on pcb */
m_audiocpu->set_addrmap(AS_PROGRAM, &shadfrce_state::shadfrce_sound_map);
Z80(config, m_audiocpu, XTAL(3'579'545)); // verified on PCB
m_audiocpu->set_addrmap(AS_PROGRAM, &shadfrce_state::sound_map);
WATCHDOG_TIMER(config, "watchdog");
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(XTAL(28'000'000) / 4, 448, 0, 320, 272, 8, 248); /* HTOTAL and VTOTAL are guessed */
m_screen->set_raw(XTAL(28'000'000) / 4, 448, 0, 320, 272, 8, 248); // HTOTAL and VTOTAL are guessed
m_screen->set_screen_update(FUNC(shadfrce_state::screen_update));
m_screen->screen_vblank().set(FUNC(shadfrce_state::screen_vblank));
m_screen->screen_vblank().set(m_spvideoram, FUNC(buffered_spriteram16_device::vblank_copy_rising));
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_shadfrce);
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x4000);
/* sound hardware */
BUFFERED_SPRITERAM16(config, m_spvideoram);
// sound hardware
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(3'579'545))); /* verified on pcb */
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(3'579'545))); // verified on PCB
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
ymsnd.add_route(0, "lspeaker", 0.50);
ymsnd.add_route(1, "rspeaker", 0.50);
OKIM6295(config, m_oki, XTAL(13'495'200)/8, okim6295_device::PIN7_HIGH); /* verified on pcb */
OKIM6295(config, m_oki, XTAL(13'495'200) / 8, okim6295_device::PIN7_HIGH); // verified on PCB
m_oki->add_route(ALL_OUTPUTS, "lspeaker", 0.50);
m_oki->add_route(ALL_OUTPUTS, "rspeaker", 0.50);
}
/* Rom Defs. */
// Rom Defs.
// one of the high score tables in attract mode ends up corrupt on this set due to the game triggering a text dialog box, is this due to a timing error?
ROM_START( shadfrce )
ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
ROM_LOAD16_BYTE( "32a12-011.34", 0x00001, 0x40000, CRC(0c041e08) SHA1(7b9d52cb1f6bc217c6e64287bd9630aa37243513) ) /* World Version 3 */
ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "32a12-011.34", 0x00001, 0x40000, CRC(0c041e08) SHA1(7b9d52cb1f6bc217c6e64287bd9630aa37243513) ) // World Version 3
ROM_LOAD16_BYTE( "32a13-010.26", 0x00000, 0x40000, CRC(00985361) SHA1(e9da1b096b25a6ee46bab6230dda66dccdd4bed8) )
ROM_LOAD16_BYTE( "32a14-010.33", 0x80001, 0x40000, CRC(ea03ca25) SHA1(7af1ee7c36c70f80ba1e096473b5786b205ab00b) )
ROM_LOAD16_BYTE( "32j15-01.14", 0x80000, 0x40000, CRC(3dc3a84a) SHA1(166ad91b93192d94e3f6d2fe6dde02f59d334f75) ) // matches Japan version 2, not US version 2
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 Code */
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "32j10-0.42", 0x00000, 0x10000, CRC(65daf475) SHA1(7144332b2d17af8645e22e1926b33113db0d20e2) )
ROM_REGION( 0x020000, "chars", 0 ) /* Chars */
ROM_REGION( 0x020000, "chars", 0 )
ROM_LOAD( "32j11-0.55", 0x00000, 0x20000, CRC(7252d993) SHA1(43f7de381841039aa290486aafb98e2cf3b8579b) )
ROM_REGION( 0xa00000, "sprites", 0 ) /* Sprite Tiles */
ROM_REGION( 0xa00000, "sprites", 0 )
ROM_LOAD( "32j4-0.12", 0x000000, 0x200000, CRC(1ebea5b6) SHA1(35bd49dda9ad75326d45ffb10c87d83fc4f1b7a8) )
ROM_LOAD( "32j5-0.13", 0x200000, 0x200000, CRC(600026b5) SHA1(5641246300d7e20dcff1eae004647faaee6cd1c6) )
ROM_LOAD( "32j6-0.24", 0x400000, 0x200000, CRC(6cde8ebe) SHA1(750933798235951fe24b2e667c33f692612c0aa0) )
ROM_LOAD( "32j7-0.25", 0x600000, 0x200000, CRC(bcb37922) SHA1(f3eee73c8b9f4873a7f1cc42e334e7502eaee3c8) )
ROM_LOAD( "32j8-0.32", 0x800000, 0x200000, CRC(201bebf6) SHA1(c89d2895ea5b19daea1f88542419f4e10f437c73) )
ROM_REGION( 0x300000, "tiles", 0 ) /* BG Tiles */
ROM_REGION( 0x300000, "tiles", 0 )
ROM_LOAD( "32j1-0.4", 0x000000, 0x100000, CRC(f1cca740) SHA1(339079b95ca137e66b4f032ad67a0adf58cca100) )
ROM_LOAD( "32j2-0.5", 0x100000, 0x100000, CRC(5fac3e01) SHA1(20c30f4c76e303285ae37e596afe86aa4812c3b9) )
ROM_LOAD( "32j3-0.6", 0x200000, 0x100000, CRC(d297925e) SHA1(5bc4d37bf0dc54114884c816b94a64ef1ccfeda5) )
ROM_REGION( 0x080000, "oki", 0 ) /* Samples */
ROM_REGION( 0x080000, "oki", 0 )
ROM_LOAD( "32j9-0.76", 0x000000, 0x080000, CRC(16001e81) SHA1(67928d2024f963aee91f1498b6f4c76101d2f3b8) )
ROM_END
ROM_START( shadfrceu )
ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
ROM_LOAD16_BYTE( "32a12-01.34", 0x00001, 0x40000, CRC(04501198) SHA1(50f981c13f9ed19d681d494376018ba86464ea13) ) /* US Version 2 */
ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "32a12-01.34", 0x00001, 0x40000, CRC(04501198) SHA1(50f981c13f9ed19d681d494376018ba86464ea13) ) // US Version 2
ROM_LOAD16_BYTE( "32a13-01.26", 0x00000, 0x40000, CRC(b8f8a05c) SHA1(bd9d4218a7cf57b56aec1f7e710e02af8471f9d7) )
ROM_LOAD16_BYTE( "32a14-0.33", 0x80001, 0x40000, CRC(08279be9) SHA1(1833526b23feddb58b21874070ad2bf3b6be8dca) )
ROM_LOAD16_BYTE( "32a15-0.14", 0x80000, 0x40000, CRC(bfcadfea) SHA1(1caa9fc30d8622ce4c7221039c446e99cc8f5346) )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 Code */
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "32j10-0.42", 0x00000, 0x10000, CRC(65daf475) SHA1(7144332b2d17af8645e22e1926b33113db0d20e2) )
ROM_REGION( 0x020000, "chars", 0 ) /* Chars */
ROM_REGION( 0x020000, "chars", 0 )
ROM_LOAD( "32a11-0.55", 0x00000, 0x20000, CRC(cfaf5e77) SHA1(eab76e085f695c74cc868aaf95f04ff2acf66ee9) )
ROM_REGION( 0xa00000, "sprites", 0 ) /* Sprite Tiles */
ROM_REGION( 0xa00000, "sprites", 0 )
ROM_LOAD( "32j4-0.12", 0x000000, 0x200000, CRC(1ebea5b6) SHA1(35bd49dda9ad75326d45ffb10c87d83fc4f1b7a8) )
ROM_LOAD( "32j5-0.13", 0x200000, 0x200000, CRC(600026b5) SHA1(5641246300d7e20dcff1eae004647faaee6cd1c6) )
ROM_LOAD( "32j6-0.24", 0x400000, 0x200000, CRC(6cde8ebe) SHA1(750933798235951fe24b2e667c33f692612c0aa0) )
ROM_LOAD( "32j7-0.25", 0x600000, 0x200000, CRC(bcb37922) SHA1(f3eee73c8b9f4873a7f1cc42e334e7502eaee3c8) )
ROM_LOAD( "32j8-0.32", 0x800000, 0x200000, CRC(201bebf6) SHA1(c89d2895ea5b19daea1f88542419f4e10f437c73) )
ROM_REGION( 0x300000, "tiles", 0 ) /* BG Tiles */
ROM_REGION( 0x300000, "tiles", 0 )
ROM_LOAD( "32j1-0.4", 0x000000, 0x100000, CRC(f1cca740) SHA1(339079b95ca137e66b4f032ad67a0adf58cca100) )
ROM_LOAD( "32j2-0.5", 0x100000, 0x100000, CRC(5fac3e01) SHA1(20c30f4c76e303285ae37e596afe86aa4812c3b9) )
ROM_LOAD( "32j3-0.6", 0x200000, 0x100000, CRC(d297925e) SHA1(5bc4d37bf0dc54114884c816b94a64ef1ccfeda5) )
ROM_REGION( 0x080000, "oki", 0 ) /* Samples */
ROM_REGION( 0x080000, "oki", 0 )
ROM_LOAD( "32j9-0.76", 0x000000, 0x080000, CRC(16001e81) SHA1(67928d2024f963aee91f1498b6f4c76101d2f3b8) )
ROM_END
ROM_START( shadfrcej )
ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
ROM_LOAD16_BYTE( "32j12-01.34", 0x00001, 0x40000, CRC(38fdbe1d) SHA1(476d8ef2c0d2a8c568ce44631f93f8c730f91b08) ) /* Japan Version 2 */
ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "32j12-01.34", 0x00001, 0x40000, CRC(38fdbe1d) SHA1(476d8ef2c0d2a8c568ce44631f93f8c730f91b08) ) // Japan Version 2
ROM_LOAD16_BYTE( "32j13-01.26", 0x00000, 0x40000, CRC(6e1df6f1) SHA1(c165553fe967b437413dd7ddc87a267548dd0ca9) )
ROM_LOAD16_BYTE( "32j14-01.33", 0x80001, 0x40000, CRC(89e3fb60) SHA1(90de38558d63215a0079079030e8b1097599c9e5) )
ROM_LOAD16_BYTE( "32j15-01.14", 0x80000, 0x40000, CRC(3dc3a84a) SHA1(166ad91b93192d94e3f6d2fe6dde02f59d334f75) )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 Code */
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "32j10-0.42", 0x00000, 0x10000, CRC(65daf475) SHA1(7144332b2d17af8645e22e1926b33113db0d20e2) )
ROM_REGION( 0x020000, "chars", 0 ) /* Chars */
ROM_REGION( 0x020000, "chars", 0 )
ROM_LOAD( "32j11-0.55", 0x00000, 0x20000, CRC(7252d993) SHA1(43f7de381841039aa290486aafb98e2cf3b8579b) )
ROM_REGION( 0xa00000, "sprites", 0 ) /* Sprite Tiles */
ROM_REGION( 0xa00000, "sprites", 0 )
ROM_LOAD( "32j4-0.12", 0x000000, 0x200000, CRC(1ebea5b6) SHA1(35bd49dda9ad75326d45ffb10c87d83fc4f1b7a8) )
ROM_LOAD( "32j5-0.13", 0x200000, 0x200000, CRC(600026b5) SHA1(5641246300d7e20dcff1eae004647faaee6cd1c6) )
ROM_LOAD( "32j6-0.24", 0x400000, 0x200000, CRC(6cde8ebe) SHA1(750933798235951fe24b2e667c33f692612c0aa0) )
ROM_LOAD( "32j7-0.25", 0x600000, 0x200000, CRC(bcb37922) SHA1(f3eee73c8b9f4873a7f1cc42e334e7502eaee3c8) )
ROM_LOAD( "32j8-0.32", 0x800000, 0x200000, CRC(201bebf6) SHA1(c89d2895ea5b19daea1f88542419f4e10f437c73) )
ROM_REGION( 0x300000, "tiles", 0 ) /* BG Tiles */
ROM_REGION( 0x300000, "tiles", 0 )
ROM_LOAD( "32j1-0.4", 0x000000, 0x100000, CRC(f1cca740) SHA1(339079b95ca137e66b4f032ad67a0adf58cca100) )
ROM_LOAD( "32j2-0.5", 0x100000, 0x100000, CRC(5fac3e01) SHA1(20c30f4c76e303285ae37e596afe86aa4812c3b9) )
ROM_LOAD( "32j3-0.6", 0x200000, 0x100000, CRC(d297925e) SHA1(5bc4d37bf0dc54114884c816b94a64ef1ccfeda5) )
ROM_REGION( 0x080000, "oki", 0 ) /* Samples */
ROM_REGION( 0x080000, "oki", 0 )
ROM_LOAD( "32j9-0.76", 0x000000, 0x080000, CRC(16001e81) SHA1(67928d2024f963aee91f1498b6f4c76101d2f3b8) )
ROM_END
} // anonymous namespace
GAME( 1993, shadfrce, 0, shadfrce, shadfrce, shadfrce_state, empty_init, ROT0, "Technos Japan", "Shadow Force (World, Version 3)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )
GAME( 1993, shadfrceu, shadfrce, shadfrce, shadfrce, shadfrce_state, empty_init, ROT0, "Technos Japan", "Shadow Force (US, Version 2)", MACHINE_NO_COCKTAIL | MACHINE_SUPPORTS_SAVE )

View File

@ -1,109 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
#ifndef MAME_INCLUDES_SHADFRCE_H
#define MAME_INCLUDES_SHADFRCE_H
#pragma once
#include "machine/gen_latch.h"
#include "machine/timer.h"
#include "sound/okim6295.h"
#include "emupal.h"
#include "screen.h"
#include "tilemap.h"
class shadfrce_state : public driver_device
{
public:
shadfrce_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_oki(*this, "oki"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch"),
m_io_p1(*this, "P1"),
m_io_p2(*this, "P2"),
m_io_dsw1(*this, "DSW1"),
m_io_dsw2(*this, "DSW2"),
m_io_other(*this, "OTHER"),
m_io_extra(*this, "EXTRA"),
m_io_misc(*this, "MISC"),
m_io_system(*this, "SYSTEM"),
m_fgvideoram(*this, "fgvideoram"),
m_bg0videoram(*this, "bg0videoram"),
m_bg1videoram(*this, "bg1videoram"),
m_spvideoram(*this, "spvideoram")
{ }
void shadfrce(machine_config &config);
protected:
virtual void video_start() override;
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<okim6295_device> m_oki;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
required_ioport m_io_p1;
required_ioport m_io_p2;
required_ioport m_io_dsw1;
required_ioport m_io_dsw2;
required_ioport m_io_other;
required_ioport m_io_extra;
required_ioport m_io_misc;
required_ioport m_io_system;
required_shared_ptr<uint16_t> m_fgvideoram;
required_shared_ptr<uint16_t> m_bg0videoram;
required_shared_ptr<uint16_t> m_bg1videoram;
required_shared_ptr<uint16_t> m_spvideoram;
std::unique_ptr<uint16_t[]> m_spvideoram_old;
tilemap_t *m_fgtilemap = nullptr;
tilemap_t *m_bg0tilemap = nullptr;
tilemap_t *m_bg1tilemap = nullptr;
int m_video_enable = 0;
int m_irqs_enable = 0;
int m_raster_scanline = 0;
int m_raster_irq_enable = 0;
int m_vblank = 0;
int m_prev_value = 0;
void flip_screen(uint16_t data);
uint16_t input_ports_r(offs_t offset);
void screen_brt_w(uint8_t data);
void irq_ack_w(offs_t offset, uint16_t data);
void irq_w(uint16_t data);
void scanline_w(uint16_t data);
void fgvideoram_w(offs_t offset, uint16_t data);
void bg0videoram_w(offs_t offset, uint16_t data);
void bg1videoram_w(offs_t offset, uint16_t data);
void bg0scrollx_w(uint16_t data);
void bg0scrolly_w(uint16_t data);
void bg1scrollx_w(uint16_t data);
void bg1scrolly_w(uint16_t data);
void oki_bankswitch_w(uint8_t data);
TILE_GET_INFO_MEMBER(get_fgtile_info);
TILE_GET_INFO_MEMBER(get_bg0tile_info);
TILE_GET_INFO_MEMBER(get_bg1tile_info);
TIMER_DEVICE_CALLBACK_MEMBER(scanline);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
void shadfrce_map(address_map &map);
void shadfrce_sound_map(address_map &map);
};
#endif // MAME_INCLUDES_SHADFRCE_H

View File

@ -1,178 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
#include "emu.h"
#include "shadfrce.h"
TILE_GET_INFO_MEMBER(shadfrce_state::get_fgtile_info)
{
/* ---- ---- tttt tttt ---- ---- pppp TTTT */
int tileno, colour;
tileno = (m_fgvideoram[tile_index *2] & 0x00ff) | ((m_fgvideoram[tile_index *2+1] & 0x000f) << 8);
colour = (m_fgvideoram[tile_index *2+1] & 0x00f0) >>4;
tileinfo.set(0,tileno,colour*4,0);
}
void shadfrce_state::fgvideoram_w(offs_t offset, uint16_t data)
{
m_fgvideoram[offset] = data;
m_fgtilemap->mark_tile_dirty(offset/2);
}
TILE_GET_INFO_MEMBER(shadfrce_state::get_bg0tile_info)
{
/* ---- ---- ---- cccc --TT TTTT TTTT TTTT */
int tileno, colour,fyx;
tileno = (m_bg0videoram[tile_index *2+1] & 0x3fff);
colour = m_bg0videoram[tile_index *2] & 0x001f;
if (colour & 0x10) colour ^= 0x30; /* skip hole */
fyx = (m_bg0videoram[tile_index *2] & 0x00c0) >>6;
tileinfo.set(2,tileno,colour,TILE_FLIPYX(fyx));
}
void shadfrce_state::bg0videoram_w(offs_t offset, uint16_t data)
{
m_bg0videoram[offset] = data;
m_bg0tilemap->mark_tile_dirty(offset/2);
}
TILE_GET_INFO_MEMBER(shadfrce_state::get_bg1tile_info)
{
int tileno, colour;
tileno = (m_bg1videoram[tile_index] & 0x0fff);
colour = (m_bg1videoram[tile_index] & 0xf000) >> 12;
tileinfo.set(2,tileno,colour+64,0);
}
void shadfrce_state::bg1videoram_w(offs_t offset, uint16_t data)
{
m_bg1videoram[offset] = data;
m_bg1tilemap->mark_tile_dirty(offset);
}
void shadfrce_state::video_start()
{
m_fgtilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(shadfrce_state::get_fgtile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_fgtilemap->set_transparent_pen(0);
m_bg0tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(shadfrce_state::get_bg0tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_bg0tilemap->set_transparent_pen(0);
m_bg1tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(shadfrce_state::get_bg1tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_spvideoram_old = std::make_unique<uint16_t[]>(m_spvideoram.bytes()/2);
save_item(NAME(m_video_enable));
save_item(NAME(m_irqs_enable));
save_item(NAME(m_raster_scanline));
save_item(NAME(m_raster_irq_enable));
save_item(NAME(m_vblank));
save_item(NAME(m_prev_value));
}
void shadfrce_state::bg0scrollx_w(uint16_t data)
{
m_bg0tilemap->set_scrollx(0, data & 0x1ff );
}
void shadfrce_state::bg0scrolly_w(uint16_t data)
{
m_bg0tilemap->set_scrolly(0, data & 0x1ff );
}
void shadfrce_state::bg1scrollx_w(uint16_t data)
{
m_bg1tilemap->set_scrollx(0, data & 0x1ff );
}
void shadfrce_state::bg1scrolly_w(uint16_t data)
{
m_bg1tilemap->set_scrolly(0, data & 0x1ff );
}
void shadfrce_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
/* | ---- ---- hhhf Fe-Y | ---- ---- yyyy yyyy | ---- ---- TTTT TTTT | ---- ---- tttt tttt |
| ---- ---- -pCc cccX | ---- ---- xxxx xxxx | ---- ---- ---- ---- | ---- ---- ---- ---- | */
/* h = height
f = flipx
F = flipy
e = enable
Yy = Y Position
Tt = Tile No.
Xx = X Position
Cc = color
P = priority
*/
gfx_element *gfx = m_gfxdecode->gfx(1);
uint16_t *finish = m_spvideoram_old.get();
uint16_t *source = finish + 0x2000/2 - 8;
int hcount;
while( source>=finish )
{
int ypos = 0x100 - (((source[0] & 0x0003) << 8) | (source[1] & 0x00ff));
int xpos = (((source[4] & 0x0001) << 8) | (source[5] & 0x00ff)) + 1;
int tile = ((source[2] & 0x00ff) << 8) | (source[3] & 0x00ff);
int height = (source[0] & 0x00e0) >> 5;
int enable = ((source[0] & 0x0004));
int flipx = ((source[0] & 0x0010) >> 4);
int flipy = ((source[0] & 0x0008) >> 3);
int pal = ((source[4] & 0x003e));
int pri_mask = (source[4] & 0x0040) ? 0x02 : 0x00;
if (pal & 0x20) pal ^= 0x60; /* skip hole */
height++;
if (enable) {
for (hcount=0;hcount<height;hcount++) {
gfx->prio_transpen(bitmap,cliprect,tile+hcount,pal,flipx,flipy,xpos,ypos-hcount*16-16,screen.priority(),pri_mask,0);
gfx->prio_transpen(bitmap,cliprect,tile+hcount,pal,flipx,flipy,xpos-0x200,ypos-hcount*16-16,screen.priority(),pri_mask,0);
gfx->prio_transpen(bitmap,cliprect,tile+hcount,pal,flipx,flipy,xpos,ypos-hcount*16-16+0x200,screen.priority(),pri_mask,0);
gfx->prio_transpen(bitmap,cliprect,tile+hcount,pal,flipx,flipy,xpos-0x200,ypos-hcount*16-16+0x200,screen.priority(),pri_mask,0);
}
}
source-=8;
}
}
uint32_t shadfrce_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0, cliprect);
if (m_video_enable)
{
m_bg1tilemap->draw(screen, bitmap, cliprect, 0,0);
m_bg0tilemap->draw(screen, bitmap, cliprect, 0,1);
draw_sprites(screen,bitmap,cliprect);
m_fgtilemap->draw(screen, bitmap, cliprect, 0,0);
}
else
{
bitmap.fill(m_palette->black_pen(), cliprect);
}
return 0;
}
WRITE_LINE_MEMBER(shadfrce_state::screen_vblank)
{
// rising edge
if (state)
{
/* looks like sprites are *two* frames ahead */
memcpy(m_spvideoram_old.get(), m_spvideoram, m_spvideoram.bytes());
}
}

View File

@ -10,31 +10,258 @@ Driver by Takahiro Nogi (nogi@kt.rim.or.jp) 1999/10/04
***************************************************************************/
#include "emu.h"
#include "ssozumo.h"
#include "cpu/m6502/m6502.h"
#include "cpu/m6809/m6809.h"
#include "machine/gen_latch.h"
#include "sound/ay8910.h"
#include "sound/dac.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"
namespace {
class ssozumo_state : public driver_device
{
public:
ssozumo_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_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_spriteram(*this, "spriteram"),
m_paletteram(*this, "paletteram"),
m_videoram(*this, "videoram%u", 1U),
m_colorram(*this, "colorram%u", 1U)
{ }
void ssozumo(machine_config &config);
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
protected:
virtual void machine_start() override;
virtual void video_start() override;
private:
void sound_nmi_mask_w(uint8_t data);
template <uint8_t Which> void videoram_w(offs_t offset, uint8_t data);
template <uint8_t Which> void colorram_w(offs_t offset, uint8_t data);
void paletteram_w(offs_t offset, uint8_t data);
void scroll_w(uint8_t data);
void flipscreen_w(uint8_t data);
INTERRUPT_GEN_MEMBER(sound_timer_irq);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
void palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void main_map(address_map &map);
void sound_map(address_map &map);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_shared_ptr<uint8_t> m_spriteram;
required_shared_ptr<uint8_t> m_paletteram;
required_shared_ptr_array<uint8_t, 2> m_videoram;
required_shared_ptr_array<uint8_t, 2> m_colorram;
tilemap_t *m_bg_tilemap = nullptr;
tilemap_t *m_fg_tilemap = nullptr;
uint8_t m_sound_nmi_mask = 0;
uint8_t m_color_bank = 0;
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
};
// video
/**************************************************************************/
void ssozumo_state::palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
for (int i = 0 ; i < 64 ; i++)
{
int bit0, bit1, bit2, bit3;
bit0 = BIT(color_prom[0], 0);
bit1 = BIT(color_prom[0], 1);
bit2 = BIT(color_prom[0], 2);
bit3 = BIT(color_prom[0], 3);
int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = BIT(color_prom[0], 4);
bit1 = BIT(color_prom[0], 5);
bit2 = BIT(color_prom[0], 6);
bit3 = BIT(color_prom[0], 7);
int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = BIT(color_prom[64], 0);
bit1 = BIT(color_prom[64], 1);
bit2 = BIT(color_prom[64], 2);
bit3 = BIT(color_prom[64], 3);
int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
}
template <uint8_t Which>
void ssozumo_state::videoram_w(offs_t offset, uint8_t data)
{
m_videoram[Which][offset] = data;
Which ? m_fg_tilemap->mark_tile_dirty(offset) : m_bg_tilemap->mark_tile_dirty(offset);
}
template <uint8_t Which>
void ssozumo_state::colorram_w(offs_t offset, uint8_t data)
{
m_colorram[Which][offset] = data;
Which ? m_fg_tilemap->mark_tile_dirty(offset) : m_bg_tilemap->mark_tile_dirty(offset);
}
void ssozumo_state::paletteram_w(offs_t offset, uint8_t data)
{
int bit0, bit1, bit2, bit3, val;
m_paletteram[offset] = data;
int const offs2 = offset & 0x0f;
val = m_paletteram[offs2];
bit0 = (val >> 0) & 0x01;
bit1 = (val >> 1) & 0x01;
bit2 = (val >> 2) & 0x01;
bit3 = (val >> 3) & 0x01;
int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
val = m_paletteram[offs2 | 0x10];
bit0 = (val >> 0) & 0x01;
bit1 = (val >> 1) & 0x01;
bit2 = (val >> 2) & 0x01;
bit3 = (val >> 3) & 0x01;
int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
val = m_paletteram[offs2 | 0x20];
bit0 = (val >> 0) & 0x01;
bit1 = (val >> 1) & 0x01;
bit2 = (val >> 2) & 0x01;
bit3 = (val >> 3) & 0x01;
int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
m_palette->set_pen_color(offs2 + 64, rgb_t(r, g, b));
}
void ssozumo_state::scroll_w(uint8_t data)
{
m_bg_tilemap->set_scrolly(0, data);
}
void ssozumo_state::flipscreen_w(uint8_t data)
{
flip_screen_set(data & 0x80);
m_color_bank = data & 3;
m_fg_tilemap->mark_all_dirty();
}
TILE_GET_INFO_MEMBER(ssozumo_state::get_bg_tile_info)
{
int const code = m_videoram[0][tile_index] + ((m_colorram[0][tile_index] & 0x08) << 5);
int const color = (m_colorram[0][tile_index] & 0x30) >> 4;
int const flags = ((tile_index % 32) >= 16) ? TILE_FLIPY : 0;
tileinfo.set(1, code, color, flags);
}
TILE_GET_INFO_MEMBER(ssozumo_state::get_fg_tile_info)
{
int const code = m_videoram[1][tile_index] + 256 * (m_colorram[1][tile_index] & 0x07);
tileinfo.set(0, code, m_color_bank, 0);
}
void ssozumo_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ssozumo_state::get_bg_tile_info)), TILEMAP_SCAN_COLS_FLIP_X,
16, 16, 16, 32);
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ssozumo_state::get_fg_tile_info)), TILEMAP_SCAN_COLS_FLIP_X,
8, 8, 32, 32);
m_fg_tilemap->set_transparent_pen(0);
save_item(NAME(m_color_bank));
}
void ssozumo_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
for (int offs = 0; offs < m_spriteram.bytes(); offs += 4)
{
if (m_spriteram[offs] & 0x01)
{
int const code = m_spriteram[offs + 1] + ((m_spriteram[offs] & 0xf0) << 4);
int const color = (m_spriteram[offs] & 0x08) >> 3;
int flipx = m_spriteram[offs] & 0x04;
int flipy = m_spriteram[offs] & 0x02;
int sx = 239 - m_spriteram[offs + 3];
int sy = (240 - m_spriteram[offs + 2]) & 0xff;
if (flip_screen())
{
sx = 240 - sx;
sy = 240 - sy;
flipx = !flipx;
flipy = !flipy;
}
m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
code, color,
flipx, flipy,
sx, sy, 0);
}
}
}
uint32_t ssozumo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect);
return 0;
}
// machine
void ssozumo_state::machine_start()
{
save_item(NAME(m_sound_nmi_mask));
}
void ssozumo_state::ssozumo_map(address_map &map)
void ssozumo_state::main_map(address_map &map)
{
map(0x0000, 0x077f).ram();
map(0x0780, 0x07ff).ram().share("spriteram");
map(0x2000, 0x23ff).ram().w(FUNC(ssozumo_state::videoram2_w)).share("videoram2");
map(0x2400, 0x27ff).ram().w(FUNC(ssozumo_state::colorram2_w)).share("colorram2");
map(0x3000, 0x31ff).ram().w(FUNC(ssozumo_state::videoram_w)).share("videoram");
map(0x3200, 0x33ff).ram().w(FUNC(ssozumo_state::colorram_w)).share("colorram");
map(0x0780, 0x07ff).ram().share(m_spriteram);
map(0x2000, 0x23ff).ram().w(FUNC(ssozumo_state::videoram_w<1>)).share(m_videoram[1]);
map(0x2400, 0x27ff).ram().w(FUNC(ssozumo_state::colorram_w<1>)).share(m_colorram[1]);
map(0x3000, 0x31ff).ram().w(FUNC(ssozumo_state::videoram_w<0>)).share(m_videoram[0]);
map(0x3200, 0x33ff).ram().w(FUNC(ssozumo_state::colorram_w<0>)).share(m_colorram[0]);
map(0x3400, 0x35ff).ram();
map(0x3600, 0x37ff).ram();
map(0x4000, 0x4000).portr("P1").w(FUNC(ssozumo_state::flipscreen_w));
@ -52,8 +279,8 @@ void ssozumo_state::sound_nmi_mask_w(uint8_t data)
m_sound_nmi_mask = data & 1;
}
/* Same as Tag Team */
void ssozumo_state::ssozumo_sound_map(address_map &map)
// Same as Tag Team
void ssozumo_state::sound_map(address_map &map)
{
map(0x0000, 0x01ff).ram();
map(0x2000, 0x2001).w("ay1", FUNC(ay8910_device::data_address_w));
@ -70,7 +297,7 @@ INPUT_CHANGED_MEMBER(ssozumo_state::coin_inserted)
}
static INPUT_PORTS_START( ssozumo )
PORT_START("P1") /* IN0 */
PORT_START("P1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
@ -80,7 +307,7 @@ static INPUT_PORTS_START( ssozumo )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, ssozumo_state, coin_inserted, 0)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, ssozumo_state, coin_inserted, 0)
PORT_START("P2") /* IN1 */
PORT_START("P2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
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)
@ -90,7 +317,7 @@ static INPUT_PORTS_START( ssozumo )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
PORT_START("DSW2") /* DSW2 */
PORT_START("DSW2")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Difficulty ) )
PORT_DIPSETTING( 0x01, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hard ) )
@ -116,7 +343,7 @@ static INPUT_PORTS_START( ssozumo )
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("DSW1") /* DSW1 */
PORT_START("DSW1")
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) )
PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
@ -141,90 +368,78 @@ INPUT_PORTS_END
static const gfx_layout charlayout =
{
8,8, /* 8*8 characters */
RGN_FRAC(1,3), /* 1024 characters */
3, /* 3 bits per pixel */
{ RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) }, /* the bitplanes are separated */
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
8*8 /* every char takes 8 consecutive bytes */
};
static const gfx_layout tilelayout =
{
16,16, /* 16*16 tiles */
256, /* 256 tiles */
3, /* 3 bits per pixel */
{ 2*256*16*16, 256*16*16, 0 }, /* the bitplanes are separated */
16,16, // 16*16 tiles
256, // 256 tiles
3, // 3 bits per pixel
{ 2*256*16*16, 256*16*16, 0 }, // the bitplanes are separated
{ 16*8 + 0, 16*8 + 1, 16*8 + 2, 16*8 + 3, 16*8 + 4, 16*8 + 5, 16*8 + 6, 16*8 + 7,
0, 1, 2, 3, 4, 5, 6, 7 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
32*8 /* every tile takes 16 consecutive bytes */
32*8 // every tile takes 16 consecutive bytes
};
static const gfx_layout spritelayout =
{
16,16, /* 16*16 sprites */
1280, /* 1280 sprites */
3, /* 3 bits per pixel */
{ 2*1280*16*16, 1280*16*16, 0 }, /* the bitplanes are separated */
16,16, // 16*16 sprites
1280, // 1280 sprites
3, // 3 bits per pixel
{ 2*1280*16*16, 1280*16*16, 0 }, // the bitplanes are separated
{ 16*8 + 0, 16*8 + 1, 16*8 + 2, 16*8 + 3, 16*8 + 4, 16*8 + 5, 16*8 + 6, 16*8 + 7,
0, 1, 2, 3, 4, 5, 6, 7 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
32*8 /* every sprite takes 16 consecutive bytes */
32*8 // every sprite takes 16 consecutive bytes
};
static GFXDECODE_START( gfx_ssozumo )
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 4 )
GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 4*8, 4 )
GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 8*8, 2 )
GFXDECODE_ENTRY( "fgtiles", 0, gfx_8x8x3_planar, 0, 4 )
GFXDECODE_ENTRY( "bgtiles", 0, tilelayout, 4*8, 4 )
GFXDECODE_ENTRY( "sprites", 0, spritelayout, 8*8, 2 )
GFXDECODE_END
INTERRUPT_GEN_MEMBER(ssozumo_state::sound_timer_irq)
{
if(m_sound_nmi_mask)
if (m_sound_nmi_mask)
device.execute().pulse_input_line(INPUT_LINE_NMI, attotime::zero);
}
void ssozumo_state::ssozumo(machine_config &config)
{
/* basic machine hardware */
M6502(config, m_maincpu, 1200000); /* 1.2 MHz ???? */
m_maincpu->set_addrmap(AS_PROGRAM, &ssozumo_state::ssozumo_map);
// basic machine hardware
M6502(config, m_maincpu, 1'200'000); // 1.2 MHz ????
m_maincpu->set_addrmap(AS_PROGRAM, &ssozumo_state::main_map);
m_maincpu->set_vblank_int("screen", FUNC(ssozumo_state::irq0_line_hold));
M6502(config, m_audiocpu, 975000); /* 975 kHz ?? */
m_audiocpu->set_addrmap(AS_PROGRAM, &ssozumo_state::ssozumo_sound_map);
m_audiocpu->set_periodic_int(FUNC(ssozumo_state::sound_timer_irq), attotime::from_hz(272/16*57)); // guess, assume to be the same as tagteam
M6502(config, m_audiocpu, 975'000); // 975 kHz ??
m_audiocpu->set_addrmap(AS_PROGRAM, &ssozumo_state::sound_map);
m_audiocpu->set_periodic_int(FUNC(ssozumo_state::sound_timer_irq), attotime::from_hz(272 / 16 * 57)); // guess, assume to be the same as tagteam
/* video hardware */
// video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
// screen.set_refresh_hz(60);
// screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
// screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate
// screen.set_size(32*8, 32*8);
// screen.set_visarea(0*8, 32*8 - 1, 1*8, 31*8 - 1);
// DECO video CRTC, unverified
screen.set_raw(XTAL(12'000'000)/2,384,0,256,272,8,248);
screen.set_raw(XTAL(12'000'000) / 2, 384, 0, 256, 272, 8, 248);
screen.set_screen_update(FUNC(ssozumo_state::screen_update));
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_ssozumo);
PALETTE(config, m_palette, FUNC(ssozumo_state::ssozumo_palette), 64 + 16);
PALETTE(config, m_palette, FUNC(ssozumo_state::palette), 64 + 16);
/* sound hardware */
// sound hardware
SPEAKER(config, "speaker").front_center();
GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, m6502_device::IRQ_LINE);
YM2149(config, "ay1", 1500000).add_route(ALL_OUTPUTS, "speaker", 0.3);
YM2149(config, "ay2", 1500000).add_route(ALL_OUTPUTS, "speaker", 0.3);
YM2149(config, "ay1", 1'500'000).add_route(ALL_OUTPUTS, "speaker", 0.3);
YM2149(config, "ay2", 1'500'000).add_route(ALL_OUTPUTS, "speaker", 0.3);
DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.3); // unknown DAC
}
@ -233,15 +448,13 @@ void ssozumo_state::ssozumo(machine_config &config)
ROM_START( ssozumo )
ROM_REGION( 0x10000, "maincpu", 0 )
/* Main Program ROMs */
ROM_LOAD( "ic61.g01", 0x06000, 0x2000, CRC(86968f46) SHA1(6acd111b71fbb4ef00ae03be4fb93d305a6564e7) ) // m1
ROM_LOAD( "ic60.g11", 0x08000, 0x2000, CRC(1a5143dd) SHA1(19e36afcd0827f14f4360b55d952cc1af38327fd) ) // m2
ROM_LOAD( "ic59.g21", 0x0a000, 0x2000, CRC(d3df04d7) SHA1(a95cff7f67ad2a3dbf7147018889a0de3f9fcbac) ) // m3
ROM_LOAD( "ic58.g31", 0x0c000, 0x2000, CRC(0ee43a78) SHA1(383a29a2dfdbd600dacf3885039759efab718a45) ) // m4
ROM_LOAD( "ic57.g41", 0x0e000, 0x2000, CRC(ac77aa4c) SHA1(36ee826327e4433bcdcb8d770fc6176f53d3eed0) ) // m5
ROM_REGION( 0x10000, "audiocpu", 0 )
/* Sound Program & Voice Sample ROMs*/
ROM_REGION( 0x10000, "audiocpu", 0 ) // program & voice samples
ROM_LOAD( "ic47.g50", 0x04000, 0x2000, CRC(b64ec829) SHA1(684f1c37c05fc3812f11e040fb96789c8abb987f) ) // a1
ROM_LOAD( "ic46.g60", 0x06000, 0x2000, CRC(630d7380) SHA1(aab3f034417a9712c8fa922946eda02751c9e319) ) // a2
ROM_LOAD( "ic45.g70", 0x08000, 0x2000, CRC(1854b657) SHA1(c4f3c24a2b03bdf4d9fd80d6df944a157f98e617) ) // a3
@ -249,20 +462,17 @@ ROM_START( ssozumo )
ROM_LOAD( "ic43.g90", 0x0c000, 0x2000, CRC(20262064) SHA1(2845efa458f4fd873b8559489bcee4b9d8e437c1) ) // a5
ROM_LOAD( "ic42.ga0", 0x0e000, 0x2000, CRC(98d7e998) SHA1(16bb3315db7d52531a3297e1255478aa1ebc32c2) ) // a6
ROM_REGION( 0x06000, "gfx1", 0 )
/* Character ROMs */
ROM_REGION( 0x06000, "fgtiles", 0 )
ROM_LOAD( "ic22.gq0", 0x00000, 0x2000, CRC(b4c7e612) SHA1(2d4f6f79b65aa27e00f173777959ec07e81ff15e) ) // c1
ROM_LOAD( "ic23.gr0", 0x02000, 0x2000, CRC(90bb9fda) SHA1(9c065a54330133e5afadcb2ae29add5e1005d977) ) // c2
ROM_LOAD( "ic21.gs0", 0x04000, 0x2000, CRC(d8cd5c78) SHA1(f1567850db649d2b7a029a5f71bbade25bb0393f) ) // c3
ROM_REGION( 0x06000, "gfx2", 0 )
/* tile set ROMs */
ROM_REGION( 0x06000, "bgtiles", 0 )
ROM_LOAD( "ic69.gt0", 0x00000, 0x2000, CRC(771116ca) SHA1(2d1c656315f57e1a142725e2d2034543cb3917ea) ) // t1
ROM_LOAD( "ic59.gu0", 0x02000, 0x2000, CRC(68035bfd) SHA1(da535ff6860f71c1780d4d9dfd1944e355234c5b) ) // t2
ROM_LOAD( "ic81.gv0", 0x04000, 0x2000, CRC(cdda1f9f) SHA1(d1f1b3e0578fd991c74d4a85313c5d37f08f1eee) ) // t3
ROM_REGION( 0x1e000, "gfx3", 0 )
/* sprites ROMs */
ROM_REGION( 0x1e000, "sprites", 0 )
ROM_LOAD( "ic06.gg0", 0x00000, 0x2000, CRC(d2342c50) SHA1(f502b716d659d9fd3119dbb454296fe9e280fa5d) ) // s1a
ROM_LOAD( "ic05.gh0", 0x02000, 0x2000, CRC(14a3cb10) SHA1(7b6d63f43ebbe3c3aea7f2e04789cdb78cdd8495) ) // s1b
ROM_LOAD( "ic04.gi0", 0x04000, 0x2000, CRC(169276c1) SHA1(7f0b54425e0f82f7fcc892d7b8e7719087060d2a) ) // s1c
@ -280,12 +490,13 @@ ROM_START( ssozumo )
ROM_LOAD( "ic40.gf0", 0x1c000, 0x2000, CRC(5a3bf1ba) SHA1(6beebb7ac9c8baa3bbb5b0ebf6a6da768e52d1d3) ) // s3e
ROM_REGION( 0x0080, "proms", 0 )
ROM_LOAD( "ic33.gz0", 0x00000, 0x0020, CRC(523d29ad) SHA1(48d0ae83a07e4409a1def56772c5156e8d505749) ) /* char palette red and green components */
ROM_LOAD( "ic30.gz2", 0x00020, 0x0020, CRC(0de202e1) SHA1(ca1aa66c1d3d4724d322ec0346860c37729ddaed) ) /* tile palette red and green components */
ROM_LOAD( "ic32.gz1", 0x00040, 0x0020, CRC(6fbff4d2) SHA1(b2cd38fa8e9a74539b96d6e8e0375fff2dd77a20) ) /* char palette blue component */
ROM_LOAD( "ic31.gz3", 0x00060, 0x0020, CRC(18e7fe63) SHA1(b0834b94b22ead765ddac5591ab1dc66ec20f17f) ) /* tile palette blue component */
ROM_LOAD( "ic33.gz0", 0x00000, 0x0020, CRC(523d29ad) SHA1(48d0ae83a07e4409a1def56772c5156e8d505749) ) // char palette red and green components
ROM_LOAD( "ic30.gz2", 0x00020, 0x0020, CRC(0de202e1) SHA1(ca1aa66c1d3d4724d322ec0346860c37729ddaed) ) // tile palette red and green components
ROM_LOAD( "ic32.gz1", 0x00040, 0x0020, CRC(6fbff4d2) SHA1(b2cd38fa8e9a74539b96d6e8e0375fff2dd77a20) ) // char palette blue component
ROM_LOAD( "ic31.gz3", 0x00060, 0x0020, CRC(18e7fe63) SHA1(b0834b94b22ead765ddac5591ab1dc66ec20f17f) ) // tile palette blue component
ROM_END
} // anonymous namespace
GAME( 1984, ssozumo, 0, ssozumo, ssozumo, ssozumo_state, empty_init, ROT270, "Technos Japan", "Syusse Oozumou (Japan)", MACHINE_SUPPORTS_SAVE )

View File

@ -1,77 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Takahiro Nogi
#ifndef MAME_INCLUDES_SSOZUMO_H
#define MAME_INCLUDES_SSOZUMO_H
#pragma once
#include "emupal.h"
#include "tilemap.h"
class ssozumo_state : public driver_device
{
public:
ssozumo_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_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_spriteram(*this, "spriteram"),
m_paletteram(*this, "paletteram"),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_videoram2(*this, "videoram2"),
m_colorram2(*this, "colorram2")
{ }
void ssozumo(machine_config &config);
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
protected:
virtual void machine_start() override;
virtual void video_start() override;
private:
void sound_nmi_mask_w(uint8_t data);
void videoram_w(offs_t offset, uint8_t data);
void colorram_w(offs_t offset, uint8_t data);
void videoram2_w(offs_t offset, uint8_t data);
void colorram2_w(offs_t offset, uint8_t data);
void paletteram_w(offs_t offset, uint8_t data);
void scroll_w(uint8_t data);
void flipscreen_w(uint8_t data);
INTERRUPT_GEN_MEMBER(sound_timer_irq);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
void ssozumo_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void ssozumo_map(address_map &map);
void ssozumo_sound_map(address_map &map);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_shared_ptr<uint8_t> m_spriteram;
required_shared_ptr<uint8_t> m_paletteram;
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
required_shared_ptr<uint8_t> m_videoram2;
required_shared_ptr<uint8_t> m_colorram2;
tilemap_t *m_bg_tilemap = nullptr;
tilemap_t *m_fg_tilemap = nullptr;
uint8_t m_sound_nmi_mask = 0;
uint8_t m_color_bank = 0;
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
};
#endif // MAME_INCLUDES_SSOZUMO_H

View File

@ -1,181 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Takahiro Nogi
/***************************************************************************
Syusse Oozumou
(c) 1984 Technos Japan (Licensed by Data East)
Driver by Takahiro Nogi (nogi@kt.rim.or.jp) 1999/10/04
***************************************************************************/
#include "emu.h"
#include "ssozumo.h"
/**************************************************************************/
void ssozumo_state::ssozumo_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
for (int i = 0 ; i < 64 ; i++)
{
int bit0, bit1, bit2, bit3;
bit0 = BIT(color_prom[0], 0);
bit1 = BIT(color_prom[0], 1);
bit2 = BIT(color_prom[0], 2);
bit3 = BIT(color_prom[0], 3);
int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = BIT(color_prom[0], 4);
bit1 = BIT(color_prom[0], 5);
bit2 = BIT(color_prom[0], 6);
bit3 = BIT(color_prom[0], 7);
int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = BIT(color_prom[64], 0);
bit1 = BIT(color_prom[64], 1);
bit2 = BIT(color_prom[64], 2);
bit3 = BIT(color_prom[64], 3);
int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
}
void ssozumo_state::videoram_w(offs_t offset, uint8_t data)
{
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
void ssozumo_state::colorram_w(offs_t offset, uint8_t data)
{
m_colorram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
void ssozumo_state::videoram2_w(offs_t offset, uint8_t data)
{
m_videoram2[offset] = data;
m_fg_tilemap->mark_tile_dirty(offset);
}
void ssozumo_state::colorram2_w(offs_t offset, uint8_t data)
{
m_colorram2[offset] = data;
m_fg_tilemap->mark_tile_dirty(offset);
}
void ssozumo_state::paletteram_w(offs_t offset, uint8_t data)
{
int bit0, bit1, bit2, bit3, val;
int r, g, b;
int offs2;
m_paletteram[offset] = data;
offs2 = offset & 0x0f;
val = m_paletteram[offs2];
bit0 = (val >> 0) & 0x01;
bit1 = (val >> 1) & 0x01;
bit2 = (val >> 2) & 0x01;
bit3 = (val >> 3) & 0x01;
r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
val = m_paletteram[offs2 | 0x10];
bit0 = (val >> 0) & 0x01;
bit1 = (val >> 1) & 0x01;
bit2 = (val >> 2) & 0x01;
bit3 = (val >> 3) & 0x01;
g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
val = m_paletteram[offs2 | 0x20];
bit0 = (val >> 0) & 0x01;
bit1 = (val >> 1) & 0x01;
bit2 = (val >> 2) & 0x01;
bit3 = (val >> 3) & 0x01;
b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
m_palette->set_pen_color(offs2 + 64, rgb_t(r, g, b));
}
void ssozumo_state::scroll_w(uint8_t data)
{
m_bg_tilemap->set_scrolly(0, data);
}
void ssozumo_state::flipscreen_w(uint8_t data)
{
flip_screen_set(data & 0x80);
m_color_bank = data & 3;
m_fg_tilemap->mark_all_dirty();
}
TILE_GET_INFO_MEMBER(ssozumo_state::get_bg_tile_info)
{
int code = m_videoram[tile_index] + ((m_colorram[tile_index] & 0x08) << 5);
int color = (m_colorram[tile_index] & 0x30) >> 4;
int flags = ((tile_index % 32) >= 16) ? TILE_FLIPY : 0;
tileinfo.set(1, code, color, flags);
}
TILE_GET_INFO_MEMBER(ssozumo_state::get_fg_tile_info)
{
int code = m_videoram2[tile_index] + 256 * (m_colorram2[tile_index] & 0x07);
tileinfo.set(0, code, m_color_bank, 0);
}
void ssozumo_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ssozumo_state::get_bg_tile_info)), TILEMAP_SCAN_COLS_FLIP_X,
16, 16, 16, 32);
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ssozumo_state::get_fg_tile_info)), TILEMAP_SCAN_COLS_FLIP_X,
8, 8, 32, 32);
m_fg_tilemap->set_transparent_pen(0);
save_item(NAME(m_color_bank));
}
void ssozumo_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
for (int offs = 0; offs < m_spriteram.bytes(); offs += 4)
{
if (m_spriteram[offs] & 0x01)
{
int code = m_spriteram[offs + 1] + ((m_spriteram[offs] & 0xf0) << 4);
int color = (m_spriteram[offs] & 0x08) >> 3;
int flipx = m_spriteram[offs] & 0x04;
int flipy = m_spriteram[offs] & 0x02;
int sx = 239 - m_spriteram[offs + 3];
int sy = (240 - m_spriteram[offs + 2]) & 0xff;
if (flip_screen())
{
sx = 240 - sx;
sy = 240 - sy;
flipx = !flipx;
flipy = !flipy;
}
m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
code, color,
flipx, flipy,
sx, sy, 0);
}
}
}
uint32_t ssozumo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect);
return 0;
}

View File

@ -27,15 +27,258 @@ TODO:
***************************************************************************/
#include "emu.h"
#include "tagteam.h"
#include "cpu/m6502/m6502.h"
#include "machine/gen_latch.h"
#include "sound/ay8910.h"
#include "sound/dac.h"
#include "video/resnet.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"
namespace {
class tagteam_state : public driver_device
{
public:
tagteam_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_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch"),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram")
{ }
void tagteam(machine_config &config);
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
protected:
virtual void machine_start() override;
virtual void video_start() override;
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
uint8_t m_palettebank = 0U;
tilemap_t *m_bg_tilemap = nullptr;
uint8_t m_sound_nmi_mask = 0U;
void irq_clear_w(uint8_t data);
void sound_nmi_mask_w(uint8_t data);
void videoram_w(offs_t offset, uint8_t data);
void colorram_w(offs_t offset, uint8_t data);
uint8_t mirrorvideoram_r(offs_t offset);
uint8_t mirrorcolorram_r(offs_t offset);
void mirrorvideoram_w(offs_t offset, uint8_t data);
void mirrorcolorram_w(offs_t offset, uint8_t data);
void control_w(uint8_t data);
void flipscreen_w(uint8_t data);
INTERRUPT_GEN_MEMBER(sound_timer_irq);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
void palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void main_map(address_map &map);
void sound_map(address_map &map);
};
// video
// TODO: fix or confirm resnet implementation
// schematics say emitter circuit with 47 ohm pullup and 470 ohm pulldown but this results in a bad palette
static const res_net_info tagteam_net_info =
{
RES_NET_VCC_5V | RES_NET_VBIAS_5V | RES_NET_VIN_TTL_OUT,
{
{ RES_NET_AMP_EMITTER, 4700, 0, 3, { 4700, 3300, 1500 } },
{ RES_NET_AMP_EMITTER, 4700, 0, 3, { 4700, 3300, 1500 } },
{ RES_NET_AMP_EMITTER, 4700, 0, 2, { 3300, 1500 } }
}
};
static const res_net_decode_info tagteam_decode_info =
{
1, // single PROM per color
0x000, 0x01f, // start/end
/* R G B */
{ 0x00, 0x00, 0x00 }, // offsets
{ 0x00, 0x03, 0x06 }, // shifts
{ 0x07, 0x07, 0x03 } // masks
};
void tagteam_state::palette(palette_device &palette) const
{
uint8_t const *const color_prom = memregion("proms")->base();
std::vector<rgb_t> rgb;
compute_res_net_all(rgb, color_prom, tagteam_decode_info, tagteam_net_info);
palette.set_pen_colors(0x00, rgb);
}
void tagteam_state::videoram_w(offs_t offset, uint8_t data)
{
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
void tagteam_state::colorram_w(offs_t offset, uint8_t data)
{
m_colorram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
uint8_t tagteam_state::mirrorvideoram_r(offs_t offset)
{
// swap x and y coordinates
int const x = offset / 32;
int const y = offset % 32;
offset = 32 * y + x;
return m_videoram[offset];
}
uint8_t tagteam_state::mirrorcolorram_r(offs_t offset)
{
// swap x and y coordinates
int const x = offset / 32;
int const y = offset % 32;
offset = 32 * y + x;
return m_colorram[offset];
}
void tagteam_state::mirrorvideoram_w(offs_t offset, uint8_t data)
{
// swap x and y coordinates
int const x = offset / 32;
int const y = offset % 32;
offset = 32 * y + x;
videoram_w(offset, data);
}
void tagteam_state::mirrorcolorram_w(offs_t offset, uint8_t data)
{
// swap x and y coordinates
int const x = offset / 32;
int const y = offset % 32;
offset = 32 * y + x;
colorram_w(offset, data);
}
void tagteam_state::control_w(uint8_t data)
{
// d0-3: color for blank screen, applies to h/v borders too
// (not implemented yet, and tagteam doesn't have a global screen on/off bit)
// d7: palette bank
m_palettebank = (data & 0x80) >> 7;
}
void tagteam_state::flipscreen_w(uint8_t data)
{
// d0: flip screen
if (flip_screen() != (data & 0x01))
{
flip_screen_set(data & 0x01);
machine().tilemap().mark_all_dirty();
}
// d6/7: coin counters
machine().bookkeeping().coin_counter_w(0, data & 0x80);
machine().bookkeeping().coin_counter_w(1, data & 0x40);
}
TILE_GET_INFO_MEMBER(tagteam_state::get_bg_tile_info)
{
int const code = m_videoram[tile_index] + 256 * m_colorram[tile_index];
int const color = m_palettebank << 1;
tileinfo.set(0, code, color, 0);
}
void tagteam_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tagteam_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS_FLIP_X,
8, 8, 32, 32);
save_item(NAME(m_palettebank));
}
void tagteam_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
for (int offs = 0; offs < 0x20; offs += 4)
{
int const spritebank = (m_videoram[offs] & 0x30) << 4;
int code = m_videoram[offs + 1] + 256 * spritebank;
int color = m_palettebank << 1 | 1;
int flipx = m_videoram[offs] & 0x04;
int flipy = m_videoram[offs] & 0x02;
int sx = 240 - m_videoram[offs + 3];
int sy = 240 - m_videoram[offs + 2];
if (!(m_videoram[offs] & 0x01)) continue;
if (flip_screen())
{
sx = 240 - sx;
sy = 240 - sy;
flipx = !flipx;
flipy = !flipy;
}
m_gfxdecode->gfx(1)->transpen(bitmap, cliprect,
code, color,
flipx, flipy,
sx, sy, 0);
// Wrap around
code = m_videoram[offs + 0x20] + 256 * spritebank;
color = m_palettebank;
sy += (flip_screen() ? -256 : 256);
m_gfxdecode->gfx(1)->transpen(bitmap, cliprect,
code, color,
flipx, flipy,
sx, sy, 0);
}
}
uint32_t tagteam_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect);
return 0;
}
// machine
void tagteam_state::machine_start()
{
save_item(NAME(m_sound_nmi_mask));
@ -55,8 +298,8 @@ void tagteam_state::main_map(address_map &map)
map(0x2003, 0x2003).portr("DSW2").w(FUNC(tagteam_state::irq_clear_w));
map(0x4000, 0x43ff).rw(FUNC(tagteam_state::mirrorvideoram_r), FUNC(tagteam_state::mirrorvideoram_w));
map(0x4400, 0x47ff).rw(FUNC(tagteam_state::mirrorcolorram_r), FUNC(tagteam_state::mirrorcolorram_w));
map(0x4800, 0x4bff).ram().w(FUNC(tagteam_state::videoram_w)).share("videoram");
map(0x4c00, 0x4fff).ram().w(FUNC(tagteam_state::colorram_w)).share("colorram");
map(0x4800, 0x4bff).ram().w(FUNC(tagteam_state::videoram_w)).share(m_videoram);
map(0x4c00, 0x4fff).ram().w(FUNC(tagteam_state::colorram_w)).share(m_colorram);
map(0x8000, 0xffff).rom();
}
@ -65,7 +308,7 @@ void tagteam_state::sound_nmi_mask_w(uint8_t data)
m_sound_nmi_mask = data & 1;
}
/* Same as Syusse Oozumou */
// Same as Syusse Oozumou
void tagteam_state::sound_map(address_map &map)
{
map(0x0000, 0x03ff).ram();
@ -91,8 +334,8 @@ static INPUT_PORTS_START( bigprowr )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, tagteam_state,coin_inserted, 0)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, tagteam_state,coin_inserted, 0)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, tagteam_state, coin_inserted, 0)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, tagteam_state, coin_inserted, 0)
PORT_START("P2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_8WAY
@ -121,7 +364,7 @@ static INPUT_PORTS_START( bigprowr )
PORT_DIPNAME( 0x60, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:6,7")
PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) // "Upright, Single Controls"
PORT_DIPSETTING( 0x40, "Upright, Dual Controls" )
// PORT_DIPSETTING( 0x20, "Cocktail, Single Controls" ) // IMPOSSIBLE !
PORT_DIPSETTING( 0x20, "Cocktail, Single Controls" ) // IMPOSSIBLE !
PORT_DIPSETTING( 0x60, DEF_STR( Cocktail ) ) // "Cocktail, Dual Controls"
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
@ -140,7 +383,7 @@ static INPUT_PORTS_START( bigprowr )
PORT_DIPUNUSED_DIPLOC( 0x80, 0x00, "SW2:8" )
INPUT_PORTS_END
/* Same as 'bigprowr', but additional "Coin Mode" Dip Switch */
// Same as 'bigprowr', but additional "Coin Mode" Dip Switch
static INPUT_PORTS_START( tagteam )
PORT_INCLUDE( bigprowr )
@ -149,38 +392,26 @@ static INPUT_PORTS_START( tagteam )
PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) ) PORT_CONDITION("DSW2", 0xe0, NOTEQUALS, 0x80) //Mode 1
PORT_DIPSETTING( 0x01, DEF_STR( 1C_6C ) ) PORT_CONDITION("DSW2", 0xe0, EQUALS, 0x80) //Mode 2
PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) ) PORT_CONDITION("DSW2", 0xe0, NOTEQUALS, 0x80) // Mode 1
PORT_DIPSETTING( 0x01, DEF_STR( 1C_6C ) ) PORT_CONDITION("DSW2", 0xe0, EQUALS, 0x80) // Mode 2
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:3,4")
PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) ) PORT_CONDITION("DSW2", 0xe0, NOTEQUALS, 0x80) //Mode 1
PORT_DIPSETTING( 0x04, DEF_STR( 1C_6C ) ) PORT_CONDITION("DSW2", 0xe0, EQUALS, 0x80) //Mode 2
PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) ) PORT_CONDITION("DSW2", 0xe0, NOTEQUALS, 0x80) // Mode 1
PORT_DIPSETTING( 0x04, DEF_STR( 1C_6C ) ) PORT_CONDITION("DSW2", 0xe0, EQUALS, 0x80) // Mode 2
PORT_MODIFY("DSW2")
PORT_DIPNAME( 0xe0, 0x00, "Coin Mode" ) PORT_DIPLOCATION("SW2:6,7,8")
PORT_DIPSETTING( 0x00, "Mode 1" )
PORT_DIPSETTING( 0x80, "Mode 2" )
/* Check code at 0xff5c */
/* Other values (0x20, 0x40, 0x60, 0xa0, 0xc0, 0xe0) : "Mode 1" */
/* Therefore the logic for DIPCONDITION is '=0x80' not '<>0x00'*/
// Check code at 0xff5c
// Other values (0x20, 0x40, 0x60, 0xa0, 0xc0, 0xe0) : "Mode 1"
// Therefore the logic for DIPCONDITION is '=0x80' not '<>0x00'
INPUT_PORTS_END
static const gfx_layout charlayout =
{
8,8, /* 8*8 characters */
3072, /* 3072 characters */
3, /* 3 bits per pixel */
{ 2*3072*8*8, 3072*8*8, 0 }, /* the bitplanes are separated */
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
8*8 /* every char takes 8 consecutive bytes */
};
static const gfx_layout spritelayout =
{
16,16, /* 16*16 sprites */
@ -195,30 +426,30 @@ static const gfx_layout spritelayout =
};
static GFXDECODE_START( gfx_tagteam )
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 4 ) /* chars */
GFXDECODE_ENTRY( "gfx1", 0, spritelayout, 0, 4 ) /* sprites */
GFXDECODE_ENTRY( "gfx", 0, gfx_8x8x3_planar, 0, 4 ) // chars
GFXDECODE_ENTRY( "gfx", 0, spritelayout, 0, 4 ) // sprites
GFXDECODE_END
INTERRUPT_GEN_MEMBER(tagteam_state::sound_timer_irq)
{
if(m_sound_nmi_mask)
if (m_sound_nmi_mask)
device.execute().pulse_input_line(INPUT_LINE_NMI, attotime::zero);
}
void tagteam_state::tagteam(machine_config &config)
{
/* basic machine hardware */
M6502(config, m_maincpu, XTAL(12'000'000)/8);
// basic machine hardware
M6502(config, m_maincpu, XTAL(12'000'000) / 8);
m_maincpu->set_addrmap(AS_PROGRAM, &tagteam_state::main_map);
m_maincpu->set_periodic_int(FUNC(tagteam_state::irq0_line_assert), attotime::from_hz(272/16*57)); // connected to bit 4 of vcount (basically once every 16 scanlines)
m_maincpu->set_periodic_int(FUNC(tagteam_state::irq0_line_assert), attotime::from_hz(272 / 16 * 57)); // connected to bit 4 of vcount (basically once every 16 scanlines)
M6502(config, m_audiocpu, XTAL(12'000'000)/2/6); // daughterboard gets 12mhz/2 from mainboard, but how it's divided further is a guess
M6502(config, m_audiocpu, XTAL(12'000'000) / 2 / 6); // daughterboard gets 12mhz / 2 from mainboard, but how it's divided further is a guess
m_audiocpu->set_addrmap(AS_PROGRAM, &tagteam_state::sound_map);
m_audiocpu->set_periodic_int(FUNC(tagteam_state::sound_timer_irq), attotime::from_hz(272/16*57)); // same source as maincpu irq
m_audiocpu->set_periodic_int(FUNC(tagteam_state::sound_timer_irq), attotime::from_hz(272 / 16 * 57)); // same source as maincpu IRQ
/* video hardware */
// video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(57); // measured?
screen.set_vblank_time(ATTOSECONDS_IN_USEC(3072));
@ -228,16 +459,16 @@ void tagteam_state::tagteam(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tagteam);
PALETTE(config, m_palette, FUNC(tagteam_state::tagteam_palette), 32);
PALETTE(config, m_palette, FUNC(tagteam_state::palette), 32);
/* sound hardware */
// sound hardware
SPEAKER(config, "speaker").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, M6502_IRQ_LINE);
AY8910(config, "ay1", XTAL(12'000'000)/8).add_route(ALL_OUTPUTS, "speaker", 0.25);
AY8910(config, "ay2", XTAL(12'000'000)/8).add_route(ALL_OUTPUTS, "speaker", 0.25);
AY8910(config, "ay1", XTAL(12'000'000) / 8).add_route(ALL_OUTPUTS, "speaker", 0.25);
AY8910(config, "ay2", XTAL(12'000'000) / 8).add_route(ALL_OUTPUTS, "speaker", 0.25);
DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.25); // unknown DAC
}
@ -251,7 +482,7 @@ ROM_START( bigprowr )
ROM_LOAD( "bf02.34", 0x0c000, 0x2000, CRC(a28b0a0e) SHA1(50b40048a3e2efb2afb7acfb4efde6dbc25fc009) )
ROM_LOAD( "bf03.46", 0x0e000, 0x2000, CRC(d4cf7ec7) SHA1(cfabe40adb05f6239c3e2f002a78efb50150d27d) )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for audio code */
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "bf4.8", 0x04000, 0x2000, CRC(0558e1d8) SHA1(317011c0e3a9d5f73c67d044c1fab315ff8049fb) )
ROM_LOAD( "bf5.7", 0x06000, 0x2000, CRC(c1073f24) SHA1(0337c259c10fae3067e5e0e0acf54e6d0891b29f) )
ROM_LOAD( "bf6.6", 0x08000, 0x2000, CRC(208cd081) SHA1(e5f6379e7f7bc80cdea12de7e0a2bb232bb16b5a) )
@ -259,7 +490,7 @@ ROM_START( bigprowr )
ROM_LOAD( "bf8.2", 0x0c000, 0x2000, CRC(eafe8056) SHA1(4a2d1c903e4acee962aeb0f0f18333252790f686) )
ROM_LOAD( "bf9.1", 0x0e000, 0x2000, CRC(d589ce1b) SHA1(c2aca1cc6867d4d6d6e02ac29a4c53c667bf6d89) )
ROM_REGION( 0x12000, "gfx1", 0 )
ROM_REGION( 0x12000, "gfx", 0 )
ROM_LOAD( "bf10.89", 0x00000, 0x2000, CRC(b1868746) SHA1(a3eff1b00f9ac2512d6ca81f9223723642d4f06a) )
ROM_LOAD( "bf11.94", 0x02000, 0x2000, CRC(c3fe99c1) SHA1(beb3056b37f26a52f3c0907868054b3cc3c4e3ea) )
ROM_LOAD( "bf12.103", 0x04000, 0x2000, CRC(c8717a46) SHA1(6de0238071aacb443234d9a7ef250ddfaa9dd1a8) )
@ -282,7 +513,7 @@ ROM_START( tagteam )
ROM_LOAD( "prowbf2.bin", 0x0c000, 0x2000, CRC(3d33a923) SHA1(e6402290fca72f4fa3a76e37957b9d4f5b4aeddb) )
ROM_LOAD( "prowbf3.bin", 0x0e000, 0x2000, CRC(518475d2) SHA1(b26bb0bb658bfd5ac24ee8ebb7fc11a79917aeda) )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for audio code */
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "bf4.8", 0x04000, 0x2000, CRC(0558e1d8) SHA1(317011c0e3a9d5f73c67d044c1fab315ff8049fb) )
ROM_LOAD( "bf5.7", 0x06000, 0x2000, CRC(c1073f24) SHA1(0337c259c10fae3067e5e0e0acf54e6d0891b29f) )
ROM_LOAD( "bf6.6", 0x08000, 0x2000, CRC(208cd081) SHA1(e5f6379e7f7bc80cdea12de7e0a2bb232bb16b5a) )
@ -290,7 +521,7 @@ ROM_START( tagteam )
ROM_LOAD( "bf8.2", 0x0c000, 0x2000, CRC(eafe8056) SHA1(4a2d1c903e4acee962aeb0f0f18333252790f686) )
ROM_LOAD( "bf9.1", 0x0e000, 0x2000, CRC(d589ce1b) SHA1(c2aca1cc6867d4d6d6e02ac29a4c53c667bf6d89) )
ROM_REGION( 0x12000, "gfx1", 0 )
ROM_REGION( 0x12000, "gfx", 0 )
ROM_LOAD( "prowbf10.bin", 0x00000, 0x2000, CRC(48165902) SHA1(3145fc83f17712b460a08b882677cfcac08fc272) )
ROM_LOAD( "bf11.94", 0x02000, 0x2000, CRC(c3fe99c1) SHA1(beb3056b37f26a52f3c0907868054b3cc3c4e3ea) )
ROM_LOAD( "prowbf12.bin", 0x04000, 0x2000, CRC(69de1ea2) SHA1(7b696c74e29c0bae33b386da463365e7e796c6a0) )
@ -306,6 +537,7 @@ ROM_START( tagteam )
ROM_LOAD( "fjo.25", 0x0020, 0x0020, CRC(24da2b63) SHA1(4db7e1ff1b9fd5ae4098cd7ca66cf1fa2574501a) ) // hcount related, not implemented yet
ROM_END
} // anonymous namespace
GAME( 1983, bigprowr, 0, tagteam, bigprowr, tagteam_state, empty_init, ROT270, "Technos Japan", "The Big Pro Wrestling!", MACHINE_SUPPORTS_SAVE )

View File

@ -1,71 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Steve Ellenoff, Brad Oliver
#ifndef MAME_INCLUDES_TAGTEAM_H
#define MAME_INCLUDES_TAGTEAM_H
#pragma once
#include "machine/gen_latch.h"
#include "emupal.h"
#include "tilemap.h"
class tagteam_state : public driver_device
{
public:
tagteam_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_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch"),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram")
{ }
void tagteam(machine_config &config);
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
protected:
virtual void machine_start() override;
virtual void video_start() override;
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
int m_palettebank = 0;
tilemap_t *m_bg_tilemap = nullptr;
uint8_t m_sound_nmi_mask = 0;
void irq_clear_w(uint8_t data);
void sound_nmi_mask_w(uint8_t data);
void videoram_w(offs_t offset, uint8_t data);
void colorram_w(offs_t offset, uint8_t data);
uint8_t mirrorvideoram_r(offs_t offset);
uint8_t mirrorcolorram_r(offs_t offset);
void mirrorvideoram_w(offs_t offset, uint8_t data);
void mirrorcolorram_w(offs_t offset, uint8_t data);
void control_w(uint8_t data);
void flipscreen_w(uint8_t data);
INTERRUPT_GEN_MEMBER(sound_timer_irq);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
void tagteam_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void main_map(address_map &map);
void sound_map(address_map &map);
};
#endif // MAME_INCLUDES_TAGTEAM_H

View File

@ -1,195 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Steve Ellenoff, Brad Oliver
/***************************************************************************
tagteam.c
Functions to emulate the video hardware of the machine.
***************************************************************************/
#include "emu.h"
#include "video/resnet.h"
#include "tagteam.h"
// TODO: fix or confirm resnet implementation
// schematics say emitter circuit with 47 ohm pullup and 470 ohm pulldown but this results in a bad palette
static const res_net_info tagteam_net_info =
{
RES_NET_VCC_5V | RES_NET_VBIAS_5V | RES_NET_VIN_TTL_OUT,
{
{ RES_NET_AMP_EMITTER, 4700, 0, 3, { 4700, 3300, 1500 } },
{ RES_NET_AMP_EMITTER, 4700, 0, 3, { 4700, 3300, 1500 } },
{ RES_NET_AMP_EMITTER, 4700, 0, 2, { 3300, 1500 } }
}
};
static const res_net_decode_info tagteam_decode_info =
{
1, /* single PROM per color */
0x000, 0x01f, /* start/end */
/* R G B */
{ 0x00, 0x00, 0x00 }, /* offsets */
{ 0x00, 0x03, 0x06 }, /* shifts */
{ 0x07, 0x07, 0x03 } /* masks */
};
void tagteam_state::tagteam_palette(palette_device &palette) const
{
uint8_t const *const color_prom = memregion("proms")->base();
std::vector<rgb_t> rgb;
compute_res_net_all(rgb, color_prom, tagteam_decode_info, tagteam_net_info);
palette.set_pen_colors(0x00, rgb);
}
void tagteam_state::videoram_w(offs_t offset, uint8_t data)
{
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
void tagteam_state::colorram_w(offs_t offset, uint8_t data)
{
m_colorram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
uint8_t tagteam_state::mirrorvideoram_r(offs_t offset)
{
int x,y;
/* swap x and y coordinates */
x = offset / 32;
y = offset % 32;
offset = 32 * y + x;
return m_videoram[offset];
}
uint8_t tagteam_state::mirrorcolorram_r(offs_t offset)
{
int x,y;
/* swap x and y coordinates */
x = offset / 32;
y = offset % 32;
offset = 32 * y + x;
return m_colorram[offset];
}
void tagteam_state::mirrorvideoram_w(offs_t offset, uint8_t data)
{
int x,y;
/* swap x and y coordinates */
x = offset / 32;
y = offset % 32;
offset = 32 * y + x;
videoram_w(offset,data);
}
void tagteam_state::mirrorcolorram_w(offs_t offset, uint8_t data)
{
int x,y;
/* swap x and y coordinates */
x = offset / 32;
y = offset % 32;
offset = 32 * y + x;
colorram_w(offset,data);
}
void tagteam_state::control_w(uint8_t data)
{
// d0-3: color for blank screen, applies to h/v borders too
// (not implemented yet, and tagteam doesn't have a global screen on/off bit)
// d7: palette bank
m_palettebank = (data & 0x80) >> 7;
}
void tagteam_state::flipscreen_w(uint8_t data)
{
// d0: flip screen
if (flip_screen() != (data &0x01))
{
flip_screen_set(data & 0x01);
machine().tilemap().mark_all_dirty();
}
// d6/7: coin counters
machine().bookkeeping().coin_counter_w(0, data & 0x80);
machine().bookkeeping().coin_counter_w(1, data & 0x40);
}
TILE_GET_INFO_MEMBER(tagteam_state::get_bg_tile_info)
{
int code = m_videoram[tile_index] + 256 * m_colorram[tile_index];
int color = m_palettebank << 1;
tileinfo.set(0, code, color, 0);
}
void tagteam_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tagteam_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS_FLIP_X,
8, 8, 32, 32);
save_item(NAME(m_palettebank));
}
void tagteam_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int offs;
for (offs = 0; offs < 0x20; offs += 4)
{
int spritebank = (m_videoram[offs] & 0x30) << 4;
int code = m_videoram[offs + 1] + 256 * spritebank;
int color = m_palettebank << 1 | 1;
int flipx = m_videoram[offs] & 0x04;
int flipy = m_videoram[offs] & 0x02;
int sx = 240 - m_videoram[offs + 3];
int sy = 240 - m_videoram[offs + 2];
if (!(m_videoram[offs] & 0x01)) continue;
if (flip_screen())
{
sx = 240 - sx;
sy = 240 - sy;
flipx = !flipx;
flipy = !flipy;
}
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
code, color,
flipx, flipy,
sx, sy, 0);
/* Wrap around */
code = m_videoram[offs + 0x20] + 256 * spritebank;
color = m_palettebank;
sy += (flip_screen() ? -256 : 256);
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
code, color,
flipx, flipy,
sx, sy, 0);
}
}
uint32_t tagteam_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect);
return 0;
}