Seta video encapsulation

- seta001: Move gfxdecode down into device; add putative master clocks
- x1_012: Separate emulation of tile layers as new device
This commit is contained in:
AJR 2020-11-30 20:49:31 -05:00
parent ff96418e9a
commit 7d89ac0608
15 changed files with 600 additions and 587 deletions

View File

@ -3813,6 +3813,8 @@ files {
MAME_DIR .. "src/mame/includes/simple_st0016.h", MAME_DIR .. "src/mame/includes/simple_st0016.h",
MAME_DIR .. "src/mame/video/seta001.cpp", MAME_DIR .. "src/mame/video/seta001.cpp",
MAME_DIR .. "src/mame/video/seta001.h", MAME_DIR .. "src/mame/video/seta001.h",
MAME_DIR .. "src/mame/video/x1_012.cpp",
MAME_DIR .. "src/mame/video/x1_012.h",
MAME_DIR .. "src/mame/drivers/thedealr.cpp", MAME_DIR .. "src/mame/drivers/thedealr.cpp",
} }

View File

@ -223,10 +223,7 @@ void cchance_state::cchance(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &cchance_state::main_map); m_maincpu->set_addrmap(AS_PROGRAM, &cchance_state::main_map);
m_maincpu->set_vblank_int("screen", FUNC(cchance_state::irq0_line_hold)); m_maincpu->set_vblank_int("screen", FUNC(cchance_state::irq0_line_hold));
GFXDECODE(config, "gfxdecode", m_palette, gfx_cchance); SETA001_SPRITE(config, m_seta001, 16000000, m_palette, gfx_cchance);
SETA001_SPRITE(config, m_seta001, 0);
m_seta001->set_gfxdecode_tag("gfxdecode");
/* video hardware */ /* video hardware */
SCREEN(config, m_screen, SCREEN_TYPE_RASTER); SCREEN(config, m_screen, SCREEN_TYPE_RASTER);

View File

@ -501,8 +501,7 @@ void champbwl_state::champbwl(machine_config &config)
MCFG_MACHINE_START_OVERRIDE(champbwl_state,champbwl) MCFG_MACHINE_START_OVERRIDE(champbwl_state,champbwl)
MCFG_MACHINE_RESET_OVERRIDE(champbwl_state,champbwl) MCFG_MACHINE_RESET_OVERRIDE(champbwl_state,champbwl)
SETA001_SPRITE(config, m_seta001, 0); SETA001_SPRITE(config, m_seta001, 16000000, m_palette, gfx_champbwl);
m_seta001->set_gfxdecode_tag("gfxdecode");
/* video hardware */ /* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@ -514,7 +513,6 @@ void champbwl_state::champbwl(machine_config &config)
screen.screen_vblank().set(FUNC(champbwl_state::screen_vblank_champbwl)); screen.screen_vblank().set(FUNC(champbwl_state::screen_vblank_champbwl));
screen.set_palette(m_palette); screen.set_palette(m_palette);
GFXDECODE(config, "gfxdecode", m_palette, gfx_champbwl);
PALETTE(config, m_palette, FUNC(champbwl_state::champbwl_palette), 512); PALETTE(config, m_palette, FUNC(champbwl_state::champbwl_palette), 512);
/* sound hardware */ /* sound hardware */
@ -562,8 +560,7 @@ void champbwl_state::doraemon(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
SETA001_SPRITE(config, m_seta001, 0); SETA001_SPRITE(config, m_seta001, 14'318'181, m_palette, gfx_champbwl);
m_seta001->set_gfxdecode_tag("gfxdecode");
TICKET_DISPENSER(config, m_hopper, attotime::from_msec(2000), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW ); TICKET_DISPENSER(config, m_hopper, attotime::from_msec(2000), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW );
@ -579,7 +576,6 @@ void champbwl_state::doraemon(machine_config &config)
screen.screen_vblank().set(FUNC(champbwl_state::screen_vblank_doraemon)); screen.screen_vblank().set(FUNC(champbwl_state::screen_vblank_doraemon));
screen.set_palette(m_palette); screen.set_palette(m_palette);
GFXDECODE(config, "gfxdecode", m_palette, gfx_champbwl);
PALETTE(config, m_palette, FUNC(champbwl_state::champbwl_palette), 512); PALETTE(config, m_palette, FUNC(champbwl_state::champbwl_palette), 512);
/* sound hardware */ /* sound hardware */

File diff suppressed because it is too large Load Diff

View File

@ -1148,8 +1148,7 @@ void srmp2_state::srmp2(machine_config &config)
MCFG_MACHINE_START_OVERRIDE(srmp2_state,srmp2) MCFG_MACHINE_START_OVERRIDE(srmp2_state,srmp2)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
SETA001_SPRITE(config, m_seta001, 0); SETA001_SPRITE(config, m_seta001, 16000000, "palette", gfx_srmp2);
m_seta001->set_gfxdecode_tag("gfxdecode");
/* video hardware */ /* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@ -1160,7 +1159,6 @@ void srmp2_state::srmp2(machine_config &config)
screen.set_screen_update(FUNC(srmp2_state::screen_update_srmp2)); screen.set_screen_update(FUNC(srmp2_state::screen_update_srmp2));
screen.set_palette("palette"); screen.set_palette("palette");
GFXDECODE(config, "gfxdecode", "palette", gfx_srmp2);
PALETTE(config, "palette", FUNC(srmp2_state::srmp2_palette)).set_format(palette_device::xRGB_555, 1024); // sprites only PALETTE(config, "palette", FUNC(srmp2_state::srmp2_palette)).set_format(palette_device::xRGB_555, 1024); // sprites only
/* sound hardware */ /* sound hardware */
@ -1188,8 +1186,7 @@ void srmp2_state::srmp3(machine_config &config)
MCFG_MACHINE_START_OVERRIDE(srmp2_state,srmp3) MCFG_MACHINE_START_OVERRIDE(srmp2_state,srmp3)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
SETA001_SPRITE(config, m_seta001, 0); SETA001_SPRITE(config, m_seta001, 16000000, "palette", gfx_srmp3);
m_seta001->set_gfxdecode_tag("gfxdecode");
m_seta001->set_gfxbank_callback(FUNC(srmp2_state::srmp3_gfxbank_callback)); m_seta001->set_gfxbank_callback(FUNC(srmp2_state::srmp3_gfxbank_callback));
/* video hardware */ /* video hardware */
@ -1201,7 +1198,6 @@ void srmp2_state::srmp3(machine_config &config)
screen.set_screen_update(FUNC(srmp2_state::screen_update_srmp3)); screen.set_screen_update(FUNC(srmp2_state::screen_update_srmp3));
screen.set_palette("palette"); screen.set_palette("palette");
GFXDECODE(config, "gfxdecode", "palette", gfx_srmp3);
PALETTE(config, "palette", FUNC(srmp2_state::srmp3_palette)).set_format(palette_device::xRGB_555, 512); // sprites only PALETTE(config, "palette", FUNC(srmp2_state::srmp3_palette)).set_format(palette_device::xRGB_555, 512); // sprites only
/* sound hardware */ /* sound hardware */
@ -1240,8 +1236,7 @@ void srmp2_state::mjyuugi(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
SETA001_SPRITE(config, m_seta001, 0); SETA001_SPRITE(config, m_seta001, 16000000, "palette", gfx_srmp3);
m_seta001->set_gfxdecode_tag("gfxdecode");
m_seta001->set_gfxbank_callback(FUNC(srmp2_state::srmp3_gfxbank_callback)); m_seta001->set_gfxbank_callback(FUNC(srmp2_state::srmp3_gfxbank_callback));
/* video hardware */ /* video hardware */
@ -1253,7 +1248,6 @@ void srmp2_state::mjyuugi(machine_config &config)
screen.set_screen_update(FUNC(srmp2_state::screen_update_mjyuugi)); screen.set_screen_update(FUNC(srmp2_state::screen_update_mjyuugi));
screen.set_palette("palette"); screen.set_palette("palette");
GFXDECODE(config, "gfxdecode", "palette", gfx_srmp3);
PALETTE(config, "palette").set_format(palette_device::xRGB_555, 512); // sprites only PALETTE(config, "palette").set_format(palette_device::xRGB_555, 512); // sprites only
/* sound hardware */ /* sound hardware */

View File

@ -826,8 +826,7 @@ void taitox_state::superman(machine_config &config)
MCFG_MACHINE_START_OVERRIDE(taitox_state,taitox) MCFG_MACHINE_START_OVERRIDE(taitox_state,taitox)
SETA001_SPRITE(config, m_seta001, 0); SETA001_SPRITE(config, m_seta001, 0, m_palette, gfx_taito_x);
m_seta001->set_gfxdecode_tag(m_gfxdecode);
/* video hardware */ /* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@ -838,10 +837,9 @@ void taitox_state::superman(machine_config &config)
screen.set_screen_update(FUNC(taitox_state::screen_update_seta_no_layers)); screen.set_screen_update(FUNC(taitox_state::screen_update_seta_no_layers));
screen.set_palette(m_palette); screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_taito_x);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
MCFG_VIDEO_START_OVERRIDE(taitox_state,seta_no_layers) MCFG_VIDEO_START_OVERRIDE(taitox_state,seta)
/* sound hardware */ /* sound hardware */
SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "lspeaker").front_left();
@ -873,8 +871,7 @@ void taitox_state::daisenpu(machine_config &config)
MCFG_MACHINE_START_OVERRIDE(taitox_state,taitox) MCFG_MACHINE_START_OVERRIDE(taitox_state,taitox)
SETA001_SPRITE(config, m_seta001, 0); SETA001_SPRITE(config, m_seta001, 16'000'000, m_palette, gfx_taito_x);
m_seta001->set_gfxdecode_tag(m_gfxdecode);
/* video hardware */ /* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@ -885,10 +882,9 @@ void taitox_state::daisenpu(machine_config &config)
screen.set_screen_update(FUNC(taitox_state::screen_update_seta_no_layers)); screen.set_screen_update(FUNC(taitox_state::screen_update_seta_no_layers));
screen.set_palette(m_palette); screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_taito_x);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
MCFG_VIDEO_START_OVERRIDE(taitox_state,seta_no_layers) MCFG_VIDEO_START_OVERRIDE(taitox_state,seta)
/* sound hardware */ /* sound hardware */
SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "lspeaker").front_left();
@ -918,8 +914,7 @@ void taitox_state::gigandes(machine_config &config)
MCFG_MACHINE_START_OVERRIDE(taitox_state,taitox) MCFG_MACHINE_START_OVERRIDE(taitox_state,taitox)
SETA001_SPRITE(config, m_seta001, 0); SETA001_SPRITE(config, m_seta001, 16000000, m_palette, gfx_taito_x);
m_seta001->set_gfxdecode_tag(m_gfxdecode);
/* video hardware */ /* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@ -930,10 +925,9 @@ void taitox_state::gigandes(machine_config &config)
screen.set_screen_update(FUNC(taitox_state::screen_update_seta_no_layers)); screen.set_screen_update(FUNC(taitox_state::screen_update_seta_no_layers));
screen.set_palette(m_palette); screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_taito_x);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
MCFG_VIDEO_START_OVERRIDE(taitox_state,seta_no_layers) MCFG_VIDEO_START_OVERRIDE(taitox_state,seta)
/* sound hardware */ /* sound hardware */
SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "lspeaker").front_left();
@ -965,8 +959,7 @@ void taitox_state::ballbros(machine_config &config)
MCFG_MACHINE_START_OVERRIDE(taitox_state,taitox) MCFG_MACHINE_START_OVERRIDE(taitox_state,taitox)
SETA001_SPRITE(config, m_seta001, 0); SETA001_SPRITE(config, m_seta001, 16000000, m_palette, gfx_taito_x);
m_seta001->set_gfxdecode_tag(m_gfxdecode);
/* video hardware */ /* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@ -977,10 +970,9 @@ void taitox_state::ballbros(machine_config &config)
screen.set_screen_update(FUNC(taitox_state::screen_update_seta_no_layers)); screen.set_screen_update(FUNC(taitox_state::screen_update_seta_no_layers));
screen.set_palette(m_palette); screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_taito_x);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
MCFG_VIDEO_START_OVERRIDE(taitox_state, kyustrkr_no_layers) MCFG_VIDEO_START_OVERRIDE(taitox_state, kyustrkr)
/* sound hardware */ /* sound hardware */
SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "lspeaker").front_left();

View File

@ -555,8 +555,7 @@ void thedealr_state::thedealr(machine_config &config)
WATCHDOG_TIMER(config, "watchdog"); WATCHDOG_TIMER(config, "watchdog");
SETA001_SPRITE(config, m_seta001, 0); SETA001_SPRITE(config, m_seta001, 16'000'000, m_palette, gfx_thedealr);
m_seta001->set_gfxdecode_tag("gfxdecode");
// video hardware // video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@ -569,7 +568,6 @@ void thedealr_state::thedealr(machine_config &config)
screen.screen_vblank().append_inputline(m_subcpu, INPUT_LINE_NMI); screen.screen_vblank().append_inputline(m_subcpu, INPUT_LINE_NMI);
screen.set_palette(m_palette); screen.set_palette(m_palette);
GFXDECODE(config, "gfxdecode", m_palette, gfx_thedealr);
PALETTE(config, m_palette, FUNC(thedealr_state::thedealr_palette), 512); PALETTE(config, m_palette, FUNC(thedealr_state::thedealr_palette), 512);
// sound hardware // sound hardware

View File

@ -1544,8 +1544,7 @@ void tnzs_base_state::tnzs_base(machine_config &config)
config.set_perfect_quantum(m_maincpu); config.set_perfect_quantum(m_maincpu);
/* video hardware */ /* video hardware */
SETA001_SPRITE(config, m_seta001, 0); SETA001_SPRITE(config, m_seta001, 12'000'000, m_palette, gfx_tnzs);
m_seta001->set_gfxdecode_tag("gfxdecode");
SCREEN(config, m_screen, SCREEN_TYPE_RASTER); SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60); m_screen->set_refresh_hz(60);
@ -1556,7 +1555,6 @@ void tnzs_base_state::tnzs_base(machine_config &config)
m_screen->screen_vblank().set(FUNC(tnzs_base_state::screen_vblank_tnzs)); m_screen->screen_vblank().set(FUNC(tnzs_base_state::screen_vblank_tnzs));
m_screen->set_palette(m_palette); m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tnzs);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 512); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 512);
/* sound hardware */ /* sound hardware */
@ -1628,7 +1626,7 @@ void insectx_state::insectx(machine_config &config)
m_subcpu->set_addrmap(AS_PROGRAM, &insectx_state::insectx_sub_map); m_subcpu->set_addrmap(AS_PROGRAM, &insectx_state::insectx_sub_map);
/* video hardware */ /* video hardware */
m_gfxdecode->set_info(gfx_insectx); m_seta001->set_info(gfx_insectx);
/* sound hardware */ /* sound hardware */
ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(12'000'000)/4)); /* verified on pcb */ ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(12'000'000)/4)); /* verified on pcb */

View File

@ -21,6 +21,7 @@
#include "machine/upd4992.h" #include "machine/upd4992.h"
#include "sound/x1_010.h" #include "sound/x1_010.h"
#include "video/seta001.h" #include "video/seta001.h"
#include "video/x1_012.h"
#include "emupal.h" #include "emupal.h"
#include "tilemap.h" #include "tilemap.h"
@ -50,6 +51,7 @@ public:
m_audiocpu(*this, "audiocpu"), m_audiocpu(*this, "audiocpu"),
m_subcpu(*this,"sub"), m_subcpu(*this,"sub"),
m_seta001(*this, "spritegen"), m_seta001(*this, "spritegen"),
m_layers(*this, "layer%u", 1U),
m_x1(*this, "x1snd"), m_x1(*this, "x1snd"),
m_soundlatch(*this, "soundlatch%u", 1U), m_soundlatch(*this, "soundlatch%u", 1U),
m_dsw(*this, "DSW"), m_dsw(*this, "DSW"),
@ -59,13 +61,10 @@ public:
m_coins(*this, "COINS"), m_coins(*this, "COINS"),
m_extra_port(*this, "EXTRA"), m_extra_port(*this, "EXTRA"),
m_sharedram(*this,"sharedram"), m_sharedram(*this,"sharedram"),
m_vram(*this,"vram_%u", 0U),
m_vctrl(*this,"vctrl_%u", 0U),
m_paletteram(*this,"paletteram%u", 1U), m_paletteram(*this,"paletteram%u", 1U),
m_subbank(*this,"subbank"), m_subbank(*this,"subbank"),
m_x1_bank(*this,"x1_bank"), m_x1_bank(*this,"x1_bank"),
m_leds(*this, "led%u", 0U), m_leds(*this, "led%u", 0U),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") m_palette(*this, "palette")
{ } { }
@ -136,6 +135,7 @@ protected:
optional_device<cpu_device> m_audiocpu; optional_device<cpu_device> m_audiocpu;
optional_device<cpu_device> m_subcpu; optional_device<cpu_device> m_subcpu;
required_device<seta001_device> m_seta001; required_device<seta001_device> m_seta001;
optional_device_array<x1_012_device, 2> m_layers;
optional_device<x1_010_device> m_x1; optional_device<x1_010_device> m_x1;
optional_device_array<generic_latch_8_device, 2> m_soundlatch; optional_device_array<generic_latch_8_device, 2> m_soundlatch;
@ -147,8 +147,6 @@ protected:
optional_ioport m_extra_port; optional_ioport m_extra_port;
optional_shared_ptr<u8> m_sharedram; optional_shared_ptr<u8> m_sharedram;
optional_shared_ptr_array<u16, 2> m_vram;
optional_shared_ptr_array<u16, 2> m_vctrl;
optional_shared_ptr_array<u16, 2> m_paletteram; optional_shared_ptr_array<u16, 2> m_paletteram;
optional_memory_bank m_subbank; optional_memory_bank m_subbank;
@ -156,18 +154,12 @@ protected:
output_finder<48> m_leds; output_finder<48> m_leds;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette; required_device<palette_device> m_palette;
u8 m_vregs; u8 m_vregs;
int m_tiles_offset;
tilemap_t *m_tilemap[2]; // Max 2 Layers
int m_rambank[2]; // 2 Tilemap banks for each layers
int m_tilemaps_flip; int m_tilemaps_flip;
int m_samples_bank; int m_samples_bank;
int m_color_mode_shift;
int m_current_tilemap_mode[2];
uPD71054_state m_uPD71054; uPD71054_state m_uPD71054;
const game_offset *m_global_offsets; const game_offset *m_global_offsets;
@ -191,7 +183,6 @@ protected:
void seta_coin_counter_w(u8 data); void seta_coin_counter_w(u8 data);
void seta_coin_lockout_w(u8 data); void seta_coin_lockout_w(u8 data);
void seta_vregs_w(u8 data); void seta_vregs_w(u8 data);
template<int Layer> void vram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void twineagl_tilebank_w(offs_t offset, u8 data); void twineagl_tilebank_w(offs_t offset, u8 data);
void timer_regs_w(offs_t offset, u16 data); void timer_regs_w(offs_t offset, u16 data);
u8 sharedram_68000_r(offs_t offset); u8 sharedram_68000_r(offs_t offset);
@ -227,15 +218,11 @@ protected:
u8 dsw2_r(); u8 dsw2_r();
u16 extra_r(); u16 extra_r();
TILE_GET_INFO_MEMBER(twineagl_get_tile_info); DECLARE_VIDEO_START(seta);
template<int Layer> TILE_GET_INFO_MEMBER(get_tile_info); DECLARE_VIDEO_START(kyustrkr);
DECLARE_VIDEO_START(seta_no_layers);
DECLARE_VIDEO_START(kyustrkr_no_layers);
DECLARE_VIDEO_START(twineagl_1_layer);
DECLARE_VIDEO_START(seta_1_layer);
DECLARE_MACHINE_RESET(calibr50); DECLARE_MACHINE_RESET(calibr50);
u16 twineagl_tile_offset(u16 code);
DECLARE_VIDEO_START(seta_2_layers);
void blandia_palette(palette_device &palette) const; void blandia_palette(palette_device &palette) const;
void zingzip_palette(palette_device &palette) const; void zingzip_palette(palette_device &palette) const;
DECLARE_MACHINE_START(wrofaero); DECLARE_MACHINE_START(wrofaero);
@ -243,7 +230,7 @@ protected:
void jjsquawk_palette(palette_device &palette) const; void jjsquawk_palette(palette_device &palette) const;
DECLARE_MACHINE_START(keroppi); DECLARE_MACHINE_START(keroppi);
DECLARE_MACHINE_START(magspeed); DECLARE_MACHINE_START(magspeed);
DECLARE_VIDEO_START(oisipuzl_2_layers); DECLARE_VIDEO_START(oisipuzl);
u32 screen_update_seta_no_layers(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); u32 screen_update_seta_no_layers(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_seta(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); u32 screen_update_seta(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@ -266,7 +253,6 @@ protected:
TIMER_DEVICE_CALLBACK_MEMBER(crazyfgt_interrupt); TIMER_DEVICE_CALLBACK_MEMBER(crazyfgt_interrupt);
void set_pens(); void set_pens();
void draw_tilemap_palette_effect(bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *tilemap, int scrollx, int scrolly, int gfxnum, int flipscreen);
void seta_layers_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int sprite_bank_size); void seta_layers_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int sprite_bank_size);
void uPD71054_timer_init(); void uPD71054_timer_init();
DECLARE_WRITE_LINE_MEMBER(pit_out0); DECLARE_WRITE_LINE_MEMBER(pit_out0);
@ -327,7 +313,9 @@ public:
m_upd4701(*this, "upd4701"), m_upd4701(*this, "upd4701"),
m_buttonmux(*this, "buttonmux"), m_buttonmux(*this, "buttonmux"),
m_track_x(*this, "TRACK%u_X", 1U), m_track_x(*this, "TRACK%u_X", 1U),
m_track_y(*this, "TRACK%u_Y", 1U) m_track_y(*this, "TRACK%u_Y", 1U),
m_port_select(0),
m_tiles_offset(0)
{ } { }
void usclssic(machine_config &config); void usclssic(machine_config &config);
@ -344,6 +332,7 @@ private:
void usclssic_palette(palette_device &palette) const; void usclssic_palette(palette_device &palette) const;
u16 tile_offset(u16 code);
u32 screen_update_usclssic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); u32 screen_update_usclssic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void usclssic_set_pens(); void usclssic_set_pens();
@ -356,6 +345,7 @@ private:
required_ioport_array<2> m_track_y; required_ioport_array<2> m_track_y;
u8 m_port_select; u8 m_port_select;
u16 m_tiles_offset;
}; };
class kiwame_state : public seta_state class kiwame_state : public seta_state
@ -453,7 +443,7 @@ private:
DECLARE_MACHINE_START(setaroul); DECLARE_MACHINE_START(setaroul);
DECLARE_MACHINE_RESET(setaroul); DECLARE_MACHINE_RESET(setaroul);
DECLARE_VIDEO_START(setaroul_1_layer); DECLARE_VIDEO_START(setaroul);
void setaroul_palette(palette_device &palette) const; void setaroul_palette(palette_device &palette) const;
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@ -518,7 +508,7 @@ private:
DECLARE_MACHINE_START(jockeyc); DECLARE_MACHINE_START(jockeyc);
DECLARE_MACHINE_START(inttoote); DECLARE_MACHINE_START(inttoote);
DECLARE_VIDEO_START(jockeyc_1_layer); DECLARE_VIDEO_START(jockeyc);
TIMER_DEVICE_CALLBACK_MEMBER(interrupt); TIMER_DEVICE_CALLBACK_MEMBER(interrupt);

View File

@ -25,7 +25,6 @@ public:
, m_subcpu(*this, "sub") , m_subcpu(*this, "sub")
, m_seta001(*this, "spritegen") , m_seta001(*this, "spritegen")
, m_palette(*this, "palette") , m_palette(*this, "palette")
, m_gfxdecode(*this, "gfxdecode")
, m_screen(*this, "screen") , m_screen(*this, "screen")
, m_mainbank(*this, "mainbank") , m_mainbank(*this, "mainbank")
, m_subbank(*this, "subbank") , m_subbank(*this, "subbank")
@ -52,9 +51,8 @@ protected:
/* devices */ /* devices */
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_subcpu; optional_device<cpu_device> m_subcpu;
optional_device<seta001_device> m_seta001; required_device<seta001_device> m_seta001;
required_device<palette_device> m_palette; required_device<palette_device> m_palette;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen; required_device<screen_device> m_screen;
optional_device<address_map_bank_device> m_mainbank; /* FIXME: optional because of reuse from cchance.cpp */ optional_device<address_map_bank_device> m_mainbank; /* FIXME: optional because of reuse from cchance.cpp */
optional_memory_bank m_subbank; /* FIXME: optional because of reuse from cchance.cpp */ optional_memory_bank m_subbank; /* FIXME: optional because of reuse from cchance.cpp */

View File

@ -299,135 +299,54 @@ Offset + 0x4:
***************************************************************************/ ***************************************************************************/
TILE_GET_INFO_MEMBER(seta_state::twineagl_get_tile_info)
{
const u16 *vram = &m_vram[0][m_rambank[0] ? 0x1000 : 0];
u16 code = vram[tile_index];
const u16 attr = vram[tile_index + 0x800];
if ((code & 0x3e00) == 0x3e00)
code = (code & 0xc07f) | ((m_twineagl_tilebank[(code & 0x0180) >> 7] >> 1) << 7);
tileinfo.set(1, (code & 0x3fff), attr & 0x1f, TILE_FLIPXY((code & 0xc000) >> 14));
}
template<int Layer>
TILE_GET_INFO_MEMBER(seta_state::get_tile_info)
{
int gfx = 1 + Layer;
const u16 *vram = &m_vram[Layer][m_rambank[Layer] ? 0x1000 : 0];
const u16 *vctrl = m_vctrl[Layer];
const u16 code = vram[tile_index];
const u16 attr = vram[tile_index + 0x800];
if (m_gfxdecode->gfx(gfx + ((vctrl[4/2] & 0x10) >> m_color_mode_shift)) != nullptr)
{
gfx += (vctrl[4/2] & 0x10) >> m_color_mode_shift;
}
else
{
popmessage("Missing Color Mode = 1 for Layer = %d. Contact MAMETesters.", Layer);
}
tileinfo.set(gfx, m_tiles_offset + (code & 0x3fff), attr & 0x1f, TILE_FLIPXY((code & 0xc000) >> 14));
}
void seta_state::twineagl_tilebank_w(offs_t offset, u8 data) void seta_state::twineagl_tilebank_w(offs_t offset, u8 data)
{ {
if (m_twineagl_tilebank[offset] != data) if (m_twineagl_tilebank[offset] != data)
{ {
m_twineagl_tilebank[offset] = data; m_twineagl_tilebank[offset] = data;
machine().tilemap().mark_all_dirty(); m_layers[0]->mark_all_dirty();
} }
} }
u16 seta_state::twineagl_tile_offset(u16 code)
/* 2 layers */
VIDEO_START_MEMBER(seta_state,seta_2_layers)
{ {
VIDEO_START_CALL_MEMBER(seta_no_layers); if ((code & 0x3e00) == 0x3e00)
return (code & 0x007f) | ((m_twineagl_tilebank[(code & 0x0180) >> 7] >> 1) << 7);
/* Each layer consists of 2 tilemaps: only one can be displayed else
at any given time */ return code;
/* layer 0 */
m_tilemap[0] = &machine().tilemap().create(
*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(seta_state::get_tile_info<0>)), TILEMAP_SCAN_ROWS,
16, 16, 64, 32);
/* layer 1 */
m_tilemap[1] = &machine().tilemap().create(
*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(seta_state::get_tile_info<1>)), TILEMAP_SCAN_ROWS,
16, 16, 64, 32);
m_tilemaps_flip = 0;
m_color_mode_shift = 3;
for (int layer = 0; layer < 2; layer++)
{
m_tilemap[layer]->set_transparent_pen(0);
}
} }
VIDEO_START_MEMBER(seta_state,oisipuzl_2_layers) u16 usclssic_state::tile_offset(u16 code)
{ {
VIDEO_START_CALL_MEMBER(seta_2_layers); return m_tiles_offset + code;
}
VIDEO_START_MEMBER(seta_state,oisipuzl)
{
VIDEO_START_CALL_MEMBER(seta);
m_tilemaps_flip = 1; m_tilemaps_flip = 1;
// position kludges // position kludges
m_seta001->set_fg_yoffsets(-0x12, 0x0e); m_seta001->set_fg_yoffsets(-0x12, 0x0e);
} }
VIDEO_START_MEMBER(setaroul_state,setaroul)
/* 1 layer */
VIDEO_START_MEMBER(seta_state,seta_1_layer)
{ {
VIDEO_START_CALL_MEMBER(seta_no_layers); VIDEO_START_CALL_MEMBER(seta);
/* Each layer consists of 2 tilemaps: only one can be displayed
at any given time */
/* layer 0 */
m_tilemap[0] = &machine().tilemap().create(
*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(seta_state::get_tile_info<0>)), TILEMAP_SCAN_ROWS,
16, 16, 64, 32);
m_color_mode_shift = 4;
m_tilemap[0]->set_transparent_pen(0);
}
VIDEO_START_MEMBER(setaroul_state,setaroul_1_layer)
{
VIDEO_START_CALL_MEMBER(seta_1_layer);
// position kludges // position kludges
m_seta001->set_bg_yoffsets(0, -0x1); m_seta001->set_bg_yoffsets(0, -0x1);
m_seta001->set_bg_xoffsets(0, 0x2); m_seta001->set_bg_xoffsets(0, 0x2);
} }
VIDEO_START_MEMBER(jockeyc_state,jockeyc_1_layer) VIDEO_START_MEMBER(jockeyc_state,jockeyc)
{ {
VIDEO_START_CALL_MEMBER(seta_1_layer); VIDEO_START_CALL_MEMBER(seta);
// position kludges // position kludges
m_seta001->set_fg_yoffsets(-0x12+8, 0x0e); m_seta001->set_fg_yoffsets(-0x12+8, 0x0e);
} }
VIDEO_START_MEMBER(seta_state,twineagl_1_layer)
{
VIDEO_START_CALL_MEMBER(seta_no_layers);
/* Each layer consists of 2 tilemaps: only one can be displayed
at any given time */
/* layer 0 */
m_tilemap[0] = &machine().tilemap().create(
*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(seta_state::twineagl_get_tile_info)), TILEMAP_SCAN_ROWS,
16, 16, 64, 32);
m_tilemap[0]->set_transparent_pen(0);
}
SETA001_SPRITE_GFXBANK_CB_MEMBER(seta_state::setac_gfxbank_callback) SETA001_SPRITE_GFXBANK_CB_MEMBER(seta_state::setac_gfxbank_callback)
{ {
const int bank = (color & 0x06) >> 1; const int bank = (color & 0x06) >> 1;
@ -436,12 +355,8 @@ SETA001_SPRITE_GFXBANK_CB_MEMBER(seta_state::setac_gfxbank_callback)
return code; return code;
} }
/* NO layers, only sprites */ VIDEO_START_MEMBER(seta_state,seta)
VIDEO_START_MEMBER(seta_state,seta_no_layers)
{ {
m_tilemap[0] = nullptr;
m_tilemap[1] = nullptr;
m_tilemaps_flip = 0; m_tilemaps_flip = 0;
m_global_offsets = game_offsets; m_global_offsets = game_offsets;
@ -455,15 +370,14 @@ VIDEO_START_MEMBER(seta_state,seta_no_layers)
m_seta001->set_fg_xoffsets(m_global_offsets->sprite_offs[1], m_global_offsets->sprite_offs[0]); m_seta001->set_fg_xoffsets(m_global_offsets->sprite_offs[1], m_global_offsets->sprite_offs[0]);
m_seta001->set_fg_yoffsets(-0x12, 0x0e); m_seta001->set_fg_yoffsets(-0x12, 0x0e);
m_seta001->set_bg_yoffsets(0x1, -0x1); m_seta001->set_bg_yoffsets(0x1, -0x1);
save_item(NAME(m_rambank));
m_vregs = 0; m_vregs = 0;
save_item(NAME(m_vregs)); save_item(NAME(m_vregs));
} }
VIDEO_START_MEMBER(seta_state,kyustrkr_no_layers) VIDEO_START_MEMBER(seta_state,kyustrkr)
{ {
VIDEO_START_CALL_MEMBER(seta_no_layers); VIDEO_START_CALL_MEMBER(seta);
// position kludges // position kludges
m_seta001->set_fg_yoffsets(-0x0a, 0x0e); m_seta001->set_fg_yoffsets(-0x0a, 0x0e);
@ -569,8 +483,8 @@ void seta_state::palette_init_RRRRRGGGGGBBBBB_proms(palette_device &palette) con
void setaroul_state::setaroul_palette(palette_device &palette) const void setaroul_state::setaroul_palette(palette_device &palette) const
{ {
m_gfxdecode->gfx(0)->set_granularity(16); m_seta001->gfx(0)->set_granularity(16);
m_gfxdecode->gfx(1)->set_granularity(16); m_layers[0]->gfx(0)->set_granularity(16);
palette_init_RRRRRGGGGGBBBBB_proms(palette); palette_init_RRRRRGGGGGBBBBB_proms(palette);
} }
@ -649,50 +563,6 @@ void usclssic_state::usclssic_set_pens()
} }
void seta_state::draw_tilemap_palette_effect(bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *tilemap, int scrollx, int scrolly, int gfxnum, int flipscreen)
{
gfx_element *gfx_tilemap = m_gfxdecode->gfx(gfxnum);
const bitmap_ind16 &src_bitmap = tilemap->pixmap();
const int opaque_mask = gfx_tilemap->granularity() - 1;
const int pixel_effect_mask = gfx_tilemap->colorbase() + (gfx_tilemap->colors() - 1) * gfx_tilemap->granularity();
const int width_mask = src_bitmap.width() - 1;
const int height_mask = src_bitmap.height() - 1;
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
{
u16 *const dest = &bitmap.pix(y);
for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
{
int p;
if (!flipscreen)
{
p = src_bitmap.pix((y + scrolly) & height_mask, (x + scrollx) & width_mask);
}
else
{
p = src_bitmap.pix((y - scrolly - 256) & height_mask, (x - scrollx - 512) & width_mask);
}
// draw not transparent pixels
if (p & opaque_mask)
{
// pixels with the last color are not drawn and the 2nd palette is added to the current bitmap color
if ((p & pixel_effect_mask) == pixel_effect_mask)
{
dest[x] = m_palette->entries() / 2 + dest[x];
}
else
{
dest[x] = m_palette->pen(p);
}
}
}
}
}
/*************************************************************************** /***************************************************************************
@ -719,40 +589,16 @@ void seta_state::seta_layers_update(screen_device &screen, bitmap_ind16 &bitmap,
const rectangle &visarea = screen.visible_area(); const rectangle &visarea = screen.visible_area();
const int vis_dimy = visarea.max_y - visarea.min_y + 1; const int vis_dimy = visarea.max_y - visarea.min_y + 1;
// check tilemaps color modes
for (int layer = 0; layer < 2; layer++)
{
if (m_tilemap[layer])
{
if (m_current_tilemap_mode[layer] != (m_vctrl[layer][4/2] & 0x10))
{
m_current_tilemap_mode[layer] = m_vctrl[layer][4/2] & 0x10;
m_tilemap[layer]->mark_all_dirty();
}
}
}
const int flip = m_seta001->is_flipped() ^ m_tilemaps_flip; const int flip = m_seta001->is_flipped() ^ m_tilemaps_flip;
machine().tilemap().set_flip_all(flip ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); for (int layer = 0; layer < 2; layer++)
if (m_layers[layer].found())
m_layers[layer]->set_flip(flip ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
int bank[2]{ 0, 0 }, x[2]{ 0, 0 }, y[2]{ 0, 0 }; int x[2]{ 0, 0 }, y[2]{ 0, 0 };
for (int layer = 0; layer < 2; layer++) for (int layer = 0; layer < 2; layer++)
{ {
if (m_tilemap[layer]) if (m_layers[layer].found())
{ {
x[layer] = m_vctrl[layer][0/2];
y[layer] = m_vctrl[layer][2/2];
bank[layer] = m_vctrl[layer][4/2];
bank[layer] = (bank[layer] & 0x0008) ? 1 : 0; /*&& (bank[layer] & 0x0001)*/
/* Select tilemap bank, Only one tilemap bank per layer is enabled */
if (m_rambank[layer] != bank[layer])
{
m_rambank[layer] = bank[layer];
m_tilemap[layer]->mark_all_dirty();
}
/* the hardware wants different scroll values when flipped */ /* the hardware wants different scroll values when flipped */
/* bg x scroll flip /* bg x scroll flip
@ -761,16 +607,7 @@ void seta_state::seta_layers_update(screen_device &screen, bitmap_ind16 &bitmap,
fff0 0260 = -$10, $400-$190 -$10 fff0 0260 = -$10, $400-$190 -$10
ffe8 0272 = -$18, $400-$190 -$18 + $1a */ ffe8 0272 = -$18, $400-$190 -$18 + $1a */
x[layer] += 0x10 - m_global_offsets->tilemap_offs[flip ? 1 : 0]; m_layers[layer]->update_scroll(m_global_offsets->tilemap_offs[flip ? 1 : 0], vis_dimy, flip);
y[layer] -= (256 - vis_dimy)/2;
if (flip)
{
x[layer] = -x[layer] - 512;
y[layer] = y[layer] - vis_dimy;
}
m_tilemap[layer]->set_scrollx(0, x[layer]);
m_tilemap[layer]->set_scrolly(0, y[layer]);
} }
else else
{ {
@ -788,21 +625,22 @@ void seta_state::seta_layers_update(screen_device &screen, bitmap_ind16 &bitmap,
if (screen.machine().input().code_pressed(KEYCODE_A)) msk |= 8; if (screen.machine().input().code_pressed(KEYCODE_A)) msk |= 8;
if (msk != 0) layers_ctrl &= msk; if (msk != 0) layers_ctrl &= msk;
if (m_tilemap[1]) if (m_layers[1].found())
popmessage("VR:%02X L0:%04X L1:%04X", popmessage("VR:%02X L0:%04X L1:%04X",
m_vregs, m_vctrl[0][4/2], m_vctrl[1][4/2]); m_vregs, m_layers[0]->vctrl(2), m_layers[1]->vctrl(2));
else if (m_tilemap[0]) popmessage("L0:%04X", m_vctrl[0][4/2]); else if (m_layers[0].found())
popmessage("L0:%04X", m_layers[0]->vctrl(2));
} }
#endif #endif
bitmap.fill(0, cliprect); bitmap.fill(0, cliprect);
const int order = m_tilemap[1] ? m_vregs : 0; const int order = m_layers[1].found() ? m_vregs : 0;
if (order & 1) // swap the layers? if (order & 1) // swap the layers?
{ {
if (m_tilemap[1]) if (m_layers[1].found())
{ {
if (layers_ctrl & 2) m_tilemap[1]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); if (layers_ctrl & 2) m_layers[1]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
} }
if (order & 2) // layer-sprite priority? if (order & 2) // layer-sprite priority?
@ -814,7 +652,7 @@ void seta_state::seta_layers_update(screen_device &screen, bitmap_ind16 &bitmap,
popmessage("Missing palette effect. Contact MAMETesters."); popmessage("Missing palette effect. Contact MAMETesters.");
} }
if (layers_ctrl & 1) m_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0); if (layers_ctrl & 1) m_layers[0]->draw(screen, bitmap, cliprect, 0, 0);
} }
else else
{ {
@ -823,14 +661,14 @@ void seta_state::seta_layers_update(screen_device &screen, bitmap_ind16 &bitmap,
popmessage("Missing palette effect. Contact MAMETesters."); popmessage("Missing palette effect. Contact MAMETesters.");
} }
if (layers_ctrl & 1) m_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0); if (layers_ctrl & 1) m_layers[0]->draw(screen, bitmap, cliprect, 0, 0);
if (layers_ctrl & 8) m_seta001->draw_sprites(screen, bitmap,cliprect,sprite_bank_size); if (layers_ctrl & 8) m_seta001->draw_sprites(screen, bitmap,cliprect,sprite_bank_size);
} }
} }
else else
{ {
if (layers_ctrl & 1) m_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); if (layers_ctrl & 1) m_layers[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
if (order & 2) // layer-sprite priority? if (order & 2) // layer-sprite priority?
{ {
@ -838,7 +676,7 @@ void seta_state::seta_layers_update(screen_device &screen, bitmap_ind16 &bitmap,
if ((order & 4) && m_paletteram[1] != nullptr) if ((order & 4) && m_paletteram[1] != nullptr)
{ {
draw_tilemap_palette_effect(bitmap, cliprect, m_tilemap[1], x[1], y[1], 2 + ((m_vctrl[1][4/2] & 0x10) >> m_color_mode_shift), flip); m_layers[1]->draw_tilemap_palette_effect(bitmap, cliprect, flip);
} }
else else
{ {
@ -847,9 +685,9 @@ void seta_state::seta_layers_update(screen_device &screen, bitmap_ind16 &bitmap,
popmessage("Missing palette effect. Contact MAMETesters."); popmessage("Missing palette effect. Contact MAMETesters.");
} }
if (m_tilemap[1]) if (m_layers[1].found())
{ {
if (layers_ctrl & 2) m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); if (layers_ctrl & 2) m_layers[1]->draw(screen, bitmap, cliprect, 0, 0);
} }
} }
} }
@ -857,7 +695,7 @@ void seta_state::seta_layers_update(screen_device &screen, bitmap_ind16 &bitmap,
{ {
if ((order & 4) && m_paletteram[1] != nullptr) if ((order & 4) && m_paletteram[1] != nullptr)
{ {
draw_tilemap_palette_effect(bitmap, cliprect, m_tilemap[1], x[1], y[1], 2 + ((m_vctrl[1][4/2] & 0x10) >> m_color_mode_shift), flip); m_layers[1]->draw_tilemap_palette_effect(bitmap, cliprect, flip);
} }
else else
{ {
@ -866,9 +704,9 @@ void seta_state::seta_layers_update(screen_device &screen, bitmap_ind16 &bitmap,
popmessage("Missing palette effect. Contact MAMETesters."); popmessage("Missing palette effect. Contact MAMETesters.");
} }
if (m_tilemap[1]) if (m_layers[1].found())
{ {
if (layers_ctrl & 2) m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); if (layers_ctrl & 2) m_layers[1]->draw(screen, bitmap, cliprect, 0, 0);
} }
} }

View File

@ -30,6 +30,8 @@
appear to have 0x800 bytes of RAM that isn't connected to the sprite chip appear to have 0x800 bytes of RAM that isn't connected to the sprite chip
between the banks. between the banks.
This should implement device_video_interface, since it generates the vertical
and horizontal blanking and sync signals from a master clock.
*/ */
#include "emu.h" #include "emu.h"
@ -41,7 +43,7 @@ DEFINE_DEVICE_TYPE(SETA001_SPRITE, seta001_device, "seta001", "Seta SETA001 Spri
seta001_device::seta001_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) seta001_device::seta001_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, SETA001_SPRITE, tag, owner, clock) : device_t(mconfig, SETA001_SPRITE, tag, owner, clock)
, m_gfxdecode(*this, finder_base::DUMMY_TAG) , device_gfx_interface(mconfig, *this)
, m_gfxbank_cb(*this) , m_gfxbank_cb(*this)
{ {
} }
@ -251,7 +253,7 @@ void seta001_device::draw_background( bitmap_ind16 &bitmap, const rectangle &cli
int offs, col; int offs, col;
int xoffs, yoffs; int xoffs, yoffs;
int const total_color_codes = m_gfxdecode->gfx(0)->colors(); int const total_color_codes = gfx(0)->colors();
int const ctrl = m_spritectrl[0]; int const ctrl = m_spritectrl[0];
int const ctrl2 = m_spritectrl[1]; int const ctrl2 = m_spritectrl[1];
@ -322,28 +324,28 @@ void seta001_device::draw_background( bitmap_ind16 &bitmap, const rectangle &cli
color = ( color >> (16-5) ) % total_color_codes; color = ( color >> (16-5) ) % total_color_codes;
code &= 0x3fff; code &= 0x3fff;
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, gfx(0)->transpen(bitmap,cliprect,
code, code,
color, color,
flipx,flipy, flipx,flipy,
((sx) & 0x1ff),((sy) & 0x0ff), ((sx) & 0x1ff),((sy) & 0x0ff),
transpen); transpen);
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, gfx(0)->transpen(bitmap,cliprect,
code, code,
color, color,
flipx,flipy, flipx,flipy,
((sx) & 0x1ff)-512,((sy) & 0x0ff), ((sx) & 0x1ff)-512,((sy) & 0x0ff),
transpen); transpen);
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, gfx(0)->transpen(bitmap,cliprect,
code, code,
color, color,
flipx,flipy, flipx,flipy,
((sx) & 0x1ff),((sy) & 0x0ff)-256, ((sx) & 0x1ff),((sy) & 0x0ff)-256,
transpen); transpen);
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, gfx(0)->transpen(bitmap,cliprect,
code, code,
color, color,
flipx,flipy, flipx,flipy,
@ -362,7 +364,7 @@ void seta001_device::draw_foreground( screen_device &screen, bitmap_ind16 &bitma
int const ctrl2 = m_spritectrl[1]; int const ctrl2 = m_spritectrl[1];
int xoffs, yoffs; int xoffs, yoffs;
int const total_color_codes = m_gfxdecode->gfx(0)->colors(); int const total_color_codes = gfx(0)->colors();
uint8_t *char_pointer = &m_spritecodelow[0x0000]; uint8_t *char_pointer = &m_spritecodelow[0x0000];
uint8_t *x_pointer = &m_spritecodelow[0x0200]; uint8_t *x_pointer = &m_spritecodelow[0x0200];
@ -409,7 +411,7 @@ void seta001_device::draw_foreground( screen_device &screen, bitmap_ind16 &bitma
flipy = !flipy; flipy = !flipy;
} }
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, gfx(0)->transpen(bitmap,cliprect,
code, code,
color, color,
flipx,flipy, flipx,flipy,
@ -417,7 +419,7 @@ void seta001_device::draw_foreground( screen_device &screen, bitmap_ind16 &bitma
max_y - ((sy + yoffs) & 0x0ff),m_transpen); max_y - ((sy + yoffs) & 0x0ff),m_transpen);
/* wrap around x */ /* wrap around x */
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, gfx(0)->transpen(bitmap,cliprect,
code, code,
color, color,
flipx,flipy, flipx,flipy,
@ -425,7 +427,7 @@ void seta001_device::draw_foreground( screen_device &screen, bitmap_ind16 &bitma
max_y - ((sy + yoffs) & 0x0ff),m_transpen); max_y - ((sy + yoffs) & 0x0ff),m_transpen);
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, gfx(0)->transpen(bitmap,cliprect,
code, code,
color, color,
flipx,flipy, flipx,flipy,
@ -433,7 +435,7 @@ void seta001_device::draw_foreground( screen_device &screen, bitmap_ind16 &bitma
max_y - ((sy + yoffs) & 0x0ff)-256,m_transpen); max_y - ((sy + yoffs) & 0x0ff)-256,m_transpen);
/* wrap around x */ /* wrap around x */
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, gfx(0)->transpen(bitmap,cliprect,
code, code,
color, color,
flipx,flipy, flipx,flipy,

View File

@ -9,13 +9,18 @@ typedef device_delegate<int (uint16_t code, uint8_t color)> gfxbank_cb_delegate;
#define SETA001_SPRITE_GFXBANK_CB_MEMBER(_name) int _name(uint16_t code, uint8_t color) #define SETA001_SPRITE_GFXBANK_CB_MEMBER(_name) int _name(uint16_t code, uint8_t color)
class seta001_device : public device_t class seta001_device : public device_t, public device_gfx_interface
{ {
public: public:
seta001_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); seta001_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
template <typename T> seta001_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&palette_tag, const gfx_decode_entry *gfxinfo)
: seta001_device(mconfig, tag, owner, clock)
{
set_info(gfxinfo);
set_palette(std::forward<T>(palette_tag));
}
// configuration // configuration
template <typename T> void set_gfxdecode_tag(T &&tag) { m_gfxdecode.set_tag(std::forward<T>(tag)); }
template <typename... T> void set_gfxbank_callback(T &&... args) { m_gfxbank_cb.set(std::forward<T>(args)...); } template <typename... T> void set_gfxbank_callback(T &&... args) { m_gfxbank_cb.set(std::forward<T>(args)...); }
void spritebgflag_w8(uint8_t data); void spritebgflag_w8(uint8_t data);
@ -61,7 +66,6 @@ protected:
private: private:
void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_size); void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_size);
void draw_foreground(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_size); void draw_foreground(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_size);
required_device<gfxdecode_device> m_gfxdecode;
gfxbank_cb_delegate m_gfxbank_cb; gfxbank_cb_delegate m_gfxbank_cb;

172
src/mame/video/x1_012.cpp Normal file
View File

@ -0,0 +1,172 @@
// license:BSD-3-Clause
// copyright-holders:Luca Elia
/***************************************************************************
Seta (or Allumer) X1-012 (+ X1-011) tile layer generator
Each layer consists of 2 tilemaps: only one can be displayed
at any given time.
***************************************************************************/
#include "emu.h"
#include "x1_012.h"
DEFINE_DEVICE_TYPE(X1_012, x1_012_device, "x1_012", "Seta X1-012 Tile Layer")
x1_012_device::x1_012_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, X1_012, tag, owner, clock)
, device_gfx_interface(mconfig, *this)
, m_tile_offset_callback(*this)
, m_vram(*this, DEVICE_SELF)
, m_tilemap(nullptr)
, m_rambank(0)
{
std::fill(std::begin(m_vctrl), std::end(m_vctrl), 0);
}
TILE_GET_INFO_MEMBER(x1_012_device::get_tile_info)
{
const u16 *const vram = &m_vram[m_rambank ? 0x1000 : 0];
u16 code = vram[tile_index] & 0x3fff;
const u16 flip = TILE_FLIPXY((vram[tile_index] & 0xc000) >> 14);
const u16 attr = vram[tile_index + 0x800];
int gfx = (m_vctrl[2] & 0x10) >> 4;
if (gfx == 1 && this->gfx(1) == nullptr)
{
popmessage("Missing Color Mode = 1 for Layer = %s. Contact MAMETesters.", tag());
gfx = 0;
}
if (!m_tile_offset_callback.isnull())
code = m_tile_offset_callback(code);
tileinfo.set(gfx, code, attr & 0x1f, flip);
}
void x1_012_device::device_resolve_objects()
{
m_tile_offset_callback.resolve();
}
void x1_012_device::device_start()
{
m_tilemap = &machine().tilemap().create(
*this, tilemap_get_info_delegate(*this, FUNC(x1_012_device::get_tile_info)), TILEMAP_SCAN_ROWS,
16, 16, 64, 32);
m_tilemap->set_transparent_pen(0);
save_item(NAME(m_vctrl));
save_item(NAME(m_rambank));
}
void x1_012_device::vram_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_vram[offset]);
if (m_rambank == ((offset >> 12) & 1))
m_tilemap->mark_tile_dirty(offset & 0x7ff);
}
u16 x1_012_device::vctrl_r(offs_t offset, u16 mem_mask)
{
return m_vctrl[offset];
}
void x1_012_device::vctrl_w(offs_t offset, u16 data, u16 mem_mask)
{
// Select tilemap bank. Only one tilemap bank per layer is enabled.
if (offset == 2 && ACCESSING_BITS_0_7)
{
if ((data & 0x0008) != (m_vctrl[2] & 0x0008))
{
m_rambank = (data & 0x0008) ? 1 : 0;
m_tilemap->mark_all_dirty();
}
// Check tilemap color mode
if ((data & 0x0010) != (m_vctrl[2] & 0x0010))
m_tilemap->mark_all_dirty();
}
COMBINE_DATA(&m_vctrl[offset]);
}
void x1_012_device::update_scroll(int xoffset, int vis_dimy, bool flip)
{
int x = m_vctrl[0];
int y = m_vctrl[1];
/* the hardware wants different scroll values when flipped */
/* bg x scroll flip
metafox 0000 025d = 0, $400-$1a3 = $400 - $190 - $13
eightfrc ffe8 0272
fff0 0260 = -$10, $400-$190 -$10
ffe8 0272 = -$18, $400-$190 -$18 + $1a */
x += 0x10 - xoffset;
y -= (256 - vis_dimy)/2;
if (flip)
{
x = -x - 512;
y = y - vis_dimy;
}
m_tilemap->set_scrollx(0, x);
m_tilemap->set_scrolly(0, y);
}
void x1_012_device::draw(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, u32 flags, u8 priority, u8 priority_mask)
{
m_tilemap->draw(screen, dest, cliprect, flags, priority, priority_mask);
}
void x1_012_device::draw_tilemap_palette_effect(bitmap_ind16 &bitmap, const rectangle &cliprect, bool flipscreen)
{
const int scrollx = m_tilemap->scrollx(0);
const int scrolly = m_tilemap->scrolly(0);
const gfx_element *const gfx_tilemap = gfx((m_vctrl[2] & 0x10) >> 4);
const bitmap_ind16 &src_bitmap = m_tilemap->pixmap();
const int opaque_mask = gfx_tilemap->granularity() - 1;
const int pixel_effect_mask = gfx_tilemap->colorbase() + (gfx_tilemap->colors() - 1) * gfx_tilemap->granularity();
const int width_mask = src_bitmap.width() - 1;
const int height_mask = src_bitmap.height() - 1;
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
{
u16 *const dest = &bitmap.pix(y);
for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
{
int p;
if (!flipscreen)
{
p = src_bitmap.pix((y + scrolly) & height_mask, (x + scrollx) & width_mask);
}
else
{
p = src_bitmap.pix((y - scrolly - 256) & height_mask, (x - scrollx - 512) & width_mask);
}
// draw not transparent pixels
if (p & opaque_mask)
{
// pixels with the last color are not drawn and the 2nd palette is added to the current bitmap color
if ((p & pixel_effect_mask) == pixel_effect_mask)
{
dest[x] = palette().entries() / 2 + dest[x];
}
else
{
dest[x] = palette().pen(p);
}
}
}
}
}

57
src/mame/video/x1_012.h Normal file
View File

@ -0,0 +1,57 @@
// license:BSD-3-Clause
// copyright-holders:Luca Elia
#ifndef MAME_VIDEO_X1_012_H
#define MAME_VIDEO_X1_012_H
#pragma once
#include "tilemap.h"
class x1_012_device : public device_t, public device_gfx_interface
{
public:
x1_012_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
template <typename T> x1_012_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&palette_tag, const gfx_decode_entry *gfxinfo)
: x1_012_device(mconfig, tag, owner, u32(0))
{
set_info(gfxinfo);
set_palette(std::forward<T>(palette_tag));
}
// configuration
template <typename... T> void set_tile_offset_callback(T &&... args) { m_tile_offset_callback.set(std::forward<T>(args)...); }
void vram_w(offs_t offset, u16 data, u16 mem_mask = 0xffff);
u16 vctrl_r(offs_t offset, u16 mem_mask = 0xffff);
void vctrl_w(offs_t offset, u16 data, u16 mem_mask = 0xffff);
u16 vctrl(int index) const { return m_vctrl[index]; }
void update_scroll(int xoffset, int vis_dimy, bool flip);
void set_flip(u32 flip) { m_tilemap->set_flip(flip); }
void mark_all_dirty() { m_tilemap->mark_all_dirty(); }
void draw(screen_device &screen, bitmap_ind16 &dest, const rectangle &cliprect, u32 flags = TILEMAP_DRAW_ALL_CATEGORIES, u8 priority = 0, u8 priority_mask = 0xff);
void draw_tilemap_palette_effect(bitmap_ind16 &bitmap, const rectangle &cliprect, bool flipscreen);
protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
private:
TILE_GET_INFO_MEMBER(get_tile_info);
device_delegate<u16 (u16 code)> m_tile_offset_callback;
required_shared_ptr<u16> m_vram;
tilemap_t *m_tilemap;
u16 m_vctrl[3];
u8 m_rambank;
};
DECLARE_DEVICE_TYPE(X1_012, x1_012_device)
#endif // MAME_VIDEO_X1_012_H