dataeast/dec8.cpp: Split state classes, reduced run-time tag lookups, and cleaned up code. (#11468)

Also updated code to use abbreviated integer type names.
This commit is contained in:
cam900 2023-08-08 02:18:27 +09:00 committed by GitHub
parent abd8d4d262
commit 013022771b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 701 additions and 630 deletions

View File

@ -217,7 +217,6 @@ private:
void main_map(address_map &map);
void sound_map(address_map &map);
void sound_protection_map(address_map &map);
};

File diff suppressed because it is too large Load Diff

View File

@ -5,52 +5,182 @@
#pragma once
#include "decbac06.h"
#include "deckarn.h"
#include "decmxc06.h"
#include "decrmc3.h"
#include "cpu/mcs51/mcs51.h"
#include "machine/gen_latch.h"
#include "machine/input_merger.h"
#include "sound/msm5205.h"
#include "video/bufsprite.h"
#include "decbac06.h"
#include "deckarn.h"
#include "decmxc06.h"
#include "decrmc3.h"
#include "screen.h"
#include "tilemap.h"
class dec8_state : public driver_device
class dec8_state_base : public driver_device
{
public:
dec8_state(const machine_config &mconfig, device_type type, const char *tag) :
protected:
dec8_state_base(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_subcpu(*this, "sub"),
m_audiocpu(*this, "audiocpu"),
m_mcu(*this, "mcu"),
m_spritegen_krn(*this, "spritegen_krn"),
m_spriteram(*this, "spriteram") ,
m_screen(*this, "screen"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch"),
m_mainbank(*this, "mainbank"),
m_nmigate(*this, "nmigate"),
m_tilegen(*this, "tilegen%u", 1),
m_spritegen_mxc(*this, "spritegen_mxc"),
m_mainbank(*this, "mainbank"),
m_videoram(*this, "videoram"),
m_bg_data(*this, "bg_data"),
m_coin_port(*this, "I8751")
m_bg_ram(*this, "bg_ram")
{ }
void shackled(machine_config &config);
void meikyuh(machine_config &config);
void lastmisn(machine_config &config);
void cobracom(machine_config &config);
void garyoret(machine_config &config);
virtual void machine_start() override;
virtual void machine_reset() override;
TIMER_CALLBACK_MEMBER(audiocpu_nmi_clear);
void buffer_spriteram16_w(u8 data);
void sound_w(u8 data);
void main_irq_on_w(u8 data);
void main_irq_off_w(u8 data);
void main_firq_off_w(u8 data);
void sub_irq_on_w(u8 data);
void sub_irq_off_w(u8 data);
void sub_firq_off_w(u8 data);
void flip_screen_w(u8 data);
void bg_ram_w(offs_t offset, u8 data);
u8 bg_ram_r(offs_t offset);
void videoram_w(offs_t offset, u8 data);
void set_screen_raw_params_data_east(machine_config &config);
void allocate_buffered_spriteram16();
void dec8_s_map(address_map &map);
void oscar_s_map(address_map &map);
/* devices */
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_subcpu;
required_device<cpu_device> m_audiocpu;
required_device<buffered_spriteram8_device> m_spriteram;
required_device<screen_device> m_screen;
required_device<gfxdecode_device> m_gfxdecode;
required_device<deco_rmc3_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
optional_device_array<deco_bac06_device, 2> m_tilegen;
/* memory regions */
required_memory_bank m_mainbank;
/* memory pointers */
required_shared_ptr<u8> m_videoram;
optional_shared_ptr<u8> m_bg_ram;
std::unique_ptr<u16[]> m_buffered_spriteram16; // for the mxc06 sprite chip emulation (oscar, cobra)
/* video-related */
tilemap_t *m_bg_tilemap = nullptr;
tilemap_t *m_fix_tilemap = nullptr;
int m_scroll[4]{};
int m_game_uses_priority = 0;
/* misc */
bool m_coin_state = false;
emu_timer *m_m6502_timer = nullptr;
};
// with I8751 MCU
class dec8_mcu_state_base : public dec8_state_base
{
protected:
dec8_mcu_state_base(const machine_config &mconfig, device_type type, const char *tag) :
dec8_state_base(mconfig, type, tag),
m_mcu(*this, "mcu"),
m_coin_port(*this, "I8751")
{
}
virtual void machine_start() override;
virtual void machine_reset() override;
TIMER_CALLBACK_MEMBER(mcu_irq_clear);
u8 i8751_h_r();
u8 i8751_l_r();
void i8751_w(offs_t offset, u8 data);
u8 i8751_port0_r();
void i8751_port0_w(u8 data);
u8 i8751_port1_r();
void i8751_port1_w(u8 data);
void i8751_reset_w(u8 data);
required_device<i8751_device> m_mcu;
/* ports */
required_ioport m_coin_port;
// MCU communication
u8 m_i8751_p2 = 0;
int m_i8751_port0 = 0;
int m_i8751_port1 = 0;
int m_i8751_return = 0;
int m_i8751_value = 0;
emu_timer *m_i8751_timer = nullptr;
};
// with unique sprite hardware
class srdarwin_state : public dec8_mcu_state_base
{
public:
srdarwin_state(const machine_config &mconfig, device_type type, const char *tag) :
dec8_mcu_state_base(mconfig, type, tag)
{
}
void srdarwin(machine_config &config);
protected:
virtual void video_start() override;
private:
void mcu_to_main_w(u8 data);
void srdarwin_videoram_w(offs_t offset, u8 data);
void control_w(offs_t offset, u8 data);
TILE_GET_INFO_MEMBER(get_fix_tile_info);
TILE_GET_INFO_MEMBER(get_tile_info);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &primap);
void main_map(address_map &map);
};
// with 'karnov' sprite hardware
class lastmisn_state : public dec8_mcu_state_base
{
public:
lastmisn_state(const machine_config &mconfig, device_type type, const char *tag) :
dec8_mcu_state_base(mconfig, type, tag),
m_spritegen_krn(*this, "spritegen_krn"),
m_nmigate(*this, "nmigate")
{
}
void garyoret(machine_config &config);
void ghostb(machine_config &config);
void oscar(machine_config &config);
void oscarbl(machine_config &config);
void gondo(machine_config &config);
void lastmisn(machine_config &config);
void meikyuh(machine_config &config);
void shackled(machine_config &config);
void init_meikyuhbl();
@ -58,175 +188,130 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
TIMER_CALLBACK_MEMBER(mcu_irq_clear);
TIMER_CALLBACK_MEMBER(audiocpu_nmi_clear);
void ghostb_bank_w(u8 data);
void gondo_scroll_w(offs_t offset, u8 data);
void gondo_mcu_to_main_w(u8 data);
uint8_t i8751_h_r();
uint8_t i8751_l_r();
void dec8_i8751_w(offs_t offset, uint8_t data);
void dec8_mxc06_karn_buffer_spriteram_w(uint8_t data);
void dec8_sound_w(uint8_t data);
void main_irq_on_w(uint8_t data);
void main_irq_off_w(uint8_t data);
void main_firq_off_w(uint8_t data);
void sub_irq_on_w(uint8_t data);
void sub_irq_off_w(uint8_t data);
void flip_screen_w(uint8_t data);
void dec8_bg_data_w(offs_t offset, uint8_t data);
uint8_t dec8_bg_data_r(offs_t offset);
void dec8_videoram_w(offs_t offset, uint8_t data);
void dec8_scroll2_w(offs_t offset, uint8_t data);
uint8_t i8751_port0_r();
void i8751_port0_w(uint8_t data);
uint8_t i8751_port1_r();
void i8751_port1_w(uint8_t data);
TILE_GET_INFO_MEMBER(get_gondo_fix_tile_info);
TILE_GET_INFO_MEMBER(get_gondo_tile_info);
DECLARE_VIDEO_START(lastmisn);
uint32_t screen_update_lastmisn(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void set_screen_raw_params_data_east(machine_config &config);
void screen_vblank(int state);
/* devices */
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_subcpu;
required_device<cpu_device> m_audiocpu;
optional_device<i8751_device> m_mcu;
optional_device<deco_karnovsprites_device> m_spritegen_krn;
required_device<buffered_spriteram8_device> m_spriteram;
required_device<screen_device> m_screen;
required_device<gfxdecode_device> m_gfxdecode;
required_device<deco_rmc3_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
/* memory regions */
required_memory_bank m_mainbank;
// MCU communication
uint8_t m_i8751_p2 = 0;
int m_i8751_port0 = 0;
int m_i8751_port1 = 0;
int m_i8751_return = 0;
int m_i8751_value = 0;
required_device<deco_karnovsprites_device> m_spritegen_krn;
optional_device<input_merger_device> m_nmigate;
private:
optional_device<input_merger_device> m_nmigate;
optional_device_array<deco_bac06_device, 2> m_tilegen;
optional_device<deco_mxc06_device> m_spritegen_mxc;
void lastmisn_control_w(u8 data);
void shackled_control_w(u8 data);
void lastmisn_scrollx_w(u8 data);
void lastmisn_scrolly_w(u8 data);
void shackled_mcu_to_main_w(u8 data);
/* memory pointers */
required_shared_ptr<uint8_t> m_videoram;
optional_shared_ptr<uint8_t> m_bg_data;
uint8_t * m_pf1_data = nullptr;
uint8_t * m_row = nullptr;
std::unique_ptr<uint16_t[]> m_buffered_spriteram16; // for the mxc06 sprite chip emulation (oscar, cobra)
/* video-related */
tilemap_t *m_bg_tilemap = nullptr;
tilemap_t *m_pf1_tilemap = nullptr;
tilemap_t *m_fix_tilemap = nullptr;
//int m_scroll1[4]{};
int m_scroll2[4]{};
int m_bg_control[0x20]{};
int m_pf1_control[0x20]{};
int m_game_uses_priority = 0;
/* misc */
bool m_secclr = false;
bool m_nmi_enable = false;
int m_coinage_id = 0;
int m_coin1 = 0;
int m_coin2 = 0;
int m_need1 = 0;
int m_need2 = 0;
int m_cred1 = 0;
int m_cred2 = 0;
int m_credits = 0;
int m_latch = 0;
bool m_coin_state = false;
int m_snd = 0;
emu_timer *m_i8751_timer = nullptr;
emu_timer *m_m6502_timer = nullptr;
void i8751_reset_w(uint8_t data);
uint8_t gondo_player_1_r(offs_t offset);
uint8_t gondo_player_2_r(offs_t offset);
void dec8_bank_w(uint8_t data);
void ghostb_bank_w(uint8_t data);
void sub_firq_off_w(uint8_t data);
void gondo_mcu_to_main_w(uint8_t data);
void shackled_mcu_to_main_w(uint8_t data);
void srdarwin_mcu_to_main_w(uint8_t data);
void srdarwin_videoram_w(offs_t offset, uint8_t data);
void srdarwin_control_w(offs_t offset, uint8_t data);
void lastmisn_control_w(uint8_t data);
void shackled_control_w(uint8_t data);
void lastmisn_scrollx_w(uint8_t data);
void lastmisn_scrolly_w(uint8_t data);
void gondo_scroll_w(offs_t offset, uint8_t data);
TILE_GET_INFO_MEMBER(get_cobracom_fix_tile_info);
TILE_GET_INFO_MEMBER(get_ghostb_fix_tile_info);
TILE_GET_INFO_MEMBER(get_oscar_fix_tile_info);
TILEMAP_MAPPER_MEMBER(lastmisn_scan_rows);
TILE_GET_INFO_MEMBER(get_ghostb_fix_tile_info);
TILE_GET_INFO_MEMBER(get_lastmisn_tile_info);
TILE_GET_INFO_MEMBER(get_lastmisn_fix_tile_info);
TILE_GET_INFO_MEMBER(get_srdarwin_fix_tile_info);
TILE_GET_INFO_MEMBER(get_srdarwin_tile_info);
TILE_GET_INFO_MEMBER(get_gondo_fix_tile_info);
TILE_GET_INFO_MEMBER(get_gondo_tile_info);
DECLARE_VIDEO_START(shackled);
DECLARE_VIDEO_START(gondo);
DECLARE_VIDEO_START(garyoret);
DECLARE_VIDEO_START(ghostb);
DECLARE_VIDEO_START(oscar);
DECLARE_VIDEO_START(srdarwin);
DECLARE_VIDEO_START(cobracom);
void allocate_buffered_spriteram16();
uint32_t screen_update_shackled(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_gondo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_garyoret(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_VIDEO_START(shackled);
uint32_t screen_update_ghostb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_oscar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_srdarwin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_cobracom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_vblank_dec8(int state);
void oscar_coin_irq(int state);
void oscar_coin_clear_w(uint8_t data);
uint32_t screen_update_garyoret(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_shackled(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void shackled_coin_irq(int state);
void srdarwin_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &primap);
void lastmisn_map(address_map &map);
void lastmisn_sub_map(address_map &map);
void garyoret_map(address_map &map);
void meikyuh_map(address_map &map);
void shackled_map(address_map &map);
void shackled_sub_map(address_map &map);
void ym3526_s_map(address_map &map);
bool m_secclr = false;
bool m_nmi_enable = false;
};
// with rotary joystick
class gondo_state : public lastmisn_state
{
public:
gondo_state(const machine_config &mconfig, device_type type, const char *tag) :
lastmisn_state(mconfig, type, tag),
m_analog_io(*this, "AN%u", 0U),
m_in_io(*this, "IN%u", 0U)
{
}
void gondo(machine_config &config);
protected:
virtual void video_start() override;
private:
template<unsigned Which> u8 player_io_r(offs_t offset);
uint32_t screen_update_gondo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void gondo_colpri_cb(u32 &colour, u32 &pri_mask);
void gondo_map(address_map &map);
required_ioport_array<2> m_analog_io;
required_ioport_array<4> m_in_io;
};
// with MXC06 sprite hardware
class oscar_state : public dec8_state_base
{
public:
oscar_state(const machine_config &mconfig, device_type type, const char *tag) :
dec8_state_base(mconfig, type, tag),
m_spritegen_mxc(*this, "spritegen_mxc")
{
}
void cobracom(machine_config &config);
void oscar(machine_config &config);
void oscarbl(machine_config &config);
private:
void bank_w(u8 data);
TILE_GET_INFO_MEMBER(get_cobracom_fix_tile_info);
TILE_GET_INFO_MEMBER(get_oscar_fix_tile_info);
DECLARE_VIDEO_START(cobracom);
DECLARE_VIDEO_START(oscar);
uint32_t screen_update_cobracom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_oscar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void coin_irq(int state);
void coin_clear_w(u8 data);
void cobracom_colpri_cb(u32 &colour, u32 &pri_mask);
void oscar_tile_cb(tile_data &tileinfo, u32 &tile, u32 &colour, u32 &flags);
void cobra_map(address_map &map);
void dec8_s_map(address_map &map);
void garyoret_map(address_map &map);
void gondo_map(address_map &map);
void lastmisn_map(address_map &map);
void lastmisn_sub_map(address_map &map);
void meikyuh_map(address_map &map);
void oscar_map(address_map &map);
void oscar_s_map(address_map &map);
void oscarbl_s_opcodes_map(address_map &map);
void oscar_sub_map(address_map &map);
void shackled_map(address_map &map);
void shackled_sub_map(address_map &map);
void srdarwin_map(address_map &map);
void ym3526_s_map(address_map &map);
/* ports */
optional_ioport m_coin_port;
required_device<deco_mxc06_device> m_spritegen_mxc;
};
class csilver_state : public dec8_state
// with MSM5205 ADPCM
class csilver_state : public lastmisn_state
{
public:
csilver_state(const machine_config &mconfig, device_type type, const char *tag) :
dec8_state(mconfig, type, tag),
lastmisn_state(mconfig, type, tag),
m_msm(*this, "msm"),
m_soundbank(*this, "soundbank")
{
@ -239,16 +324,17 @@ protected:
virtual void machine_reset() override;
private:
void csilver_control_w(uint8_t data);
void csilver_adpcm_data_w(uint8_t data);
void csilver_sound_bank_w(uint8_t data);
void csilver_mcu_to_main_w(uint8_t data);
uint8_t csilver_adpcm_reset_r();
void csilver_adpcm_int(int state);
void scroll_w(offs_t offset, u8 data);
void control_w(u8 data);
void adpcm_data_w(u8 data);
void sound_bank_w(u8 data);
void mcu_to_main_w(u8 data);
u8 adpcm_reset_r();
void adpcm_int(int state);
void csilver_map(address_map &map);
void csilver_s_map(address_map &map);
void csilver_sub_map(address_map &map);
void main_map(address_map &map);
void sound_map(address_map &map);
void sub_map(address_map &map);
required_device<msm5205_device> m_msm;
required_memory_bank m_soundbank;

View File

@ -46,52 +46,52 @@ sprites.
#include "emu.h"
#include "dec8.h"
void dec8_state::dec8_bg_data_w(offs_t offset, uint8_t data)
void dec8_state_base::bg_ram_w(offs_t offset, u8 data)
{
m_bg_data[offset] = data;
m_bg_ram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset / 2);
}
uint8_t dec8_state::dec8_bg_data_r(offs_t offset)
u8 dec8_state_base::bg_ram_r(offs_t offset)
{
return m_bg_data[offset];
return m_bg_ram[offset];
}
void dec8_state::dec8_videoram_w(offs_t offset, uint8_t data)
void dec8_state_base::videoram_w(offs_t offset, u8 data)
{
m_videoram[offset] = data;
m_fix_tilemap->mark_tile_dirty(offset / 2);
}
void dec8_state::srdarwin_videoram_w(offs_t offset, uint8_t data)
void srdarwin_state::srdarwin_videoram_w(offs_t offset, u8 data)
{
m_videoram[offset] = data;
m_fix_tilemap->mark_tile_dirty(offset);
}
void dec8_state::dec8_scroll2_w(offs_t offset, uint8_t data)
void csilver_state::scroll_w(offs_t offset, u8 data)
{
m_scroll2[offset] = data;
m_scroll[offset] = data;
}
void dec8_state::srdarwin_control_w(offs_t offset, uint8_t data)
void srdarwin_state::control_w(offs_t offset, u8 data)
{
switch (offset)
{
case 0: /* Top 3 bits - bank switch, bottom 4 - scroll MSB */
m_mainbank->set_entry((data >> 5));
m_scroll2[0] = data & 0xf;
m_scroll[0] = data & 0xf;
return;
case 1:
m_scroll2[1] = data;
m_scroll[1] = data;
return;
}
}
void dec8_state::lastmisn_control_w(uint8_t data)
void lastmisn_state::lastmisn_control_w(u8 data)
{
/*
Bit 0x0f - ROM bank switch.
@ -102,8 +102,8 @@ void dec8_state::lastmisn_control_w(uint8_t data)
*/
m_mainbank->set_entry(data & 0x0f);
m_scroll2[0] = (data >> 5) & 1;
m_scroll2[2] = (data >> 6) & 1;
m_scroll[0] = (data >> 5) & 1;
m_scroll[2] = (data >> 6) & 1;
if (data & 0x80)
m_subcpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
@ -111,55 +111,55 @@ void dec8_state::lastmisn_control_w(uint8_t data)
m_subcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
}
void dec8_state::shackled_control_w(uint8_t data)
void lastmisn_state::shackled_control_w(u8 data)
{
/* Bottom 4 bits - bank switch, Bits 4 & 5 - Scroll MSBs */
m_mainbank->set_entry(data & 0x0f);
m_scroll2[0] = (data >> 5) & 1;
m_scroll2[2] = (data >> 6) & 1;
m_scroll[0] = (data >> 5) & 1;
m_scroll[2] = (data >> 6) & 1;
}
void dec8_state::lastmisn_scrollx_w(uint8_t data)
void lastmisn_state::lastmisn_scrollx_w(u8 data)
{
m_scroll2[1] = data;
m_scroll[1] = data;
}
void dec8_state::lastmisn_scrolly_w(uint8_t data)
void lastmisn_state::lastmisn_scrolly_w(u8 data)
{
m_scroll2[3] = data;
m_scroll[3] = data;
}
void dec8_state::gondo_scroll_w(offs_t offset, uint8_t data)
void lastmisn_state::gondo_scroll_w(offs_t offset, u8 data)
{
switch (offset)
{
case 0x0:
m_scroll2[1] = data; /* X LSB */
m_scroll[1] = data; /* X LSB */
break;
case 0x8:
m_scroll2[3] = data; /* Y LSB */
m_scroll[3] = data; /* Y LSB */
break;
case 0x10:
m_scroll2[0] = (data >> 0) & 1; /* Bit 0: X MSB */
m_scroll2[2] = (data >> 1) & 1; /* Bit 1: Y MSB */
m_scroll[0] = (data >> 0) & 1; /* Bit 0: X MSB */
m_scroll[2] = (data >> 1) & 1; /* Bit 1: Y MSB */
/* Bit 2 is also used in Gondo & Garyoret */
break;
}
}
void dec8_state::allocate_buffered_spriteram16()
void dec8_state_base::allocate_buffered_spriteram16()
{
m_buffered_spriteram16 = make_unique_clear<uint16_t[]>(0x800/2);
m_buffered_spriteram16 = make_unique_clear<u16[]>(0x800/2);
save_pointer(NAME(m_buffered_spriteram16), 0x800/2);
}
/******************************************************************************/
void dec8_state::srdarwin_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &primap)
void srdarwin_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &primap)
{
uint8_t *buffered_spriteram = m_spriteram->buffer();
u8 *buffered_spriteram = m_spriteram->buffer();
/* Sprites */
for (int offs = 0x200 - 4; offs >= 0; offs -= 4)
@ -206,7 +206,7 @@ void dec8_state::srdarwin_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cl
/******************************************************************************/
void dec8_state::cobracom_colpri_cb(u32 &colour, u32 &pri_mask)
void oscar_state::cobracom_colpri_cb(u32 &colour, u32 &pri_mask)
{
pri_mask = 0; // above foreground, background
if ((colour & 4) == 0)
@ -215,7 +215,7 @@ void dec8_state::cobracom_colpri_cb(u32 &colour, u32 &pri_mask)
colour &= 3;
}
uint32_t dec8_state::screen_update_cobracom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t oscar_state::screen_update_cobracom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0,cliprect);
bool flip = m_tilegen[0]->get_flip_state();
@ -234,7 +234,7 @@ uint32_t dec8_state::screen_update_cobracom(screen_device &screen, bitmap_ind16
/******************************************************************************/
TILE_GET_INFO_MEMBER(dec8_state::get_cobracom_fix_tile_info)
TILE_GET_INFO_MEMBER(oscar_state::get_cobracom_fix_tile_info)
{
int offs = tile_index << 1;
int tile = m_videoram[offs + 1] + (m_videoram[offs] << 8);
@ -246,10 +246,10 @@ TILE_GET_INFO_MEMBER(dec8_state::get_cobracom_fix_tile_info)
0);
}
VIDEO_START_MEMBER(dec8_state,cobracom)
VIDEO_START_MEMBER(oscar_state,cobracom)
{
allocate_buffered_spriteram16();
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dec8_state::get_cobracom_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(oscar_state::get_cobracom_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_fix_tilemap->set_transparent_pen(0);
@ -258,7 +258,7 @@ VIDEO_START_MEMBER(dec8_state,cobracom)
/******************************************************************************/
uint32_t dec8_state::screen_update_ghostb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t lastmisn_state::screen_update_ghostb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0);
m_spritegen_krn->draw_sprites(screen, bitmap, cliprect, m_gfxdecode->gfx(1), m_buffered_spriteram16.get(), 0x400);
@ -266,7 +266,7 @@ uint32_t dec8_state::screen_update_ghostb(screen_device &screen, bitmap_ind16 &b
return 0;
}
TILE_GET_INFO_MEMBER(dec8_state::get_ghostb_fix_tile_info)
TILE_GET_INFO_MEMBER(lastmisn_state::get_ghostb_fix_tile_info)
{
int offs = tile_index << 1;
int tile = m_videoram[offs + 1] + (m_videoram[offs] << 8);
@ -278,10 +278,10 @@ TILE_GET_INFO_MEMBER(dec8_state::get_ghostb_fix_tile_info)
0);
}
VIDEO_START_MEMBER(dec8_state,ghostb)
VIDEO_START_MEMBER(lastmisn_state,ghostb)
{
allocate_buffered_spriteram16();
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dec8_state::get_ghostb_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(lastmisn_state::get_ghostb_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_fix_tilemap->set_transparent_pen(0);
m_game_uses_priority = 0;
@ -293,13 +293,13 @@ VIDEO_START_MEMBER(dec8_state,ghostb)
/******************************************************************************/
// we mimic the priority scheme in dec0.cpp, this was originally a bit different, so this could be wrong
void dec8_state::oscar_tile_cb(tile_data &tileinfo, u32 &tile, u32 &colour, u32 &flags)
void oscar_state::oscar_tile_cb(tile_data &tileinfo, u32 &tile, u32 &colour, u32 &flags)
{
tileinfo.group = BIT(colour, 3) ? 1 : 0;
colour &= 7;
}
uint32_t dec8_state::screen_update_oscar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t oscar_state::screen_update_oscar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bool flip = m_tilegen[0]->get_flip_state();
m_tilegen[0]->set_flip_screen(flip);
@ -313,7 +313,7 @@ uint32_t dec8_state::screen_update_oscar(screen_device &screen, bitmap_ind16 &bi
return 0;
}
TILE_GET_INFO_MEMBER(dec8_state::get_oscar_fix_tile_info)
TILE_GET_INFO_MEMBER(oscar_state::get_oscar_fix_tile_info)
{
int offs = tile_index << 1;
int tile = m_videoram[offs + 1] + (m_videoram[offs] << 8);
@ -325,10 +325,10 @@ TILE_GET_INFO_MEMBER(dec8_state::get_oscar_fix_tile_info)
0);
}
VIDEO_START_MEMBER(dec8_state,oscar)
VIDEO_START_MEMBER(oscar_state,oscar)
{
allocate_buffered_spriteram16();
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dec8_state::get_oscar_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(oscar_state::get_oscar_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_fix_tilemap->set_transparent_pen(0);
m_tilegen[0]->set_transmask(0, 0xffff, 0x0000);
@ -339,10 +339,10 @@ VIDEO_START_MEMBER(dec8_state,oscar)
/******************************************************************************/
uint32_t dec8_state::screen_update_lastmisn(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t lastmisn_state::screen_update_lastmisn(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->set_scrollx(0, ((m_scroll2[0] << 8)+ m_scroll2[1]));
m_bg_tilemap->set_scrolly(0, ((m_scroll2[2] << 8)+ m_scroll2[3]));
m_bg_tilemap->set_scrollx(0, ((m_scroll[0] << 8)+ m_scroll[1]));
m_bg_tilemap->set_scrolly(0, ((m_scroll[2] << 8)+ m_scroll[3]));
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
m_spritegen_krn->draw_sprites(screen, bitmap, cliprect, m_gfxdecode->gfx(1), m_buffered_spriteram16.get(), 0x400);
@ -350,10 +350,10 @@ uint32_t dec8_state::screen_update_lastmisn(screen_device &screen, bitmap_ind16
return 0;
}
uint32_t dec8_state::screen_update_shackled(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t lastmisn_state::screen_update_shackled(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->set_scrollx(0, ((m_scroll2[0] << 8) + m_scroll2[1]));
m_bg_tilemap->set_scrolly(0, ((m_scroll2[2] << 8) + m_scroll2[3]));
m_bg_tilemap->set_scrollx(0, ((m_scroll[0] << 8) + m_scroll[1]));
m_bg_tilemap->set_scrolly(0, ((m_scroll[2] << 8) + m_scroll[3]));
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1 | 0, 0);
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1 | 1, 0);
@ -364,16 +364,16 @@ uint32_t dec8_state::screen_update_shackled(screen_device &screen, bitmap_ind16
return 0;
}
TILEMAP_MAPPER_MEMBER(dec8_state::lastmisn_scan_rows)
TILEMAP_MAPPER_MEMBER(lastmisn_state::lastmisn_scan_rows)
{
/* logical (col,row) -> memory offset */
return ((col & 0x0f) + ((row & 0x0f) << 4)) + ((col & 0x10) << 4) + ((row & 0x10) << 5);
}
TILE_GET_INFO_MEMBER(dec8_state::get_lastmisn_tile_info)
TILE_GET_INFO_MEMBER(lastmisn_state::get_lastmisn_tile_info)
{
int offs = tile_index * 2;
int tile = m_bg_data[offs + 1] + (m_bg_data[offs] << 8);
int tile = m_bg_ram[offs + 1] + (m_bg_ram[offs] << 8);
int color = tile >> 12;
if (color & 8 && m_game_uses_priority)
@ -387,7 +387,7 @@ TILE_GET_INFO_MEMBER(dec8_state::get_lastmisn_tile_info)
0);
}
TILE_GET_INFO_MEMBER(dec8_state::get_lastmisn_fix_tile_info)
TILE_GET_INFO_MEMBER(lastmisn_state::get_lastmisn_fix_tile_info)
{
int offs = tile_index << 1;
int tile = m_videoram[offs + 1] + (m_videoram[offs] << 8);
@ -399,21 +399,21 @@ TILE_GET_INFO_MEMBER(dec8_state::get_lastmisn_fix_tile_info)
0);
}
VIDEO_START_MEMBER(dec8_state,lastmisn)
VIDEO_START_MEMBER(lastmisn_state,lastmisn)
{
allocate_buffered_spriteram16();
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dec8_state::get_lastmisn_tile_info)), tilemap_mapper_delegate(*this, FUNC(dec8_state::lastmisn_scan_rows)), 16, 16, 32, 32);
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dec8_state::get_lastmisn_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(lastmisn_state::get_lastmisn_tile_info)), tilemap_mapper_delegate(*this, FUNC(lastmisn_state::lastmisn_scan_rows)), 16, 16, 32, 32);
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(lastmisn_state::get_lastmisn_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_fix_tilemap->set_transparent_pen(0);
m_game_uses_priority = 0;
}
VIDEO_START_MEMBER(dec8_state,shackled)
VIDEO_START_MEMBER(lastmisn_state,shackled)
{
allocate_buffered_spriteram16();
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dec8_state::get_lastmisn_tile_info)), tilemap_mapper_delegate(*this, FUNC(dec8_state::lastmisn_scan_rows)), 16, 16, 32, 32);
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dec8_state::get_lastmisn_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(lastmisn_state::get_lastmisn_tile_info)), tilemap_mapper_delegate(*this, FUNC(lastmisn_state::lastmisn_scan_rows)), 16, 16, 32, 32);
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(lastmisn_state::get_lastmisn_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_fix_tilemap->set_transparent_pen(0);
m_bg_tilemap->set_transmask(0, 0x000f, 0xfff0); // Bottom 12 pens
@ -422,19 +422,19 @@ VIDEO_START_MEMBER(dec8_state,shackled)
/******************************************************************************/
uint32_t dec8_state::screen_update_srdarwin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t srdarwin_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0, cliprect);
m_bg_tilemap->set_scrollx(0, (m_scroll2[0] << 8) + m_scroll2[1]);
m_bg_tilemap->set_scrollx(0, (m_scroll[0] << 8) + m_scroll[1]);
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 1);
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 2);
srdarwin_draw_sprites(bitmap, cliprect, screen.priority());
draw_sprites(bitmap, cliprect, screen.priority());
m_fix_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
}
TILE_GET_INFO_MEMBER(dec8_state::get_srdarwin_fix_tile_info)
TILE_GET_INFO_MEMBER(srdarwin_state::get_fix_tile_info)
{
int tile = m_videoram[tile_index];
int color = 0; /* ? */
@ -447,9 +447,9 @@ TILE_GET_INFO_MEMBER(dec8_state::get_srdarwin_fix_tile_info)
0);
}
TILE_GET_INFO_MEMBER(dec8_state::get_srdarwin_tile_info)
TILE_GET_INFO_MEMBER(srdarwin_state::get_tile_info)
{
int tile = m_bg_data[2 * tile_index + 1] + (m_bg_data[2 * tile_index] << 8);
int tile = m_bg_ram[2 * tile_index + 1] + (m_bg_ram[2 * tile_index] << 8);
int color = tile >> 12 & 3;
int bank;
@ -463,10 +463,10 @@ TILE_GET_INFO_MEMBER(dec8_state::get_srdarwin_tile_info)
tileinfo.group = color;
}
VIDEO_START_MEMBER(dec8_state,srdarwin)
void srdarwin_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dec8_state::get_srdarwin_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 16);
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dec8_state::get_srdarwin_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(srdarwin_state::get_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 16);
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(srdarwin_state::get_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_fix_tilemap->set_transparent_pen(0);
m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); // draw as background only
@ -477,18 +477,18 @@ VIDEO_START_MEMBER(dec8_state,srdarwin)
/******************************************************************************/
void dec8_state::gondo_colpri_cb(u32 &colour, u32 &pri_mask)
void gondo_state::gondo_colpri_cb(u32 &colour, u32 &pri_mask)
{
pri_mask = 0; // above foreground, background
if (colour & 8)
pri_mask |= GFX_PMASK_2; // behind foreground, above background
}
uint32_t dec8_state::screen_update_gondo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t gondo_state::screen_update_gondo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0, cliprect);
m_bg_tilemap->set_scrollx(0, ((m_scroll2[0] << 8) + m_scroll2[1]));
m_bg_tilemap->set_scrolly(0, ((m_scroll2[2] << 8) + m_scroll2[3]));
m_bg_tilemap->set_scrollx(0, ((m_scroll[0] << 8) + m_scroll[1]));
m_bg_tilemap->set_scrolly(0, ((m_scroll[2] << 8) + m_scroll[3]));
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 1);
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 2);
@ -497,10 +497,10 @@ uint32_t dec8_state::screen_update_gondo(screen_device &screen, bitmap_ind16 &bi
return 0;
}
uint32_t dec8_state::screen_update_garyoret(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t lastmisn_state::screen_update_garyoret(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->set_scrollx(0, ((m_scroll2[0] << 8) + m_scroll2[1]));
m_bg_tilemap->set_scrolly(0, ((m_scroll2[2] << 8) + m_scroll2[3]));
m_bg_tilemap->set_scrollx(0, ((m_scroll[0] << 8) + m_scroll[1]));
m_bg_tilemap->set_scrolly(0, ((m_scroll[2] << 8) + m_scroll[3]));
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
m_spritegen_krn->draw_sprites(screen, bitmap, cliprect, m_gfxdecode->gfx(1), m_buffered_spriteram16.get(), 0x400);
@ -509,7 +509,7 @@ uint32_t dec8_state::screen_update_garyoret(screen_device &screen, bitmap_ind16
return 0;
}
TILE_GET_INFO_MEMBER(dec8_state::get_gondo_fix_tile_info)
TILE_GET_INFO_MEMBER(lastmisn_state::get_gondo_fix_tile_info)
{
int offs = tile_index * 2;
int tile = m_videoram[offs + 1] + (m_videoram[offs] << 8);
@ -521,10 +521,10 @@ TILE_GET_INFO_MEMBER(dec8_state::get_gondo_fix_tile_info)
0);
}
TILE_GET_INFO_MEMBER(dec8_state::get_gondo_tile_info)
TILE_GET_INFO_MEMBER(lastmisn_state::get_gondo_tile_info)
{
int offs = tile_index * 2;
int tile = m_bg_data[offs + 1] + (m_bg_data[offs] << 8);
int tile = m_bg_ram[offs + 1] + (m_bg_ram[offs] << 8);
int color = tile>> 12;
if (color & 8 && m_game_uses_priority)
@ -538,22 +538,22 @@ TILE_GET_INFO_MEMBER(dec8_state::get_gondo_tile_info)
0);
}
VIDEO_START_MEMBER(dec8_state,gondo)
void gondo_state::video_start()
{
allocate_buffered_spriteram16();
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dec8_state::get_gondo_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dec8_state::get_gondo_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gondo_state::get_gondo_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gondo_state::get_gondo_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_fix_tilemap->set_transparent_pen(0);
m_bg_tilemap->set_transmask(0, 0x00ff, 0xff00); /* Bottom 8 pens */
m_game_uses_priority = 0;
}
VIDEO_START_MEMBER(dec8_state,garyoret)
VIDEO_START_MEMBER(lastmisn_state,garyoret)
{
allocate_buffered_spriteram16();
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dec8_state::get_gondo_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dec8_state::get_gondo_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_fix_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(lastmisn_state::get_gondo_fix_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(lastmisn_state::get_gondo_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_fix_tilemap->set_transparent_pen(0);
m_game_uses_priority = 1;