summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2022-08-30 18:03:35 +0200
committer Ivan Vangelista <mesgnet@yahoo.it>2022-08-30 18:03:35 +0200
commit03355075d81672b2c103a674e03cc8b6ec20c832 (patch)
treef116436277897aaea7c59a1ed88b507376358ed5
parent42333c97022280adf9c85498d197ad2e52684799 (diff)
taito/groundfx.cpp, taito/pitnrun.cpp, taito/rollrace.cpp, taito/ssrj.cpp, taito/volfied.cpp, taito/warriorb.cpp: consolidated drivers in single files, minor cleanups
-rw-r--r--src/mame/taito/groundfx.cpp417
-rw-r--r--src/mame/taito/groundfx.h72
-rw-r--r--src/mame/taito/groundfx_v.cpp261
-rw-r--r--src/mame/taito/pitnrun.cpp663
-rw-r--r--src/mame/taito/pitnrun.h103
-rw-r--r--src/mame/taito/pitnrun_m.cpp162
-rw-r--r--src/mame/taito/pitnrun_v.cpp276
-rw-r--r--src/mame/taito/rollrace.cpp493
-rw-r--r--src/mame/taito/rollrace.h81
-rw-r--r--src/mame/taito/rollrace_v.cpp212
-rw-r--r--src/mame/taito/ssrj.cpp370
-rw-r--r--src/mame/taito/ssrj.h68
-rw-r--r--src/mame/taito/ssrj_v.cpp293
-rw-r--r--src/mame/taito/volfied.cpp313
-rw-r--r--src/mame/taito/volfied.h72
-rw-r--r--src/mame/taito/volfied_v.cpp129
-rw-r--r--src/mame/taito/warriorb.cpp444
-rw-r--r--src/mame/taito/warriorb.h75
-rw-r--r--src/mame/taito/warriorb_v.cpp108
19 files changed, 2269 insertions, 2343 deletions
diff --git a/src/mame/taito/groundfx.cpp b/src/mame/taito/groundfx.cpp
index 73d33da7c61..2c0860b91cb 100644
--- a/src/mame/taito/groundfx.cpp
+++ b/src/mame/taito/groundfx.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:Bryan McPhail, David Graves
+// copyright-holders: Bryan McPhail, David Graves
+
/***************************************************************************
Ground Effects / Super Ground FX (c) 1993 Taito
@@ -56,7 +57,7 @@
Ground Effects is effectively a 30Hz game - though the vblank interrupts
still come in at 60Hz, the game uses a hardware frame counter to limit
itself to 30Hz (it only updates things like the video registers every
- other vblank). There isn't enough cpu power in a 20MHz 68020 to run
+ other vblank). There isn't enough CPU power in a 20MHz 68020 to run
this game at 60Hz.
Ground Effects has a network mode - probably uses IRQ 6 and the unknown
@@ -65,18 +66,350 @@
***************************************************************************/
#include "emu.h"
-#include "groundfx.h"
+
#include "taito_en.h"
#include "taitoio.h"
+#include "tc0100scn.h"
+#include "tc0480scp.h"
#include "cpu/m68000/m68000.h"
#include "machine/adc0808.h"
#include "machine/eepromser.h"
#include "sound/es5506.h"
+
+#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+namespace {
+
+class groundfx_state : public driver_device
+{
+public:
+ groundfx_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_ram(*this, "ram"),
+ m_spriteram(*this, "spriteram"),
+ m_maincpu(*this, "maincpu"),
+ m_tc0620scc(*this, "tc0620scc"),
+ m_tc0480scp(*this, "tc0480scp"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette"),
+ m_spritemap(*this, "spritemap")
+ { }
+
+ void groundfx(machine_config &config);
+ void init_groundfx();
+
+protected:
+ virtual void video_start() override;
+
+private:
+ required_shared_ptr<u32> m_ram;
+ required_shared_ptr<u32> m_spriteram;
+
+ required_device<cpu_device> m_maincpu;
+ required_device<tc0620scc_device> m_tc0620scc;
+ required_device<tc0480scp_device> m_tc0480scp;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+ required_region_ptr<u16> m_spritemap;
+
+ struct gfx_tempsprite
+ {
+ u8 gfx = 0U;
+ u32 code = 0U, color = 0U;
+ bool flipx = false, flipy = false;
+ int x = 0, y = 0;
+ int zoomx = 0, zoomy = 0;
+ u8 pri = 0;
+ };
+
+ u16 m_frame_counter = 0U;
+ u8 m_port_sel = 0U;
+ std::unique_ptr<gfx_tempsprite[]> m_spritelist{};
+ u16 m_rotate_ctrl[8]{};
+ rectangle m_hack_cliprect{};
+
+ void rotate_control_w(offs_t offset, u16 data);
+ void motor_control_w(u32 data);
+ u32 irq_speedup_r();
+ DECLARE_READ_LINE_MEMBER(frame_counter_r);
+ void coin_word_w(u8 data);
+ u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ INTERRUPT_GEN_MEMBER(interrupt);
+ void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int do_hack, int x_offs, int y_offs);
+
+ void prg_map(address_map &map);
+};
+
+
+// video
+
+/******************************************************************/
+
+void groundfx_state::video_start()
+{
+ m_spritelist = std::make_unique<gfx_tempsprite[]>(0x4000);
+
+ save_item(NAME(m_frame_counter));
+ save_item(NAME(m_port_sel));
+ save_item(NAME(m_rotate_ctrl));
+
+ // Hack
+ m_hack_cliprect.set(69, 250, 24 + 5, 24 + 44);
+}
+
+/***************************************************************
+ SPRITE DRAW ROUTINES
+
+We draw a series of small tiles ("chunks") together to
+create each big sprite. The spritemap ROM provides the lookup
+table for this. The game hardware looks up 16x16 sprite chunks
+from the spritemap ROM, creating a 64x64 sprite like this:
+
+ 0 1 2 3
+ 4 5 6 7
+ 8 9 10 11
+ 12 13 14 15
+
+(where the number is the word offset into the spritemap ROM).
+It can also create 32x32 sprites.
+
+NB: unused portions of the spritemap ROM contain hex FF's.
+It is a useful coding check to warn in the log if these
+are being accessed. [They can be inadvertently while
+spriteram is being tested, take no notice of that.]
+
+Heavy use is made of sprite zooming.
+
+ ***
+
+ Sprite table layout (4 long words per entry)
+
+ ------------------------------------------
+ 0 | ........ x....... ........ ........ | Flip X
+ 0 | ........ .xxxxxxx ........ ........ | ZoomX
+ 0 | ........ ........ .xxxxxxx xxxxxxxx | Sprite Tile
+ | |
+ 2 | ........ ....xx.. ........ ........ | Sprite/tile priority [*]
+ 2 | ........ ......xx xxxxxx.. ........ | Palette bank
+ 2 | ........ ........ ......xx xxxxxxxx | X position
+ | |
+ 3 | ........ .....x.. ........ ........ | Sprite size (0=32x32, 1=64x64)
+ 3 | ........ ......x. ........ ........ | Flip Y
+ 3 | ........ .......x xxxxxx.. ........ | ZoomY
+ 3 | ........ ........ ......xx xxxxxxxx | Y position
+ ------------------------------------------
+
+ [* 00=over BG0, 01=BG1, 10=BG2, 11=BG3 ]
+ [or 00=over BG1, 01=BG2, 10=BG3, 11=BG3 ]
+
+***************************************************************/
+
+void groundfx_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int do_hack, int x_offs, int y_offs)
+{
+ int sprites_flipscreen = 0;
+ static const u32 primasks[4] = {0xffff, 0xfffc, 0xfff0, 0xff00 };
+
+ /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list
+ while processing sprite ram and then draw them all at the end */
+ struct gfx_tempsprite *sprite_ptr = m_spritelist.get();
+
+ for (int offs = (m_spriteram.bytes() / 4 - 4); offs >= 0; offs -= 4)
+ {
+ u32 data = m_spriteram[offs+0];
+ int flipx = (data & 0x00800000) >> 23;
+ int zoomx = (data & 0x007f0000) >> 16;
+ const u32 tilenum = (data & 0x00007fff);
+
+ data = m_spriteram[offs+2];
+ const int priority = (data & 0x000c0000) >> 18;
+ u32 color = (data & 0x0003fc00) >> 10;
+ int x = (data & 0x000003ff);
+
+ data = m_spriteram[offs+3];
+ const int dblsize = (data & 0x00040000) >> 18;
+ int flipy = (data & 0x00020000) >> 17;
+ int zoomy = (data & 0x0001fc00) >> 10;
+ int y = (data & 0x000003ff);
+
+// color |= (0x100 + (priority << 6)); // priority bits select color bank
+ color /= 2; // as sprites are 5bpp
+ flipy = !flipy;
+ y = (-y & 0x3ff);
+
+ if (!tilenum) continue;
+
+ flipy = !flipy;
+ zoomx += 1;
+ zoomy += 1;
+
+ y += y_offs;
+
+ // treat coords as signed
+ if (x > 0x340) x -= 0x400;
+ if (y > 0x340) y -= 0x400;
+
+ x -= x_offs;
+
+ const int dimension = ((dblsize * 2) + 2); // 2 or 4
+ const int total_chunks = ((dblsize * 3) + 1) << 2; // 4 or 16
+ const int map_offset = tilenum << 2;
+
+ {
+ for (int sprite_chunk = 0; sprite_chunk < total_chunks; sprite_chunk++)
+ {
+ const int j = sprite_chunk / dimension; // rows
+ const int k = sprite_chunk % dimension; // chunks per row
+
+ int px = k;
+ int py = j;
+ // pick tiles back to front for x and y flips
+ if (flipx) px = dimension - 1 - k;
+ if (flipy) py = dimension - 1 - j;
+
+ const u16 code = m_spritemap[map_offset + px + (py << (dblsize + 1))];
+
+ if (code == 0xffff)
+ {
+ continue;
+ }
+
+ int curx = x + ((k * zoomx) / dimension);
+ int cury = y + ((j * zoomy) / dimension);
+
+ const int zx = x + (((k + 1) * zoomx) / dimension) - curx;
+ const int zy = y + (((j + 1) * zoomy) / dimension) - cury;
+
+ if (sprites_flipscreen)
+ {
+ /* -zx/y is there to fix zoomed sprite coords in screenflip.
+ drawgfxzoom does not know to draw from flip-side of sprites when
+ screen is flipped; so we must correct the coords ourselves. */
+
+ curx = 320 - curx - zx;
+ cury = 256 - cury - zy;
+ flipx = !flipx;
+ flipy = !flipy;
+ }
+
+ sprite_ptr->gfx = 0;
+ sprite_ptr->code = code;
+ sprite_ptr->color = color;
+ sprite_ptr->flipx = !flipx;
+ sprite_ptr->flipy = flipy;
+ sprite_ptr->x = curx;
+ sprite_ptr->y = cury;
+ sprite_ptr->zoomx = zx << 12;
+ sprite_ptr->zoomy = zy << 12;
+ sprite_ptr->pri = priority;
+ sprite_ptr++;
+ }
+ }
+ }
+
+ // this happens only if primsks != nullptr
+ while (sprite_ptr != m_spritelist.get())
+ {
+ const rectangle *clipper;
+
+ sprite_ptr--;
+
+ if (do_hack && sprite_ptr->pri == 1 && sprite_ptr->y < 100)
+ clipper = &m_hack_cliprect;
+ else
+ clipper = &cliprect;
+
+ m_gfxdecode->gfx(sprite_ptr->gfx)->prio_zoom_transpen(bitmap, *clipper,
+ sprite_ptr->code,
+ sprite_ptr->color,
+ sprite_ptr->flipx, sprite_ptr->flipy,
+ sprite_ptr->x, sprite_ptr->y,
+ sprite_ptr->zoomx, sprite_ptr->zoomy,
+ screen.priority(), primasks[sprite_ptr->pri], 0);
+ }
+}
+
+/**************************************************************
+ SCREEN REFRESH
+**************************************************************/
+
+u32 groundfx_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ u8 layer[5];
+ u8 scclayer[3];
+
+ m_tc0620scc->tilemap_update();
+ m_tc0480scp->tilemap_update();
+
+ const u16 priority = m_tc0480scp->get_bg_priority();
+
+ layer[0] = (priority & 0xf000) >> 12; // tells us which bg layer is bottom
+ layer[1] = (priority & 0x0f00) >> 8;
+ layer[2] = (priority & 0x00f0) >> 4;
+ layer[3] = (priority & 0x000f) >> 0; // tells us which is top
+ layer[4] = 4; // text layer always over bg layers
+
+ scclayer[0] = m_tc0620scc->bottomlayer();
+ scclayer[1] = scclayer[0] ^ 1;
+ scclayer[2] = 2;
+
+ screen.priority().fill(0, cliprect);
+ bitmap.fill(0, cliprect); // wrong color?
+
+ m_tc0620scc->tilemap_draw(screen, bitmap, cliprect, scclayer[0], TILEMAP_DRAW_OPAQUE, 0);
+ m_tc0620scc->tilemap_draw(screen, bitmap, cliprect, scclayer[1], 0, 0);
+
+ /* BIG HACK!
+
+ The rear view mirror is a big priority trick - the text
+ layer of TC0100SCN is used as a stencil to display
+ the bottom layer of TC0480SCP and a particular sprite
+ priority. These never appear outside of the stencil.
+
+ I'm not sure how the game turns this effect on/off
+ (the 480 layer is used normally in the frontend
+ of the game).
+
+ I haven't implemented it properly yet, instead I'm
+ doing a hacky cliprect around the rearview and drawing
+ its contents the usual way.
+
+ */
+ if (m_tc0620scc->ram_r(0x4090 / 2) || m_tc0620scc->ram_r(0x4092 / 2) ||
+ ((m_tc0480scp->ram_r(0x20 / 2) == 0x24) && (m_tc0480scp->ram_r(0x22 / 2) == 0x0866))) // Anything in text layer - really stupid hack
+ {
+ m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 2);
+ m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 4);
+ m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[3], 0, 8);
+
+ //m_tc0620scc->tilemap_draw(screen, bitmap, cliprect, 0, scclayer[2], 0, 0);
+
+ if ((m_tc0480scp->ram_r(0x20 / 2) != 0x24) && (m_tc0480scp->ram_r(0x22 / 2) != 0x0866)) // Stupid hack for start of race
+ m_tc0480scp->tilemap_draw(screen, bitmap, m_hack_cliprect, layer[0], 0, 0);
+ draw_sprites(screen, bitmap, cliprect, 1, 44, -574);
+ }
+ else
+ {
+ m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[0], 0, 1);
+ m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 2);
+ m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 4);
+ m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[3], 0, 8);
+
+ m_tc0620scc->tilemap_draw(screen, bitmap, cliprect, scclayer[2], 0, 0);
+
+ draw_sprites(screen, bitmap, cliprect, 0, 44, -574);
+ }
+
+ m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[4], 0, 0); // TC0480SCP text layer
+ return 0;
+}
+
+
+// machine
+
/**********************************************************
GAME INPUTS
**********************************************************/
@@ -88,13 +421,13 @@ READ_LINE_MEMBER(groundfx_state::frame_counter_r)
void groundfx_state::coin_word_w(u8 data)
{
- machine().bookkeeping().coin_lockout_w(0,~data & 0x01);
- machine().bookkeeping().coin_lockout_w(1,~data & 0x02);
+ machine().bookkeeping().coin_lockout_w(0, ~data & 0x01);
+ machine().bookkeeping().coin_lockout_w(1, ~data & 0x02);
machine().bookkeeping().coin_counter_w(0, data & 0x04);
machine().bookkeeping().coin_counter_w(1, data & 0x08);
}
-void groundfx_state::rotate_control_w(offs_t offset, u16 data) /* only a guess that it's rotation */
+void groundfx_state::rotate_control_w(offs_t offset, u16 data) // only a guess that it's rotation
{
if (offset & 1)
{
@@ -110,7 +443,7 @@ void groundfx_state::rotate_control_w(offs_t offset, u16 data) /* only a guess t
void groundfx_state::motor_control_w(u32 data)
{
/*
- Standard value poked is 0x00910200 (we ignore lsb and msb
+ Standard value poked is 0x00910200 (we ignore LSB and MSB
which seem to be always zero)
0x0, 0x8000 and 0x9100 are written at startup
@@ -128,28 +461,28 @@ void groundfx_state::motor_control_w(u32 data)
MEMORY STRUCTURES
***********************************************************/
-void groundfx_state::groundfx_map(address_map &map)
+void groundfx_state::prg_map(address_map &map)
{
map(0x000000, 0x1fffff).rom();
- map(0x200000, 0x21ffff).ram().share("ram"); /* main CPUA ram */
- map(0x300000, 0x303fff).ram().share("spriteram"); /* sprite ram */
- map(0x400000, 0x400003).w(FUNC(groundfx_state::motor_control_w)); /* gun vibration */
+ map(0x200000, 0x21ffff).ram().share(m_ram); // main CPUA RAM
+ map(0x300000, 0x303fff).ram().share(m_spriteram);
+ map(0x400000, 0x400003).w(FUNC(groundfx_state::motor_control_w)); // gun vibration
map(0x500000, 0x500007).rw("tc0510nio", FUNC(tc0510nio_device::read), FUNC(tc0510nio_device::write));
map(0x600000, 0x600007).rw("adc", FUNC(adc0808_device::data_r), FUNC(adc0808_device::address_offset_start_w)).umask32(0xffffffff);
map(0x700000, 0x7007ff).rw("taito_en:dpram", FUNC(mb8421_device::left_r), FUNC(mb8421_device::left_w));
- map(0x800000, 0x80ffff).rw(m_tc0480scp, FUNC(tc0480scp_device::ram_r), FUNC(tc0480scp_device::ram_w)); /* tilemaps */
+ map(0x800000, 0x80ffff).rw(m_tc0480scp, FUNC(tc0480scp_device::ram_r), FUNC(tc0480scp_device::ram_w)); // tilemaps
map(0x830000, 0x83002f).rw(m_tc0480scp, FUNC(tc0480scp_device::ctrl_r), FUNC(tc0480scp_device::ctrl_w)); // debugging
- map(0x900000, 0x90ffff).rw(m_tc0620scc, FUNC(tc0620scc_device::ram_r), FUNC(tc0620scc_device::ram_w)); /* 6bpp tilemaps */
+ map(0x900000, 0x90ffff).rw(m_tc0620scc, FUNC(tc0620scc_device::ram_r), FUNC(tc0620scc_device::ram_w)); // 6bpp tilemaps
map(0x920000, 0x92000f).rw(m_tc0620scc, FUNC(tc0620scc_device::ctrl_r), FUNC(tc0620scc_device::ctrl_w));
map(0xa00000, 0xa0ffff).ram().w(m_palette, FUNC(palette_device::write32)).share("palette");
map(0xb00000, 0xb003ff).ram(); // ?? single bytes, blending ??
- map(0xc00000, 0xc00007).nopr(); /* Network? */
- map(0xd00000, 0xd00003).w(FUNC(groundfx_state::rotate_control_w)); /* perhaps port based rotate control? */
- /* f00000 is seat control? */
+ map(0xc00000, 0xc00007).nopr(); // Network?
+ map(0xd00000, 0xd00003).w(FUNC(groundfx_state::rotate_control_w)); // perhaps port based rotate control?
+ // f00000 is seat control?
}
/***********************************************************
- INPUT PORTS (dips in eprom)
+ INPUT PORTS (dips in EPROM)
***********************************************************/
static INPUT_PORTS_START( groundfx )
@@ -186,13 +519,13 @@ INPUT_PORTS_END
static const gfx_layout tile16x16_layout =
{
- 16,16, /* 16*16 sprites */
+ 16,16, // 16*16 sprites
RGN_FRAC(1,5),
- 5, /* 5 bits per pixel */
+ 5, // 5 bits per pixel
{ 0, RGN_FRAC(1,5), RGN_FRAC(2,5), RGN_FRAC(3,5), RGN_FRAC(4,5) },
{ STEP16(0,1) },
{ STEP16(0,16) },
- 16*16 /* every sprite takes 128 consecutive bytes */
+ 16*16 // every sprite takes 128 consecutive bytes
};
static GFXDECODE_START( gfx_groundfx )
@@ -212,17 +545,17 @@ INTERRUPT_GEN_MEMBER(groundfx_state::interrupt)
void groundfx_state::groundfx(machine_config &config)
{
- /* basic machine hardware */
- M68EC020(config, m_maincpu, XTAL(40'000'000) / 2); /* 20MHz - verified */
- m_maincpu->set_addrmap(AS_PROGRAM, &groundfx_state::groundfx_map);
+ // basic machine hardware
+ M68EC020(config, m_maincpu, XTAL(40'000'000) / 2); // 20MHz - verified
+ m_maincpu->set_addrmap(AS_PROGRAM, &groundfx_state::prg_map);
m_maincpu->set_vblank_int("screen", FUNC(groundfx_state::interrupt));
EEPROM_93C46_16BIT(config, "eeprom");
- adc0809_device &adc(ADC0809(config, "adc", 500000)); // unknown clock
+ adc0809_device &adc(ADC0809(config, "adc", 500'000)); // unknown clock
adc.eoc_ff_callback().set_inputline("maincpu", 5);
adc.in_callback<0>().set_constant(0); // unknown
- adc.in_callback<1>().set_constant(0); // unknown (used to be labeled 'volume' - but doesn't seem to affect it
+ adc.in_callback<1>().set_constant(0); // unknown (used to be labeled 'volume' - but doesn't seem to affect it)
adc.in_callback<2>().set_ioport("WHEEL");
adc.in_callback<3>().set_ioport("ACCEL");
@@ -236,7 +569,7 @@ void groundfx_state::groundfx(machine_config &config)
tc0510nio.write_4_callback().set(FUNC(groundfx_state::coin_word_w));
tc0510nio.read_7_callback().set_ioport("SYSTEM");
- /* 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(0));
@@ -257,7 +590,7 @@ void groundfx_state::groundfx(machine_config &config)
m_tc0480scp->set_offsets(0x24, 0);
m_tc0480scp->set_offsets_tx(-1, 0);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
@@ -271,7 +604,7 @@ void groundfx_state::groundfx(machine_config &config)
***************************************************************************/
ROM_START( groundfx )
- ROM_REGION( 0x200000, "maincpu", 0 ) /* 2048K for 68020 code (CPU A) */
+ ROM_REGION( 0x200000, "maincpu", 0 ) // 68020 code (CPU A)
ROM_LOAD32_BYTE( "d51-24.79", 0x00000, 0x80000, CRC(5caaa031) SHA1(03e727e26df701e3f5e16c5f933d5b29a528945a) )
ROM_LOAD32_BYTE( "d51-23.61", 0x00001, 0x80000, CRC(462e3c9b) SHA1(7f116ee755748497b911868a948d3e3b5134e475) )
ROM_LOAD32_BYTE( "d51-22.77", 0x00002, 0x80000, CRC(b6b04d88) SHA1(58685ee8fd788dcbfe318f1e3c06d93e2128034c) )
@@ -281,29 +614,29 @@ ROM_START( groundfx )
ROM_LOAD16_BYTE( "d51-29.54", 0x100000, 0x40000, CRC(4b64f41d) SHA1(040427668d13f7320d23805098d6d0e1aa8d121e) )
ROM_LOAD16_BYTE( "d51-30.56", 0x100001, 0x40000, CRC(45f339fe) SHA1(cc7adfb2b86070f5bb426542e3b7ed2a50b3c39e) )
- ROM_REGION( 0x400000, "tc0480scp", 0 )
- ROM_LOAD32_WORD( "d51-08.35", 0x000000, 0x200000, CRC(835b7a0f) SHA1(0131fceabd73b0045b5d4ae0bb2f03efdd407962) ) /* SCR 16x16 tiles */
+ ROM_REGION( 0x400000, "tc0480scp", 0 ) // SCR 16x16 tiles
+ ROM_LOAD32_WORD( "d51-08.35", 0x000000, 0x200000, CRC(835b7a0f) SHA1(0131fceabd73b0045b5d4ae0bb2f03efdd407962) )
ROM_LOAD32_WORD( "d51-09.34", 0x000002, 0x200000, CRC(6dabd83d) SHA1(3dbd7ea36b9900faa6420af1f1600efe295db74c) )
- ROM_REGION( 0xa00000, "sprites", 0 )
- ROM_LOAD16_WORD_SWAP( "d51-03.47", 0x000000, 0x200000, CRC(629a5c99) SHA1(cfc1c0b07ecefd6eddb83edcbcf710e8b8de19e4) ) /* OBJ 16x16 tiles */
+ ROM_REGION( 0xa00000, "sprites", 0 ) // OBJ 16x16 tiles
+ ROM_LOAD16_WORD_SWAP( "d51-03.47", 0x000000, 0x200000, CRC(629a5c99) SHA1(cfc1c0b07ecefd6eddb83edcbcf710e8b8de19e4) )
ROM_LOAD16_WORD_SWAP( "d51-04.48", 0x200000, 0x200000, CRC(f49b14b7) SHA1(31129771159c1295a074c8311344ece525302289) )
ROM_LOAD16_WORD_SWAP( "d51-05.49", 0x400000, 0x200000, CRC(3a2e2cbf) SHA1(ed2c1ca9211b1d70b4767a54e08263a3e4867199) )
ROM_LOAD16_WORD_SWAP( "d51-06.50", 0x600000, 0x200000, CRC(d33ce2a0) SHA1(92c4504344672ea798cd6dd34f4b46848bf9f82b) )
ROM_LOAD16_WORD_SWAP( "d51-07.51", 0x800000, 0x200000, CRC(24b2f97d) SHA1(6980e67b435d189ce897c0301e0411763410ab47) )
- ROM_REGION( 0x200000, "tc0620scc", 0 )
- ROM_LOAD16_BYTE( "d51-10.95", 0x000001, 0x100000, CRC(d5910604) SHA1(8efe13884cfdef208394ddfe19f43eb1b9f78ff3) ) /* SCC 8x8 tiles, 4bpp */
+ ROM_REGION( 0x200000, "tc0620scc", 0 ) // SCC 8x8 tiles, 4bpp
+ ROM_LOAD16_BYTE( "d51-10.95", 0x000001, 0x100000, CRC(d5910604) SHA1(8efe13884cfdef208394ddfe19f43eb1b9f78ff3) )
ROM_LOAD16_BYTE( "d51-11.96", 0x000000, 0x100000, CRC(fee5f5c6) SHA1(1be88747f9c71c348dd61a8f0040007df3a3e6a6) )
- ROM_REGION( 0x100000, "tc0620scc:hi_gfx", 0 )
- ROM_LOAD ( "d51-12.97", 0x000000, 0x100000, CRC(d630287b) SHA1(2fa09e1821b7280d193ca9a2a270759c3c3189d1) ) /* SCC 8x8 tiles, 2bpp */
+ ROM_REGION( 0x100000, "tc0620scc:hi_gfx", 0 ) // SCC 8x8 tiles, 2bpp
+ ROM_LOAD ( "d51-12.97", 0x000000, 0x100000, CRC(d630287b) SHA1(2fa09e1821b7280d193ca9a2a270759c3c3189d1) )
- ROM_REGION16_LE( 0x80000, "spritemap", 0 )
- ROM_LOAD16_WORD( "d51-13.7", 0x00000, 0x80000, CRC(36921b8b) SHA1(2130120f78a3b984618a53054fc937cf727177b9) ) /* STY, spritemap */
+ ROM_REGION16_LE( 0x80000, "spritemap", 0 ) // STY
+ ROM_LOAD16_WORD( "d51-13.7", 0x00000, 0x80000, CRC(36921b8b) SHA1(2130120f78a3b984618a53054fc937cf727177b9) )
ROM_REGION16_BE( 0x1000000, "taito_en:ensoniq", ROMREGION_ERASE00 )
- ROM_LOAD16_BYTE( "d51-01.73", 0x000000, 0x200000, CRC(92f09155) SHA1(8015e1997818bb480174394eb43840bf26679bcf) ) /* Ensoniq samples */
+ ROM_LOAD16_BYTE( "d51-01.73", 0x000000, 0x200000, CRC(92f09155) SHA1(8015e1997818bb480174394eb43840bf26679bcf) )
ROM_LOAD16_BYTE( "d51-02.74", 0xc00000, 0x200000, CRC(20a9428f) SHA1(c9033d02a49c72f704808f5f899101617d5814e5) )
ROM_REGION16_BE( 0x80, "eeprom", 0 )
@@ -333,9 +666,11 @@ u32 groundfx_state::irq_speedup_r()
void groundfx_state::init_groundfx()
{
- /* Speedup handlers */
+ // Speedup handlers
m_maincpu->space(AS_PROGRAM).install_read_handler(0x20b574, 0x20b577, read32smo_delegate(*this, FUNC(groundfx_state::irq_speedup_r)));
}
+} // anonymous namespace
+
-GAME( 1992, groundfx, 0, groundfx, groundfx, groundfx_state, init_groundfx, ROT0, "Taito Corporation", "Ground Effects / Super Ground Effects (Japan)", MACHINE_NODEVICE_LAN )
+GAME( 1992, groundfx, 0, groundfx, groundfx, groundfx_state, init_groundfx, ROT0, "Taito Corporation", "Ground Effects / Super Ground Effects (Japan)", MACHINE_NODEVICE_LAN | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/taito/groundfx.h b/src/mame/taito/groundfx.h
deleted file mode 100644
index 10f4e9ac63e..00000000000
--- a/src/mame/taito/groundfx.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Bryan McPhail, David Graves
-#ifndef MAME_INCLUDES_GROUNDFX_H
-#define MAME_INCLUDES_GROUNDFX_H
-
-#pragma once
-
-#include "tc0100scn.h"
-#include "tc0480scp.h"
-#include "emupal.h"
-
-struct gfx_tempsprite
-{
- u8 gfx = 0U;
- u32 code = 0U, color = 0U;
- bool flipx = false, flipy = false;
- int x = 0, y = 0;
- int zoomx = 0, zoomy = 0;
- int pri = 0;
-};
-
-class groundfx_state : public driver_device
-{
-public:
- groundfx_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_ram(*this, "ram"),
- m_spriteram(*this, "spriteram"),
- m_maincpu(*this, "maincpu"),
- m_tc0620scc(*this, "tc0620scc"),
- m_tc0480scp(*this, "tc0480scp"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
- m_spritemap(*this, "spritemap")
- { }
-
- void groundfx(machine_config &config);
- void init_groundfx();
-
-protected:
- virtual void video_start() override;
-
-private:
- required_shared_ptr<u32> m_ram;
- required_shared_ptr<u32> m_spriteram;
-
- required_device<cpu_device> m_maincpu;
- required_device<tc0620scc_device> m_tc0620scc;
- required_device<tc0480scp_device> m_tc0480scp;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
- required_region_ptr<u16> m_spritemap;
-
- u16 m_frame_counter = 0U;
- u16 m_port_sel = 0U;
- std::unique_ptr<gfx_tempsprite[]> m_spritelist{};
- u16 m_rotate_ctrl[8]{};
- rectangle m_hack_cliprect{};
-
- void rotate_control_w(offs_t offset, u16 data);
- void motor_control_w(u32 data);
- u32 irq_speedup_r();
- DECLARE_READ_LINE_MEMBER(frame_counter_r);
- void coin_word_w(u8 data);
- u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- INTERRUPT_GEN_MEMBER(interrupt);
- void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,int do_hack,int x_offs,int y_offs);
-
- void groundfx_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_GROUNDFX_H
diff --git a/src/mame/taito/groundfx_v.cpp b/src/mame/taito/groundfx_v.cpp
deleted file mode 100644
index 3f6ba5f6ce9..00000000000
--- a/src/mame/taito/groundfx_v.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Bryan McPhail, David Graves
-#include "emu.h"
-#include "groundfx.h"
-#include "screen.h"
-
-/******************************************************************/
-
-void groundfx_state::video_start()
-{
- m_spritelist = std::make_unique<gfx_tempsprite[]>(0x4000);
-
- /* Hack */
- m_hack_cliprect.set(69, 250, 24 + 5, 24 + 44);
-}
-
-/***************************************************************
- SPRITE DRAW ROUTINES
-
-We draw a series of small tiles ("chunks") together to
-create each big sprite. The spritemap rom provides the lookup
-table for this. The game hardware looks up 16x16 sprite chunks
-from the spritemap rom, creating a 64x64 sprite like this:
-
- 0 1 2 3
- 4 5 6 7
- 8 9 10 11
- 12 13 14 15
-
-(where the number is the word offset into the spritemap rom).
-It can also create 32x32 sprites.
-
-NB: unused portions of the spritemap rom contain hex FF's.
-It is a useful coding check to warn in the log if these
-are being accessed. [They can be inadvertently while
-spriteram is being tested, take no notice of that.]
-
-Heavy use is made of sprite zooming.
-
- ***
-
- Sprite table layout (4 long words per entry)
-
- ------------------------------------------
- 0 | ........ x....... ........ ........ | Flip X
- 0 | ........ .xxxxxxx ........ ........ | ZoomX
- 0 | ........ ........ .xxxxxxx xxxxxxxx | Sprite Tile
- | |
- 2 | ........ ....xx.. ........ ........ | Sprite/tile priority [*]
- 2 | ........ ......xx xxxxxx.. ........ | Palette bank
- 2 | ........ ........ ......xx xxxxxxxx | X position
- | |
- 3 | ........ .....x.. ........ ........ | Sprite size (0=32x32, 1=64x64)
- 3 | ........ ......x. ........ ........ | Flip Y
- 3 | ........ .......x xxxxxx.. ........ | ZoomY
- 3 | ........ ........ ......xx xxxxxxxx | Y position
- ------------------------------------------
-
- [* 00=over BG0, 01=BG1, 10=BG2, 11=BG3 ]
- [or 00=over BG1, 01=BG2, 10=BG3, 11=BG3 ]
-
-***************************************************************/
-
-void groundfx_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,int do_hack,int x_offs,int y_offs)
-{
- int sprites_flipscreen = 0;
- static const u32 primasks[4] = {0xffff, 0xfffc, 0xfff0, 0xff00 };
-
- /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list
- while processing sprite ram and then draw them all at the end */
- struct gfx_tempsprite *sprite_ptr = m_spritelist.get();
-
- for (int offs = (m_spriteram.bytes() / 4 - 4); offs >= 0; offs -= 4)
- {
- u32 data = m_spriteram[offs+0];
- int flipx = (data & 0x00800000) >> 23;
- int zoomx = (data & 0x007f0000) >> 16;
- const u32 tilenum = (data & 0x00007fff);
-
- data = m_spriteram[offs+2];
- const int priority = (data & 0x000c0000) >> 18;
- u32 color = (data & 0x0003fc00) >> 10;
- int x = (data & 0x000003ff);
-
- data = m_spriteram[offs+3];
- const int dblsize = (data & 0x00040000) >> 18;
- int flipy = (data & 0x00020000) >> 17;
- int zoomy = (data & 0x0001fc00) >> 10;
- int y = (data & 0x000003ff);
-
-// color |= (0x100 + (priority << 6)); /* priority bits select color bank */
- color /= 2; /* as sprites are 5bpp */
- flipy = !flipy;
- y = (-y & 0x3ff);
-
- if (!tilenum) continue;
-
- flipy = !flipy;
- zoomx += 1;
- zoomy += 1;
-
- y += y_offs;
-
- /* treat coords as signed */
- if (x>0x340) x -= 0x400;
- if (y>0x340) y -= 0x400;
-
- x -= x_offs;
-
- const int dimension = ((dblsize*2) + 2); // 2 or 4
- const int total_chunks = ((dblsize*3) + 1) << 2; // 4 or 16
- const int map_offset = tilenum << 2;
-
- {
- for (int sprite_chunk = 0; sprite_chunk < total_chunks; sprite_chunk++)
- {
- const int j = sprite_chunk / dimension; /* rows */
- const int k = sprite_chunk % dimension; /* chunks per row */
-
- int px = k;
- int py = j;
- /* pick tiles back to front for x and y flips */
- if (flipx) px = dimension-1-k;
- if (flipy) py = dimension-1-j;
-
- const u16 code = m_spritemap[map_offset + px + (py << (dblsize + 1))];
-
- if (code==0xffff)
- {
- continue;
- }
-
- int curx = x + ((k * zoomx) / dimension);
- int cury = y + ((j * zoomy) / dimension);
-
- const int zx = x + (((k + 1) * zoomx) / dimension) - curx;
- const int zy = y + (((j + 1) * zoomy) / dimension) - cury;
-
- if (sprites_flipscreen)
- {
- /* -zx/y is there to fix zoomed sprite coords in screenflip.
- drawgfxzoom does not know to draw from flip-side of sprites when
- screen is flipped; so we must correct the coords ourselves. */
-
- curx = 320 - curx - zx;
- cury = 256 - cury - zy;
- flipx = !flipx;
- flipy = !flipy;
- }
-
- sprite_ptr->gfx = 0;
- sprite_ptr->code = code;
- sprite_ptr->color = color;
- sprite_ptr->flipx = !flipx;
- sprite_ptr->flipy = flipy;
- sprite_ptr->x = curx;
- sprite_ptr->y = cury;
- sprite_ptr->zoomx = zx << 12;
- sprite_ptr->zoomy = zy << 12;
- sprite_ptr->pri = priority;
- sprite_ptr++;
- }
- }
- }
-
- /* this happens only if primsks != nullptr */
- while (sprite_ptr != m_spritelist.get())
- {
- const rectangle *clipper;
-
- sprite_ptr--;
-
- if (do_hack && sprite_ptr->pri == 1 && sprite_ptr->y < 100)
- clipper = &m_hack_cliprect;
- else
- clipper = &cliprect;
-
- m_gfxdecode->gfx(sprite_ptr->gfx)->prio_zoom_transpen(bitmap,*clipper,
- sprite_ptr->code,
- sprite_ptr->color,
- sprite_ptr->flipx,sprite_ptr->flipy,
- sprite_ptr->x,sprite_ptr->y,
- sprite_ptr->zoomx,sprite_ptr->zoomy,
- screen.priority(),primasks[sprite_ptr->pri],0);
- }
-}
-
-/**************************************************************
- SCREEN REFRESH
-**************************************************************/
-
-u32 groundfx_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- u8 layer[5];
- u8 scclayer[3];
-
- m_tc0620scc->tilemap_update();
- m_tc0480scp->tilemap_update();
-
- const u16 priority = m_tc0480scp->get_bg_priority();
-
- layer[0] = (priority & 0xf000) >> 12; /* tells us which bg layer is bottom */
- layer[1] = (priority & 0x0f00) >> 8;
- layer[2] = (priority & 0x00f0) >> 4;
- layer[3] = (priority & 0x000f) >> 0; /* tells us which is top */
- layer[4] = 4; /* text layer always over bg layers */
-
- scclayer[0] = m_tc0620scc->bottomlayer();
- scclayer[1] = scclayer[0]^1;
- scclayer[2] = 2;
-
- screen.priority().fill(0, cliprect);
- bitmap.fill(0, cliprect); /* wrong color? */
-
- m_tc0620scc->tilemap_draw(screen, bitmap, cliprect, scclayer[0], TILEMAP_DRAW_OPAQUE, 0);
- m_tc0620scc->tilemap_draw(screen, bitmap, cliprect, scclayer[1], 0, 0);
-
- /* BIG HACK!
-
- The rear view mirror is a big priority trick - the text
- layer of TC0100SCN is used as a stencil to display
- the bottom layer of TC0480SCP and a particular sprite
- priority. These never appear outside of the stencil.
-
- I'm not sure how the game turns this effect on/off
- (the 480 layer is used normally in the frontend
- of the game).
-
- I haven't implemented it properly yet, instead I'm
- doing a hacky cliprect around the rearview and drawing
- it's contents the usual way.
-
- */
- if (m_tc0620scc->ram_r(0x4090 / 2) || m_tc0620scc->ram_r(0x4092 / 2) ||
- ((m_tc0480scp->ram_r(0x20 / 2) == 0x24) && (m_tc0480scp->ram_r(0x22 / 2) == 0x0866))) /* Anything in text layer - really stupid hack */
- {
- m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 2);
- m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 4);
- m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[3], 0, 8);
-
- //m_tc0620scc->tilemap_draw(screen, bitmap, cliprect, 0, scclayer[2], 0, 0);
-
- if ((m_tc0480scp->ram_r(0x20 / 2) != 0x24) && (m_tc0480scp->ram_r(0x22 / 2) != 0x0866)) /* Stupid hack for start of race */
- m_tc0480scp->tilemap_draw(screen, bitmap, m_hack_cliprect, layer[0], 0, 0);
- draw_sprites(screen, bitmap, cliprect, 1, 44, -574);
- }
- else
- {
- m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[0], 0, 1);
- m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 2);
- m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 4);
- m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[3], 0, 8);
-
- m_tc0620scc->tilemap_draw(screen, bitmap, cliprect, scclayer[2], 0, 0);
-
- draw_sprites(screen, bitmap, cliprect, 0, 44, -574);
- }
-
- m_tc0480scp->tilemap_draw(screen, bitmap, cliprect, layer[4], 0, 0); /* TC0480SCP text layer */
- return 0;
-}
diff --git a/src/mame/taito/pitnrun.cpp b/src/mame/taito/pitnrun.cpp
index 6e0c42fb097..5cbf7a7af34 100644
--- a/src/mame/taito/pitnrun.cpp
+++ b/src/mame/taito/pitnrun.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:Tomasz Slanina, Pierpaolo Prazzoli
+// copyright-holders: Tomasz Slanina, Pierpaolo Prazzoli
+
/****************************************************
Pit&Run - Taito 1984
@@ -67,19 +68,563 @@ K1000233A
*/
#include "emu.h"
-#include "pitnrun.h"
+#include "cpu/m6805/m68705.h"
#include "cpu/z80/z80.h"
-
#include "machine/74259.h"
#include "machine/gen_latch.h"
#include "machine/watchdog.h"
-
#include "sound/ay8910.h"
+#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+namespace {
+
+class pitnrun_state : public driver_device
+{
+public:
+ pitnrun_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette"),
+ m_videoram(*this, "videoram%u", 1U),
+ m_spriteram(*this, "spriteram"),
+ m_spotrom(*this, "spot")
+ { }
+
+ void pitnrun(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
+ required_device<cpu_device> m_maincpu;
+
+ void main_map(address_map &map);
+
+private:
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
+ required_shared_ptr_array<uint8_t, 2> m_videoram;
+ required_shared_ptr<uint8_t> m_spriteram;
+
+ required_region_ptr<uint8_t> m_spotrom;
+
+ uint8_t m_nmi = 0;
+ uint8_t m_h_heed = 0;
+ uint8_t m_v_heed = 0;
+ uint8_t m_ha = 0;
+ uint16_t m_scroll = 0;
+ uint8_t m_char_bank = 0;
+ uint8_t m_color_select = 0;
+ std::unique_ptr<bitmap_ind16> m_tmp_bitmap[4];
+ tilemap_t *m_bg = nullptr;
+ tilemap_t *m_fg = nullptr;
+
+ DECLARE_WRITE_LINE_MEMBER(nmi_enable_w);
+ DECLARE_WRITE_LINE_MEMBER(hflip_w);
+ DECLARE_WRITE_LINE_MEMBER(vflip_w);
+ template <uint8_t Which> void videoram_w(offs_t offset, uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(char_bank_select_w);
+ void scroll_w(offs_t offset, uint8_t data);
+ void scroll_y_w(uint8_t data);
+ void ha_w(uint8_t data);
+ void h_heed_w(uint8_t data);
+ void v_heed_w(uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(color_select_w);
+
+ TILE_GET_INFO_MEMBER(get_tile_info_fg);
+ TILE_GET_INFO_MEMBER(get_tile_info_bg);
+
+ INTERRUPT_GEN_MEMBER(nmi_source);
+
+ void palette(palette_device &palette) const;
+
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void spotlights();
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void sound_io_map(address_map &map);
+ void sound_prg_map(address_map &map);
+};
+
+class pitnrun_mcu_state : public pitnrun_state
+{
+public:
+ pitnrun_mcu_state(const machine_config &mconfig, device_type type, const char *tag) :
+ pitnrun_state(mconfig, type, tag),
+ m_mcu(*this, "mcu")
+ { }
+
+ void pitnrun_mcu(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+private:
+ required_device<m68705p5_device> m_mcu;
+ uint8_t m_fromz80 = 0;
+ uint8_t m_toz80 = 0;
+ uint8_t m_zaccept = 0;
+ uint8_t m_zready = 0;
+ uint8_t m_porta_in = 0;
+ uint8_t m_porta_out = 0;
+ uint16_t m_address = 0;
+
+ uint8_t mcu_data_r();
+ void mcu_data_w(uint8_t data);
+ uint8_t mcu_status_r();
+ uint8_t m68705_porta_r();
+ void m68705_porta_w(uint8_t data);
+ uint8_t m68705_portb_r();
+ void m68705_portb_w(uint8_t data);
+ uint8_t m68705_portc_r();
+
+ TIMER_CALLBACK_MEMBER(mcu_real_data_r);
+ TIMER_CALLBACK_MEMBER(mcu_real_data_w);
+ TIMER_CALLBACK_MEMBER(mcu_data_real_r);
+ TIMER_CALLBACK_MEMBER(mcu_status_real_w);
+
+ void mcu_map(address_map &map);
+};
+
+
+// video
+
+/***************************************************************************
+
+ - BG layer 32x128 , 8x8 tiles 4bpp , 2 palettes (2nd is black )
+ - TXT layer 32x32 , 8x8 tiles 4bpp , 2 palettes (2nd is black)
+ - Sprites 16x16 3bpp, 8 palettes (0-3 are black)
+
+ 'Special' effects :
+
+ - spotlight - gfx(BG+Sprites) outside spotlight is using black pals
+ spotlight masks are taken from ROM pr8
+ simulated using bitmaps and custom clipping rect
+
+ - lightning - BG color change (darkening ?) - simple analog circ.
+ simulated by additional palette
+In debug build press 'w' for spotlight and 'e' for lightning
+
+***************************************************************************/
+
+
+TILE_GET_INFO_MEMBER(pitnrun_state::get_tile_info_fg)
+{
+ int const code = m_videoram[0][tile_index];
+ tileinfo.set(0,
+ code,
+ 0,
+ 0);
+}
+
+TILE_GET_INFO_MEMBER(pitnrun_state::get_tile_info_bg)
+{
+ int const code = m_videoram[1][tile_index];
+ tileinfo.set(1,
+ code + (m_char_bank << 8),
+ m_color_select,
+ 0);
+}
+
+template <uint8_t Which>
+void pitnrun_state::videoram_w(offs_t offset, uint8_t data)
+{
+ m_videoram[Which][offset] = data;
+ Which ? m_bg->mark_all_dirty() : m_fg->mark_all_dirty();
+}
+
+WRITE_LINE_MEMBER(pitnrun_state::char_bank_select_w)
+{
+ m_char_bank = state;
+ m_bg->mark_all_dirty();
+}
+
+
+void pitnrun_state::scroll_w(offs_t offset, uint8_t data)
+{
+ m_scroll = (m_scroll & (0xff << ((offset) ? 0 : 8))) |( data << ((offset) ? 8 : 0));
+ m_bg->set_scrollx(0, m_scroll);
+}
+
+void pitnrun_state::scroll_y_w(uint8_t data)
+{
+ m_bg->set_scrolly(0, data);
+}
+
+void pitnrun_state::ha_w(uint8_t data)
+{
+ m_ha = data;
+}
+
+void pitnrun_state::h_heed_w(uint8_t data)
+{
+ m_h_heed = data;
+}
+
+void pitnrun_state::v_heed_w(uint8_t data)
+{
+ m_v_heed = data;
+}
+
+WRITE_LINE_MEMBER(pitnrun_state::color_select_w)
+{
+ m_color_select = state;
+ machine().tilemap().mark_all_dirty();
+}
+
+void pitnrun_state::spotlights()
+{
+ for (int i = 0; i < 4; i++)
+ {
+ for (int y = 0; y < 128; y++)
+ {
+ for (int x = 0; x < 16; x++)
+ {
+ int datapix = m_spotrom[128 * 16 * i + x + y * 16];
+ for (int b = 0; b < 8; b++)
+ {
+ m_tmp_bitmap[i]->pix(y, x * 8 + (7 - b)) = (datapix & 1);
+ datapix >>= 1;
+ }
+ }
+ }
+ }
+}
+
+
+void pitnrun_state::palette(palette_device &palette) const
+{
+ uint8_t const *const color_prom = memregion("proms")->base();
+
+ for (int i = 0; i < 32*3; i++)
+ {
+ int bit0, bit1, bit2;
+
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = 0;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
+ }
+
+ // fake bg palette for lightning effect
+ for (int i = 2 * 16; i < 2 * 16 + 16; i++)
+ {
+ int bit0, bit1, bit2;
+
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = 0;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ r /= 3;
+ g /= 3;
+ b /= 3;
+
+ palette.set_pen_color(i + 16, (r > 0xff) ? 0xff : r, (g > 0xff) ? 0xff : g, (b > 0xff) ? 0xff : b);
+
+ }
+}
+
+void pitnrun_state::video_start()
+{
+ m_fg = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(pitnrun_state::get_tile_info_fg)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+ m_bg = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(pitnrun_state::get_tile_info_bg)), TILEMAP_SCAN_ROWS, 8, 8, 32 * 4, 32);
+ m_fg->set_transparent_pen(0 );
+ m_tmp_bitmap[0] = std::make_unique<bitmap_ind16>(128, 128);
+ m_tmp_bitmap[1] = std::make_unique<bitmap_ind16>(128, 128);
+ m_tmp_bitmap[2] = std::make_unique<bitmap_ind16>(128, 128);
+ m_tmp_bitmap[3] = std::make_unique<bitmap_ind16>(128, 128);
+ spotlights();
+
+ save_item(NAME(m_h_heed));
+ save_item(NAME(m_v_heed));
+ save_item(NAME(m_ha));
+ save_item(NAME(m_scroll));
+ save_item(NAME(m_char_bank));
+ save_item(NAME(m_color_select));
+}
+
+void pitnrun_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ for (int offs = 0; offs < 0x100; offs += 4)
+ {
+ int const pal = m_spriteram[offs + 2] & 0x3;
+
+ int sy = 256 - m_spriteram[offs + 0] - 16;
+ int sx = m_spriteram[offs + 3] + 1; // +1 needed to properly align Jump Kun
+ int flipy = (m_spriteram[offs + 1] & 0x80) >> 7;
+ int flipx = (m_spriteram[offs + 1] & 0x40) >> 6;
+
+ if (flip_screen_x())
+ {
+ sx = 256 - sx;
+ flipx = !flipx;
+ }
+ if (flip_screen_y())
+ {
+ sy = 240 - sy;
+ flipy = !flipy;
+ }
+
+ m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
+ (m_spriteram[offs + 1] & 0x3f) + ((m_spriteram[offs + 2] & 0x80) >> 1)+ ((m_spriteram[offs + 2] & 0x40) << 1),
+ pal,
+ flipx, flipy,
+ sx, sy, 0);
+ }
+}
+
+uint32_t pitnrun_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ int dx = 0, dy = 0;
+ rectangle myclip = cliprect;
+
+#ifdef MAME_DEBUG
+ if (machine().input().code_pressed_once(KEYCODE_Q))
+ {
+ uint8_t *ROM = memregion("maincpu")->base();
+ ROM[0x84f6] = 0; // lap 0 - normal
+ }
+
+ if (machine().input().code_pressed_once(KEYCODE_W))
+ {
+ uint8_t *ROM = memregion("maincpu")->base();
+ ROM[0x84f6] = 6; // lap 6 = spotlight
+ }
+
+ if (machine().input().code_pressed_once(KEYCODE_E))
+ {
+ uint8_t *ROM = memregion("maincpu")->base();
+ ROM[0x84f6] = 2; // lap 3 (trial 2)= lightnings
+ ROM[0x8102] = 1;
+ }
+#endif
+
+ bitmap.fill(0, cliprect);
+
+ if (!(m_ha & 4))
+ m_bg->draw(screen, bitmap, cliprect, 0, 0);
+ else
+ {
+ dx = 128 - m_h_heed + ((m_ha & 8) << 5) + 3;
+ dy = 128 - m_v_heed + ((m_ha & 0x10) << 4);
+
+ if (flip_screen_x())
+ dx = 128 - dx + 16;
+
+ if (flip_screen_y())
+ dy = 128 - dy;
+
+ myclip.set(dx, dx + 127, dy, dy + 127);
+ myclip &= cliprect;
+
+ m_bg->draw(screen, bitmap, myclip, 0, 0);
+ }
+
+ draw_sprites(bitmap, myclip);
+
+ if (m_ha & 4)
+ copybitmap_trans(bitmap, *m_tmp_bitmap[m_ha & 3], flip_screen_x(), flip_screen_y(), dx, dy, myclip, 1);
+ m_fg->draw(screen, bitmap, cliprect, 0, 0);
+ return 0;
+}
+
+
+// MCU
+
+/***************************************************************************
+
+ Based on TaitsoSJ driver
+ 68705 has access to Z80 memory space
+
+***************************************************************************/
+
+TIMER_CALLBACK_MEMBER(pitnrun_mcu_state::mcu_real_data_r)
+{
+ m_zaccept = 1;
+}
+
+uint8_t pitnrun_mcu_state::mcu_data_r()
+{
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_mcu_state::mcu_real_data_r), this));
+ return m_toz80;
+}
+
+TIMER_CALLBACK_MEMBER(pitnrun_mcu_state::mcu_real_data_w)
+{
+ m_zready = 1;
+ m_mcu->set_input_line(0, ASSERT_LINE);
+ m_fromz80 = param;
+}
+
+void pitnrun_mcu_state::mcu_data_w(uint8_t data)
+{
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_mcu_state::mcu_real_data_w), this), data);
+ machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(5));
+}
+
+uint8_t pitnrun_mcu_state::mcu_status_r()
+{
+ /* MCU synchronization
+ bit 0 = the 68705 has read data from the Z80
+ bit 1 = the 68705 has written data for the Z80 */
+ return ~((m_zready << 1) | (m_zaccept << 0));
+}
+
+
+uint8_t pitnrun_mcu_state::m68705_porta_r()
+{
+ return m_porta_in;
+}
+
+void pitnrun_mcu_state::m68705_porta_w(uint8_t data)
+{
+ m_porta_out = data;
+}
+
+
+
+/*
+ * Port B connections:
+ *
+ * all bits are logical 1 when read (+5V pullup)
+ *
+ * 0 W !68INTRQ
+ * 1 W !68LRD (enables latch which holds command from the Z80)
+ * 2 W !68LWR (loads the latch which holds data for the Z80, and sets a
+ * status bit so the Z80 knows there's data waiting)
+ * 3 W to Z80 !BUSRQ (aka !WAIT) pin
+ * 4 W !68WRITE (triggers write to main Z80 memory area )
+ * 5 W !68READ (triggers read from main Z80 memory area )
+ * 6 W !LAL (loads the latch which holds the low 8 bits of the address of
+ * the main Z80 memory location to access)
+ * 7 W !UAL (loads the latch which holds the high 8 bits of the address of
+ * the main Z80 memory location to access)
+ */
+
+uint8_t pitnrun_mcu_state::m68705_portb_r()
+{
+ return 0xff;
+}
+
+
+TIMER_CALLBACK_MEMBER(pitnrun_mcu_state::mcu_data_real_r)
+{
+ m_zready = 0;
+}
+
+TIMER_CALLBACK_MEMBER(pitnrun_mcu_state::mcu_status_real_w)
+{
+ m_toz80 = param;
+ m_zaccept = 0;
+}
+
+void pitnrun_mcu_state::m68705_portb_w(uint8_t data)
+{
+ address_space &cpu0space = m_maincpu->space(AS_PROGRAM);
+ if (~data & 0x02)
+ {
+ // 68705 is going to read data from the Z80
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_mcu_state::mcu_data_real_r), this));
+ m_mcu->set_input_line(0, CLEAR_LINE);
+ m_porta_in = m_fromz80;
+ }
+ if (~data & 0x04)
+ {
+ // 68705 is writing data for the Z80
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_mcu_state::mcu_status_real_w), this), m_porta_out);
+ }
+ if (~data & 0x10)
+ {
+ cpu0space.write_byte(m_address, m_porta_out);
+ }
+ if (~data & 0x20)
+ {
+ m_porta_in = cpu0space.read_byte(m_address);
+ }
+ if (~data & 0x40)
+ {
+ m_address = (m_address & 0xff00) | m_porta_out;
+ }
+ if (~data & 0x80)
+ {
+ m_address = (m_address & 0x00ff) | (m_porta_out << 8);
+ }
+}
+
+/*
+ * Port C connections:
+ *
+ * 0 R ZREADY (1 when the Z80 has written a command in the latch)
+ * 1 R ZACCEPT (1 when the Z80 has read data from the latch)
+ * 2 R from Z80 !BUSAK pin
+ * 3 R 68INTAK (goes 0 when the interrupt request done with 68INTRQ
+ * passes through)
+ */
+
+uint8_t pitnrun_mcu_state::m68705_portc_r()
+{
+ return (m_zready << 0) | (m_zaccept << 1);
+}
+
+
+// machine
+
+void pitnrun_state::machine_start()
+{
+ save_item(NAME(m_nmi));
+}
+
+void pitnrun_mcu_state::machine_start()
+{
+ pitnrun_state::machine_start();
+
+ save_item(NAME(m_fromz80));
+ save_item(NAME(m_toz80));
+ save_item(NAME(m_zaccept));
+ save_item(NAME(m_zready));
+ save_item(NAME(m_porta_in));
+ save_item(NAME(m_porta_out));
+ save_item(NAME(m_address));
+}
+
+void pitnrun_mcu_state::machine_reset()
+{
+ m_zaccept = 1;
+ m_zready = 0;
+ m_mcu->set_input_line(0, CLEAR_LINE);
+}
INTERRUPT_GEN_MEMBER(pitnrun_state::nmi_source)
{
@@ -104,44 +649,41 @@ WRITE_LINE_MEMBER(pitnrun_state::vflip_w)
flip_screen_y_set(state);
}
-void pitnrun_state::pitnrun_map(address_map &map)
+void pitnrun_state::main_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0x8000, 0x87ff).ram();
- map(0x8800, 0x8fff).ram().w(FUNC(pitnrun_state::videoram_w)).share("videoram");
- map(0x9000, 0x9fff).ram().w(FUNC(pitnrun_state::videoram2_w)).share("videoram2");
- map(0xa000, 0xa0ff).ram().share("spriteram");
+ map(0x8800, 0x8fff).ram().w(FUNC(pitnrun_state::videoram_w<0>)).share(m_videoram[0]);
+ map(0x9000, 0x9fff).ram().w(FUNC(pitnrun_state::videoram_w<1>)).share(m_videoram[1]);
+ map(0xa000, 0xa0ff).ram().share(m_spriteram);
map(0xa800, 0xa800).portr("SYSTEM");
- map(0xa800, 0xa807).w("noiselatch", FUNC(ls259_device::write_d0)); /* Analog Sound */
+ map(0xa800, 0xa807).w("noiselatch", FUNC(ls259_device::write_d0)); // analog sound
map(0xb000, 0xb000).portr("DSW");
map(0xb000, 0xb007).w("mainlatch", FUNC(ls259_device::write_d0));
map(0xb800, 0xb800).portr("INPUTS").w("soundlatch", FUNC(generic_latch_8_device::write));
map(0xc800, 0xc801).w(FUNC(pitnrun_state::scroll_w));
map(0xc802, 0xc802).w(FUNC(pitnrun_state::scroll_y_w));
- //map(0xc804, 0xc804).w(FUNC(pitnrun_state::mcu_data_w));
map(0xc805, 0xc805).w(FUNC(pitnrun_state::h_heed_w));
map(0xc806, 0xc806).w(FUNC(pitnrun_state::v_heed_w));
map(0xc807, 0xc807).w(FUNC(pitnrun_state::ha_w));
- //map(0xd000, 0xd000).r(FUNC(pitnrun_state::mcu_data_r));
- //map(0xd800, 0xd800).r(FUNC(pitnrun_state::mcu_status_r));
map(0xf000, 0xf000).r("watchdog", FUNC(watchdog_timer_device::reset_r));
}
-void pitnrun_state::pitnrun_map_mcu(address_map &map)
+void pitnrun_mcu_state::mcu_map(address_map &map)
{
- pitnrun_map(map);
- map(0xc804, 0xc804).w(FUNC(pitnrun_state::mcu_data_w));
- map(0xd000, 0xd000).r(FUNC(pitnrun_state::mcu_data_r));
- map(0xd800, 0xd800).r(FUNC(pitnrun_state::mcu_status_r));
+ main_map(map);
+ map(0xc804, 0xc804).w(FUNC(pitnrun_mcu_state::mcu_data_w));
+ map(0xd000, 0xd000).r(FUNC(pitnrun_mcu_state::mcu_data_r));
+ map(0xd800, 0xd800).r(FUNC(pitnrun_mcu_state::mcu_status_r));
}
-void pitnrun_state::pitnrun_sound_map(address_map &map)
+void pitnrun_state::sound_prg_map(address_map &map)
{
- map(0x0000, 0x2fff).rom();
+ map(0x0000, 0x1fff).rom();
map(0x3800, 0x3bff).ram();
}
-void pitnrun_state::pitnrun_sound_io_map(address_map &map)
+void pitnrun_state::sound_io_map(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x00).w("soundlatch", FUNC(generic_latch_8_device::clear_w));
@@ -272,15 +814,15 @@ static const gfx_layout charlayout =
};
static GFXDECODE_START( gfx_pitnrun )
- GFXDECODE_ENTRY( "gfx3", 0, charlayout, 64, 2 )
- GFXDECODE_ENTRY( "gfx2", 0, charlayout, 32, 2 )
- GFXDECODE_ENTRY( "gfx1", 0, spritelayout, 0, 4 )
+ GFXDECODE_ENTRY( "fgtiles", 0, charlayout, 64, 2 )
+ GFXDECODE_ENTRY( "bgtiles", 0, charlayout, 32, 2 )
+ GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 4 )
GFXDECODE_END
void pitnrun_state::pitnrun(machine_config &config)
{
- Z80(config, m_maincpu, XTAL(18'432'000)/6); /* verified on pcb */
- m_maincpu->set_addrmap(AS_PROGRAM, &pitnrun_state::pitnrun_map);
+ Z80(config, m_maincpu, XTAL(18'432'000) / 6); // verified on PCB
+ m_maincpu->set_addrmap(AS_PROGRAM, &pitnrun_state::main_map);
m_maincpu->set_vblank_int("screen", FUNC(pitnrun_state::nmi_source));
ls259_device &mainlatch(LS259(config, "mainlatch")); // 7B (mislabeled LS156 on schematic)
@@ -291,16 +833,16 @@ void pitnrun_state::pitnrun(machine_config &config)
mainlatch.q_out_cb<6>().set(FUNC(pitnrun_state::hflip_w)); // HFLIP
mainlatch.q_out_cb<7>().set(FUNC(pitnrun_state::vflip_w)); // VFLIP
- z80_device &audiocpu(Z80(config, "audiocpu", XTAL(5'000'000)/2)); /* verified on pcb */
- audiocpu.set_addrmap(AS_PROGRAM, &pitnrun_state::pitnrun_sound_map);
- audiocpu.set_addrmap(AS_IO, &pitnrun_state::pitnrun_sound_io_map);
+ z80_device &audiocpu(Z80(config, "audiocpu", XTAL(5'000'000) / 2)); // verified on PCB
+ audiocpu.set_addrmap(AS_PROGRAM, &pitnrun_state::sound_prg_map);
+ audiocpu.set_addrmap(AS_IO, &pitnrun_state::sound_io_map);
audiocpu.set_vblank_int("screen", FUNC(pitnrun_state::irq0_line_hold));
WATCHDOG_TIMER(config, "watchdog");
config.set_maximum_quantum(attotime::from_hz(6000));
- /* 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(0));
@@ -310,19 +852,19 @@ void pitnrun_state::pitnrun(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pitnrun);
- PALETTE(config, m_palette, FUNC(pitnrun_state::pitnrun_palette), 32 * 3);
+ PALETTE(config, m_palette, FUNC(pitnrun_state::palette), 32 * 3);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, "soundlatch");
- ay8910_device &ay1(AY8910(config, "ay1", XTAL(18'432'000)/12)); /* verified on pcb */
+ ay8910_device &ay1(AY8910(config, "ay1", XTAL(18'432'000) / 12)); // verified on PCB
ay1.port_a_read_callback().set("soundlatch", FUNC(generic_latch_8_device::read));
ay1.port_b_read_callback().set("soundlatch", FUNC(generic_latch_8_device::read));
ay1.add_route(ALL_OUTPUTS, "mono", 0.50);
- ay8910_device &ay2(AY8910(config, "ay2", XTAL(18'432'000)/12)); /* verified on pcb */
+ ay8910_device &ay2(AY8910(config, "ay2", XTAL(18'432'000) / 12)); // verified on PCB
ay2.port_a_read_callback().set("soundlatch", FUNC(generic_latch_8_device::read));
ay2.port_b_read_callback().set("soundlatch", FUNC(generic_latch_8_device::read));
ay2.add_route(ALL_OUTPUTS, "mono", 0.50);
@@ -330,43 +872,43 @@ void pitnrun_state::pitnrun(machine_config &config)
LS259(config, "noiselatch"); // 1J
}
-void pitnrun_state::pitnrun_mcu(machine_config &config)
+void pitnrun_mcu_state::pitnrun_mcu(machine_config &config)
{
pitnrun(config);
- m_maincpu->set_addrmap(AS_PROGRAM, &pitnrun_state::pitnrun_map_mcu);
+ m_maincpu->set_addrmap(AS_PROGRAM, &pitnrun_mcu_state::mcu_map);
- M68705P5(config, m_mcu, XTAL(18'432'000)/6); /* verified on pcb */
- m_mcu->porta_r().set(FUNC(pitnrun_state::m68705_porta_r));
- m_mcu->portb_r().set(FUNC(pitnrun_state::m68705_portb_r));
- m_mcu->portc_r().set(FUNC(pitnrun_state::m68705_portc_r));
- m_mcu->porta_w().set(FUNC(pitnrun_state::m68705_porta_w));
- m_mcu->portb_w().set(FUNC(pitnrun_state::m68705_portb_w));
+ M68705P5(config, m_mcu, XTAL(18'432'000) / 6); // verified on PCB
+ m_mcu->porta_r().set(FUNC(pitnrun_mcu_state::m68705_porta_r));
+ m_mcu->portb_r().set(FUNC(pitnrun_mcu_state::m68705_portb_r));
+ m_mcu->portc_r().set(FUNC(pitnrun_mcu_state::m68705_portc_r));
+ m_mcu->porta_w().set(FUNC(pitnrun_mcu_state::m68705_porta_w));
+ m_mcu->portb_w().set(FUNC(pitnrun_mcu_state::m68705_portb_w));
}
ROM_START( pitnrun )
- ROM_REGION( 0x10000, "maincpu", 0 )
+ ROM_REGION( 0x8000, "maincpu", 0 )
ROM_LOAD( "pr12", 0x0000, 0x2000, CRC(587a7b85) SHA1(f200ff9b706e13760a23e0187c6bffe496af0087) )
ROM_LOAD( "pr11", 0x2000, 0x2000, CRC(270cd6dd) SHA1(ad42562e18aa30319fc55c201e5507e8734a5b4d) )
ROM_LOAD( "pr10", 0x4000, 0x2000, CRC(65d92d89) SHA1(4030ccdb4d84e69c256e95431ee5a18cffeae5c0) )
ROM_LOAD( "pr9", 0x6000, 0x2000, CRC(3155286d) SHA1(45af8cb81d70f2e30b52bbc7abd9f8d15231735f) )
- ROM_REGION( 0x10000, "audiocpu", 0 )
+ ROM_REGION( 0x2000, "audiocpu", 0 )
ROM_LOAD( "pr13", 0x0000, 0x1000, CRC(fc8fd05c) SHA1(f40cc9c6fff6bda8411f4d638a0f5c5915aa3746) )
ROM_REGION( 0x0800, "mcu", 0 )
ROM_LOAD( "a11_17.3a", 0x0000, 0x0800, CRC(e7d5d6e1) SHA1(c1131d6fcc36926e287be26090a3c89f22feaa35) )
- ROM_REGION( 0x6000, "gfx1", 0 )
+ ROM_REGION( 0x6000, "sprites", 0 )
ROM_LOAD( "pr1", 0x0000, 0x2000, CRC(c3b3131e) SHA1(ed0463e7eef452d7fbdcb031f9477825e9780943) )
ROM_LOAD( "pr2", 0x2000, 0x2000, CRC(2fa1682a) SHA1(9daefb525fd69f0d9a45ff27e89865545e177a5a) )
ROM_LOAD( "pr3", 0x4000, 0x2000, CRC(e678fe39) SHA1(134e36fd30bf3cf5884732f3455ca4d9dab6b665) )
- ROM_REGION( 0x4000, "gfx2", 0 )
+ ROM_REGION( 0x4000, "bgtiles", 0 )
ROM_LOAD( "pr4", 0x0000, 0x2000, CRC(fbae3504) SHA1(ce799dfd653462c0814e7530f3f8a686ab0ad7f4) )
ROM_LOAD( "pr5", 0x2000, 0x2000, CRC(c9177180) SHA1(98c8f8f586b78b88dba254bd662642ee27f9b131) )
- ROM_REGION( 0x2000, "gfx3", 0 )
+ ROM_REGION( 0x2000, "fgtiles", 0 )
ROM_LOAD( "pr6", 0x0000, 0x1000, CRC(c53cb897) SHA1(81a73e6031b52fa45ec507ff4264b14474ef42a2) )
ROM_LOAD( "pr7", 0x1000, 0x1000, CRC(7cdf9a55) SHA1(404dface7e09186e486945981e39063929599efc) )
@@ -380,28 +922,28 @@ ROM_START( pitnrun )
ROM_END
ROM_START( pitnruna )
- ROM_REGION( 0x010000, "maincpu", 0 )
+ ROM_REGION( 0x8000, "maincpu", 0 )
ROM_LOAD( "pr_12-1.5d", 0x0000, 0x2000, CRC(2539aec3) SHA1(5ee87cf2379a6b6218f0c1f79374edafe5413616) )
ROM_LOAD( "pr_11-1.5c", 0x2000, 0x2000, CRC(818a49f8) SHA1(0a4c77055529967595984277f11dc1cd1eec4dae) )
ROM_LOAD( "pr_10-1.5b", 0x4000, 0x2000, CRC(69b3a864) SHA1(3d29e1f71f1a94650839696c3070d5739360bee0) )
ROM_LOAD( "pr_9-1.5a", 0x6000, 0x2000, CRC(ba0c4093) SHA1(0273e4bd09b9eebff490fdac27e6ae9b54bb3cd9) )
- ROM_REGION( 0x10000, "audiocpu", 0 )
+ ROM_REGION( 0x2000, "audiocpu", 0 )
ROM_LOAD( "pr-13", 0x0000, 0x1000, CRC(32a18d3b) SHA1(fcff1c13183b64ede0865dd04eee5182029bebdf) )
ROM_REGION( 0x0800, "mcu", 0 )
ROM_LOAD( "a11_17.3a", 0x0000, 0x0800, CRC(e7d5d6e1) SHA1(c1131d6fcc36926e287be26090a3c89f22feaa35) )
- ROM_REGION( 0x06000, "gfx1", 0 )
+ ROM_REGION( 0x06000, "sprites", 0 )
ROM_LOAD( "pr-1.1k", 0x0000, 0x2000, CRC(c3b3131e) SHA1(ed0463e7eef452d7fbdcb031f9477825e9780943) )
ROM_LOAD( "pr-2.1m", 0x2000, 0x2000, CRC(2fa1682a) SHA1(9daefb525fd69f0d9a45ff27e89865545e177a5a) )
ROM_LOAD( "pr-3.1n", 0x4000, 0x2000, CRC(e678fe39) SHA1(134e36fd30bf3cf5884732f3455ca4d9dab6b665) )
- ROM_REGION( 0x4000, "gfx2", 0 )
+ ROM_REGION( 0x4000, "bgtiles", 0 )
ROM_LOAD( "pr-4.6d", 0x0000, 0x2000, CRC(fbae3504) SHA1(ce799dfd653462c0814e7530f3f8a686ab0ad7f4) )
ROM_LOAD( "pr-5.6f", 0x2000, 0x2000, CRC(c9177180) SHA1(98c8f8f586b78b88dba254bd662642ee27f9b131) )
- ROM_REGION( 0x2000, "gfx3", 0 )
+ ROM_REGION( 0x2000, "fgtiles", 0 )
ROM_LOAD( "pr-6.3m", 0x0000, 0x1000, CRC(c53cb897) SHA1(81a73e6031b52fa45ec507ff4264b14474ef42a2) )
ROM_LOAD( "pr-7.3p", 0x1000, 0x1000, CRC(7cdf9a55) SHA1(404dface7e09186e486945981e39063929599efc) )
@@ -415,29 +957,29 @@ ROM_START( pitnruna )
ROM_END
ROM_START( jumpkun )
- ROM_REGION( 0x10000, "maincpu", 0 )
+ ROM_REGION( 0x8000, "maincpu", 0 )
ROM_LOAD( "pr1.5d.2764", 0x00000, 0x02000, CRC(b0eabe9f) SHA1(e662f3946efe72b0bbf6c6934201163f765bb7aa) )
ROM_LOAD( "pr2.5c.2764", 0x02000, 0x02000, CRC(d9240413) SHA1(f4d0491e125f1fe435b200b38fa125889784af0a) )
ROM_LOAD( "pr3.5b.2764", 0x04000, 0x02000, CRC(105e3fec) SHA1(06ea902e6647fc37a603146324e3d0a067e1f649) )
ROM_LOAD( "pr4.5a.2764", 0x06000, 0x02000, CRC(3a17ca88) SHA1(00516798d546098831e75547664c8fdaa2bbf050) )
- ROM_REGION( 0x10000, "audiocpu", 0 )
+ ROM_REGION( 0x2000, "audiocpu", 0 )
ROM_LOAD( "snd1.2732", 0x00000, 0x01000, CRC(1290f316) SHA1(13e393860c1f7d1f97343b9f936c60adb7641efc) )
ROM_LOAD( "snd2.2732", 0x01000, 0x01000, CRC(ec5e4489) SHA1(fc94fe798a1925e8e3dd15161648e9a960969fc4) )
ROM_REGION( 0x0800, "mcu", ROMREGION_ERASE00 )
// not populated
- ROM_REGION( 0x6000, "gfx1", 0 )
+ ROM_REGION( 0x6000, "sprites", 0 )
ROM_LOAD( "obj1.1k.2764", 0x00000, 0x02000, CRC(8929abfd) SHA1(978994af5816c20a8cd520263d04d1cc1e4df576) )
ROM_LOAD( "obj2.1m.2764", 0x02000, 0x02000, CRC(c7bf5819) SHA1(15d8e1dd1c0911785237e9063a75a42a2dc1bd50) )
ROM_LOAD( "obj3.1n.2764", 0x04000, 0x02000, CRC(5eeec986) SHA1(e58a0b98b90a1dd3971ed305100337aa2e5ec450) )
- ROM_REGION( 0x4000, "gfx2", 0 )
+ ROM_REGION( 0x4000, "bgtiles", 0 )
ROM_LOAD( "chr1.6d.2764", 0x00000, 0x02000, CRC(3c93d4ee) SHA1(003121c49bccbb95efb137e6d92d26eea1957fbd) )
ROM_LOAD( "chr2.6f.2764", 0x02000, 0x02000, CRC(154fad33) SHA1(7eddc794bd547053f185bb79a8220907bab13d85) )
- ROM_REGION( 0x2000, "gfx3", 0 )
+ ROM_REGION( 0x2000, "fgtiles", 0 )
ROM_LOAD( "bsc2.3m.2764", 0x00000, 0x01000, CRC(25445f17) SHA1(b1ada95d8f02623bb4a4562d2d278a882414e57e) )
ROM_LOAD( "bsc1.3p.2764", 0x01000, 0x01000, CRC(39ca2c37) SHA1(b8c71f443a0faf54df03ac5aca46ddd34c42d3a0) )
@@ -450,6 +992,9 @@ ROM_START( jumpkun )
ROM_LOAD( "8j.82s123.bin", 0x0040, 0x0020, CRC(223a6990) SHA1(06e16de037c2c7ad5733390859fa7ec1ab1e2f69) )
ROM_END
-GAME( 1984, pitnrun, 0, pitnrun_mcu, pitnrun, pitnrun_state, empty_init, ROT90, "Taito Corporation", "Pit & Run - F-1 Race (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
-GAME( 1984, pitnruna, pitnrun, pitnrun_mcu, pitnrun, pitnrun_state, empty_init, ROT90, "Taito Corporation", "Pit & Run - F-1 Race (set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
-GAME( 1984, jumpkun, 0, pitnrun, jumpkun, pitnrun_state, empty_init, ROT90, "Kaneko", "Jump Kun (prototype)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // no copyright message
+} // anonymous namespace
+
+
+GAME( 1984, pitnrun, 0, pitnrun_mcu, pitnrun, pitnrun_mcu_state, empty_init, ROT90, "Taito Corporation", "Pit & Run - F-1 Race (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
+GAME( 1984, pitnruna, pitnrun, pitnrun_mcu, pitnrun, pitnrun_mcu_state, empty_init, ROT90, "Taito Corporation", "Pit & Run - F-1 Race (set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
+GAME( 1984, jumpkun, 0, pitnrun, jumpkun, pitnrun_state, empty_init, ROT90, "Kaneko", "Jump Kun (prototype)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // no copyright message
diff --git a/src/mame/taito/pitnrun.h b/src/mame/taito/pitnrun.h
deleted file mode 100644
index 65ec773c641..00000000000
--- a/src/mame/taito/pitnrun.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Tomasz Slanina, Pierpaolo Prazzoli
-#ifndef MAME_INCLUDES_PITNRUN_H
-#define MAME_INCLUDES_PITNRUN_H
-
-#pragma once
-
-#include "cpu/m6805/m68705.h"
-#include "emupal.h"
-#include "tilemap.h"
-
-class pitnrun_state : public driver_device
-{
-public:
- pitnrun_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_mcu(*this, "mcu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
- m_videoram(*this, "videoram"),
- m_videoram2(*this, "videoram2"),
- m_spriteram(*this, "spriteram")
- { }
-
- void pitnrun_mcu(machine_config &config);
- void pitnrun(machine_config &config);
-
-protected:
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
-
-private:
- required_device<cpu_device> m_maincpu;
- optional_device<m68705p5_device> m_mcu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
-
- required_shared_ptr<uint8_t> m_videoram;
- required_shared_ptr<uint8_t> m_videoram2;
- required_shared_ptr<uint8_t> m_spriteram;
-
- int m_nmi = 0;
- uint8_t m_fromz80 = 0;
- uint8_t m_toz80 = 0;
- int m_zaccept = 0;
- int m_zready = 0;
- uint8_t m_porta_in = 0;
- uint8_t m_porta_out = 0;
- int m_address = 0;
- int m_h_heed = 0;
- int m_v_heed = 0;
- int m_ha = 0;
- int m_scroll = 0;
- int m_char_bank = 0;
- int m_color_select = 0;
- std::unique_ptr<bitmap_ind16> m_tmp_bitmap[4];
- tilemap_t *m_bg = nullptr;
- tilemap_t *m_fg = nullptr;
-
- DECLARE_WRITE_LINE_MEMBER(nmi_enable_w);
- DECLARE_WRITE_LINE_MEMBER(hflip_w);
- DECLARE_WRITE_LINE_MEMBER(vflip_w);
- uint8_t mcu_data_r();
- void mcu_data_w(uint8_t data);
- uint8_t mcu_status_r();
- uint8_t m68705_porta_r();
- void m68705_porta_w(uint8_t data);
- uint8_t m68705_portb_r();
- void m68705_portb_w(uint8_t data);
- uint8_t m68705_portc_r();
- void videoram_w(offs_t offset, uint8_t data);
- void videoram2_w(offs_t offset, uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(char_bank_select_w);
- void scroll_w(offs_t offset, uint8_t data);
- void scroll_y_w(uint8_t data);
- void ha_w(uint8_t data);
- void h_heed_w(uint8_t data);
- void v_heed_w(uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(color_select_w);
-
- TILE_GET_INFO_MEMBER(get_tile_info1);
- TILE_GET_INFO_MEMBER(get_tile_info2);
-
- INTERRUPT_GEN_MEMBER(nmi_source);
- TIMER_CALLBACK_MEMBER(mcu_real_data_r);
- TIMER_CALLBACK_MEMBER(mcu_real_data_w);
- TIMER_CALLBACK_MEMBER(mcu_data_real_r);
- TIMER_CALLBACK_MEMBER(mcu_status_real_w);
-
- void pitnrun_palette(palette_device &palette) const;
-
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void spotlights();
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
- void pitnrun_map(address_map &map);
- void pitnrun_map_mcu(address_map &map);
- void pitnrun_sound_io_map(address_map &map);
- void pitnrun_sound_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_PITNRUN_H
diff --git a/src/mame/taito/pitnrun_m.cpp b/src/mame/taito/pitnrun_m.cpp
deleted file mode 100644
index a01934a59da..00000000000
--- a/src/mame/taito/pitnrun_m.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Tomasz Slanina, Pierpaolo Prazzoli
-/***************************************************************************
-
- Pit&Run
-
- Based on TaitsoSJ driver
- 68705 has access to Z80 memory space
-
-***************************************************************************/
-
-#include "emu.h"
-#include "cpu/m6805/m6805.h"
-#include "pitnrun.h"
-
-
-void pitnrun_state::machine_start()
-{
- save_item(NAME(m_nmi));
- save_item(NAME(m_fromz80));
- save_item(NAME(m_toz80));
- save_item(NAME(m_zaccept));
- save_item(NAME(m_zready));
- save_item(NAME(m_porta_in));
- save_item(NAME(m_porta_out));
- save_item(NAME(m_address));
-}
-
-void pitnrun_state::machine_reset()
-{
- m_zaccept = 1;
- m_zready = 0;
- if (m_mcu) m_mcu->set_input_line(0, CLEAR_LINE);
-}
-
-TIMER_CALLBACK_MEMBER(pitnrun_state::mcu_real_data_r)
-{
- m_zaccept = 1;
-}
-
-uint8_t pitnrun_state::mcu_data_r()
-{
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_state::mcu_real_data_r),this));
- return m_toz80;
-}
-
-TIMER_CALLBACK_MEMBER(pitnrun_state::mcu_real_data_w)
-{
- m_zready = 1;
- m_mcu->set_input_line(0, ASSERT_LINE);
- m_fromz80 = param;
-}
-
-void pitnrun_state::mcu_data_w(uint8_t data)
-{
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_state::mcu_real_data_w),this), data);
- machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(5));
-}
-
-uint8_t pitnrun_state::mcu_status_r()
-{
- /* mcu synchronization */
- /* bit 0 = the 68705 has read data from the Z80 */
- /* bit 1 = the 68705 has written data for the Z80 */
- return ~((m_zready << 1) | (m_zaccept << 0));
-}
-
-
-uint8_t pitnrun_state::m68705_porta_r()
-{
- return m_porta_in;
-}
-
-void pitnrun_state::m68705_porta_w(uint8_t data)
-{
- m_porta_out = data;
-}
-
-
-
-/*
- * Port B connections:
- *
- * all bits are logical 1 when read (+5V pullup)
- *
- * 0 W !68INTRQ
- * 1 W !68LRD (enables latch which holds command from the Z80)
- * 2 W !68LWR (loads the latch which holds data for the Z80, and sets a
- * status bit so the Z80 knows there's data waiting)
- * 3 W to Z80 !BUSRQ (aka !WAIT) pin
- * 4 W !68WRITE (triggers write to main Z80 memory area )
- * 5 W !68READ (triggers read from main Z80 memory area )
- * 6 W !LAL (loads the latch which holds the low 8 bits of the address of
- * the main Z80 memory location to access)
- * 7 W !UAL (loads the latch which holds the high 8 bits of the address of
- * the main Z80 memory location to access)
- */
-
-uint8_t pitnrun_state::m68705_portb_r()
-{
- return 0xff;
-}
-
-
-TIMER_CALLBACK_MEMBER(pitnrun_state::mcu_data_real_r)
-{
- m_zready = 0;
-}
-
-TIMER_CALLBACK_MEMBER(pitnrun_state::mcu_status_real_w)
-{
- m_toz80 = param;
- m_zaccept = 0;
-}
-
-void pitnrun_state::m68705_portb_w(uint8_t data)
-{
- address_space &cpu0space = m_maincpu->space(AS_PROGRAM);
- if (~data & 0x02)
- {
- /* 68705 is going to read data from the Z80 */
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_state::mcu_data_real_r),this));
- m_mcu->set_input_line(0,CLEAR_LINE);
- m_porta_in = m_fromz80;
- }
- if (~data & 0x04)
- {
- /* 68705 is writing data for the Z80 */
- machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_state::mcu_status_real_w),this), m_porta_out);
- }
- if (~data & 0x10)
- {
- cpu0space.write_byte(m_address, m_porta_out);
- }
- if (~data & 0x20)
- {
- m_porta_in = cpu0space.read_byte(m_address);
- }
- if (~data & 0x40)
- {
- m_address = (m_address & 0xff00) | m_porta_out;
- }
- if (~data & 0x80)
- {
- m_address = (m_address & 0x00ff) | (m_porta_out << 8);
- }
-}
-
-/*
- * Port C connections:
- *
- * 0 R ZREADY (1 when the Z80 has written a command in the latch)
- * 1 R ZACCEPT (1 when the Z80 has read data from the latch)
- * 2 R from Z80 !BUSAK pin
- * 3 R 68INTAK (goes 0 when the interrupt request done with 68INTRQ
- * passes through)
- */
-
-uint8_t pitnrun_state::m68705_portc_r()
-{
- return (m_zready << 0) | (m_zaccept << 1);
-}
diff --git a/src/mame/taito/pitnrun_v.cpp b/src/mame/taito/pitnrun_v.cpp
deleted file mode 100644
index 4df85ac9db4..00000000000
--- a/src/mame/taito/pitnrun_v.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Tomasz Slanina, Pierpaolo Prazzoli
-/***************************************************************************
-
- - BG layer 32x128 , 8x8 tiles 4bpp , 2 palettes (2nd is black )
- - TXT layer 32x32 , 8x8 tiles 4bpp , 2 palettes (2nd is black)
- - Sprites 16x16 3bpp, 8 palettes (0-3 are black)
-
- 'Special' effects :
-
- - spotlight - gfx(BG+Sprites) outside spotlight is using black pals
- spotlight masks are taken from ROM pr8
- simulated using bitmaps and custom clipping rect
-
- - lightning - BG color change (darkening ?) - simple analog circ.
- simulated by additional palette
-
-In debug build press 'w' for spotlight and 'e' for lightning
-
-***************************************************************************/
-#include "emu.h"
-#include "pitnrun.h"
-
-
-
-TILE_GET_INFO_MEMBER(pitnrun_state::get_tile_info1)
-{
- int code = m_videoram[tile_index];
- tileinfo.set(0,
- code,
- 0,
- 0);
-}
-
-TILE_GET_INFO_MEMBER(pitnrun_state::get_tile_info2)
-{
- int code = m_videoram2[tile_index];
- tileinfo.set(1,
- code + (m_char_bank<<8),
- m_color_select&1,
- 0);
-}
-
-void pitnrun_state::videoram_w(offs_t offset, uint8_t data)
-{
- m_videoram[offset] = data;
- m_fg ->mark_all_dirty();
-}
-
-void pitnrun_state::videoram2_w(offs_t offset, uint8_t data)
-{
- m_videoram2[offset] = data;
- m_bg ->mark_all_dirty();
-}
-
-WRITE_LINE_MEMBER(pitnrun_state::char_bank_select_w)
-{
- m_char_bank = state;
- m_bg->mark_all_dirty();
-}
-
-
-void pitnrun_state::scroll_w(offs_t offset, uint8_t data)
-{
- m_scroll = (m_scroll & (0xff<<((offset)?0:8))) |( data<<((offset)?8:0));
- m_bg->set_scrollx(0, m_scroll);
-}
-
-void pitnrun_state::scroll_y_w(uint8_t data)
-{
- m_bg->set_scrolly(0, data);
-}
-
-void pitnrun_state::ha_w(uint8_t data)
-{
- m_ha=data;
-}
-
-void pitnrun_state::h_heed_w(uint8_t data)
-{
- m_h_heed=data;
-}
-
-void pitnrun_state::v_heed_w(uint8_t data)
-{
- m_v_heed=data;
-}
-
-WRITE_LINE_MEMBER(pitnrun_state::color_select_w)
-{
- m_color_select = state;
- machine().tilemap().mark_all_dirty();
-}
-
-void pitnrun_state::spotlights()
-{
- uint8_t const *const ROM = memregion("spot")->base();
- for (int i=0; i<4; i++)
- {
- for (int y=0; y<128; y++)
- {
- for (int x=0; x<16; x++)
- {
- int datapix = ROM[128*16*i + x + y*16];
- for(int b=0; b<8; b++)
- {
- m_tmp_bitmap[i]->pix(y, x*8 + (7 - b)) = (datapix & 1);
- datapix>>=1;
- }
- }
- }
- }
-}
-
-
-void pitnrun_state::pitnrun_palette(palette_device &palette) const
-{
- uint8_t const *const color_prom = memregion("proms")->base();
-
- for (int i = 0; i < 32*3; i++)
- {
- int bit0, bit1, bit2;
-
- bit0 = BIT(color_prom[i], 0);
- bit1 = BIT(color_prom[i], 1);
- bit2 = BIT(color_prom[i], 2);
- int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- bit0 = BIT(color_prom[i], 3);
- bit1 = BIT(color_prom[i], 4);
- bit2 = BIT(color_prom[i], 5);
- int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- bit0 = 0;
- bit1 = BIT(color_prom[i], 6);
- bit2 = BIT(color_prom[i], 7);
- int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- palette.set_pen_color(i, rgb_t(r, g, b));
- }
-
- // fake bg palette for lightning effect
- for (int i = 2*16; i < 2*16 + 16; i++)
- {
- int bit0, bit1, bit2;
-
- bit0 = BIT(color_prom[i], 0);
- bit1 = BIT(color_prom[i], 1);
- bit2 = BIT(color_prom[i], 2);
- int r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- bit0 = BIT(color_prom[i], 3);
- bit1 = BIT(color_prom[i], 4);
- bit2 = BIT(color_prom[i], 5);
- int g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- bit0 = 0;
- bit1 = BIT(color_prom[i], 6);
- bit2 = BIT(color_prom[i], 7);
- int b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- r /= 3;
- g /= 3;
- b /= 3;
-
- palette.set_pen_color(i + 16, (r > 0xff) ? 0xff : r, (g > 0xff) ? 0xff : g, (b > 0xff) ? 0xff : b);
-
- }
-}
-
-void pitnrun_state::video_start()
-{
- m_fg = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(pitnrun_state::get_tile_info1)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
- m_bg = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(pitnrun_state::get_tile_info2)), TILEMAP_SCAN_ROWS, 8, 8, 32*4, 32);
- m_fg->set_transparent_pen(0 );
- m_tmp_bitmap[0] = std::make_unique<bitmap_ind16>(128,128);
- m_tmp_bitmap[1] = std::make_unique<bitmap_ind16>(128,128);
- m_tmp_bitmap[2] = std::make_unique<bitmap_ind16>(128,128);
- m_tmp_bitmap[3] = std::make_unique<bitmap_ind16>(128,128);
- spotlights();
-
- save_item(NAME(m_h_heed));
- save_item(NAME(m_v_heed));
- save_item(NAME(m_ha));
- save_item(NAME(m_scroll));
- save_item(NAME(m_char_bank));
- save_item(NAME(m_color_select));
-}
-
-void pitnrun_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
-{
- uint8_t *spriteram = m_spriteram;
- int sx, sy, flipx, flipy, offs,pal;
-
- for (offs = 0 ; offs < 0x100; offs+=4)
- {
- pal=spriteram[offs+2]&0x3;
-
- sy = 256-spriteram[offs+0]-16;
- sx = spriteram[offs+3]+1; // +1 needed to properly align Jump Kun
- flipy = (spriteram[offs+1]&0x80)>>7;
- flipx = (spriteram[offs+1]&0x40)>>6;
-
- if (flip_screen_x())
- {
- sx = 256 - sx;
- flipx = !flipx;
- }
- if (flip_screen_y())
- {
- sy = 240 - sy;
- flipy = !flipy;
- }
-
- m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
- (spriteram[offs+1]&0x3f)+((spriteram[offs+2]&0x80)>>1)+((spriteram[offs+2]&0x40)<<1),
- pal,
- flipx,flipy,
- sx,sy,0);
- }
-}
-
-uint32_t pitnrun_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- int dx=0,dy=0;
- rectangle myclip=cliprect;
-
-#ifdef MAME_DEBUG
- if (machine().input().code_pressed_once(KEYCODE_Q))
- {
- uint8_t *ROM = memregion("maincpu")->base();
- ROM[0x84f6]=0; /* lap 0 - normal */
- }
-
- if (machine().input().code_pressed_once(KEYCODE_W))
- {
- uint8_t *ROM = memregion("maincpu")->base();
- ROM[0x84f6]=6; /* lap 6 = spotlight */
- }
-
- if (machine().input().code_pressed_once(KEYCODE_E))
- {
- uint8_t *ROM = memregion("maincpu")->base();
- ROM[0x84f6]=2; /* lap 3 (trial 2)= lightnings */
- ROM[0x8102]=1;
- }
-#endif
-
- bitmap.fill(0, cliprect);
-
- if(!(m_ha&4))
- m_bg->draw(screen, bitmap, cliprect, 0,0);
- else
- {
- dx=128-m_h_heed+((m_ha&8)<<5)+3;
- dy=128-m_v_heed+((m_ha&0x10)<<4);
-
- if (flip_screen_x())
- dx=128-dx+16;
-
- if (flip_screen_y())
- dy=128-dy;
-
- myclip.set(dx, dx+127, dy, dy+127);
- myclip &= cliprect;
-
- m_bg->draw(screen, bitmap, myclip, 0,0);
- }
-
- draw_sprites(bitmap,myclip);
-
- if(m_ha&4)
- copybitmap_trans(bitmap,*m_tmp_bitmap[m_ha&3],flip_screen_x(),flip_screen_y(),dx,dy,myclip, 1);
- m_fg->draw(screen, bitmap, cliprect, 0,0);
- return 0;
-}
diff --git a/src/mame/taito/rollrace.cpp b/src/mame/taito/rollrace.cpp
index 5bef99eb690..c78fb2ce10e 100644
--- a/src/mame/taito/rollrace.cpp
+++ b/src/mame/taito/rollrace.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:Pierpaolo Prazzoli
+// copyright-holders: Pierpaolo Prazzoli
+
/***************************************************************************
Fighting Roller (c) 1983 Kaneko
@@ -10,15 +11,311 @@ Issues:
***************************************************************************/
#include "emu.h"
-#include "rollrace.h"
#include "cpu/z80/z80.h"
#include "machine/74259.h"
#include "machine/gen_latch.h"
#include "sound/ay8910.h"
+
+#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+// configurable logging
+#define LOG_D900 (1U << 1)
+
+//#define VERBOSE (LOG_GENERAL | LOG_D900)
+
+#include "logmacro.h"
+
+#define LOGD900(...) LOGMASKED(LOG_D900, __VA_ARGS__)
+
+
+namespace {
+
+class rollrace_state : public driver_device
+{
+public:
+ rollrace_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette"),
+ m_videoram(*this, "videoram"),
+ m_colorram(*this, "colorram"),
+ m_spriteram(*this, "spriteram"),
+ m_roadlay_rom(*this, "road_layout")
+ { }
+
+ void rollace2(machine_config &config);
+ void rollrace(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
+private:
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+ required_shared_ptr<uint8_t> m_videoram;
+ required_shared_ptr<uint8_t> m_colorram;
+ required_shared_ptr<uint8_t> m_spriteram;
+ required_region_ptr<uint8_t> m_roadlay_rom;
+
+ tilemap_t *m_fg_tilemap = nullptr;
+ uint8_t m_bkgpage = 0;
+ uint8_t m_bkgflip = 0;
+ uint8_t m_chrbank = 0;
+ uint8_t m_bkgpen = 0;
+ uint8_t m_bkgcol = 0;
+ uint8_t m_flipy = 0;
+ uint8_t m_flipx = 0;
+ uint8_t m_spritebank = 0;
+
+ enum
+ {
+ RA_FGCHAR_BASE = 0,
+ RA_BGCHAR_BASE = 4,
+ RA_SP_BASE = 5
+ };
+
+ uint8_t m_nmi_mask = 0;
+ uint8_t m_sound_nmi_mask = 0;
+
+ uint8_t fake_d900_r();
+ void fake_d900_w(uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(nmi_mask_w);
+ void sound_nmi_mask_w(uint8_t data);
+ template <uint8_t Which> DECLARE_WRITE_LINE_MEMBER(coin_counter_w);
+ DECLARE_WRITE_LINE_MEMBER(charbank_0_w);
+ DECLARE_WRITE_LINE_MEMBER(charbank_1_w);
+ void bkgpen_w(uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(spritebank_w);
+ void backgroundpage_w(uint8_t data);
+ void backgroundcolor_w(uint8_t data);
+ void flipy_w(uint8_t data);
+ DECLARE_WRITE_LINE_MEMBER(flipx_w);
+ void vram_w(offs_t offset, uint8_t data);
+ void cram_w(offs_t offset, uint8_t data);
+ TILE_GET_INFO_MEMBER(get_fg_tile_info);
+ void tilemap_refresh_flip();
+
+ void palette(palette_device &palette) const;
+
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ DECLARE_WRITE_LINE_MEMBER(vblank_irq);
+ INTERRUPT_GEN_MEMBER(sound_timer_irq);
+ void main_map(address_map &map);
+ void sound_map(address_map &map);
+};
+
+
+// video
+
+TILE_GET_INFO_MEMBER(rollrace_state::get_fg_tile_info)
+{
+ int const code = m_videoram[tile_index];
+ int const color = m_colorram[(tile_index & 0x1f) * 2 + 1] & 0x1f;
+
+ tileinfo.set(RA_FGCHAR_BASE + m_chrbank,
+ code,
+ color,
+ TILE_FLIPY);
+}
+void rollrace_state::video_start()
+{
+ m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(rollrace_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+
+ m_fg_tilemap->set_transparent_pen(0);
+ m_fg_tilemap->set_scroll_cols(32);
+}
+
+void rollrace_state::vram_w(offs_t offset, uint8_t data)
+{
+ m_videoram[offset] = data;
+ m_fg_tilemap->mark_tile_dirty(offset);
+}
+
+void rollrace_state::cram_w(offs_t offset, uint8_t data)
+{
+ m_colorram[offset] = data;
+ if (offset & 1)
+ {
+ // TODO: optimize
+ m_fg_tilemap->mark_all_dirty();
+ //for(int x = 0; x < 32; x++)
+ // m_fg_tilemap->mark_tile_dirty(x + ((offset >> 1) * 32));
+ }
+ else
+ m_fg_tilemap->set_scrolly(offset >> 1,data);
+}
+
+/***************************************************************************
+
+ Convert the color PROMs into a more useable format.
+
+ Stinger has three 256x4 palette PROMs (one per gun).
+ The palette PROMs are connected to the RGB output this way:
+
+ bit 3 -- 100 ohm resistor -- RED/GREEN/BLUE
+ -- 220 ohm resistor -- RED/GREEN/BLUE
+ -- 470 ohm resistor -- RED/GREEN/BLUE
+ bit 0 -- 1 kohm resistor -- RED/GREEN/BLUE
+
+***************************************************************************/
+void rollrace_state::palette(palette_device &palette) const
+{
+ const uint8_t *color_prom = memregion("proms")->base();
+
+ for (int i = 0; i < palette.entries(); 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 + 0x42 * bit2 + 0x90 * bit3;
+
+ bit0 = BIT(color_prom[palette.entries()], 0);
+ bit1 = BIT(color_prom[palette.entries()], 1);
+ bit2 = BIT(color_prom[palette.entries()], 2);
+ bit3 = BIT(color_prom[palette.entries()], 3);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x42 * bit2 + 0x90 * bit3;
+
+ bit0 = BIT(color_prom[2 * palette.entries()], 0);
+ bit1 = BIT(color_prom[2 * palette.entries()], 1);
+ bit2 = BIT(color_prom[2 * palette.entries()], 2);
+ bit3 = BIT(color_prom[2 * palette.entries()], 3);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x42 * bit2 + 0x90 * bit3;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
+
+ color_prom++;
+ }
+}
+
+WRITE_LINE_MEMBER(rollrace_state::charbank_0_w)
+{
+ m_chrbank = state | (m_chrbank & 2);
+ m_fg_tilemap->mark_all_dirty();
+}
+
+WRITE_LINE_MEMBER(rollrace_state::charbank_1_w)
+{
+ m_chrbank = (m_chrbank & 1) | (state << 1);
+ m_fg_tilemap->mark_all_dirty();
+}
+
+void rollrace_state::bkgpen_w(uint8_t data)
+{
+ m_bkgpen = data;
+}
+
+WRITE_LINE_MEMBER(rollrace_state::spritebank_w)
+{
+ m_spritebank = state;
+}
+
+void rollrace_state::backgroundpage_w(uint8_t data)
+{
+ m_bkgpage = data & 0x1f;
+ m_bkgflip = (data & 0x80) >> 7;
+
+ // 0x80 flip vertical
+}
+
+void rollrace_state::backgroundcolor_w(uint8_t data)
+{
+ m_bkgcol = data;
+}
+
+void rollrace_state::flipy_w(uint8_t data)
+{
+ m_flipy = data & 0x01;
+ // bit 2: cleared at night stage in attract, unknown purpose
+}
+
+WRITE_LINE_MEMBER(rollrace_state::flipx_w)
+{
+ m_flipx = state;
+ m_fg_tilemap->set_flip(m_flipx ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
+}
+
+uint32_t rollrace_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ // fill in background colour
+ bitmap.fill(m_bkgpen, cliprect);
+
+ // draw road
+ for (int offs = 0x3ff; offs >= 0; offs--)
+ {
+ int sy;
+
+ if (!(m_bkgflip))
+ sy = (31 - offs / 32);
+ else
+ sy = (offs / 32);
+
+ int sx = (offs % 32);
+
+ if (m_flipx)
+ sx = 31 - sx;
+
+ if (m_flipy)
+ sy = 31 - sy;
+
+ m_gfxdecode->gfx(RA_BGCHAR_BASE)->transpen(bitmap,
+ cliprect,
+ m_roadlay_rom[offs + (m_bkgpage * 1024)]
+ + (((m_roadlay_rom[offs + 0x4000 + (m_bkgpage * 1024)] & 0xc0) >> 6) * 256),
+ m_bkgcol,
+ m_flipx, (m_bkgflip ^ m_flipy),
+ sx * 8, sy * 8, 0);
+ }
+
+ // sprites
+ for (int offs = 0x80-4; offs >=0x0; offs -= 4)
+ {
+ int s_flipy = 0;
+
+ int sy = m_spriteram[offs] - 16;
+ int sx = m_spriteram[offs + 3] - 16;
+
+ if (sx && sy)
+ {
+ if (m_flipx)
+ sx = 224 - sx;
+ if (m_flipy)
+ sy = 224 - sy;
+
+ if (m_spriteram[offs + 1] & 0x80)
+ s_flipy = 1;
+
+ int bank = ((m_spriteram[offs + 1] & 0x40 ) >> 6);
+
+ if (bank)
+ bank += m_spritebank;
+
+ m_gfxdecode->gfx(RA_SP_BASE + bank)->transpen(bitmap, cliprect,
+ m_spriteram[offs + 1] & 0x3f,
+ m_spriteram[offs + 2] & 0x1f,
+ m_flipx, !(s_flipy ^ m_flipy),
+ sx, sy, 0);
+ }
+ }
+
+ m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ return 0;
+}
+
+
+// machine
void rollrace_state::machine_start()
{
@@ -34,14 +331,14 @@ void rollrace_state::machine_start()
save_item(NAME(m_sound_nmi_mask));
}
-uint8_t rollrace_state::fake_d800_r()
+uint8_t rollrace_state::fake_d900_r()
{
return 0x51;
}
-void rollrace_state::fake_d800_w(uint8_t data)
+void rollrace_state::fake_d900_w(uint8_t data)
{
-/* logerror("d900: %02X\n",data);*/
+ LOGD900("d900: %02X\n", data);
}
WRITE_LINE_MEMBER(rollrace_state::nmi_mask_w)
@@ -56,28 +353,24 @@ void rollrace_state::sound_nmi_mask_w(uint8_t data)
m_sound_nmi_mask = data & 1;
}
-WRITE_LINE_MEMBER(rollrace_state::coin_counter_1_w)
-{
- machine().bookkeeping().coin_counter_w(0, state);
-}
-
-WRITE_LINE_MEMBER(rollrace_state::coin_counter_2_w)
+template <uint8_t Which>
+WRITE_LINE_MEMBER(rollrace_state::coin_counter_w)
{
- machine().bookkeeping().coin_counter_w(1, state);
+ machine().bookkeeping().coin_counter_w(Which, state);
}
-void rollrace_state::rollrace_map(address_map &map)
+void rollrace_state::main_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
- map(0x8000, 0x9fff).rom(); /* only rollace2 */
+ map(0x8000, 0x9fff).rom(); // only rollace2
map(0xc000, 0xcfff).ram();
- map(0xd806, 0xd806).nopr(); /* looks like a watchdog, bit4 checked*/
- map(0xd900, 0xd900).rw(FUNC(rollrace_state::fake_d800_r), FUNC(rollrace_state::fake_d800_w)); /* protection ??*/
- map(0xe000, 0xe3ff).ram().w(FUNC(rollrace_state::vram_w)).share("videoram");
- map(0xe400, 0xe47f).ram().w(FUNC(rollrace_state::cram_w)).share("colorram");
+ map(0xd806, 0xd806).nopr(); // looks like a watchdog, bit 4 checked
+ map(0xd900, 0xd900).rw(FUNC(rollrace_state::fake_d900_r), FUNC(rollrace_state::fake_d900_w)); // protection ??
+ map(0xe000, 0xe3ff).ram().w(FUNC(rollrace_state::vram_w)).share(m_videoram);
+ map(0xe400, 0xe47f).ram().w(FUNC(rollrace_state::cram_w)).share(m_colorram);
map(0xe800, 0xe800).w("soundlatch", FUNC(generic_latch_8_device::write));
- map(0xec00, 0xec0f).noprw(); /* Analog sound effects ?? ec00 sound enable ?*/
- map(0xf000, 0xf0ff).ram().share("spriteram");
+ map(0xec00, 0xec0f).noprw(); // Analog sound effects ?? ec00 sound enable ?
+ map(0xf000, 0xf0ff).ram().share(m_spriteram);
map(0xf400, 0xf400).w(FUNC(rollrace_state::backgroundcolor_w));
map(0xf800, 0xf800).portr("P1");
map(0xf801, 0xf801).portr("P2").w(FUNC(rollrace_state::bkgpen_w));
@@ -89,7 +382,7 @@ void rollrace_state::rollrace_map(address_map &map)
}
-void rollrace_state::rollrace_sound_map(address_map &map)
+void rollrace_state::sound_map(address_map &map)
{
map(0x0000, 0x0fff).rom();
map(0x2000, 0x2fff).ram();
@@ -156,14 +449,14 @@ static INPUT_PORTS_START( rollrace )
PORT_DIPSETTING( 0x10, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x18, DEF_STR( 1C_6C ) )
-/* PORT_BIT( 0x40, IP_ACTIVE_HIGH , IPT_CUSTOM ) PORT_VBLANK("screen") freezes frame, could be vblank ?*/
+// PORT_BIT( 0x40, IP_ACTIVE_HIGH , IPT_CUSTOM ) PORT_VBLANK("screen") freezes frame, could be vblank ?
PORT_DIPNAME( 0x40, 0x00, "Freeze" )
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x40, DEF_STR( On ) )
-/* PORT_DIPNAME( 0x80, 0x00, "Free Run" ) */
+// PORT_DIPNAME( 0x80, 0x00, "Free Run" )
PORT_DIPNAME( 0x80, 0x00, "Invulnerability (Cheat)" )
- PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) /* test mode, you are invulnerable */
- PORT_DIPSETTING( 0x80, DEF_STR( On ) ) /* to 'static' objects */
+ PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) // test mode, you are invulnerable
+ PORT_DIPSETTING( 0x80, DEF_STR( On ) ) // to 'static' objects
PORT_START("DSW2")
PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )
@@ -191,50 +484,50 @@ INPUT_PORTS_END
static const gfx_layout charlayout =
{
- 8,8, /* 8*8 characters */
- 256, /* 256 characters */
- 3, /* 3 bits per pixel */
- { 0,1024*8*8, 2*1024*8*8 }, /* the two bitplanes are separated */
+ 8,8, // 8*8 characters
+ 256, // 256 characters
+ 3, // 3 bits per pixel
+ { 0,1024*8*8, 2*1024*8*8 }, // the two bitplanes are separated
{ 0,1,2,3,4,5,6,7 },
{ 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
- 8*8 /* every char takes 8 consecutive bytes */
+ 8*8 // every char takes 8 consecutive bytes
};
static const gfx_layout charlayout2 =
{
- 8,8, /* 8*8 characters */
- 1024, /* 1024 characters */
- 3, /* 3 bits per pixel */
- { 0,1024*8*8, 2*1024*8*8 }, /* the two bitplanes are separated */
+ 8,8, // 8*8 characters
+ 1024, // 1024 characters
+ 3, // 3 bits per pixel
+ { 0,1024*8*8, 2*1024*8*8 }, // the two bitplanes are separated
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
// { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
- 8*8 /* every char takes 8 consecutive bytes */
+ 8*8 // every char takes 8 consecutive bytes
};
static const gfx_layout spritelayout =
{
- 32,32, /* 32*32 sprites */
- 64, /* 64 sprites */
- 3, /* 3 bits per pixel */
- { 0x4000*8, 0x2000*8, 0 }, /* the three bitplanes are separated */
+ 32,32, // 32*32 sprites
+ 64, // 64 sprites
+ 3, // 3 bits per pixel
+ { 0x4000*8, 0x2000*8, 0 }, // the three bitplanes are separated
{ 0, 1, 2, 3, 4, 5, 6, 7,
8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7,16*8,16*8+1,16*8+2,16*8+3,16*8+4,16*8+5,16*8+6,16*8+7,24*8,24*8+1,24*8+2,24*8+3,24*8+4,24*8+5,24*8+6,24*8+7},
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8,
64*8,65*8,66*8,67*8,68*8,69*8,70*8,71*8, 96*8,97*8,98*8,99*8,100*8,101*8,102*8,103*8 },
- 32*32 /* every sprite takes 128 consecutive bytes */
+ 32*32 // every sprite takes 128 consecutive bytes
};
static GFXDECODE_START( gfx_rollrace )
- GFXDECODE_ENTRY( "gfx1", 0x0000, charlayout, 0, 32 ) /* foreground */
- GFXDECODE_ENTRY( "gfx1", 0x0800, charlayout, 0, 32 )
- GFXDECODE_ENTRY( "gfx1", 0x1000, charlayout, 0, 32 )
- GFXDECODE_ENTRY( "gfx1", 0x1800, charlayout, 0, 32 )
- GFXDECODE_ENTRY( "gfx2", 0x0000, charlayout2, 0, 32 ) /* for the road */
- GFXDECODE_ENTRY( "gfx3", 0x0000, spritelayout, 0, 32 ) /* sprites */
- GFXDECODE_ENTRY( "gfx4", 0x0000, spritelayout, 0, 32 )
- GFXDECODE_ENTRY( "gfx5", 0x0000, spritelayout, 0, 32 )
+ GFXDECODE_ENTRY( "chars", 0x0000, charlayout, 0, 32 )
+ GFXDECODE_ENTRY( "chars", 0x0800, charlayout, 0, 32 )
+ GFXDECODE_ENTRY( "chars", 0x1000, charlayout, 0, 32 )
+ GFXDECODE_ENTRY( "chars", 0x1800, charlayout, 0, 32 )
+ GFXDECODE_ENTRY( "road", 0x0000, charlayout2, 0, 32 )
+ GFXDECODE_ENTRY( "sprites_0", 0x0000, spritelayout, 0, 32 )
+ GFXDECODE_ENTRY( "sprites_1", 0x0000, spritelayout, 0, 32 )
+ GFXDECODE_ENTRY( "sprites_2", 0x0000, spritelayout, 0, 32 )
GFXDECODE_END
WRITE_LINE_MEMBER(rollrace_state::vblank_irq)
@@ -245,33 +538,33 @@ WRITE_LINE_MEMBER(rollrace_state::vblank_irq)
INTERRUPT_GEN_MEMBER(rollrace_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 rollrace_state::rollrace(machine_config &config)
{
- /* basic machine hardware */
- Z80(config, m_maincpu, XTAL(24'000'000)/8); /* verified on pcb */
- m_maincpu->set_addrmap(AS_PROGRAM, &rollrace_state::rollrace_map);
+ // basic machine hardware
+ Z80(config, m_maincpu, XTAL(24'000'000) / 8); // verified on PCB
+ m_maincpu->set_addrmap(AS_PROGRAM, &rollrace_state::main_map);
- z80_device &audiocpu(Z80(config, "audiocpu", XTAL(24'000'000)/16)); /* verified on pcb */
- audiocpu.set_addrmap(AS_PROGRAM, &rollrace_state::rollrace_sound_map);
- audiocpu.set_periodic_int(FUNC(rollrace_state::sound_timer_irq), attotime::from_hz(4*60));
+ z80_device &audiocpu(Z80(config, "audiocpu", XTAL(24'000'000) / 16)); // verified on PCB
+ audiocpu.set_addrmap(AS_PROGRAM, &rollrace_state::sound_map);
+ audiocpu.set_periodic_int(FUNC(rollrace_state::sound_timer_irq), attotime::from_hz(4 * 60));
ls259_device &mainlatch(LS259(config, "mainlatch"));
mainlatch.q_out_cb<0>().set(FUNC(rollrace_state::flipx_w));
mainlatch.q_out_cb<1>().set(FUNC(rollrace_state::nmi_mask_w));
- mainlatch.q_out_cb<2>().set(FUNC(rollrace_state::coin_counter_1_w));
- mainlatch.q_out_cb<3>().set(FUNC(rollrace_state::coin_counter_2_w));
+ mainlatch.q_out_cb<2>().set(FUNC(rollrace_state::coin_counter_w<0>));
+ mainlatch.q_out_cb<3>().set(FUNC(rollrace_state::coin_counter_w<1>));
mainlatch.q_out_cb<4>().set(FUNC(rollrace_state::charbank_0_w));
mainlatch.q_out_cb<5>().set(FUNC(rollrace_state::charbank_1_w));
mainlatch.q_out_cb<6>().set(FUNC(rollrace_state::spritebank_w));
- /* 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(256, 256);
screen.set_visarea(0, 256-1, 16, 255-16);
screen.set_screen_update(FUNC(rollrace_state::screen_update));
@@ -279,26 +572,26 @@ void rollrace_state::rollrace(machine_config &config)
screen.screen_vblank().set(FUNC(rollrace_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_rollrace);
- PALETTE(config, m_palette, FUNC(rollrace_state::rollrace_palette), 256);
+ PALETTE(config, m_palette, FUNC(rollrace_state::palette), 256);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
GENERIC_LATCH_8(config, "soundlatch");
- AY8910(config, "ay1", XTAL(24'000'000)/16).add_route(ALL_OUTPUTS, "rspeaker", 0.10); /* verified on pcb */
+ AY8910(config, "ay1", XTAL(24'000'000) / 16).add_route(ALL_OUTPUTS, "rspeaker", 0.10); // verified on PCB
- AY8910(config, "ay2", XTAL(24'000'000)/16).add_route(ALL_OUTPUTS, "rspeaker", 0.10); /* verified on pcb */
+ AY8910(config, "ay2", XTAL(24'000'000) / 16).add_route(ALL_OUTPUTS, "rspeaker", 0.10); // verified on PCB
- AY8910(config, "ay3", XTAL(24'000'000)/16).add_route(ALL_OUTPUTS, "lspeaker", 0.10); /* verified on pcb */
+ AY8910(config, "ay3", XTAL(24'000'000) / 16).add_route(ALL_OUTPUTS, "lspeaker", 0.10); // verified on PCB
}
void rollrace_state::rollace2(machine_config &config)
{
rollrace(config);
- /* basic machine hardware */
+ // basic machine hardware
// subdevice<screen_device>("screen")->set_visarea(0, 256-1, 16, 255-16);
}
@@ -311,147 +604,149 @@ void rollrace_state::rollace2(machine_config &config)
***************************************************************************/
ROM_START( fightrol )
- ROM_REGION( 0x10000, "maincpu",0 )
+ ROM_REGION( 0xa000, "maincpu", 0 )
ROM_LOAD( "4.8k", 0x0000, 0x2000, CRC(efa2f430) SHA1(6aeb2a41e4fba97a0ac1b24fe5437e25b6c6b6c5) )
ROM_LOAD( "5.8h", 0x2000, 0x2000, CRC(2497d9f6) SHA1(4f4cfed47efc603bf057dd24b761beecf5b929f4) )
ROM_LOAD( "6.8f", 0x4000, 0x2000, CRC(f39727b9) SHA1(08a1300172b4100cb80c9a5d8942408255d8e330) )
ROM_LOAD( "7.8d", 0x6000, 0x2000, CRC(ee65b728) SHA1(871918d505ad8bab60c55bbb95fe37556a204dc9) )
- ROM_REGION( 0x6000,"gfx1",0 ) /* characters */
+ ROM_REGION( 0x6000, "chars", 0 )
ROM_LOAD( "3.7m", 0x0000, 0x2000, CRC(ca4f353c) SHA1(754838c6ad6886052a018966d55f40a7ed4b684d) )
ROM_LOAD( "2.8m", 0x2000, 0x2000, CRC(93786171) SHA1(3928aad8bc43adeaad5e53c1d4e9df64f1d23704) )
ROM_LOAD( "1.9m", 0x4000, 0x2000, CRC(dc072be1) SHA1(94d379a4c5a53050a18cd572cc82edb337182f3b) )
- ROM_REGION( 0x6000, "gfx2",0 ) /* road graphics */
+ ROM_REGION( 0x6000, "road", 0 )
ROM_LOAD ( "6.20k", 0x0000, 0x2000, CRC(003d7515) SHA1(d8d84d690478cad16101f2ef9a1ae1ae74d01c88) )
ROM_LOAD ( "7.18k", 0x2000, 0x2000, CRC(27843afa) SHA1(81d3031a2c06086461110696a0ee11d32992ecac) )
ROM_LOAD ( "5.20f", 0x4000, 0x2000, CRC(51dd0108) SHA1(138c0aba6c952204e794216193def17b390c4ba2) )
- ROM_REGION( 0x6000, "gfx3",0 ) /* sprite bank 0*/
+ ROM_REGION( 0x6000, "sprites_0", 0 )
ROM_LOAD ( "8.17m", 0x0000, 0x2000, CRC(08ad783e) SHA1(fea91e41916cfc7b29c5f9a578e2c82a54f66829) )
ROM_LOAD ( "9.17r", 0x2000, 0x2000, CRC(69b23461) SHA1(73eca5e721425f37df311454bd5b4e632b096eba) )
ROM_LOAD ( "10.17t", 0x4000, 0x2000, CRC(ba6ccd8c) SHA1(29a13e3161aba4db080434685869f8b79ad7997c) )
- ROM_REGION( 0x6000, "gfx4",0 ) /* sprite bank 1*/
+ ROM_REGION( 0x6000, "sprites_1", 0 )
ROM_LOAD ( "11.18m", 0x0000, 0x2000, CRC(06a5d849) SHA1(b9f604edf4fdc053b738041493aef91dd730fe6b) )
ROM_LOAD ( "12.18r", 0x2000, 0x2000, CRC(569815ef) SHA1(db261799892f60b2274b73fb25cde58219bb44db) )
ROM_LOAD ( "13.18t", 0x4000, 0x2000, CRC(4f8af872) SHA1(6c07ff0733b8d8440309c9ae0db0876587b740a6) )
- ROM_REGION( 0x6000, "gfx5",0 ) /* sprite bank 2*/
+ ROM_REGION( 0x6000, "sprites_2", 0 )
ROM_LOAD ( "14.19m", 0x0000, 0x2000, CRC(93f3c649) SHA1(38d6bb4b6108a67b135ae1a145532f4a0c2568b8) )
ROM_LOAD ( "15.19r", 0x2000, 0x2000, CRC(5b3d87e4) SHA1(e47f7b62bf7101afba8d5e181f4bd8f8eb6eeb08) )
ROM_LOAD ( "16.19u", 0x4000, 0x2000, CRC(a2c24b64) SHA1(e76558785ea337ab902fb6f94dc1a4bdfcd6335e) )
- ROM_REGION( 0x8000, "user1",0 ) /* road layout */
+ ROM_REGION( 0x8000, "road_layout", 0 )
ROM_LOAD ( "1.17a", 0x0000, 0x2000, CRC(f0fa72fc) SHA1(b73e794df635630f29a79adfe2951dc8f1d17e20) )
ROM_LOAD ( "3.18b", 0x2000, 0x2000, CRC(954268f7) SHA1(07057296e0281f90b18dfe4223aad18bff7cfa6e) )
ROM_LOAD ( "2.17d", 0x4000, 0x2000, CRC(2e38bb0e) SHA1(684f14a06ff957e40780be21c0ad5f10088a55ed) )
ROM_LOAD ( "4.18d", 0x6000, 0x2000, CRC(3d9e16ab) SHA1(e99628ffc54e3ff4818313a287ca111617120910) )
- ROM_REGION( 0x300, "proms",0 ) /* colour */
+ ROM_REGION( 0x300, "proms", 0 ) // colour
ROM_LOAD("tbp24s10.7u", 0x0000, 0x0100, CRC(9d199d33) SHA1(b8982f7da2b85f10d117177e4e73cbb486931cf5) )
ROM_LOAD("tbp24s10.7t", 0x0100, 0x0100, CRC(c0426582) SHA1(8e3e4d1e76243cce272aa099d2d6ad4fa6c99f7c) )
ROM_LOAD("tbp24s10.6t", 0x0200, 0x0100, CRC(c096e05c) SHA1(cb5b509e6124453f381a683ba446f8f4493d4610) )
- ROM_REGION( 0x10000,"audiocpu",0 )
+ ROM_REGION( 0x1000, "audiocpu", 0 )
ROM_LOAD( "8.6f", 0x0000, 0x1000, CRC(6ec3c545) SHA1(1a2477b9e1563734195b0743f5dbbb005e06022e) )
ROM_END
ROM_START( rollace )
- ROM_REGION( 0x10000, "maincpu",0 )
+ ROM_REGION( 0xa000, "maincpu", 0 )
ROM_LOAD( "w1.8k", 0x0000, 0x2000, CRC(c0bd3cf3) SHA1(a44d69b8c3249b5093261a32d0e0404992fa7f7a) )
ROM_LOAD( "w2.8h", 0x2000, 0x2000, CRC(c1900a75) SHA1(f7ec968b6bcb6ee6db98628cdf566ae0a501edba) )
ROM_LOAD( "w3.8f", 0x4000, 0x2000, CRC(16ceced6) SHA1(241119959ffdf26780258bcc5651eca0c6a6128f) )
ROM_LOAD( "w4.8d", 0x6000, 0x2000, CRC(ae826a96) SHA1(47979343c9fa7629ba6d62630c7c3fdfa2c8c28a) )
- ROM_REGION( 0x6000,"gfx1",0 ) /* characters */
+ ROM_REGION( 0x6000, "chars", 0 )
ROM_LOAD( "w3.7m", 0x0000, 0x2000, CRC(f9970aae) SHA1(ccb806cab3d3817c779e048f995d1f6fbe163679) )
ROM_LOAD( "w2.8m", 0x2000, 0x2000, CRC(80573091) SHA1(ea352abebc428db9e89eda5f369a3b1086aa8970) )
ROM_LOAD( "w1.9m", 0x4000, 0x2000, CRC(b37effd8) SHA1(d77d56d734834812b8d9b3c156577dbbcb2deac8) )
- ROM_REGION( 0x6000, "gfx2",0 ) /* road graphics */
+ ROM_REGION( 0x6000, "road", 0 )
ROM_LOAD ( "6.20k", 0x0000, 0x2000, CRC(003d7515) SHA1(d8d84d690478cad16101f2ef9a1ae1ae74d01c88) )
ROM_LOAD ( "7.18k", 0x2000, 0x2000, CRC(27843afa) SHA1(81d3031a2c06086461110696a0ee11d32992ecac) )
ROM_LOAD ( "5.20f", 0x4000, 0x2000, CRC(51dd0108) SHA1(138c0aba6c952204e794216193def17b390c4ba2) )
- ROM_REGION( 0x6000, "gfx3",0 ) /* sprite bank 0*/
+ ROM_REGION( 0x6000, "sprites_0", 0 )
ROM_LOAD ( "w8.17m", 0x0000, 0x2000, CRC(e2afe3a3) SHA1(a83a12c0c6c62e45add916a6993f0ad06840c4d9) )
ROM_LOAD ( "w9.17p", 0x2000, 0x2000, CRC(8a8e6b62) SHA1(6e7d4a84b7c78e009bce0641e357f74c8ac9e5ac) )
ROM_LOAD ( "w10.17t", 0x4000, 0x2000, CRC(70bf7b23) SHA1(6774eceb0bfea66156ecd837f9d0adbdf8dec8ee) )
- ROM_REGION( 0x6000, "gfx4",0 ) /* sprite bank 1*/
+ ROM_REGION( 0x6000, "sprites_1", 0 )
ROM_LOAD ( "11.18m", 0x0000, 0x2000, CRC(06a5d849) SHA1(b9f604edf4fdc053b738041493aef91dd730fe6b) )
ROM_LOAD ( "12.18r", 0x2000, 0x2000, CRC(569815ef) SHA1(db261799892f60b2274b73fb25cde58219bb44db) )
ROM_LOAD ( "13.18t", 0x4000, 0x2000, CRC(4f8af872) SHA1(6c07ff0733b8d8440309c9ae0db0876587b740a6) )
- ROM_REGION( 0x6000, "gfx5",0 ) /* sprite bank 2*/
+ ROM_REGION( 0x6000, "sprites_2", 0 )
ROM_LOAD ( "14.19m", 0x0000, 0x2000, CRC(93f3c649) SHA1(38d6bb4b6108a67b135ae1a145532f4a0c2568b8) )
ROM_LOAD ( "15.19r", 0x2000, 0x2000, CRC(5b3d87e4) SHA1(e47f7b62bf7101afba8d5e181f4bd8f8eb6eeb08) )
ROM_LOAD ( "16.19u", 0x4000, 0x2000, CRC(a2c24b64) SHA1(e76558785ea337ab902fb6f94dc1a4bdfcd6335e) )
- ROM_REGION( 0x8000, "user1",0 ) /* road layout */
+ ROM_REGION( 0x8000, "road_layout", 0 )
ROM_LOAD ( "1.17a", 0x0000, 0x2000, CRC(f0fa72fc) SHA1(b73e794df635630f29a79adfe2951dc8f1d17e20) )
ROM_LOAD ( "3.18b", 0x2000, 0x2000, CRC(954268f7) SHA1(07057296e0281f90b18dfe4223aad18bff7cfa6e) )
ROM_LOAD ( "2.17d", 0x4000, 0x2000, CRC(2e38bb0e) SHA1(684f14a06ff957e40780be21c0ad5f10088a55ed) )
ROM_LOAD ( "4.18d", 0x6000, 0x2000, CRC(3d9e16ab) SHA1(e99628ffc54e3ff4818313a287ca111617120910) )
- ROM_REGION( 0x300, "proms",0 ) /* colour */
+ ROM_REGION( 0x300, "proms", 0 ) // colour
ROM_LOAD("tbp24s10.7u", 0x0000, 0x0100, CRC(9d199d33) SHA1(b8982f7da2b85f10d117177e4e73cbb486931cf5) )
ROM_LOAD("tbp24s10.7t", 0x0100, 0x0100, CRC(c0426582) SHA1(8e3e4d1e76243cce272aa099d2d6ad4fa6c99f7c) )
ROM_LOAD("tbp24s10.6t", 0x0200, 0x0100, CRC(c096e05c) SHA1(cb5b509e6124453f381a683ba446f8f4493d4610) )
- ROM_REGION( 0x10000,"audiocpu",0 )
+ ROM_REGION( 0x1000, "audiocpu", 0 )
ROM_LOAD( "8.6f", 0x0000, 0x1000, CRC(6ec3c545) SHA1(1a2477b9e1563734195b0743f5dbbb005e06022e) )
ROM_END
ROM_START( rollace2 )
- ROM_REGION( 0x10000, "maincpu",0 )
+ ROM_REGION( 0xa000, "maincpu", 0 )
ROM_LOAD( "8k.764", 0x0000, 0x2000, CRC(a7abff82) SHA1(d49635f98b28b2b5e2833d25b0961addac2c3e6f) )
ROM_LOAD( "8h.764", 0x2000, 0x2000, CRC(9716ba03) SHA1(8a7bfc1dce3b1b0c634690e0637e0a30776c0334) )
ROM_LOAD( "8f.764", 0x4000, 0x2000, CRC(3eadb0e8) SHA1(6ff5b76360597f3a6a9718e505295c8557e569ae) )
ROM_LOAD( "8d.764", 0x6000, 0x2000, CRC(baac14db) SHA1(9707b59a6506eb11c0a6b88364a784469ccdbb96) )
ROM_LOAD( "8c.764", 0x8000, 0x2000, CRC(b418ce84) SHA1(876be297a671328138a9238d42871f22bb568cda) )
- ROM_REGION( 0x6000,"gfx1",0 ) /* characters */
+ ROM_REGION( 0x6000, "chars", 0 )
ROM_LOAD( "7m.764", 0x0000, 0x2000, CRC(8b9b27af) SHA1(a52894adb739f14a5949b6d15dd7b03ce5716d9a) )
ROM_LOAD( "8m.764", 0x2000, 0x2000, CRC(2dfc38f2) SHA1(c0ad3a7d1f5249c159c355d709cc3039fbb7a3b2) )
ROM_LOAD( "9m.764", 0x4000, 0x2000, CRC(2e3a825b) SHA1(d0d25d9a0fe31d46cb6cc999da3d9fc14f23251f) )
- ROM_REGION( 0x6000, "gfx2",0 ) /* road graphics */
+ ROM_REGION( 0x6000, "road", 0 )
ROM_LOAD ( "6.20k", 0x0000, 0x2000, CRC(003d7515) SHA1(d8d84d690478cad16101f2ef9a1ae1ae74d01c88) )
ROM_LOAD ( "7.18k", 0x2000, 0x2000, CRC(27843afa) SHA1(81d3031a2c06086461110696a0ee11d32992ecac) )
ROM_LOAD ( "5.20f", 0x4000, 0x2000, CRC(51dd0108) SHA1(138c0aba6c952204e794216193def17b390c4ba2) )
- ROM_REGION( 0x6000, "gfx3",0 ) /* sprite bank 0*/
- ROM_LOAD ( "17n.764",0x0000, 0x2000, CRC(3365703c) SHA1(7cf374ba25f4fd163a66c0aea74ddfd3003c7992) )
- ROM_LOAD ( "9.17r", 0x2000, 0x2000, CRC(69b23461) SHA1(73eca5e721425f37df311454bd5b4e632b096eba) )
- ROM_LOAD ( "17t.764",0x4000, 0x2000, CRC(5e84cc9b) SHA1(33cdf7b756ade8c0dd1dcdad583af4de02cd51eb) )
+ ROM_REGION( 0x6000, "sprites_0", 0 )
+ ROM_LOAD ( "17n.764", 0x0000, 0x2000, CRC(3365703c) SHA1(7cf374ba25f4fd163a66c0aea74ddfd3003c7992) )
+ ROM_LOAD ( "9.17r", 0x2000, 0x2000, CRC(69b23461) SHA1(73eca5e721425f37df311454bd5b4e632b096eba) )
+ ROM_LOAD ( "17t.764", 0x4000, 0x2000, CRC(5e84cc9b) SHA1(33cdf7b756ade8c0dd1dcdad583af4de02cd51eb) )
- ROM_REGION( 0x6000, "gfx4",0 ) /* sprite bank 1*/
+ ROM_REGION( 0x6000, "sprites_1", 0 )
ROM_LOAD ( "11.18m", 0x0000, 0x2000, CRC(06a5d849) SHA1(b9f604edf4fdc053b738041493aef91dd730fe6b) )
ROM_LOAD ( "12.18r", 0x2000, 0x2000, CRC(569815ef) SHA1(db261799892f60b2274b73fb25cde58219bb44db) )
ROM_LOAD ( "13.18t", 0x4000, 0x2000, CRC(4f8af872) SHA1(6c07ff0733b8d8440309c9ae0db0876587b740a6) )
- ROM_REGION( 0x6000, "gfx5",0 ) /* sprite bank 2*/
+ ROM_REGION( 0x6000, "sprites_2", 0 )
ROM_LOAD ( "14.19m", 0x0000, 0x2000, CRC(93f3c649) SHA1(38d6bb4b6108a67b135ae1a145532f4a0c2568b8) )
ROM_LOAD ( "15.19r", 0x2000, 0x2000, CRC(5b3d87e4) SHA1(e47f7b62bf7101afba8d5e181f4bd8f8eb6eeb08) )
ROM_LOAD ( "16.19u", 0x4000, 0x2000, CRC(a2c24b64) SHA1(e76558785ea337ab902fb6f94dc1a4bdfcd6335e) )
- ROM_REGION( 0x8000, "user1",0 ) /* road layout */
- ROM_LOAD ( "1.17a", 0x0000, 0x2000, CRC(f0fa72fc) SHA1(b73e794df635630f29a79adfe2951dc8f1d17e20) )
- ROM_LOAD ( "3.18b", 0x2000, 0x2000, CRC(954268f7) SHA1(07057296e0281f90b18dfe4223aad18bff7cfa6e) )
- ROM_LOAD ( "17d.764",0x4000, 0x2000, CRC(32e69320) SHA1(d399a8c3b0319178d75f68f1a9b65b3efd91e00a) )
- ROM_LOAD ( "4.18d", 0x6000, 0x2000, CRC(3d9e16ab) SHA1(e99628ffc54e3ff4818313a287ca111617120910) )
+ ROM_REGION( 0x8000, "road_layout", 0 )
+ ROM_LOAD ( "1.17a", 0x0000, 0x2000, CRC(f0fa72fc) SHA1(b73e794df635630f29a79adfe2951dc8f1d17e20) )
+ ROM_LOAD ( "3.18b", 0x2000, 0x2000, CRC(954268f7) SHA1(07057296e0281f90b18dfe4223aad18bff7cfa6e) )
+ ROM_LOAD ( "17d.764", 0x4000, 0x2000, CRC(32e69320) SHA1(d399a8c3b0319178d75f68f1a9b65b3efd91e00a) )
+ ROM_LOAD ( "4.18d", 0x6000, 0x2000, CRC(3d9e16ab) SHA1(e99628ffc54e3ff4818313a287ca111617120910) )
- ROM_REGION( 0x300, "proms",0 ) /* colour */
+ ROM_REGION( 0x300, "proms", 0 ) // colour
ROM_LOAD("tbp24s10.7u", 0x0000, 0x0100, CRC(9d199d33) SHA1(b8982f7da2b85f10d117177e4e73cbb486931cf5) )
ROM_LOAD("tbp24s10.7t", 0x0100, 0x0100, CRC(c0426582) SHA1(8e3e4d1e76243cce272aa099d2d6ad4fa6c99f7c) )
ROM_LOAD("tbp24s10.6t", 0x0200, 0x0100, CRC(c096e05c) SHA1(cb5b509e6124453f381a683ba446f8f4493d4610) )
- ROM_REGION( 0x10000,"audiocpu",0 )
+ ROM_REGION( 0x1000, "audiocpu", 0 )
ROM_LOAD( "8.6f", 0x0000, 0x1000, CRC(6ec3c545) SHA1(1a2477b9e1563734195b0743f5dbbb005e06022e) )
ROM_END
+} // anonymous namespace
+
GAME( 1983, fightrol, 0, rollrace, rollrace, rollrace_state, empty_init, ROT270, "Kaneko (Taito license)", "Fighting Roller", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1983, rollace, fightrol, rollrace, rollrace, rollrace_state, empty_init, ROT270, "Kaneko (Williams license)", "Roller Aces (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/taito/rollrace.h b/src/mame/taito/rollrace.h
deleted file mode 100644
index 2da99cf72e3..00000000000
--- a/src/mame/taito/rollrace.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Pierpaolo Prazzoli
-#ifndef MAME_INCLUDES_ROLLRACE_H
-#define MAME_INCLUDES_ROLLRACE_H
-
-#pragma once
-
-#include "emupal.h"
-#include "tilemap.h"
-
-class rollrace_state : public driver_device
-{
-public:
- rollrace_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
- m_videoram(*this, "videoram"),
- m_colorram(*this, "colorram"),
- m_spriteram(*this, "spriteram")
- { }
-
- void rollace2(machine_config &config);
- void rollrace(machine_config &config);
-
-protected:
- virtual void machine_start() override;
- virtual void video_start() override;
-
-private:
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
- required_shared_ptr<uint8_t> m_videoram;
- required_shared_ptr<uint8_t> m_colorram;
- required_shared_ptr<uint8_t> m_spriteram;
-
- tilemap_t *m_fg_tilemap = nullptr;
- int m_bkgpage = 0;
- int m_bkgflip = 0;
- int m_chrbank = 0;
- int m_bkgpen = 0;
- int m_bkgcol = 0;
- int m_flipy = 0;
- int m_flipx = 0;
- int m_spritebank = 0;
-
- uint8_t m_nmi_mask = 0;
- uint8_t m_sound_nmi_mask = 0;
-
- uint8_t fake_d800_r();
- void fake_d800_w(uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(nmi_mask_w);
- void sound_nmi_mask_w(uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w);
- DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w);
- DECLARE_WRITE_LINE_MEMBER(charbank_0_w);
- DECLARE_WRITE_LINE_MEMBER(charbank_1_w);
- void bkgpen_w(uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(spritebank_w);
- void backgroundpage_w(uint8_t data);
- void backgroundcolor_w(uint8_t data);
- void flipy_w(uint8_t data);
- DECLARE_WRITE_LINE_MEMBER(flipx_w);
- void vram_w(offs_t offset, uint8_t data);
- void cram_w(offs_t offset, uint8_t data);
- TILE_GET_INFO_MEMBER(get_fg_tile_info);
- void tilemap_refresh_flip();
-
- void rollrace_palette(palette_device &palette) const;
-
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
-
- DECLARE_WRITE_LINE_MEMBER(vblank_irq);
- INTERRUPT_GEN_MEMBER(sound_timer_irq);
- void rollrace_map(address_map &map);
- void rollrace_sound_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_ROLLRACE_H
diff --git a/src/mame/taito/rollrace_v.cpp b/src/mame/taito/rollrace_v.cpp
deleted file mode 100644
index a96a6aa52fc..00000000000
--- a/src/mame/taito/rollrace_v.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Pierpaolo Prazzoli
-#include "emu.h"
-#include "rollrace.h"
-
-
-#define RA_FGCHAR_BASE 0
-#define RA_BGCHAR_BASE 4
-#define RA_SP_BASE 5
-
-
-TILE_GET_INFO_MEMBER(rollrace_state::get_fg_tile_info)
-{
- int code = m_videoram[tile_index];
- int color = m_colorram[(tile_index & 0x1f)*2+1] & 0x1f;
-
- tileinfo.set(RA_FGCHAR_BASE + m_chrbank,
- code,
- color,
- TILE_FLIPY);
-}
-
-void rollrace_state::video_start()
-{
- m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(rollrace_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
-
- m_fg_tilemap->set_transparent_pen(0);
- m_fg_tilemap->set_scroll_cols(32);
-}
-
-void rollrace_state::vram_w(offs_t offset, uint8_t data)
-{
- m_videoram[offset] = data;
- m_fg_tilemap->mark_tile_dirty(offset);
-}
-
-void rollrace_state::cram_w(offs_t offset, uint8_t data)
-{
- m_colorram[offset] = data;
- if(offset & 1)
- {
- // TODO: optimize
- m_fg_tilemap->mark_all_dirty();
- //for(int x = 0; x < 32; x++)
- // m_fg_tilemap->mark_tile_dirty(x + ((offset >> 1)*32));
- }
- else
- m_fg_tilemap->set_scrolly(offset >> 1,data);
-}
-
-/***************************************************************************
-
- Convert the color PROMs into a more useable format.
-
- Stinger has three 256x4 palette PROMs (one per gun).
- The palette PROMs are connected to the RGB output this way:
-
- bit 3 -- 100 ohm resistor -- RED/GREEN/BLUE
- -- 220 ohm resistor -- RED/GREEN/BLUE
- -- 470 ohm resistor -- RED/GREEN/BLUE
- bit 0 -- 1 kohm resistor -- RED/GREEN/BLUE
-
-***************************************************************************/
-void rollrace_state::rollrace_palette(palette_device &palette) const
-{
- const uint8_t *color_prom = memregion("proms")->base();
-
- for (int i = 0; i < palette.entries(); 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 + 0x42 * bit2 + 0x90 * bit3;
-
- bit0 = BIT(color_prom[palette.entries()], 0);
- bit1 = BIT(color_prom[palette.entries()], 1);
- bit2 = BIT(color_prom[palette.entries()], 2);
- bit3 = BIT(color_prom[palette.entries()], 3);
- int const g = 0x0e * bit0 + 0x1f * bit1 + 0x42 * bit2 + 0x90 * bit3;
-
- bit0 = BIT(color_prom[2 * palette.entries()], 0);
- bit1 = BIT(color_prom[2 * palette.entries()], 1);
- bit2 = BIT(color_prom[2 * palette.entries()], 2);
- bit3 = BIT(color_prom[2 * palette.entries()], 3);
- int const b = 0x0e * bit0 + 0x1f * bit1 + 0x42 * bit2 + 0x90 * bit3;
-
- palette.set_pen_color(i, rgb_t(r, g, b));
-
- color_prom++;
- }
-}
-
-WRITE_LINE_MEMBER(rollrace_state::charbank_0_w)
-{
- m_chrbank = state | (m_chrbank & 2);
- m_fg_tilemap->mark_all_dirty();
-}
-
-WRITE_LINE_MEMBER(rollrace_state::charbank_1_w)
-{
- m_chrbank = (m_chrbank & 1) | (state << 1);
- m_fg_tilemap->mark_all_dirty();
-}
-
-void rollrace_state::bkgpen_w(uint8_t data)
-{
- m_bkgpen = data;
-}
-
-WRITE_LINE_MEMBER(rollrace_state::spritebank_w)
-{
- m_spritebank = state;
-}
-
-void rollrace_state::backgroundpage_w(uint8_t data)
-{
- m_bkgpage = data & 0x1f;
- m_bkgflip = ( data & 0x80 ) >> 7;
-
- /* 0x80 flip vertical */
-}
-
-void rollrace_state::backgroundcolor_w(uint8_t data)
-{
- m_bkgcol = data;
-}
-
-void rollrace_state::flipy_w(uint8_t data)
-{
- m_flipy = data & 0x01;
- // bit 2: cleared at night stage in attract, unknown purpose
-}
-
-WRITE_LINE_MEMBER(rollrace_state::flipx_w)
-{
- m_flipx = state;
- m_fg_tilemap->set_flip(m_flipx ? TILEMAP_FLIPX|TILEMAP_FLIPY : 0);
-}
-
-uint32_t rollrace_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- uint8_t *spriteram = m_spriteram;
- int offs;
- int sx, sy;
- const uint8_t *mem = memregion("user1")->base();
-
- /* fill in background colour*/
- bitmap.fill(m_bkgpen, cliprect);
-
- /* draw road */
- for (offs = 0x3ff; offs >= 0; offs--)
- {
- if(!(m_bkgflip))
- sy = ( 31 - offs / 32 ) ;
- else
- sy = ( offs / 32 ) ;
-
- sx = ( offs%32 ) ;
-
- if(m_flipx)
- sx = 31-sx ;
-
- if(m_flipy)
- sy = 31-sy ;
-
- m_gfxdecode->gfx(RA_BGCHAR_BASE)->transpen(bitmap,
- cliprect,
- mem[offs + ( m_bkgpage * 1024 )]
- + ((( mem[offs + 0x4000 + ( m_bkgpage * 1024 )] & 0xc0 ) >> 6 ) * 256 ) ,
- m_bkgcol,
- m_flipx,(m_bkgflip^m_flipy),
- sx*8,sy*8,0);
- }
-
- /* sprites */
- for ( offs = 0x80-4 ; offs >=0x0 ; offs -= 4)
- {
- int s_flipy = 0;
- int bank = 0;
-
- sy=spriteram[offs] - 16;
- sx=spriteram[offs+3] - 16;
-
- if(sx && sy)
- {
- if(m_flipx)
- sx = 224 - sx;
- if(m_flipy)
- sy = 224 - sy;
-
- if(spriteram[offs+1] & 0x80)
- s_flipy = 1;
-
- bank = (( spriteram[offs+1] & 0x40 ) >> 6 ) ;
-
- if(bank)
- bank += m_spritebank;
-
- m_gfxdecode->gfx( RA_SP_BASE + bank )->transpen(bitmap,cliprect,
- spriteram[offs+1] & 0x3f ,
- spriteram[offs+2] & 0x1f,
- m_flipx,!(s_flipy^m_flipy),
- sx,sy,0);
- }
- }
-
- m_fg_tilemap->draw(screen,bitmap,cliprect,0,0);
- return 0;
-}
diff --git a/src/mame/taito/ssrj.cpp b/src/mame/taito/ssrj.cpp
index 0c43a4e4508..a69ceff597d 100644
--- a/src/mame/taito/ssrj.cpp
+++ b/src/mame/taito/ssrj.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:Tomasz Slanina
+// copyright-holders: Tomasz Slanina
+
/***********************************
Super Speed Race Jr (c) 1985 Taito
driver by Tomasz Slanina
@@ -31,13 +32,313 @@ HW info :
************************************/
#include "emu.h"
-#include "ssrj.h"
#include "cpu/z80/z80.h"
#include "sound/ay8910.h"
+#include "video/bufsprite.h"
+
+#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+#include "tilemap.h"
+
+
+namespace {
+
+class ssrj_state : public driver_device
+{
+public:
+ ssrj_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette"),
+ m_buffered_spriteram(*this, "scrollram"),
+ m_vram(*this, "vram%u", 1U),
+ m_in1(*this, "IN1")
+ { }
+
+ void ssrj(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+private:
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+ required_device<buffered_spriteram8_device> m_buffered_spriteram;
+
+ required_shared_ptr_array<uint8_t, 4> m_vram;
+
+ required_ioport m_in1;
+
+ int16_t m_oldport = 0;
+ tilemap_t *m_tilemap[4]{};
+
+ uint8_t wheel_r();
+ template <uint8_t Which> void vram_w(offs_t offset, uint8_t data);
+
+ template <uint8_t Which> TILE_GET_INFO_MEMBER(get_tile_info);
+
+ void palette(palette_device &palette) const;
+
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ DECLARE_WRITE_LINE_MEMBER(screen_vblank);
+ void draw_objects(bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ void prg_map(address_map &map);
+};
+
+
+// video
+
+
+template <uint8_t Which>
+void ssrj_state::vram_w(offs_t offset, uint8_t data)
+{
+ m_vram[Which][offset] = data;
+ m_tilemap[Which]->mark_tile_dirty(offset >> 1);
+}
+
+template <uint8_t Which>
+TILE_GET_INFO_MEMBER(ssrj_state::get_tile_info)
+{
+ int const code = m_vram[Which][tile_index << 1] + (m_vram[Which][(tile_index << 1) + 1] << 8);
+ tileinfo.set(0,
+ code & 0x3ff,
+ ((code >> 12) & 0x3) + Which * 4,
+ ((code & 0x8000) ? TILE_FLIPY : 0) |( (code & 0x4000) ? TILE_FLIPX : 0));
+}
+
+/*
+TODO: This table is nowhere near as accurate. If you bother, here's how colors should be:
+-"START" sign is red with dark blue background.
+-Sidewalk is yellow-ish.
+-first opponents have swapped colors (blue/yellow instead of yellow/blue)
+-after the first stage, houses have red/white colors.
+*/
+
+static constexpr rgb_t fakecols[4 * 4][8] =
+{
+{{0x00,0x00,0x00},
+ {42,87,140},
+ {0,0,0},
+ {33,75,160},
+ {0xff,0xff,0xff},
+ {37,56,81},
+ {0x1f,0x1f,0x2f},
+ {55,123,190}},
+
+{{0x00,0x00,0x00},
+ {0x00,99,41},
+ {0x00,0x00,0xff},
+ {0x00,0xff,0},
+ {255,255,255},
+ {0xff,0x00,0x00},
+ {0,45,105},
+ {0xff,0xff,0}},
+
+
+{{0x00,0x00,0x00},
+ {0x00,0x20,0x00},
+ {0x00,0x40,0x00},
+ {0x00,0x60,0x00},
+ {0x00,0x80,0x00},
+ {0x00,0xa0,0x00},
+ {0x00,0xc0,0x00},
+ {0x00,0xf0,0x00}},
+
+ {{0x00,0x00,0x00},
+ {0x20,0x00,0x20},
+ {0x40,0x00,0x40},
+ {0x60,0x00,0x60},
+ {0x80,0x00,0x80},
+ {0xa0,0x00,0xa0},
+ {0xc0,0x00,0xc0},
+ {0xf0,0x00,0xf0}},
+
+{{0x00,0x00,0x00},
+ {0xff,0x00,0x00},
+ {0x7f,0x00,0x00},
+ {0x00,0x00,0x00},
+ {0x00,0x00,0x00},
+ {0xaf,0x00,0x00},
+ {0xff,0xff,0xff},
+ {0xff,0x7f,0x7f}},
+
+{{0x00,0x00,0x00},
+ {0x20,0x20,0x20},
+ {0x40,0x40,0x40},
+ {0x60,0x60,0x60},
+ {0x80,0x80,0x80},
+ {0xa0,0xa0,0xa0},
+ {0xc0,0xc0,0xc0},
+ {0xf0,0xf0,0xf0}},
+
+{{0x00,0x00,0x00},
+ {0x20,0x20,0x20},
+ {0x40,0x40,0x40},
+ {0x60,0x60,0x60},
+ {0x80,0x80,0x80},
+ {0xa0,0xa0,0xa0},
+ {0xc0,0xc0,0xc0},
+ {0xf0,0xf0,0xf0}},
+
+{{0x00,0x00,0x00},
+ {0xff,0x00,0x00},
+ {0x00,0x00,0x9f},
+ {0x60,0x60,0x60},
+ {0x00,0x00,0x00},
+ {0xff,0xff,0x00},
+ {0x00,0xff,0x00},
+ {0xff,0xff,0xff}},
+
+{
+ {0x00,0x00,0x00},
+ {0x00,0x00,0xff},
+ {0x00,0x00,0x7f},
+ {0x00,0x00,0x00},
+ {0x00,0x00,0x00},
+ {0x00,0x00,0xaf},
+ {0xff,0xff,0xff},
+ {0x7f,0x7f,0xff}},
+
+{{0x00,0x00,0x00},
+ {0xff,0xff,0x00},
+ {0x7f,0x7f,0x00},
+ {0x00,0x00,0x00},
+ {0x00,0x00,0x00},
+ {0xaf,0xaf,0x00},
+ {0xff,0xff,0xff},
+ {0xff,0xff,0x7f}},
+
+{{0x00,0x00,0x00},
+ {0x00,0xff,0x00},
+ {0x00,0x7f,0x00},
+ {0x00,0x00,0x00},
+ {0x00,0x00,0x00},
+ {0x00,0xaf,0x00},
+ {0xff,0xff,0xff},
+ {0x7f,0xff,0x7f}},
+
+{{0x00,0x00,0x00},
+ {0x20,0x20,0x20},
+ {0x40,0x40,0x40},
+ {0x60,0x60,0x60},
+ {0x80,0x80,0x80},
+ {0xa0,0xa0,0xa0},
+ {0xc0,0xc0,0xc0},
+ {0xf0,0xf0,0xf0}},
+
+{{0x00,0x00,0x00},
+ {0x20,0x20,0x20},
+ {0x40,0x40,0x40},
+ {0x60,0x60,0x60},
+ {0x80,0x80,0x80},
+ {0xa0,0xa0,0xa0},
+ {0xc0,0xc0,0xc0},
+ {0xf0,0xf0,0xf0}},
+
+{{0x00,0x00,0x00},
+ {0x20,0x20,0x20},
+ {0x40,0x40,0x40},
+ {0x60,0x60,0x60},
+ {0x80,0x80,0x80},
+ {0xa0,0xa0,0xa0},
+ {0xc0,0xc0,0xc0},
+ {0xf0,0xf0,0xf0}},
+
+{{0x00,0x00,0x00},
+ {0x20,0x20,0x20},
+ {0x40,0x40,0x40},
+ {0x60,0x60,0x60},
+ {0x80,0x80,0x80},
+ {0xa0,0xa0,0xa0},
+ {0xc0,0xc0,0xc0},
+ {0xf0,0xf0,0xf0}},
+
+{
+ {0x00,0x00,0x00},
+ {0xff,0xaf,0xaf},
+ {0x00,0x00,0xff},
+ {0xff,0xff,0xff},
+ {0x00,0x00,0x00},
+ {0xff,0x50,0x50},
+ {0xff,0xff,0x00},
+ {0x00,0xff,0x00}
+}
+
+};
+
+void ssrj_state::video_start()
+{
+ m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ssrj_state::get_tile_info<0>)), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
+ m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ssrj_state::get_tile_info<1>)), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
+ m_tilemap[3] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ssrj_state::get_tile_info<3>)), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
+ m_tilemap[1]->set_transparent_pen(0);
+ m_tilemap[3]->set_transparent_pen(0);
+}
+
+
+void ssrj_state::draw_objects(bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ uint8_t const *buffered_spriteram = m_buffered_spriteram->buffer();
+
+ for (int i = 0; i < 6; i++)
+ {
+ int const y = buffered_spriteram[0x80 + 20 * i];
+ int x = buffered_spriteram[0x80 + 20 * i + 2];
+ if (!buffered_spriteram[0x80 + 20 * i + 3])
+ {
+ for (int k = 0; k < 5; k++, x += 8)
+ {
+ for (int j = 0; j < 0x20; j++)
+ {
+ int const offs = (i * 5 + k) * 64 + (31 - j) * 2;
+
+ int const code = m_vram[2][offs] + 256 * m_vram[2][offs + 1];
+ m_gfxdecode->gfx(0)->transpen(bitmap,
+ cliprect,
+ code & 1023,
+ ((code >> 12) & 0x3) + 8,
+ code & 0x4000,
+ code & 0x8000,
+ x,
+ (247 - (y + (j << 3))) & 0xff,
+ 0);
+ }
+ }
+ }
+ }
+}
+
+
+void ssrj_state::palette(palette_device &palette) const
+{
+ for (int i = 0; i < 4 * 4; i++)
+ for (int j = 0; j < 8; j++)
+ palette.set_pen_color(i * 8 + j, fakecols[i][j]);
+}
+
+uint32_t ssrj_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ uint8_t const *buffered_spriteram = m_buffered_spriteram->live();
+ m_tilemap[0]->set_scrollx(0, 0xff - buffered_spriteram[2]);
+ m_tilemap[0]->set_scrolly(0, buffered_spriteram[0]);
+ m_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0);
+ draw_objects(bitmap, cliprect);
+ m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
+
+ if (m_buffered_spriteram->live()[0x101] == 0xb) m_tilemap[3]->draw(screen, bitmap, cliprect, 0, 0); // hack to display 4th tilemap
+ return 0;
+}
+
+
+// machine
void ssrj_state::machine_start()
{
@@ -48,36 +349,36 @@ void ssrj_state::machine_reset()
{
uint8_t *rom = memregion("maincpu")->base();
- memset(&rom[0xc000], 0 ,0x3fff); /* req for some control types */
+ memset(&rom[0xc000], 0 ,0x3fff); // req for some control types
m_oldport = 0x80;
}
uint8_t ssrj_state::wheel_r()
{
- int port = ioport("IN1")->read() - 0x80;
- int retval = port - m_oldport;
+ int const port = m_in1->read() - 0x80;
+ int const retval = port - m_oldport;
m_oldport = port;
return retval;
}
-void ssrj_state::ssrj_map(address_map &map)
+void ssrj_state::prg_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
- map(0xc000, 0xc7ff).ram().w(FUNC(ssrj_state::vram1_w)).share("vram1");
- map(0xc800, 0xcfff).ram().w(FUNC(ssrj_state::vram2_w)).share("vram2");
- map(0xd000, 0xd7ff).ram().share("vram3");
- map(0xd800, 0xdfff).ram().w(FUNC(ssrj_state::vram4_w)).share("vram4");
+ map(0xc000, 0xc7ff).ram().w(FUNC(ssrj_state::vram_w<0>)).share(m_vram[0]);
+ map(0xc800, 0xcfff).ram().w(FUNC(ssrj_state::vram_w<1>)).share(m_vram[1]);
+ map(0xd000, 0xd7ff).ram().share(m_vram[2]);
+ map(0xd800, 0xdfff).ram().w(FUNC(ssrj_state::vram_w<3>)).share(m_vram[3]);
map(0xe000, 0xe7ff).ram();
map(0xe800, 0xefff).ram().share("scrollram");
map(0xf000, 0xf000).portr("IN0");
map(0xf001, 0xf001).r(FUNC(ssrj_state::wheel_r));
map(0xf002, 0xf002).portr("IN2");
- map(0xf003, 0xf003).nopw(); /* unknown */
+ map(0xf003, 0xf003).nopw(); // unknown
map(0xf401, 0xf401).r("aysnd", FUNC(ay8910_device::data_r));
map(0xf400, 0xf401).w("aysnd", FUNC(ay8910_device::address_data_w));
- map(0xf800, 0xf800).nopw(); /* wheel ? */
- map(0xfc00, 0xfc00).nopw(); /* unknown */
+ map(0xf800, 0xf800).nopw(); // wheel ?
+ map(0xfc00, 0xfc00).nopw(); // unknown
}
static INPUT_PORTS_START( ssrj )
@@ -91,7 +392,7 @@ static INPUT_PORTS_START( ssrj )
PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(4) PORT_REVERSE
PORT_START("IN2")
- PORT_BIT( 0xf, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("IN3", 0x30, EQUALS, 0x00) /* code @ $eef, tested when controls != type1 */
+ PORT_BIT( 0xf, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("IN3", 0x30, EQUALS, 0x00) // code @ $eef, tested when controls != type1
PORT_BIT( 0x1, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("IN3", 0x30, NOTEQUALS, 0x00) PORT_NAME("Start (Easy)")
PORT_BIT( 0x2, IP_ACTIVE_LOW, IPT_START2 ) PORT_CONDITION("IN3", 0x30, NOTEQUALS, 0x00) PORT_NAME("Start (Normal)")
PORT_BIT( 0x4, IP_ACTIVE_LOW, IPT_START3 ) PORT_CONDITION("IN3", 0x30, NOTEQUALS, 0x00) PORT_NAME("Start (Difficult)")
@@ -120,53 +421,55 @@ static INPUT_PORTS_START( ssrj )
PORT_DIPNAME( 0x08, 0x08, "Freeze" )
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x30, 0x00, DEF_STR( Controls ) ) /* Type 1 has no start button and uses difficulty DSW, type 2-4 have 4 start buttons that determine difficulty. MT07492 for more. */
+ PORT_DIPNAME( 0x30, 0x00, DEF_STR( Controls ) ) // Type 1 has no start button and uses difficulty DSW, type 2-4 have 4 start buttons that determine difficulty. MT07492 for more.
PORT_DIPSETTING( 0x00, "Type 1" )
PORT_DIPSETTING( 0x10, "Type 2" )
PORT_DIPSETTING( 0x20, "Type 3" )
PORT_DIPSETTING( 0x30, "Type 4" )
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* sometimes hangs after game over ($69b) */
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // sometimes hangs after game over ($69b)
INPUT_PORTS_END
static const gfx_layout charlayout =
{
- 8,8, /* 8*8 characters */
- RGN_FRAC(1,3), /* 1024 characters */
- 3, /* 3 bits per pixel */
- { 0, RGN_FRAC(2,3), RGN_FRAC(1,3) }, /* the bitplanes are separated */
+ 8,8, // 8*8 characters
+ RGN_FRAC(1,3), // 1024 characters
+ 3, // 3 bits per pixel
+ { 0, RGN_FRAC(2,3), RGN_FRAC(1,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 */
+ 8*8 // every char takes 8 consecutive bytes
};
static GFXDECODE_START( gfx_ssrj )
- GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 0x10 )
+ GFXDECODE_ENTRY( "gfx", 0, charlayout, 0, 0x10 )
GFXDECODE_END
void ssrj_state::ssrj(machine_config &config)
{
- /* basic machine hardware */
- Z80(config, m_maincpu, 8000000/2);
- m_maincpu->set_addrmap(AS_PROGRAM, &ssrj_state::ssrj_map);
+ // basic machine hardware
+ Z80(config, m_maincpu, 8000000 / 2);
+ m_maincpu->set_addrmap(AS_PROGRAM, &ssrj_state::prg_map);
m_maincpu->set_vblank_int("screen", FUNC(ssrj_state::irq0_line_hold));
- /* 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(0));
screen.set_size(40*8, 32*8);
screen.set_visarea(0*8, 34*8-1, 1*8, 31*8-1); // unknown res
screen.set_screen_update(FUNC(ssrj_state::screen_update));
- screen.screen_vblank().set(FUNC(ssrj_state::screen_vblank));
+ screen.screen_vblank().set(m_buffered_spriteram, FUNC(buffered_spriteram8_device::vblank_copy_rising));
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_ssrj);
- PALETTE(config, m_palette, FUNC(ssrj_state::ssrj_palette), 128);
+ PALETTE(config, m_palette, FUNC(ssrj_state::palette), 128);
- /* sound hardware */
+ BUFFERED_SPRITERAM8(config, m_buffered_spriteram);
+
+ // sound hardware
SPEAKER(config, "mono").front_center();
- ay8910_device &aysnd(AY8910(config, "aysnd", 8000000/5));
+ ay8910_device &aysnd(AY8910(config, "aysnd", 8000000 / 5));
aysnd.port_b_read_callback().set_ioport("IN3");
aysnd.add_route(ALL_OUTPUTS, "mono", 0.30);
}
@@ -182,7 +485,7 @@ ROM_START( ssrj )
ROM_LOAD( "a40-01.bin", 0x0000, 0x4000, CRC(1ff7dbff) SHA1(a9e676ee087141d62f880cd98e7748db1e6e9461) )
ROM_LOAD( "a40-02.bin", 0x4000, 0x4000, CRC(bbb36f9f) SHA1(9f85bac639d18ee932273a6c00b36ac969e69bb8) )
- ROM_REGION( 0x6000, "gfx1", 0 )
+ ROM_REGION( 0x6000, "gfx", 0 )
ROM_LOAD( "a40-03.bin", 0x0000, 0x2000, CRC(3753182a) SHA1(3eda34f967563b11416344da87b7be46cbecff2b) )
ROM_LOAD( "a40-04.bin", 0x2000, 0x2000, CRC(96471816) SHA1(e24b690085602b8bde079e596c2879deab128c83) )
ROM_LOAD( "a40-05.bin", 0x4000, 0x2000, CRC(dce9169e) SHA1(2cdda1453b2913fad931788e1db0bc01ce923a04) )
@@ -191,4 +494,7 @@ ROM_START( ssrj )
ROM_LOAD( "proms", 0x0000, 0x0100, NO_DUMP )
ROM_END
-GAME( 1985, ssrj, 0, ssrj, ssrj, ssrj_state, empty_init, ROT90, "Taito Corporation", "Super Speed Race Junior (Japan)", MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
+} // anonymous namespace
+
+
+GAME( 1985, ssrj, 0, ssrj, ssrj, ssrj_state, empty_init, ROT90, "Taito Corporation", "Super Speed Race Junior (Japan)", MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/taito/ssrj.h b/src/mame/taito/ssrj.h
deleted file mode 100644
index 4794e9b4a8e..00000000000
--- a/src/mame/taito/ssrj.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Tomasz Slanina
-#ifndef MAME_INCLUDES_SSRJ_H
-#define MAME_INCLUDES_SSRJ_H
-
-#pragma once
-
-#include "emupal.h"
-#include "tilemap.h"
-
-class ssrj_state : public driver_device
-{
-public:
- ssrj_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
- m_vram1(*this, "vram1"),
- m_vram2(*this, "vram2"),
- m_vram3(*this, "vram3"),
- m_vram4(*this, "vram4"),
- m_scrollram(*this, "scrollram")
- { }
-
- void ssrj(machine_config &config);
-
-protected:
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
-
-private:
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
-
- required_shared_ptr<uint8_t> m_vram1;
- required_shared_ptr<uint8_t> m_vram2;
- required_shared_ptr<uint8_t> m_vram3;
- required_shared_ptr<uint8_t> m_vram4;
- required_shared_ptr<uint8_t> m_scrollram;
-
- int m_oldport = 0;
- tilemap_t *m_tilemap1 = nullptr;
- tilemap_t *m_tilemap2 = nullptr;
- tilemap_t *m_tilemap4 = nullptr;
- std::unique_ptr<uint8_t[]> m_buffer_spriteram;
-
- uint8_t wheel_r();
- void vram1_w(offs_t offset, uint8_t data);
- void vram2_w(offs_t offset, uint8_t data);
- void vram4_w(offs_t offset, uint8_t data);
-
- TILE_GET_INFO_MEMBER(get_tile_info1);
- TILE_GET_INFO_MEMBER(get_tile_info2);
- TILE_GET_INFO_MEMBER(get_tile_info4);
-
- void ssrj_palette(palette_device &palette) const;
-
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_WRITE_LINE_MEMBER(screen_vblank);
- void draw_objects(bitmap_ind16 &bitmap, const rectangle &cliprect );
-
- void ssrj_map(address_map &map);
-};
-
-#endif // MAME_INCLUDES_SSRJ_H
diff --git a/src/mame/taito/ssrj_v.cpp b/src/mame/taito/ssrj_v.cpp
deleted file mode 100644
index 8ee4ddabc15..00000000000
--- a/src/mame/taito/ssrj_v.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Tomasz Slanina
-#include "emu.h"
-#include "ssrj.h"
-
-/* tilemap 1 */
-
-void ssrj_state::vram1_w(offs_t offset, uint8_t data)
-{
- m_vram1[offset] = data;
- m_tilemap1->mark_tile_dirty(offset>>1);
-}
-
-TILE_GET_INFO_MEMBER(ssrj_state::get_tile_info1)
-{
- int code;
- code = m_vram1[tile_index<<1] + (m_vram1[(tile_index<<1)+1]<<8);
- tileinfo.set(0,
- code&0x3ff,
- (code>>12)&0x3,
- ((code & 0x8000) ? TILE_FLIPY:0) |( (code & 0x4000) ? TILE_FLIPX:0) );
-}
-
-/* tilemap 2 */
-
-void ssrj_state::vram2_w(offs_t offset, uint8_t data)
-{
- m_vram2[offset] = data;
- m_tilemap2->mark_tile_dirty(offset>>1);
-}
-
-TILE_GET_INFO_MEMBER(ssrj_state::get_tile_info2)
-{
- int code;
- code = m_vram2[tile_index<<1] + (m_vram2[(tile_index<<1)+1]<<8);
- tileinfo.set(0,
- code&0x3ff,
- ((code>>12)&0x3)+4,
- ((code & 0x8000) ? TILE_FLIPY:0) |( (code & 0x4000) ? TILE_FLIPX:0) );
-}
-
-/* tilemap 4 */
-
-void ssrj_state::vram4_w(offs_t offset, uint8_t data)
-{
- m_vram4[offset] = data;
- m_tilemap4->mark_tile_dirty(offset>>1);
-}
-
-TILE_GET_INFO_MEMBER(ssrj_state::get_tile_info4)
-{
- int code;
- code = m_vram4[tile_index<<1] + (m_vram4[(tile_index<<1)+1]<<8);
- tileinfo.set(0,
- code&0x3ff,
- ((code>>12)&0x3)+12,
- ((code & 0x8000) ? TILE_FLIPY:0) |( (code & 0x4000) ? TILE_FLIPX:0) );
-}
-
-
-/*
-TODO: This table is nowhere near as accurate. If you bother, here's how colors should be:
--"START" sign is red with dark blue background.
--Sidewalk is yellow-ish.
--first opponents have swapped colors (blue/yellow instead of yellow/blue)
--after the first stage, houses have red/white colors.
-*/
-
-static constexpr rgb_t fakecols[4 * 4][8] =
-{
-{{0x00,0x00,0x00},
- {42,87,140},
- {0,0,0},
- {33,75,160},
- {0xff,0xff,0xff},
- {37,56,81},
- {0x1f,0x1f,0x2f},
- {55,123,190}},
-
-{{0x00,0x00,0x00},
- {0x00,99,41},
- {0x00,0x00,0xff},
- {0x00,0xff,0},
- {255,255,255},
- {0xff,0x00,0x00},
- {0,45,105},
- {0xff,0xff,0}},
-
-
-{{0x00,0x00,0x00},
- {0x00,0x20,0x00},
- {0x00,0x40,0x00},
- {0x00,0x60,0x00},
- {0x00,0x80,0x00},
- {0x00,0xa0,0x00},
- {0x00,0xc0,0x00},
- {0x00,0xf0,0x00}},
-
- {{0x00,0x00,0x00},
- {0x20,0x00,0x20},
- {0x40,0x00,0x40},
- {0x60,0x00,0x60},
- {0x80,0x00,0x80},
- {0xa0,0x00,0xa0},
- {0xc0,0x00,0xc0},
- {0xf0,0x00,0xf0}},
-
-{{0x00,0x00,0x00},
- {0xff,0x00,0x00},
- {0x7f,0x00,0x00},
- {0x00,0x00,0x00},
- {0x00,0x00,0x00},
- {0xaf,0x00,0x00},
- {0xff,0xff,0xff},
- {0xff,0x7f,0x7f}},
-
-{{0x00,0x00,0x00},
- {0x20,0x20,0x20},
- {0x40,0x40,0x40},
- {0x60,0x60,0x60},
- {0x80,0x80,0x80},
- {0xa0,0xa0,0xa0},
- {0xc0,0xc0,0xc0},
- {0xf0,0xf0,0xf0}},
-
-{{0x00,0x00,0x00},
- {0x20,0x20,0x20},
- {0x40,0x40,0x40},
- {0x60,0x60,0x60},
- {0x80,0x80,0x80},
- {0xa0,0xa0,0xa0},
- {0xc0,0xc0,0xc0},
- {0xf0,0xf0,0xf0}},
-
-{{0x00,0x00,0x00},
- {0xff,0x00,0x00},
- {0x00,0x00,0x9f},
- {0x60,0x60,0x60},
- {0x00,0x00,0x00},
- {0xff,0xff,0x00},
- {0x00,0xff,0x00},
- {0xff,0xff,0xff}},
-
-{
- {0x00,0x00,0x00},
- {0x00,0x00,0xff},
- {0x00,0x00,0x7f},
- {0x00,0x00,0x00},
- {0x00,0x00,0x00},
- {0x00,0x00,0xaf},
- {0xff,0xff,0xff},
- {0x7f,0x7f,0xff}},
-
-{{0x00,0x00,0x00},
- {0xff,0xff,0x00},
- {0x7f,0x7f,0x00},
- {0x00,0x00,0x00},
- {0x00,0x00,0x00},
- {0xaf,0xaf,0x00},
- {0xff,0xff,0xff},
- {0xff,0xff,0x7f}},
-
-{{0x00,0x00,0x00},
- {0x00,0xff,0x00},
- {0x00,0x7f,0x00},
- {0x00,0x00,0x00},
- {0x00,0x00,0x00},
- {0x00,0xaf,0x00},
- {0xff,0xff,0xff},
- {0x7f,0xff,0x7f}},
-
-{{0x00,0x00,0x00},
- {0x20,0x20,0x20},
- {0x40,0x40,0x40},
- {0x60,0x60,0x60},
- {0x80,0x80,0x80},
- {0xa0,0xa0,0xa0},
- {0xc0,0xc0,0xc0},
- {0xf0,0xf0,0xf0}},
-
-{{0x00,0x00,0x00},
- {0x20,0x20,0x20},
- {0x40,0x40,0x40},
- {0x60,0x60,0x60},
- {0x80,0x80,0x80},
- {0xa0,0xa0,0xa0},
- {0xc0,0xc0,0xc0},
- {0xf0,0xf0,0xf0}},
-
-{{0x00,0x00,0x00},
- {0x20,0x20,0x20},
- {0x40,0x40,0x40},
- {0x60,0x60,0x60},
- {0x80,0x80,0x80},
- {0xa0,0xa0,0xa0},
- {0xc0,0xc0,0xc0},
- {0xf0,0xf0,0xf0}},
-
-{{0x00,0x00,0x00},
- {0x20,0x20,0x20},
- {0x40,0x40,0x40},
- {0x60,0x60,0x60},
- {0x80,0x80,0x80},
- {0xa0,0xa0,0xa0},
- {0xc0,0xc0,0xc0},
- {0xf0,0xf0,0xf0}},
-
-{
- {0x00,0x00,0x00},
- {0xff,0xaf,0xaf},
- {0x00,0x00,0xff},
- {0xff,0xff,0xff},
- {0x00,0x00,0x00},
- {0xff,0x50,0x50},
- {0xff,0xff,0x00},
- {0x00,0xff,0x00}
-}
-
-};
-
-void ssrj_state::video_start()
-{
- m_tilemap1 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ssrj_state::get_tile_info1)), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
- m_tilemap2 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ssrj_state::get_tile_info2)), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
- m_tilemap4 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ssrj_state::get_tile_info4)), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
- m_tilemap2->set_transparent_pen(0);
- m_tilemap4->set_transparent_pen(0);
-
- m_buffer_spriteram = std::make_unique<uint8_t[]>(0x0800);
-}
-
-
-void ssrj_state::draw_objects(bitmap_ind16 &bitmap, const rectangle &cliprect )
-{
- int i,j,k,x,y;
-
- for(i=0;i<6;i++)
- {
- y = m_buffer_spriteram[0x80+20*i];
- x = m_buffer_spriteram[0x80+20*i+2];
- if (!m_buffer_spriteram[0x80+20*i+3])
- {
- for(k=0;k<5;k++,x+=8)
- {
- for(j=0;j<0x20;j++)
- {
- int code;
- int offs = (i * 5 + k) * 64 + (31 - j) * 2;
-
- code = m_vram3[offs] + 256 * m_vram3[offs + 1];
- m_gfxdecode->gfx(0)->transpen(bitmap,
- cliprect,
- code&1023,
- ((code>>12)&0x3)+8,
- code&0x4000,
- code&0x8000,
- x,
- (247-(y+(j<<3)))&0xff,
- 0);
- }
- }
- }
- }
-}
-
-
-void ssrj_state::ssrj_palette(palette_device &palette) const
-{
- for (int i = 0; i < 4*4; i++)
- for (int j = 0; j < 8; j++)
- palette.set_pen_color(i*8 + j, fakecols[i][j]);
-}
-
-uint32_t ssrj_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- m_tilemap1->set_scrollx(0, 0xff-m_scrollram[2] );
- m_tilemap1->set_scrolly(0, m_scrollram[0] );
- m_tilemap1->draw(screen, bitmap, cliprect, 0, 0);
- draw_objects(bitmap, cliprect);
- m_tilemap2->draw(screen, bitmap, cliprect, 0, 0);
-
- if (m_scrollram[0x101] == 0xb) m_tilemap4->draw(screen, bitmap, cliprect, 0, 0);/* hack to display 4th tilemap */
- return 0;
-}
-
-WRITE_LINE_MEMBER(ssrj_state::screen_vblank)
-{
- // rising edge
- if (state)
- {
- memcpy(m_buffer_spriteram.get(), m_scrollram, 0x800);
- }
-}
diff --git a/src/mame/taito/volfied.cpp b/src/mame/taito/volfied.cpp
index 5d9b71e1984..9a897e106f2 100644
--- a/src/mame/taito/volfied.cpp
+++ b/src/mame/taito/volfied.cpp
@@ -1,5 +1,6 @@
// license:BSD-3-Clause
-// copyright-holders:Bryan McPhail, Nicola Salmoria
+// copyright-holders: Bryan McPhail, Nicola Salmoria
+
/******************************************************************
Volfied (c) 1989 Taito Corporation
@@ -46,22 +47,197 @@ Stephh's notes (based on the game M68000 code and some tests) :
********************************************************************/
#include "emu.h"
-#include "volfied.h"
+
+#include "pc090oj.h"
+#include "taitocchip.h"
#include "taitoipt.h"
#include "taitosnd.h"
#include "cpu/m68000/m68000.h"
#include "cpu/z80/z80.h"
+#include "machine/timer.h"
#include "sound/ymopn.h"
+
#include "emupal.h"
+#include "screen.h"
#include "speaker.h"
-/* Define clocks based on actual OSC on the PCB */
+namespace {
+
+class volfied_state : public driver_device
+{
+public:
+ volfied_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_video_ram(*this, "video_ram"),
+ m_maincpu(*this, "maincpu"),
+ m_audiocpu(*this, "audiocpu"),
+ m_cchip(*this, "cchip"),
+ m_pc090oj(*this, "pc090oj"),
+ m_screen(*this, "screen"),
+ m_cchip_irq_clear(*this, "cchip_irq_clear")
+ { }
+
+ void volfied(machine_config &config);
+
+protected:
+ virtual void video_start() override;
+
+private:
+ void video_ram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
+ void video_ctrl_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
+ uint16_t video_ctrl_r();
+ void video_mask_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
+ void counters_w(uint8_t data);
+ void colpri_cb(uint32_t &sprite_colbank, uint32_t &pri_mask, uint16_t sprite_ctrl);
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ INTERRUPT_GEN_MEMBER(interrupt);
+ TIMER_DEVICE_CALLBACK_MEMBER(cchip_irq_clear_cb);
+
+ void refresh_pixel_layer(bitmap_ind16 &bitmap);
+
+ void main_map(address_map &map);
+ void z80_map(address_map &map);
+
+ // memory pointers
+ required_shared_ptr<uint16_t> m_video_ram;
+
+ // video-related
+ uint16_t m_video_ctrl = 0;
+ uint16_t m_video_mask = 0;
+
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<taito_cchip_device> m_cchip;
+ required_device<pc090oj_device> m_pc090oj;
+ required_device<screen_device> m_screen;
+ required_device<timer_device> m_cchip_irq_clear;
+};
+
+
+// video
+
+/******************************************************
+ INITIALISATION AND CLEAN-UP
+******************************************************/
+
+void volfied_state::video_start()
+{
+ m_video_ctrl = 0;
+ m_video_mask = 0;
+
+ save_item(NAME(m_video_ctrl));
+ save_item(NAME(m_video_mask));
+}
+
+
+/*******************************************************
+ READ AND WRITE HANDLERS
+*******************************************************/
+
+void volfied_state::video_ram_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+{
+ mem_mask &= m_video_mask;
+
+ COMBINE_DATA(&m_video_ram[offset]);
+}
+
+void volfied_state::video_ctrl_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+{
+ COMBINE_DATA(&m_video_ctrl);
+}
+
+uint16_t volfied_state::video_ctrl_r()
+{
+ /* Could this be some kind of hardware collision detection? If bit 6 is
+ set the game will check for collisions with the large enemy, whereas
+ bit 5 does the same for small enemies. Bit 7 is also used although
+ its purpose is unclear. This register is usually read during a VBI
+ and stored in work RAM for later use. */
+
+ return 0x60;
+}
+
+void volfied_state::video_mask_w(offs_t offset, uint16_t data, uint16_t mem_mask)
+{
+ COMBINE_DATA(&m_video_mask);
+}
+
+void volfied_state::colpri_cb(uint32_t &sprite_colbank, uint32_t &pri_mask, uint16_t sprite_ctrl)
+{
+ sprite_colbank = 0x100 | ((sprite_ctrl & 0x3c) << 2);
+ pri_mask = 0; // sprites over everything
+}
+
+
+/*******************************************************
+ SCREEN REFRESH
+*******************************************************/
+
+void volfied_state::refresh_pixel_layer(bitmap_ind16 &bitmap)
+{
+ /*********************************************************
+
+ VIDEO RAM has 2 screens x 256 rows x 512 columns x 16 bits
+
+ x--------------- select image
+ -x-------------- ? (used for 3-D corners)
+ --x------------- ? (used for 3-D walls)
+ ---xxxx--------- image B
+ -------xxx------ palette index bits #8 to #A
+ ----------x----- ?
+ -----------x---- ?
+ ------------xxxx image A
+
+ '3d' corners & walls are made using unknown bits for each
+ line the player draws. However, on the PCB they just
+ appear as solid black. Perhaps it was prototype code that
+ was turned off at some stage.
+
+ *********************************************************/
+
+ uint16_t* p = m_video_ram.target();
+ int const width = m_screen->width();
+ int const height = m_screen->height();
+
+ if (m_video_ctrl & 1)
+ p += 0x20000;
+
+ for (int y = 0; y < height; y++)
+ {
+ for (int x = 1; x < width + 1; x++) // Hmm, 1 pixel offset is needed to align properly with sprites
+ {
+ int color = (p[x] << 2) & 0x700;
+
+ if (p[x] & 0x8000)
+ {
+ color |= 0x800 | ((p[x] >> 9) & 0xf);
+
+ if (p[x] & 0x2000)
+ color &= ~0xf; // hack
+ }
+ else
+ color |= p[x] & 0xf;
+
+ bitmap.pix(y, x - 1) = color;
+ }
+
+ p += 512;
+ }
+}
+
+uint32_t volfied_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ screen.priority().fill(0, cliprect);
+ refresh_pixel_layer(bitmap);
+ m_pc090oj->draw_sprites(screen, bitmap, cliprect);
+ return 0;
+}
-#define CPU_CLOCK (XTAL(32'000'000) / 4) /* 8 MHz clock for 68000 */
-#define SOUND_CPU_CLOCK (XTAL(32'000'000) / 8) /* 4 MHz clock for Z80 sound CPU */
+// machine
/***********************************************************
MEMORY STRUCTURES
@@ -69,11 +245,11 @@ Stephh's notes (based on the game M68000 code and some tests) :
void volfied_state::main_map(address_map &map)
{
- map(0x000000, 0x03ffff).rom(); /* program */
- map(0x080000, 0x0fffff).rom(); /* tiles */
- map(0x100000, 0x103fff).ram(); /* main */
+ map(0x000000, 0x03ffff).rom(); // program
+ map(0x080000, 0x0fffff).rom(); // tiles
+ map(0x100000, 0x103fff).ram(); // main
map(0x200000, 0x203fff).rw(m_pc090oj, FUNC(pc090oj_device::word_r), FUNC(pc090oj_device::word_w));
- map(0x400000, 0x47ffff).rw(FUNC(volfied_state::video_ram_r), FUNC(volfied_state::video_ram_w));
+ map(0x400000, 0x47ffff).ram().w(FUNC(volfied_state::video_ram_w)).share(m_video_ram);
map(0x500000, 0x503fff).ram().w("palette", FUNC(palette_device::write16)).share("palette");
map(0x600000, 0x600001).w(FUNC(volfied_state::video_mask_w));
map(0x700000, 0x700001).w(m_pc090oj, FUNC(pc090oj_device::sprite_ctrl_w));
@@ -91,7 +267,7 @@ void volfied_state::z80_map(address_map &map)
map(0x8800, 0x8800).w("ciu", FUNC(pc060ha_device::slave_port_w));
map(0x8801, 0x8801).rw("ciu", FUNC(pc060ha_device::slave_comm_r), FUNC(pc060ha_device::slave_comm_w));
map(0x9000, 0x9001).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write));
- map(0x9800, 0x9800).nopw(); /* ? */
+ map(0x9800, 0x9800).nopw(); // ?
}
@@ -100,14 +276,14 @@ void volfied_state::z80_map(address_map &map)
***********************************************************/
static INPUT_PORTS_START( volfied )
- /* Z80 CPU -> 0x10002c ($2c,A5) */
+ // Z80 CPU -> 0x10002c ($2c,A5)
PORT_START("DSWA")
TAITO_MACHINE_COCKTAIL_LOC(SW1)
TAITO_COINAGE_WORLD_LOC(SW1)
- /* Z80 CPU -> 0x10002e ($2e,A5) */
+ // Z80 CPU -> 0x10002e ($2e,A5)
PORT_START("DSWB")
- PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:1,2") /* table at 0x003140 - 4 * 6 words - LSB first */
+ PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:1,2") // table at 0x003140 - 4 * 6 words - LSB first
PORT_DIPSETTING( 0x02, "20k 40k 120k 480k 2400k" )
PORT_DIPSETTING( 0x03, "50k 150k 600k 3000k" )
PORT_DIPSETTING( 0x01, "70k 280k 1400k" )
@@ -122,7 +298,7 @@ static INPUT_PORTS_START( volfied )
PORT_DIPSETTING( 0x20, "4" )
PORT_DIPSETTING( 0x10, "5" )
PORT_DIPSETTING( 0x00, "6" )
- PORT_DIPNAME( 0x40, 0x40, "32768 Lives (Cheat)" ) PORT_DIPLOCATION("SW2:7") /* code at 0x0015cc - Manual shows unused and OFF */
+ PORT_DIPNAME( 0x40, 0x40, "32768 Lives (Cheat)" ) PORT_DIPLOCATION("SW2:7") // code at 0x0015cc - Manual shows unused and OFF
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW2:8")
@@ -174,9 +350,9 @@ static INPUT_PORTS_START( volfiedu )
PORT_INCLUDE(volfied)
PORT_MODIFY("DSWA")
- TAITO_COINAGE_US_COIN_START_LOC(SW1) /* see notes */
- PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW1:7" ) /* see notes */
- PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW1:8" ) /* see notes */
+ TAITO_COINAGE_US_COIN_START_LOC(SW1) // see notes
+ PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW1:7" ) // see notes
+ PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW1:8" ) // see notes
INPUT_PORTS_END
static INPUT_PORTS_START( volfiedj )
@@ -191,14 +367,6 @@ INPUT_PORTS_END
MACHINE DRIVERS
***********************************************************/
-void volfied_state::machine_start()
-{
-}
-
-void volfied_state::machine_reset()
-{
-}
-
void volfied_state::counters_w(uint8_t data)
{
machine().bookkeeping().coin_lockout_w(1, data & 0x80);
@@ -222,15 +390,20 @@ TIMER_DEVICE_CALLBACK_MEMBER(volfied_state::cchip_irq_clear_cb)
void volfied_state::volfied(machine_config &config)
{
- /* basic machine hardware */
- M68000(config, m_maincpu, CPU_CLOCK); /* 8MHz */
+ // Define clocks based on actual OSC on the PCB
+
+ static constexpr XTAL CPU_CLOCK = (32_MHz_XTAL / 4); // 8 MHz clock for 68000
+ static constexpr XTAL SOUND_CPU_CLOCK = (32_MHz_XTAL / 8); // 4 MHz clock for Z80 sound CPU
+
+ // basic machine hardware
+ M68000(config, m_maincpu, CPU_CLOCK); // 8MHz
m_maincpu->set_addrmap(AS_PROGRAM, &volfied_state::main_map);
m_maincpu->set_vblank_int("screen", FUNC(volfied_state::interrupt));
- Z80(config, m_audiocpu, SOUND_CPU_CLOCK); /* 4MHz sound CPU, required to run the game */
+ Z80(config, m_audiocpu, SOUND_CPU_CLOCK); // 4MHz sound CPU, required to run the game
m_audiocpu->set_addrmap(AS_PROGRAM, &volfied_state::z80_map);
- TAITO_CCHIP(config, m_cchip, 20_MHz_XTAL/2); // 20MHz OSC next to C-Chip
+ TAITO_CCHIP(config, m_cchip, 20_MHz_XTAL / 2); // 20MHz OSC next to C-Chip
m_cchip->in_pa_callback().set_ioport("F00007");
m_cchip->in_pb_callback().set_ioport("F00009");
m_cchip->in_pc_callback().set_ioport("F0000B");
@@ -241,7 +414,7 @@ void volfied_state::volfied(machine_config &config)
TIMER(config, m_cchip_irq_clear).configure_generic(FUNC(volfied_state::cchip_irq_clear_cb));
- /* video hardware */
+ // video hardware
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0));
@@ -254,12 +427,12 @@ void volfied_state::volfied(machine_config &config)
PC090OJ(config, m_pc090oj, 0);
m_pc090oj->set_palette("palette");
- m_pc090oj->set_colpri_callback(FUNC(volfied_state::volfied_colpri_cb));
+ m_pc090oj->set_colpri_callback(FUNC(volfied_state::colpri_cb));
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
- ym2203_device &ymsnd(YM2203(config, "ymsnd", 4000000));
+ ym2203_device &ymsnd(YM2203(config, "ymsnd", SOUND_CPU_CLOCK));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
ymsnd.port_a_read_callback().set_ioport("DSWA");
ymsnd.port_b_read_callback().set_ioport("DSWB");
@@ -279,7 +452,7 @@ void volfied_state::volfied(machine_config &config)
***************************************************************************/
ROM_START( volfied )
- ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code and tile data */
+ ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code and tile data
ROM_LOAD16_BYTE( "c04-12-1.30", 0x00000, 0x10000, CRC(afb6a058) SHA1(fca488e86725a0a673332afeb0002f0e77ef2dbf) )
ROM_LOAD16_BYTE( "c04-08-1.10", 0x00001, 0x10000, CRC(19f7e66b) SHA1(51b5d0d00ec398ed717154286bec24b05c3f81b8) )
ROM_LOAD16_BYTE( "c04-11-1.29", 0x20000, 0x10000, CRC(1aaf6e9b) SHA1(4be643283dc78eb57e9fe4c5afebdc427e4354e8) )
@@ -292,7 +465,7 @@ ROM_START( volfied )
ROM_REGION( 0x2000, "cchip:cchip_eprom", 0 )
ROM_LOAD( "cchip_c04-23", 0x0000, 0x2000, CRC(46b0b479) SHA1(73aa2267eb468c5aa5db67183047e9aef8321215) )
- ROM_REGION( 0xc0000, "pc090oj", 0 ) /* sprites 16x16 */
+ ROM_REGION( 0xc0000, "pc090oj", 0 ) // sprites 16x16
ROM_LOAD16_BYTE( "c04-16.2", 0x00000, 0x20000, CRC(8c2476ef) SHA1(972ddc8e47a669f1aeca67d02b4a0bed867ddb7d) )
ROM_LOAD16_BYTE( "c04-18.4", 0x00001, 0x20000, CRC(7665212c) SHA1(b816ac2a95ee273aaf90991f53766d7f0d5d9238) )
ROM_LOAD16_BYTE( "c04-15.1", 0x40000, 0x20000, CRC(7c50b978) SHA1(aa9cad5f09f5d9dceaf4e06bcd347f1d5d02d292) )
@@ -302,16 +475,16 @@ ROM_START( volfied )
ROM_LOAD16_BYTE( "c04-09.14", 0x80001, 0x10000, CRC(c78cf057) SHA1(097982e57b1d20fbdf21986c23684adefe6f1ce1) )
ROM_RELOAD ( 0xa0001, 0x10000 )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound cpu */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "c04-06.71", 0x0000, 0x8000, CRC(b70106b2) SHA1(d71062f9d9b11492e13fc93982b95883f564f902) )
- ROM_REGION( 0x00400, "proms", 0 ) /* unused PROMs */
- ROM_LOAD( "c04-4-1.3", 0x00000, 0x00200, CRC(ab9fae65) SHA1(e2b29606aa63e42e041d3c47216551f62846bd99) ) /* PROM type is a MB7116H or compatible */
- ROM_LOAD( "c04-5.75", 0x00200, 0x00200, CRC(2763ec89) SHA1(1e8339e21ee35b526d8604a21cfed9a1ac6455e8) ) /* PROM type is a MB7124E or compatible */
+ ROM_REGION( 0x00400, "proms", 0 ) // unused
+ ROM_LOAD( "c04-4-1.3", 0x00000, 0x00200, CRC(ab9fae65) SHA1(e2b29606aa63e42e041d3c47216551f62846bd99) ) // PROM type is a MB7116H or compatible
+ ROM_LOAD( "c04-5.75", 0x00200, 0x00200, CRC(2763ec89) SHA1(1e8339e21ee35b526d8604a21cfed9a1ac6455e8) ) // PROM type is a MB7124E or compatible
ROM_END
ROM_START( volfiedo )
- ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code and tile data */
+ ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code and tile data
ROM_LOAD16_BYTE( "c04-12.30", 0x00000, 0x10000, CRC(e319c7ec) SHA1(e76fb872191fce0186ed0ac5066385a9913fdc4c) )
ROM_LOAD16_BYTE( "c04-08.10", 0x00001, 0x10000, CRC(81c6f755) SHA1(43ad72bb05d847f58b3043c674fb9b1e317691df) )
ROM_LOAD16_BYTE( "c04-11.29", 0x20000, 0x10000, CRC(f05696a6) SHA1(8514e5751e2f11840379e8cc6883a23cf1b3a4eb) )
@@ -324,7 +497,7 @@ ROM_START( volfiedo )
ROM_REGION( 0x2000, "cchip:cchip_eprom", 0 )
ROM_LOAD( "cchip_c04-23", 0x0000, 0x2000, CRC(46b0b479) SHA1(73aa2267eb468c5aa5db67183047e9aef8321215) )
- ROM_REGION( 0xc0000, "pc090oj", 0 ) /* sprites 16x16 */
+ ROM_REGION( 0xc0000, "pc090oj", 0 ) // sprites 16x16
ROM_LOAD16_BYTE( "c04-16.2", 0x00000, 0x20000, CRC(8c2476ef) SHA1(972ddc8e47a669f1aeca67d02b4a0bed867ddb7d) )
ROM_LOAD16_BYTE( "c04-18.4", 0x00001, 0x20000, CRC(7665212c) SHA1(b816ac2a95ee273aaf90991f53766d7f0d5d9238) )
ROM_LOAD16_BYTE( "c04-15.1", 0x40000, 0x20000, CRC(7c50b978) SHA1(aa9cad5f09f5d9dceaf4e06bcd347f1d5d02d292) )
@@ -334,16 +507,16 @@ ROM_START( volfiedo )
ROM_LOAD16_BYTE( "c04-09.14", 0x80001, 0x10000, CRC(c78cf057) SHA1(097982e57b1d20fbdf21986c23684adefe6f1ce1) )
ROM_RELOAD ( 0xa0001, 0x10000 )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound cpu */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "c04-06.71", 0x0000, 0x8000, CRC(b70106b2) SHA1(d71062f9d9b11492e13fc93982b95883f564f902) )
- ROM_REGION( 0x00400, "proms", 0 ) /* unused PROMs */
- ROM_LOAD( "c04-4-1.3", 0x00000, 0x00200, CRC(ab9fae65) SHA1(e2b29606aa63e42e041d3c47216551f62846bd99) ) /* PROM type is a MB7116H or compatible */
- ROM_LOAD( "c04-5.75", 0x00200, 0x00200, CRC(2763ec89) SHA1(1e8339e21ee35b526d8604a21cfed9a1ac6455e8) ) /* PROM type is a MB7124E or compatible */
+ ROM_REGION( 0x00400, "proms", 0 ) // unused
+ ROM_LOAD( "c04-4-1.3", 0x00000, 0x00200, CRC(ab9fae65) SHA1(e2b29606aa63e42e041d3c47216551f62846bd99) ) // PROM type is a MB7116H or compatible
+ ROM_LOAD( "c04-5.75", 0x00200, 0x00200, CRC(2763ec89) SHA1(1e8339e21ee35b526d8604a21cfed9a1ac6455e8) ) // PROM type is a MB7124E or compatible
ROM_END
ROM_START( volfiedu )
- ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code and tile data */
+ ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code and tile data
ROM_LOAD16_BYTE( "c04-12-1.30", 0x00000, 0x10000, CRC(afb6a058) SHA1(fca488e86725a0a673332afeb0002f0e77ef2dbf) )
ROM_LOAD16_BYTE( "c04-08-1.10", 0x00001, 0x10000, CRC(19f7e66b) SHA1(51b5d0d00ec398ed717154286bec24b05c3f81b8) )
ROM_LOAD16_BYTE( "c04-11-1.29", 0x20000, 0x10000, CRC(1aaf6e9b) SHA1(4be643283dc78eb57e9fe4c5afebdc427e4354e8) )
@@ -356,7 +529,7 @@ ROM_START( volfiedu )
ROM_REGION( 0x2000, "cchip:cchip_eprom", 0 )
ROM_LOAD( "cchip_c04-23", 0x0000, 0x2000, CRC(46b0b479) SHA1(73aa2267eb468c5aa5db67183047e9aef8321215) )
- ROM_REGION( 0xc0000, "pc090oj", 0 ) /* sprites 16x16 */
+ ROM_REGION( 0xc0000, "pc090oj", 0 ) // sprites 16x16
ROM_LOAD16_BYTE( "c04-16.2", 0x00000, 0x20000, CRC(8c2476ef) SHA1(972ddc8e47a669f1aeca67d02b4a0bed867ddb7d) )
ROM_LOAD16_BYTE( "c04-18.4", 0x00001, 0x20000, CRC(7665212c) SHA1(b816ac2a95ee273aaf90991f53766d7f0d5d9238) )
ROM_LOAD16_BYTE( "c04-15.1", 0x40000, 0x20000, CRC(7c50b978) SHA1(aa9cad5f09f5d9dceaf4e06bcd347f1d5d02d292) )
@@ -366,16 +539,16 @@ ROM_START( volfiedu )
ROM_LOAD16_BYTE( "c04-09.14", 0x80001, 0x10000, CRC(c78cf057) SHA1(097982e57b1d20fbdf21986c23684adefe6f1ce1) )
ROM_RELOAD ( 0xa0001, 0x10000 )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound cpu */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "c04-06.71", 0x0000, 0x8000, CRC(b70106b2) SHA1(d71062f9d9b11492e13fc93982b95883f564f902) )
- ROM_REGION( 0x00400, "proms", 0 ) /* unused PROMs */
- ROM_LOAD( "c04-4-1.3", 0x00000, 0x00200, CRC(ab9fae65) SHA1(e2b29606aa63e42e041d3c47216551f62846bd99) ) /* PROM type is a MB7116H or compatible */
- ROM_LOAD( "c04-5.75", 0x00200, 0x00200, CRC(2763ec89) SHA1(1e8339e21ee35b526d8604a21cfed9a1ac6455e8) ) /* PROM type is a MB7124E or compatible */
+ ROM_REGION( 0x00400, "proms", 0 ) // unused
+ ROM_LOAD( "c04-4-1.3", 0x00000, 0x00200, CRC(ab9fae65) SHA1(e2b29606aa63e42e041d3c47216551f62846bd99) ) // PROM type is a MB7116H or compatible
+ ROM_LOAD( "c04-5.75", 0x00200, 0x00200, CRC(2763ec89) SHA1(1e8339e21ee35b526d8604a21cfed9a1ac6455e8) ) // PROM type is a MB7124E or compatible
ROM_END
ROM_START( volfieduo )
- ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code and tile data */
+ ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code and tile data
ROM_LOAD16_BYTE( "c04-12.30", 0x00000, 0x10000, CRC(e319c7ec) SHA1(e76fb872191fce0186ed0ac5066385a9913fdc4c) )
ROM_LOAD16_BYTE( "c04-08.10", 0x00001, 0x10000, CRC(81c6f755) SHA1(43ad72bb05d847f58b3043c674fb9b1e317691df) )
ROM_LOAD16_BYTE( "c04-11.29", 0x20000, 0x10000, CRC(f05696a6) SHA1(8514e5751e2f11840379e8cc6883a23cf1b3a4eb) )
@@ -388,7 +561,7 @@ ROM_START( volfieduo )
ROM_REGION( 0x2000, "cchip:cchip_eprom", 0 )
ROM_LOAD( "cchip_c04-23", 0x0000, 0x2000, CRC(46b0b479) SHA1(73aa2267eb468c5aa5db67183047e9aef8321215) )
- ROM_REGION( 0xc0000, "pc090oj", 0 ) /* sprites 16x16 */
+ ROM_REGION( 0xc0000, "pc090oj", 0 ) // sprites 16x16
ROM_LOAD16_BYTE( "c04-16.2", 0x00000, 0x20000, CRC(8c2476ef) SHA1(972ddc8e47a669f1aeca67d02b4a0bed867ddb7d) )
ROM_LOAD16_BYTE( "c04-18.4", 0x00001, 0x20000, CRC(7665212c) SHA1(b816ac2a95ee273aaf90991f53766d7f0d5d9238) )
ROM_LOAD16_BYTE( "c04-15.1", 0x40000, 0x20000, CRC(7c50b978) SHA1(aa9cad5f09f5d9dceaf4e06bcd347f1d5d02d292) )
@@ -398,16 +571,16 @@ ROM_START( volfieduo )
ROM_LOAD16_BYTE( "c04-09.14", 0x80001, 0x10000, CRC(c78cf057) SHA1(097982e57b1d20fbdf21986c23684adefe6f1ce1) )
ROM_RELOAD ( 0xa0001, 0x10000 )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound cpu */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "c04-06.71", 0x0000, 0x8000, CRC(b70106b2) SHA1(d71062f9d9b11492e13fc93982b95883f564f902) )
- ROM_REGION( 0x00400, "proms", 0 ) /* unused PROMs */
- ROM_LOAD( "c04-4-1.3", 0x00000, 0x00200, CRC(ab9fae65) SHA1(e2b29606aa63e42e041d3c47216551f62846bd99) ) /* PROM type is a MB7116H or compatible */
- ROM_LOAD( "c04-5.75", 0x00200, 0x00200, CRC(2763ec89) SHA1(1e8339e21ee35b526d8604a21cfed9a1ac6455e8) ) /* PROM type is a MB7124E or compatible */
+ ROM_REGION( 0x00400, "proms", 0 ) // unused
+ ROM_LOAD( "c04-4-1.3", 0x00000, 0x00200, CRC(ab9fae65) SHA1(e2b29606aa63e42e041d3c47216551f62846bd99) ) // PROM type is a MB7116H or compatible
+ ROM_LOAD( "c04-5.75", 0x00200, 0x00200, CRC(2763ec89) SHA1(1e8339e21ee35b526d8604a21cfed9a1ac6455e8) ) // PROM type is a MB7124E or compatible
ROM_END
ROM_START( volfiedj )
- ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code and tile data */
+ ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code and tile data
ROM_LOAD16_BYTE( "c04-12-1.30", 0x00000, 0x10000, CRC(afb6a058) SHA1(fca488e86725a0a673332afeb0002f0e77ef2dbf) )
ROM_LOAD16_BYTE( "c04-08-1.10", 0x00001, 0x10000, CRC(19f7e66b) SHA1(51b5d0d00ec398ed717154286bec24b05c3f81b8) )
ROM_LOAD16_BYTE( "c04-11-1.29", 0x20000, 0x10000, CRC(1aaf6e9b) SHA1(4be643283dc78eb57e9fe4c5afebdc427e4354e8) )
@@ -420,7 +593,7 @@ ROM_START( volfiedj )
ROM_REGION( 0x2000, "cchip:cchip_eprom", 0 )
ROM_LOAD( "cchip_c04-23", 0x0000, 0x2000, CRC(46b0b479) SHA1(73aa2267eb468c5aa5db67183047e9aef8321215) )
- ROM_REGION( 0xc0000, "pc090oj", 0 ) /* sprites 16x16 */
+ ROM_REGION( 0xc0000, "pc090oj", 0 ) // sprites 16x16
ROM_LOAD16_BYTE( "c04-16.2", 0x00000, 0x20000, CRC(8c2476ef) SHA1(972ddc8e47a669f1aeca67d02b4a0bed867ddb7d) )
ROM_LOAD16_BYTE( "c04-18.4", 0x00001, 0x20000, CRC(7665212c) SHA1(b816ac2a95ee273aaf90991f53766d7f0d5d9238) )
ROM_LOAD16_BYTE( "c04-15.1", 0x40000, 0x20000, CRC(7c50b978) SHA1(aa9cad5f09f5d9dceaf4e06bcd347f1d5d02d292) )
@@ -430,16 +603,16 @@ ROM_START( volfiedj )
ROM_LOAD16_BYTE( "c04-09.14", 0x80001, 0x10000, CRC(c78cf057) SHA1(097982e57b1d20fbdf21986c23684adefe6f1ce1) )
ROM_RELOAD ( 0xa0001, 0x10000 )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound cpu */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "c04-06.71", 0x0000, 0x8000, CRC(b70106b2) SHA1(d71062f9d9b11492e13fc93982b95883f564f902) )
- ROM_REGION( 0x00400, "proms", 0 ) /* unused PROMs */
- ROM_LOAD( "c04-4-1.3", 0x00000, 0x00200, CRC(ab9fae65) SHA1(e2b29606aa63e42e041d3c47216551f62846bd99) ) /* PROM type is a MB7116H or compatible */
- ROM_LOAD( "c04-5.75", 0x00200, 0x00200, CRC(2763ec89) SHA1(1e8339e21ee35b526d8604a21cfed9a1ac6455e8) ) /* PROM type is a MB7124E or compatible */
+ ROM_REGION( 0x00400, "proms", 0 ) // unused
+ ROM_LOAD( "c04-4-1.3", 0x00000, 0x00200, CRC(ab9fae65) SHA1(e2b29606aa63e42e041d3c47216551f62846bd99) ) // PROM type is a MB7116H or compatible
+ ROM_LOAD( "c04-5.75", 0x00200, 0x00200, CRC(2763ec89) SHA1(1e8339e21ee35b526d8604a21cfed9a1ac6455e8) ) // PROM type is a MB7124E or compatible
ROM_END
ROM_START( volfiedjo )
- ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 code and tile data */
+ ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code and tile data
ROM_LOAD16_BYTE( "c04-12.30", 0x00000, 0x10000, CRC(e319c7ec) SHA1(e76fb872191fce0186ed0ac5066385a9913fdc4c) )
ROM_LOAD16_BYTE( "c04-08.10", 0x00001, 0x10000, CRC(81c6f755) SHA1(43ad72bb05d847f58b3043c674fb9b1e317691df) )
ROM_LOAD16_BYTE( "c04-11.29", 0x20000, 0x10000, CRC(f05696a6) SHA1(8514e5751e2f11840379e8cc6883a23cf1b3a4eb) )
@@ -452,7 +625,7 @@ ROM_START( volfiedjo )
ROM_REGION( 0x2000, "cchip:cchip_eprom", 0 )
ROM_LOAD( "cchip_c04-23", 0x0000, 0x2000, CRC(46b0b479) SHA1(73aa2267eb468c5aa5db67183047e9aef8321215) )
- ROM_REGION( 0xc0000, "pc090oj", 0 ) /* sprites 16x16 */
+ ROM_REGION( 0xc0000, "pc090oj", 0 ) // sprites 16x16
ROM_LOAD16_BYTE( "c04-16.2", 0x00000, 0x20000, CRC(8c2476ef) SHA1(972ddc8e47a669f1aeca67d02b4a0bed867ddb7d) )
ROM_LOAD16_BYTE( "c04-18.4", 0x00001, 0x20000, CRC(7665212c) SHA1(b816ac2a95ee273aaf90991f53766d7f0d5d9238) )
ROM_LOAD16_BYTE( "c04-15.1", 0x40000, 0x20000, CRC(7c50b978) SHA1(aa9cad5f09f5d9dceaf4e06bcd347f1d5d02d292) )
@@ -462,14 +635,16 @@ ROM_START( volfiedjo )
ROM_LOAD16_BYTE( "c04-09.14", 0x80001, 0x10000, CRC(c78cf057) SHA1(097982e57b1d20fbdf21986c23684adefe6f1ce1) )
ROM_RELOAD ( 0xa0001, 0x10000 )
- ROM_REGION( 0x10000, "audiocpu", 0 ) /* sound cpu */
+ ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "c04-06.71", 0x0000, 0x8000, CRC(b70106b2) SHA1(d71062f9d9b11492e13fc93982b95883f564f902) )
- ROM_REGION( 0x00400, "proms", 0 ) /* unused PROMs */
- ROM_LOAD( "c04-4-1.3", 0x00000, 0x00200, CRC(ab9fae65) SHA1(e2b29606aa63e42e041d3c47216551f62846bd99) ) /* PROM type is a MB7116H or compatible */
- ROM_LOAD( "c04-5.75", 0x00200, 0x00200, CRC(2763ec89) SHA1(1e8339e21ee35b526d8604a21cfed9a1ac6455e8) ) /* PROM type is a MB7124E or compatible */
+ ROM_REGION( 0x00400, "proms", 0 ) // unused
+ ROM_LOAD( "c04-4-1.3", 0x00000, 0x00200, CRC(ab9fae65) SHA1(e2b29606aa63e42e041d3c47216551f62846bd99) ) // PROM type is a MB7116H or compatible
+ ROM_LOAD( "c04-5.75", 0x00200, 0x00200, CRC(2763ec89) SHA1(1e8339e21ee35b526d8604a21cfed9a1ac6455e8) ) // PROM type is a MB7124E or compatible
ROM_END
+} // anonymous namespace
+
GAME( 1989, volfied, 0, volfied, volfied, volfied_state, empty_init, ROT270, "Taito Corporation Japan", "Volfied (World, revision 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1989, volfiedu, volfied, volfied, volfiedu, volfied_state, empty_init, ROT270, "Taito America Corporation", "Volfied (US, revision 1)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/taito/volfied.h b/src/mame/taito/volfied.h
deleted file mode 100644
index 72842847176..00000000000
--- a/src/mame/taito/volfied.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Bryan McPhail, Nicola Salmoria
-/*************************************************************************
-
- Volfied
-
-*************************************************************************/
-#ifndef MAME_INCLUDES_VOLFIED_H
-#define MAME_INCLUDES_VOLFIED_H
-
-#pragma once
-
-#include "taitocchip.h"
-#include "pc090oj.h"
-#include "screen.h"
-#include "machine/timer.h"
-
-class volfied_state : public driver_device
-{
-public:
- volfied_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_cchip(*this, "cchip"),
- m_pc090oj(*this, "pc090oj"),
- m_screen(*this, "screen"),
- m_cchip_irq_clear(*this, "cchip_irq_clear")
- { }
-
- void volfied(machine_config &config);
-
-protected:
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
-
-private:
- uint16_t video_ram_r(offs_t offset);
- void video_ram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
- void video_ctrl_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
- uint16_t video_ctrl_r();
- void video_mask_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
- void counters_w(uint8_t data);
- void volfied_colpri_cb(u32 &sprite_colbank, u32 &pri_mask, u16 sprite_ctrl);
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- INTERRUPT_GEN_MEMBER(interrupt);
- TIMER_DEVICE_CALLBACK_MEMBER(cchip_irq_clear_cb);
-
- void refresh_pixel_layer( bitmap_ind16 &bitmap );
-
- void main_map(address_map &map);
- void z80_map(address_map &map);
-
- /* memory pointers */
- std::unique_ptr<uint16_t[]> m_video_ram;
-
- /* video-related */
- uint16_t m_video_ctrl = 0;
- uint16_t m_video_mask = 0;
-
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
- required_device<taito_cchip_device> m_cchip;
- required_device<pc090oj_device> m_pc090oj;
- required_device<screen_device> m_screen;
-
- required_device<timer_device> m_cchip_irq_clear;
-};
-
-#endif // MAME_INCLUDES_VOLFIED_H
diff --git a/src/mame/taito/volfied_v.cpp b/src/mame/taito/volfied_v.cpp
deleted file mode 100644
index b4d03171e14..00000000000
--- a/src/mame/taito/volfied_v.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Bryan McPhail, Nicola Salmoria
-#include "emu.h"
-#include "volfied.h"
-
-/******************************************************
- INITIALISATION AND CLEAN-UP
-******************************************************/
-
-void volfied_state::video_start()
-{
- m_video_ram = std::make_unique<uint16_t[]>(0x40000);
-
- m_video_ctrl = 0;
- m_video_mask = 0;
-
- save_pointer(NAME(m_video_ram), 0x40000);
- save_item(NAME(m_video_ctrl));
- save_item(NAME(m_video_mask));
-}
-
-
-/*******************************************************
- READ AND WRITE HANDLERS
-*******************************************************/
-
-uint16_t volfied_state::video_ram_r(offs_t offset)
-{
- return m_video_ram[offset];
-}
-
-void volfied_state::video_ram_w(offs_t offset, uint16_t data, uint16_t mem_mask)
-{
- mem_mask &= m_video_mask;
-
- COMBINE_DATA(&m_video_ram[offset]);
-}
-
-void volfied_state::video_ctrl_w(offs_t offset, uint16_t data, uint16_t mem_mask)
-{
- COMBINE_DATA(&m_video_ctrl);
-}
-
-uint16_t volfied_state::video_ctrl_r()
-{
- /* Could this be some kind of hardware collision detection? If bit 6 is
- set the game will check for collisions with the large enemy, whereas
- bit 5 does the same for small enemies. Bit 7 is also used although
- its purpose is unclear. This register is usually read during a VBI
- and stored in work RAM for later use. */
-
- return 0x60;
-}
-
-void volfied_state::video_mask_w(offs_t offset, uint16_t data, uint16_t mem_mask)
-{
- COMBINE_DATA(&m_video_mask);
-}
-
-void volfied_state::volfied_colpri_cb(u32 &sprite_colbank, u32 &pri_mask, u16 sprite_ctrl)
-{
- sprite_colbank = 0x100 | ((sprite_ctrl & 0x3c) << 2);
- pri_mask = 0; /* sprites over everything */
-}
-
-
-/*******************************************************
- SCREEN REFRESH
-*******************************************************/
-
-void volfied_state::refresh_pixel_layer( bitmap_ind16 &bitmap )
-{
- /*********************************************************
-
- VIDEO RAM has 2 screens x 256 rows x 512 columns x 16 bits
-
- x--------------- select image
- -x-------------- ? (used for 3-D corners)
- --x------------- ? (used for 3-D walls)
- ---xxxx--------- image B
- -------xxx------ palette index bits #8 to #A
- ----------x----- ?
- -----------x---- ?
- ------------xxxx image A
-
- '3d' corners & walls are made using unknown bits for each
- line the player draws. However, on the pcb they just
- appear as solid black. Perhaps it was prototype code that
- was turned off at some stage.
-
- *********************************************************/
-
- uint16_t* p = m_video_ram.get();
- int width = m_screen->width();
- int height = m_screen->height();
-
- if (m_video_ctrl & 1)
- p += 0x20000;
-
- for (int y = 0; y < height; y++)
- {
- for (int x = 1; x < width + 1; x++) // Hmm, 1 pixel offset is needed to align properly with sprites
- {
- int color = (p[x] << 2) & 0x700;
-
- if (p[x] & 0x8000)
- {
- color |= 0x800 | ((p[x] >> 9) & 0xf);
-
- if (p[x] & 0x2000)
- color &= ~0xf; /* hack */
- }
- else
- color |= p[x] & 0xf;
-
- bitmap.pix(y, x - 1) = color;
- }
-
- p += 512;
- }
-}
-
-uint32_t volfied_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- screen.priority().fill(0, cliprect);
- refresh_pixel_layer(bitmap);
- m_pc090oj->draw_sprites(screen, bitmap, cliprect);
- return 0;
-}
diff --git a/src/mame/taito/warriorb.cpp b/src/mame/taito/warriorb.cpp
index dcd2c19b2dc..a137bc2e9f0 100644
--- a/src/mame/taito/warriorb.cpp
+++ b/src/mame/taito/warriorb.cpp
@@ -1,6 +1,7 @@
// license:BSD-3-Clause
-// copyright-holders:David Graves
-// thanks-to:Richard Bush
+// copyright-holders: David Graves
+// thanks-to: Richard Bush
+
/***************************************************************************
Taito Dual Screen Games
@@ -18,12 +19,12 @@ source was very helpful in many areas particularly the sprites.)
*****
The dual screen games operate on hardware with various similarities to
-the Taito F2 system, as they share some custom ics e.g. the TC0100SCN.
+the Taito F2 system, as they share some custom ICs e.g. the TC0100SCN.
For each screen the games have 3 separate layers of graphics: - one
128x64 tiled scrolling background plane of 8x8 tiles, a similar
foreground plane, and a 128x32 text plane with character definitions
-held in ram. As well as this, there is a single sprite plane which
+held in RAM. As well as this, there is a single sprite plane which
covers both screens. The sprites are 16x16 and are not zoomable.
Writing to the first TC0100SCN "writes through" to the subsidiary one
@@ -147,17 +148,197 @@ Colscroll effects?
***************************************************************************/
#include "emu.h"
-#include "warriorb.h"
+
+#include "taitoio.h"
#include "taitoipt.h"
+#include "taitosnd.h"
+#include "tc0100scn.h"
+#include "tc0110pcr.h"
#include "cpu/z80/z80.h"
#include "cpu/m68000/m68000.h"
+#include "sound/flt_vol.h"
#include "sound/ymopn.h"
-#include "layout/generic.h"
+#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+#include "layout/generic.h"
+
+
+// configurable logging
+#define LOG_PANDATA (1U << 1)
+
+//#define VERBOSE (LOG_GENERAL | LOG_PANDATA)
+
+#include "logmacro.h"
+
+#define LOGPANDATA(...) LOGMASKED(LOG_PANDATA, __VA_ARGS__)
+
+
+namespace {
+
+class warriorb_state : public driver_device
+{
+public:
+ warriorb_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_tc0140syt(*this, "tc0140syt"),
+ m_tc0100scn(*this, "tc0100scn_%u", 1),
+ m_tc0110pcr(*this, "tc0110pcr_%u", 1),
+ m_2610_l(*this, "2610.%u.l", 1),
+ m_2610_r(*this, "2610.%u.r", 1),
+ m_gfxdecode(*this, "gfxdecode_%u", 1),
+ m_spriteram(*this, "spriteram"),
+ m_z80bank(*this, "z80bank")
+ { }
+
+ void warriorb(machine_config &config);
+ void darius2d(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+private:
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<tc0140syt_device> m_tc0140syt;
+ required_device_array<tc0100scn_device, 2> m_tc0100scn;
+ required_device_array<tc0110pcr_device, 2> m_tc0110pcr;
+ required_device_array<filter_volume_device, 2> m_2610_l;
+ required_device_array<filter_volume_device, 2> m_2610_r;
+ required_device_array<gfxdecode_device, 2> m_gfxdecode;
+
+ // memory pointers
+ required_shared_ptr<u16> m_spriteram;
+
+ // memory regions
+ required_memory_bank m_z80bank;
+
+ // misc
+ u16 m_pandata[4]{};
+
+ void coin_control_w(u8 data);
+ void sound_bankswitch_w(u8 data);
+ void pancontrol_w(offs_t offset, u8 data);
+ void tc0100scn_dual_screen_w(offs_t offset, u16 data, u16 mem_mask = ~0);
+
+ void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs, int chip);
+ template <u8 Which> u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ void darius2d_main_map(address_map &map);
+ void warriorb_main_map(address_map &map);
+ void z80_sound_map(address_map &map);
+};
+
+
+// video
+
+/************************************************************
+ SPRITE DRAW ROUTINE
+************************************************************/
+
+void warriorb_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs, int chip)
+{
+#ifdef MAME_DEBUG
+ int unknown = 0;
+#endif
+
+ // pdrawgfx() needs us to draw sprites front to back
+ for (int offs = 0; offs < m_spriteram.bytes() / 2; offs += 4)
+ {
+ int data = m_spriteram[offs + 1];
+ const u32 tilenum = data & 0x7fff;
+
+ data = m_spriteram[offs + 0];
+ int y = (-(data & 0x1ff) - 24) & 0x1ff; // (inverted y adjusted for vis area)
+ const bool flipy = (data & 0x200) >> 9;
+
+ const u16 data2 = m_spriteram[offs + 2];
+ // 8,4 also seen in msbyte
+ const int priority = (data2 & 0x0100) >> 8; // 1 = low
+
+ u32 pri_mask;
+
+ if (priority)
+ pri_mask = 0xfffe;
+ else
+ pri_mask = 0;
+
+ const u32 color = (data2 & 0x7f);
+
+ data = m_spriteram[offs + 3];
+ int x = (data & 0x3ff);
+ const bool flipx = (data & 0x400) >> 10;
+
+#ifdef MAME_DEBUG
+ if (data2 & 0xf280) unknown |= (data2 &0xf280);
+#endif
+
+ x -= x_offs;
+ y += y_offs;
+
+ // sprite wrap: coords become negative at high values
+ if (x > 0x3c0) x -= 0x400;
+ if (y > 0x180) y -= 0x200;
+
+ m_gfxdecode[chip]->gfx(0)->prio_transpen(bitmap, cliprect,
+ tilenum,
+ color,
+ flipx, flipy,
+ x, y,
+ screen.priority(), pri_mask, 0);
+ }
+
+#ifdef MAME_DEBUG
+ if (unknown)
+ popmessage("unknown sprite bits: %04x", unknown);
+#endif
+}
+
+
+/**************************************************************
+ SCREEN REFRESH
+**************************************************************/
+
+template <u8 Which>
+u32 warriorb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+{
+ u8 layer[3];
+
+ m_tc0100scn[Which]->tilemap_update();
+
+ layer[0] = m_tc0100scn[Which]->bottomlayer();
+ layer[1] = layer[0] ^ 1;
+ layer[2] = 2;
+
+ // Clear priority bitmap */
+ screen.priority().fill(0, cliprect);
+
+ /* chip 0 does tilemaps on the left, chip 1 does the ones on the right */
+ // draw bottom layer
+ const u8 nodraw = m_tc0100scn[Which]->tilemap_draw(screen, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 0); // left
+
+ // Ensure screen blanked even when bottom layers not drawn due to disable bit
+ if (nodraw)
+ bitmap.fill(m_tc0110pcr[Which]->black_pen(), cliprect);
+
+ // draw middle layer
+ m_tc0100scn[Which]->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 1);
+
+ // Sprites can be under/over the layer below text layer
+ const int xoffs = 40 * 8;
+ draw_sprites(screen, bitmap, cliprect, xoffs * Which, 8, Which);
+
+ // draw top (text) layer
+ m_tc0100scn[Which]->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 0);
+ return 0;
+}
+
+// machine
void warriorb_state::coin_control_w(u8 data)
{
@@ -192,8 +373,8 @@ void warriorb_state::pancontrol_w(offs_t offset, u8 data)
case 3: flt = m_2610_r[1]; break;
}
- m_pandata[offset] = (data << 1) + data; /* original volume*3 */
- //popmessage(" pan %02x %02x %02x %02x", m_pandata[0], m_pandata[1], m_pandata[2], m_pandata[3] );
+ m_pandata[offset] = (data << 1) + data; // original volume * 3
+ LOGPANDATA("pan %02x %02x %02x %02x", m_pandata[0], m_pandata[1], m_pandata[2], m_pandata[3]);
flt->flt_volume_set_volume(m_pandata[offset] / 100.0);
}
@@ -208,36 +389,36 @@ void warriorb_state::tc0100scn_dual_screen_w(offs_t offset, u16 data, u16 mem_ma
MEMORY STRUCTURES
***********************************************************/
-void warriorb_state::darius2d_map(address_map &map)
+void warriorb_state::darius2d_main_map(address_map &map)
{
map(0x000000, 0x0fffff).rom();
- map(0x100000, 0x10ffff).ram(); /* main ram */
- map(0x200000, 0x213fff).r(m_tc0100scn[0], FUNC(tc0100scn_device::ram_r)).w(FUNC(warriorb_state::tc0100scn_dual_screen_w)); /* tilemaps (all screens) */
- map(0x214000, 0x2141ff).nopw(); /* error in screen clearing code ? */
+ map(0x100000, 0x10ffff).ram(); // main RAM
+ map(0x200000, 0x213fff).r(m_tc0100scn[0], FUNC(tc0100scn_device::ram_r)).w(FUNC(warriorb_state::tc0100scn_dual_screen_w)); // tilemaps (all screens)
+ map(0x214000, 0x2141ff).nopw(); // error in screen clearing code ?
map(0x220000, 0x22000f).rw(m_tc0100scn[0], FUNC(tc0100scn_device::ctrl_r), FUNC(tc0100scn_device::ctrl_w));
- map(0x240000, 0x253fff).rw(m_tc0100scn[1], FUNC(tc0100scn_device::ram_r), FUNC(tc0100scn_device::ram_w)); /* tilemaps (2nd screen) */
+ map(0x240000, 0x253fff).rw(m_tc0100scn[1], FUNC(tc0100scn_device::ram_r), FUNC(tc0100scn_device::ram_w)); // tilemaps (2nd screen)
map(0x260000, 0x26000f).rw(m_tc0100scn[1], FUNC(tc0100scn_device::ctrl_r), FUNC(tc0100scn_device::ctrl_w));
- map(0x400000, 0x400007).rw(m_tc0110pcr[0], FUNC(tc0110pcr_device::word_r), FUNC(tc0110pcr_device::step1_word_w)); /* palette (1st screen) */
- map(0x420000, 0x420007).rw(m_tc0110pcr[1], FUNC(tc0110pcr_device::word_r), FUNC(tc0110pcr_device::step1_word_w)); /* palette (2nd screen) */
- map(0x600000, 0x6013ff).ram().share("spriteram");
- map(0x800000, 0x80000f).rw(m_tc0220ioc, FUNC(tc0220ioc_device::read), FUNC(tc0220ioc_device::write)).umask16(0x00ff);
+ map(0x400000, 0x400007).rw(m_tc0110pcr[0], FUNC(tc0110pcr_device::word_r), FUNC(tc0110pcr_device::step1_word_w)); // palette (1st screen)
+ map(0x420000, 0x420007).rw(m_tc0110pcr[1], FUNC(tc0110pcr_device::word_r), FUNC(tc0110pcr_device::step1_word_w)); // palette (2nd screen)
+ map(0x600000, 0x6013ff).ram().share(m_spriteram);
+ map(0x800000, 0x80000f).rw("tc0220ioc", FUNC(tc0220ioc_device::read), FUNC(tc0220ioc_device::write)).umask16(0x00ff);
// map(0x820000, 0x820001).nopw(); // ???
map(0x830001, 0x830001).w(m_tc0140syt, FUNC(tc0140syt_device::master_port_w));
map(0x830003, 0x830003).rw(m_tc0140syt, FUNC(tc0140syt_device::master_comm_r), FUNC(tc0140syt_device::master_comm_w));
}
-void warriorb_state::warriorb_map(address_map &map)
+void warriorb_state::warriorb_main_map(address_map &map)
{
map(0x000000, 0x1fffff).rom();
map(0x200000, 0x213fff).ram();
- map(0x300000, 0x313fff).r(m_tc0100scn[0], FUNC(tc0100scn_device::ram_r)).w(FUNC(warriorb_state::tc0100scn_dual_screen_w)); /* tilemaps (all screens) */
+ map(0x300000, 0x313fff).r(m_tc0100scn[0], FUNC(tc0100scn_device::ram_r)).w(FUNC(warriorb_state::tc0100scn_dual_screen_w)); // tilemaps (all screens)
map(0x320000, 0x32000f).rw(m_tc0100scn[0], FUNC(tc0100scn_device::ctrl_r), FUNC(tc0100scn_device::ctrl_w));
- map(0x340000, 0x353fff).rw(m_tc0100scn[1], FUNC(tc0100scn_device::ram_r), FUNC(tc0100scn_device::ram_w)); /* tilemaps (2nd screen) */
+ map(0x340000, 0x353fff).rw(m_tc0100scn[1], FUNC(tc0100scn_device::ram_r), FUNC(tc0100scn_device::ram_w)); // tilemaps (2nd screen)
map(0x360000, 0x36000f).rw(m_tc0100scn[1], FUNC(tc0100scn_device::ctrl_r), FUNC(tc0100scn_device::ctrl_w));
- map(0x400000, 0x400007).rw(m_tc0110pcr[0], FUNC(tc0110pcr_device::word_r), FUNC(tc0110pcr_device::step1_word_w)); /* palette (1st screen) */
- map(0x420000, 0x420007).rw(m_tc0110pcr[1], FUNC(tc0110pcr_device::word_r), FUNC(tc0110pcr_device::step1_word_w)); /* palette (2nd screen) */
- map(0x600000, 0x6013ff).ram().share("spriteram");
- map(0x800000, 0x80000f).rw(m_tc0510nio, FUNC(tc0510nio_device::read), FUNC(tc0510nio_device::write)).umask16(0x00ff);
+ map(0x400000, 0x400007).rw(m_tc0110pcr[0], FUNC(tc0110pcr_device::word_r), FUNC(tc0110pcr_device::step1_word_w)); // palette (1st screen)
+ map(0x420000, 0x420007).rw(m_tc0110pcr[1], FUNC(tc0110pcr_device::word_r), FUNC(tc0110pcr_device::step1_word_w)); // palette (2nd screen)
+ map(0x600000, 0x6013ff).ram().share(m_spriteram);
+ map(0x800000, 0x80000f).rw("tc0510nio", FUNC(tc0510nio_device::read), FUNC(tc0510nio_device::write)).umask16(0x00ff);
// map(0x820000, 0x820001).nopw(); // ? uses bits 0,2,3
map(0x830001, 0x830001).w(m_tc0140syt, FUNC(tc0140syt_device::master_port_w));
map(0x830003, 0x830003).rw(m_tc0140syt, FUNC(tc0140syt_device::master_comm_r), FUNC(tc0140syt_device::master_comm_w));
@@ -248,15 +429,15 @@ void warriorb_state::warriorb_map(address_map &map)
void warriorb_state::z80_sound_map(address_map &map)
{
map(0x0000, 0x3fff).rom();
- map(0x4000, 0x7fff).bankr("z80bank");
+ map(0x4000, 0x7fff).bankr(m_z80bank);
map(0xc000, 0xdfff).ram();
map(0xe000, 0xe003).rw("ymsnd", FUNC(ym_generic_device::read), FUNC(ym_generic_device::write));
map(0xe200, 0xe200).nopr().w(m_tc0140syt, FUNC(tc0140syt_device::slave_port_w));
map(0xe201, 0xe201).rw(m_tc0140syt, FUNC(tc0140syt_device::slave_comm_r), FUNC(tc0140syt_device::slave_comm_w));
- map(0xe400, 0xe403).w(FUNC(warriorb_state::pancontrol_w)); /* pan */
+ map(0xe400, 0xe403).w(FUNC(warriorb_state::pancontrol_w));
map(0xea00, 0xea00).nopr();
- map(0xee00, 0xee00).nopw(); /* ? */
- map(0xf000, 0xf000).nopw(); /* ? */
+ map(0xee00, 0xee00).nopw(); // ?
+ map(0xf000, 0xf000).nopw(); // ?
map(0xf200, 0xf200).w(FUNC(warriorb_state::sound_bankswitch_w));
}
@@ -266,9 +447,9 @@ void warriorb_state::z80_sound_map(address_map &map)
***********************************************************/
static INPUT_PORTS_START( darius2d )
- /* 0x800000 -> 0x109e16 ($1e16,A5) and 0x109e1a ($1e1a,A5) */
+ // 0x800000 -> 0x109e16 ($1e16,A5) and 0x109e1a ($1e1a,A5)
PORT_START("DSWA")
- PORT_DIPNAME( 0x01, 0x01, "Difficulty Enhancement" ) PORT_DIPLOCATION("SW1:1") /* code at 0x0170f2 ('darius2d') or 0x01705c ('drius2do') */
+ PORT_DIPNAME( 0x01, 0x01, "Difficulty Enhancement" ) PORT_DIPLOCATION("SW1:1") // code at 0x0170f2 ('darius2d') or 0x01705c ('drius2do')
PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) // Easy Medium Hard Hardest // Japan factory default = "Off"
PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // Easy- Medium+ Hard+ Hardest+ // "Easy-" is easier than "Easy". "Medium+","Hard+" and "hardest+" are harder than "Medium","Hard" and "hardest".
PORT_DIPNAME( 0x02, 0x02, "Auto Fire" ) PORT_DIPLOCATION("SW1:2")
@@ -277,7 +458,7 @@ static INPUT_PORTS_START( darius2d )
TAITO_DSWA_BITS_2_TO_3_LOC(SW1)
TAITO_COINAGE_JAPAN_OLD_LOC(SW1)
- /* 0x800002 -> 0x109e18 ($1e18,A5) and 0x109e1c ($1e1c,A5) */
+ // 0x800002 -> 0x109e18 ($1e18,A5) and 0x109e1c ($1e1c,A5)
PORT_START("DSWB")
TAITO_DIFFICULTY_LOC(SW2)
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:3,4")
@@ -323,7 +504,7 @@ static INPUT_PORTS_START( sagaia )
PORT_INCLUDE(darius2d)
PORT_MODIFY("DSWA")
- PORT_DIPNAME( 0x01, 0x00, "Difficulty Enhancement" ) PORT_DIPLOCATION("SW1:1") /* code at 0x0170f2 ('darius2d') or 0x01705c ('drius2do') */
+ PORT_DIPNAME( 0x01, 0x00, "Difficulty Enhancement" ) PORT_DIPLOCATION("SW1:1") // code at 0x0170f2 ('darius2d') or 0x01705c ('drius2do')
PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) // Easy Medium Hard Hardest
PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // Easy- Medium+ Hard+ Hardest+
// MAME 0.143u7 SW1:1="Unknown / Off / On" default="On"
@@ -334,9 +515,9 @@ INPUT_PORTS_END
static INPUT_PORTS_START( warriorb )
PORT_INCLUDE(darius2d)
- /* 0x800000 -> 0x202912.b (-$56ee,A5) */
+ // 0x800000 -> 0x202912.b (-$56ee,A5)
PORT_MODIFY("DSWA")
- PORT_DIPNAME( 0x03, 0x03, "Vitality Recovery" ) PORT_DIPLOCATION("SW1:1,2") /* table at 0x00d508 - 4 * 4 words */
+ PORT_DIPNAME( 0x03, 0x03, "Vitality Recovery" ) PORT_DIPLOCATION("SW1:1,2") // table at 0x00d508 - 4 * 4 words
PORT_DIPSETTING( 0x02, "Less" )
PORT_DIPSETTING( 0x03, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x01, "More" )
@@ -344,13 +525,13 @@ static INPUT_PORTS_START( warriorb )
TAITO_DSWA_BITS_2_TO_3_LOC(SW1)
TAITO_COINAGE_JAPAN_NEW_LOC(SW1)
- /* 0x800002 -> 0x202913.b (-$56ed,A5) */
+ // 0x800002 -> 0x202913.b (-$56ed,A5)
PORT_MODIFY("DSWB")
TAITO_DIFFICULTY_LOC(SW2)
PORT_DIPNAME( 0x04, 0x04, "Gold Sheep at" ) PORT_DIPLOCATION("SW2:3")
PORT_DIPSETTING( 0x04, "50k only" )
PORT_DIPSETTING( 0x00, "50k then every 70k" )
- PORT_DIPNAME( 0x08, 0x08, "Magic Energy Loss" ) PORT_DIPLOCATION("SW2:4") /* code at 0x0587de - when BUTTON3 pressed */
+ PORT_DIPNAME( 0x08, 0x08, "Magic Energy Loss" ) PORT_DIPLOCATION("SW2:4") // code at 0x0587de - when BUTTON3 pressed
PORT_DIPSETTING( 0x08, "Always Player" )
PORT_DIPSETTING( 0x00, "Player or Magician" )
PORT_DIPNAME( 0x10, 0x10, "Player Starting Strength" ) PORT_DIPLOCATION("SW2:5")
@@ -367,7 +548,7 @@ static INPUT_PORTS_START( warriorb )
PORT_DIPSETTING( 0x00, "Long (14)" )
PORT_MODIFY("IN0")
- /* Japanese version actually doesn't have the third button */
+ // Japanese version actually doesn't have the third button
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Button 3 (Cheat)")
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Button 3 (Cheat)")
INPUT_PORTS_END
@@ -378,7 +559,7 @@ INPUT_PORTS_END
***********************************************************/
static GFXDECODE_START( gfx_warriorb )
- GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_lsb, 0, 256 ) /* sprites */
+ GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_lsb, 0, 256 )
GFXDECODE_END
/***********************************************************
@@ -395,28 +576,28 @@ void warriorb_state::machine_start()
void warriorb_state::machine_reset()
{
/**** mixer control enable ****/
- machine().sound().system_mute(false); /* mixer enabled */
+ machine().sound().system_mute(false); // mixer enabled
}
void warriorb_state::darius2d(machine_config &config)
{
- /* basic machine hardware */
- M68000(config, m_maincpu, 16_MHz_XTAL); /* MC68000P12F 16 MHz, 16 MHz XTAL */
- m_maincpu->set_addrmap(AS_PROGRAM, &warriorb_state::darius2d_map);
+ // basic machine hardware */
+ M68000(config, m_maincpu, 16_MHz_XTAL); // MC68000P12F 16 MHz, 16 MHz XTAL
+ m_maincpu->set_addrmap(AS_PROGRAM, &warriorb_state::darius2d_main_map);
m_maincpu->set_vblank_int("lscreen", FUNC(warriorb_state::irq4_line_hold));
- z80_device &audiocpu(Z80(config, "audiocpu", 16_MHz_XTAL / 4)); /* 4 MHz (16 MHz XTAL / 4) */
+ z80_device &audiocpu(Z80(config, "audiocpu", 16_MHz_XTAL / 4)); // 4 MHz (16 MHz XTAL / 4)
audiocpu.set_addrmap(AS_PROGRAM, &warriorb_state::z80_sound_map);
- TC0220IOC(config, m_tc0220ioc, 0);
- m_tc0220ioc->read_0_callback().set_ioport("DSWA");
- m_tc0220ioc->read_1_callback().set_ioport("DSWB");
- m_tc0220ioc->read_2_callback().set_ioport("IN0");
- m_tc0220ioc->read_3_callback().set_ioport("IN1");
- m_tc0220ioc->write_4_callback().set(FUNC(warriorb_state::coin_control_w));
- m_tc0220ioc->read_7_callback().set_ioport("IN2");
+ tc0220ioc_device & tc0220ioc(TC0220IOC(config, "tc0220ioc", 0));
+ tc0220ioc.read_0_callback().set_ioport("DSWA");
+ tc0220ioc.read_1_callback().set_ioport("DSWB");
+ tc0220ioc.read_2_callback().set_ioport("IN0");
+ tc0220ioc.read_3_callback().set_ioport("IN1");
+ tc0220ioc.write_4_callback().set(FUNC(warriorb_state::coin_control_w));
+ tc0220ioc.read_7_callback().set_ioport("IN2");
- /* video hardware */
+ // video hardware
GFXDECODE(config, m_gfxdecode[0], m_tc0110pcr[0], gfx_warriorb);
GFXDECODE(config, m_gfxdecode[1], m_tc0110pcr[1], gfx_warriorb);
@@ -427,7 +608,7 @@ void warriorb_state::darius2d(machine_config &config)
lscreen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
lscreen.set_size(40*8, 32*8);
lscreen.set_visarea(0*8, 40*8-1, 3*8, 32*8-1);
- lscreen.set_screen_update(FUNC(warriorb_state::screen_update_left));
+ lscreen.set_screen_update(FUNC(warriorb_state::screen_update<0>));
lscreen.set_palette(m_tc0110pcr[0]);
TC0100SCN(config, m_tc0100scn[0], 0);
@@ -441,7 +622,7 @@ void warriorb_state::darius2d(machine_config &config)
rscreen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
rscreen.set_size(40*8, 32*8);
rscreen.set_visarea(0*8, 40*8-1, 3*8, 32*8-1);
- rscreen.set_screen_update(FUNC(warriorb_state::screen_update_right));
+ rscreen.set_screen_update(FUNC(warriorb_state::screen_update<1>));
rscreen.set_palette(m_tc0110pcr[1]);
TC0100SCN(config, m_tc0100scn[1], 0);
@@ -451,7 +632,7 @@ void warriorb_state::darius2d(machine_config &config)
TC0110PCR(config, m_tc0110pcr[1], 0);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
SPEAKER(config, "subwoofer").seat();
@@ -476,21 +657,21 @@ void warriorb_state::darius2d(machine_config &config)
void warriorb_state::warriorb(machine_config &config)
{
- /* basic machine hardware */
- M68000(config, m_maincpu, 16_MHz_XTAL); /* MC68000P12F 16 MHz, 16 MHz XTAL */
- m_maincpu->set_addrmap(AS_PROGRAM, &warriorb_state::warriorb_map);
+ // basic machine hardware
+ M68000(config, m_maincpu, 16_MHz_XTAL); // MC68000P12F 16 MHz, 16 MHz XTAL
+ m_maincpu->set_addrmap(AS_PROGRAM, &warriorb_state::warriorb_main_map);
m_maincpu->set_vblank_int("lscreen", FUNC(warriorb_state::irq4_line_hold));
- z80_device &audiocpu(Z80(config, "audiocpu", 16_MHz_XTAL / 4)); /* 4 MHz (16 MHz XTAL / 4) */
+ z80_device &audiocpu(Z80(config, "audiocpu", 16_MHz_XTAL / 4)); // 4 MHz (16 MHz XTAL / 4)
audiocpu.set_addrmap(AS_PROGRAM, &warriorb_state::z80_sound_map);
- TC0510NIO(config, m_tc0510nio, 0);
- m_tc0510nio->read_0_callback().set_ioport("DSWA");
- m_tc0510nio->read_1_callback().set_ioport("DSWB");
- m_tc0510nio->read_2_callback().set_ioport("IN0");
- m_tc0510nio->read_3_callback().set_ioport("IN1");
- m_tc0510nio->write_4_callback().set(FUNC(warriorb_state::coin_control_w));
- m_tc0510nio->read_7_callback().set_ioport("IN2");
+ tc0510nio_device &tc0510nio(TC0510NIO(config, "tc0510nio", 0));
+ tc0510nio.read_0_callback().set_ioport("DSWA");
+ tc0510nio.read_1_callback().set_ioport("DSWB");
+ tc0510nio.read_2_callback().set_ioport("IN0");
+ tc0510nio.read_3_callback().set_ioport("IN1");
+ tc0510nio.write_4_callback().set(FUNC(warriorb_state::coin_control_w));
+ tc0510nio.read_7_callback().set_ioport("IN2");
/* video hardware */
GFXDECODE(config, m_gfxdecode[0], m_tc0110pcr[0], gfx_warriorb);
@@ -503,7 +684,7 @@ void warriorb_state::warriorb(machine_config &config)
lscreen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
lscreen.set_size(40*8, 32*8);
lscreen.set_visarea(0*8, 40*8-1, 2*8, 32*8-1);
- lscreen.set_screen_update(FUNC(warriorb_state::screen_update_left));
+ lscreen.set_screen_update(FUNC(warriorb_state::screen_update<0>));
lscreen.set_palette(m_tc0110pcr[0]);
TC0100SCN(config, m_tc0100scn[0], 0);
@@ -517,7 +698,7 @@ void warriorb_state::warriorb(machine_config &config)
rscreen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
rscreen.set_size(40*8, 32*8);
rscreen.set_visarea(0*8, 40*8-1, 2*8, 32*8-1);
- rscreen.set_screen_update(FUNC(warriorb_state::screen_update_right));
+ rscreen.set_screen_update(FUNC(warriorb_state::screen_update<1>));
rscreen.set_palette(m_tc0110pcr[1]);
TC0100SCN(config, m_tc0100scn[1], 0);
@@ -528,10 +709,10 @@ void warriorb_state::warriorb(machine_config &config)
TC0110PCR(config, m_tc0110pcr[1], 0);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
- // subwoofer under seat is exists like other taito multiscreen games?
+ // is there a subwoofer under the seat like other Taito multiscreen games?
ym2610b_device &ymsnd(YM2610B(config, "ymsnd", 16_MHz_XTAL / 2));
ymsnd.irq_handler().set_inputline("audiocpu", 0);
@@ -558,170 +739,171 @@ void warriorb_state::warriorb(machine_config &config)
***************************************************************************/
ROM_START( sagaia )
- ROM_REGION( 0x100000, "maincpu", 0 ) /* 512K for 68000 code */
+ ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "c07_44.74", 0x00000, 0x20000, CRC(d0ca72d8) SHA1(13b47a4fb976167141dd36968f9e8d932ba78dcb) )
ROM_LOAD16_BYTE( "c07_43.73", 0x00001, 0x20000, CRC(a34ea5ba) SHA1(300d168a8602b3c871fcd403fb72a8c8740eb013) )
ROM_LOAD16_BYTE( "c07_45.76", 0x40000, 0x20000, CRC(8a043c14) SHA1(018647f3d3f4850ed0319266258fb33223c8a9ea) )
ROM_LOAD16_BYTE( "c07_42.71", 0x40001, 0x20000, CRC(b6cb642f) SHA1(54f4848e0a411ac6e6cfc911800dfeba19c62936) )
- ROM_LOAD16_WORD_SWAP( "c07-09.75", 0x80000, 0x80000, CRC(cc69c2ce) SHA1(47883b9e14d8b6dd74db221bff396477231938f2) ) /* data rom */
+ ROM_LOAD16_WORD_SWAP( "c07-09.75", 0x80000, 0x80000, CRC(cc69c2ce) SHA1(47883b9e14d8b6dd74db221bff396477231938f2) ) // data ROM
- ROM_REGION( 0x20000, "audiocpu", 0 ) /* sound cpu */
+ ROM_REGION( 0x20000, "audiocpu", 0 )
ROM_LOAD( "c07_41.69", 0x00000, 0x20000, CRC(b50256ea) SHA1(6ed271e4dafd1c759adaa55d5b2343d7374c721a) )
- ROM_REGION( 0x200000, "sprites", 0 )
- ROM_LOAD64_WORD( "c07-05.24", 0x00000, 0x80000, CRC(fb6d0550) SHA1(2d570ff5ef262cb4cb52e8584a7f167263194d37) ) /* OBJ */
+ ROM_REGION( 0x200000, "sprites", 0 ) // OBJ
+ ROM_LOAD64_WORD( "c07-05.24", 0x00000, 0x80000, CRC(fb6d0550) SHA1(2d570ff5ef262cb4cb52e8584a7f167263194d37) )
ROM_LOAD64_WORD( "c07-06.27", 0x00002, 0x80000, CRC(5eebbcd6) SHA1(d4d860bf6b099956c45c7273ad77b1d35deba4c1) )
ROM_LOAD64_WORD( "c07-07.26", 0x00004, 0x80000, CRC(fd9f9e74) SHA1(e89beb5cac844fe16662465b0c76337692591aae) )
ROM_LOAD64_WORD( "c07-08.25", 0x00006, 0x80000, CRC(a07dc846) SHA1(7199a604fcd693215ddb7670bfb2daf150145fd7) )
- ROM_REGION( 0x100000, "tc0100scn_1", 0 )
- ROM_LOAD16_WORD_SWAP( "c07-03.12", 0x00000, 0x80000, CRC(189bafce) SHA1(d885e444523489fe24269b90dec58e0d92cfbd6e) ) /* SCr(screen 1) */
+ ROM_REGION( 0x100000, "tc0100scn_1", 0 ) // SCr(screen 1)
+ ROM_LOAD16_WORD_SWAP( "c07-03.12", 0x00000, 0x80000, CRC(189bafce) SHA1(d885e444523489fe24269b90dec58e0d92cfbd6e) )
ROM_LOAD16_WORD_SWAP( "c07-04.11", 0x80000, 0x80000, CRC(50421e81) SHA1(27ac420602f1dac00dc32903543a518e6f47fb2f) )
- ROM_REGION( 0x100000, "tc0100scn_2", 0 )
- ROM_LOAD16_WORD_SWAP( "c07-03.47", 0x00000, 0x80000, CRC(189bafce) SHA1(d885e444523489fe24269b90dec58e0d92cfbd6e) ) /* SCr(screen 2) */
+ ROM_REGION( 0x100000, "tc0100scn_2", 0 ) // SCr(screen 2)
+ ROM_LOAD16_WORD_SWAP( "c07-03.47", 0x00000, 0x80000, CRC(189bafce) SHA1(d885e444523489fe24269b90dec58e0d92cfbd6e) )
ROM_LOAD16_WORD_SWAP( "c07-04.48", 0x80000, 0x80000, CRC(50421e81) SHA1(27ac420602f1dac00dc32903543a518e6f47fb2f) )
- ROM_REGION( 0x100000, "ymsnd:adpcma", 0 ) /* ADPCM samples */
+ ROM_REGION( 0x100000, "ymsnd:adpcma", 0 ) // ADPCM samples
ROM_LOAD( "c07-10.95", 0x00000, 0x80000, CRC(4bbe0ed9) SHA1(081b73c4e4d4fa548445e5548573099bcb1e9213) )
ROM_LOAD( "c07-11.96", 0x80000, 0x80000, CRC(3c815699) SHA1(0471ff5b0c0da905267f2cee52fd68c8661cccc9) )
- ROM_REGION( 0x080000, "ymsnd:adpcmb", 0 ) /* Delta-T samples */
+ ROM_REGION( 0x080000, "ymsnd:adpcmb", 0 ) // Delta-T samples
ROM_LOAD( "c07-12.107", 0x00000, 0x80000, CRC(e0b71258) SHA1(0258e308b643d723475824752ebffc4ea29d1ac4) )
- ROM_REGION( 0x001000, "user1", 0 ) /* unknown roms */
+ ROM_REGION( 0x000800, "proms", 0 ) // unknown
ROM_LOAD( "c07-13.37", 0x00000, 0x00400, CRC(3ca18eb3) SHA1(54560f02c2be67993940831222130e90cd171991) )
- ROM_LOAD( "c07-14.38", 0x00000, 0x00400, CRC(baf2a193) SHA1(b7f103b5f5aab0702dd21fd7e3a82261ae1760e9) )
+ ROM_LOAD( "c07-14.38", 0x00400, 0x00400, CRC(baf2a193) SHA1(b7f103b5f5aab0702dd21fd7e3a82261ae1760e9) )
-// Pals, not dumped
-// ROM_LOAD( "C07-15.78", 0x00000, 0x00?00, NO_DUMP )
-// ROM_LOAD( "C07-16.79", 0x00000, 0x00?00, NO_DUMP )
+ ROM_REGION( 0x400, "plds", 0 ) // type and size unknown
+ ROM_LOAD( "c07-15.78", 0x000, 0x144, NO_DUMP )
+ ROM_LOAD( "c07-16.79", 0x144, 0x144, NO_DUMP )
ROM_END
ROM_START( darius2d )
- ROM_REGION( 0x100000, "maincpu", 0 ) /* 512K for 68000 code */
+ ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "c07_20-2.74", 0x00000, 0x20000, CRC(a0f345b8) SHA1(1ce46e9707ec9ad51b26acf613eedc0536d227ae) )
ROM_LOAD16_BYTE( "c07_19-2.73", 0x00001, 0x20000, CRC(925412c6) SHA1(7f1f62b7b2261c440dccd512ebd3faea141b7c83) )
ROM_LOAD16_BYTE( "c07_21-2.76", 0x40000, 0x20000, CRC(bdd60e37) SHA1(777d3f67deba7df0da9d2605b2e2198f4bf47ebc) )
ROM_LOAD16_BYTE( "c07_18-2.71", 0x40001, 0x20000, CRC(23fcd89b) SHA1(8aaf4ac836773d9b064ded68a6f092fe9eec7ac2) )
- ROM_LOAD16_WORD_SWAP( "c07-09.75", 0x80000, 0x80000, CRC(cc69c2ce) SHA1(47883b9e14d8b6dd74db221bff396477231938f2) ) /* data rom */
+ ROM_LOAD16_WORD_SWAP( "c07-09.75", 0x80000, 0x80000, CRC(cc69c2ce) SHA1(47883b9e14d8b6dd74db221bff396477231938f2) ) // data ROM
- ROM_REGION( 0x20000, "audiocpu", 0 ) /* sound cpu */
+ ROM_REGION( 0x20000, "audiocpu", 0 )
ROM_LOAD( "c07_17.69", 0x00000, 0x20000, CRC(ae16c905) SHA1(70ba5aacd8a8e00b94719e3955abad8827c67aa8) )
- ROM_REGION( 0x200000, "sprites", 0 )
- ROM_LOAD64_WORD( "c07-05.24", 0x00000, 0x80000, CRC(fb6d0550) SHA1(2d570ff5ef262cb4cb52e8584a7f167263194d37) ) /* OBJ */
+ ROM_REGION( 0x200000, "sprites", 0 ) // OBJ
+ ROM_LOAD64_WORD( "c07-05.24", 0x00000, 0x80000, CRC(fb6d0550) SHA1(2d570ff5ef262cb4cb52e8584a7f167263194d37) )
ROM_LOAD64_WORD( "c07-06.27", 0x00002, 0x80000, CRC(5eebbcd6) SHA1(d4d860bf6b099956c45c7273ad77b1d35deba4c1) )
ROM_LOAD64_WORD( "c07-07.26", 0x00004, 0x80000, CRC(fd9f9e74) SHA1(e89beb5cac844fe16662465b0c76337692591aae) )
ROM_LOAD64_WORD( "c07-08.25", 0x00006, 0x80000, CRC(a07dc846) SHA1(7199a604fcd693215ddb7670bfb2daf150145fd7) )
- ROM_REGION( 0x100000, "tc0100scn_1", 0 )
- ROM_LOAD16_WORD_SWAP( "c07-03.12", 0x00000, 0x80000, CRC(189bafce) SHA1(d885e444523489fe24269b90dec58e0d92cfbd6e) ) /* SCr(screen 1) */
+ ROM_REGION( 0x100000, "tc0100scn_1", 0 ) // SCr(screen 1)
+ ROM_LOAD16_WORD_SWAP( "c07-03.12", 0x00000, 0x80000, CRC(189bafce) SHA1(d885e444523489fe24269b90dec58e0d92cfbd6e) )
ROM_LOAD16_WORD_SWAP( "c07-04.11", 0x80000, 0x80000, CRC(50421e81) SHA1(27ac420602f1dac00dc32903543a518e6f47fb2f) )
- ROM_REGION( 0x100000, "tc0100scn_2", 0 )
- ROM_LOAD16_WORD_SWAP( "c07-03.47", 0x00000, 0x80000, CRC(189bafce) SHA1(d885e444523489fe24269b90dec58e0d92cfbd6e) ) /* SCr(screen 2) */
+ ROM_REGION( 0x100000, "tc0100scn_2", 0 ) // SCr(screen 2)
+ ROM_LOAD16_WORD_SWAP( "c07-03.47", 0x00000, 0x80000, CRC(189bafce) SHA1(d885e444523489fe24269b90dec58e0d92cfbd6e) )
ROM_LOAD16_WORD_SWAP( "c07-04.48", 0x80000, 0x80000, CRC(50421e81) SHA1(27ac420602f1dac00dc32903543a518e6f47fb2f) )
- ROM_REGION( 0x100000, "ymsnd:adpcma", 0 ) /* ADPCM samples */
+ ROM_REGION( 0x100000, "ymsnd:adpcma", 0 ) // ADPCM samples
ROM_LOAD( "c07-10.95", 0x00000, 0x80000, CRC(4bbe0ed9) SHA1(081b73c4e4d4fa548445e5548573099bcb1e9213) )
ROM_LOAD( "c07-11.96", 0x80000, 0x80000, CRC(3c815699) SHA1(0471ff5b0c0da905267f2cee52fd68c8661cccc9) )
- ROM_REGION( 0x080000, "ymsnd:adpcmb", 0 ) /* Delta-T samples */
+ ROM_REGION( 0x080000, "ymsnd:adpcmb", 0 ) // Delta-T samples
ROM_LOAD( "c07-12.107", 0x00000, 0x80000, CRC(e0b71258) SHA1(0258e308b643d723475824752ebffc4ea29d1ac4) )
- ROM_REGION( 0x001000, "user1", 0 ) /* unknown roms */
+ ROM_REGION( 0x000800, "proms", 0 ) // unknown
ROM_LOAD( "c07-13.37", 0x00000, 0x00400, CRC(3ca18eb3) SHA1(54560f02c2be67993940831222130e90cd171991) )
- ROM_LOAD( "c07-14.38", 0x00000, 0x00400, CRC(baf2a193) SHA1(b7f103b5f5aab0702dd21fd7e3a82261ae1760e9) )
+ ROM_LOAD( "c07-14.38", 0x00400, 0x00400, CRC(baf2a193) SHA1(b7f103b5f5aab0702dd21fd7e3a82261ae1760e9) )
-// Pals, not dumped
-// ROM_LOAD( "C07-15.78", 0x00000, 0x00?00, NO_DUMP )
-// ROM_LOAD( "C07-16.79", 0x00000, 0x00?00, NO_DUMP )
+ ROM_REGION( 0x400, "plds", 0 ) // type and size unknown
+ ROM_LOAD( "c07-15.78", 0x000, 0x144, NO_DUMP )
+ ROM_LOAD( "c07-16.79", 0x144, 0x144, NO_DUMP )
ROM_END
ROM_START( darius2do )
- ROM_REGION( 0x100000, "maincpu", 0 ) /* 512K for 68000 code */
+ ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "c07_20-1.74", 0x00000, 0x20000, CRC(48b0804a) SHA1(932fb2cd55e6bfef84cf3cfaf3e75b4297a92b34) )
ROM_LOAD16_BYTE( "c07_19-1.73", 0x00001, 0x20000, CRC(1f9a4f83) SHA1(d02caef350bdcac0ff771b5c92bb4e7435e0c9fa) )
ROM_LOAD16_BYTE( "c07_21-1.76", 0x40000, 0x20000, CRC(b491b0ca) SHA1(dd7aa196c6002abc8e2f885f3f997f2279e59769) )
ROM_LOAD16_BYTE( "c07_18-1.71", 0x40001, 0x20000, CRC(c552e42f) SHA1(dc952002a9a738cb1789f7c51acb71693ae03549) )
- ROM_LOAD16_WORD_SWAP( "c07-09.75", 0x80000, 0x80000, CRC(cc69c2ce) SHA1(47883b9e14d8b6dd74db221bff396477231938f2) ) /* data rom */
+ ROM_LOAD16_WORD_SWAP( "c07-09.75", 0x80000, 0x80000, CRC(cc69c2ce) SHA1(47883b9e14d8b6dd74db221bff396477231938f2) ) // data ROM
- ROM_REGION( 0x20000, "audiocpu", 0 ) /* sound cpu */
+ ROM_REGION( 0x20000, "audiocpu", 0 )
ROM_LOAD( "c07_17.69", 0x00000, 0x20000, CRC(ae16c905) SHA1(70ba5aacd8a8e00b94719e3955abad8827c67aa8) )
- ROM_REGION( 0x200000, "sprites", 0 )
- ROM_LOAD64_WORD( "c07-05.24", 0x00000, 0x80000, CRC(fb6d0550) SHA1(2d570ff5ef262cb4cb52e8584a7f167263194d37) ) /* OBJ */
+ ROM_REGION( 0x200000, "sprites", 0 ) // OBJ
+ ROM_LOAD64_WORD( "c07-05.24", 0x00000, 0x80000, CRC(fb6d0550) SHA1(2d570ff5ef262cb4cb52e8584a7f167263194d37) )
ROM_LOAD64_WORD( "c07-06.27", 0x00002, 0x80000, CRC(5eebbcd6) SHA1(d4d860bf6b099956c45c7273ad77b1d35deba4c1) )
ROM_LOAD64_WORD( "c07-07.26", 0x00004, 0x80000, CRC(fd9f9e74) SHA1(e89beb5cac844fe16662465b0c76337692591aae) )
ROM_LOAD64_WORD( "c07-08.25", 0x00006, 0x80000, CRC(a07dc846) SHA1(7199a604fcd693215ddb7670bfb2daf150145fd7) )
- ROM_REGION( 0x100000, "tc0100scn_1", 0 )
- ROM_LOAD16_WORD_SWAP( "c07-03.12", 0x00000, 0x80000, CRC(189bafce) SHA1(d885e444523489fe24269b90dec58e0d92cfbd6e) ) /* SCr(screen 1) */
+ ROM_REGION( 0x100000, "tc0100scn_1", 0 ) // SCr(screen 1)
+ ROM_LOAD16_WORD_SWAP( "c07-03.12", 0x00000, 0x80000, CRC(189bafce) SHA1(d885e444523489fe24269b90dec58e0d92cfbd6e) )
ROM_LOAD16_WORD_SWAP( "c07-04.11", 0x80000, 0x80000, CRC(50421e81) SHA1(27ac420602f1dac00dc32903543a518e6f47fb2f) )
- ROM_REGION( 0x100000, "tc0100scn_2", 0 )
- ROM_LOAD16_WORD_SWAP( "c07-03.47", 0x00000, 0x80000, CRC(189bafce) SHA1(d885e444523489fe24269b90dec58e0d92cfbd6e) ) /* SCr(screen 2) */
+ ROM_REGION( 0x100000, "tc0100scn_2", 0 ) // SCr(screen 2)
+ ROM_LOAD16_WORD_SWAP( "c07-03.47", 0x00000, 0x80000, CRC(189bafce) SHA1(d885e444523489fe24269b90dec58e0d92cfbd6e) )
ROM_LOAD16_WORD_SWAP( "c07-04.48", 0x80000, 0x80000, CRC(50421e81) SHA1(27ac420602f1dac00dc32903543a518e6f47fb2f) )
- ROM_REGION( 0x100000, "ymsnd:adpcma", 0 ) /* ADPCM samples */
+ ROM_REGION( 0x100000, "ymsnd:adpcma", 0 ) // ADPCM samples
ROM_LOAD( "c07-10.95", 0x00000, 0x80000, CRC(4bbe0ed9) SHA1(081b73c4e4d4fa548445e5548573099bcb1e9213) )
ROM_LOAD( "c07-11.96", 0x80000, 0x80000, CRC(3c815699) SHA1(0471ff5b0c0da905267f2cee52fd68c8661cccc9) )
- ROM_REGION( 0x080000, "ymsnd:adpcmb", 0 ) /* Delta-T samples */
+ ROM_REGION( 0x080000, "ymsnd:adpcmb", 0 ) // Delta-T samples
ROM_LOAD( "c07-12.107", 0x00000, 0x80000, CRC(e0b71258) SHA1(0258e308b643d723475824752ebffc4ea29d1ac4) )
- ROM_REGION( 0x001000, "user1", 0 ) /* unknown roms */
+ ROM_REGION( 0x000800, "proms", 0 ) // unknown
ROM_LOAD( "c07-13.37", 0x00000, 0x00400, CRC(3ca18eb3) SHA1(54560f02c2be67993940831222130e90cd171991) )
- ROM_LOAD( "c07-14.38", 0x00000, 0x00400, CRC(baf2a193) SHA1(b7f103b5f5aab0702dd21fd7e3a82261ae1760e9) )
+ ROM_LOAD( "c07-14.38", 0x00400, 0x00400, CRC(baf2a193) SHA1(b7f103b5f5aab0702dd21fd7e3a82261ae1760e9) )
ROM_END
ROM_START( warriorb )
- ROM_REGION( 0x200000, "maincpu", 0 ) /* 1024K for 68000 code */
+ ROM_REGION( 0x200000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "d24_20-1.74", 0x000000, 0x40000, CRC(4452dc25) SHA1(bbb4fbc25a3f263ce2716698cacaca201cb9591b) )
ROM_LOAD16_BYTE( "d24_19-1.73", 0x000001, 0x40000, CRC(15c16016) SHA1(5b28834d8d5296c562c90a861c6ccdd46cc3c204) )
ROM_LOAD16_BYTE( "d24_21-1.76", 0x080000, 0x40000, CRC(783ef8e1) SHA1(28a43d5231031b2ff3e437c3b6b8604f0d2b521b) )
ROM_LOAD16_BYTE( "d24_18-1.71", 0x080001, 0x40000, CRC(4502db60) SHA1(b29c441ab79f753378ea47e7c22924db0cd5eb89) )
- ROM_LOAD16_WORD_SWAP( "d24-09.75", 0x100000, 0x100000, CRC(ece5cc59) SHA1(337db41d5a74fa4202b1be1a672a068ec3b205a8) ) /* data rom */
- /* Note: Raine wrongly doubles up d24-09 as delta-t samples */
+ ROM_LOAD16_WORD_SWAP( "d24-09.75", 0x100000, 0x100000, CRC(ece5cc59) SHA1(337db41d5a74fa4202b1be1a672a068ec3b205a8) ) // data ROM
- ROM_REGION( 0x20000, "audiocpu", 0 ) /* sound cpu */
+ ROM_REGION( 0x20000, "audiocpu", 0 )
ROM_LOAD( "d24_17.69", 0x00000, 0x20000, CRC(e41e4aae) SHA1(9bf40b6e8aa5c6ec62c5d21edbb2214f6550c94f) )
- ROM_REGION( 0x400000, "sprites", 0 )
- ROM_LOAD64_WORD( "d24-03.24", 0x000000, 0x100000, CRC(46db9fd7) SHA1(f08f3c9833d80ce161b06f4ae484c5c79539639c) ) /* OBJ */
+ ROM_REGION( 0x400000, "sprites", 0 ) // OBJ
+ ROM_LOAD64_WORD( "d24-03.24", 0x000000, 0x100000, CRC(46db9fd7) SHA1(f08f3c9833d80ce161b06f4ae484c5c79539639c) )
ROM_LOAD64_WORD( "d24-06.27", 0x000002, 0x100000, CRC(918486fe) SHA1(cc9e287221ef33dba77a22975e23b250ba50b758) )
ROM_LOAD64_WORD( "d24-05.26", 0x000004, 0x100000, CRC(9f414317) SHA1(204cf47404e5e1085c1108abacd2b79a6cd0f74a) )
ROM_LOAD64_WORD( "d24-04.25", 0x000006, 0x100000, CRC(148e0493) SHA1(f1cb819830e5bd544b11762784e228b5cb62b7e4) )
- ROM_REGION( 0x200000, "tc0100scn_1", 0 )
- ROM_LOAD16_WORD_SWAP( "d24-02.12", 0x000000, 0x100000, CRC(9f50c271) SHA1(1a1b2ae7cb7785e7f66aa26258a6cd2921a29545) ) /* SCR A, screen 1 */
+ ROM_REGION( 0x200000, "tc0100scn_1", 0 )// SCR A, screen 1
+ ROM_LOAD16_WORD_SWAP( "d24-02.12", 0x000000, 0x100000, CRC(9f50c271) SHA1(1a1b2ae7cb7785e7f66aa26258a6cd2921a29545) )
ROM_LOAD16_WORD_SWAP( "d24-01.11", 0x100000, 0x100000, CRC(326dcca9) SHA1(1993776d71bca7d6dfc6f84dd9262d0dcae87f69) )
- ROM_REGION( 0x200000, "tc0100scn_2", 0 )
- ROM_LOAD16_WORD_SWAP( "d24-07.47", 0x000000, 0x100000, CRC(9f50c271) SHA1(1a1b2ae7cb7785e7f66aa26258a6cd2921a29545) ) /* SCR B, screen 2 */
+ ROM_REGION( 0x200000, "tc0100scn_2", 0 ) // SCR B, screen 2
+ ROM_LOAD16_WORD_SWAP( "d24-07.47", 0x000000, 0x100000, CRC(9f50c271) SHA1(1a1b2ae7cb7785e7f66aa26258a6cd2921a29545) )
ROM_LOAD16_WORD_SWAP( "d24-08.48", 0x100000, 0x100000, CRC(1e6d1528) SHA1(d6843aa67befd7db44f468be16ba2f0efb85d40f) )
- ROM_REGION( 0x300000, "ymsnd:adpcma", 0 ) /* ADPCM samples */
+ ROM_REGION( 0x300000, "ymsnd:adpcma", 0 ) // ADPCM samples
ROM_LOAD( "d24-12.107", 0x000000, 0x100000, CRC(279203a1) SHA1(ed75e811a1f0863c134034457ce2e97372726bdb) )
ROM_LOAD( "d24-10.95", 0x100000, 0x100000, CRC(0e0c716d) SHA1(5e2f334dd484678766c5a71196d9bad0ba0fe8d9) )
ROM_LOAD( "d24-11.118", 0x200000, 0x100000, CRC(15362573) SHA1(8602c9f24134cac6fe1375fb189b152f0c68aeb7) )
- /* No Delta-T samples */
+ // No Delta-T samples
+
+ ROM_REGION( 0x000800, "proms", 0 ) // unknown
+ ROM_LOAD( "d24-13.37", 0x00000, 0x400, CRC(3ca18eb3) SHA1(54560f02c2be67993940831222130e90cd171991) ) // AM27S33A or compatible like N82HS137A
+ ROM_LOAD( "d24-14.38", 0x00400, 0x400, CRC(baf2a193) SHA1(b7f103b5f5aab0702dd21fd7e3a82261ae1760e9) ) // AM27S33A or compatible like N82HS137A
- ROM_REGION( 0x01000, "user1", 0 ) /* unknown roms */
- ROM_LOAD( "d24-13.37", 0x00000, 0x400, CRC(3ca18eb3) SHA1(54560f02c2be67993940831222130e90cd171991) ) /* AM27S33A or compatible like N82HS137A */
- ROM_LOAD( "d24-14.38", 0x00000, 0x400, CRC(baf2a193) SHA1(b7f103b5f5aab0702dd21fd7e3a82261ae1760e9) ) /* AM27S33A or compatible like N82HS137A */
+ ROM_REGION( 0x000288, "plds", 0 )
ROM_LOAD( "d24-15.78", 0x00000, 0x144, CRC(04992a7d) SHA1(82ce7ab7e3e7045776b660c32dac4abc28cabfa5) ) // PAL20L8BCNS
- ROM_LOAD( "d24-16.79", 0x00000, 0x144, CRC(92c59a8d) SHA1(a83eb70cdc47af688a33505f60e5cb9960f8ba9f) ) // PAL20L8BCNS
+ ROM_LOAD( "d24-16.79", 0x00144, 0x144, CRC(92c59a8d) SHA1(a83eb70cdc47af688a33505f60e5cb9960f8ba9f) ) // PAL20L8BCNS
ROM_END
+} // anonymous namespace
-/* Working Games */
// YEAR, NAME, PARENT, MACHINE, INPUT, STATE, INIT, MONITOR,COMPANY,FULLNAME, FLAGS
GAME( 1989, sagaia, darius2, darius2d, sagaia, warriorb_state, empty_init, ROT0, "Taito Corporation Japan", "Sagaia (dual screen) (World)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND )
diff --git a/src/mame/taito/warriorb.h b/src/mame/taito/warriorb.h
deleted file mode 100644
index 90a8d61ec90..00000000000
--- a/src/mame/taito/warriorb.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:David Graves
-/*************************************************************************
-
- Taito Dual Screen Games
-
-*************************************************************************/
-
-#include "taitosnd.h"
-#include "taitoio.h"
-#include "sound/flt_vol.h"
-#include "tc0100scn.h"
-#include "tc0110pcr.h"
-#include "emupal.h"
-
-
-class warriorb_state : public driver_device
-{
-public:
- warriorb_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_tc0140syt(*this, "tc0140syt"),
- m_tc0100scn(*this, "tc0100scn_%u", 1),
- m_tc0110pcr(*this, "tc0110pcr_%u", 1),
- m_tc0220ioc(*this, "tc0220ioc"),
- m_tc0510nio(*this, "tc0510nio"),
- m_2610_l(*this, "2610.%u.l", 1),
- m_2610_r(*this, "2610.%u.r", 1),
- m_gfxdecode(*this, "gfxdecode_%u", 1),
- m_spriteram(*this, "spriteram"),
- m_z80bank(*this, "z80bank")
- { }
-
- void warriorb(machine_config &config);
- void darius2d(machine_config &config);
-
-private:
- /* devices */
- required_device<cpu_device> m_maincpu;
- required_device<tc0140syt_device> m_tc0140syt;
- required_device_array<tc0100scn_device, 2> m_tc0100scn;
- required_device_array<tc0110pcr_device, 2> m_tc0110pcr;
- optional_device<tc0220ioc_device> m_tc0220ioc;
- optional_device<tc0510nio_device> m_tc0510nio;
- required_device_array<filter_volume_device, 2> m_2610_l;
- required_device_array<filter_volume_device, 2> m_2610_r;
- required_device_array<gfxdecode_device, 2> m_gfxdecode;
-
- /* memory pointers */
- required_shared_ptr<u16> m_spriteram;
-
- /* memory regions */
- required_memory_bank m_z80bank;
-
- /* misc */
- int m_pandata[4]{};
-
- void coin_control_w(u8 data);
- void sound_bankswitch_w(u8 data);
- void pancontrol_w(offs_t offset, u8 data);
- void tc0100scn_dual_screen_w(offs_t offset, u16 data, u16 mem_mask = ~0);
-
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- u32 screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- u32 screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs, int chip);
- u32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, int chip);
-
- void darius2d_map(address_map &map);
- void warriorb_map(address_map &map);
- void z80_sound_map(address_map &map);
-};
diff --git a/src/mame/taito/warriorb_v.cpp b/src/mame/taito/warriorb_v.cpp
deleted file mode 100644
index 5ccf2594cf1..00000000000
--- a/src/mame/taito/warriorb_v.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:David Graves
-#include "emu.h"
-#include "warriorb.h"
-#include "screen.h"
-
-/************************************************************
- SPRITE DRAW ROUTINE
-************************************************************/
-
-void warriorb_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs, int chip)
-{
- u32 pri_mask;
-
-#ifdef MAME_DEBUG
- int unknown = 0;
-#endif
-
- /* pdrawgfx() needs us to draw sprites front to back */
- for (int offs = 0; offs < m_spriteram.bytes() / 2; offs += 4)
- {
- int data = m_spriteram[offs + 1];
- const u32 tilenum = data & 0x7fff;
-
- data = m_spriteram[offs + 0];
- int y = (-(data & 0x1ff) - 24) & 0x1ff; /* (inverted y adjusted for vis area) */
- const bool flipy = (data & 0x200) >> 9;
-
- const u16 data2 = m_spriteram[offs + 2];
- /* 8,4 also seen in msbyte */
- const int priority = (data2 & 0x0100) >> 8; // 1 = low
-
- if(priority)
- pri_mask = 0xfffe;
- else
- pri_mask = 0;
-
- const u32 color = (data2 & 0x7f);
-
- data = m_spriteram[offs + 3];
- int x = (data & 0x3ff);
- const bool flipx = (data & 0x400) >> 10;
-
-#ifdef MAME_DEBUG
- if (data2 & 0xf280) unknown |= (data2 &0xf280);
-#endif
-
- x -= x_offs;
- y += y_offs;
-
- /* sprite wrap: coords become negative at high values */
- if (x > 0x3c0) x -= 0x400;
- if (y > 0x180) y -= 0x200;
-
- m_gfxdecode[chip]->gfx(0)->prio_transpen(bitmap,cliprect,
- tilenum,
- color,
- flipx,flipy,
- x,y,
- screen.priority(),pri_mask,0);
- }
-
-#ifdef MAME_DEBUG
- if (unknown)
- popmessage("unknown sprite bits: %04x",unknown);
-#endif
-}
-
-
-/**************************************************************
- SCREEN REFRESH
-**************************************************************/
-
-u32 warriorb_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, int chip)
-{
- tc0100scn_device *tc0100scn = m_tc0100scn[chip];
- u8 layer[3];
-
- tc0100scn->tilemap_update();
-
- layer[0] = tc0100scn->bottomlayer();
- layer[1] = layer[0] ^ 1;
- layer[2] = 2;
-
- /* Clear priority bitmap */
- screen.priority().fill(0, cliprect);
-
- /* chip 0 does tilemaps on the left, chip 1 does the ones on the right */
- // draw bottom layer
- const u8 nodraw = tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 0); /* left */
-
- /* Ensure screen blanked even when bottom layers not drawn due to disable bit */
- if (nodraw)
- bitmap.fill(m_tc0110pcr[chip]->black_pen(), cliprect);
-
- // draw middle layer
- tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 1);
-
- /* Sprites can be under/over the layer below text layer */
- draw_sprites(screen, bitmap, cliprect, xoffs * chip, 8, chip); // draw sprites
-
- // draw top(text) layer
- tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 0);
- return 0;
-}
-
-u32 warriorb_state::screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 40 * 8, 0); }
-u32 warriorb_state::screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 40 * 8, 1); }