mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
cyberbal.c: Use separate palette for each screen [Alex Jackson]
This commit is contained in:
parent
5e0a532f11
commit
6e8ac206d2
@ -126,8 +126,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, cyberbal_state )
|
||||
AM_RANGE(0xfd8000, 0xfd9fff) AM_DEVWRITE8("soundcomm", atari_sound_comm_device, main_command_w, 0xff00)
|
||||
AM_RANGE(0xfe0000, 0xfe0fff) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0xfe1000, 0xfe1fff) AM_READ_PORT("IN1")
|
||||
AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE(paletteram_1_w) AM_SHARE("paletteram_1")
|
||||
AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE(paletteram_0_w) AM_SHARE("paletteram_0")
|
||||
AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_DEVWRITE("rpalette", palette_device, write) AM_SHARE("rpalette")
|
||||
AM_RANGE(0xfec000, 0xfecfff) AM_RAM_DEVWRITE("lpalette", palette_device, write) AM_SHARE("lpalette")
|
||||
AM_RANGE(0xff0000, 0xff1fff) AM_RAM_DEVWRITE("playfield2", tilemap_device, write) AM_SHARE("playfield2")
|
||||
AM_RANGE(0xff2000, 0xff2fff) AM_RAM_DEVWRITE("alpha2", tilemap_device, write) AM_SHARE("alpha2")
|
||||
AM_RANGE(0xff3000, 0xff37ff) AM_RAM AM_SHARE("mob2")
|
||||
@ -153,8 +153,8 @@ static ADDRESS_MAP_START( extra_map, AS_PROGRAM, 16, cyberbal_state )
|
||||
AM_RANGE(0xfc0000, 0xfdffff) AM_WRITE(video_int_ack_w)
|
||||
AM_RANGE(0xfe0000, 0xfe0fff) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0xfe1000, 0xfe1fff) AM_READ_PORT("IN1")
|
||||
AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE(paletteram_1_w) AM_SHARE("paletteram_1")
|
||||
AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE(paletteram_0_w) AM_SHARE("paletteram_0")
|
||||
AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_DEVWRITE("rpalette", palette_device, write) AM_SHARE("rpalette")
|
||||
AM_RANGE(0xfec000, 0xfecfff) AM_RAM_DEVWRITE("lpalette", palette_device, write) AM_SHARE("lpalette")
|
||||
AM_RANGE(0xff0000, 0xff1fff) AM_RAM_DEVWRITE("playfield2", tilemap_device, write) AM_SHARE("playfield2")
|
||||
AM_RANGE(0xff2000, 0xff2fff) AM_RAM_DEVWRITE("alpha2", tilemap_device, write) AM_SHARE("alpha2")
|
||||
AM_RANGE(0xff3000, 0xff37ff) AM_RAM AM_SHARE("mob2")
|
||||
@ -409,8 +409,12 @@ static MACHINE_CONFIG_START( cyberbal, cyberbal_state )
|
||||
MCFG_ATARI_EEPROM_2804_ADD("eeprom")
|
||||
|
||||
/* video hardware */
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", interleaved)
|
||||
MCFG_PALETTE_ADD("palette", 4096)
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "lpalette", interleaved)
|
||||
|
||||
MCFG_PALETTE_ADD("lpalette", 2048)
|
||||
MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
|
||||
MCFG_PALETTE_ADD("rpalette", 2048)
|
||||
MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
|
||||
|
||||
MCFG_TILEMAP_ADD_STANDARD("playfield", "gfxdecode", 2, cyberbal_state, get_playfield_tile_info, 16,8, SCAN_ROWS, 64,64)
|
||||
MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", "gfxdecode", 2, cyberbal_state, get_alpha_tile_info, 16,8, SCAN_ROWS, 64,32, 0)
|
||||
@ -428,7 +432,7 @@ static MACHINE_CONFIG_START( cyberbal, cyberbal_state )
|
||||
/* the board uses an SOS-2 chip to generate video signals */
|
||||
MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz, 456*2, 0, 336*2, 262, 0, 240)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(cyberbal_state, screen_update_cyberbal_left)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
MCFG_SCREEN_PALETTE("lpalette")
|
||||
|
||||
MCFG_SCREEN_ADD("rscreen", RASTER)
|
||||
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
|
||||
@ -436,7 +440,7 @@ static MACHINE_CONFIG_START( cyberbal, cyberbal_state )
|
||||
/* the board uses an SOS-2 chip to generate video signals */
|
||||
MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz, 456*2, 0, 336*2, 262, 0, 240)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(cyberbal_state, screen_update_cyberbal_right)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
MCFG_SCREEN_PALETTE("rpalette")
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(cyberbal_state,cyberbal)
|
||||
|
||||
|
@ -32,10 +32,7 @@ public:
|
||||
m_alpha2_tilemap(*this, "alpha2"),
|
||||
m_mob2(*this, "mob2"),
|
||||
m_lscreen(*this, "lscreen"),
|
||||
m_rscreen(*this, "rscreen"),
|
||||
m_paletteram_0(*this, "paletteram_0"),
|
||||
m_paletteram_1(*this, "paletteram_1"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_rscreen(*this, "rscreen") { }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
optional_device<m6502_device> m_audiocpu;
|
||||
@ -52,9 +49,7 @@ public:
|
||||
optional_device<atari_motion_objects_device> m_mob2;
|
||||
optional_device<screen_device> m_lscreen;
|
||||
optional_device<screen_device> m_rscreen;
|
||||
optional_shared_ptr<UINT16> m_paletteram_0;
|
||||
optional_shared_ptr<UINT16> m_paletteram_1;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
UINT16 m_current_slip[2];
|
||||
UINT8 m_playfield_palette_bank[2];
|
||||
UINT16 m_playfield_xscroll[2];
|
||||
@ -96,10 +91,6 @@ public:
|
||||
UINT32 screen_update_cyberbal_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_cyberbal2p(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(sound_68k_irq_gen);
|
||||
DECLARE_READ16_MEMBER(paletteram_0_r);
|
||||
DECLARE_READ16_MEMBER(paletteram_1_r);
|
||||
DECLARE_WRITE16_MEMBER(paletteram_0_w);
|
||||
DECLARE_WRITE16_MEMBER(paletteram_1_w);
|
||||
|
||||
static const atari_motion_objects_config s_mob_config;
|
||||
|
||||
|
@ -82,21 +82,16 @@ const atari_motion_objects_config cyberbal_state::s_mob_config =
|
||||
|
||||
void cyberbal_state::video_start_common(int screens)
|
||||
{
|
||||
/* initialize the tilemaps */
|
||||
if (m_playfield2_tilemap != NULL)
|
||||
if (screens == 2)
|
||||
{
|
||||
m_playfield2_tilemap->set_scrollx(0, 0);
|
||||
m_playfield2_tilemap->set_palette_offset(0x800);
|
||||
}
|
||||
if (m_alpha2_tilemap != NULL)
|
||||
{
|
||||
m_alpha2_tilemap->set_scrollx(0, 0);
|
||||
m_alpha2_tilemap->set_palette_offset(0x800);
|
||||
palette_device *rpalette = subdevice<palette_device>("rpalette");
|
||||
m_playfield2_tilemap->set_palette(rpalette);
|
||||
m_alpha2_tilemap->set_palette(rpalette);
|
||||
}
|
||||
|
||||
/* initialize the motion objects */
|
||||
m_mob->set_slipram(&m_current_slip[0]);
|
||||
if (m_mob2 != NULL)
|
||||
if (screens == 2)
|
||||
m_mob2->set_slipram(&m_current_slip[1]);
|
||||
|
||||
/* save states */
|
||||
@ -127,56 +122,6 @@ VIDEO_START_MEMBER(cyberbal_state,cyberbal2p)
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Palette tweaker
|
||||
*
|
||||
*************************************/
|
||||
|
||||
inline void cyberbal_state::set_palette_entry(int entry, UINT16 value)
|
||||
{
|
||||
int r, g, b;
|
||||
|
||||
r = ((value >> 9) & 0x3e) | ((value >> 15) & 1);
|
||||
g = ((value >> 4) & 0x3e) | ((value >> 15) & 1);
|
||||
b = ((value << 1) & 0x3e) | ((value >> 15) & 1);
|
||||
|
||||
m_palette->set_pen_color(entry, pal6bit(r), pal6bit(g), pal6bit(b));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Palette RAM write handlers
|
||||
*
|
||||
*************************************/
|
||||
|
||||
WRITE16_MEMBER(cyberbal_state::paletteram_0_w)
|
||||
{
|
||||
COMBINE_DATA(&m_paletteram_0[offset]);
|
||||
set_palette_entry(offset, m_paletteram_0[offset]);
|
||||
}
|
||||
|
||||
READ16_MEMBER(cyberbal_state::paletteram_0_r)
|
||||
{
|
||||
return m_paletteram_0[offset];
|
||||
}
|
||||
|
||||
|
||||
WRITE16_MEMBER(cyberbal_state::paletteram_1_w)
|
||||
{
|
||||
COMBINE_DATA(&m_paletteram_1[offset]);
|
||||
set_palette_entry(offset + 0x800, m_paletteram_1[offset]);
|
||||
}
|
||||
|
||||
READ16_MEMBER(cyberbal_state::paletteram_1_r)
|
||||
{
|
||||
return m_paletteram_1[offset];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Periodic scanline updater
|
||||
@ -192,8 +137,8 @@ void cyberbal_state::scanline_update(screen_device &screen, int scanline)
|
||||
screen_device_iterator iter(*this);
|
||||
for (i = 0, update_screen = iter.first(); update_screen != NULL; i++, update_screen = iter.next())
|
||||
{
|
||||
tilemap_t &curplayfield = i ? static_cast<tilemap_t &>(m_playfield2_tilemap) : static_cast<tilemap_t &>(m_playfield_tilemap);
|
||||
tilemap_t &curalpha = i ? static_cast<tilemap_t &>(m_alpha2_tilemap) : static_cast<tilemap_t &>(m_alpha_tilemap);
|
||||
tilemap_t *curplayfield = i ? m_playfield2_tilemap : m_playfield_tilemap;
|
||||
tilemap_device *curalpha = i ? m_alpha2_tilemap : m_alpha_tilemap;
|
||||
|
||||
/* keep in range */
|
||||
int offset = ((scanline - 8) / 8) * 64 + 47;
|
||||
@ -203,7 +148,7 @@ void cyberbal_state::scanline_update(screen_device &screen, int scanline)
|
||||
return;
|
||||
|
||||
/* update the current parameters */
|
||||
UINT16 word = curalpha.device()->basemem_read(offset + 3);
|
||||
UINT16 word = curalpha->basemem_read(offset + 3);
|
||||
if (!(word & 1))
|
||||
{
|
||||
if (((word >> 1) & 7) != m_playfield_palette_bank[i])
|
||||
@ -211,10 +156,10 @@ void cyberbal_state::scanline_update(screen_device &screen, int scanline)
|
||||
if (scanline > 0)
|
||||
update_screen->update_partial(scanline - 1);
|
||||
m_playfield_palette_bank[i] = (word >> 1) & 7;
|
||||
curplayfield.set_palette_offset(i * 0x800 + (m_playfield_palette_bank[i] << 8));
|
||||
curplayfield->set_palette_offset(m_playfield_palette_bank[i] << 8);
|
||||
}
|
||||
}
|
||||
word = curalpha.device()->basemem_read(offset + 4);
|
||||
word = curalpha->basemem_read(offset + 4);
|
||||
if (!(word & 1))
|
||||
{
|
||||
int newscroll = 2 * (((word >> 7) + 4) & 0x1ff);
|
||||
@ -222,11 +167,11 @@ void cyberbal_state::scanline_update(screen_device &screen, int scanline)
|
||||
{
|
||||
if (scanline > 0)
|
||||
update_screen->update_partial(scanline - 1);
|
||||
curplayfield.set_scrollx(0, newscroll);
|
||||
curplayfield->set_scrollx(0, newscroll);
|
||||
m_playfield_xscroll[i] = newscroll;
|
||||
}
|
||||
}
|
||||
word = curalpha.device()->basemem_read(offset + 5);
|
||||
word = curalpha->basemem_read(offset + 5);
|
||||
if (!(word & 1))
|
||||
{
|
||||
/* a new vscroll latches the offset into a counter; we must adjust for this */
|
||||
@ -235,11 +180,11 @@ void cyberbal_state::scanline_update(screen_device &screen, int scanline)
|
||||
{
|
||||
if (scanline > 0)
|
||||
update_screen->update_partial(scanline - 1);
|
||||
curplayfield.set_scrolly(0, newscroll);
|
||||
curplayfield->set_scrolly(0, newscroll);
|
||||
m_playfield_yscroll[i] = newscroll;
|
||||
}
|
||||
}
|
||||
word = curalpha.device()->basemem_read(offset + 7);
|
||||
word = curalpha->basemem_read(offset + 7);
|
||||
if (!(word & 1))
|
||||
{
|
||||
if (m_current_slip[i] != word)
|
||||
@ -272,7 +217,6 @@ UINT32 cyberbal_state::update_one_screen(screen_device &screen, bitmap_ind16 &bi
|
||||
|
||||
/* draw and merge the MO */
|
||||
bitmap_ind16 &mobitmap = curmob->bitmap();
|
||||
int palbase = index * 0x800;
|
||||
for (const sparse_dirty_rect *rect = curmob->first_dirty_rect(cliprect); rect != NULL; rect = rect->next())
|
||||
for (int y = rect->min_y; y <= rect->max_y; y++)
|
||||
{
|
||||
@ -283,7 +227,7 @@ UINT32 cyberbal_state::update_one_screen(screen_device &screen, bitmap_ind16 &bi
|
||||
{
|
||||
/* not verified: logic is all controlled in a PAL
|
||||
*/
|
||||
pf[x] = palbase + mo[x];
|
||||
pf[x] = mo[x];
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user