mirror of
https://github.com/holub/mame
synced 2025-04-16 05:24:54 +03:00
atari/eprom.cpp, atari/firetrk.cpp: consolidated drivers in single files
This commit is contained in:
parent
0eda78b301
commit
3031f9cea5
File diff suppressed because it is too large
Load Diff
@ -1,83 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Aaron Giles
|
||||
/*************************************************************************
|
||||
|
||||
Atari Escape hardware
|
||||
|
||||
*************************************************************************/
|
||||
#ifndef MAME_ATARI_EPROM_H
|
||||
#define MAME_ATARI_EPROM_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "machine/adc0808.h"
|
||||
#include "machine/timer.h"
|
||||
#include "atarijsa.h"
|
||||
#include "atarimo.h"
|
||||
#include "emupal.h"
|
||||
#include "screen.h"
|
||||
#include "tilemap.h"
|
||||
|
||||
class eprom_state : public driver_device
|
||||
{
|
||||
public:
|
||||
eprom_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
m_playfield_tilemap(*this, "playfield"),
|
||||
m_alpha_tilemap(*this, "alpha"),
|
||||
m_mob(*this, "mob"),
|
||||
m_jsa(*this, "jsa"),
|
||||
m_share1(*this, "share1"),
|
||||
m_adc(*this, "adc"),
|
||||
m_extra(*this, "extra"),
|
||||
m_palette(*this, "palette"),
|
||||
m_paletteram(*this, "paletteram")
|
||||
{ }
|
||||
|
||||
void guts(machine_config &config);
|
||||
void eprom(machine_config &config);
|
||||
void klaxp(machine_config &config);
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
|
||||
private:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<tilemap_device> m_playfield_tilemap;
|
||||
required_device<tilemap_device> m_alpha_tilemap;
|
||||
required_device<atari_motion_objects_device> m_mob;
|
||||
required_device<atari_jsa_base_device> m_jsa;
|
||||
required_shared_ptr<uint16_t> m_share1;
|
||||
uint8_t m_screen_intensity = 0U;
|
||||
uint8_t m_video_disable = 0U;
|
||||
optional_device<adc0808_device> m_adc;
|
||||
optional_device<cpu_device> m_extra;
|
||||
required_device<palette_device> m_palette;
|
||||
optional_shared_ptr<uint16_t> m_paletteram;
|
||||
static const atari_motion_objects_config s_mob_config;
|
||||
static const atari_motion_objects_config s_guts_mob_config;
|
||||
|
||||
void video_int_ack_w(uint16_t data);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(scanline_update);
|
||||
uint8_t adc_r(offs_t offset);
|
||||
void eprom_latch_w(uint8_t data);
|
||||
template<bool maincpu> void sync_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
|
||||
TILE_GET_INFO_MEMBER(get_alpha_tile_info);
|
||||
TILE_GET_INFO_MEMBER(get_playfield_tile_info);
|
||||
TILE_GET_INFO_MEMBER(guts_get_playfield_tile_info);
|
||||
uint32_t screen_update_eprom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
uint32_t screen_update_guts(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void update_palette();
|
||||
void extra_map(address_map &map);
|
||||
void guts_map(address_map &map);
|
||||
void main_map(address_map &map);
|
||||
};
|
||||
|
||||
#endif // MAME_ATARI_EPROM_H
|
@ -1,412 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Aaron Giles
|
||||
/***************************************************************************
|
||||
|
||||
Atari Escape hardware
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "eprom.h"
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Palette
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void eprom_state::update_palette()
|
||||
{
|
||||
int color;
|
||||
|
||||
for (color = 0; color < 0x800; ++color)
|
||||
{
|
||||
int i, r, g, b;
|
||||
uint16_t const data = m_paletteram[color];
|
||||
|
||||
/* FIXME this is only a very crude approximation of the palette output.
|
||||
* The circuit involves a dozen transistors and probably has an output
|
||||
* which is quite different from this.
|
||||
* This is, however, good enough to match the video and description
|
||||
* of MAMETesters bug #02677.
|
||||
*/
|
||||
i = (((data >> 12) & 15) + 1) * (4 - m_screen_intensity);
|
||||
if (i < 0)
|
||||
i = 0;
|
||||
|
||||
r = ((data >> 8) & 15) * i / 4;
|
||||
g = ((data >> 4) & 15) * i / 4;
|
||||
b = ((data >> 0) & 15) * i / 4;
|
||||
|
||||
m_palette->set_pen_color(color, r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Tilemap callbacks
|
||||
*
|
||||
*************************************/
|
||||
|
||||
TILE_GET_INFO_MEMBER(eprom_state::get_alpha_tile_info)
|
||||
{
|
||||
uint16_t data = m_alpha_tilemap->basemem_read(tile_index);
|
||||
int code = data & 0x3ff;
|
||||
int color = ((data >> 10) & 0x0f) | ((data >> 9) & 0x20);
|
||||
int opaque = data & 0x8000;
|
||||
tileinfo.set(1, code, color, opaque ? TILE_FORCE_LAYER0 : 0);
|
||||
}
|
||||
|
||||
|
||||
TILE_GET_INFO_MEMBER(eprom_state::get_playfield_tile_info)
|
||||
{
|
||||
uint16_t data1 = m_playfield_tilemap->basemem_read(tile_index);
|
||||
uint16_t data2 = m_playfield_tilemap->extmem_read(tile_index) >> 8;
|
||||
int code = data1 & 0x7fff;
|
||||
int color = 0x10 + (data2 & 0x0f);
|
||||
tileinfo.set(0, code, color, (data1 >> 15) & 1);
|
||||
}
|
||||
|
||||
|
||||
TILE_GET_INFO_MEMBER(eprom_state::guts_get_playfield_tile_info)
|
||||
{
|
||||
uint16_t data1 = m_playfield_tilemap->basemem_read(tile_index);
|
||||
uint16_t data2 = m_playfield_tilemap->extmem_read(tile_index) >> 8;
|
||||
int code = data1 & 0x7fff;
|
||||
int color = 0x10 + (data2 & 0x0f);
|
||||
tileinfo.set(2, code, color, (data1 >> 15) & 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Video system start
|
||||
*
|
||||
*************************************/
|
||||
|
||||
const atari_motion_objects_config eprom_state::s_mob_config =
|
||||
{
|
||||
0, /* index to which gfx system */
|
||||
1, /* number of motion object banks */
|
||||
1, /* are the entries linked? */
|
||||
0, /* are the entries split? */
|
||||
1, /* render in reverse order? */
|
||||
0, /* render in swapped X/Y order? */
|
||||
0, /* does the neighbor bit affect the next object? */
|
||||
8, /* pixels per SLIP entry (0 for no-slip) */
|
||||
0, /* pixel offset for SLIPs */
|
||||
0, /* maximum number of links to visit/scanline (0=all) */
|
||||
|
||||
0x100, /* base palette entry */
|
||||
0x100, /* maximum number of colors */
|
||||
0, /* transparent pen index */
|
||||
|
||||
{{ 0x03ff,0,0,0 }}, /* mask for the link */
|
||||
{{ 0,0x7fff,0,0 }}, /* mask for the code index */
|
||||
{{ 0,0,0x000f,0 }}, /* mask for the color */
|
||||
{{ 0,0,0xff80,0 }}, /* mask for the X position */
|
||||
{{ 0,0,0,0xff80 }}, /* mask for the Y position */
|
||||
{{ 0,0,0,0x0070 }}, /* mask for the width, in tiles*/
|
||||
{{ 0,0,0,0x0007 }}, /* mask for the height, in tiles */
|
||||
{{ 0,0,0,0x0008 }}, /* mask for the horizontal flip */
|
||||
{{ 0 }}, /* mask for the vertical flip */
|
||||
{{ 0,0,0x0070,0 }}, /* mask for the priority */
|
||||
{{ 0 }}, /* mask for the neighbor */
|
||||
{{ 0 }}, /* mask for absolute coordinates */
|
||||
|
||||
{{ 0 }}, /* mask for the special value */
|
||||
0 /* resulting value to indicate "special" */
|
||||
};
|
||||
|
||||
void eprom_state::video_start()
|
||||
{
|
||||
/* save states */
|
||||
save_item(NAME(m_screen_intensity));
|
||||
save_item(NAME(m_video_disable));
|
||||
|
||||
m_screen_intensity = 0;
|
||||
m_video_disable = 0;
|
||||
}
|
||||
|
||||
|
||||
const atari_motion_objects_config eprom_state::s_guts_mob_config =
|
||||
{
|
||||
0, /* index to which gfx system */
|
||||
1, /* number of motion object banks */
|
||||
1, /* are the entries linked? */
|
||||
0, /* are the entries split? */
|
||||
0, /* render in reverse order? */
|
||||
0, /* render in swapped X/Y order? */
|
||||
0, /* does the neighbor bit affect the next object? */
|
||||
8, /* pixels per SLIP entry (0 for no-slip) */
|
||||
0, /* pixel offset for SLIPs */
|
||||
0, /* maximum number of links to visit/scanline (0=all) */
|
||||
|
||||
0x100, /* base palette entry */
|
||||
0x100, /* maximum number of colors */
|
||||
0, /* transparent pen index */
|
||||
|
||||
{{ 0x03ff,0,0,0 }}, /* mask for the link */
|
||||
{{ 0,0x7fff,0,0 }}, /* mask for the code index */
|
||||
{{ 0,0,0x000f,0 }}, /* mask for the color */
|
||||
{{ 0,0,0xff80,0 }}, /* mask for the X position */
|
||||
{{ 0,0,0,0xff80 }}, /* mask for the Y position */
|
||||
{{ 0,0,0,0x0070 }}, /* mask for the width, in tiles*/
|
||||
{{ 0,0,0,0x000f }}, /* mask for the height, in tiles */
|
||||
{{ 0,0x8000,0,0 }}, /* mask for the horizontal flip */
|
||||
{{ 0 }}, /* mask for the vertical flip */
|
||||
{{ 0,0,0x0070,0 }}, /* mask for the priority */
|
||||
{{ 0 }}, /* mask for the neighbor */
|
||||
{{ 0 }}, /* mask for absolute coordinates */
|
||||
|
||||
{{ 0 }}, /* mask for the special value */
|
||||
0 /* resulting value to indicate "special" */
|
||||
};
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Periodic scanline updater
|
||||
*
|
||||
*************************************/
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(eprom_state::scanline_update)
|
||||
{
|
||||
/* update the playfield */
|
||||
if (param == 0)
|
||||
{
|
||||
int xscroll = (m_alpha_tilemap->basemem_read(0x780) >> 7) & 0x1ff;
|
||||
int yscroll = (m_alpha_tilemap->basemem_read(0x781) >> 7) & 0x1ff;
|
||||
m_playfield_tilemap->set_scrollx(0, xscroll);
|
||||
m_playfield_tilemap->set_scrolly(0, yscroll);
|
||||
m_mob->set_scroll(xscroll, yscroll);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Main refresh
|
||||
*
|
||||
*************************************/
|
||||
|
||||
uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
if (m_video_disable)
|
||||
{
|
||||
bitmap.fill(m_palette->black_pen(), cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
update_palette();
|
||||
|
||||
// start drawing
|
||||
m_mob->draw_async(cliprect);
|
||||
|
||||
/* draw the playfield */
|
||||
m_playfield_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
|
||||
// draw and merge the MO
|
||||
bitmap_ind16 &mobitmap = m_mob->bitmap();
|
||||
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
|
||||
for (int y = rect->top(); y <= rect->bottom(); y++)
|
||||
{
|
||||
uint16_t const *const mo = &mobitmap.pix(y);
|
||||
uint16_t *const pf = &bitmap.pix(y);
|
||||
for (int x = rect->left(); x <= rect->right(); x++)
|
||||
if (mo[x] != 0xffff)
|
||||
{
|
||||
/* verified from the GALs on the real PCB; equations follow
|
||||
*
|
||||
* --- FORCEMC0 forces 3 bits of the MO color to 0 under some conditions
|
||||
* FORCEMC0=!PFX3*PFX4*PFX5*!MPR0
|
||||
* +!PFX3*PFX5*!MPR1
|
||||
* +!PFX3*PFX4*!MPR0*!MPR1
|
||||
*
|
||||
* --- SHADE selects an alternate color bank for the playfield
|
||||
* !SHADE=!MPX0
|
||||
* +MPX1
|
||||
* +MPX2
|
||||
* +MPX3
|
||||
* +!MPX4*!MPX5*!MPX6*!MPX7
|
||||
* +FORCEMC0
|
||||
*
|
||||
* --- PF/M is 1 if playfield has priority, or 0 if MOs have priority
|
||||
* !PF/M=MPR0*MPR1
|
||||
* +PFX3
|
||||
* +!PFX4*MPR1
|
||||
* +!PFX5*MPR1
|
||||
* +!PFX5*MPR0
|
||||
* +!PFX4*!PFX5*!MPR0*!MPR1
|
||||
*
|
||||
* --- M7 is passed as the upper MO bit to the GPC ASIC
|
||||
* M7=MPX0*!MPX1*!MPX2*!MPX3
|
||||
*
|
||||
* --- CL10-9 are outputs from the GPC, specifying which layer to render
|
||||
* CL10 = 1 if pf
|
||||
* CL9 = 1 if mo
|
||||
*
|
||||
* --- CRA10 is the 0x200 bit of the color RAM index; it comes directly from the GPC
|
||||
* CRA10 = CL10
|
||||
*
|
||||
* --- CRA9 is the 0x100 bit of the color RAM index; is comes directly from the GPC
|
||||
* or if the SHADE flag is set, it affects the playfield color bank
|
||||
* CRA9 = SHADE*CL10
|
||||
* +CL9
|
||||
*
|
||||
* --- CRA8-1 are the low 8 bits of the color RAM index; set as expected
|
||||
*/
|
||||
int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7;
|
||||
int const pfpriority = (pf[x] >> 4) & 3;
|
||||
|
||||
/* upper bit of MO priority signals special rendering and doesn't draw anything */
|
||||
if (mopriority & 4)
|
||||
continue;
|
||||
|
||||
/* compute the FORCEMC signal */
|
||||
int forcemc0 = 0;
|
||||
if (!(pf[x] & 8))
|
||||
{
|
||||
if (((pfpriority == 3) && !(mopriority & 1)) ||
|
||||
((pfpriority & 2) && !(mopriority & 2)) ||
|
||||
((pfpriority & 1) && (mopriority == 0)))
|
||||
forcemc0 = 1;
|
||||
}
|
||||
|
||||
/* compute the SHADE signal */
|
||||
int shade = 1;
|
||||
if (((mo[x] & 0x0f) != 1) ||
|
||||
((mo[x] & 0xf0) == 0) ||
|
||||
forcemc0)
|
||||
shade = 0;
|
||||
|
||||
/* compute the PF/M signal */
|
||||
int pfm = 1;
|
||||
if ((mopriority == 3) ||
|
||||
(pf[x] & 8) ||
|
||||
(!(pfpriority & 1) && (mopriority & 2)) ||
|
||||
(!(pfpriority & 2) && (mopriority & 2)) ||
|
||||
(!(pfpriority & 2) && (mopriority & 1)) ||
|
||||
((pfpriority == 0) && (mopriority == 0)))
|
||||
pfm = 0;
|
||||
|
||||
/* compute the M7 signal */
|
||||
int m7 = 0;
|
||||
if ((mo[x] & 0x0f) == 1)
|
||||
m7 = 1;
|
||||
|
||||
/* PF/M and M7 go in the GPC ASIC and select playfield or MO layers */
|
||||
if (!pfm && !m7)
|
||||
{
|
||||
if (!forcemc0)
|
||||
pf[x] = mo[x] & atari_motion_objects_device::DATA_MASK;
|
||||
else
|
||||
pf[x] = mo[x] & atari_motion_objects_device::DATA_MASK & ~0x70;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (shade)
|
||||
pf[x] |= 0x100;
|
||||
if (m7)
|
||||
pf[x] |= 0x080;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* add the alpha on top */
|
||||
m_alpha_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
|
||||
/* now go back and process the upper bit of MO priority */
|
||||
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
|
||||
for (int y = rect->top(); y <= rect->bottom(); y++)
|
||||
{
|
||||
uint16_t const *const mo = &mobitmap.pix(y);
|
||||
uint16_t *const pf = &bitmap.pix(y);
|
||||
for (int x = rect->left(); x <= rect->right(); x++)
|
||||
if (mo[x] != 0xffff)
|
||||
{
|
||||
int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT;
|
||||
|
||||
/* upper bit of MO priority might mean palette kludges */
|
||||
if (mopriority & 4)
|
||||
{
|
||||
/* if bit 2 is set, start setting high palette bits */
|
||||
if (mo[x] & 2)
|
||||
m_mob->apply_stain(bitmap, pf, mo, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uint32_t eprom_state::screen_update_guts(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
if (m_video_disable)
|
||||
{
|
||||
bitmap.fill(m_palette->black_pen(), cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
update_palette();
|
||||
|
||||
// start drawing
|
||||
m_mob->draw_async(cliprect);
|
||||
|
||||
/* draw the playfield */
|
||||
m_playfield_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
|
||||
// draw and merge the MO
|
||||
bitmap_ind16 &mobitmap = m_mob->bitmap();
|
||||
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
|
||||
for (int y = rect->top(); y <= rect->bottom(); y++)
|
||||
{
|
||||
uint16_t const *const mo = &mobitmap.pix(y);
|
||||
uint16_t *const pf = &bitmap.pix(y);
|
||||
for (int x = rect->left(); x <= rect->right(); x++)
|
||||
if (mo[x] != 0xffff)
|
||||
{
|
||||
int const mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7;
|
||||
int const pfpriority = (pf[x] >> 5) & 3;
|
||||
|
||||
/* upper bit of MO priority signals special rendering and doesn't draw anything */
|
||||
if (mopriority & 4)
|
||||
continue;
|
||||
|
||||
/* check the priority */
|
||||
if (!(pf[x] & 8) || mopriority >= pfpriority)
|
||||
pf[x] = mo[x] & atari_motion_objects_device::DATA_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
/* add the alpha on top */
|
||||
m_alpha_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
|
||||
/* now go back and process the upper bit of MO priority */
|
||||
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
|
||||
for (int y = rect->top(); y <= rect->bottom(); y++)
|
||||
{
|
||||
uint16_t const *const mo = &mobitmap.pix(y);
|
||||
uint16_t *const pf = &bitmap.pix(y);
|
||||
for (int x = rect->left(); x <= rect->right(); x++)
|
||||
if (mo[x] != 0xffff)
|
||||
{
|
||||
int const mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT;
|
||||
|
||||
/* upper bit of MO priority might mean palette kludges */
|
||||
if (mopriority & 4)
|
||||
{
|
||||
/* if bit 2 is set, start setting high palette bits */
|
||||
if (mo[x] & 2)
|
||||
m_mob->apply_stain(bitmap, pf, mo, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,182 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Phil Stroffolino
|
||||
/*************************************************************************
|
||||
|
||||
Atari Fire Truck + Super Bug + Monte Carlo driver
|
||||
|
||||
*************************************************************************/
|
||||
#ifndef MAME_ATARI_FIRETRK_H
|
||||
#define MAME_ATARI_FIRETRK_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "machine/timer.h"
|
||||
#include "machine/watchdog.h"
|
||||
#include "sound/discrete.h"
|
||||
#include "emupal.h"
|
||||
#include "screen.h"
|
||||
#include "tilemap.h"
|
||||
|
||||
#define FIRETRUCK_MOTOR_DATA NODE_01
|
||||
#define FIRETRUCK_HORN_EN NODE_02
|
||||
#define FIRETRUCK_SIREN_DATA NODE_03
|
||||
#define FIRETRUCK_CRASH_DATA NODE_04
|
||||
#define FIRETRUCK_SKID_EN NODE_05
|
||||
#define FIRETRUCK_BELL_EN NODE_06
|
||||
#define FIRETRUCK_ATTRACT_EN NODE_07
|
||||
#define FIRETRUCK_XTNDPLY_EN NODE_08
|
||||
|
||||
#define SUPERBUG_SPEED_DATA FIRETRUCK_MOTOR_DATA
|
||||
#define SUPERBUG_CRASH_DATA FIRETRUCK_CRASH_DATA
|
||||
#define SUPERBUG_SKID_EN FIRETRUCK_SKID_EN
|
||||
#define SUPERBUG_ASR_EN FIRETRUCK_XTNDPLY_EN
|
||||
#define SUPERBUG_ATTRACT_EN FIRETRUCK_ATTRACT_EN
|
||||
|
||||
#define MONTECAR_MOTOR_DATA FIRETRUCK_MOTOR_DATA
|
||||
#define MONTECAR_CRASH_DATA FIRETRUCK_CRASH_DATA
|
||||
#define MONTECAR_DRONE_MOTOR_DATA FIRETRUCK_SIREN_DATA
|
||||
#define MONTECAR_SKID_EN FIRETRUCK_SKID_EN
|
||||
#define MONTECAR_DRONE_LOUD_DATA FIRETRUCK_BELL_EN
|
||||
#define MONTECAR_BEEPER_EN FIRETRUCK_XTNDPLY_EN
|
||||
#define MONTECAR_ATTRACT_INV FIRETRUCK_ATTRACT_EN
|
||||
|
||||
|
||||
class firetrk_state : public driver_device
|
||||
{
|
||||
public:
|
||||
firetrk_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_watchdog(*this, "watchdog")
|
||||
, m_discrete(*this, "discrete")
|
||||
, m_alpha_num_ram(*this, "alpha_num_ram")
|
||||
, m_playfield_ram(*this, "playfield_ram")
|
||||
, m_scroll_y(*this, "scroll_y")
|
||||
, m_scroll_x(*this, "scroll_x")
|
||||
, m_car_rot(*this, "car_rot")
|
||||
, m_blink(*this, "blink")
|
||||
, m_drone_x(*this, "drone_x")
|
||||
, m_drone_y(*this, "drone_y")
|
||||
, m_drone_rot(*this, "drone_rot")
|
||||
, m_gfxdecode(*this, "gfxdecode")
|
||||
, m_screen(*this, "screen")
|
||||
, m_palette(*this, "palette")
|
||||
, m_bit_0(*this, "BIT_0")
|
||||
, m_bit_6(*this, "BIT_6")
|
||||
, m_bit_7(*this, "BIT_7")
|
||||
, m_dips(*this, {"DIP_0", "DIP_1"})
|
||||
, m_steer(*this, "STEER_%u", 1U)
|
||||
, m_leds(*this, "led%u", 0U)
|
||||
{ }
|
||||
|
||||
void firetrk(machine_config &config);
|
||||
void montecar(machine_config &config);
|
||||
void superbug(machine_config &config);
|
||||
|
||||
template <int P> DECLARE_READ_LINE_MEMBER(steer_dir_r);
|
||||
template <int P> DECLARE_READ_LINE_MEMBER(steer_flag_r);
|
||||
template <int P> DECLARE_READ_LINE_MEMBER(skid_r);
|
||||
template <int P> DECLARE_READ_LINE_MEMBER(crash_r);
|
||||
template <int P> DECLARE_READ_LINE_MEMBER(gear_r);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(service_mode_switch_changed);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(firetrk_horn_changed);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(gear_changed);
|
||||
|
||||
private:
|
||||
void firetrk_output_w(uint8_t data);
|
||||
void superbug_output_w(offs_t offset, uint8_t data);
|
||||
void montecar_output_1_w(uint8_t data);
|
||||
void montecar_output_2_w(uint8_t data);
|
||||
uint8_t firetrk_dip_r(offs_t offset);
|
||||
uint8_t montecar_dip_r(offs_t offset);
|
||||
uint8_t firetrk_input_r(offs_t offset);
|
||||
uint8_t montecar_input_r(offs_t offset);
|
||||
void blink_on_w(uint8_t data);
|
||||
void montecar_car_reset_w(uint8_t data);
|
||||
void montecar_drone_reset_w(uint8_t data);
|
||||
void steer_reset_w(uint8_t data);
|
||||
void crash_reset_w(uint8_t data);
|
||||
TILE_GET_INFO_MEMBER(firetrk_get_tile_info1);
|
||||
TILE_GET_INFO_MEMBER(superbug_get_tile_info1);
|
||||
TILE_GET_INFO_MEMBER(montecar_get_tile_info1);
|
||||
TILE_GET_INFO_MEMBER(firetrk_get_tile_info2);
|
||||
TILE_GET_INFO_MEMBER(superbug_get_tile_info2);
|
||||
TILE_GET_INFO_MEMBER(montecar_get_tile_info2);
|
||||
void firetrk_palette(palette_device &palette);
|
||||
DECLARE_VIDEO_START(superbug);
|
||||
DECLARE_VIDEO_START(montecar);
|
||||
void montecar_palette(palette_device &palette);
|
||||
uint32_t screen_update_firetrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
uint32_t screen_update_superbug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
uint32_t screen_update_montecar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(firetrk_scanline);
|
||||
void firetrk_skid_reset_w(uint8_t data);
|
||||
void montecar_skid_reset_w(uint8_t data);
|
||||
void firetrk_crash_snd_w(uint8_t data);
|
||||
void firetrk_skid_snd_w(uint8_t data);
|
||||
void firetrk_motor_snd_w(uint8_t data);
|
||||
void superbug_motor_snd_w(uint8_t data);
|
||||
void firetrk_xtndply_w(uint8_t data);
|
||||
void prom_to_palette(int number, uint8_t val);
|
||||
void firetrk_draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flash);
|
||||
void superbug_draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int flash);
|
||||
void montecar_draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int is_collision_detection);
|
||||
void check_collision(int which);
|
||||
void set_service_mode(int enable);
|
||||
void draw_text(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *alpha_ram, int x, int count, int height);
|
||||
void firetrk_map(address_map &map);
|
||||
void montecar_map(address_map &map);
|
||||
void superbug_map(address_map &map);
|
||||
|
||||
virtual void machine_start() override { m_leds.resolve(); }
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<watchdog_timer_device> m_watchdog;
|
||||
required_device<discrete_device> m_discrete;
|
||||
required_shared_ptr<uint8_t> m_alpha_num_ram;
|
||||
required_shared_ptr<uint8_t> m_playfield_ram;
|
||||
required_shared_ptr<uint8_t> m_scroll_y;
|
||||
required_shared_ptr<uint8_t> m_scroll_x;
|
||||
required_shared_ptr<uint8_t> m_car_rot;
|
||||
optional_shared_ptr<uint8_t> m_blink;
|
||||
optional_shared_ptr<uint8_t> m_drone_x;
|
||||
optional_shared_ptr<uint8_t> m_drone_y;
|
||||
optional_shared_ptr<uint8_t> m_drone_rot;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
optional_ioport m_bit_0;
|
||||
optional_ioport m_bit_6;
|
||||
optional_ioport m_bit_7;
|
||||
required_ioport_array<2> m_dips;
|
||||
optional_ioport_array<2> m_steer;
|
||||
output_finder<4> m_leds;
|
||||
|
||||
uint8_t m_in_service_mode = 0;
|
||||
uint32_t m_dial[2]{};
|
||||
uint8_t m_steer_dir[2]{};
|
||||
uint8_t m_steer_flag[2]{};
|
||||
uint8_t m_gear = 0;
|
||||
|
||||
uint8_t m_flash = 0;
|
||||
uint8_t m_crash[2]{};
|
||||
uint8_t m_skid[2]{};
|
||||
bitmap_ind16 m_helper1;
|
||||
bitmap_ind16 m_helper2;
|
||||
uint32_t m_color1_mask = 0;
|
||||
uint32_t m_color2_mask = 0;
|
||||
tilemap_t *m_tilemap1 = nullptr;
|
||||
tilemap_t *m_tilemap2 = nullptr;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in audio/firetrk.c -----------*/
|
||||
|
||||
DISCRETE_SOUND_EXTERN( firetrk_discrete );
|
||||
DISCRETE_SOUND_EXTERN( superbug_discrete );
|
||||
DISCRETE_SOUND_EXTERN( montecar_discrete );
|
||||
|
||||
#endif // MAME_ATARI_FIRETRK_H
|
@ -1,68 +1,15 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:K.Wilkins,Derrick Renaud
|
||||
// copyright-holders: K.Wilkins, Derrick Renaud
|
||||
|
||||
/*************************************************************************
|
||||
|
||||
audio\firetrk.cpp
|
||||
atari/firetrk_a.cpp
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "firetrk.h"
|
||||
#include "sound/discrete.h"
|
||||
|
||||
|
||||
void firetrk_state::firetrk_skid_reset_w(uint8_t data)
|
||||
{
|
||||
m_skid[0] = 0;
|
||||
m_skid[1] = 0;
|
||||
|
||||
// also SUPERBUG_SKID_EN
|
||||
m_discrete->write(FIRETRUCK_SKID_EN, 1);
|
||||
}
|
||||
|
||||
|
||||
void firetrk_state::montecar_skid_reset_w(uint8_t data)
|
||||
{
|
||||
m_discrete->write(MONTECAR_SKID_EN, 1);
|
||||
}
|
||||
|
||||
|
||||
void firetrk_state::firetrk_crash_snd_w(uint8_t data)
|
||||
{
|
||||
// also SUPERBUG_CRASH_DATA and MONTECAR_CRASH_DATA
|
||||
m_discrete->write(FIRETRUCK_CRASH_DATA, data >> 4);
|
||||
}
|
||||
|
||||
|
||||
void firetrk_state::firetrk_skid_snd_w(uint8_t data)
|
||||
{
|
||||
// also SUPERBUG_SKID_EN and MONTECAR_SKID_EN
|
||||
m_discrete->write(FIRETRUCK_SKID_EN, 0);
|
||||
}
|
||||
|
||||
|
||||
void firetrk_state::firetrk_motor_snd_w(uint8_t data)
|
||||
{
|
||||
// also MONTECAR_DRONE_MOTOR_DATA
|
||||
m_discrete->write(FIRETRUCK_SIREN_DATA, data >> 4);
|
||||
|
||||
// also MONTECAR_MOTOR_DATA
|
||||
m_discrete->write(FIRETRUCK_MOTOR_DATA, data & 0x0f);
|
||||
}
|
||||
|
||||
|
||||
void firetrk_state::superbug_motor_snd_w(uint8_t data)
|
||||
{
|
||||
m_discrete->write(SUPERBUG_SPEED_DATA, data & 0x0f);
|
||||
}
|
||||
|
||||
|
||||
void firetrk_state::firetrk_xtndply_w(uint8_t data)
|
||||
{
|
||||
// also SUPERBUG_ASR_EN (extended play)
|
||||
m_discrete->write(FIRETRUCK_XTNDPLY_EN, data);
|
||||
}
|
||||
|
||||
#include "firetrk_a.h"
|
||||
|
||||
#define FIRETRUCK_HSYNC 15750.0 /* not checked */
|
||||
#define FIRETRUCK_1V FIRETRUCK_HSYNC/2
|
||||
@ -198,7 +145,7 @@ DISCRETE_SOUND_START(firetrk_discrete)
|
||||
/************************************************/
|
||||
/* Motor sound circuit is based on a 556 VCO */
|
||||
/* with the input frequency set by the MotorSND */
|
||||
/* latch (4 bit). This freqency is then used to */
|
||||
/* latch (4 bit). This frequency is then used to*/
|
||||
/* drive a modulo 12 counter, with div6 & div12 */
|
||||
/* summed as the output of the circuit. */
|
||||
/************************************************/
|
||||
@ -283,7 +230,7 @@ DISCRETE_SOUND_START(firetrk_discrete)
|
||||
/* counter. */
|
||||
/************************************************/
|
||||
DISCRETE_RCDISC2(NODE_70, FIRETRUCK_BELL_EN,
|
||||
4.4, 10, // Q3 instantally charges C42
|
||||
4.4, 10, // Q3 instantaneously charges C42
|
||||
0, RES_K(33), // discharges through R66
|
||||
CAP_U(10)) // C42
|
||||
DISCRETE_TRANSFORM2(NODE_71, NODE_70,
|
||||
@ -402,7 +349,7 @@ DISCRETE_SOUND_START(superbug_discrete)
|
||||
/************************************************/
|
||||
/* Motor sound circuit is based on a 556 VCO */
|
||||
/* with the input frequency set by the MotorSND */
|
||||
/* latch (4 bit). This freqency is then used to */
|
||||
/* latch (4 bit). This frequency is then used to*/
|
||||
/* drive a modulo 12 counter. */
|
||||
/************************************************/
|
||||
DISCRETE_ADJUSTMENT(NODE_20,
|
||||
@ -585,7 +532,7 @@ DISCRETE_SOUND_START(montecar_discrete)
|
||||
/************************************************/
|
||||
/* Motor sound circuit is based on a 556 VCO */
|
||||
/* with the input frequency set by the MotorSND */
|
||||
/* latch (4 bit). This freqency is then used to */
|
||||
/* latch (4 bit). This frequency is then used to*/
|
||||
/* driver a modulo 12 counter, with div6, 4 & 3 */
|
||||
/* summed as the output of the circuit. */
|
||||
/************************************************/
|
||||
|
47
src/mame/atari/firetrk_a.h
Normal file
47
src/mame/atari/firetrk_a.h
Normal file
@ -0,0 +1,47 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders: K.Wilkins, Derrick Renaud
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Fire Truck / Monte Carlo - Super Bug audio
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MAME_ATARI_FIRETRK_A_H
|
||||
#define MAME_ATARI_FIRETRK_A_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sound/discrete.h"
|
||||
|
||||
// discrete sound input nodes
|
||||
|
||||
#define FIRETRUCK_MOTOR_DATA NODE_01
|
||||
#define FIRETRUCK_HORN_EN NODE_02
|
||||
#define FIRETRUCK_SIREN_DATA NODE_03
|
||||
#define FIRETRUCK_CRASH_DATA NODE_04
|
||||
#define FIRETRUCK_SKID_EN NODE_05
|
||||
#define FIRETRUCK_BELL_EN NODE_06
|
||||
#define FIRETRUCK_ATTRACT_EN NODE_07
|
||||
#define FIRETRUCK_XTNDPLY_EN NODE_08
|
||||
|
||||
#define MONTECAR_MOTOR_DATA FIRETRUCK_MOTOR_DATA
|
||||
#define MONTECAR_CRASH_DATA FIRETRUCK_CRASH_DATA
|
||||
#define MONTECAR_DRONE_MOTOR_DATA FIRETRUCK_SIREN_DATA
|
||||
#define MONTECAR_SKID_EN FIRETRUCK_SKID_EN
|
||||
#define MONTECAR_DRONE_LOUD_DATA FIRETRUCK_BELL_EN
|
||||
#define MONTECAR_BEEPER_EN FIRETRUCK_XTNDPLY_EN
|
||||
#define MONTECAR_ATTRACT_INV FIRETRUCK_ATTRACT_EN
|
||||
|
||||
#define SUPERBUG_SPEED_DATA FIRETRUCK_MOTOR_DATA
|
||||
#define SUPERBUG_CRASH_DATA FIRETRUCK_CRASH_DATA
|
||||
#define SUPERBUG_SKID_EN FIRETRUCK_SKID_EN
|
||||
#define SUPERBUG_ASR_EN FIRETRUCK_XTNDPLY_EN
|
||||
#define SUPERBUG_ATTRACT_EN FIRETRUCK_ATTRACT_EN
|
||||
|
||||
|
||||
DISCRETE_SOUND_EXTERN( firetrk_discrete );
|
||||
DISCRETE_SOUND_EXTERN( montecar_discrete );
|
||||
DISCRETE_SOUND_EXTERN( superbug_discrete );
|
||||
|
||||
#endif // MAME_ATARI_FIRETRK_A_H
|
@ -1,428 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Phil Stroffolino
|
||||
/***************************************************************************
|
||||
|
||||
Atari Fire Truck + Super Bug + Monte Carlo video emulation
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "firetrk.h"
|
||||
|
||||
static const rectangle playfield_window(0x02a, 0x115, 0x000, 0x0ff);
|
||||
|
||||
|
||||
void firetrk_state::firetrk_palette(palette_device &palette)
|
||||
{
|
||||
static constexpr uint8_t colortable_source[] =
|
||||
{
|
||||
0, 0, 1, 0,
|
||||
2, 0, 3, 0,
|
||||
3, 3, 2, 3,
|
||||
1, 3, 0, 3,
|
||||
0, 0, 1, 0,
|
||||
2, 0, 0, 3,
|
||||
3, 0, 0, 3
|
||||
};
|
||||
static constexpr rgb_t palette_source[] =
|
||||
{
|
||||
rgb_t::black(),
|
||||
rgb_t(0x5b, 0x5b, 0x5b),
|
||||
rgb_t(0xa4, 0xa4, 0xa4),
|
||||
rgb_t::white()
|
||||
};
|
||||
|
||||
m_color1_mask = m_color2_mask = 0;
|
||||
|
||||
for (int i = 0; i < std::size(colortable_source); i++)
|
||||
{
|
||||
uint8_t color = colortable_source[i];
|
||||
|
||||
if (color == 1)
|
||||
m_color1_mask |= 1 << i;
|
||||
else if (color == 2)
|
||||
m_color2_mask |= 1 << i;
|
||||
|
||||
palette.set_pen_color(i, palette_source[color]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void firetrk_state::prom_to_palette(int number, uint8_t val)
|
||||
{
|
||||
m_palette->set_pen_color(number, rgb_t(pal1bit(val >> 2), pal1bit(val >> 1), pal1bit(val >> 0)));
|
||||
}
|
||||
|
||||
|
||||
void firetrk_state::montecar_palette(palette_device &palette)
|
||||
{
|
||||
const uint8_t *color_prom = memregion("proms")->base();
|
||||
|
||||
static constexpr uint8_t colortable_source[] =
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x02, 0x00, 0x03,
|
||||
0x03, 0x03, 0x03, 0x02,
|
||||
0x03, 0x01, 0x03, 0x00,
|
||||
0x00, 0x00, 0x02, 0x00,
|
||||
0x02, 0x01, 0x02, 0x02,
|
||||
0x00, 0x10, 0x20, 0x30,
|
||||
0x00, 0x04, 0x08, 0x0c,
|
||||
0x00, 0x44, 0x48, 0x4c,
|
||||
0x00, 0x84, 0x88, 0x8c,
|
||||
0x00, 0xc4, 0xc8, 0xcc
|
||||
};
|
||||
|
||||
/*
|
||||
* The color PROM is addressed as follows:
|
||||
*
|
||||
* A0 => PLAYFIELD 1
|
||||
* A1 => PLAYFIELD 2
|
||||
* A2 => DRONE 1
|
||||
* A3 => DRONE 2
|
||||
* A4 => CAR 1
|
||||
* A5 => CAR 2
|
||||
* A6 => DRONE COLOR 1
|
||||
* A7 => DRONE COLOR 2
|
||||
* A8 => PLAYFIELD WINDOW
|
||||
*
|
||||
* This driver hard-codes some behavior which actually depends
|
||||
* on the PROM, like priorities, clipping and transparency.
|
||||
*
|
||||
*/
|
||||
|
||||
m_color1_mask = m_color2_mask = 0;
|
||||
|
||||
for (int i = 0; i < std::size(colortable_source); i++)
|
||||
{
|
||||
uint8_t color = colortable_source[i];
|
||||
|
||||
if (color == 1)
|
||||
m_color1_mask |= 1 << i;
|
||||
else if (color == 2)
|
||||
m_color2_mask |= 1 << i;
|
||||
|
||||
prom_to_palette(i, color_prom[0x100 + colortable_source[i]]);
|
||||
}
|
||||
|
||||
palette.set_pen_color(std::size(colortable_source) + 0, rgb_t::black());
|
||||
palette.set_pen_color(std::size(colortable_source) + 1, rgb_t::white());
|
||||
}
|
||||
|
||||
|
||||
TILE_GET_INFO_MEMBER(firetrk_state::firetrk_get_tile_info1)
|
||||
{
|
||||
int code = m_playfield_ram[tile_index] & 0x3f;
|
||||
int color = (m_playfield_ram[tile_index] >> 6) & 0x03;
|
||||
|
||||
if (*m_blink && (code >= 0x04) && (code <= 0x0b))
|
||||
color = 0;
|
||||
|
||||
if (m_flash)
|
||||
color = color | 0x04;
|
||||
|
||||
tileinfo.set(1, code, color, 0);
|
||||
}
|
||||
|
||||
|
||||
TILE_GET_INFO_MEMBER(firetrk_state::superbug_get_tile_info1)
|
||||
{
|
||||
int code = m_playfield_ram[tile_index] & 0x3f;
|
||||
int color = (m_playfield_ram[tile_index] >> 6) & 0x03;
|
||||
|
||||
if (*m_blink && (code >= 0x08) && (code <= 0x0f))
|
||||
color = 0;
|
||||
|
||||
if (m_flash)
|
||||
color = color | 0x04;
|
||||
|
||||
tileinfo.set(1, code, color, 0);
|
||||
}
|
||||
|
||||
|
||||
TILE_GET_INFO_MEMBER(firetrk_state::montecar_get_tile_info1)
|
||||
{
|
||||
int code = m_playfield_ram[tile_index] & 0x3f;
|
||||
int color = (m_playfield_ram[tile_index] >> 6) & 0x03;
|
||||
|
||||
if (m_flash)
|
||||
color = color | 0x04;
|
||||
|
||||
tileinfo.set(1, code, color, 0);
|
||||
}
|
||||
|
||||
|
||||
TILE_GET_INFO_MEMBER(firetrk_state::firetrk_get_tile_info2)
|
||||
{
|
||||
uint8_t code = m_playfield_ram[tile_index] & 0x3f;
|
||||
int color = 0;
|
||||
|
||||
/* palette 1 for crash and palette 2 for skid */
|
||||
if (((code & 0x30) != 0x00) || ((code & 0x0c) == 0x00))
|
||||
color = 1; /* palette 0, 1 */
|
||||
|
||||
if ((code & 0x3c) == 0x0c)
|
||||
color = 2; /* palette 0, 2 */
|
||||
|
||||
tileinfo.set(2, code, color, 0);
|
||||
}
|
||||
|
||||
|
||||
TILE_GET_INFO_MEMBER(firetrk_state::superbug_get_tile_info2)
|
||||
{
|
||||
uint8_t code = m_playfield_ram[tile_index] & 0x3f;
|
||||
int color = 0;
|
||||
|
||||
/* palette 1 for crash and palette 2 for skid */
|
||||
if ((code & 0x30) != 0x00)
|
||||
color = 1; /* palette 0, 1 */
|
||||
|
||||
if ((code & 0x38) == 0x00)
|
||||
color = 2; /* palette 0, 2 */
|
||||
|
||||
tileinfo.set(2, code, color, 0);
|
||||
}
|
||||
|
||||
|
||||
TILE_GET_INFO_MEMBER(firetrk_state::montecar_get_tile_info2)
|
||||
{
|
||||
uint8_t code = m_playfield_ram[tile_index];
|
||||
int color = 0;
|
||||
|
||||
/* palette 1 for crash and palette 2 for skid */
|
||||
if (((code & 0xc0) == 0x40) || ((code & 0xc0) == 0x80))
|
||||
color = 2; /* palette 2, 1 */
|
||||
|
||||
if ((code & 0xc0) == 0xc0)
|
||||
color = 1; /* palette 2, 0 */
|
||||
|
||||
if ((code & 0xc0) == 0x00)
|
||||
color = 3; /* palette 2, 2 */
|
||||
|
||||
if ((code & 0x30) == 0x30)
|
||||
color = 0; /* palette 0, 0 */
|
||||
|
||||
tileinfo.set(2, code & 0x3f, color, 0);
|
||||
}
|
||||
|
||||
|
||||
void firetrk_state::video_start()
|
||||
{
|
||||
m_screen->register_screen_bitmap(m_helper1);
|
||||
m_screen->register_screen_bitmap(m_helper2);
|
||||
|
||||
m_tilemap1 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(firetrk_state::firetrk_get_tile_info1)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16);
|
||||
m_tilemap2 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(firetrk_state::firetrk_get_tile_info2)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START_MEMBER(firetrk_state,superbug)
|
||||
{
|
||||
m_screen->register_screen_bitmap(m_helper1);
|
||||
m_screen->register_screen_bitmap(m_helper2);
|
||||
|
||||
m_tilemap1 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(firetrk_state::superbug_get_tile_info1)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16);
|
||||
m_tilemap2 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(firetrk_state::superbug_get_tile_info2)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START_MEMBER(firetrk_state,montecar)
|
||||
{
|
||||
m_screen->register_screen_bitmap(m_helper1);
|
||||
m_screen->register_screen_bitmap(m_helper2);
|
||||
|
||||
m_tilemap1 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(firetrk_state::montecar_get_tile_info1)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16);
|
||||
m_tilemap2 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(firetrk_state::montecar_get_tile_info2)), TILEMAP_SCAN_ROWS, 16, 16, 16, 16);
|
||||
}
|
||||
|
||||
|
||||
void firetrk_state::firetrk_draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flash)
|
||||
{
|
||||
int gfx_bank, code, color, flip_x, flip_y, x, y;
|
||||
|
||||
if (which)
|
||||
{
|
||||
gfx_bank = 5;
|
||||
code = *m_drone_rot & 0x07;
|
||||
color = flash ? 1 : 0;
|
||||
flip_x = *m_drone_rot & 0x08;
|
||||
flip_y = *m_drone_rot & 0x10;
|
||||
x = (flip_x ? *m_drone_x - 63 : 192 - *m_drone_x) + 36;
|
||||
y = flip_y ? *m_drone_y - 63 : 192 - *m_drone_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
gfx_bank = (*m_car_rot & 0x10) ? 4 : 3;
|
||||
code = *m_car_rot & 0x03;
|
||||
color = flash ? 1 : 0;
|
||||
flip_x = *m_car_rot & 0x04;
|
||||
flip_y = *m_car_rot & 0x08;
|
||||
x = 144;
|
||||
y = 104;
|
||||
}
|
||||
|
||||
m_gfxdecode->gfx(gfx_bank)->transpen(bitmap,cliprect, code, color, flip_x, flip_y, x, y, 0);
|
||||
}
|
||||
|
||||
|
||||
void firetrk_state::superbug_draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int flash)
|
||||
{
|
||||
int gfx_bank = (*m_car_rot & 0x10) ? 4 : 3;
|
||||
int code = ~*m_car_rot & 0x03;
|
||||
int color = flash ? 1 : 0;
|
||||
int flip_x = *m_car_rot & 0x04;
|
||||
int flip_y = *m_car_rot & 0x08;
|
||||
|
||||
m_gfxdecode->gfx(gfx_bank)->transpen(bitmap,cliprect, code, color, flip_x, flip_y, 144, 104, 0);
|
||||
}
|
||||
|
||||
|
||||
void firetrk_state::montecar_draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int is_collision_detection)
|
||||
{
|
||||
int gfx_bank, code, color, flip_x, flip_y, x, y;
|
||||
|
||||
if (which)
|
||||
{
|
||||
gfx_bank = 4;
|
||||
code = *m_drone_rot & 0x07;
|
||||
color = is_collision_detection ? 0 : (((*m_car_rot & 0x80) >> 6) | ((*m_drone_rot & 0x80) >> 7));
|
||||
flip_x = *m_drone_rot & 0x10;
|
||||
flip_y = *m_drone_rot & 0x08;
|
||||
x = (flip_x ? *m_drone_x - 31 : 224 - *m_drone_x) + 34;
|
||||
y = flip_y ? *m_drone_y - 31 : 224 - *m_drone_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
gfx_bank = 3;
|
||||
code = *m_car_rot & 0x07;
|
||||
color = 0;
|
||||
flip_x = *m_car_rot & 0x10;
|
||||
flip_y = *m_car_rot & 0x08;
|
||||
x = 144;
|
||||
y = 104;
|
||||
}
|
||||
|
||||
m_gfxdecode->gfx(gfx_bank)->transpen(bitmap,cliprect, code, color, flip_x, flip_y, x, y, 0);
|
||||
}
|
||||
|
||||
|
||||
void firetrk_state::draw_text(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *alpha_ram,
|
||||
int x, int count, int height)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, alpha_ram[i], 0, 0, 0, x, i * height);
|
||||
}
|
||||
|
||||
|
||||
void firetrk_state::check_collision(int which)
|
||||
{
|
||||
for (int y = playfield_window.top(); y <= playfield_window.bottom(); y++)
|
||||
for (int x = playfield_window.left(); x <= playfield_window.right(); x++)
|
||||
{
|
||||
pen_t const a = m_helper1.pix(y, x);
|
||||
pen_t const b = m_helper2.pix(y, x);
|
||||
|
||||
if (b != 0xff && (m_color1_mask >> a) & 1)
|
||||
m_crash[which] = 1;
|
||||
|
||||
if (b != 0xff && (m_color2_mask >> a) & 1)
|
||||
m_skid[which] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint32_t firetrk_state::screen_update_firetrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
machine().tilemap().mark_all_dirty();
|
||||
m_tilemap1->set_scrollx(0, *m_scroll_x - 37);
|
||||
m_tilemap2->set_scrollx(0, *m_scroll_x - 37);
|
||||
m_tilemap1->set_scrolly(0, *m_scroll_y);
|
||||
m_tilemap2->set_scrolly(0, *m_scroll_y);
|
||||
|
||||
bitmap.fill(0, cliprect);
|
||||
m_tilemap1->draw(screen, bitmap, playfield_window, 0, 0);
|
||||
firetrk_draw_car(bitmap, playfield_window, 0, m_flash);
|
||||
firetrk_draw_car(bitmap, playfield_window, 1, m_flash);
|
||||
draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 296, 0x10, 0x10);
|
||||
draw_text(bitmap, cliprect, m_alpha_num_ram + 0x10, 8, 0x10, 0x10);
|
||||
|
||||
if (cliprect.bottom() == screen.visible_area().bottom())
|
||||
{
|
||||
m_tilemap2->draw(screen, m_helper1, playfield_window, 0, 0);
|
||||
|
||||
m_helper2.fill(0xff, playfield_window);
|
||||
firetrk_draw_car(m_helper2, playfield_window, 0, false);
|
||||
check_collision(0);
|
||||
|
||||
m_helper2.fill(0xff, playfield_window);
|
||||
firetrk_draw_car(m_helper2, playfield_window, 1, false);
|
||||
check_collision(1);
|
||||
|
||||
*m_blink = false;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uint32_t firetrk_state::screen_update_superbug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
machine().tilemap().mark_all_dirty();
|
||||
m_tilemap1->set_scrollx(0, *m_scroll_x - 37);
|
||||
m_tilemap2->set_scrollx(0, *m_scroll_x - 37);
|
||||
m_tilemap1->set_scrolly(0, *m_scroll_y);
|
||||
m_tilemap2->set_scrolly(0, *m_scroll_y);
|
||||
|
||||
bitmap.fill(0, cliprect);
|
||||
m_tilemap1->draw(screen, bitmap, playfield_window, 0, 0);
|
||||
superbug_draw_car(bitmap, playfield_window, m_flash);
|
||||
draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 296, 0x10, 0x10);
|
||||
draw_text(bitmap, cliprect, m_alpha_num_ram + 0x10, 8, 0x10, 0x10);
|
||||
|
||||
if (cliprect.bottom() == screen.visible_area().bottom())
|
||||
{
|
||||
m_tilemap2->draw(screen, m_helper1, playfield_window, 0, 0);
|
||||
|
||||
m_helper2.fill(0xff, playfield_window);
|
||||
superbug_draw_car(m_helper2, playfield_window, false);
|
||||
check_collision(0);
|
||||
|
||||
*m_blink = false;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uint32_t firetrk_state::screen_update_montecar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
machine().tilemap().mark_all_dirty();
|
||||
m_tilemap1->set_scrollx(0, *m_scroll_x - 37);
|
||||
m_tilemap2->set_scrollx(0, *m_scroll_x - 37);
|
||||
m_tilemap1->set_scrolly(0, *m_scroll_y);
|
||||
m_tilemap2->set_scrolly(0, *m_scroll_y);
|
||||
|
||||
bitmap.fill(0x2c, cliprect);
|
||||
m_tilemap1->draw(screen, bitmap, playfield_window, 0, 0);
|
||||
montecar_draw_car(bitmap, playfield_window, 0, false);
|
||||
montecar_draw_car(bitmap, playfield_window, 1, false);
|
||||
draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 24, 0x20, 0x08);
|
||||
draw_text(bitmap, cliprect, m_alpha_num_ram + 0x20, 16, 0x20, 0x08);
|
||||
|
||||
if (cliprect.bottom() == screen.visible_area().bottom())
|
||||
{
|
||||
m_tilemap2->draw(screen, m_helper1, playfield_window, 0, 0);
|
||||
|
||||
m_helper2.fill(0xff, playfield_window);
|
||||
montecar_draw_car(m_helper2, playfield_window, 0, true);
|
||||
check_collision(0);
|
||||
|
||||
m_helper2.fill(0xff, playfield_window);
|
||||
montecar_draw_car(m_helper2, playfield_window, 1, true);
|
||||
check_collision(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user