mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
cvs,quasar,galaxia: shorthand variable types
This commit is contained in:
parent
0cf2b03a73
commit
9dd37ab2ed
@ -155,23 +155,23 @@ protected:
|
||||
|
||||
private:
|
||||
// memory pointers
|
||||
memory_share_creator<uint8_t> m_palette_ram;
|
||||
memory_share_creator<uint8_t> m_character_ram; // only half is used, but we can use the same gfx_layout like this
|
||||
required_shared_ptr<uint8_t> m_4_bit_dac_data;
|
||||
required_shared_ptr<uint8_t> m_tms5110_ctl_data;
|
||||
required_shared_ptr<uint8_t> m_sh_trigger;
|
||||
required_region_ptr<uint8_t> m_speech_data_rom;
|
||||
memory_share_creator<u8> m_palette_ram;
|
||||
memory_share_creator<u8> m_character_ram; // only half is used, but we can use the same gfx_layout like this
|
||||
required_shared_ptr<u8> m_4_bit_dac_data;
|
||||
required_shared_ptr<u8> m_tms5110_ctl_data;
|
||||
required_shared_ptr<u8> m_sh_trigger;
|
||||
required_region_ptr<u8> m_speech_data_rom;
|
||||
|
||||
bitmap_ind16 m_background_bitmap = 0;
|
||||
bitmap_ind16 m_scrolled_collision_background = 0;
|
||||
uint8_t m_stars_on = 0U;
|
||||
uint8_t m_scroll_reg = 0U;
|
||||
u8 m_stars_on = 0U;
|
||||
u8 m_scroll_reg = 0U;
|
||||
|
||||
// misc
|
||||
uint8_t m_protection_counter = 0U;
|
||||
uint16_t m_character_ram_page_start = 0U;
|
||||
uint8_t m_character_banking_mode = 0U;
|
||||
uint16_t m_speech_rom_bit_address = 0U;
|
||||
u8 m_protection_counter = 0U;
|
||||
u16 m_character_ram_page_start = 0U;
|
||||
u8 m_character_banking_mode = 0U;
|
||||
u16 m_speech_rom_bit_address = 0U;
|
||||
|
||||
// devices
|
||||
required_device<s2650_device> m_audiocpu;
|
||||
@ -190,30 +190,30 @@ private:
|
||||
void main_cpu_map(address_map &map) ATTR_COLD;
|
||||
void speech_cpu_map(address_map &map) ATTR_COLD;
|
||||
|
||||
uint8_t huncholy_prot_r(offs_t offset);
|
||||
uint8_t superbik_prot_r();
|
||||
uint8_t hero_prot_r(offs_t offset);
|
||||
u8 huncholy_prot_r(offs_t offset);
|
||||
u8 superbik_prot_r();
|
||||
u8 hero_prot_r(offs_t offset);
|
||||
int speech_rom_read_bit();
|
||||
void audio_cpu_interrupt(int state);
|
||||
void main_cpu_interrupt(int state);
|
||||
uint8_t input_r(offs_t offset);
|
||||
void speech_rom_address_lo_w(uint8_t data);
|
||||
void speech_rom_address_hi_w(uint8_t data);
|
||||
uint8_t speech_command_r();
|
||||
void audio_command_w(uint8_t data);
|
||||
uint8_t palette_r(offs_t offset) { return m_palette_ram[offset & 0x0f]; }
|
||||
void palette_w(offs_t offset, uint8_t data) { m_palette_ram[offset & 0x0f] = data; }
|
||||
void video_fx_w(uint8_t data);
|
||||
void scroll_w(uint8_t data);
|
||||
void _4_bit_dac_data_w(offs_t offset, uint8_t data);
|
||||
void sh_trigger_w(offs_t offset, uint8_t data);
|
||||
void tms5110_ctl_w(offs_t offset, uint8_t data);
|
||||
void tms5110_pdc_w(offs_t offset, uint8_t data);
|
||||
u8 input_r(offs_t offset);
|
||||
void speech_rom_address_lo_w(u8 data);
|
||||
void speech_rom_address_hi_w(u8 data);
|
||||
u8 speech_command_r();
|
||||
void audio_command_w(u8 data);
|
||||
u8 palette_r(offs_t offset) { return m_palette_ram[offset & 0x0f]; }
|
||||
void palette_w(offs_t offset, u8 data) { m_palette_ram[offset & 0x0f] = data; }
|
||||
void video_fx_w(u8 data);
|
||||
void scroll_w(u8 data);
|
||||
void _4_bit_dac_data_w(offs_t offset, u8 data);
|
||||
void sh_trigger_w(offs_t offset, u8 data);
|
||||
void tms5110_ctl_w(offs_t offset, u8 data);
|
||||
void tms5110_pdc_w(offs_t offset, u8 data);
|
||||
void palette(palette_device &palette) const ATTR_COLD;
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void set_pens();
|
||||
template <uint8_t Which> uint8_t character_ram_r(offs_t offset);
|
||||
template <uint8_t Which> void character_ram_w(offs_t offset, uint8_t data);
|
||||
template <u8 Which> u8 character_ram_r(offs_t offset);
|
||||
template <u8 Which> void character_ram_w(offs_t offset, u8 data);
|
||||
};
|
||||
|
||||
|
||||
@ -227,19 +227,19 @@ private:
|
||||
* colours are taken from SRAM and are programmable *
|
||||
******************************************************/
|
||||
|
||||
static constexpr uint16_t SPRITE_PEN_BASE = 0x820;
|
||||
static constexpr uint16_t BULLET_STAR_PEN = 0x828;
|
||||
static constexpr u16 SPRITE_PEN_BASE = 0x820;
|
||||
static constexpr u16 BULLET_STAR_PEN = 0x828;
|
||||
|
||||
void cvs_state::palette(palette_device &palette) const
|
||||
{
|
||||
uint8_t const *const color_prom = memregion("proms")->base();
|
||||
u8 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;
|
||||
u8 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);
|
||||
@ -279,7 +279,7 @@ void cvs_state::set_pens()
|
||||
}
|
||||
|
||||
|
||||
void cvs_state::video_fx_w(uint8_t data)
|
||||
void cvs_state::video_fx_w(u8 data)
|
||||
{
|
||||
if (data & 0xce)
|
||||
LOGMASKED(LOG_VIDEOFX, "%04x: Unimplemented CVS video fx = %2x\n", m_maincpu->pc(), data & 0xce);
|
||||
@ -298,7 +298,7 @@ void cvs_state::video_fx_w(uint8_t data)
|
||||
}
|
||||
|
||||
|
||||
void cvs_state::scroll_w(uint8_t data)
|
||||
void cvs_state::scroll_w(u8 data)
|
||||
{
|
||||
m_scroll_reg = 255 - data;
|
||||
}
|
||||
@ -324,7 +324,7 @@ void cvs_state::video_start()
|
||||
}
|
||||
|
||||
|
||||
uint32_t cvs_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
u32 cvs_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
static const int ram_based_char_start_indices[] = { 0xe0, 0xc0, 0x100, 0x80 };
|
||||
|
||||
@ -334,11 +334,11 @@ uint32_t cvs_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c
|
||||
for (offs_t offs = 0; offs < 0x0400; offs++)
|
||||
{
|
||||
int collision_color = 0x100;
|
||||
uint8_t const code = m_video_ram[offs];
|
||||
uint8_t const color = m_color_ram[offs];
|
||||
u8 const code = m_video_ram[offs];
|
||||
u8 const color = m_color_ram[offs];
|
||||
|
||||
uint8_t const x = offs << 3;
|
||||
uint8_t const y = offs >> 5 << 3;
|
||||
u8 const x = offs << 3;
|
||||
u8 const y = offs >> 5 << 3;
|
||||
|
||||
int const gfxnum = (code < ram_based_char_start_indices[m_character_banking_mode]) ? 0 : 1;
|
||||
|
||||
@ -457,14 +457,14 @@ uint32_t cvs_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c
|
||||
*
|
||||
*************************************/
|
||||
|
||||
template <uint8_t Which>
|
||||
uint8_t cvs_state::character_ram_r(offs_t offset)
|
||||
template <u8 Which>
|
||||
u8 cvs_state::character_ram_r(offs_t offset)
|
||||
{
|
||||
return m_character_ram[(Which * 0x800) | 0x400 | m_character_ram_page_start | offset];
|
||||
}
|
||||
|
||||
template <uint8_t Which>
|
||||
void cvs_state::character_ram_w(offs_t offset, uint8_t data)
|
||||
template <u8 Which>
|
||||
void cvs_state::character_ram_w(offs_t offset, u8 data)
|
||||
{
|
||||
offset |= (Which * 0x800) | 0x400 | m_character_ram_page_start;
|
||||
m_character_ram[offset] = data;
|
||||
@ -498,9 +498,9 @@ void cvs_state::audio_cpu_interrupt(int state)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
uint8_t cvs_state::input_r(offs_t offset)
|
||||
u8 cvs_state::input_r(offs_t offset)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
u8 ret = 0;
|
||||
|
||||
// the upper 4 bits of the address is used to select the character banking attributes
|
||||
m_character_banking_mode = (offset >> 4) & 0x03;
|
||||
@ -529,7 +529,7 @@ uint8_t cvs_state::input_r(offs_t offset)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void cvs_state::_4_bit_dac_data_w(offs_t offset, uint8_t data)
|
||||
void cvs_state::_4_bit_dac_data_w(offs_t offset, u8 data)
|
||||
{
|
||||
data = BIT(data, 7);
|
||||
|
||||
@ -540,7 +540,7 @@ void cvs_state::_4_bit_dac_data_w(offs_t offset, uint8_t data)
|
||||
}
|
||||
|
||||
// merge into D0-D3
|
||||
uint8_t const dac_value = (m_4_bit_dac_data[0] << 0) |
|
||||
u8 const dac_value = (m_4_bit_dac_data[0] << 0) |
|
||||
(m_4_bit_dac_data[1] << 1) |
|
||||
(m_4_bit_dac_data[2] << 2) |
|
||||
(m_4_bit_dac_data[3] << 3);
|
||||
@ -549,7 +549,7 @@ void cvs_state::_4_bit_dac_data_w(offs_t offset, uint8_t data)
|
||||
m_dac2->write(dac_value);
|
||||
}
|
||||
|
||||
void cvs_state::sh_trigger_w(offs_t offset, uint8_t data)
|
||||
void cvs_state::sh_trigger_w(offs_t offset, u8 data)
|
||||
{
|
||||
/* offset 0 is used in darkwar, spacefrt, logger, raiders
|
||||
* offset 2 is used in darkwar, spacefrt, 8ball, superbik, raiders
|
||||
@ -578,21 +578,21 @@ void cvs_state::sh_trigger_w(offs_t offset, uint8_t data)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void cvs_state::speech_rom_address_lo_w(uint8_t data)
|
||||
void cvs_state::speech_rom_address_lo_w(u8 data)
|
||||
{
|
||||
// assuming that d0-d2 are cleared here
|
||||
m_speech_rom_bit_address = (m_speech_rom_bit_address & 0xf800) | (data << 3);
|
||||
LOGMASKED(LOG_SPEECH, "%04x : CVS: Speech Lo %02x Address = %04x\n", m_speechcpu->pc(), data, m_speech_rom_bit_address >> 3);
|
||||
}
|
||||
|
||||
void cvs_state::speech_rom_address_hi_w(uint8_t data)
|
||||
void cvs_state::speech_rom_address_hi_w(u8 data)
|
||||
{
|
||||
m_speech_rom_bit_address = (m_speech_rom_bit_address & 0x07ff) | (data << 11);
|
||||
LOGMASKED(LOG_SPEECH, "%04x : CVS: Speech Hi %02x Address = %04x\n", m_speechcpu->pc(), data, m_speech_rom_bit_address >> 3);
|
||||
}
|
||||
|
||||
|
||||
uint8_t cvs_state::speech_command_r()
|
||||
u8 cvs_state::speech_command_r()
|
||||
{
|
||||
/* FIXME: this was by observation on board ???
|
||||
* -bit 7 is TMS status (active LO) */
|
||||
@ -600,14 +600,14 @@ uint8_t cvs_state::speech_command_r()
|
||||
}
|
||||
|
||||
|
||||
void cvs_state::tms5110_ctl_w(offs_t offset, uint8_t data)
|
||||
void cvs_state::tms5110_ctl_w(offs_t offset, u8 data)
|
||||
{
|
||||
/*
|
||||
* offset 0: CS ?
|
||||
*/
|
||||
m_tms5110_ctl_data[offset] = (~data >> 7) & 0x01;
|
||||
|
||||
uint8_t const ctl = 0 | // CTL1
|
||||
u8 const ctl = 0 | // CTL1
|
||||
(m_tms5110_ctl_data[1] << 1) | // CTL2
|
||||
(m_tms5110_ctl_data[2] << 2) | // CTL4
|
||||
(m_tms5110_ctl_data[1] << 3); // CTL8
|
||||
@ -617,9 +617,9 @@ void cvs_state::tms5110_ctl_w(offs_t offset, uint8_t data)
|
||||
}
|
||||
|
||||
|
||||
void cvs_state::tms5110_pdc_w(offs_t offset, uint8_t data)
|
||||
void cvs_state::tms5110_pdc_w(offs_t offset, u8 data)
|
||||
{
|
||||
uint8_t const out = ((~data) >> 7) & 1;
|
||||
u8 const out = ((~data) >> 7) & 1;
|
||||
LOGMASKED(LOG_SPEECH, "CVS: Speech PDC = %02x %02x\n", offset, out);
|
||||
m_tms5110->pdc_w(out);
|
||||
}
|
||||
@ -645,7 +645,7 @@ int cvs_state::speech_rom_read_bit()
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void cvs_state::audio_command_w(uint8_t data)
|
||||
void cvs_state::audio_command_w(u8 data)
|
||||
{
|
||||
//LOG(("data %02x\n", data));
|
||||
// cause interrupt on audio CPU if bit 7 set
|
||||
@ -1217,13 +1217,13 @@ void cvs_state::cvs(machine_config &config)
|
||||
m_screen->screen_vblank().append(FUNC(cvs_state::scroll_start));
|
||||
|
||||
S2636(config, m_s2636[0], 0);
|
||||
m_s2636[0]->set_offsets(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
|
||||
m_s2636[0]->set_offsets(-5, -26);
|
||||
|
||||
S2636(config, m_s2636[1], 0);
|
||||
m_s2636[1]->set_offsets(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
|
||||
m_s2636[1]->set_offsets(-5, -26);
|
||||
|
||||
S2636(config, m_s2636[2], 0);
|
||||
m_s2636[2]->set_offsets(CVS_S2636_Y_OFFSET, CVS_S2636_X_OFFSET);
|
||||
m_s2636[2]->set_offsets(-5, -26);
|
||||
|
||||
// audio hardware
|
||||
SPEAKER(config, "speaker").front_center();
|
||||
@ -1761,7 +1761,7 @@ ROM_END
|
||||
|
||||
void cvs_state::init_hunchbaka()
|
||||
{
|
||||
uint8_t *rom = memregion("maincpu")->base();
|
||||
u8 *rom = memregion("maincpu")->base();
|
||||
|
||||
// data lines D2 and D5 swapped
|
||||
for (offs_t offs = 0; offs < 0x7400; offs++)
|
||||
@ -1769,7 +1769,7 @@ void cvs_state::init_hunchbaka()
|
||||
}
|
||||
|
||||
|
||||
uint8_t cvs_state::superbik_prot_r()
|
||||
u8 cvs_state::superbik_prot_r()
|
||||
{
|
||||
if (!machine().side_effects_disabled())
|
||||
m_protection_counter++;
|
||||
@ -1785,7 +1785,7 @@ void cvs_state::init_superbik()
|
||||
|
||||
void cvs_state::init_raiders()
|
||||
{
|
||||
uint8_t *rom = memregion("maincpu")->base();
|
||||
u8 *rom = memregion("maincpu")->base();
|
||||
|
||||
// data lines D1 and D6 swapped
|
||||
for (offs_t offs = 0; offs < 0x7400; offs++)
|
||||
@ -1796,7 +1796,7 @@ void cvs_state::init_raiders()
|
||||
}
|
||||
|
||||
|
||||
uint8_t cvs_state::hero_prot_r(offs_t offset)
|
||||
u8 cvs_state::hero_prot_r(offs_t offset)
|
||||
{
|
||||
u8 *rom = memregion("maincpu")->base() + 0x73f0;
|
||||
|
||||
@ -1827,7 +1827,7 @@ void cvs_state::init_hero()
|
||||
}
|
||||
|
||||
|
||||
uint8_t cvs_state::huncholy_prot_r(offs_t offset)
|
||||
u8 cvs_state::huncholy_prot_r(offs_t offset)
|
||||
{
|
||||
if (offset == 1)
|
||||
{
|
||||
|
@ -24,12 +24,12 @@ void cvs_base_state::machine_reset()
|
||||
|
||||
// collision register accesors
|
||||
|
||||
uint8_t cvs_base_state::collision_r()
|
||||
u8 cvs_base_state::collision_r()
|
||||
{
|
||||
return m_collision;
|
||||
}
|
||||
|
||||
uint8_t cvs_base_state::collision_clear_r()
|
||||
u8 cvs_base_state::collision_clear_r()
|
||||
{
|
||||
if (!machine().side_effects_disabled())
|
||||
m_collision = 0;
|
||||
@ -47,7 +47,7 @@ void cvs_base_state::scroll_start(int state)
|
||||
|
||||
void cvs_base_state::init_stars()
|
||||
{
|
||||
uint32_t generator = 0;
|
||||
u32 generator = 0;
|
||||
m_total_stars = 0;
|
||||
|
||||
// precalculate the star background
|
||||
@ -74,8 +74,8 @@ void cvs_base_state::update_stars(bitmap_ind16 &bitmap, const rectangle &cliprec
|
||||
{
|
||||
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);
|
||||
u8 x = (m_stars[offs].x + m_stars_scroll) >> 1;
|
||||
u8 y = m_stars[offs].y + ((m_stars_scroll + m_stars[offs].x) >> 9);
|
||||
|
||||
if (BIT(y, 0) ^ BIT(x, 4))
|
||||
{
|
||||
|
@ -38,9 +38,7 @@ protected:
|
||||
, m_ram_view(*this, "video_color_ram_view")
|
||||
{ }
|
||||
|
||||
static inline constexpr uint8_t CVS_MAX_STARS = 128;
|
||||
static inline constexpr int8_t CVS_S2636_Y_OFFSET = -5;
|
||||
static inline constexpr int8_t CVS_S2636_X_OFFSET = -26;
|
||||
static inline constexpr u8 CVS_MAX_STARS = 128;
|
||||
|
||||
struct cvs_star
|
||||
{
|
||||
@ -48,14 +46,14 @@ protected:
|
||||
};
|
||||
|
||||
// memory pointers
|
||||
required_shared_ptr<uint8_t> m_bullet_ram;
|
||||
required_shared_ptr<u8> m_bullet_ram;
|
||||
|
||||
// video-related
|
||||
cvs_star m_stars[CVS_MAX_STARS];
|
||||
bitmap_ind16 m_collision_background;
|
||||
uint8_t m_collision = 0U;
|
||||
uint16_t m_total_stars = 0U;
|
||||
uint8_t m_stars_scroll = 0U;
|
||||
u8 m_collision = 0U;
|
||||
u16 m_total_stars = 0U;
|
||||
u8 m_stars_scroll = 0U;
|
||||
|
||||
// devices
|
||||
required_device<s2650_device> m_maincpu;
|
||||
@ -65,16 +63,16 @@ protected:
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
// memory
|
||||
memory_share_creator<uint8_t> m_video_ram;
|
||||
memory_share_creator<uint8_t> m_color_ram;
|
||||
memory_share_creator<u8> m_video_ram;
|
||||
memory_share_creator<u8> m_color_ram;
|
||||
|
||||
memory_view m_ram_view;
|
||||
|
||||
virtual void machine_start() override ATTR_COLD;
|
||||
virtual void machine_reset() override ATTR_COLD;
|
||||
|
||||
uint8_t collision_r();
|
||||
uint8_t collision_clear_r();
|
||||
u8 collision_r();
|
||||
u8 collision_clear_r();
|
||||
void scroll_start(int state);
|
||||
void init_stars() ATTR_COLD;
|
||||
void update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, const pen_t star_pen, bool update_always);
|
||||
|
@ -116,8 +116,8 @@ protected:
|
||||
virtual void video_start() override ATTR_COLD;
|
||||
|
||||
// max stars is more than it needs to be, to allow experimenting with the star generator
|
||||
static constexpr uint16_t MAX_STARS = 0x800;
|
||||
static constexpr uint8_t STAR_PEN = 0x18;
|
||||
static constexpr u16 MAX_STARS = 0x800;
|
||||
static constexpr u8 STAR_PEN = 0x18;
|
||||
|
||||
// devices
|
||||
required_device<s2650_device> m_maincpu;
|
||||
@ -127,28 +127,28 @@ protected:
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
// memory
|
||||
memory_share_creator<uint8_t> m_video_ram;
|
||||
memory_share_creator<uint8_t> m_color_ram;
|
||||
required_shared_ptr<uint8_t> m_bullet_ram;
|
||||
memory_share_creator<u8> m_video_ram;
|
||||
memory_share_creator<u8> m_color_ram;
|
||||
required_shared_ptr<u8> m_bullet_ram;
|
||||
|
||||
memory_view m_ram_view;
|
||||
|
||||
bitmap_ind16 m_temp_bitmap;
|
||||
tilemap_t *m_bg_tilemap = nullptr;
|
||||
|
||||
uint8_t m_collision = 0;
|
||||
uint16_t m_stars_scroll = 0;
|
||||
uint16_t m_total_stars = 0;
|
||||
u8 m_collision = 0;
|
||||
u16 m_stars_scroll = 0;
|
||||
u16 m_total_stars = 0;
|
||||
|
||||
struct star_t
|
||||
{
|
||||
uint16_t x = 0;
|
||||
uint16_t y = 0;
|
||||
uint8_t color = 0;
|
||||
u16 x = 0;
|
||||
u16 y = 0;
|
||||
u8 color = 0;
|
||||
};
|
||||
star_t m_stars[MAX_STARS];
|
||||
|
||||
template <uint8_t Which> void video_w(offs_t offset, uint8_t data);
|
||||
template <u8 Which> void video_w(offs_t offset, u8 data);
|
||||
void data_map(address_map &map) ATTR_COLD;
|
||||
void io_map(address_map &map) ATTR_COLD;
|
||||
|
||||
@ -157,18 +157,18 @@ protected:
|
||||
void stars_palette(palette_device &palette) const ATTR_COLD;
|
||||
virtual void palette(palette_device &palette) const ATTR_COLD;
|
||||
void draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
virtual u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
virtual void mem_map(address_map &map) ATTR_COLD;
|
||||
|
||||
void scroll_stars(int state);
|
||||
void init_stars() ATTR_COLD;
|
||||
void update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
void scroll_w(uint8_t data);
|
||||
uint8_t collision_r();
|
||||
uint8_t collision_clear_r();
|
||||
void ctrlport_w(uint8_t data);
|
||||
void dataport_w(uint8_t data);
|
||||
void scroll_w(u8 data);
|
||||
u8 collision_r();
|
||||
u8 collision_clear_r();
|
||||
void ctrlport_w(u8 data);
|
||||
void dataport_w(u8 data);
|
||||
};
|
||||
|
||||
class astrowar_state : public galaxia_state
|
||||
@ -182,7 +182,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void palette(palette_device &palette) const override ATTR_COLD;
|
||||
virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) override;
|
||||
virtual u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) override;
|
||||
virtual void mem_map(address_map &map) override ATTR_COLD;
|
||||
};
|
||||
|
||||
@ -222,13 +222,13 @@ void galaxia_state::stars_palette(palette_device &palette) const
|
||||
|
||||
void galaxia_state::palette(palette_device &palette) const
|
||||
{
|
||||
uint8_t const *const color_prom = memregion("proms")->base();
|
||||
u8 const *const color_prom = memregion("proms")->base();
|
||||
|
||||
// background from A5-A8
|
||||
for (int i = 0; i < 0x10; i++)
|
||||
{
|
||||
int index = bitswap<4>(i, 0, 1, 2, 3) << 5;
|
||||
uint8_t data = color_prom[index];
|
||||
u8 data = color_prom[index];
|
||||
|
||||
palette.set_pen_color(i, pal1bit(BIT(data, 0)), pal1bit(BIT(data, 1)), pal1bit(BIT(data, 2)));
|
||||
}
|
||||
@ -236,7 +236,7 @@ void galaxia_state::palette(palette_device &palette) const
|
||||
// sprites from A0-A3
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
uint8_t data = ~color_prom[i] & 7;
|
||||
u8 data = ~color_prom[i] & 7;
|
||||
palette.set_pen_color(i | 0x10, pal1bit(BIT(data, 2)), pal1bit(BIT(data, 1)), pal1bit(BIT(data, 0)));
|
||||
}
|
||||
|
||||
@ -268,7 +268,7 @@ void astrowar_state::palette(palette_device &palette) const
|
||||
|
||||
void galaxia_state::init_stars()
|
||||
{
|
||||
uint32_t generator = 0;
|
||||
u32 generator = 0;
|
||||
m_total_stars = 0;
|
||||
|
||||
// precalculate the star background
|
||||
@ -296,8 +296,8 @@ void galaxia_state::update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect
|
||||
{
|
||||
for (int offs = 0; offs < m_total_stars; offs++)
|
||||
{
|
||||
uint8_t x = ((m_stars[offs].x + m_stars_scroll) >> 1) % 240;
|
||||
uint16_t y = m_stars[offs].y;
|
||||
u8 x = ((m_stars[offs].x + m_stars_scroll) >> 1) % 240;
|
||||
u16 y = m_stars[offs].y;
|
||||
|
||||
if ((BIT(y, 4) ^ BIT(y, 8) ^ BIT(x, 5)))
|
||||
{
|
||||
@ -325,8 +325,8 @@ void galaxia_state::scroll_stars(int state)
|
||||
|
||||
TILE_GET_INFO_MEMBER(galaxia_state::get_bg_tile_info)
|
||||
{
|
||||
uint8_t code = m_video_ram[tile_index]; // d7 unused for galaxia
|
||||
uint8_t color = m_color_ram[tile_index]; // highest bits unused
|
||||
u8 code = m_video_ram[tile_index]; // d7 unused for galaxia
|
||||
u8 color = m_color_ram[tile_index]; // highest bits unused
|
||||
|
||||
tileinfo.set(0, code, color, 0);
|
||||
}
|
||||
@ -374,7 +374,7 @@ void galaxia_state::draw_background(screen_device &screen, bitmap_ind16 &bitmap,
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
uint32_t galaxia_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
u32 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);
|
||||
@ -435,7 +435,7 @@ uint32_t galaxia_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
|
||||
}
|
||||
|
||||
|
||||
uint32_t astrowar_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
u32 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);
|
||||
@ -497,26 +497,26 @@ uint32_t astrowar_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
template <uint8_t Which>
|
||||
void galaxia_state::video_w(offs_t offset, uint8_t data)
|
||||
template <u8 Which>
|
||||
void galaxia_state::video_w(offs_t offset, u8 data)
|
||||
{
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
Which ? m_video_ram[offset] = data : m_color_ram[offset] = data;
|
||||
}
|
||||
|
||||
void galaxia_state::scroll_w(uint8_t data)
|
||||
void galaxia_state::scroll_w(u8 data)
|
||||
{
|
||||
// fixed scrolling area
|
||||
for (int i = 1; i < 6; i++)
|
||||
m_bg_tilemap->set_scrolly(i, data);
|
||||
}
|
||||
|
||||
uint8_t galaxia_state::collision_r()
|
||||
u8 galaxia_state::collision_r()
|
||||
{
|
||||
return m_collision;
|
||||
}
|
||||
|
||||
uint8_t galaxia_state::collision_clear_r()
|
||||
u8 galaxia_state::collision_clear_r()
|
||||
{
|
||||
if (!machine().side_effects_disabled())
|
||||
m_collision = 0;
|
||||
@ -524,7 +524,7 @@ uint8_t galaxia_state::collision_clear_r()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void galaxia_state::ctrlport_w(uint8_t data)
|
||||
void galaxia_state::ctrlport_w(u8 data)
|
||||
{
|
||||
// d0: triggers on every new credit
|
||||
// d1: coin counter? if you put a coin in slot A, galaxia constantly
|
||||
@ -534,7 +534,7 @@ void galaxia_state::ctrlport_w(uint8_t data)
|
||||
// other bits: unknown
|
||||
}
|
||||
|
||||
void galaxia_state::dataport_w(uint8_t data)
|
||||
void galaxia_state::dataport_w(u8 data)
|
||||
{
|
||||
// seems to be related to sound board comms
|
||||
}
|
||||
|
@ -98,30 +98,30 @@ private:
|
||||
required_ioport_array<3> m_dsw;
|
||||
|
||||
// memory
|
||||
memory_share_creator<uint8_t> m_video_ram;
|
||||
memory_share_creator<uint8_t> m_color_ram;
|
||||
memory_share_creator<uint8_t> m_effectram;
|
||||
required_shared_ptr<uint8_t> m_bullet_ram;
|
||||
memory_share_creator<u8> m_video_ram;
|
||||
memory_share_creator<u8> m_color_ram;
|
||||
memory_share_creator<u8> m_effectram;
|
||||
required_shared_ptr<u8> m_bullet_ram;
|
||||
|
||||
bitmap_ind16 m_collision_background;
|
||||
uint8_t m_collision = 0U;
|
||||
uint8_t m_effectcontrol = 0U;
|
||||
u8 m_collision = 0U;
|
||||
u8 m_effectcontrol = 0U;
|
||||
|
||||
uint8_t m_page = 0U;
|
||||
uint8_t m_io_page = 0U;
|
||||
u8 m_page = 0U;
|
||||
u8 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);
|
||||
uint8_t collision_r();
|
||||
uint8_t collision_clear_r();
|
||||
void sh_command_w(uint8_t data);
|
||||
uint8_t sh_command_r();
|
||||
void video_page_select_w(offs_t offset, u8 data);
|
||||
void io_page_select_w(offs_t offset, u8 data);
|
||||
void video_w(offs_t offset, u8 data);
|
||||
u8 io_r();
|
||||
void bullet_w(offs_t offset, u8 data);
|
||||
u8 collision_r();
|
||||
u8 collision_clear_r();
|
||||
void sh_command_w(u8 data);
|
||||
u8 sh_command_r();
|
||||
int audio_t1_r();
|
||||
void palette(palette_device &palette) const ATTR_COLD;
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
u32 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;
|
||||
@ -156,7 +156,7 @@ void quasar_state::machine_reset()
|
||||
|
||||
void quasar_state::palette(palette_device &palette) const
|
||||
{
|
||||
uint8_t const *const color_prom = memregion("proms")->base();
|
||||
u8 const *const color_prom = memregion("proms")->base();
|
||||
|
||||
// standard 1 bit per color palette (background and sprites)
|
||||
for (int i = 0; i < 8; i++)
|
||||
@ -219,14 +219,14 @@ void quasar_state::video_start()
|
||||
save_item(NAME(m_collision_background));
|
||||
}
|
||||
|
||||
uint32_t quasar_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
u32 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;
|
||||
u8 const code = m_video_ram[offs];
|
||||
u8 const x = (offs & 0x1f) << 3;
|
||||
u8 const y = (offs >> 5) << 3;
|
||||
|
||||
// While we have the current character code, draw the effects layer
|
||||
// intensity / on and off controlled by latch
|
||||
@ -320,12 +320,12 @@ uint32_t quasar_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
void quasar_state::video_page_select_w(offs_t offset, uint8_t data)
|
||||
void quasar_state::video_page_select_w(offs_t offset, u8 data)
|
||||
{
|
||||
m_page = offset & 0x03;
|
||||
}
|
||||
|
||||
void quasar_state::io_page_select_w(offs_t offset, uint8_t data)
|
||||
void quasar_state::io_page_select_w(offs_t offset, u8 data)
|
||||
{
|
||||
m_io_page = offset & 0x03;
|
||||
|
||||
@ -337,7 +337,7 @@ void quasar_state::io_page_select_w(offs_t offset, uint8_t data)
|
||||
}
|
||||
}
|
||||
|
||||
void quasar_state::video_w(offs_t offset, uint8_t data)
|
||||
void quasar_state::video_w(offs_t offset, u8 data)
|
||||
{
|
||||
switch (m_page)
|
||||
{
|
||||
@ -348,9 +348,9 @@ void quasar_state::video_w(offs_t offset, uint8_t data)
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t quasar_state::io_r()
|
||||
u8 quasar_state::io_r()
|
||||
{
|
||||
uint8_t data = 0;
|
||||
u8 data = 0;
|
||||
|
||||
switch (m_io_page)
|
||||
{
|
||||
@ -363,17 +363,17 @@ uint8_t quasar_state::io_r()
|
||||
return data;
|
||||
}
|
||||
|
||||
void quasar_state::bullet_w(offs_t offset, uint8_t data)
|
||||
void quasar_state::bullet_w(offs_t offset, u8 data)
|
||||
{
|
||||
m_bullet_ram[offset] = data ^ 0xff;
|
||||
}
|
||||
|
||||
uint8_t quasar_state::collision_r()
|
||||
u8 quasar_state::collision_r()
|
||||
{
|
||||
return m_collision;
|
||||
}
|
||||
|
||||
uint8_t quasar_state::collision_clear_r()
|
||||
u8 quasar_state::collision_clear_r()
|
||||
{
|
||||
if (!machine().side_effects_disabled())
|
||||
m_collision = 0;
|
||||
@ -417,7 +417,7 @@ void quasar_state::data(address_map &map)
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
void quasar_state::sh_command_w(uint8_t data)
|
||||
void quasar_state::sh_command_w(u8 data)
|
||||
{
|
||||
// bit 4 = Sound Invader : Linked to an NE555V circuit
|
||||
// Not handled yet
|
||||
@ -426,7 +426,7 @@ void quasar_state::sh_command_w(uint8_t data)
|
||||
m_soundlatch->write(data & 0xf);
|
||||
}
|
||||
|
||||
uint8_t quasar_state::sh_command_r()
|
||||
u8 quasar_state::sh_command_r()
|
||||
{
|
||||
return m_soundlatch->read() | (m_dsw[2]->read() & 0x30);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user