summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author David Haywood <28625134+DavidHaywood@users.noreply.github.com>2023-03-25 18:27:39 +0000
committer GitHub <noreply@github.com>2023-03-26 05:27:39 +1100
commita50cadf1bea558fec213342842d0e02577505bd7 (patch)
tree2405c5f9e4db901e72cfa03d1147e475bd4babec /src
parentde1ec65cd2dc6301da1ec9fcefc6c8669c1dac5e (diff)
orca/vastar_viddev.cpp: Created a device to encapsulate the orca40c.cpp video code. (#11021)
Also moved misc/kyugo.cpp and sigma/sub.cpp into orca project.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/mame/mame.lst52
-rw-r--r--src/mame/orca/akazukin.cpp319
-rw-r--r--src/mame/orca/kyugo.cpp (renamed from src/mame/misc/kyugo.cpp)0
-rw-r--r--src/mame/orca/kyugo.h (renamed from src/mame/misc/kyugo.h)6
-rw-r--r--src/mame/orca/kyugo_v.cpp (renamed from src/mame/misc/kyugo_v.cpp)0
-rw-r--r--src/mame/orca/sub.cpp (renamed from src/mame/sigma/sub.cpp)0
-rw-r--r--src/mame/orca/vastar.cpp310
-rw-r--r--src/mame/orca/vastar_viddev.cpp282
-rw-r--r--src/mame/orca/vastar_viddev.h101
9 files changed, 459 insertions, 611 deletions
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index 64e97a82ca9..8c8208149a4 100755
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -30054,29 +30054,6 @@ maxideal // (c) 1983 American Communications Laboratories
kurukuru // (c) 1990 Success / Taiyo Jidoki.
ppj // (c) 199? Success / Taiyo Jidoki.
-@source:misc/kyugo.cpp
-99lstwar // (c) 1985 Proma
-99lstwara // (c) 1985 Proma
-99lstwarb // bootleg
-99lstwark // (c) 1985 Kyugo
-airwolf // (c) 1987 Kyugo
-airwolfa // (c) 1987 Kyugo
-buzzard // (c) 1984 Crux
-flashgal // (c) 1985 Sega
-flashgala // (c) 1985 Sega
-flashgalk // (c) 1985 Kyugo
-fx // bootleg
-gyrodine // (c) 1984 Crux
-gyrodinet // (c) 1984 Crux (Taito Corporation license)
-legend // no copyright notice [1986 Sega/Coreland] (Arcade TV Game List - P.104, Left, 14 from top)
-legendb // no copyright notice [1986 Sega/Coreland] (Arcade TV Game List - P.104, Left, 14 from top)
-repulse // (c) 1985 Sega
-skywolf // bootleg
-skywolf2 // bootleg
-skywolf3 // bootleg
-sonofphx // bootleg
-srdmissn // (c) 1986 Taito Corporation
-
@source:misc/ladyfrog.cpp
ladyfrog // (c) 1990 Mondial Games
toucheme //
@@ -34446,6 +34423,29 @@ funkybeeb // (c) 1982 Orca
skylancr // (c) 1983 Orca
skylancre // (c) 1983 Orca + Esco Trading Co license
+@source:orca/kyugo.cpp
+99lstwar // (c) 1985 Proma
+99lstwara // (c) 1985 Proma
+99lstwarb // bootleg
+99lstwark // (c) 1985 Kyugo
+airwolf // (c) 1987 Kyugo
+airwolfa // (c) 1987 Kyugo
+buzzard // (c) 1984 Crux
+flashgal // (c) 1985 Sega
+flashgala // (c) 1985 Sega
+flashgalk // (c) 1985 Kyugo
+fx // bootleg
+gyrodine // (c) 1984 Crux
+gyrodinet // (c) 1984 Crux (Taito Corporation license)
+legend // no copyright notice [1986 Sega/Coreland] (Arcade TV Game List - P.104, Left, 14 from top)
+legendb // no copyright notice [1986 Sega/Coreland] (Arcade TV Game List - P.104, Left, 14 from top)
+repulse // (c) 1985 Sega
+skywolf // bootleg
+skywolf2 // bootleg
+skywolf3 // bootleg
+sonofphx // bootleg
+srdmissn // (c) 1986 Taito Corporation
+
@source:orca/marineb.cpp
bcruzm12 // (c) 1983 Sigma Ent. Inc.
changes // (c) 1982 Orca
@@ -34458,6 +34458,9 @@ marineb // (c) 1982 Orca
springer // (c) 1982 Orca
wanted // (c) 1984 Sigma Ent. Inc.
+@source:orca/sub.cpp
+sub // (c) 1985 Sigma Ent. Inc.
+
@source:orca/vastar.cpp
dogfightp // (c) 1983 Orca
pprobe // Kyugo?
@@ -40562,9 +40565,6 @@ spiders2 // (c) 1981 Sigma Ent. Inc.
spiders3 // (c) 1981 Sigma Ent. Inc.
spinner // bootleg
-@source:sigma/sub.cpp
-sub // (c) 1985 Sigma Ent. Inc.
-
@source:sinclair/atm.cpp
atm //
atmtb2 //
diff --git a/src/mame/orca/akazukin.cpp b/src/mame/orca/akazukin.cpp
index 3733d6c033d..ec92873541a 100644
--- a/src/mame/orca/akazukin.cpp
+++ b/src/mame/orca/akazukin.cpp
@@ -7,7 +7,6 @@ ORCA OVG-33C + ORCA OVG-46C
Based off orca/vastar.cpp
TODO:
-- Unify '46C to common device implementations;
- Unify sound section, it's ported from sigma/sub.cpp;
Notes:
@@ -18,18 +17,15 @@ Notes:
#include "emu.h"
-//#include "orca40c.h"
+#include "vastar_viddev.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 {
@@ -41,11 +37,7 @@ public:
, m_maincpu(*this, "maincpu")
, m_subcpu(*this, "sub")
, m_mainlatch(*this, "mainlatch")
- , m_gfxdecode(*this, "gfxdecode")
- , m_palette(*this, "palette")
- , m_bgvideoram(*this, "bg%uvideoram", 1U)
- , m_fgvideoram(*this, "fgvideoram")
- , m_fg_vregs(*this, "fg_vregs")
+ , m_vasvid(*this, "vasvid")
, m_soundlatch(*this, "soundlatch%u", 0)
, m_ay(*this, "ay%u", 0)
{ }
@@ -55,18 +47,12 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void video_start() override;
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_subcpu;
required_device<ls259_device> m_mainlatch;
-
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
- required_shared_ptr_array<uint8_t, 2> m_bgvideoram;
- required_shared_ptr<uint8_t> m_fgvideoram;
- required_shared_ptr<uint8_t> m_fg_vregs;
+ required_device<vastar_video_device> m_vasvid;
required_device_array<generic_latch_8_device, 2> m_soundlatch;
required_device_array<ay8910_device, 2> m_ay;
@@ -84,285 +70,18 @@ private:
void main_io(address_map &map);
void sub_map(address_map &map);
void sub_io(address_map &map);
-
- tilemap_t *m_fg_tilemap = nullptr;
- tilemap_t *m_bg_tilemap[2]{};
- uint8_t* m_bg_scroll[2]{};
- uint8_t* m_spriteram[3]{};
-
- void fgvideoram_w(offs_t offset, uint8_t data);
- template <uint8_t Which> void bgvideoram_w(offs_t offset, uint8_t data);
-
- TILE_GET_INFO_MEMBER(get_fg_tile_info);
- template <uint8_t Which> TILE_GET_INFO_MEMBER(get_bg_tile_info);
-
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
};
/******************
*
- * Video section
- *
- *****************/
-
-void akazukin_state::video_start()
-{
- m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(akazukin_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 32,32);
- m_bg_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(akazukin_state::get_bg_tile_info<0>)), TILEMAP_SCAN_ROWS, 8,8, 32,32);
- m_bg_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(akazukin_state::get_bg_tile_info<1>)), TILEMAP_SCAN_ROWS, 8,8, 32,32);
-
- m_fg_tilemap->set_transparent_pen(0);
- m_bg_tilemap[0]->set_transparent_pen(0);
- m_bg_tilemap[1]->set_transparent_pen(0);
-
- m_bg_tilemap[0]->set_scroll_cols(32);
- m_bg_tilemap[1]->set_scroll_cols(32);
-}
-
-
-TILE_GET_INFO_MEMBER(akazukin_state::get_fg_tile_info)
-{
- const u32 m_fg_codebase = 0x000;
- const u32 m_fg_attrbase = 0x400;
- const u32 m_fg_colbase = 0x800;
-
- int const code = m_fgvideoram[tile_index + m_fg_codebase] | (m_fgvideoram[tile_index + m_fg_attrbase] << 8);
- int const color = m_fgvideoram[tile_index + m_fg_colbase];
- // TODO: guess, based on the other layers
- int const fxy = (code & 0xc00) >> 10;
- tileinfo.set(0,
- code,
- color & 0x3f,
- TILE_FLIPXY(fxy));
-}
-
-template <uint8_t Which>
-TILE_GET_INFO_MEMBER(akazukin_state::get_bg_tile_info)
-{
- const u32 m_bg_codebase = 0x000;
- const u32 m_bg_attrbase = 0x800;
- const u32 m_bg_colbase = 0x400;
-
- int const code = m_bgvideoram[Which][tile_index + m_bg_codebase] | (m_bgvideoram[Which][tile_index + m_bg_attrbase] << 8);
- int const color = m_bgvideoram[Which][tile_index + m_bg_colbase];
- int fxy = (code & 0xc00) >> 10;
- tileinfo.set(4 - Which,
- code,
- color & 0x3f,
- TILE_FLIPXY(fxy));
-}
-
-template <uint8_t Which>
-void akazukin_state::bgvideoram_w(offs_t offset, uint8_t data)
-{
- m_bgvideoram[Which][offset] = data;
- m_bg_tilemap[Which]->mark_tile_dirty(offset & 0x3ff);
-}
-
-void akazukin_state::fgvideoram_w(offs_t offset, uint8_t data)
-{
- m_fgvideoram[offset] = data;
- m_fg_tilemap->mark_tile_dirty(offset & 0x3ff);
-}
-
-void akazukin_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
-// for (int offs = 0; offs < 0x40; offs += 2)
- for (int offs = 0x40 - 2; offs >= 0; offs -= 2)
- {
- if (!(offs & 0x10))
- continue;
-
- const int code = ((m_spriteram[2][offs] & 0xfc) >> 2) + ((m_spriteram[1][offs] & 0x01) << 6)
- + ((offs & 0x20) << 2);
-
- const int sx = m_spriteram[2][offs + 1];
- int sy = m_spriteram[0][offs];
- const int color = m_spriteram[0][offs + 1] & 0x3f;
- int flipx = m_spriteram[2][offs] & 0x02;
- int flipy = m_spriteram[2][offs] & 0x01;
-
- if (flip_screen())
- {
- int temp = flipx;
- flipx = !flipy;
- flipy = !temp;
- }
-
- if (m_spriteram[1][offs] & 0x08) // double width
- {
- if (!flip_screen())
- sy = 224 - sy;
-
- m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
- code / 2,
- color,
- flipx, flipy,
- sx, sy, 0);
- // redraw with wraparound y
- m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
- code / 2,
- color,
- flipx, flipy,
- sx, sy + 256, 0);
-
- // redraw with wraparound x
- m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
- code / 2,
- color,
- flipx, flipy,
- sx - 256, sy, 0);
-
- // redraw with wraparound xy
- m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
- code / 2,
- color,
- flipx, flipy,
- sx - 256, sy + 256, 0);
- }
- else
- {
- if (!flip_screen())
- sy = 240 - sy;
-
- m_gfxdecode->gfx(1)->transpen(bitmap, cliprect,
- code,
- color,
- flipx, flipy,
- sx, sy, 0);
-
- // redraw with wraparound x
- m_gfxdecode->gfx(1)->transpen(bitmap, cliprect,
- code,
- color,
- flipx, flipy,
- sx - 256, sy, 0);
- }
- }
-}
-
-uint32_t akazukin_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- for (int i = 0; i < 32; i++)
- {
- m_bg_tilemap[0]->set_scrolly(i, m_bg_scroll[0][i]);
- m_bg_tilemap[1]->set_scrolly(i, m_bg_scroll[1][i]);
- }
-
-
- // TODO: copied from orca/vastar.cpp
- // Looks like $ac00 is some kind of '46C mixer control.
- switch (m_fg_vregs[0])
- {
- case 0:
- m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
- draw_sprites(bitmap, cliprect);
- m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
- m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- break;
-
- case 1: // ?? planet probe
- m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
- m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
- draw_sprites(bitmap, cliprect);
- m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- break;
-
- case 2:
- m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
- draw_sprites(bitmap, cliprect);
- m_bg_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0);
- m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
- m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- break;
-
- case 3:
- m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
- m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
- m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- draw_sprites(bitmap, cliprect);
- break;
-
- case 4: // akazukin title screen
- m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
- draw_sprites(bitmap, cliprect);
- m_bg_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0);
- m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
- break;
-
- default:
- popmessage("Unimplemented priority %X\n", m_fg_vregs[0]);
- break;
- }
-
- return 0;
-}
-
-
-static const gfx_layout charlayout =
-{
- 8,8,
- RGN_FRAC(1,1),
- 2,
- { 0, 4 },
- { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 },
- { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
- 16*8
-};
-
-static const gfx_layout spritelayout =
-{
- 16,16,
- RGN_FRAC(1,1),
- 2,
- { 0, 4 },
- { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3,
- 16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 },
- { 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
-};
-
-static const gfx_layout spritelayoutdw =
-{
- 16,32,
- RGN_FRAC(1,1),
- 2,
- { 0, 4 },
- { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3,
- 16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 },
- { 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 },
- 128*8
-};
-
-static GFXDECODE_START( gfx_vastar )
- GFXDECODE_ENTRY( "fgtiles", 0, charlayout, 0, 64 )
- GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 64 )
- GFXDECODE_ENTRY( "sprites", 0, spritelayoutdw, 0, 64 )
- GFXDECODE_ENTRY( "bgtiles0", 0, charlayout, 0, 64 )
- GFXDECODE_ENTRY( "bgtiles1", 0, charlayout, 0, 64 )
-GFXDECODE_END
-
-
-/******************
- *
* Machine section
*
*****************/
void akazukin_state::machine_start()
{
- m_spriteram[0] = m_fgvideoram + 0x800;
- m_bg_scroll[0] = m_fgvideoram + 0xbe0;
- m_bg_scroll[1] = m_fgvideoram + 0xbc0;
- m_spriteram[1] = m_fgvideoram + 0x400;
- m_spriteram[2] = m_fgvideoram + 0x000;
-
save_item(NAME(m_nmi_mask));
+ save_item(NAME(m_nmi_sub_mask));
}
void akazukin_state::machine_reset()
@@ -380,14 +99,14 @@ void akazukin_state::nmi_sub_mask_w(uint8_t data)
m_nmi_sub_mask = data & 1;
}
-
void akazukin_state::main_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
- map(0x8000, 0x8fff).ram().w(FUNC(akazukin_state::bgvideoram_w<1>)).share(m_bgvideoram[1]);
- map(0x9000, 0x9fff).ram().w(FUNC(akazukin_state::bgvideoram_w<0>)).share(m_bgvideoram[0]);
- map(0xa000, 0xabff).ram().w(FUNC(akazukin_state::fgvideoram_w)).share(m_fgvideoram);
- map(0xac00, 0xafff).ram().share(m_fg_vregs);
+ map(0x8000, 0x8fff).ram().w(m_vasvid, FUNC(vastar_video_device::bgvideoram_w<1>)).share("bg1videoram");
+ map(0x9000, 0x9fff).ram().w(m_vasvid, FUNC(vastar_video_device::bgvideoram_w<0>)).share("bg0videoram");
+ map(0xa000, 0xabff).ram().w(m_vasvid, FUNC(vastar_video_device::fgvideoram_w)).share("fgvideoram");
+ map(0xac00, 0xac00).w(m_vasvid, FUNC(vastar_video_device::priority_w));
+ map(0xac01, 0xafff).ram();
map(0xc000, 0xc007).w(m_mainlatch, FUNC(ls259_device::write_d0));
map(0xe000, 0xe000).portr("SYSTEM");
map(0xe800, 0xe800).portr("P1");
@@ -545,7 +264,7 @@ void akazukin_state::akazukin(machine_config &config)
LS259(config, m_mainlatch);
m_mainlatch->q_out_cb<0>().set(FUNC(akazukin_state::nmi_mask_w));
- m_mainlatch->q_out_cb<1>().set(FUNC(akazukin_state::flip_screen_set));
+ m_mainlatch->q_out_cb<1>().set(m_vasvid, FUNC(vastar_video_device::flipscreen_w));
m_mainlatch->q_out_cb<2>().set_inputline(m_subcpu, INPUT_LINE_RESET).invert();
// WATCHDOG_TIMER(config, "watchdog");
@@ -559,12 +278,16 @@ void akazukin_state::akazukin(machine_config &config)
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
screen.set_size(32*8, 32*8);
screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
- screen.set_screen_update(FUNC(akazukin_state::screen_update));
- screen.set_palette(m_palette);
-
- GFXDECODE(config, m_gfxdecode, m_palette, gfx_vastar);
- PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
+ VASTAR_VIDEO_DEVICE(config, m_vasvid, 0);
+ m_vasvid->set_screen("screen");
+ m_vasvid->set_bg_bases(0x000, 0x800, 0x400);
+ m_vasvid->set_fg_bases(0x000, 0x400, 0x800);
+ m_vasvid->set_other_bases(0x800, 0x400, 0x000, 0xbe0, 0xbc0);
+ m_vasvid->set_bg0ram_tag("bg0videoram");
+ m_vasvid->set_bg1ram_tag("bg1videoram");
+ m_vasvid->set_fgram_tag("fgvideoram");
+
// sound hardware
SPEAKER(config, "mono").front_center();
@@ -604,12 +327,12 @@ ROM_START( akazukin )
ROM_REGION( 0x2000, "bgtiles1", 0 ) // on ORCA OVG-46C sub board
ROM_LOAD( "8.p4", 0x0000, 0x2000, CRC(193f6bcb) SHA1(0f4699052b2c66fabd293e7ef08fd25de7af42f3) )
- ROM_REGION( 0x0300, "proms", 0 ) // on ORCA OVG-46C sub board
+ ROM_REGION( 0x0300, "vasvid:proms", 0 ) // on ORCA OVG-46C sub board
ROM_LOAD( "r.r6", 0x0000, 0x0100, CRC(77ccc932) SHA1(5bd23ca5ab80ac9c19e85ea79ba3d276c4be59cb) ) // red component
ROM_LOAD( "g.m6", 0x0100, 0x0100, CRC(eddc3acf) SHA1(0fca5d36ccbd5191ce8a59d070112ae4a3297b0b) ) // green component
ROM_LOAD( "b.l6", 0x0200, 0x0100, CRC(059dae45) SHA1(26c9b975804fc206e80ee21361e489824f39e0c0) ) // blue component
- ROM_REGION( 0x0100, "unkprom", 0 ) // on ORCA OVG-46C sub board
+ ROM_REGION( 0x0100, "vasvid:unkprom", 0 ) // on ORCA OVG-46C sub board
ROM_LOAD( "8n", 0x0000, 0x0100, CRC(e1b815ca) SHA1(df2b99259bf1023d37aa3b54247721d657d7e9c9) ) // ????
ROM_END
diff --git a/src/mame/misc/kyugo.cpp b/src/mame/orca/kyugo.cpp
index a2b4fbd5959..a2b4fbd5959 100644
--- a/src/mame/misc/kyugo.cpp
+++ b/src/mame/orca/kyugo.cpp
diff --git a/src/mame/misc/kyugo.h b/src/mame/orca/kyugo.h
index 5dcdbe02aae..94eade56bd1 100644
--- a/src/mame/misc/kyugo.h
+++ b/src/mame/orca/kyugo.h
@@ -5,8 +5,8 @@
Kyugo hardware games
***************************************************************************/
-#ifndef MAME_MISC_KYUGO_H
-#define MAME_MISC_KYUGO_H
+#ifndef MAME_ORCA_KYUGO_H
+#define MAME_ORCA_KYUGO_H
#pragma once
@@ -100,4 +100,4 @@ private:
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
};
-#endif // MAME_MISC_KYUGO_H
+#endif // MAME_ORCA_KYUGO_H
diff --git a/src/mame/misc/kyugo_v.cpp b/src/mame/orca/kyugo_v.cpp
index b52b0bfb453..b52b0bfb453 100644
--- a/src/mame/misc/kyugo_v.cpp
+++ b/src/mame/orca/kyugo_v.cpp
diff --git a/src/mame/sigma/sub.cpp b/src/mame/orca/sub.cpp
index 45fdda167ba..45fdda167ba 100644
--- a/src/mame/sigma/sub.cpp
+++ b/src/mame/orca/sub.cpp
diff --git a/src/mame/orca/vastar.cpp b/src/mame/orca/vastar.cpp
index 33e5ca5df3e..47690d95612 100644
--- a/src/mame/orca/vastar.cpp
+++ b/src/mame/orca/vastar.cpp
@@ -106,6 +106,7 @@ Vsync : 60.58hz
#include "emu.h"
#include "orca40c.h"
+#include "vastar_viddev.h"
#include "cpu/z80/z80.h"
#include "machine/74259.h"
@@ -165,42 +166,16 @@ class vastar_state : public vastar_common_state
public:
vastar_state(const machine_config &mconfig, device_type type, const char *tag) :
vastar_common_state(mconfig, type, tag),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
- m_bgvideoram(*this, "bg%uvideoram", 1U),
- m_fgvideoram(*this, "fgvideoram"),
- m_sprite_priority(*this, "sprite_priority")
+ m_vasvid(*this, "vasvid")
{ }
void vastar(machine_config &config);
protected:
virtual void machine_reset() override;
- virtual void video_start() override;
private:
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
-
- required_shared_ptr_array<uint8_t, 2> m_bgvideoram;
- required_shared_ptr<uint8_t> m_fgvideoram;
- required_shared_ptr<uint8_t> m_sprite_priority;
-
- // these are pointers into m_fgvideoram
- uint8_t* m_bg_scroll[2]{};
- uint8_t* m_spriteram[3]{};
-
- tilemap_t *m_fg_tilemap = nullptr;
- tilemap_t *m_bg_tilemap[2]{};
-
- void fgvideoram_w(offs_t offset, uint8_t data);
- template <uint8_t Which> void bgvideoram_w(offs_t offset, uint8_t data);
-
- TILE_GET_INFO_MEMBER(get_fg_tile_info);
- template <uint8_t Which> TILE_GET_INFO_MEMBER(get_bg_tile_info);
-
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+ required_device<vastar_video_device> m_vasvid;
void main_map(address_map &map);
};
@@ -219,189 +194,6 @@ private:
};
-// video
-
-/***************************************************************************
-
- Callbacks for the TileMap code
-
-***************************************************************************/
-
-TILE_GET_INFO_MEMBER(vastar_state::get_fg_tile_info)
-{
- int const code = m_fgvideoram[tile_index + 0x800] | (m_fgvideoram[tile_index + 0x400] << 8);
- int const color = m_fgvideoram[tile_index];
- int const fxy = (code & 0xc00) >> 10; // maybe, based on the other layers
- tileinfo.set(0,
- code,
- color & 0x3f,
- TILE_FLIPXY(fxy));
-}
-
-template <uint8_t Which>
-TILE_GET_INFO_MEMBER(vastar_state::get_bg_tile_info)
-{
- int const code = m_bgvideoram[Which][tile_index + 0x800] | (m_bgvideoram[Which][tile_index] << 8);
- int const color = m_bgvideoram[Which][tile_index + 0xc00];
- int fxy = (code & 0xc00) >> 10;
- tileinfo.set(4 - Which,
- code,
- color & 0x3f,
- TILE_FLIPXY(fxy));
-}
-
-
-/***************************************************************************
-
- Start the video hardware emulation.
-
-***************************************************************************/
-
-void vastar_state::video_start()
-{
- m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vastar_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 32,32);
- m_bg_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vastar_state::get_bg_tile_info<0>)), TILEMAP_SCAN_ROWS, 8,8, 32,32);
- m_bg_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vastar_state::get_bg_tile_info<1>)), TILEMAP_SCAN_ROWS, 8,8, 32,32);
-
- m_fg_tilemap->set_transparent_pen(0);
- m_bg_tilemap[0]->set_transparent_pen(0);
- m_bg_tilemap[1]->set_transparent_pen(0);
-
- m_bg_tilemap[0]->set_scroll_cols(32);
- m_bg_tilemap[1]->set_scroll_cols(32);
-}
-
-
-/***************************************************************************
-
- Memory handlers
-
-***************************************************************************/
-
-void vastar_state::fgvideoram_w(offs_t offset, uint8_t data)
-{
- m_fgvideoram[offset] = data;
- m_fg_tilemap->mark_tile_dirty(offset & 0x3ff);
-}
-
-template <uint8_t Which>
-void vastar_state::bgvideoram_w(offs_t offset, uint8_t data)
-{
- m_bgvideoram[Which][offset] = data;
- m_bg_tilemap[Which]->mark_tile_dirty(offset & 0x3ff);
-}
-
-
-/***************************************************************************
-
- Display refresh
-
-***************************************************************************/
-
-// I wouldn't rule out the possibility of there being 2 sprite chips due to
-// "offs & 0x20" being used to select the tile bank.
-//
-// for Planet Probe more cases appear correct if we draw the list in reverse
-// order, but it's also possible we should be drawing 2 swapped lists in
-// forward order instead
-void vastar_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
-// for (int offs = 0; offs < 0x40; offs += 2)
- for (int offs = 0x40 - 2; offs >= 0; offs -= 2)
- {
- int const code = ((m_spriteram[2][offs] & 0xfc) >> 2) + ((m_spriteram[1][offs] & 0x01) << 6)
- + ((offs & 0x20) << 2);
-
- int const sx = m_spriteram[2][offs + 1];
- int sy = m_spriteram[0][offs];
- int const color = m_spriteram[0][offs + 1] & 0x3f;
- int flipx = m_spriteram[2][offs] & 0x02;
- int flipy = m_spriteram[2][offs] & 0x01;
-
- if (flip_screen())
- {
- flipx = !flipx;
- flipy = !flipy;
- }
-
- if (m_spriteram[1][offs] & 0x08) // double width
- {
- if (!flip_screen())
- sy = 224 - sy;
-
- m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
- code / 2,
- color,
- flipx, flipy,
- sx, sy, 0);
- // redraw with wraparound
- m_gfxdecode->gfx(2)->transpen(bitmap, cliprect,
- code / 2,
- color,
- flipx, flipy,
- sx, sy + 256, 0);
- }
- else
- {
- if (!flip_screen())
- sy = 240 - sy;
-
- m_gfxdecode->gfx(1)->transpen(bitmap, cliprect,
- code,
- color,
- flipx, flipy,
- sx, sy, 0);
- }
- }
-}
-
-uint32_t vastar_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- for (int i = 0;i < 32;i++)
- {
- m_bg_tilemap[0]->set_scrolly(i, m_bg_scroll[0][i]);
- m_bg_tilemap[1]->set_scrolly(i, m_bg_scroll[1][i]);
- }
-
- switch (*m_sprite_priority)
- {
- case 0:
- m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
- draw_sprites(bitmap, cliprect);
- m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
- m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- break;
-
- case 1: // ?? planet probe
- m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
- m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
- draw_sprites(bitmap, cliprect);
- m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- break;
-
- case 2:
- m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
- draw_sprites(bitmap, cliprect);
- m_bg_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0);
- m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
- m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- break;
-
- case 3:
- m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
- m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
- m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- draw_sprites(bitmap, cliprect);
- break;
-
- default:
- LOGPRIORITY("Unimplemented priority %X\n", *m_sprite_priority);
- break;
- }
- return 0;
-}
-
-
// machine
void vastar_common_state::machine_start()
@@ -411,13 +203,6 @@ void vastar_common_state::machine_start()
void vastar_state::machine_reset()
{
- m_sprite_priority[0] = 0;
-
- m_spriteram[0] = m_fgvideoram + 0x000;
- m_bg_scroll[0] = m_fgvideoram + 0x3c0;
- m_bg_scroll[1] = m_fgvideoram + 0x3e0;
- m_spriteram[1] = m_fgvideoram + 0x400;
- m_spriteram[2] = m_fgvideoram + 0x800;
}
WRITE_LINE_MEMBER(vastar_common_state::nmi_mask_w)
@@ -425,14 +210,13 @@ WRITE_LINE_MEMBER(vastar_common_state::nmi_mask_w)
m_nmi_mask = state;
}
-
void vastar_state::main_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
- map(0x8000, 0x8fff).ram().w(FUNC(vastar_state::bgvideoram_w<1>)).share(m_bgvideoram[1]).mirror(0x2000);
- map(0x9000, 0x9fff).ram().w(FUNC(vastar_state::bgvideoram_w<0>)).share(m_bgvideoram[0]).mirror(0x2000);
- map(0xc000, 0xc000).writeonly().share(m_sprite_priority); // sprite / BG priority
- map(0xc400, 0xcfff).ram().w(FUNC(vastar_state::fgvideoram_w)).share(m_fgvideoram); // fg videoram + sprites
+ map(0x8000, 0x8fff).ram().w(m_vasvid, FUNC(vastar_video_device::bgvideoram_w<1>)).share("bg1videoram").mirror(0x2000);
+ map(0x9000, 0x9fff).ram().w(m_vasvid, FUNC(vastar_video_device::bgvideoram_w<0>)).share("bg0videoram").mirror(0x2000);
+ map(0xc000, 0xc000).w(m_vasvid, FUNC(vastar_video_device::priority_w));
+ map(0xc400, 0xcfff).ram().w(m_vasvid, FUNC(vastar_video_device::fgvideoram_w)).share("fgvideoram");
map(0xe000, 0xe000).rw("watchdog", FUNC(watchdog_timer_device::reset_r), FUNC(watchdog_timer_device::reset_w));
map(0xf000, 0xf7ff).ram().share(m_sharedram);
}
@@ -659,52 +443,6 @@ static INPUT_PORTS_START( pprobe )
PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C ) )
INPUT_PORTS_END
-static const gfx_layout charlayout =
-{
- 8,8,
- RGN_FRAC(1,1),
- 2,
- { 0, 4 },
- { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 },
- { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
- 16*8
-};
-
-static const gfx_layout spritelayout =
-{
- 16,16,
- RGN_FRAC(1,1),
- 2,
- { 0, 4 },
- { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3,
- 16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 },
- { 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
-};
-
-static const gfx_layout spritelayoutdw =
-{
- 16,32,
- RGN_FRAC(1,1),
- 2,
- { 0, 4 },
- { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3,
- 16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 },
- { 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 },
- 128*8
-};
-
-static GFXDECODE_START( gfx_vastar )
- GFXDECODE_ENTRY( "fgtiles", 0, charlayout, 0, 64 )
- GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 64 )
- GFXDECODE_ENTRY( "sprites", 0, spritelayoutdw, 0, 64 )
- GFXDECODE_ENTRY( "bgtiles0", 0, charlayout, 0, 64 )
- GFXDECODE_ENTRY( "bgtiles1", 0, charlayout, 0, 64 )
-GFXDECODE_END
INTERRUPT_GEN_MEMBER(vastar_common_state::vblank_irq)
@@ -749,7 +487,7 @@ void vastar_state::vastar(machine_config &config)
m_maincpu->set_vblank_int("screen", FUNC(vastar_state::vblank_irq));
ls259_device &mainlatch(*subdevice<ls259_device>("mainlatch"));
- mainlatch.q_out_cb<1>().set(FUNC(vastar_state::flip_screen_set));
+ mainlatch.q_out_cb<1>().set(m_vasvid, FUNC(vastar_video_device::flipscreen_w));
// video hardware
screen_device& screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@@ -757,11 +495,15 @@ void vastar_state::vastar(machine_config &config)
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
screen.set_size(32*8, 32*8);
screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
- screen.set_screen_update(FUNC(vastar_state::screen_update));
- screen.set_palette(m_palette);
- GFXDECODE(config, m_gfxdecode, m_palette, gfx_vastar);
- PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
+ VASTAR_VIDEO_DEVICE(config, m_vasvid, 0);
+ m_vasvid->set_screen("screen");
+ m_vasvid->set_bg_bases(0x800, 0x000, 0xc00);
+ m_vasvid->set_fg_bases(0x800, 0x400, 0x000);
+ m_vasvid->set_other_bases(0x000, 0x400, 0x800, 0x3c0, 0x3e0);
+ m_vasvid->set_bg0ram_tag("bg0videoram");
+ m_vasvid->set_bg1ram_tag("bg1videoram");
+ m_vasvid->set_fgram_tag("fgvideoram");
}
void dogfightp_state::dogfightp(machine_config &config)
@@ -815,12 +557,12 @@ ROM_START( vastar )
ROM_REGION( 0x2000, "bgtiles1", 0 )
ROM_LOAD( "c_s4.rom", 0x0000, 0x2000, CRC(c9fbbfc9) SHA1(7c6ace0e2eae8420a31d9054ad5dd94924273d5f) )
- ROM_REGION( 0x0300, "proms", 0 )
+ ROM_REGION( 0x0300, "vasvid:proms", 0 )
ROM_LOAD( "tbp24s10.6p", 0x0000, 0x0100, CRC(a712d73a) SHA1(a65fa5928431d8631fb04e01ad0a0d2de849bf1d) ) // red component
ROM_LOAD( "tbp24s10.6s", 0x0100, 0x0100, CRC(0a7d48ec) SHA1(400e0b271c241712e7b7502e96e4f8a609e078e1) ) // green component
ROM_LOAD( "tbp24s10.6m", 0x0200, 0x0100, CRC(4c3db907) SHA1(03bcbc4763dcf49f4a06f499042e36183aa8b762) ) // blue component
- ROM_REGION( 0x0100, "unkprom", 0 )
+ ROM_REGION( 0x0100, "vasvid:unkprom", 0 )
ROM_LOAD( "tbp24s10.8n", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) // ????
ROM_END
@@ -852,12 +594,12 @@ ROM_START( vastar2 )
ROM_REGION( 0x2000, "bgtiles1", 0 )
ROM_LOAD( "c_s4.rom", 0x0000, 0x2000, CRC(c9fbbfc9) SHA1(7c6ace0e2eae8420a31d9054ad5dd94924273d5f) )
- ROM_REGION( 0x0300, "proms", 0 )
+ ROM_REGION( 0x0300, "vasvid:proms", 0 )
ROM_LOAD( "tbp24s10.6p", 0x0000, 0x0100, CRC(a712d73a) SHA1(a65fa5928431d8631fb04e01ad0a0d2de849bf1d) ) // red component
ROM_LOAD( "tbp24s10.6s", 0x0100, 0x0100, CRC(0a7d48ec) SHA1(400e0b271c241712e7b7502e96e4f8a609e078e1) ) // green component
ROM_LOAD( "tbp24s10.6m", 0x0200, 0x0100, CRC(4c3db907) SHA1(03bcbc4763dcf49f4a06f499042e36183aa8b762) ) // blue component
- ROM_REGION( 0x0100, "unkprom", 0 )
+ ROM_REGION( 0x0100, "vasvid:unkprom", 0 )
ROM_LOAD( "tbp24s10.8n", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) // ????
ROM_END
@@ -895,12 +637,12 @@ ROM_START( vastar3 )
ROM_REGION( 0x2000, "bgtiles1", 0 )
ROM_LOAD( "c_s4.rom", 0x0000, 0x2000, CRC(c9fbbfc9) SHA1(7c6ace0e2eae8420a31d9054ad5dd94924273d5f) )
- ROM_REGION( 0x0300, "proms", 0 )
+ ROM_REGION( 0x0300, "vasvid:proms", 0 )
ROM_LOAD( "tbp24s10.6p", 0x0000, 0x0100, CRC(a712d73a) SHA1(a65fa5928431d8631fb04e01ad0a0d2de849bf1d) ) // red component
ROM_LOAD( "tbp24s10.6s", 0x0100, 0x0100, CRC(0a7d48ec) SHA1(400e0b271c241712e7b7502e96e4f8a609e078e1) ) // green component
ROM_LOAD( "tbp24s10.6m", 0x0200, 0x0100, CRC(4c3db907) SHA1(03bcbc4763dcf49f4a06f499042e36183aa8b762) ) // blue component
- ROM_REGION( 0x0100, "unkprom", 0 )
+ ROM_REGION( 0x0100, "vasvid:unkprom", 0 )
ROM_LOAD( "tbp24s10.8n", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) // ????
ROM_END
@@ -932,12 +674,12 @@ ROM_START( vastar4 ) // minimal changes (2 bytes) from parent set
ROM_REGION( 0x2000, "bgtiles1", 0 )
ROM_LOAD( "c_s4.rom", 0x0000, 0x2000, CRC(c9fbbfc9) SHA1(7c6ace0e2eae8420a31d9054ad5dd94924273d5f) )
- ROM_REGION( 0x0300, "proms", 0 )
+ ROM_REGION( 0x0300, "vasvid:proms", 0 )
ROM_LOAD( "tbp24s10.6p", 0x0000, 0x0100, CRC(a712d73a) SHA1(a65fa5928431d8631fb04e01ad0a0d2de849bf1d) ) // red component
ROM_LOAD( "tbp24s10.6s", 0x0100, 0x0100, CRC(0a7d48ec) SHA1(400e0b271c241712e7b7502e96e4f8a609e078e1) ) // green component
ROM_LOAD( "tbp24s10.6m", 0x0200, 0x0100, CRC(4c3db907) SHA1(03bcbc4763dcf49f4a06f499042e36183aa8b762) ) // blue component
- ROM_REGION( 0x0100, "unkprom", 0 )
+ ROM_REGION( 0x0100, "vasvid:unkprom", 0 )
ROM_LOAD( "tbp24s10.8n", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) // ????
ROM_END
@@ -987,12 +729,12 @@ ROM_START( pprobe )
ROM_REGION( 0x2000, "bgtiles1", 0 )
ROM_LOAD( "pb7.bin", 0x0000, 0x2000, CRC(439978f7) SHA1(ba80dd919a9bb6f8c516d4eb794c02ae0f0dea00) )
- ROM_REGION( 0x0300, "proms", 0 )
+ ROM_REGION( 0x0300, "vasvid:proms", 0 )
ROM_LOAD( "n82s129.3", 0x0000, 0x0100, CRC(dfb6b97c) SHA1(e35eda4f3022e661b021b952c53054d96481fb49) )
ROM_LOAD( "n82s129.1", 0x0100, 0x0100, CRC(3cc696a2) SHA1(0a1407c19c63ee0f02c3e8b95b0c199b9aec3ce5) )
ROM_LOAD( "dm74s287.2", 0x0200, 0x0100, CRC(64fea033) SHA1(19bbb325f71cb17ea069958b3c246fa908f0008e) )
- ROM_REGION( 0x0100, "unkprom", 0 )
+ ROM_REGION( 0x0100, "vasvid:unkprom", 0 )
ROM_LOAD( "mmi6301-1.bin", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) // ???? == vastar - tbp24s10.8n
ROM_END
diff --git a/src/mame/orca/vastar_viddev.cpp b/src/mame/orca/vastar_viddev.cpp
new file mode 100644
index 00000000000..49911883ef8
--- /dev/null
+++ b/src/mame/orca/vastar_viddev.cpp
@@ -0,0 +1,282 @@
+// license:BSD-3-Clause
+// copyright-holders: Allard van der Bas
+
+// Orca video system, implemented on ORCA OVG-46C PCB
+
+#include "emu.h"
+#include "vastar_viddev.h"
+
+#include "emupal.h"
+#include "screen.h"
+
+DEFINE_DEVICE_TYPE(VASTAR_VIDEO_DEVICE, vastar_video_device, "vastar_viddev", "Orca Vastar Video Device")
+
+vastar_video_device::vastar_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, VASTAR_VIDEO_DEVICE, tag, owner, clock)
+ , device_gfx_interface(mconfig, *this, nullptr, "palette")
+ , device_video_interface(mconfig, *this)
+ , m_bgvideoram(*this, { finder_base::DUMMY_TAG, finder_base::DUMMY_TAG })
+ , m_fgvideoram(*this, finder_base::DUMMY_TAG)
+ , m_fg_vregs(0)
+ , m_flip_screen(0)
+{
+}
+
+/*************************************
+ *
+ * Graphics definitions
+ *
+ *************************************/
+
+static const gfx_layout charlayout =
+{
+ 8,8,
+ RGN_FRAC(1,1),
+ 2,
+ { 0, 4 },
+ { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 },
+ { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
+ 16*8
+};
+
+static const gfx_layout spritelayout =
+{
+ 16,16,
+ RGN_FRAC(1,1),
+ 2,
+ { 0, 4 },
+ { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3,
+ 16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 },
+ { 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
+};
+
+static const gfx_layout spritelayoutdw =
+{
+ 16,32,
+ RGN_FRAC(1,1),
+ 2,
+ { 0, 4 },
+ { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3,
+ 16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 },
+ { 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 },
+ 128*8
+};
+
+GFXDECODE_MEMBER(vastar_video_device::gfxinfo)
+ GFXDECODE_ENTRY( "fgtiles", 0, charlayout, 0, 64 )
+ GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 64 )
+ GFXDECODE_ENTRY( "sprites", 0, spritelayoutdw, 0, 64 )
+ GFXDECODE_ENTRY( "bgtiles0", 0, charlayout, 0, 64 )
+ GFXDECODE_ENTRY( "bgtiles1", 0, charlayout, 0, 64 )
+GFXDECODE_END
+
+
+//-------------------------------------------------
+// device_start: Start up the device
+//-------------------------------------------------
+
+void vastar_video_device::device_start()
+{
+ decode_gfx(gfxinfo);
+
+ m_fg_tilemap = &machine().tilemap().create(*this, tilemap_get_info_delegate(*this, FUNC(vastar_video_device::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 32,32);
+ m_bg_tilemap[0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(*this, FUNC(vastar_video_device::get_bg_tile_info<0>)), TILEMAP_SCAN_ROWS, 8,8, 32,32);
+ m_bg_tilemap[1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(*this, FUNC(vastar_video_device::get_bg_tile_info<1>)), TILEMAP_SCAN_ROWS, 8,8, 32,32);
+
+ m_fg_tilemap->set_transparent_pen(0);
+ m_bg_tilemap[0]->set_transparent_pen(0);
+ m_bg_tilemap[1]->set_transparent_pen(0);
+
+ m_bg_tilemap[0]->set_scroll_cols(32);
+ m_bg_tilemap[1]->set_scroll_cols(32);
+
+ m_fg_vregs = 0;
+ m_flip_screen = 0;
+
+ save_item(NAME(m_fg_vregs));
+ save_item(NAME(m_flip_screen));
+}
+
+WRITE_LINE_MEMBER(vastar_video_device::flipscreen_w)
+{
+ m_flip_screen = state ? 1 : 0;
+
+ m_bg_tilemap[0]->set_flip(m_flip_screen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
+ m_bg_tilemap[1]->set_flip(m_flip_screen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
+ m_fg_tilemap->set_flip(m_flip_screen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
+}
+
+template <uint8_t Which>
+TILE_GET_INFO_MEMBER(vastar_video_device::get_bg_tile_info)
+{
+ int const code = m_bgvideoram[Which][tile_index + m_bg_codebase] | (m_bgvideoram[Which][tile_index + m_bg_attrbase] << 8);
+ int const color = m_bgvideoram[Which][tile_index + m_bg_colbase];
+ int const fxy = (code & 0xc00) >> 10;
+ tileinfo.set(4 - Which,
+ code,
+ color & 0x3f,
+ TILE_FLIPXY(fxy));
+}
+
+TILE_GET_INFO_MEMBER(vastar_video_device::get_fg_tile_info)
+{
+ int const code = m_fgvideoram[tile_index + m_fg_codebase] | (m_fgvideoram[tile_index + m_fg_attrbase] << 8);
+ int const color = m_fgvideoram[tile_index + m_fg_colbase];
+ // TODO: guess, based on the other layers
+ int const fxy = (code & 0xc00) >> 10;
+ tileinfo.set(0,
+ code,
+ color & 0x3f,
+ TILE_FLIPXY(fxy));
+}
+
+void vastar_video_device::draw_sprites(bitmap_rgb32& bitmap, const rectangle& cliprect, uint16_t rambase, uint16_t tilebase)
+{
+ uint8_t const *const spriteram = &m_fgvideoram[rambase];
+ for (int offs = 0; offs < 0x10; offs += 2)
+ {
+ const int code = ((spriteram[m_spr_code_x + offs] & 0xfc) >> 2) + ((spriteram[m_spr_attr + offs] & 0x01) << 6) + tilebase;
+
+ const int sx = spriteram[m_spr_code_x + offs + 1];
+ int sy = spriteram[m_spr_y_col + offs];
+ const int color = spriteram[m_spr_y_col + offs + 1] & 0x3f;
+ int flipx = spriteram[m_spr_code_x + offs] & 0x02;
+ int flipy = spriteram[m_spr_code_x + offs] & 0x01;
+
+ if (m_flip_screen)
+ {
+ int temp = flipx;
+ flipx = !flipy;
+ flipy = !temp;
+ }
+
+ if (spriteram[m_spr_attr + offs] & 0x08) // double width
+ {
+ if (!m_flip_screen)
+ sy = 224 - sy;
+
+ gfx(2)->transpen(bitmap, cliprect,
+ code / 2,
+ color,
+ flipx, flipy,
+ sx, sy, 0);
+ // redraw with wraparound y
+ gfx(2)->transpen(bitmap, cliprect,
+ code / 2,
+ color,
+ flipx, flipy,
+ sx, sy + 256, 0);
+
+ // redraw with wraparound x
+ gfx(2)->transpen(bitmap, cliprect,
+ code / 2,
+ color,
+ flipx, flipy,
+ sx - 256, sy, 0);
+
+ // redraw with wraparound xy
+ gfx(2)->transpen(bitmap, cliprect,
+ code / 2,
+ color,
+ flipx, flipy,
+ sx - 256, sy + 256, 0);
+ }
+ else
+ {
+ if (!m_flip_screen)
+ sy = 240 - sy;
+
+ gfx(1)->transpen(bitmap, cliprect,
+ code,
+ color,
+ flipx, flipy,
+ sx, sy, 0);
+
+ // redraw with wraparound x
+ gfx(1)->transpen(bitmap, cliprect,
+ code,
+ color,
+ flipx, flipy,
+ sx - 256, sy, 0);
+ }
+ }
+}
+
+uint32_t vastar_video_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+{
+ for (int i = 0; i < 32; i++)
+ {
+ m_bg_tilemap[0]->set_scrolly(i, m_fgvideoram[m_bg_scroll0 + i]);
+ m_bg_tilemap[1]->set_scrolly(i, m_fgvideoram[m_bg_scroll1 + i]);
+ }
+
+ // Looks like $ac00 is some kind of '46C mixer control.
+ switch (m_fg_vregs)
+ {
+ case 0:
+ m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
+ draw_sprites(bitmap, cliprect, 0x30, 0x80);
+ draw_sprites(bitmap, cliprect, 0x10, 0x00);
+ m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
+ m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ break;
+
+ case 1: // ?? planet probe
+ m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
+ m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
+ draw_sprites(bitmap, cliprect, 0x30, 0x80);
+ draw_sprites(bitmap, cliprect, 0x10, 0x00);
+ m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ break;
+
+ case 2:
+ m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
+ draw_sprites(bitmap, cliprect, 0x30, 0x80);
+ draw_sprites(bitmap, cliprect, 0x10, 0x00);
+ m_bg_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0);
+ m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
+ m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ break;
+
+ case 3:
+ m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
+ m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
+ m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ draw_sprites(bitmap, cliprect, 0x30, 0x80);
+ draw_sprites(bitmap, cliprect, 0x10, 0x00);
+ break;
+
+ case 4: // akazukin title screen
+ m_fg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
+ draw_sprites(bitmap, cliprect, 0x30, 0x80);
+ draw_sprites(bitmap, cliprect, 0x10, 0x00);
+ m_bg_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0);
+ m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
+ break;
+
+ default:
+ popmessage("Unimplemented priority %X\n", m_fg_vregs);
+ break;
+ }
+
+ return 0;
+}
+
+void vastar_video_device::device_config_complete()
+{
+ if (!has_screen())
+ return;
+
+ if (!screen().has_screen_update())
+ screen().set_screen_update(*this, FUNC(vastar_video_device::screen_update));
+}
+
+void vastar_video_device::device_add_mconfig(machine_config &config)
+{
+ PALETTE(config, "palette", palette_device::RGB_444_PROMS, "proms", 256);
+}
diff --git a/src/mame/orca/vastar_viddev.h b/src/mame/orca/vastar_viddev.h
new file mode 100644
index 00000000000..9234ee52dde
--- /dev/null
+++ b/src/mame/orca/vastar_viddev.h
@@ -0,0 +1,101 @@
+// license:BSD-3-Clause
+// copyright-holders: Allard van der Bas
+
+/***************************************************************************
+
+ vastar_viddev.h
+
+***************************************************************************/
+
+#ifndef MAME_ORCA_VASTAR_VIDDEV_H
+#define MAME_ORCA_VASTAR_VIDDEV_H
+
+#pragma once
+
+#include "emupal.h"
+#include "tilemap.h"
+
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+// ======================> vastar_video_device
+
+class vastar_video_device : public device_t, public device_gfx_interface, public device_video_interface
+{
+public:
+ // construction/destruction
+ vastar_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+
+ void set_bg_bases(uint16_t code, uint16_t attr, uint16_t col) { m_bg_codebase = code; m_bg_attrbase = attr; m_bg_colbase = col; }
+ void set_fg_bases(uint16_t code, uint16_t attr, uint16_t col) { m_fg_codebase = code; m_fg_attrbase = attr; m_fg_colbase = col; }
+ void set_other_bases(uint16_t spy, uint16_t atr, uint16_t spx, uint16_t bgs0, uint16_t bgs1) { m_spr_y_col = spy; m_spr_attr = atr; m_spr_code_x = spx; m_bg_scroll0 = bgs0; m_bg_scroll1 = bgs1; }
+
+ template <typename... T> void set_bg0ram_tag(T &&... args) { m_bgvideoram[0].set_tag(std::forward<T>(args)...); }
+ template <typename... T> void set_bg1ram_tag(T &&... args) { m_bgvideoram[1].set_tag(std::forward<T>(args)...); }
+ template <typename... T> void set_fgram_tag(T &&... args) { m_fgvideoram.set_tag(std::forward<T>(args)...); }
+
+ // memory handlers
+ void fgvideoram_w(offs_t offset, uint8_t data)
+ {
+ m_fgvideoram[offset] = data;
+ m_fg_tilemap->mark_tile_dirty(offset & 0x3ff);
+ }
+
+ template <uint8_t Which>
+ void bgvideoram_w(offs_t offset, uint8_t data)
+ {
+ m_bgvideoram[Which][offset] = data;
+ m_bg_tilemap[Which]->mark_tile_dirty(offset & 0x3ff);
+ }
+
+ DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
+ void priority_w(uint8_t data) { m_fg_vregs = data; }
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_config_complete() override;
+ virtual void device_add_mconfig(machine_config &config) override;
+
+private:
+ // shared memory finders
+ required_shared_ptr_array<uint8_t, 2> m_bgvideoram;
+ required_shared_ptr<uint8_t> m_fgvideoram;
+
+ // decoding info
+ DECLARE_GFXDECODE_MEMBER(gfxinfo);
+
+ // internal state
+ tilemap_t *m_fg_tilemap = nullptr;
+ tilemap_t *m_bg_tilemap[2]{};
+
+ uint8_t m_fg_vregs;
+ uint8_t m_flip_screen;
+
+ // config
+ uint16_t m_bg_codebase = 0;
+ uint16_t m_bg_attrbase = 0;
+ uint16_t m_bg_colbase = 0;
+ uint16_t m_fg_codebase = 0;
+ uint16_t m_fg_attrbase = 0;
+ uint16_t m_fg_colbase = 0;
+
+ uint16_t m_spr_y_col = 0;
+ uint16_t m_spr_attr = 0;
+ uint16_t m_spr_code_x = 0;
+ uint16_t m_bg_scroll0 = 0;
+ uint16_t m_bg_scroll1 = 0;
+
+ TILE_GET_INFO_MEMBER(get_fg_tile_info);
+ template <uint8_t Which> TILE_GET_INFO_MEMBER(get_bg_tile_info);
+
+ uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ void draw_sprites( bitmap_rgb32 &bitmap, const rectangle &cliprect, uint16_t rambase, uint16_t tilebase );
+};
+
+// device type definition
+DECLARE_DEVICE_TYPE(VASTAR_VIDEO_DEVICE, vastar_video_device)
+
+#endif // MAME_ORCA_VASTAR_VIDDEV_H