mirror of
https://github.com/holub/mame
synced 2025-04-23 17:00:53 +03:00
mame/cvs: created a base class from which cvs.cpp, galaxia.cpp and quasar.cpp derive
This commit is contained in:
parent
7354b0b1fb
commit
2a7fdcf1ef
File diff suppressed because it is too large
Load Diff
@ -1,164 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Mike Coates, Couriersud
|
||||
/***************************************************************************
|
||||
|
||||
Century CVS System
|
||||
|
||||
****************************************************************************/
|
||||
#ifndef MAME_CVS_CVS_H
|
||||
#define MAME_CVS_CVS_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cpu/s2650/s2650.h"
|
||||
#include "machine/gen_latch.h"
|
||||
#include "machine/s2636.h"
|
||||
#include "sound/dac.h"
|
||||
#include "sound/tms5110.h"
|
||||
#include "emupal.h"
|
||||
#include "screen.h"
|
||||
|
||||
#define CVS_S2636_Y_OFFSET (-5)
|
||||
#define CVS_S2636_X_OFFSET (-26)
|
||||
#define CVS_MAX_STARS 250
|
||||
|
||||
class cvs_state : public driver_device
|
||||
{
|
||||
public:
|
||||
cvs_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_video_ram(*this, "video_ram")
|
||||
, m_bullet_ram(*this, "bullet_ram")
|
||||
, m_cvs_4_bit_dac_data(*this, "4bit_dac")
|
||||
, m_tms5110_ctl_data(*this, "tms5110_ctl")
|
||||
, m_dac3_state(*this, "dac3_state")
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_audiocpu(*this, "audiocpu")
|
||||
, m_speechcpu(*this, "speechcpu")
|
||||
, m_dac2(*this, "dac2")
|
||||
, m_dac3(*this, "dac3")
|
||||
, m_tms5110(*this, "tms")
|
||||
, m_s2636(*this, "s2636%u", 0U)
|
||||
, m_gfxdecode(*this, "gfxdecode")
|
||||
, m_screen(*this, "screen")
|
||||
, m_palette(*this, "palette")
|
||||
, m_soundlatch(*this, "soundlatch")
|
||||
, m_lamps(*this, "lamp%u", 1U)
|
||||
, m_color_ram(*this, "color_ram", 0x400, ENDIANNESS_BIG)
|
||||
, m_palette_ram(*this, "palette_ram", 0x10, ENDIANNESS_BIG)
|
||||
, m_character_ram(*this, "character_ram", 3 * 0x800, ENDIANNESS_BIG)
|
||||
{ }
|
||||
|
||||
void init_raiders();
|
||||
void init_huncholy();
|
||||
void init_hero();
|
||||
void init_superbik();
|
||||
void init_hunchbaka();
|
||||
void cvs(machine_config &config);
|
||||
|
||||
protected:
|
||||
DECLARE_WRITE_LINE_MEMBER(write_s2650_flag); // used by galaxia_state
|
||||
uint8_t huncholy_prot_r(offs_t offset);
|
||||
uint8_t superbik_prot_r();
|
||||
uint8_t hero_prot_r(offs_t offset);
|
||||
DECLARE_READ_LINE_MEMBER(speech_rom_read_bit);
|
||||
DECLARE_WRITE_LINE_MEMBER(cvs_slave_cpu_interrupt);
|
||||
uint8_t cvs_input_r(offs_t offset);
|
||||
void cvs_speech_rom_address_lo_w(uint8_t data);
|
||||
void cvs_speech_rom_address_hi_w(uint8_t data);
|
||||
uint8_t cvs_speech_command_r();
|
||||
void audio_command_w(uint8_t data);
|
||||
uint8_t cvs_video_or_color_ram_r(offs_t offset);
|
||||
void cvs_video_or_color_ram_w(offs_t offset, uint8_t data);
|
||||
uint8_t cvs_bullet_ram_or_palette_r(offs_t offset);
|
||||
void cvs_bullet_ram_or_palette_w(offs_t offset, uint8_t data);
|
||||
uint8_t cvs_s2636_0_or_character_ram_r(offs_t offset);
|
||||
void cvs_s2636_0_or_character_ram_w(offs_t offset, uint8_t data);
|
||||
uint8_t cvs_s2636_1_or_character_ram_r(offs_t offset);
|
||||
void cvs_s2636_1_or_character_ram_w(offs_t offset, uint8_t data);
|
||||
uint8_t cvs_s2636_2_or_character_ram_r(offs_t offset);
|
||||
void cvs_s2636_2_or_character_ram_w(offs_t offset, uint8_t data);
|
||||
void cvs_video_fx_w(uint8_t data);
|
||||
uint8_t cvs_collision_r();
|
||||
uint8_t cvs_collision_clear();
|
||||
void cvs_scroll_w(uint8_t data);
|
||||
DECLARE_READ_LINE_MEMBER(tms_clock_r);
|
||||
void cvs_4_bit_dac_data_w(offs_t offset, uint8_t data);
|
||||
void cvs_unknown_w(offs_t offset, uint8_t data);
|
||||
void cvs_tms5110_ctl_w(offs_t offset, uint8_t data);
|
||||
void cvs_tms5110_pdc_w(offs_t offset, uint8_t data);
|
||||
void cvs_palette(palette_device &palette) const;
|
||||
uint32_t screen_update_cvs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(cvs_main_cpu_interrupt);
|
||||
TIMER_CALLBACK_MEMBER(cvs_393hz_timer_cb);
|
||||
void set_pens();
|
||||
void cvs_scroll_stars();
|
||||
void cvs_init_stars();
|
||||
void cvs_update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, const pen_t star_pen, bool update_always);
|
||||
void start_393hz_timer();
|
||||
void cvs_dac_cpu_map(address_map &map);
|
||||
void cvs_main_cpu_data_map(address_map &map);
|
||||
void cvs_main_cpu_io_map(address_map &map);
|
||||
void cvs_main_cpu_map(address_map &map);
|
||||
void cvs_speech_cpu_map(address_map &map);
|
||||
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
|
||||
/* memory pointers */
|
||||
required_shared_ptr<uint8_t> m_video_ram;
|
||||
required_shared_ptr<uint8_t> m_bullet_ram;
|
||||
optional_shared_ptr<uint8_t> m_cvs_4_bit_dac_data;
|
||||
optional_shared_ptr<uint8_t> m_tms5110_ctl_data;
|
||||
optional_shared_ptr<uint8_t> m_dac3_state;
|
||||
|
||||
/* video-related */
|
||||
struct cvs_star
|
||||
{
|
||||
int x = 0, y = 0, code = 0;
|
||||
};
|
||||
|
||||
cvs_star m_stars[CVS_MAX_STARS]{};
|
||||
bitmap_ind16 m_collision_background = 0;
|
||||
bitmap_ind16 m_background_bitmap = 0;
|
||||
bitmap_ind16 m_scrolled_collision_background = 0;
|
||||
int m_collision_register = 0;
|
||||
int m_total_stars = 0;
|
||||
int m_stars_on = 0;
|
||||
uint8_t m_scroll_reg = 0U;
|
||||
int m_stars_scroll = 0;
|
||||
|
||||
/* misc */
|
||||
int m_s2650_flag = 0;
|
||||
emu_timer *m_cvs_393hz_timer = nullptr;
|
||||
uint8_t m_cvs_393hz_clock = 0U;
|
||||
uint8_t m_protection_counter = 0U;
|
||||
|
||||
uint8_t m_character_banking_mode = 0U;
|
||||
uint16_t m_character_ram_page_start = 0U;
|
||||
uint16_t m_speech_rom_bit_address = 0U;
|
||||
|
||||
/* devices */
|
||||
required_device<s2650_device> m_maincpu;
|
||||
optional_device<s2650_device> m_audiocpu;
|
||||
optional_device<s2650_device> m_speechcpu;
|
||||
optional_device<dac_byte_interface> m_dac2;
|
||||
optional_device<dac_bit_interface> m_dac3;
|
||||
optional_device<tms5110_device> m_tms5110;
|
||||
optional_device_array<s2636_device, 3> m_s2636;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
optional_device<generic_latch_8_device> m_soundlatch;
|
||||
output_finder<2> m_lamps;
|
||||
|
||||
/* memory */
|
||||
memory_share_creator<uint8_t> m_color_ram;
|
||||
memory_share_creator<uint8_t> m_palette_ram;
|
||||
memory_share_creator<uint8_t> m_character_ram; /* only half is used, but
|
||||
by allocating twice the amount,
|
||||
we can use the same gfx_layout */
|
||||
};
|
||||
|
||||
#endif // MAME_CVS_CVS_H
|
104
src/mame/cvs/cvs_base.cpp
Normal file
104
src/mame/cvs/cvs_base.cpp
Normal file
@ -0,0 +1,104 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders: Mike Coates, Couriersud
|
||||
|
||||
// common methods shared by Century CVS and derived hardware
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
#include "cvs_base.h"
|
||||
|
||||
|
||||
void cvs_base_state::machine_start()
|
||||
{
|
||||
// register state save
|
||||
save_item(NAME(m_collision_register));
|
||||
save_item(NAME(m_stars_scroll));
|
||||
}
|
||||
|
||||
void cvs_base_state::machine_reset()
|
||||
{
|
||||
m_collision_register = 0;
|
||||
m_stars_scroll = 0;
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(cvs_base_state::write_s2650_flag) // TODO: remove once set_memview is available via devcb
|
||||
{
|
||||
m_ram_view.select(state);
|
||||
}
|
||||
|
||||
uint8_t cvs_base_state::collision_r()
|
||||
{
|
||||
return m_collision_register;
|
||||
}
|
||||
|
||||
uint8_t cvs_base_state::collision_clear()
|
||||
{
|
||||
m_collision_register = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// cvs stars hardware
|
||||
|
||||
void cvs_base_state::scroll_start()
|
||||
{
|
||||
m_stars_scroll++;
|
||||
}
|
||||
|
||||
void cvs_base_state::init_stars()
|
||||
{
|
||||
int generator = 0;
|
||||
|
||||
// precalculate the star background
|
||||
|
||||
m_total_stars = 0;
|
||||
|
||||
for (int y = 255; y >= 0; y--)
|
||||
{
|
||||
for (int x = 511; x >= 0; x--)
|
||||
{
|
||||
generator <<= 1;
|
||||
int const bit1 = (~generator >> 17) & 1;
|
||||
int const bit2 = (generator >> 5) & 1;
|
||||
|
||||
if (bit1 ^ bit2)
|
||||
generator |= 1;
|
||||
|
||||
if (((~generator >> 16) & 1) && (generator & 0xfe) == 0xfe)
|
||||
{
|
||||
if(((~(generator >> 12)) & 0x01) && ((~(generator >> 13)) & 0x01))
|
||||
{
|
||||
if (m_total_stars < CVS_MAX_STARS)
|
||||
{
|
||||
m_stars[m_total_stars].x = x;
|
||||
m_stars[m_total_stars].y = y;
|
||||
m_stars[m_total_stars].code = 1;
|
||||
|
||||
m_total_stars++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cvs_base_state::update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, const pen_t star_pen, bool update_always)
|
||||
{
|
||||
for (int offs = 0; offs < m_total_stars; offs++)
|
||||
{
|
||||
uint8_t x = (m_stars[offs].x + m_stars_scroll) >> 1;
|
||||
uint8_t y = m_stars[offs].y + ((m_stars_scroll + m_stars[offs].x) >> 9);
|
||||
|
||||
if ((y & 1) ^ ((x >> 4) & 1))
|
||||
{
|
||||
if (flip_screen_x())
|
||||
x = ~x;
|
||||
|
||||
if (flip_screen_y())
|
||||
y = ~y;
|
||||
|
||||
if ((y >= cliprect.top()) && (y <= cliprect.bottom()) &&
|
||||
(update_always || (m_palette->pen_indirect(bitmap.pix(y, x)) == 0)))
|
||||
bitmap.pix(y, x) = star_pen;
|
||||
}
|
||||
}
|
||||
}
|
85
src/mame/cvs/cvs_base.h
Normal file
85
src/mame/cvs/cvs_base.h
Normal file
@ -0,0 +1,85 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders: Mike Coates, Couriersud
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Century CVS System
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef MAME_CVS_CVS_BASE_H
|
||||
#define MAME_CVS_CVS_BASE_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cpu/s2650/s2650.h"
|
||||
#include "machine/gen_latch.h"
|
||||
#include "machine/s2636.h"
|
||||
#include "sound/dac.h"
|
||||
#include "sound/tms5110.h"
|
||||
|
||||
#include "emupal.h"
|
||||
#include "screen.h"
|
||||
|
||||
|
||||
class cvs_base_state : public driver_device
|
||||
{
|
||||
public:
|
||||
cvs_base_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_bullet_ram(*this, "bullet_ram")
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_s2636(*this, "s2636%u", 0U)
|
||||
, m_gfxdecode(*this, "gfxdecode")
|
||||
, m_screen(*this, "screen")
|
||||
, m_palette(*this, "palette")
|
||||
, m_video_ram(*this, "video_ram", 0x400, ENDIANNESS_BIG)
|
||||
, m_color_ram(*this, "color_ram", 0x400, ENDIANNESS_BIG)
|
||||
, m_ram_view(*this, "video_color_ram_view")
|
||||
{ }
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override ATTR_COLD;
|
||||
virtual void machine_reset() override ATTR_COLD;
|
||||
|
||||
// memory pointers
|
||||
required_shared_ptr<uint8_t> m_bullet_ram;
|
||||
|
||||
// video-related
|
||||
static constexpr uint8_t CVS_MAX_STARS = 250;
|
||||
static constexpr int8_t CVS_S2636_Y_OFFSET = -5;
|
||||
static constexpr int8_t CVS_S2636_X_OFFSET = -26;
|
||||
|
||||
struct cvs_star
|
||||
{
|
||||
int x = 0, y = 0, code = 0;
|
||||
};
|
||||
|
||||
cvs_star m_stars[CVS_MAX_STARS]{};
|
||||
bitmap_ind16 m_collision_background = 0;
|
||||
uint8_t m_collision_register = 0U;
|
||||
uint16_t m_total_stars = 0U;
|
||||
int32_t m_stars_scroll = 0U;
|
||||
|
||||
// devices
|
||||
required_device<s2650_device> m_maincpu;
|
||||
optional_device_array<s2636_device, 3> m_s2636;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
// memory
|
||||
memory_share_creator<uint8_t> m_video_ram;
|
||||
memory_share_creator<uint8_t> m_color_ram;
|
||||
|
||||
memory_view m_ram_view;
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(write_s2650_flag);
|
||||
uint8_t collision_r();
|
||||
uint8_t collision_clear();
|
||||
void scroll_start();
|
||||
void init_stars() ATTR_COLD;
|
||||
void update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, const pen_t star_pen, bool update_always);
|
||||
};
|
||||
|
||||
#endif // MAME_CVS_CVS_BASE_H
|
@ -1,324 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Mike Coates, Couriersud
|
||||
/***************************************************************************
|
||||
|
||||
video\cvs.cpp
|
||||
|
||||
Functions to emulate the video hardware of the machine.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/s2650/s2650.h"
|
||||
#include "cvs.h"
|
||||
|
||||
|
||||
#define SPRITE_PEN_BASE (0x820)
|
||||
#define BULLET_STAR_PEN (0x828)
|
||||
|
||||
|
||||
/******************************************************
|
||||
* Convert Colour prom to format for Mame Colour Map *
|
||||
* *
|
||||
* There is a prom used for colour mapping and plane *
|
||||
* priority. This is converted to a colour table here *
|
||||
* *
|
||||
* colours are taken from SRAM and are programmable *
|
||||
******************************************************/
|
||||
|
||||
void cvs_state::cvs_palette(palette_device &palette) const
|
||||
{
|
||||
uint8_t const *const color_prom = memregion("proms")->base();
|
||||
|
||||
// color mapping PROM
|
||||
for (int attr = 0; attr < 0x100; attr++)
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
uint8_t ctabentry = color_prom[(i << 8) | attr] & 0x07;
|
||||
|
||||
// bits 0 and 2 are swapped
|
||||
ctabentry = bitswap<8>(ctabentry, 7, 6, 5, 4, 3, 0, 1, 2);
|
||||
|
||||
palette.set_pen_indirect((attr << 3) | i, ctabentry);
|
||||
}
|
||||
}
|
||||
|
||||
// background collision map
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
palette.set_pen_indirect(0x800 + i, 0);
|
||||
palette.set_pen_indirect(0x808 + i, i & 0x04);
|
||||
palette.set_pen_indirect(0x810 + i, i & 0x02);
|
||||
palette.set_pen_indirect(0x818 + i, i & 0x06);
|
||||
}
|
||||
|
||||
// sprites
|
||||
for (int i = 0; i < 8; i++)
|
||||
palette.set_pen_indirect(SPRITE_PEN_BASE + i, i | 0x08);
|
||||
|
||||
// bullet
|
||||
palette.set_pen_indirect(BULLET_STAR_PEN, 7);
|
||||
}
|
||||
|
||||
|
||||
void cvs_state::set_pens( )
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 0x10; i++)
|
||||
{
|
||||
int r = pal2bit(~m_palette_ram[i] >> 0);
|
||||
int g = pal3bit(~m_palette_ram[i] >> 2);
|
||||
int b = pal3bit(~m_palette_ram[i] >> 5);
|
||||
|
||||
m_palette->set_indirect_color(i, rgb_t(r, g, b));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void cvs_state::cvs_video_fx_w(uint8_t data)
|
||||
{
|
||||
if (data & 0xce)
|
||||
logerror("%4x : CVS: Unimplemented CVS video fx = %2x\n",m_maincpu->pc(), data & 0xce);
|
||||
|
||||
m_stars_on = data & 0x01;
|
||||
|
||||
if (data & 0x02) logerror(" SHADE BRIGHTER TO RIGHT\n");
|
||||
if (data & 0x04) logerror(" SCREEN ROTATE\n");
|
||||
if (data & 0x08) logerror(" SHADE BRIGHTER TO LEFT\n");
|
||||
|
||||
m_lamps[0] = BIT(data, 4); /* lamp 1 */
|
||||
m_lamps[1] = BIT(data, 5); /* lamp 2 */
|
||||
|
||||
if (data & 0x40) logerror(" SHADE BRIGHTER TO BOTTOM\n");
|
||||
if (data & 0x80) logerror(" SHADE BRIGHTER TO TOP\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint8_t cvs_state::cvs_collision_r()
|
||||
{
|
||||
return m_collision_register;
|
||||
}
|
||||
|
||||
uint8_t cvs_state::cvs_collision_clear()
|
||||
{
|
||||
m_collision_register = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void cvs_state::cvs_scroll_w(uint8_t data)
|
||||
{
|
||||
m_scroll_reg = 255 - data;
|
||||
}
|
||||
|
||||
|
||||
void cvs_state::video_start()
|
||||
{
|
||||
cvs_init_stars();
|
||||
|
||||
/* create helper bitmaps */
|
||||
m_screen->register_screen_bitmap(m_background_bitmap);
|
||||
m_screen->register_screen_bitmap(m_collision_background);
|
||||
m_screen->register_screen_bitmap(m_scrolled_collision_background);
|
||||
|
||||
/* register save */
|
||||
save_item(NAME(m_background_bitmap));
|
||||
save_item(NAME(m_collision_background));
|
||||
save_item(NAME(m_scrolled_collision_background));
|
||||
}
|
||||
|
||||
|
||||
uint32_t cvs_state::screen_update_cvs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
static const int ram_based_char_start_indices[] = { 0xe0, 0xc0, 0x100, 0x80 };
|
||||
int scroll[8];
|
||||
|
||||
set_pens();
|
||||
|
||||
/* draw the background */
|
||||
for (offs_t offs = 0; offs < 0x0400; offs++)
|
||||
{
|
||||
int collision_color = 0x100;
|
||||
uint8_t code = m_video_ram[offs];
|
||||
uint8_t color = m_color_ram[offs];
|
||||
|
||||
uint8_t x = offs << 3;
|
||||
uint8_t y = offs >> 5 << 3;
|
||||
|
||||
int gfxnum = (code < ram_based_char_start_indices[m_character_banking_mode]) ? 0 : 1;
|
||||
|
||||
m_gfxdecode->gfx(gfxnum)->opaque(m_background_bitmap,m_background_bitmap.cliprect(),
|
||||
code, color,
|
||||
0, 0,
|
||||
x, y);
|
||||
|
||||
/* foreground for collision detection */
|
||||
if (color & 0x80)
|
||||
collision_color = 0x103;
|
||||
else
|
||||
{
|
||||
if ((color & 0x03) == 0x03)
|
||||
collision_color = 0x101;
|
||||
else if ((color & 0x01) == 0)
|
||||
collision_color = 0x102;
|
||||
}
|
||||
|
||||
m_gfxdecode->gfx(gfxnum)->opaque(m_collision_background,m_collision_background.cliprect(),
|
||||
code, collision_color,
|
||||
0, 0,
|
||||
x, y);
|
||||
}
|
||||
|
||||
|
||||
/* Update screen - 8 regions, fixed scrolling area */
|
||||
scroll[0] = 0;
|
||||
scroll[1] = m_scroll_reg;
|
||||
scroll[2] = m_scroll_reg;
|
||||
scroll[3] = m_scroll_reg;
|
||||
scroll[4] = m_scroll_reg;
|
||||
scroll[5] = m_scroll_reg;
|
||||
scroll[6] = 0;
|
||||
scroll[7] = 0;
|
||||
|
||||
copyscrollbitmap(bitmap, m_background_bitmap, 0, nullptr, 8, scroll, cliprect);
|
||||
copyscrollbitmap(m_scrolled_collision_background, m_collision_background, 0, nullptr, 8, scroll, cliprect);
|
||||
|
||||
/* update the S2636 chips */
|
||||
bitmap_ind16 const &s2636_0_bitmap = m_s2636[0]->update(cliprect);
|
||||
bitmap_ind16 const &s2636_1_bitmap = m_s2636[1]->update(cliprect);
|
||||
bitmap_ind16 const &s2636_2_bitmap = m_s2636[2]->update(cliprect);
|
||||
|
||||
/* Bullet Hardware */
|
||||
for (offs_t offs = 8; offs < 256; offs++ )
|
||||
{
|
||||
if (m_bullet_ram[offs] != 0)
|
||||
{
|
||||
for (int ct = 0; ct < 4; ct++)
|
||||
{
|
||||
int bx = 255 - 7 - m_bullet_ram[offs] - ct;
|
||||
|
||||
/* Bullet/Object Collision */
|
||||
if ((s2636_0_bitmap.pix(offs, bx) != 0) ||
|
||||
(s2636_1_bitmap.pix(offs, bx) != 0) ||
|
||||
(s2636_2_bitmap.pix(offs, bx) != 0))
|
||||
m_collision_register |= 0x08;
|
||||
|
||||
/* Bullet/Background Collision */
|
||||
if (m_palette->pen_indirect(m_scrolled_collision_background.pix(offs, bx)))
|
||||
m_collision_register |= 0x80;
|
||||
|
||||
bitmap.pix(offs, bx) = BULLET_STAR_PEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* mix and copy the S2636 images into the main bitmap, also check for collision */
|
||||
for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
|
||||
{
|
||||
for (int x = cliprect.left(); x <= cliprect.right(); x++)
|
||||
{
|
||||
int pixel0 = s2636_0_bitmap.pix(y, x);
|
||||
int pixel1 = s2636_1_bitmap.pix(y, x);
|
||||
int pixel2 = s2636_2_bitmap.pix(y, x);
|
||||
|
||||
int pixel = pixel0 | pixel1 | pixel2;
|
||||
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel))
|
||||
{
|
||||
bitmap.pix(y, x) = SPRITE_PEN_BASE + S2636_PIXEL_COLOR(pixel);
|
||||
|
||||
/* S2636 vs. S2636 collision detection */
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x01;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel1) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x04;
|
||||
|
||||
/* S2636 vs. background collision detection */
|
||||
if (m_palette->pen_indirect(m_scrolled_collision_background.pix(y, x)))
|
||||
{
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x10;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x20;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x40;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* stars circuit */
|
||||
if (m_stars_on)
|
||||
cvs_update_stars(bitmap, cliprect, BULLET_STAR_PEN, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* cvs stars hardware */
|
||||
|
||||
void cvs_state::cvs_scroll_stars( )
|
||||
{
|
||||
m_stars_scroll++;
|
||||
}
|
||||
|
||||
void cvs_state::cvs_init_stars( )
|
||||
{
|
||||
int generator = 0;
|
||||
|
||||
/* precalculate the star background */
|
||||
|
||||
m_total_stars = 0;
|
||||
|
||||
for (int y = 255; y >= 0; y--)
|
||||
{
|
||||
for (int x = 511; x >= 0; x--)
|
||||
{
|
||||
generator <<= 1;
|
||||
int const bit1 = (~generator >> 17) & 1;
|
||||
int const bit2 = (generator >> 5) & 1;
|
||||
|
||||
if (bit1 ^ bit2)
|
||||
generator |= 1;
|
||||
|
||||
if (((~generator >> 16) & 1) && (generator & 0xfe) == 0xfe)
|
||||
{
|
||||
if(((~(generator >> 12)) & 0x01) && ((~(generator >> 13)) & 0x01))
|
||||
{
|
||||
if (m_total_stars < CVS_MAX_STARS)
|
||||
{
|
||||
m_stars[m_total_stars].x = x;
|
||||
m_stars[m_total_stars].y = y;
|
||||
m_stars[m_total_stars].code = 1;
|
||||
|
||||
m_total_stars++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cvs_state::cvs_update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, const pen_t star_pen, bool update_always)
|
||||
{
|
||||
for (int offs = 0; offs < m_total_stars; offs++)
|
||||
{
|
||||
uint8_t x = (m_stars[offs].x + m_stars_scroll) >> 1;
|
||||
uint8_t y = m_stars[offs].y + ((m_stars_scroll + m_stars[offs].x) >> 9);
|
||||
|
||||
if ((y & 1) ^ ((x >> 4) & 1))
|
||||
{
|
||||
if (flip_screen_x())
|
||||
x = ~x;
|
||||
|
||||
if (flip_screen_y())
|
||||
y = ~y;
|
||||
|
||||
if ((y >= cliprect.top()) && (y <= cliprect.bottom()) &&
|
||||
(update_always || (m_palette->pen_indirect(bitmap.pix(y, x)) == 0)))
|
||||
bitmap.pix(y, x) = star_pen;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:David Haywood, hap
|
||||
// copyright-holders: David Haywood, hap
|
||||
|
||||
/*
|
||||
|
||||
Galaxia by Zaccaria (1979)
|
||||
@ -76,19 +77,294 @@ TODO:
|
||||
*/
|
||||
|
||||
#include "emu.h"
|
||||
#include "galaxia.h"
|
||||
|
||||
#include "machine/s2636.h"
|
||||
#include "cpu/s2650/s2650.h"
|
||||
#include "cvs_base.h"
|
||||
|
||||
#include "speaker.h"
|
||||
#include "tilemap.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
class galaxia_state : public cvs_base_state
|
||||
{
|
||||
public:
|
||||
galaxia_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: cvs_base_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
void galaxia(machine_config &config) ATTR_COLD;
|
||||
|
||||
void init_common() ATTR_COLD;
|
||||
|
||||
protected:
|
||||
virtual void video_start() override ATTR_COLD;
|
||||
|
||||
tilemap_t *m_bg_tilemap = nullptr;
|
||||
|
||||
template <uint8_t Which> void video_w(offs_t offset, uint8_t data);
|
||||
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
|
||||
void data_map(address_map &map) ATTR_COLD;
|
||||
void io_map(address_map &map) ATTR_COLD;
|
||||
|
||||
private:
|
||||
void scroll_w(uint8_t data);
|
||||
void ctrlport_w(uint8_t data);
|
||||
void dataport_w(uint8_t data);
|
||||
uint8_t collision_r();
|
||||
uint8_t collision_clear();
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
void palette(palette_device &palette) const ATTR_COLD;
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void mem_map(address_map &map) ATTR_COLD;
|
||||
};
|
||||
|
||||
class astrowar_state : public galaxia_state
|
||||
{
|
||||
public:
|
||||
astrowar_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: galaxia_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
void astrowar(machine_config &config) ATTR_COLD;
|
||||
|
||||
protected:
|
||||
virtual void video_start() override ATTR_COLD;
|
||||
|
||||
private:
|
||||
bitmap_ind16 m_temp_bitmap;
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
void palette(palette_device &palette) const ATTR_COLD;
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void mem_map(address_map &map) ATTR_COLD;
|
||||
};
|
||||
|
||||
|
||||
// video
|
||||
|
||||
static constexpr uint8_t SPRITE_PEN_BASE = 0x10;
|
||||
static constexpr uint8_t STAR_PEN = 0x18;
|
||||
static constexpr uint8_t BULLET_PEN = 0x19;
|
||||
|
||||
|
||||
// Colors are 3bpp, but how they are generated is a mystery
|
||||
// there's no color PROM on the PCB, nor palette RAM
|
||||
|
||||
void galaxia_state::palette(palette_device &palette) const
|
||||
{
|
||||
// estimated with video/photo references
|
||||
constexpr int lut_clr[0x18] = {
|
||||
// background
|
||||
0, 1, 4, 5,
|
||||
0, 3, 6, 2,
|
||||
0, 1, 4, 5, // unused?
|
||||
0, 3, 1, 7,
|
||||
|
||||
// sprites
|
||||
0, 4, 3, 6, 1, 5, 2, 7
|
||||
};
|
||||
|
||||
for (int i = 0; i < 0x18; i++)
|
||||
palette.set_pen_color(i, pal1bit(lut_clr[i] >> 0), pal1bit(lut_clr[i] >> 1), pal1bit(lut_clr[i] >> 2));
|
||||
|
||||
// stars/bullets
|
||||
palette.set_pen_color(STAR_PEN, pal1bit(1), pal1bit(1), pal1bit(1));
|
||||
palette.set_pen_color(BULLET_PEN, pal1bit(1), pal1bit(1), pal1bit(0));
|
||||
}
|
||||
|
||||
void astrowar_state::palette(palette_device &palette) const
|
||||
{
|
||||
// no reference material available(?), except for Data East astrof
|
||||
constexpr int lut_clr[8] = { 7, 3, 5, 1, 4, 2, 6, 7 };
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
// background
|
||||
palette.set_pen_color(i * 2, 0, 0, 0);
|
||||
palette.set_pen_color(i * 2 + 1, pal1bit(lut_clr[i] >> 0), pal1bit(lut_clr[i] >> 1), pal1bit(lut_clr[i] >> 2));
|
||||
|
||||
// sprites
|
||||
palette.set_pen_color(i | SPRITE_PEN_BASE, pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
|
||||
}
|
||||
|
||||
// stars/bullets
|
||||
palette.set_pen_color(STAR_PEN, pal1bit(1), pal1bit(1), pal1bit(1));
|
||||
palette.set_pen_color(BULLET_PEN, pal1bit(1), pal1bit(1), pal1bit(0));
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(galaxia_state::get_bg_tile_info)
|
||||
{
|
||||
uint8_t code = m_video_ram[tile_index] & 0x7f; // d7 unused
|
||||
uint8_t color = m_color_ram[tile_index] & 3; // highest bits unused
|
||||
|
||||
tileinfo.set(0, code, color, 0);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(astrowar_state::get_bg_tile_info)
|
||||
{
|
||||
uint8_t code = m_video_ram[tile_index];
|
||||
uint8_t color = m_color_ram[tile_index] & 7; // highest bits unused
|
||||
|
||||
tileinfo.set(0, code, color, 0);
|
||||
}
|
||||
|
||||
void galaxia_state::init_common()
|
||||
{
|
||||
assert((STAR_PEN & 7) == 0);
|
||||
init_stars();
|
||||
}
|
||||
|
||||
void galaxia_state::video_start()
|
||||
{
|
||||
init_common();
|
||||
|
||||
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(galaxia_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
m_bg_tilemap->set_transparent_pen(0);
|
||||
m_bg_tilemap->set_scroll_cols(8);
|
||||
|
||||
}
|
||||
|
||||
void astrowar_state::video_start()
|
||||
{
|
||||
init_common();
|
||||
|
||||
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(astrowar_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
m_bg_tilemap->set_transparent_pen(0);
|
||||
m_bg_tilemap->set_scroll_cols(8);
|
||||
m_bg_tilemap->set_scrolldx(8, 8);
|
||||
|
||||
m_screen->register_screen_bitmap(m_temp_bitmap);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************************/
|
||||
|
||||
uint32_t galaxia_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
bitmap_ind16 const &s2636_0_bitmap = m_s2636[0]->update(cliprect);
|
||||
bitmap_ind16 const &s2636_1_bitmap = m_s2636[1]->update(cliprect);
|
||||
bitmap_ind16 const &s2636_2_bitmap = m_s2636[2]->update(cliprect);
|
||||
|
||||
bitmap.fill(0, cliprect);
|
||||
update_stars(bitmap, cliprect, STAR_PEN, 1);
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
|
||||
for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
|
||||
{
|
||||
for (int x = cliprect.left(); x <= cliprect.right(); x++)
|
||||
{
|
||||
bool const bullet = m_bullet_ram[y] && x == (m_bullet_ram[y] ^ 0xff);
|
||||
bool const background = (bitmap.pix(y, x) & 3) != 0;
|
||||
|
||||
// draw bullets (guesswork)
|
||||
if (bullet)
|
||||
{
|
||||
// background vs. bullet collision detection
|
||||
if (background) m_collision_register |= 0x80;
|
||||
|
||||
// bullet size/color/priority is guessed
|
||||
bitmap.pix(y, x) = BULLET_PEN;
|
||||
if (x) bitmap.pix(y, x - 1) = BULLET_PEN;
|
||||
}
|
||||
|
||||
// copy the S2636 images into the main bitmap and check collision
|
||||
int const pixel0 = s2636_0_bitmap.pix(y, x);
|
||||
int const pixel1 = s2636_1_bitmap.pix(y, x);
|
||||
int const pixel2 = s2636_2_bitmap.pix(y, x);
|
||||
|
||||
int const pixel = pixel0 | pixel1 | pixel2;
|
||||
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel))
|
||||
{
|
||||
// S2636 vs. S2636 collision detection
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x01;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel1) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel2) && S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x04;
|
||||
|
||||
// S2636 vs. bullet collision detection
|
||||
if (bullet) m_collision_register |= 0x08;
|
||||
|
||||
// S2636 vs. background collision detection
|
||||
if (background)
|
||||
{
|
||||
/* bit4 causes problems on 2nd level
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x10; */
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x20;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x40;
|
||||
}
|
||||
|
||||
bitmap.pix(y, x) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uint32_t astrowar_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
// astrowar has only one S2636
|
||||
bitmap_ind16 const &s2636_0_bitmap = m_s2636[0]->update(cliprect);
|
||||
|
||||
bitmap.fill(0, cliprect);
|
||||
update_stars(bitmap, cliprect, STAR_PEN, 1);
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
copybitmap(m_temp_bitmap, bitmap, 0, 0, 0, 0, cliprect);
|
||||
|
||||
for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
|
||||
{
|
||||
// draw bullets (guesswork)
|
||||
if (m_bullet_ram[y])
|
||||
{
|
||||
uint8_t const pos = m_bullet_ram[y] ^ 0xff;
|
||||
|
||||
// background vs. bullet collision detection
|
||||
if (m_temp_bitmap.pix(y, pos) & 1)
|
||||
m_collision_register |= 0x02;
|
||||
|
||||
// bullet size/color/priority is guessed
|
||||
bitmap.pix(y, pos) = BULLET_PEN;
|
||||
if (pos) bitmap.pix(y, pos - 1) = BULLET_PEN;
|
||||
}
|
||||
|
||||
for (int x = cliprect.left(); x <= cliprect.right(); x++)
|
||||
{
|
||||
// NOTE: similar to zac2650.cpp, the sprite chip runs at a different frequency than the background generator
|
||||
// the exact timing ratio is unknown, so we'll have to do with guesswork
|
||||
float const s_ratio = 256.0f / 196.0f;
|
||||
|
||||
float const sx = x * s_ratio;
|
||||
if (int(sx + 0.5f) > cliprect.right())
|
||||
break;
|
||||
|
||||
// copy the S2636 bitmap into the main bitmap and check collision
|
||||
int const pixel = s2636_0_bitmap.pix(y, x);
|
||||
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel))
|
||||
{
|
||||
// S2636 vs. background collision detection
|
||||
if ((m_temp_bitmap.pix(y, int(sx)) | m_temp_bitmap.pix(y, int(sx + 0.5f))) & 1)
|
||||
m_collision_register |= 0x01;
|
||||
|
||||
bitmap.pix(y, int(sx)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE;
|
||||
bitmap.pix(y, int(sx + 0.5f)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// machine
|
||||
|
||||
WRITE_LINE_MEMBER(galaxia_state::vblank_irq)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
m_maincpu->set_input_line(0, ASSERT_LINE);
|
||||
cvs_scroll_stars();
|
||||
scroll_start();
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,14 +375,14 @@ WRITE_LINE_MEMBER(galaxia_state::vblank_irq)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void galaxia_state::galaxia_video_w(offs_t offset, uint8_t data)
|
||||
template <uint8_t Which>
|
||||
void galaxia_state::video_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
// m_screen->update_partial(m_screen->vpos());
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
cvs_video_or_color_ram_w(offset, data);
|
||||
Which ? m_video_ram[offset] = data : m_color_ram[offset] = data;
|
||||
}
|
||||
|
||||
void galaxia_state::galaxia_scroll_w(uint8_t data)
|
||||
void galaxia_state::scroll_w(uint8_t data)
|
||||
{
|
||||
m_screen->update_partial(m_screen->vpos());
|
||||
|
||||
@ -115,7 +391,7 @@ void galaxia_state::galaxia_scroll_w(uint8_t data)
|
||||
m_bg_tilemap->set_scrolly(i, data);
|
||||
}
|
||||
|
||||
void galaxia_state::galaxia_ctrlport_w(uint8_t data)
|
||||
void galaxia_state::ctrlport_w(uint8_t data)
|
||||
{
|
||||
// d0: triggers on every new credit
|
||||
// d1: coin counter? if you put a coin in slot A, galaxia constantly
|
||||
@ -125,51 +401,55 @@ void galaxia_state::galaxia_ctrlport_w(uint8_t data)
|
||||
// other bits: unknown
|
||||
}
|
||||
|
||||
void galaxia_state::galaxia_dataport_w(uint8_t data)
|
||||
void galaxia_state::dataport_w(uint8_t data)
|
||||
{
|
||||
// seems to be related to sound board comms
|
||||
}
|
||||
|
||||
uint8_t galaxia_state::galaxia_collision_r()
|
||||
uint8_t galaxia_state::collision_r()
|
||||
{
|
||||
m_screen->update_partial(m_screen->vpos());
|
||||
return m_collision_register;
|
||||
}
|
||||
|
||||
uint8_t galaxia_state::galaxia_collision_clear()
|
||||
uint8_t galaxia_state::collision_clear()
|
||||
{
|
||||
m_screen->update_partial(m_screen->vpos());
|
||||
m_collision_register = 0;
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
void galaxia_state::galaxia_mem_map(address_map &map)
|
||||
void galaxia_state::mem_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x13ff).rom();
|
||||
map(0x1400, 0x14ff).mirror(0x6000).ram().share("bullet_ram");
|
||||
map(0x1400, 0x14ff).mirror(0x6000).ram().share(m_bullet_ram);
|
||||
map(0x1500, 0x15ff).mirror(0x6000).rw(m_s2636[0], FUNC(s2636_device::read_data), FUNC(s2636_device::write_data));
|
||||
map(0x1600, 0x16ff).mirror(0x6000).rw(m_s2636[1], FUNC(s2636_device::read_data), FUNC(s2636_device::write_data));
|
||||
map(0x1700, 0x17ff).mirror(0x6000).rw(m_s2636[2], FUNC(s2636_device::read_data), FUNC(s2636_device::write_data));
|
||||
map(0x1800, 0x1bff).mirror(0x6000).r(FUNC(galaxia_state::cvs_video_or_color_ram_r)).w(FUNC(galaxia_state::galaxia_video_w)).share("video_ram");
|
||||
map(0x1800, 0x1bff).mirror(0x6000).view(m_ram_view);
|
||||
m_ram_view[0](0x1800, 0x1bff).ram().w(FUNC(galaxia_state::video_w<0>)).share(m_color_ram);
|
||||
m_ram_view[1](0x1800, 0x1bff).ram().w(FUNC(galaxia_state::video_w<1>)).share(m_video_ram);
|
||||
map(0x1c00, 0x1fff).mirror(0x6000).ram();
|
||||
map(0x2000, 0x33ff).rom();
|
||||
map(0x7214, 0x7214).portr("IN0");
|
||||
}
|
||||
|
||||
void galaxia_state::astrowar_mem_map(address_map &map)
|
||||
void astrowar_state::mem_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x13ff).rom();
|
||||
map(0x1400, 0x14ff).mirror(0x6000).ram();
|
||||
map(0x1500, 0x15ff).mirror(0x6000).rw(m_s2636[0], FUNC(s2636_device::read_data), FUNC(s2636_device::write_data));
|
||||
map(0x1800, 0x1bff).mirror(0x6000).r(FUNC(galaxia_state::cvs_video_or_color_ram_r)).w(FUNC(galaxia_state::galaxia_video_w)).share("video_ram");
|
||||
map(0x1c00, 0x1cff).mirror(0x6000).ram().share("bullet_ram");
|
||||
map(0x1800, 0x1bff).mirror(0x6000).view(m_ram_view);
|
||||
m_ram_view[0](0x1800, 0x1bff).ram().w(FUNC(astrowar_state::video_w<0>)).share(m_color_ram);
|
||||
m_ram_view[1](0x1800, 0x1bff).ram().w(FUNC(astrowar_state::video_w<1>)).share(m_video_ram);
|
||||
map(0x1c00, 0x1cff).mirror(0x6000).ram().share(m_bullet_ram);
|
||||
map(0x2000, 0x33ff).rom();
|
||||
}
|
||||
|
||||
void galaxia_state::galaxia_io_map(address_map &map)
|
||||
void galaxia_state::io_map(address_map &map)
|
||||
{
|
||||
map.unmap_value_high();
|
||||
map(0x00, 0x00).w(FUNC(galaxia_state::galaxia_scroll_w)).portr("IN0");
|
||||
map(0x00, 0x00).w(FUNC(galaxia_state::scroll_w)).portr("IN0");
|
||||
map(0x02, 0x02).portr("IN1");
|
||||
map(0x05, 0x05).nopr();
|
||||
map(0x06, 0x06).portr("DSW0");
|
||||
@ -177,10 +457,10 @@ void galaxia_state::galaxia_io_map(address_map &map)
|
||||
map(0xac, 0xac).nopr();
|
||||
}
|
||||
|
||||
void galaxia_state::galaxia_data_map(address_map &map)
|
||||
void galaxia_state::data_map(address_map &map)
|
||||
{
|
||||
map(S2650_CTRL_PORT, S2650_CTRL_PORT).rw(FUNC(galaxia_state::galaxia_collision_r), FUNC(galaxia_state::galaxia_ctrlport_w));
|
||||
map(S2650_DATA_PORT, S2650_DATA_PORT).rw(FUNC(galaxia_state::galaxia_collision_clear), FUNC(galaxia_state::galaxia_dataport_w));
|
||||
map(S2650_CTRL_PORT, S2650_CTRL_PORT).rw(FUNC(galaxia_state::collision_r), FUNC(galaxia_state::ctrlport_w));
|
||||
map(S2650_DATA_PORT, S2650_DATA_PORT).rw(FUNC(galaxia_state::collision_clear), FUNC(galaxia_state::dataport_w));
|
||||
}
|
||||
|
||||
|
||||
@ -281,38 +561,38 @@ static const gfx_layout tiles8x8x2_layout =
|
||||
};
|
||||
|
||||
static GFXDECODE_START( gfx_galaxia )
|
||||
GFXDECODE_ENTRY( "gfx1", 0, tiles8x8x2_layout, 0, 4 )
|
||||
GFXDECODE_ENTRY( "tiles", 0, tiles8x8x2_layout, 0, 4 )
|
||||
GFXDECODE_END
|
||||
|
||||
static GFXDECODE_START( gfx_astrowar )
|
||||
GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x1, 0, 8 )
|
||||
GFXDECODE_ENTRY( "tiles", 0, gfx_8x8x1, 0, 8 )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
void galaxia_state::galaxia(machine_config &config)
|
||||
{
|
||||
/* basic machine hardware */
|
||||
S2650(config, m_maincpu, XTAL(14'318'181)/8);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &galaxia_state::galaxia_mem_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &galaxia_state::galaxia_io_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &galaxia_state::galaxia_data_map);
|
||||
// basic machine hardware
|
||||
S2650(config, m_maincpu, XTAL(14'318'181) / 8);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &galaxia_state::mem_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &galaxia_state::io_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &galaxia_state::data_map);
|
||||
m_maincpu->sense_handler().set("screen", FUNC(screen_device::vblank));
|
||||
m_maincpu->flag_handler().set(FUNC(galaxia_state::write_s2650_flag));
|
||||
m_maincpu->intack_handler().set([this]() { m_maincpu->set_input_line(0, CLEAR_LINE); return 0x03; });
|
||||
|
||||
/* video hardware */
|
||||
// video hardware
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
m_screen->set_video_attributes(VIDEO_ALWAYS_UPDATE);
|
||||
m_screen->set_refresh_hz(60); // wrong
|
||||
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500));
|
||||
m_screen->set_size(256, 256);
|
||||
m_screen->set_visarea(0*8, 30*8-1, 2*8, 32*8-1);
|
||||
m_screen->set_screen_update(FUNC(galaxia_state::screen_update_galaxia));
|
||||
m_screen->set_screen_update(FUNC(galaxia_state::screen_update));
|
||||
m_screen->set_palette(m_palette);
|
||||
m_screen->screen_vblank().set(FUNC(galaxia_state::vblank_irq));
|
||||
|
||||
GFXDECODE(config, m_gfxdecode, m_palette, gfx_galaxia);
|
||||
PALETTE(config, m_palette, FUNC(galaxia_state::galaxia_palette), 0x18+2);
|
||||
PALETTE(config, m_palette, FUNC(galaxia_state::palette), 0x18+2);
|
||||
|
||||
S2636(config, m_s2636[0], 0);
|
||||
m_s2636[0]->set_offsets(-13, -26);
|
||||
@ -326,42 +606,40 @@ void galaxia_state::galaxia(machine_config &config)
|
||||
m_s2636[2]->set_offsets(-13, -26);
|
||||
m_s2636[2]->add_route(ALL_OUTPUTS, "mono", 0.25);
|
||||
|
||||
/* sound hardware */
|
||||
// sound hardware
|
||||
SPEAKER(config, "mono").front_center();
|
||||
}
|
||||
|
||||
void galaxia_state::astrowar(machine_config &config)
|
||||
void astrowar_state::astrowar(machine_config &config)
|
||||
{
|
||||
/* basic machine hardware */
|
||||
S2650(config, m_maincpu, XTAL(14'318'181)/8);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &galaxia_state::astrowar_mem_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &galaxia_state::galaxia_io_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &galaxia_state::galaxia_data_map);
|
||||
// basic machine hardware
|
||||
S2650(config, m_maincpu, XTAL(14'318'181) / 8);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &astrowar_state::mem_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &astrowar_state::io_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &astrowar_state::data_map);
|
||||
m_maincpu->sense_handler().set("screen", FUNC(screen_device::vblank));
|
||||
m_maincpu->flag_handler().set(FUNC(galaxia_state::write_s2650_flag));
|
||||
m_maincpu->flag_handler().set(FUNC(astrowar_state::write_s2650_flag));
|
||||
m_maincpu->intack_handler().set([this]() { m_maincpu->set_input_line(0, CLEAR_LINE); return 0x03; });
|
||||
|
||||
/* video hardware */
|
||||
// video hardware
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
m_screen->set_video_attributes(VIDEO_ALWAYS_UPDATE);
|
||||
m_screen->set_refresh_hz(60);
|
||||
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500));
|
||||
m_screen->set_size(256, 256);
|
||||
m_screen->set_visarea(1*8, 31*8-1, 2*8, 32*8-1);
|
||||
m_screen->set_screen_update(FUNC(galaxia_state::screen_update_astrowar));
|
||||
m_screen->set_screen_update(FUNC(astrowar_state::screen_update));
|
||||
m_screen->set_palette(m_palette);
|
||||
m_screen->screen_vblank().set(FUNC(galaxia_state::vblank_irq));
|
||||
m_screen->screen_vblank().set(FUNC(astrowar_state::vblank_irq));
|
||||
|
||||
GFXDECODE(config, m_gfxdecode, m_palette, gfx_astrowar);
|
||||
PALETTE(config, m_palette, FUNC(galaxia_state::astrowar_palette), 0x18+2);
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(galaxia_state,astrowar)
|
||||
PALETTE(config, m_palette, FUNC(astrowar_state::palette), 0x18+2);
|
||||
|
||||
S2636(config, m_s2636[0], 0);
|
||||
m_s2636[0]->set_offsets(-13, -8);
|
||||
m_s2636[0]->add_route(ALL_OUTPUTS, "mono", 0.25);
|
||||
|
||||
/* sound hardware */
|
||||
// sound hardware
|
||||
SPEAKER(config, "mono").front_center();
|
||||
}
|
||||
|
||||
@ -385,7 +663,7 @@ ROM_START( galaxia )
|
||||
ROM_LOAD( "galaxia.11l", 0x02c00, 0x0400, CRC(50c6a645) SHA1(46638907bc393df6be25fc7461d73047d1746ffc) )
|
||||
ROM_LOAD( "galaxia.13l", 0x03000, 0x0400, CRC(3a9c38c7) SHA1(d1e934092b69c0f3f9636eba05a1d8a6d9588e6b) )
|
||||
|
||||
ROM_REGION( 0x0800, "gfx1", 0 )
|
||||
ROM_REGION( 0x0800, "tiles", 0 )
|
||||
ROM_LOAD( "galaxia.1d", 0x00000, 0x0400, CRC(2dd50aab) SHA1(758d7a5383c9a1ee134d99e3f7025819cfbe0e0f) )
|
||||
ROM_LOAD( "galaxia.3d", 0x00400, 0x0400, CRC(1dc30185) SHA1(e3c75eecb80b376ece98f602e1b9587487841824) )
|
||||
|
||||
@ -406,7 +684,7 @@ ROM_START( galaxiaa )
|
||||
ROM_LOAD( "galaxia.11l", 0x02c00, 0x0400, CRC(50c6a645) SHA1(46638907bc393df6be25fc7461d73047d1746ffc) )
|
||||
ROM_LOAD( "galaxia.13l", 0x03000, 0x0400, CRC(3a9c38c7) SHA1(d1e934092b69c0f3f9636eba05a1d8a6d9588e6b) )
|
||||
|
||||
ROM_REGION( 0x0800, "gfx1", 0 )
|
||||
ROM_REGION( 0x0800, "tiles", 0 )
|
||||
ROM_LOAD( "galaxia.1d", 0x00000, 0x0400, CRC(2dd50aab) SHA1(758d7a5383c9a1ee134d99e3f7025819cfbe0e0f) ) // taken from parent
|
||||
ROM_LOAD( "galaxia.3d", 0x00400, 0x0400, CRC(1dc30185) SHA1(e3c75eecb80b376ece98f602e1b9587487841824) ) // taken from parent
|
||||
|
||||
@ -427,7 +705,7 @@ ROM_START( galaxiab )
|
||||
ROM_LOAD( "galaxia.11l", 0x02c00, 0x0400, CRC(50c6a645) SHA1(46638907bc393df6be25fc7461d73047d1746ffc) )
|
||||
ROM_LOAD( "galaxia.13l", 0x03000, 0x0400, CRC(3a9c38c7) SHA1(d1e934092b69c0f3f9636eba05a1d8a6d9588e6b) )
|
||||
|
||||
ROM_REGION( 0x0800, "gfx1", 0 )
|
||||
ROM_REGION( 0x0800, "tiles", 0 )
|
||||
ROM_LOAD( "galaxia.1d", 0x00000, 0x0400, CRC(2dd50aab) SHA1(758d7a5383c9a1ee134d99e3f7025819cfbe0e0f) ) // taken from parent
|
||||
ROM_LOAD( "galaxia.3d", 0x00400, 0x0400, CRC(1dc30185) SHA1(e3c75eecb80b376ece98f602e1b9587487841824) ) // taken from parent
|
||||
|
||||
@ -448,7 +726,7 @@ ROM_START( galaxiac )
|
||||
ROM_LOAD( "galaxia.11l", 0x02c00, 0x0400, CRC(8e3f5343) SHA1(6298be9bb33975854cb3d009b89913b1a8018aee) ) // sldh
|
||||
ROM_LOAD( "galaxia.13l", 0x03000, 0x0400, CRC(3a9c38c7) SHA1(d1e934092b69c0f3f9636eba05a1d8a6d9588e6b) )
|
||||
|
||||
ROM_REGION( 0x0800, "gfx1", 0 )
|
||||
ROM_REGION( 0x0800, "tiles", 0 )
|
||||
ROM_LOAD( "galaxia.1d", 0x00000, 0x0400, CRC(2dd50aab) SHA1(758d7a5383c9a1ee134d99e3f7025819cfbe0e0f) ) // taken from parent
|
||||
ROM_LOAD( "galaxia.3d", 0x00400, 0x0400, CRC(1dc30185) SHA1(e3c75eecb80b376ece98f602e1b9587487841824) ) // taken from parent
|
||||
|
||||
@ -470,13 +748,16 @@ ROM_START( astrowar )
|
||||
ROM_LOAD( "astro.11l", 0x02c00, 0x0400, CRC(29f52f57) SHA1(5cb50b82e09c537eeaeae167351fca686fde8228) )
|
||||
ROM_LOAD( "astro.13l", 0x03000, 0x0400, CRC(882cdb87) SHA1(062ee8d296316cbce2eb62e72774aa4181e9847d) )
|
||||
|
||||
ROM_REGION( 0x0800, "gfx1", 0 )
|
||||
ROM_REGION( 0x0800, "tiles", 0 )
|
||||
ROM_LOAD( "astro.1d", 0x00000, 0x0400, CRC(6053f834) SHA1(e0b76800c241b3c8010c09869cecbc109b25310a) )
|
||||
ROM_LOAD( "astro.3d", 0x00400, 0x0400, CRC(822505aa) SHA1(f9d3465e14bb850a286f8b4f42aa0a4044413b67) )
|
||||
ROM_END
|
||||
|
||||
GAME( 1979, galaxia, 0, galaxia, galaxia, galaxia_state, empty_init, ROT90, "Zaccaria / Zelco", "Galaxia (set 1)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
|
||||
GAME( 1979, galaxiaa, galaxia, galaxia, galaxia, galaxia_state, empty_init, ROT90, "Zaccaria / Zelco", "Galaxia (set 2)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
|
||||
GAME( 1979, galaxiab, galaxia, galaxia, galaxia, galaxia_state, empty_init, ROT90, "Zaccaria / Zelco", "Galaxia (set 3)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
|
||||
GAME( 1979, galaxiac, galaxia, galaxia, galaxia, galaxia_state, empty_init, ROT90, "Zaccaria / Zelco", "Galaxia (set 4)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
|
||||
GAME( 1980, astrowar, 0, astrowar, galaxia, galaxia_state, empty_init, ROT90, "Zaccaria / Zelco", "Astro Wars", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
GAME( 1979, galaxia, 0, galaxia, galaxia, galaxia_state, empty_init, ROT90, "Zaccaria / Zelco", "Galaxia (set 1)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1979, galaxiaa, galaxia, galaxia, galaxia, galaxia_state, empty_init, ROT90, "Zaccaria / Zelco", "Galaxia (set 2)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1979, galaxiab, galaxia, galaxia, galaxia, galaxia_state, empty_init, ROT90, "Zaccaria / Zelco", "Galaxia (set 3)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1979, galaxiac, galaxia, galaxia, galaxia, galaxia_state, empty_init, ROT90, "Zaccaria / Zelco", "Galaxia (set 4)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1980, astrowar, 0, astrowar, galaxia, astrowar_state, empty_init, ROT90, "Zaccaria / Zelco", "Astro Wars", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
|
||||
|
@ -1,54 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:David Haywood, hap
|
||||
/***************************************************************************
|
||||
|
||||
Zaccaria Galaxia HW
|
||||
|
||||
****************************************************************************/
|
||||
#ifndef MAME_CVS_GALAXIA_H
|
||||
#define MAME_CVS_GALAXIA_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvs.h"
|
||||
#include "tilemap.h"
|
||||
|
||||
class galaxia_state : public cvs_state
|
||||
{
|
||||
public:
|
||||
galaxia_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: cvs_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
void astrowar(machine_config &config);
|
||||
void galaxia(machine_config &config);
|
||||
|
||||
void init_common();
|
||||
|
||||
protected:
|
||||
virtual void video_start() override;
|
||||
|
||||
private:
|
||||
tilemap_t *m_bg_tilemap = nullptr;
|
||||
bitmap_ind16 m_temp_bitmap;
|
||||
void galaxia_video_w(offs_t offset, uint8_t data);
|
||||
void galaxia_scroll_w(uint8_t data);
|
||||
void galaxia_ctrlport_w(uint8_t data);
|
||||
void galaxia_dataport_w(uint8_t data);
|
||||
uint8_t galaxia_collision_r();
|
||||
uint8_t galaxia_collision_clear();
|
||||
TILE_GET_INFO_MEMBER(get_galaxia_bg_tile_info);
|
||||
TILE_GET_INFO_MEMBER(get_astrowar_bg_tile_info);
|
||||
void galaxia_palette(palette_device &palette) const;
|
||||
DECLARE_VIDEO_START(astrowar);
|
||||
void astrowar_palette(palette_device &palette) const;
|
||||
uint32_t screen_update_galaxia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
uint32_t screen_update_astrowar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
|
||||
void astrowar_mem_map(address_map &map);
|
||||
void galaxia_data_map(address_map &map);
|
||||
void galaxia_io_map(address_map &map);
|
||||
void galaxia_mem_map(address_map &map);
|
||||
};
|
||||
|
||||
#endif // MAME_CVS_GALAXIA_H
|
@ -1,226 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:David Haywood, hap
|
||||
/***************************************************************************
|
||||
|
||||
Galaxia Video HW
|
||||
|
||||
hardware is derived from cvs
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "galaxia.h"
|
||||
|
||||
#define SPRITE_PEN_BASE (0x10)
|
||||
#define STAR_PEN (0x18)
|
||||
#define BULLET_PEN (0x19)
|
||||
|
||||
|
||||
// Colors are 3bpp, but how they are generated is a mystery
|
||||
// there's no color prom on the pcb, nor palette ram
|
||||
|
||||
void galaxia_state::galaxia_palette(palette_device &palette) const
|
||||
{
|
||||
// estimated with video/photo references
|
||||
constexpr int lut_clr[0x18] = {
|
||||
// background
|
||||
0, 1, 4, 5,
|
||||
0, 3, 6, 2,
|
||||
0, 1, 4, 5, // unused?
|
||||
0, 3, 1, 7,
|
||||
|
||||
// sprites
|
||||
0, 4, 3, 6, 1, 5, 2, 7
|
||||
};
|
||||
|
||||
for (int i = 0; i < 0x18; i++)
|
||||
palette.set_pen_color(i, pal1bit(lut_clr[i] >> 0), pal1bit(lut_clr[i] >> 1), pal1bit(lut_clr[i] >> 2));
|
||||
|
||||
// stars/bullets
|
||||
palette.set_pen_color(STAR_PEN, pal1bit(1), pal1bit(1), pal1bit(1));
|
||||
palette.set_pen_color(BULLET_PEN, pal1bit(1), pal1bit(1), pal1bit(0));
|
||||
}
|
||||
|
||||
void galaxia_state::astrowar_palette(palette_device &palette) const
|
||||
{
|
||||
// no reference material available(?), except for Data East astrof
|
||||
constexpr int lut_clr[8] = { 7, 3, 5, 1, 4, 2, 6, 7 };
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
// background
|
||||
palette.set_pen_color(i*2, 0, 0, 0);
|
||||
palette.set_pen_color(i*2 + 1, pal1bit(lut_clr[i] >> 0), pal1bit(lut_clr[i] >> 1), pal1bit(lut_clr[i] >> 2));
|
||||
|
||||
// sprites
|
||||
palette.set_pen_color(i | SPRITE_PEN_BASE, pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
|
||||
}
|
||||
|
||||
// stars/bullets
|
||||
palette.set_pen_color(STAR_PEN, pal1bit(1), pal1bit(1), pal1bit(1));
|
||||
palette.set_pen_color(BULLET_PEN, pal1bit(1), pal1bit(1), pal1bit(0));
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(galaxia_state::get_galaxia_bg_tile_info)
|
||||
{
|
||||
uint8_t code = m_video_ram[tile_index] & 0x7f; // d7 unused
|
||||
uint8_t color = m_color_ram[tile_index] & 3; // highest bits unused
|
||||
|
||||
tileinfo.set(0, code, color, 0);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(galaxia_state::get_astrowar_bg_tile_info)
|
||||
{
|
||||
uint8_t code = m_video_ram[tile_index];
|
||||
uint8_t color = m_color_ram[tile_index] & 7; // highest bits unused
|
||||
|
||||
tileinfo.set(0, code, color, 0);
|
||||
}
|
||||
|
||||
void galaxia_state::init_common()
|
||||
{
|
||||
assert((STAR_PEN & 7) == 0);
|
||||
cvs_init_stars();
|
||||
}
|
||||
|
||||
void galaxia_state::video_start()
|
||||
{
|
||||
init_common();
|
||||
|
||||
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(galaxia_state::get_galaxia_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
m_bg_tilemap->set_transparent_pen(0);
|
||||
m_bg_tilemap->set_scroll_cols(8);
|
||||
|
||||
}
|
||||
|
||||
VIDEO_START_MEMBER(galaxia_state,astrowar)
|
||||
{
|
||||
init_common();
|
||||
|
||||
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(galaxia_state::get_astrowar_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
m_bg_tilemap->set_transparent_pen(0);
|
||||
m_bg_tilemap->set_scroll_cols(8);
|
||||
m_bg_tilemap->set_scrolldx(8, 8);
|
||||
|
||||
m_screen->register_screen_bitmap(m_temp_bitmap);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************************/
|
||||
|
||||
uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
bitmap_ind16 const &s2636_0_bitmap = m_s2636[0]->update(cliprect);
|
||||
bitmap_ind16 const &s2636_1_bitmap = m_s2636[1]->update(cliprect);
|
||||
bitmap_ind16 const &s2636_2_bitmap = m_s2636[2]->update(cliprect);
|
||||
|
||||
bitmap.fill(0, cliprect);
|
||||
cvs_update_stars(bitmap, cliprect, STAR_PEN, 1);
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
|
||||
for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
|
||||
{
|
||||
for (int x = cliprect.left(); x <= cliprect.right(); x++)
|
||||
{
|
||||
bool const bullet = m_bullet_ram[y] && x == (m_bullet_ram[y] ^ 0xff);
|
||||
bool const background = (bitmap.pix(y, x) & 3) != 0;
|
||||
|
||||
// draw bullets (guesswork)
|
||||
if (bullet)
|
||||
{
|
||||
// background vs. bullet collision detection
|
||||
if (background) m_collision_register |= 0x80;
|
||||
|
||||
// bullet size/color/priority is guessed
|
||||
bitmap.pix(y, x) = BULLET_PEN;
|
||||
if (x) bitmap.pix(y, x-1) = BULLET_PEN;
|
||||
}
|
||||
|
||||
// copy the S2636 images into the main bitmap and check collision
|
||||
int const pixel0 = s2636_0_bitmap.pix(y, x);
|
||||
int const pixel1 = s2636_1_bitmap.pix(y, x);
|
||||
int const pixel2 = s2636_2_bitmap.pix(y, x);
|
||||
|
||||
int const pixel = pixel0 | pixel1 | pixel2;
|
||||
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel))
|
||||
{
|
||||
// S2636 vs. S2636 collision detection
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0) && S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x01;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel1) && S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel2) && S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x04;
|
||||
|
||||
// S2636 vs. bullet collision detection
|
||||
if (bullet) m_collision_register |= 0x08;
|
||||
|
||||
// S2636 vs. background collision detection
|
||||
if (background)
|
||||
{
|
||||
/* bit4 causes problems on 2nd level
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x10; */
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel1)) m_collision_register |= 0x20;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x40;
|
||||
}
|
||||
|
||||
bitmap.pix(y, x) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
// astrowar has only one S2636
|
||||
bitmap_ind16 const &s2636_0_bitmap = m_s2636[0]->update(cliprect);
|
||||
|
||||
bitmap.fill(0, cliprect);
|
||||
cvs_update_stars(bitmap, cliprect, STAR_PEN, 1);
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
copybitmap(m_temp_bitmap, bitmap, 0, 0, 0, 0, cliprect);
|
||||
|
||||
for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
|
||||
{
|
||||
// draw bullets (guesswork)
|
||||
if (m_bullet_ram[y])
|
||||
{
|
||||
uint8_t const pos = m_bullet_ram[y] ^ 0xff;
|
||||
|
||||
// background vs. bullet collision detection
|
||||
if (m_temp_bitmap.pix(y, pos) & 1)
|
||||
m_collision_register |= 0x02;
|
||||
|
||||
// bullet size/color/priority is guessed
|
||||
bitmap.pix(y, pos) = BULLET_PEN;
|
||||
if (pos) bitmap.pix(y, pos-1) = BULLET_PEN;
|
||||
}
|
||||
|
||||
for (int x = cliprect.left(); x <= cliprect.right(); x++)
|
||||
{
|
||||
// NOTE: similar to zac2650.c, the sprite chip runs at a different frequency than the background generator
|
||||
// the exact timing ratio is unknown, so we'll have to do with guesswork
|
||||
float const s_ratio = 256.0f / 196.0f;
|
||||
|
||||
float const sx = x * s_ratio;
|
||||
if (int(sx + 0.5f) > cliprect.right())
|
||||
break;
|
||||
|
||||
// copy the S2636 bitmap into the main bitmap and check collision
|
||||
int const pixel = s2636_0_bitmap.pix(y, x);
|
||||
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel))
|
||||
{
|
||||
// S2636 vs. background collision detection
|
||||
if ((m_temp_bitmap.pix(y, int(sx)) | m_temp_bitmap.pix(y, int(sx + 0.5f))) & 1)
|
||||
m_collision_register |= 0x01;
|
||||
|
||||
bitmap.pix(y, int(sx)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE;
|
||||
bitmap.pix(y, int(sx + 0.5f)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Mike Coates, Pierpaolo Prazzoli
|
||||
// copyright-holders: Mike Coates, Pierpaolo Prazzoli
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Zaccaria S2650 '80s games
|
||||
@ -30,12 +31,242 @@ I8085 Sound Board
|
||||
|
||||
************************************************************************/
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
#include "quasar.h"
|
||||
#include "cpu/s2650/s2650.h"
|
||||
|
||||
#include "cvs_base.h"
|
||||
|
||||
#include "cpu/mcs48/mcs48.h"
|
||||
|
||||
#include "speaker.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
class quasar_state : public cvs_base_state
|
||||
{
|
||||
public:
|
||||
quasar_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: cvs_base_state(mconfig, type, tag)
|
||||
, m_soundlatch(*this, "soundlatch")
|
||||
, m_in(*this, "IN%u", 0U)
|
||||
, m_dsw(*this, "DSW%u", 0U)
|
||||
, m_effectram(*this, "effectram", 0x400, ENDIANNESS_BIG)
|
||||
{ }
|
||||
|
||||
void quasar(machine_config &config) ATTR_COLD;
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override ATTR_COLD;
|
||||
virtual void machine_reset() override ATTR_COLD;
|
||||
virtual void video_start() override ATTR_COLD;
|
||||
|
||||
private:
|
||||
required_device<generic_latch_8_device> m_soundlatch;
|
||||
|
||||
required_ioport_array<2> m_in;
|
||||
required_ioport_array<3> m_dsw;
|
||||
|
||||
memory_share_creator<uint8_t> m_effectram;
|
||||
|
||||
uint8_t m_effectcontrol = 0U;
|
||||
uint8_t m_page = 0U;
|
||||
uint8_t m_io_page = 0U;
|
||||
|
||||
void video_page_select_w(offs_t offset, uint8_t data);
|
||||
void io_page_select_w(offs_t offset, uint8_t data);
|
||||
void video_w(offs_t offset, uint8_t data);
|
||||
uint8_t io_r();
|
||||
void bullet_w(offs_t offset, uint8_t data);
|
||||
void sh_command_w(uint8_t data);
|
||||
uint8_t sh_command_r();
|
||||
DECLARE_READ_LINE_MEMBER(audio_t1_r);
|
||||
void palette(palette_device &palette) const ATTR_COLD;
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
void program(address_map &map) ATTR_COLD;
|
||||
void data(address_map &map) ATTR_COLD;
|
||||
void io(address_map &map) ATTR_COLD;
|
||||
void sound_map(address_map &map) ATTR_COLD;
|
||||
void sound_portmap(address_map &map) ATTR_COLD;
|
||||
};
|
||||
|
||||
|
||||
// video
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Zaccaria S2650 games share various levels of design with the Century Video
|
||||
System (CVS) games, and hence some routines are shared from there.
|
||||
|
||||
Shooting seems to mix custom boards from Zaccaria and sound boards from CVS
|
||||
hinting at a strong link between the two companies.
|
||||
|
||||
Zaccaria are an Italian company, Century were based in Manchester UK
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void quasar_state::palette(palette_device &palette) const
|
||||
{
|
||||
uint8_t const *const color_prom = memregion("proms")->base();
|
||||
|
||||
// standard 1 bit per color palette (background and sprites)
|
||||
for (int i = 0; i < 8; i++)
|
||||
palette.set_indirect_color(i, rgb_t(pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2)));
|
||||
|
||||
// effects color map
|
||||
for (int i = 0; i < 0x100; i++)
|
||||
{
|
||||
int bit0, bit1, bit2;
|
||||
|
||||
// red component
|
||||
bit0 = BIT(i, 0);
|
||||
bit1 = BIT(i, 1);
|
||||
bit2 = BIT(i, 2);
|
||||
int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
// green component
|
||||
bit0 = BIT(i, 3);
|
||||
bit1 = BIT(i, 4);
|
||||
bit2 = BIT(i, 5);
|
||||
int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
// blue component
|
||||
bit0 = BIT(i, 6);
|
||||
bit1 = BIT(i, 7);
|
||||
int const b = 0x4f * bit0 + 0xa8 * bit1;
|
||||
|
||||
// intensity 0
|
||||
palette.set_indirect_color(0x100 + i, rgb_t::black());
|
||||
|
||||
// intensity 1
|
||||
palette.set_indirect_color(0x200 + i, rgb_t(r >> 2, g >> 2, b >> 2));
|
||||
|
||||
// intensity 2
|
||||
palette.set_indirect_color(0x300 + i, rgb_t((r >> 2) + (r >> 3), (g >> 2) + (g >> 3), (b >> 2) + (b >> 2)));
|
||||
|
||||
// intensity 3
|
||||
palette.set_indirect_color(0x400 + i, rgb_t(r >> 1, g >> 1, b >> 1));
|
||||
}
|
||||
|
||||
// Address 0-2 from graphic ROM
|
||||
// 3-5 from color RAM
|
||||
// 6-8 from sprite chips (Used for priority)
|
||||
for (int i = 0; i < 0x200; i++)
|
||||
palette.set_pen_indirect(i, color_prom[i] & 0x07);
|
||||
|
||||
// background for collision
|
||||
for (int i = 1; i < 8; i++)
|
||||
palette.set_pen_indirect(0x200 + i, 7);
|
||||
palette.set_pen_indirect(0x200, 0);
|
||||
|
||||
// effects
|
||||
for (int i = 0; i < 0x400; i++)
|
||||
palette.set_pen_indirect(0x208 + i, 0x100 + i);
|
||||
}
|
||||
|
||||
|
||||
void quasar_state::video_start()
|
||||
{
|
||||
// create helper bitmap
|
||||
m_screen->register_screen_bitmap(m_collision_background);
|
||||
|
||||
// register save
|
||||
save_item(NAME(m_collision_background));
|
||||
}
|
||||
|
||||
uint32_t quasar_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
// for every character in the video RAM
|
||||
for (int offs = 0; offs < 0x0400; offs++)
|
||||
{
|
||||
uint8_t const code = m_video_ram[offs];
|
||||
uint8_t const x = (offs & 0x1f) << 3;
|
||||
uint8_t const y = (offs >> 5) << 3;
|
||||
|
||||
// While we have the current character code, draw the effects layer
|
||||
// intensity / on and off controlled by latch
|
||||
|
||||
int const forecolor = 0x208 + m_effectram[offs] + (256 * (((m_effectcontrol >> 4) ^ 3) & 3));
|
||||
|
||||
for (int ox = 0; ox < 8; ox++)
|
||||
for (int oy = 0; oy < 8; oy++)
|
||||
bitmap.pix(y + oy, x + ox) = forecolor;
|
||||
|
||||
// Main Screen
|
||||
m_gfxdecode->gfx(0)->transpen(bitmap, cliprect,
|
||||
code,
|
||||
m_color_ram[offs] & 0x3f,
|
||||
0, 0,
|
||||
x, y, 0);
|
||||
|
||||
|
||||
// background for Collision Detection (it can only hit certain items)
|
||||
if ((m_color_ram[offs] & 7) == 0)
|
||||
{
|
||||
m_gfxdecode->gfx(0)->opaque(m_collision_background, cliprect,
|
||||
code,
|
||||
64,
|
||||
0, 0,
|
||||
x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// update the S2636 chips
|
||||
bitmap_ind16 const &s2636_0_bitmap = m_s2636[0]->update(cliprect);
|
||||
bitmap_ind16 const &s2636_1_bitmap = m_s2636[1]->update(cliprect);
|
||||
bitmap_ind16 const &s2636_2_bitmap = m_s2636[2]->update(cliprect);
|
||||
|
||||
// Bullet Hardware
|
||||
for (int offs = 8; offs < 256; offs++)
|
||||
{
|
||||
if (m_bullet_ram[offs] != 0)
|
||||
{
|
||||
for (int ct = 0; ct < 1; ct++)
|
||||
{
|
||||
int const bx = 255 - 9 - m_bullet_ram[offs] - ct;
|
||||
|
||||
// bullet/object Collision
|
||||
if (s2636_0_bitmap.pix(offs, bx) != 0) m_collision_register |= 0x04;
|
||||
if (s2636_2_bitmap.pix(offs, bx) != 0) m_collision_register |= 0x08;
|
||||
|
||||
bitmap.pix(offs, bx) = 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// mix and copy the S2636 images into the main bitmap, also check for collision
|
||||
for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
|
||||
{
|
||||
for (int x = cliprect.left(); x <= cliprect.right(); x++)
|
||||
{
|
||||
int const pixel0 = s2636_0_bitmap.pix(y, x);
|
||||
int const pixel1 = s2636_1_bitmap.pix(y, x);
|
||||
int const pixel2 = s2636_2_bitmap.pix(y, x);
|
||||
|
||||
int const pixel = pixel0 | pixel1 | pixel2;
|
||||
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel))
|
||||
{
|
||||
bitmap.pix(y, x) = S2636_PIXEL_COLOR(pixel);
|
||||
|
||||
// S2636 vs. background collision detection
|
||||
if (m_palette->pen_indirect(m_collision_background.pix(y, x)))
|
||||
{
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x01;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// machine
|
||||
|
||||
/************************************************************************
|
||||
|
||||
Quasar memory layout
|
||||
@ -56,7 +287,7 @@ void quasar_state::io_page_select_w(offs_t offset, uint8_t data)
|
||||
m_io_page = offset & 0x03;
|
||||
}
|
||||
|
||||
void quasar_state::quasar_video_w(offs_t offset, uint8_t data)
|
||||
void quasar_state::video_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
switch (m_page)
|
||||
{
|
||||
@ -67,27 +298,27 @@ void quasar_state::quasar_video_w(offs_t offset, uint8_t data)
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t quasar_state::quasar_IO_r()
|
||||
uint8_t quasar_state::io_r()
|
||||
{
|
||||
uint8_t ans = 0;
|
||||
|
||||
switch (m_io_page)
|
||||
{
|
||||
case 0: ans = ioport("IN0")->read(); break;
|
||||
case 1: ans = ioport("IN1")->read(); break;
|
||||
case 2: ans = ioport("DSW0")->read(); break;
|
||||
case 3: ans = ioport("DSW1")->read(); break;
|
||||
case 0: ans = m_in[0]->read(); break;
|
||||
case 1: ans = m_in[1]->read(); break;
|
||||
case 2: ans = m_dsw[0]->read(); break;
|
||||
case 3: ans = m_dsw[1]->read(); break;
|
||||
}
|
||||
|
||||
return ans;
|
||||
}
|
||||
|
||||
void quasar_state::quasar_bullet_w(offs_t offset, uint8_t data)
|
||||
void quasar_state::bullet_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
m_bullet_ram[offset] = (data ^ 0xff);
|
||||
}
|
||||
|
||||
void quasar_state::quasar_sh_command_w(uint8_t data)
|
||||
void quasar_state::sh_command_w(uint8_t data)
|
||||
{
|
||||
// bit 4 = Sound Invader : Linked to an NE555V circuit
|
||||
// Not handled yet
|
||||
@ -98,9 +329,9 @@ void quasar_state::quasar_sh_command_w(uint8_t data)
|
||||
m_soundlatch->write((data & 8) + ((data >> 1) & 3) + ((data << 2) & 4));
|
||||
}
|
||||
|
||||
uint8_t quasar_state::quasar_sh_command_r()
|
||||
uint8_t quasar_state::sh_command_r()
|
||||
{
|
||||
return m_soundlatch->read() + (ioport("DSW2")->read() & 0x30);
|
||||
return m_soundlatch->read() + (m_dsw[2]->read() & 0x30);
|
||||
}
|
||||
|
||||
READ_LINE_MEMBER(quasar_state::audio_t1_r)
|
||||
@ -110,30 +341,30 @@ READ_LINE_MEMBER(quasar_state::audio_t1_r)
|
||||
|
||||
// memory map taken from the manual
|
||||
|
||||
void quasar_state::quasar_program(address_map &map)
|
||||
void quasar_state::program(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x13ff).rom();
|
||||
map(0x1400, 0x14ff).mirror(0x6000).r(FUNC(quasar_state::cvs_bullet_ram_or_palette_r)).w(FUNC(quasar_state::quasar_bullet_w)).share("bullet_ram");
|
||||
map(0x1500, 0x15ff).mirror(0x6000).rw(FUNC(quasar_state::cvs_s2636_0_or_character_ram_r), FUNC(quasar_state::cvs_s2636_0_or_character_ram_w));
|
||||
map(0x1600, 0x16ff).mirror(0x6000).rw(FUNC(quasar_state::cvs_s2636_1_or_character_ram_r), FUNC(quasar_state::cvs_s2636_1_or_character_ram_w));
|
||||
map(0x1700, 0x17ff).mirror(0x6000).rw(FUNC(quasar_state::cvs_s2636_2_or_character_ram_r), FUNC(quasar_state::cvs_s2636_2_or_character_ram_w));
|
||||
map(0x1800, 0x1bff).mirror(0x6000).r(FUNC(quasar_state::cvs_video_or_color_ram_r)).w(FUNC(quasar_state::quasar_video_w)).share("video_ram");
|
||||
map(0x1400, 0x14ff).ram().w(FUNC(quasar_state::bullet_w)).share(m_bullet_ram);
|
||||
map(0x1500, 0x15ff).mirror(0x6000).rw(m_s2636[0], FUNC(s2636_device::read_data), FUNC(s2636_device::write_data));
|
||||
map(0x1600, 0x16ff).mirror(0x6000).rw(m_s2636[1], FUNC(s2636_device::read_data), FUNC(s2636_device::write_data));
|
||||
map(0x1700, 0x17ff).mirror(0x6000).rw(m_s2636[2], FUNC(s2636_device::read_data), FUNC(s2636_device::write_data));
|
||||
map(0x1800, 0x1bff).mirror(0x6000).ram().w(FUNC(quasar_state::video_w)).share(m_color_ram);
|
||||
map(0x1c00, 0x1fff).mirror(0x6000).ram();
|
||||
map(0x2000, 0x33ff).rom();
|
||||
map(0x4000, 0x53ff).rom();
|
||||
map(0x6000, 0x73ff).rom();
|
||||
}
|
||||
|
||||
void quasar_state::quasar_io(address_map &map)
|
||||
void quasar_state::io(address_map &map)
|
||||
{
|
||||
map(0x00, 0x03).rw(FUNC(quasar_state::quasar_IO_r), FUNC(quasar_state::video_page_select_w));
|
||||
map(0x00, 0x03).rw(FUNC(quasar_state::io_r), FUNC(quasar_state::video_page_select_w));
|
||||
map(0x08, 0x0b).w(FUNC(quasar_state::io_page_select_w));
|
||||
}
|
||||
|
||||
void quasar_state::quasar_data(address_map &map)
|
||||
void quasar_state::data(address_map &map)
|
||||
{
|
||||
map(S2650_CTRL_PORT, S2650_CTRL_PORT).r(FUNC(quasar_state::cvs_collision_r)).nopw();
|
||||
map(S2650_DATA_PORT, S2650_DATA_PORT).rw(FUNC(quasar_state::cvs_collision_clear), FUNC(quasar_state::quasar_sh_command_w));
|
||||
map(S2650_CTRL_PORT, S2650_CTRL_PORT).r(FUNC(quasar_state::collision_r)).nopw();
|
||||
map(S2650_DATA_PORT, S2650_DATA_PORT).rw(FUNC(quasar_state::collision_clear), FUNC(quasar_state::sh_command_w));
|
||||
}
|
||||
|
||||
/*************************************
|
||||
@ -150,7 +381,7 @@ void quasar_state::sound_map(address_map &map)
|
||||
void quasar_state::sound_portmap(address_map &map)
|
||||
{
|
||||
map(0x00, 0x7f).ram();
|
||||
map(0x80, 0x80).r(FUNC(quasar_state::quasar_sh_command_r));
|
||||
map(0x80, 0x80).r(FUNC(quasar_state::sh_command_r));
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
@ -168,30 +399,30 @@ static INPUT_PORTS_START( quasar )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) /* test switch */
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) // test switch
|
||||
|
||||
PORT_START("IN1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* table (from manual) */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // table (from manual)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* count enable (from manual) */
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // count enable (from manual)
|
||||
|
||||
PORT_START("DSW0")
|
||||
PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Coin_A ) ) /* confirmed */
|
||||
PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Coin_A ) ) // confirmed
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
|
||||
PORT_DIPSETTING( 0x04, DEF_STR( 1C_1C ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_3C ) )
|
||||
PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) ) /* confirmed */
|
||||
PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) ) // confirmed
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0x02, DEF_STR( 1C_3C ) )
|
||||
PORT_DIPSETTING( 0x03, DEF_STR( 1C_5C ) )
|
||||
PORT_DIPNAME( 0x30, 0x00, "Number of Rockets" ) /* confirmed */
|
||||
PORT_DIPNAME( 0x30, 0x00, "Number of Rockets" ) // confirmed
|
||||
PORT_DIPSETTING( 0x00, "3" )
|
||||
PORT_DIPSETTING( 0x10, "4" )
|
||||
PORT_DIPSETTING( 0x20, "5" )
|
||||
@ -199,7 +430,7 @@ static INPUT_PORTS_START( quasar )
|
||||
PORT_DIPNAME( 0x40, 0x00, DEF_STR( Free_Play ) ) // requires initial coin, but doesn't decrease coins on game over
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x40, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x80, 0x80, "Test Mode" ) /* confirmed */
|
||||
PORT_DIPNAME( 0x80, 0x80, "Test Mode" ) // confirmed
|
||||
PORT_DIPSETTING( 0x00, "Collisions excluded" )
|
||||
PORT_DIPSETTING( 0x80, "Collisions included" )
|
||||
|
||||
@ -216,11 +447,11 @@ static INPUT_PORTS_START( quasar )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( Difficult ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Very_Difficult ) )
|
||||
PORT_DIPNAME( 0x60, 0x20, "Extended Play" )
|
||||
PORT_DIPSETTING( 0x20, "5500" ) /* confirmed */
|
||||
PORT_DIPSETTING( 0x20, "5500" ) // confirmed
|
||||
PORT_DIPSETTING( 0x40, "7500" )
|
||||
PORT_DIPSETTING( 0x60, "9500" )
|
||||
PORT_DIPSETTING( 0x00, "17500" )
|
||||
PORT_DIPNAME( 0x80, 0x80, "Full Screen Rocket" ) /* confirmed */
|
||||
PORT_DIPNAME( 0x80, 0x80, "Full Screen Rocket" ) // confirmed
|
||||
PORT_DIPSETTING( 0x80, "Stop at edge" )
|
||||
PORT_DIPSETTING( 0x00, "Wrap Around" )
|
||||
|
||||
@ -264,26 +495,21 @@ static const gfx_layout charlayout =
|
||||
8*8
|
||||
};
|
||||
|
||||
/* S2636 Mappings */
|
||||
// S2636 mappings
|
||||
|
||||
static GFXDECODE_START( gfx_quasar )
|
||||
GFXDECODE_ENTRY( "gfx1", 0x0000, charlayout, 0, 64+1 ) /* ROM chars */
|
||||
GFXDECODE_ENTRY( "tiles", 0x0000, charlayout, 0, 64+1 )
|
||||
GFXDECODE_END
|
||||
|
||||
INTERRUPT_GEN_MEMBER(quasar_state::quasar_interrupt)
|
||||
{
|
||||
m_maincpu->set_input_line(0, ASSERT_LINE);
|
||||
}
|
||||
|
||||
// ****************************************
|
||||
// Quasar S2650 Main CPU, I8035 sound board
|
||||
// ****************************************
|
||||
|
||||
void quasar_state::machine_start()
|
||||
{
|
||||
cvs_state::machine_start();
|
||||
cvs_base_state::machine_start();
|
||||
|
||||
/* register state save */
|
||||
// register state save
|
||||
save_item(NAME(m_effectcontrol));
|
||||
save_item(NAME(m_page));
|
||||
save_item(NAME(m_io_page));
|
||||
@ -291,7 +517,7 @@ void quasar_state::machine_start()
|
||||
|
||||
void quasar_state::machine_reset()
|
||||
{
|
||||
cvs_state::machine_reset();
|
||||
cvs_base_state::machine_reset();
|
||||
|
||||
m_effectcontrol = 0;
|
||||
m_page = 0;
|
||||
@ -300,16 +526,16 @@ void quasar_state::machine_reset()
|
||||
|
||||
void quasar_state::quasar(machine_config &config)
|
||||
{
|
||||
/* basic machine hardware */
|
||||
S2650(config, m_maincpu, 14318000/4); /* 14 mhz crystal divide by 4 on board */
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &quasar_state::quasar_program);
|
||||
m_maincpu->set_addrmap(AS_IO, &quasar_state::quasar_io);
|
||||
m_maincpu->set_addrmap(AS_DATA, &quasar_state::quasar_data);
|
||||
m_maincpu->set_vblank_int("screen", FUNC(quasar_state::quasar_interrupt));
|
||||
// basic machine hardware
|
||||
S2650(config, m_maincpu, 14'318'000 / 4); // 14 mhz crystal divide by 4 on board
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &quasar_state::program);
|
||||
m_maincpu->set_addrmap(AS_IO, &quasar_state::io);
|
||||
m_maincpu->set_addrmap(AS_DATA, &quasar_state::data);
|
||||
m_maincpu->set_vblank_int("screen", FUNC(quasar_state::irq0_line_assert));
|
||||
m_maincpu->sense_handler().set("screen", FUNC(screen_device::vblank));
|
||||
m_maincpu->intack_handler().set([this]() { m_maincpu->set_input_line(0, CLEAR_LINE); return 0x03; });
|
||||
|
||||
i8035_device &soundcpu(I8035(config, "soundcpu", 6000000)); /* 6MHz crystal divide by 15 in CPU */
|
||||
i8035_device &soundcpu(I8035(config, "soundcpu", 6'000'000)); // 6MHz crystal divide by 15 in CPU
|
||||
soundcpu.set_addrmap(AS_PROGRAM, &quasar_state::sound_map);
|
||||
soundcpu.set_addrmap(AS_IO, &quasar_state::sound_portmap);
|
||||
soundcpu.t1_in_cb().set(FUNC(quasar_state::audio_t1_r));
|
||||
@ -317,17 +543,17 @@ void quasar_state::quasar(machine_config &config)
|
||||
|
||||
config.set_maximum_quantum(attotime::from_hz(6000));
|
||||
|
||||
/* video hardware */
|
||||
// video hardware
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
m_screen->set_refresh_hz(50); /* From dot clock */
|
||||
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
|
||||
m_screen->set_refresh_hz(50); // From dot clock
|
||||
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate
|
||||
m_screen->set_size(256, 256);
|
||||
m_screen->set_visarea(1*8+1, 29*8-1, 2*8, 32*8-1);
|
||||
m_screen->set_screen_update(FUNC(quasar_state::screen_update_quasar));
|
||||
m_screen->set_screen_update(FUNC(quasar_state::screen_update));
|
||||
m_screen->set_palette(m_palette);
|
||||
|
||||
GFXDECODE(config, m_gfxdecode, m_palette, gfx_quasar);
|
||||
PALETTE(config, m_palette, FUNC(quasar_state::quasar_palette), (64 + 1) * 8 + (4 * 256), 0x500);
|
||||
PALETTE(config, m_palette, FUNC(quasar_state::palette), (64 + 1) * 8 + (4 * 256), 0x500);
|
||||
|
||||
S2636(config, m_s2636[0], 0);
|
||||
m_s2636[0]->set_offsets(CVS_S2636_Y_OFFSET - 8, CVS_S2636_X_OFFSET - 9);
|
||||
@ -338,7 +564,7 @@ void quasar_state::quasar(machine_config &config)
|
||||
S2636(config, m_s2636[2], 0);
|
||||
m_s2636[2]->set_offsets(CVS_S2636_Y_OFFSET - 8, CVS_S2636_X_OFFSET - 9);
|
||||
|
||||
/* sound hardware */
|
||||
// sound hardware
|
||||
GENERIC_LATCH_8(config, m_soundlatch);
|
||||
|
||||
SPEAKER(config, "speaker").front_center();
|
||||
@ -366,7 +592,7 @@ ROM_START( quasar )
|
||||
ROM_REGION( 0x1000, "soundcpu", 0 )
|
||||
ROM_LOAD( "quasar.snd", 0x0000, 0x0800, CRC(9e489768) SHA1(a9f01ef0a6512543bbdfec56037f37a0440b2b94) )
|
||||
|
||||
ROM_REGION( 0x1800, "gfx1", 0 )
|
||||
ROM_REGION( 0x1800, "tiles", 0 )
|
||||
ROM_LOAD( "6g.bin", 0x0000, 0x0800, CRC(deb2f4a9) SHA1(9a15d07a9b35bef34ce923973fc59fbd911f8111) )
|
||||
ROM_LOAD( "7g.bin", 0x0800, 0x0800, CRC(76222f30) SHA1(937286fcb50bd0a61db9e71e04b5eb1a0746e1c0) )
|
||||
ROM_LOAD( "9g.bin", 0x1000, 0x0800, CRC(fd0a36e9) SHA1(93f1207a36418b9ab15a25163a092308b9916528) )
|
||||
@ -396,7 +622,7 @@ ROM_START( quasara )
|
||||
ROM_REGION( 0x1000, "soundcpu", 0 )
|
||||
ROM_LOAD( "quasar.snd", 0x0000, 0x0800, CRC(9e489768) SHA1(a9f01ef0a6512543bbdfec56037f37a0440b2b94) )
|
||||
|
||||
ROM_REGION( 0x1800, "gfx1", 0 )
|
||||
ROM_REGION( 0x1800, "tiles", 0 )
|
||||
ROM_LOAD( "6g.bin", 0x0000, 0x0800, CRC(deb2f4a9) SHA1(9a15d07a9b35bef34ce923973fc59fbd911f8111) )
|
||||
ROM_LOAD( "7g.bin", 0x0800, 0x0800, CRC(76222f30) SHA1(937286fcb50bd0a61db9e71e04b5eb1a0746e1c0) )
|
||||
ROM_LOAD( "9g.bin", 0x1000, 0x0800, CRC(fd0a36e9) SHA1(93f1207a36418b9ab15a25163a092308b9916528) )
|
||||
@ -405,6 +631,8 @@ ROM_START( quasara )
|
||||
ROM_LOAD( "12m_q.bin", 0x0000, 0x0200, CRC(1ab8633d) SHA1(3aed29f2326676a8d8a5de6f6bb923b6510896d8) )
|
||||
ROM_END
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
GAME( 1980, quasar, 0, quasar, quasar, quasar_state, empty_init, ROT90, "Zaccaria / Zelco", "Quasar (set 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1980, quasara, quasar, quasar, quasar, quasar_state, empty_init, ROT90, "Zaccaria / Zelco", "Quasar (set 2)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
|
||||
|
@ -1,54 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Mike Coates, Pierpaolo Prazzoli
|
||||
/***************************************************************************
|
||||
|
||||
Zaccaria Quasar
|
||||
|
||||
****************************************************************************/
|
||||
#ifndef MAME_CVS_QUASAR_H
|
||||
#define MAME_CVS_QUASAR_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cvs.h"
|
||||
|
||||
class quasar_state : public cvs_state
|
||||
{
|
||||
public:
|
||||
quasar_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: cvs_state(mconfig, type, tag)
|
||||
{ }
|
||||
|
||||
void quasar(machine_config &config);
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
|
||||
private:
|
||||
void video_page_select_w(offs_t offset, uint8_t data);
|
||||
void io_page_select_w(offs_t offset, uint8_t data);
|
||||
void quasar_video_w(offs_t offset, uint8_t data);
|
||||
uint8_t quasar_IO_r();
|
||||
void quasar_bullet_w(offs_t offset, uint8_t data);
|
||||
void quasar_sh_command_w(uint8_t data);
|
||||
uint8_t quasar_sh_command_r();
|
||||
DECLARE_READ_LINE_MEMBER(audio_t1_r);
|
||||
void quasar_palette(palette_device &palette) const;
|
||||
uint32_t screen_update_quasar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(quasar_interrupt);
|
||||
|
||||
void quasar_program(address_map &map);
|
||||
void quasar_data(address_map &map);
|
||||
void quasar_io(address_map &map);
|
||||
void sound_map(address_map &map);
|
||||
void sound_portmap(address_map &map);
|
||||
|
||||
std::unique_ptr<uint8_t[]> m_effectram;
|
||||
uint8_t m_effectcontrol = 0;
|
||||
uint8_t m_page = 0;
|
||||
uint8_t m_io_page = 0;
|
||||
};
|
||||
|
||||
#endif // MAME_CVS_QUASAR_H
|
@ -1,182 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Mike Coates, Pierpaolo Prazzoli
|
||||
/***************************************************************************
|
||||
|
||||
video\quasar.cpp
|
||||
|
||||
Functions to emulate the video hardware of the machine.
|
||||
|
||||
Zaccaria S2650 games share various levels of design with the Century Video
|
||||
System (CVS) games, and hence some routines are shared from there.
|
||||
|
||||
Shooting seems to mix custom boards from Zaccaria and sound boards from CVS
|
||||
hinting at a strong link between the two companies.
|
||||
|
||||
Zaccaria are an italian company, Century were based in Manchester UK
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/s2650/s2650.h"
|
||||
#include "quasar.h"
|
||||
|
||||
void quasar_state::quasar_palette(palette_device &palette) const
|
||||
{
|
||||
uint8_t const *const color_prom = memregion("proms")->base();
|
||||
|
||||
// standard 1 bit per color palette (background and sprites)
|
||||
for (int i = 0; i < 8; i++)
|
||||
palette.set_indirect_color(i, rgb_t(pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2)));
|
||||
|
||||
// effects color map
|
||||
for (int i = 0; i < 0x100; i++)
|
||||
{
|
||||
int bit0, bit1, bit2;
|
||||
|
||||
// red component
|
||||
bit0 = BIT(i, 0);
|
||||
bit1 = BIT(i, 1);
|
||||
bit2 = BIT(i, 2);
|
||||
int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
// green component
|
||||
bit0 = BIT(i, 3);
|
||||
bit1 = BIT(i, 4);
|
||||
bit2 = BIT(i, 5);
|
||||
int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
// blue component
|
||||
bit0 = BIT(i, 6);
|
||||
bit1 = BIT(i, 7);
|
||||
int const b = 0x4f * bit0 + 0xa8 * bit1;
|
||||
|
||||
// intensity 0
|
||||
palette.set_indirect_color(0x100 + i, rgb_t::black());
|
||||
|
||||
// intensity 1
|
||||
palette.set_indirect_color(0x200 + i, rgb_t(r >> 2, g >> 2, b >> 2));
|
||||
|
||||
/* intensity 2 */
|
||||
palette.set_indirect_color(0x300 + i, rgb_t((r >> 2) + (r >> 3), (g >> 2) + (g >> 3), (b >> 2) + (b >> 2)));
|
||||
|
||||
/* intensity 3 */
|
||||
palette.set_indirect_color(0x400 + i, rgb_t(r >> 1, g >> 1, b >> 1));
|
||||
}
|
||||
|
||||
// Address 0-2 from graphic rom
|
||||
// 3-5 from color ram
|
||||
// 6-8 from sprite chips (Used for priority)
|
||||
for (int i = 0; i < 0x200; i++)
|
||||
palette.set_pen_indirect(i, color_prom[i] & 0x07);
|
||||
|
||||
// background for collision
|
||||
for (int i = 1; i < 8; i++)
|
||||
palette.set_pen_indirect(0x200 + i, 7);
|
||||
palette.set_pen_indirect(0x200, 0);
|
||||
|
||||
// effects
|
||||
for (int i = 0; i < 0x400; i++)
|
||||
palette.set_pen_indirect(0x208 + i, 0x100 + i);
|
||||
}
|
||||
|
||||
|
||||
void quasar_state::video_start()
|
||||
{
|
||||
m_effectram = std::make_unique<uint8_t[]>(0x400);
|
||||
|
||||
/* create helper bitmap */
|
||||
m_screen->register_screen_bitmap(m_collision_background);
|
||||
|
||||
/* register save */
|
||||
save_item(NAME(m_collision_background));
|
||||
save_pointer(NAME(m_effectram), 0x400);
|
||||
}
|
||||
|
||||
uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
// for every character in the video RAM
|
||||
for (int offs = 0; offs < 0x0400; offs++)
|
||||
{
|
||||
uint8_t const code = m_video_ram[offs];
|
||||
uint8_t const x = (offs & 0x1f) << 3;
|
||||
uint8_t const y = (offs >> 5) << 3;
|
||||
|
||||
// While we have the current character code, draw the effects layer
|
||||
// intensity / on and off controlled by latch
|
||||
|
||||
int const forecolor = 0x208 + m_effectram[offs] + (256 * (((m_effectcontrol >> 4) ^ 3) & 3));
|
||||
|
||||
for (int ox = 0; ox < 8; ox++)
|
||||
for (int oy = 0; oy < 8; oy++)
|
||||
bitmap.pix(y + oy, x + ox) = forecolor;
|
||||
|
||||
// Main Screen
|
||||
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
|
||||
code,
|
||||
m_color_ram[offs] & 0x3f,
|
||||
0,0,
|
||||
x,y,0);
|
||||
|
||||
|
||||
// background for Collision Detection (it can only hit certain items)
|
||||
if ((m_color_ram[offs] & 7) == 0)
|
||||
{
|
||||
m_gfxdecode->gfx(0)->opaque(m_collision_background,cliprect,
|
||||
code,
|
||||
64,
|
||||
0,0,
|
||||
x,y);
|
||||
}
|
||||
}
|
||||
|
||||
/* update the S2636 chips */
|
||||
bitmap_ind16 const &s2636_0_bitmap = m_s2636[0]->update(cliprect);
|
||||
bitmap_ind16 const &s2636_1_bitmap = m_s2636[1]->update(cliprect);
|
||||
bitmap_ind16 const &s2636_2_bitmap = m_s2636[2]->update(cliprect);
|
||||
|
||||
// Bullet Hardware
|
||||
for (int offs = 8; offs < 256; offs++)
|
||||
{
|
||||
if (m_bullet_ram[offs] != 0)
|
||||
{
|
||||
for (int ct = 0; ct < 1; ct++)
|
||||
{
|
||||
int const bx = 255 - 9 - m_bullet_ram[offs] - ct;
|
||||
|
||||
// bullet/object Collision
|
||||
if (s2636_0_bitmap.pix(offs, bx) != 0) m_collision_register |= 0x04;
|
||||
if (s2636_2_bitmap.pix(offs, bx) != 0) m_collision_register |= 0x08;
|
||||
|
||||
bitmap.pix(offs, bx) = 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// mix and copy the S2636 images into the main bitmap, also check for collision
|
||||
for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
|
||||
{
|
||||
for (int x = cliprect.left(); x <= cliprect.right(); x++)
|
||||
{
|
||||
int const pixel0 = s2636_0_bitmap.pix(y, x);
|
||||
int const pixel1 = s2636_1_bitmap.pix(y, x);
|
||||
int const pixel2 = s2636_2_bitmap.pix(y, x);
|
||||
|
||||
int const pixel = pixel0 | pixel1 | pixel2;
|
||||
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel))
|
||||
{
|
||||
bitmap.pix(y, x) = S2636_PIXEL_COLOR(pixel);
|
||||
|
||||
/* S2636 vs. background collision detection */
|
||||
if (m_palette->pen_indirect(m_collision_background.pix(y, x)))
|
||||
{
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x01;
|
||||
if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user