mirror of
https://github.com/holub/mame
synced 2025-04-24 01:11:11 +03:00
gaelco/gaelco2.cpp: Added developers/licencees to manufacturers and cleaned up code. (#12451)
* Moved snowboar/maniacsqs protection simulation to a derived class. * Reduced use of literal tags and duplicated code. * Improved ROM region names. * Changed single-line comments to C++ line comments.
This commit is contained in:
parent
ff9b01328d
commit
3e3a70377c
File diff suppressed because it is too large
Load Diff
@ -19,11 +19,10 @@ public:
|
||||
m_eeprom(*this, "eeprom"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette"),
|
||||
m_global_spritexoff(0),
|
||||
m_vregs(*this, "vregs"),
|
||||
m_snowboar_protection(*this, "snowboar_prot"),
|
||||
m_paletteram(*this, "paletteram"),
|
||||
m_shareram(*this, "shareram")
|
||||
m_shareram(*this, "shareram"),
|
||||
m_global_spritexoff(0)
|
||||
{ }
|
||||
|
||||
void maniacsq_d5002fp(machine_config &config);
|
||||
@ -32,22 +31,26 @@ public:
|
||||
void alighunt(machine_config &config);
|
||||
void touchgo(machine_config &config);
|
||||
void alighunt_d5002fp(machine_config &config);
|
||||
void snowboar(machine_config &config);
|
||||
void maniacsq(machine_config &config);
|
||||
void maniacsqs(machine_config &config);
|
||||
void touchgo_d5002fp(machine_config &config);
|
||||
void saltcrdi(machine_config &config);
|
||||
|
||||
void init_touchgo();
|
||||
void init_snowboar();
|
||||
void init_snowboara();
|
||||
void init_alighunt();
|
||||
void init_wrally2();
|
||||
void init_play2000();
|
||||
|
||||
void coin1_counter_w(int state);
|
||||
void coin2_counter_w(int state);
|
||||
|
||||
protected:
|
||||
void vram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
|
||||
void vregs_w(offs_t offset, u16 data, u16 mem_mask = ~0);
|
||||
void palette_w(offs_t offset, u16 data, u16 mem_mask = ~0);
|
||||
|
||||
void wrally2_latch_w(offs_t offset, u16 data);
|
||||
|
||||
void ROM16_split_gfx(const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2);
|
||||
|
||||
DECLARE_VIDEO_START(gaelco2);
|
||||
DECLARE_VIDEO_START(gaelco2_dual);
|
||||
|
||||
@ -55,7 +58,8 @@ public:
|
||||
u32 screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
u32 screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
protected:
|
||||
void mcu_hostmem_map(address_map &map);
|
||||
|
||||
required_device<m68000_device> m_maincpu;
|
||||
optional_device<ls259_device> m_mainlatch;
|
||||
required_device<buffered_spriteram16_device> m_spriteram;
|
||||
@ -63,13 +67,9 @@ protected:
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
void vram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
|
||||
void vregs_w(offs_t offset, u16 data, u16 mem_mask = ~0);
|
||||
void palette_w(offs_t offset, u16 data, u16 mem_mask = ~0);
|
||||
|
||||
void wrally2_latch_w(offs_t offset, u16 data);
|
||||
|
||||
void mcu_hostmem_map(address_map &map);
|
||||
required_shared_ptr<u16> m_vregs;
|
||||
required_shared_ptr<u16> m_paletteram;
|
||||
optional_shared_ptr<u16> m_shareram;
|
||||
|
||||
private:
|
||||
void shareram_w(offs_t offset, u8 data);
|
||||
@ -77,19 +77,15 @@ private:
|
||||
void alighunt_coin_w(u16 data);
|
||||
void coin3_counter_w(int state);
|
||||
void coin4_counter_w(int state);
|
||||
u16 snowboar_protection_r();
|
||||
void snowboar_protection_w(offs_t offset, u16 data, u16 mem_mask = ~0);
|
||||
template<unsigned Layer> TILE_GET_INFO_MEMBER(get_tile_info);
|
||||
template<unsigned Layer> TILE_GET_INFO_MEMBER(get_tile_info_dual);
|
||||
int get_rowscrollmode_yscroll(bool first_screen);
|
||||
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int mask);
|
||||
u32 dual_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index);
|
||||
void ROM16_split_gfx(const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2);
|
||||
|
||||
void alighunt_map(address_map &map);
|
||||
void maniacsq_map(address_map &map);
|
||||
void play2000_map(address_map &map);
|
||||
void snowboar_map(address_map &map);
|
||||
void touchgo_map(address_map &map);
|
||||
void saltcrdi_map(address_map &map);
|
||||
void srollnd_map(address_map &map);
|
||||
@ -98,17 +94,38 @@ private:
|
||||
u16 srollnd_share_sim_r(offs_t offset, u16 mem_mask = ~0);
|
||||
void srollnd_share_sim_w(offs_t offset, u16 data, u16 mem_mask = ~0);
|
||||
|
||||
u32 m_snowboard_latch = 0U;
|
||||
|
||||
u16 *m_videoram = nullptr;
|
||||
tilemap_t *m_pant[2]{};
|
||||
int m_dual_monitor = 0;
|
||||
int m_global_spritexoff = 0;
|
||||
bool m_dual_monitor = false;
|
||||
int m_global_spritexoff;
|
||||
};
|
||||
|
||||
required_shared_ptr<u16> m_vregs;
|
||||
optional_shared_ptr<u16> m_snowboar_protection;
|
||||
required_shared_ptr<u16> m_paletteram;
|
||||
optional_shared_ptr<u16> m_shareram;
|
||||
|
||||
class snowboar_state : public gaelco2_state
|
||||
{
|
||||
public:
|
||||
snowboar_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
gaelco2_state(mconfig, type, tag),
|
||||
m_snowboar_protection(*this, "snowboar_prot")
|
||||
{ }
|
||||
|
||||
void maniacsqs(machine_config &config);
|
||||
void snowboar(machine_config &config);
|
||||
|
||||
void init_snowboara();
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
|
||||
private:
|
||||
u16 snowboar_protection_r();
|
||||
void snowboar_protection_w(offs_t offset, u16 data, u16 mem_mask = ~0);
|
||||
|
||||
void snowboar_map(address_map &map);
|
||||
|
||||
required_shared_ptr<u16> m_snowboar_protection;
|
||||
|
||||
u32 m_snowboard_latch = 0U;
|
||||
};
|
||||
|
||||
|
||||
@ -117,31 +134,26 @@ class bang_state : public gaelco2_state
|
||||
public:
|
||||
bang_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: gaelco2_state(mconfig, type, tag)
|
||||
, m_light0_x(*this, "LIGHT0_X")
|
||||
, m_light0_y(*this, "LIGHT0_Y")
|
||||
, m_light1_x(*this, "LIGHT1_X")
|
||||
, m_light1_y(*this, "LIGHT1_Y")
|
||||
, m_light_x(*this, "LIGHT%u_X", 0U)
|
||||
, m_light_y(*this, "LIGHT%u_Y", 0U)
|
||||
{}
|
||||
|
||||
void bang(machine_config &config);
|
||||
|
||||
void init_bang();
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
|
||||
private:
|
||||
required_ioport m_light0_x;
|
||||
required_ioport m_light0_y;
|
||||
required_ioport m_light1_x;
|
||||
required_ioport m_light1_y;
|
||||
|
||||
int m_clr_gun_int = 0;
|
||||
|
||||
u16 p1_gun_x();
|
||||
u16 p1_gun_y();
|
||||
u16 p2_gun_x();
|
||||
u16 p2_gun_y();
|
||||
template <unsigned Which> u16 gun_x();
|
||||
template <unsigned Which> u16 gun_y();
|
||||
void bang_clr_gun_int_w(u16 data);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(bang_irq);
|
||||
void bang_map(address_map &map);
|
||||
|
||||
required_ioport_array<2> m_light_x;
|
||||
required_ioport_array<2> m_light_y;
|
||||
|
||||
bool m_clr_gun_int = false;
|
||||
};
|
||||
|
||||
|
||||
@ -150,21 +162,21 @@ class wrally2_state : public gaelco2_state
|
||||
public:
|
||||
wrally2_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: gaelco2_state(mconfig, type, tag)
|
||||
, m_analog0(*this, "ANALOG0")
|
||||
, m_analog1(*this, "ANALOG1")
|
||||
, m_analog(*this, "ANALOG%u", 0U)
|
||||
{}
|
||||
|
||||
void wrally2(machine_config &config);
|
||||
|
||||
void init_wrally2();
|
||||
|
||||
template <int N> int wrally2_analog_bit_r();
|
||||
|
||||
private:
|
||||
required_ioport m_analog0;
|
||||
required_ioport m_analog1;
|
||||
|
||||
uint8_t m_analog_ports[2]{};
|
||||
|
||||
void wrally2_adc_clk(int state);
|
||||
void wrally2_adc_cs(int state);
|
||||
void wrally2_map(address_map &map);
|
||||
|
||||
required_ioport_array<2> m_analog;
|
||||
|
||||
u8 m_analog_ports[2]{};
|
||||
};
|
||||
|
@ -24,16 +24,14 @@
|
||||
|
||||
void gaelco2_state::ROM16_split_gfx(const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* get a pointer to the source data */
|
||||
uint8_t *src = (uint8_t *)memregion(src_reg)->base();
|
||||
u8 *src = (u8 *)memregion(src_reg)->base();
|
||||
|
||||
/* get a pointer to the destination data */
|
||||
uint8_t *dst = (uint8_t *)memregion(dst_reg)->base();
|
||||
u8 *dst = (u8 *)memregion(dst_reg)->base();
|
||||
|
||||
/* fill destination areas with the proper data */
|
||||
for (i = 0; i < length/2; i++){
|
||||
for (int i = 0; i < length/2; i++){
|
||||
dst[dest1 + i] = src[start + i*2 + 0];
|
||||
dst[dest2 + i] = src[start + i*2 + 1];
|
||||
}
|
||||
@ -49,13 +47,13 @@ void gaelco2_state::ROM16_split_gfx(const char *src_reg, const char *dst_reg, in
|
||||
void gaelco2_state::init_alighunt()
|
||||
{
|
||||
/*
|
||||
For "gfx2" we have this memory map:
|
||||
For "gfx_temp" we have this memory map:
|
||||
0x0000000-0x03fffff ROM u48
|
||||
0x0400000-0x07fffff ROM u47
|
||||
0x0800000-0x0bfffff ROM u50
|
||||
0x0c00000-0x0ffffff ROM u49
|
||||
|
||||
and we are going to construct this one for "gfx1":
|
||||
and we are going to construct this one for "gfx":
|
||||
0x0000000-0x01fffff ROM u48 even bytes
|
||||
0x0200000-0x03fffff ROM u47 even bytes
|
||||
0x0400000-0x05fffff ROM u48 odd bytes
|
||||
@ -67,28 +65,28 @@ void gaelco2_state::init_alighunt()
|
||||
*/
|
||||
|
||||
/* split ROM u48 */
|
||||
ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
|
||||
ROM16_split_gfx("gfx_temp", "gfx", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
|
||||
|
||||
/* split ROM u47 */
|
||||
ROM16_split_gfx("gfx2", "gfx1", 0x0400000, 0x0400000, 0x0200000, 0x0600000);
|
||||
ROM16_split_gfx("gfx_temp", "gfx", 0x0400000, 0x0400000, 0x0200000, 0x0600000);
|
||||
|
||||
/* split ROM u50 */
|
||||
ROM16_split_gfx("gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
|
||||
ROM16_split_gfx("gfx_temp", "gfx", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
|
||||
|
||||
/* split ROM u49 */
|
||||
ROM16_split_gfx("gfx2", "gfx1", 0x0c00000, 0x0400000, 0x0a00000, 0x0e00000);
|
||||
ROM16_split_gfx("gfx_temp", "gfx", 0x0c00000, 0x0400000, 0x0a00000, 0x0e00000);
|
||||
}
|
||||
|
||||
|
||||
void gaelco2_state::init_touchgo()
|
||||
{
|
||||
/*
|
||||
For "gfx2" we have this memory map:
|
||||
For "gfx_temp" we have this memory map:
|
||||
0x0000000-0x03fffff ROM ic65
|
||||
0x0400000-0x05fffff ROM ic66
|
||||
0x0800000-0x0bfffff ROM ic67
|
||||
|
||||
and we are going to construct this one for "gfx1":
|
||||
and we are going to construct this one for "gfx":
|
||||
0x0000000-0x01fffff ROM ic65 even bytes
|
||||
0x0200000-0x02fffff ROM ic66 even bytes
|
||||
0x0400000-0x05fffff ROM ic65 odd bytes
|
||||
@ -98,25 +96,25 @@ void gaelco2_state::init_touchgo()
|
||||
*/
|
||||
|
||||
/* split ROM ic65 */
|
||||
ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
|
||||
ROM16_split_gfx("gfx_temp", "gfx", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
|
||||
|
||||
/* split ROM ic66 */
|
||||
ROM16_split_gfx("gfx2", "gfx1", 0x0400000, 0x0200000, 0x0200000, 0x0600000);
|
||||
ROM16_split_gfx("gfx_temp", "gfx", 0x0400000, 0x0200000, 0x0200000, 0x0600000);
|
||||
|
||||
/* split ROM ic67 */
|
||||
ROM16_split_gfx("gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
|
||||
ROM16_split_gfx("gfx_temp", "gfx", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
|
||||
}
|
||||
|
||||
|
||||
void gaelco2_state::init_snowboara()
|
||||
void snowboar_state::init_snowboara()
|
||||
{
|
||||
/*
|
||||
For "gfx2" we have this memory map:
|
||||
For "gfx_temp" we have this memory map:
|
||||
0x0000000-0x03fffff ROM sb44
|
||||
0x0400000-0x07fffff ROM sb45
|
||||
0x0800000-0x0bfffff ROM sb46
|
||||
|
||||
and we are going to construct this one for "gfx1":
|
||||
and we are going to construct this one for "gfx":
|
||||
0x0000000-0x01fffff ROM sb44 even bytes
|
||||
0x0200000-0x03fffff ROM sb45 even bytes
|
||||
0x0400000-0x05fffff ROM sb44 odd bytes
|
||||
@ -126,25 +124,24 @@ void gaelco2_state::init_snowboara()
|
||||
*/
|
||||
|
||||
/* split ROM sb44 */
|
||||
ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
|
||||
ROM16_split_gfx("gfx_temp", "gfx", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
|
||||
|
||||
/* split ROM sb45 */
|
||||
ROM16_split_gfx("gfx2", "gfx1", 0x0400000, 0x0400000, 0x0200000, 0x0600000);
|
||||
ROM16_split_gfx("gfx_temp", "gfx", 0x0400000, 0x0400000, 0x0200000, 0x0600000);
|
||||
|
||||
/* split ROM sb46 */
|
||||
ROM16_split_gfx("gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
|
||||
init_snowboar();
|
||||
ROM16_split_gfx("gfx_temp", "gfx", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
|
||||
}
|
||||
|
||||
|
||||
void gaelco2_state::init_wrally2()
|
||||
void wrally2_state::init_wrally2()
|
||||
{
|
||||
/*
|
||||
For "gfx2" we have this memory map:
|
||||
For "gfx_temp" we have this memory map:
|
||||
0x0000000-0x03fffff ROM wr2_ic69.ic69
|
||||
0x0400000-0x05fffff ROM wr2_ic70.ic70
|
||||
|
||||
and we are going to construct this one for "gfx1":
|
||||
and we are going to construct this one for "gfx":
|
||||
0x0000000-0x01fffff ROM wr2_ic69.ic69 even bytes
|
||||
0x0200000-0x03fffff ROM wr2_ic69.ic69 odd bytes
|
||||
0x0400000-0x04fffff ROM wr2_ic70.ic70 even bytes
|
||||
@ -152,10 +149,10 @@ void gaelco2_state::init_wrally2()
|
||||
*/
|
||||
|
||||
/* split ROM wr2_ic69.ic69 */
|
||||
ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0200000);
|
||||
ROM16_split_gfx("gfx_temp", "gfx", 0x0000000, 0x0400000, 0x0000000, 0x0200000);
|
||||
|
||||
/* split ROM wr2_ic70.ic70 */
|
||||
ROM16_split_gfx("gfx2", "gfx1", 0x0400000, 0x0200000, 0x0400000, 0x0600000);
|
||||
ROM16_split_gfx("gfx_temp", "gfx", 0x0400000, 0x0200000, 0x0400000, 0x0600000);
|
||||
}
|
||||
|
||||
|
||||
@ -212,12 +209,12 @@ void gaelco2_state::coin4_counter_w(int state)
|
||||
void gaelco2_state::alighunt_coin_w(u16 data)
|
||||
{
|
||||
/* Coin Lockouts */
|
||||
machine().bookkeeping().coin_lockout_w(0, ~data & 0x01);
|
||||
machine().bookkeeping().coin_lockout_w(1, ~data & 0x02);
|
||||
machine().bookkeeping().coin_lockout_w(0, BIT(~data, 0));
|
||||
machine().bookkeeping().coin_lockout_w(1, BIT(~data, 1));
|
||||
|
||||
/* Coin Counters */
|
||||
machine().bookkeeping().coin_counter_w(0, data & 0x04);
|
||||
machine().bookkeeping().coin_counter_w(1, data & 0x08);
|
||||
machine().bookkeeping().coin_counter_w(0, BIT(data, 2));
|
||||
machine().bookkeeping().coin_counter_w(1, BIT(data, 3));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -226,27 +223,29 @@ void gaelco2_state::alighunt_coin_w(u16 data)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
void bang_state::init_bang()
|
||||
void bang_state::machine_start()
|
||||
{
|
||||
m_clr_gun_int = 0;
|
||||
gaelco2_state::machine_start();
|
||||
|
||||
save_item(NAME(m_clr_gun_int));
|
||||
}
|
||||
|
||||
void bang_state::bang_clr_gun_int_w(u16 data)
|
||||
{
|
||||
m_clr_gun_int = 1;
|
||||
m_clr_gun_int = true;
|
||||
}
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(bang_state::bang_irq)
|
||||
{
|
||||
int scanline = param;
|
||||
|
||||
if (scanline == 256){
|
||||
if (scanline == 256)
|
||||
{
|
||||
m_maincpu->set_input_line(2, HOLD_LINE);
|
||||
m_clr_gun_int = 0;
|
||||
m_clr_gun_int = false;
|
||||
}
|
||||
|
||||
if ((scanline % 64) == 0 && m_clr_gun_int)
|
||||
if (((scanline % 64) == 0) && m_clr_gun_int)
|
||||
m_maincpu->set_input_line(4, HOLD_LINE);
|
||||
}
|
||||
|
||||
@ -256,8 +255,10 @@ TIMER_DEVICE_CALLBACK_MEMBER(bang_state::bang_irq)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void gaelco2_state::init_snowboar()
|
||||
void snowboar_state::machine_start()
|
||||
{
|
||||
gaelco2_state::machine_start();
|
||||
|
||||
save_item(NAME(m_snowboard_latch));
|
||||
}
|
||||
|
||||
@ -320,14 +321,14 @@ u16 mangle(u32 x)
|
||||
return get_out(((a ^ 0x0010) - (b ^ 0x0024)) ^ 0x5496);
|
||||
}
|
||||
|
||||
u16 gaelco2_state::snowboar_protection_r()
|
||||
u16 snowboar_state::snowboar_protection_r()
|
||||
{
|
||||
u16 ret = mangle(m_snowboard_latch);
|
||||
ret = ((ret & 0xff00) >> 8) | ((ret & 0x00ff) << 8);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void gaelco2_state::snowboar_protection_w(offs_t offset, u16 data, u16 mem_mask)
|
||||
void snowboar_state::snowboar_protection_w(offs_t offset, u16 data, u16 mem_mask)
|
||||
{
|
||||
COMBINE_DATA(&m_snowboar_protection[offset]);
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
||||
Notes:
|
||||
(1) See sprite format in the sprite section
|
||||
(2) x scroll register is not taken into account when doing line scroll
|
||||
(3) See sound/gaelco.c for the sound register layout
|
||||
(3) See devices/sound/gaelco.cpp for the sound register layout
|
||||
(4) tilemaps use the memory [0x2000*bank .. 0x2000*bank + 0x1fff]
|
||||
(5) See tile format in the tilemap section
|
||||
|
||||
@ -163,11 +163,11 @@ void gaelco2_state::vram_w(offs_t offset, u16 data, u16 mem_mask)
|
||||
|
||||
COMBINE_DATA(&m_videoram[offset]);
|
||||
|
||||
/* tilemap 0 writes */
|
||||
// tilemap 0 writes
|
||||
if ((offset >= pant0_start) && (offset < pant0_end))
|
||||
m_pant[0]->mark_tile_dirty(((offset << 1) & 0x1fff) >> 2);
|
||||
|
||||
/* tilemap 1 writes */
|
||||
// tilemap 1 writes
|
||||
if ((offset >= pant1_start) && (offset < pant1_end))
|
||||
m_pant[1]->mark_tile_dirty(((offset << 1) & 0x1fff) >> 2);
|
||||
|
||||
@ -212,7 +212,7 @@ void gaelco2_state::vregs_w(offs_t offset, u16 data, u16 mem_mask)
|
||||
static constexpr u8 RGB_CHG = 0x08;
|
||||
static inline const u8 ADJUST_COLOR(s16 c) { return (c < 0) ? 0 : ((c > 255) ? 255 : c); }
|
||||
|
||||
/* table used for color adjustment */
|
||||
// table used for color adjustment
|
||||
static const s8 pen_color_adjust[16] = {
|
||||
+RGB_CHG * 0, -RGB_CHG * 1, -RGB_CHG * 2, -RGB_CHG * 3, -RGB_CHG * 4, -RGB_CHG * 5, -RGB_CHG * 6, -RGB_CHG * 7,
|
||||
+RGB_CHG * 8, +RGB_CHG * 7, +RGB_CHG * 6, +RGB_CHG * 5, +RGB_CHG * 4, +RGB_CHG * 3, +RGB_CHG * 2, +RGB_CHG * 1
|
||||
@ -224,15 +224,15 @@ void gaelco2_state::palette_w(offs_t offset, u16 data, u16 mem_mask)
|
||||
COMBINE_DATA(&m_paletteram[offset]);
|
||||
const u16 color = m_paletteram[offset];
|
||||
|
||||
/* extract RGB components */
|
||||
// extract RGB components
|
||||
const u8 r = pal5bit(color >> 10);
|
||||
const u8 g = pal5bit(color >> 5);
|
||||
const u8 b = pal5bit(color & 0x1f);
|
||||
|
||||
/* update game palette */
|
||||
// update game palette
|
||||
m_palette->set_pen_color(4096*0 + offset, rgb_t(r, g, b));
|
||||
|
||||
/* update shadow/highlight palettes */
|
||||
// update shadow/highlight palettes
|
||||
for (int i = 1; i < 16; i++)
|
||||
{
|
||||
const u8 auxr = ADJUST_COLOR(r + pen_color_adjust[i]);
|
||||
@ -253,11 +253,11 @@ VIDEO_START_MEMBER(gaelco2_state,gaelco2)
|
||||
{
|
||||
m_videoram = m_spriteram->live();
|
||||
|
||||
/* create tilemaps */
|
||||
// create tilemaps
|
||||
m_pant[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gaelco2_state::get_tile_info<0>)), TILEMAP_SCAN_ROWS, 16,16, 64,32);
|
||||
m_pant[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gaelco2_state::get_tile_info<1>)), TILEMAP_SCAN_ROWS, 16,16, 64,32);
|
||||
|
||||
/* set tilemap properties */
|
||||
// set tilemap properties
|
||||
m_pant[0]->set_transparent_pen(0);
|
||||
m_pant[1]->set_transparent_pen(0);
|
||||
|
||||
@ -266,18 +266,18 @@ VIDEO_START_MEMBER(gaelco2_state,gaelco2)
|
||||
m_pant[1]->set_scroll_rows(512);
|
||||
m_pant[1]->set_scroll_cols(1);
|
||||
|
||||
m_dual_monitor = 0;
|
||||
m_dual_monitor = false;
|
||||
}
|
||||
|
||||
VIDEO_START_MEMBER(gaelco2_state,gaelco2_dual)
|
||||
{
|
||||
m_videoram = m_spriteram->live();
|
||||
|
||||
/* create tilemaps */
|
||||
// create tilemaps
|
||||
m_pant[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gaelco2_state::get_tile_info_dual<0>)), TILEMAP_SCAN_ROWS, 16,16, 64,32);
|
||||
m_pant[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(gaelco2_state::get_tile_info_dual<1>)), TILEMAP_SCAN_ROWS, 16,16, 64,32);
|
||||
|
||||
/* set tilemap properties */
|
||||
// set tilemap properties
|
||||
m_pant[0]->set_transparent_pen(0);
|
||||
m_pant[1]->set_transparent_pen(0);
|
||||
|
||||
@ -286,7 +286,7 @@ VIDEO_START_MEMBER(gaelco2_state,gaelco2_dual)
|
||||
m_pant[1]->set_scroll_rows(512);
|
||||
m_pant[1]->set_scroll_cols(1);
|
||||
|
||||
m_dual_monitor = 1;
|
||||
m_dual_monitor = true;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -327,14 +327,14 @@ VIDEO_START_MEMBER(gaelco2_state,gaelco2_dual)
|
||||
|
||||
void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int mask)
|
||||
{
|
||||
u16 *buffered_spriteram16 = m_spriteram->buffer();
|
||||
u16 const *const buffered_spriteram16 = m_spriteram->buffer();
|
||||
gfx_element *gfx = m_gfxdecode->gfx(0);
|
||||
|
||||
/* get sprite ram start and end offsets */
|
||||
// get sprite ram start and end offsets
|
||||
const u32 start_offset = (m_vregs[1] & 0x10) * 0x100;
|
||||
const u32 end_offset = start_offset + 0x1000;
|
||||
|
||||
/* sprite offset is based on the visible area - this seems very kludgy */
|
||||
// sprite offset is based on the visible area - this seems very kludgy
|
||||
const int spr_x_adjust = (screen.visible_area().max_x - 320 + 1) - (511 - 320 - 1) - ((m_vregs[0] >> 4) & 0x01) + m_global_spritexoff;
|
||||
|
||||
for (int j = start_offset; j < end_offset; j += 8)
|
||||
@ -347,23 +347,23 @@ void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co
|
||||
const int sx = data3 & 0x3ff;
|
||||
const int sy = data2 & 0x1ff;
|
||||
|
||||
const bool xflip = data2 & 0x800;
|
||||
const bool yflip = data2 & 0x400;
|
||||
const bool xflip = BIT(data2, 11);
|
||||
const bool yflip = BIT(data2, 10);
|
||||
|
||||
const int xsize = ((data3 >> 12) & 0x0f) + 1;
|
||||
const int ysize = ((data2 >> 12) & 0x0f) + 1;
|
||||
|
||||
if (m_dual_monitor && ((data & 0x8000) != mask)) continue;
|
||||
|
||||
/* if it's enabled, draw it */
|
||||
if ((data2 & 0x0200) != 0)
|
||||
// if it's enabled, draw it
|
||||
if (BIT(data2, 9))
|
||||
{
|
||||
for (int y = 0; y < ysize; y++)
|
||||
{
|
||||
for (int x = 0; x < xsize; x++)
|
||||
{
|
||||
/* for each x,y of the sprite, fetch the sprite data */
|
||||
const u16 data5 = buffered_spriteram16[((data4 / 2) + (y*xsize + x)) & 0x7fff];
|
||||
// for each x,y of the sprite, fetch the sprite data
|
||||
const u16 data5 = buffered_spriteram16[((data4 / 2) + (y * xsize + x)) & 0x7fff];
|
||||
const u32 number = ((data & 0x1ff) << 10) + (data5 & 0x0fff);
|
||||
const u32 color = ((data >> 9) & 0x7f) + ((data5 >> 12) & 0x0f);
|
||||
const bool color_effect = m_dual_monitor ? ((color & 0x3f) == 0x3f) : (color == 0x7f);
|
||||
@ -371,23 +371,22 @@ void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co
|
||||
const int ex = xflip ? (xsize - 1 - x) : x;
|
||||
const int ey = yflip ? (ysize - 1 - y) : y;
|
||||
|
||||
/* normal sprite, pen 0 transparent */
|
||||
if (!color_effect)
|
||||
{
|
||||
{ // normal sprite, pen 0 transparent
|
||||
gfx->transpen(bitmap,cliprect, number,
|
||||
color, xflip, yflip,
|
||||
((sx + ex * 16) & 0x3ff) + spr_x_adjust,
|
||||
((sy + ey * 16) & 0x1ff), 0);
|
||||
color, xflip, yflip,
|
||||
((sx + ex * 16) & 0x3ff) + spr_x_adjust,
|
||||
((sy + ey * 16) & 0x1ff), 0);
|
||||
}
|
||||
else
|
||||
{ /* last palette entry is reserved for shadows and highlights */
|
||||
{ // last palette entry is reserved for shadows and highlights
|
||||
|
||||
/* get a pointer to the current sprite's gfx data */
|
||||
const uint8_t *gfx_src = gfx->get_data(number % gfx->elements());
|
||||
// get a pointer to the current sprite's gfx data
|
||||
u8 const *const gfx_src = gfx->get_data(number % gfx->elements());
|
||||
|
||||
for (int py = 0; py < gfx->height(); py++)
|
||||
{
|
||||
/* get a pointer to the current line in the screen bitmap */
|
||||
// get a pointer to the current line in the screen bitmap
|
||||
const int ypos = ((sy + ey * 16 + py) & 0x1ff);
|
||||
|
||||
if ((ypos < cliprect.min_y) || (ypos > cliprect.max_y)) continue;
|
||||
@ -397,13 +396,14 @@ void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co
|
||||
|
||||
for (int px = 0; px < gfx->width(); px++)
|
||||
{
|
||||
/* get current pixel */
|
||||
// get current pixel
|
||||
const int xpos = (((sx + ex * 16 + px) & 0x3ff) + spr_x_adjust) & 0x3ff;
|
||||
if ((xpos < cliprect.min_x) || (xpos > cliprect.max_x)) continue;
|
||||
if ((xpos < cliprect.min_x) || (xpos > cliprect.max_x))
|
||||
continue;
|
||||
|
||||
const int gfx_px = xflip ? (gfx->width() - 1 - px) : px;
|
||||
|
||||
/* get asociated pen for the current sprite pixel */
|
||||
// get asociated pen for the current sprite pixel
|
||||
const u8 gfx_pen = gfx_src[gfx->rowbytes() * gfx_py + gfx_px];
|
||||
|
||||
if ((gfx_pen == 0) || (gfx_pen >= 16)) continue;
|
||||
@ -411,8 +411,8 @@ void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co
|
||||
u16 *const pixel = srcy + xpos;
|
||||
const u16 src_color = *pixel;
|
||||
|
||||
/* make background color darker or brighter */
|
||||
*pixel = (src_color & 0xfff) | 0x1000*gfx_pen;
|
||||
// make background color darker or brighter
|
||||
*pixel = (src_color & 0xfff) | (0x1000 * gfx_pen);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -430,30 +430,29 @@ void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, co
|
||||
|
||||
u32 gaelco2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int xoff0 = 0x14;
|
||||
int xoff1 = xoff0 - 4;
|
||||
int yoff0 = 0x01;
|
||||
int yoff1 = 0x01;
|
||||
const int xoff0 = 0x14;
|
||||
const int xoff1 = xoff0 - 4;
|
||||
const int yoff0 = 0x01;
|
||||
const int yoff1 = 0x01;
|
||||
|
||||
/* read scroll values */
|
||||
int scroll0x = m_videoram[0x2802 / 2] + xoff0;
|
||||
int scroll1x = m_videoram[0x2806 / 2] + xoff1;
|
||||
int scroll0y = m_videoram[0x2800 / 2] + yoff0;
|
||||
int scroll1y = m_videoram[0x2804 / 2] + yoff1;
|
||||
// read scroll values
|
||||
const int scroll0x = m_videoram[0x2802 / 2] + xoff0;
|
||||
const int scroll1x = m_videoram[0x2806 / 2] + xoff1;
|
||||
const int scroll0y = m_videoram[0x2800 / 2] + yoff0;
|
||||
const int scroll1y = m_videoram[0x2804 / 2] + yoff1;
|
||||
|
||||
/* set y scroll registers */
|
||||
// set y scroll registers
|
||||
m_pant[0]->set_scrolly(0, scroll0y & 0x1ff);
|
||||
m_pant[1]->set_scrolly(0, scroll1y & 0x1ff);
|
||||
|
||||
|
||||
/* set x linescroll registers */
|
||||
// set x linescroll registers
|
||||
for (int i = 0; i < 512; i++)
|
||||
{
|
||||
m_pant[0]->set_scrollx(i & 0x1ff, (m_vregs[0] & 0x8000) ? (m_videoram[(0x2000 / 2) + i] + xoff0) & 0x3ff : scroll0x & 0x3ff);
|
||||
m_pant[1]->set_scrollx(i & 0x1ff, (m_vregs[1] & 0x8000) ? (m_videoram[(0x2400 / 2) + i] + xoff1) & 0x3ff : scroll1x & 0x3ff);
|
||||
m_pant[0]->set_scrollx(i & 0x1ff, (BIT(m_vregs[0], 15) ? (m_videoram[(0x2000 / 2) + i] + xoff0) : scroll0x) & 0x3ff);
|
||||
m_pant[1]->set_scrollx(i & 0x1ff, (BIT(m_vregs[1], 15) ? (m_videoram[(0x2400 / 2) + i] + xoff1) : scroll1x) & 0x3ff);
|
||||
}
|
||||
|
||||
/* draw screen */
|
||||
// draw screen
|
||||
bitmap.fill(0, cliprect);
|
||||
|
||||
m_pant[1]->draw(screen, bitmap, cliprect, 0, 0);
|
||||
@ -566,9 +565,9 @@ u32 gaelco2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co
|
||||
|
||||
int gaelco2_state::get_rowscrollmode_yscroll(bool first_screen)
|
||||
{
|
||||
uint16_t base = first_screen ? 0x2000 / 2 : 0x2400 / 2;
|
||||
const u16 base = first_screen ? 0x2000 / 2 : 0x2400 / 2;
|
||||
|
||||
uint8_t checkoffsets[32] = {
|
||||
const u8 checkoffsets[32] = {
|
||||
0x02, 0x0e, 0x0a, 0x1b, 0x15, 0x13, 0x04, 0x19,
|
||||
0x0c, 0x1f, 0x08, 0x1d, 0x11, 0x06, 0x17, 0x10,
|
||||
0x01, 0x0d, 0x16, 0x09, 0x1a, 0x05, 0x1e, 0x00,
|
||||
@ -577,9 +576,9 @@ int gaelco2_state::get_rowscrollmode_yscroll(bool first_screen)
|
||||
int usescroll = 0;
|
||||
for (int i = 31; i >= 0; i--)
|
||||
{
|
||||
int checkoffset = (0x80 / 2) + ((checkoffsets[i] * 3) + 1);
|
||||
const int checkoffset = (0x80 / 2) + ((checkoffsets[i] * 3) + 1);
|
||||
|
||||
if (m_videoram[(base)+checkoffset] & 0x1000)
|
||||
if (BIT(m_videoram[base + checkoffset], 12))
|
||||
{
|
||||
usescroll = 31 - i;
|
||||
}
|
||||
@ -590,43 +589,43 @@ int gaelco2_state::get_rowscrollmode_yscroll(bool first_screen)
|
||||
|
||||
u32 gaelco2_state::dual_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index)
|
||||
{
|
||||
int xoff0 = 0x14; // intro scenes align better with 0x13, but test screen is definitely 0x14
|
||||
int xoff1 = xoff0 - 4;
|
||||
int yoff0 = 0x01;
|
||||
int yoff1 = 0x01;
|
||||
const int xoff0 = 0x14; // intro scenes align better with 0x13, but test screen is definitely 0x14
|
||||
const int xoff1 = xoff0 - 4;
|
||||
const int yoff0 = 0x01;
|
||||
const int yoff1 = 0x01;
|
||||
|
||||
/* read scroll values */
|
||||
int scroll0x = m_videoram[0x2802 / 2] + xoff0;
|
||||
int scroll1x = m_videoram[0x2806 / 2] + xoff1;
|
||||
// read scroll values
|
||||
const int scroll0x = m_videoram[0x2802 / 2] + xoff0;
|
||||
const int scroll1x = m_videoram[0x2806 / 2] + xoff1;
|
||||
int scroll0y = m_videoram[0x2800 / 2] + yoff0;
|
||||
int scroll1y = m_videoram[0x2804 / 2] + yoff1;
|
||||
|
||||
if (m_vregs[0] & 0x8000)
|
||||
if (BIT(m_vregs[0], 15))
|
||||
{
|
||||
scroll0y += get_rowscrollmode_yscroll(true);
|
||||
}
|
||||
|
||||
if (m_vregs[1] & 0x8000)
|
||||
if (BIT(m_vregs[1], 15))
|
||||
{
|
||||
scroll1y += get_rowscrollmode_yscroll(false);
|
||||
}
|
||||
|
||||
/* set y scroll registers */
|
||||
// set y scroll registers
|
||||
m_pant[0]->set_scrolly(0, scroll0y & 0x1ff);
|
||||
m_pant[1]->set_scrolly(0, scroll1y & 0x1ff);
|
||||
|
||||
/* set x linescroll registers */
|
||||
// set x linescroll registers
|
||||
for (int i = 0; i < 512; i++)
|
||||
{
|
||||
m_pant[0]->set_scrollx(i & 0x1ff, (m_vregs[0] & 0x8000) ? (m_videoram[(0x2000 / 2) + i] + xoff0) & 0x3ff : scroll0x & 0x3ff);
|
||||
m_pant[1]->set_scrollx(i & 0x1ff, (m_vregs[1] & 0x8000) ? (m_videoram[(0x2400 / 2) + i] + xoff1) & 0x3ff : scroll1x & 0x3ff);
|
||||
m_pant[0]->set_scrollx(i & 0x1ff, (BIT(m_vregs[0], 15) ? (m_videoram[(0x2000 / 2) + i] + xoff0) : scroll0x) & 0x3ff);
|
||||
m_pant[1]->set_scrollx(i & 0x1ff, (BIT(m_vregs[1], 15) ? (m_videoram[(0x2400 / 2) + i] + xoff1) : scroll1x) & 0x3ff);
|
||||
}
|
||||
|
||||
/* draw screen */
|
||||
// draw screen
|
||||
bitmap.fill(0, cliprect);
|
||||
|
||||
m_pant[index]->draw(screen, bitmap, cliprect, 0, 0);
|
||||
draw_sprites(screen,bitmap,cliprect, 0x8000 * index);
|
||||
draw_sprites(screen, bitmap, cliprect, 0x8000 * index);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user