mirror of
https://github.com/holub/mame
synced 2025-04-24 01:11:11 +03:00
jaguar.cpp : Updates
Add palette device for precalculated YCC color lookup, Fix spacings, Fix notes, Reduce unnecessary lines
This commit is contained in:
parent
118df1b2db
commit
bad8ba8589
@ -1849,6 +1849,8 @@ void jaguar_state::cojagr3k(machine_config &config)
|
||||
m_screen->set_raw(COJAG_PIXEL_CLOCK/2, 456, 42, 402, 262, 17, 257);
|
||||
m_screen->set_screen_update(FUNC(jaguar_state::screen_update));
|
||||
|
||||
PALETTE(config, m_palette, FUNC(jaguar_state::jagpal_ycc), 65536);
|
||||
|
||||
/* sound hardware */
|
||||
SPEAKER(config, "lspeaker").front_left();
|
||||
SPEAKER(config, "rspeaker").front_right();
|
||||
@ -1904,6 +1906,8 @@ void jaguar_state::jaguar(machine_config &config)
|
||||
m_screen->set_raw(JAGUAR_CLOCK, 456, 42, 402, 262, 17, 257);
|
||||
m_screen->set_screen_update(FUNC(jaguar_state::screen_update));
|
||||
|
||||
PALETTE(config, m_palette, FUNC(jaguar_state::jagpal_ycc), 65536);
|
||||
|
||||
/* sound hardware */
|
||||
SPEAKER(config, "lspeaker").front_left();
|
||||
SPEAKER(config, "rspeaker").front_right();
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "cdrom.h"
|
||||
#include "imagedev/chd_cd.h"
|
||||
#include "screen.h"
|
||||
#include "emupal.h"
|
||||
|
||||
#ifndef ENABLE_SPEEDUP_HACKS
|
||||
#define ENABLE_SPEEDUP_HACKS 1
|
||||
@ -75,6 +76,7 @@ public:
|
||||
, m_eeprom(*this, "eeprom")
|
||||
, m_ide(*this, "ide")
|
||||
, m_screen(*this, "screen")
|
||||
, m_palette(*this, "palette")
|
||||
{
|
||||
}
|
||||
|
||||
@ -250,20 +252,21 @@ private:
|
||||
DECLARE_READ32_MEMBER(butch_regs_r);
|
||||
DECLARE_WRITE32_MEMBER(butch_regs_w);
|
||||
|
||||
// from audio/jaguar.c
|
||||
// from audio/jaguar.cpp
|
||||
DECLARE_READ16_MEMBER( jerry_regs_r );
|
||||
DECLARE_WRITE16_MEMBER( jerry_regs_w );
|
||||
DECLARE_READ32_MEMBER( serial_r );
|
||||
DECLARE_WRITE32_MEMBER( serial_w );
|
||||
void serial_update();
|
||||
|
||||
// from video/jaguar.c
|
||||
// from video/jaguar.cpp
|
||||
DECLARE_READ32_MEMBER( blitter_r );
|
||||
DECLARE_WRITE32_MEMBER( blitter_w );
|
||||
DECLARE_READ16_MEMBER( tom_regs_r );
|
||||
DECLARE_WRITE16_MEMBER( tom_regs_w );
|
||||
DECLARE_READ32_MEMBER( cojag_gun_input_r );
|
||||
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
void jagpal_ycc(palette_device &palette) const;
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( gpu_cpu_int );
|
||||
DECLARE_WRITE_LINE_MEMBER( dsp_cpu_int );
|
||||
@ -386,4 +389,5 @@ private:
|
||||
optional_device<eeprom_serial_93cxx_device> m_eeprom;
|
||||
optional_device<vt83c461_device> m_ide;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
};
|
||||
|
@ -295,13 +295,14 @@ WRITE_LINE_MEMBER( jaguar_state::dsp_cpu_int )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void jaguar_state::set_palette(uint16_t vmode)
|
||||
void jaguar_state::jagpal_ycc(palette_device &palette) const
|
||||
{
|
||||
// construct YCC Color lookup
|
||||
static const uint8_t red_lookup[256] =
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 19, 0,
|
||||
68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 64, 43, 21, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 19, 0,
|
||||
68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 64, 43, 21, 0,
|
||||
102,102,102,102,102,102,102,102,102,102,102, 95, 71, 47, 23, 0,
|
||||
135,135,135,135,135,135,135,135,135,135,130,104, 78, 52, 26, 0,
|
||||
169,169,169,169,169,169,169,169,169,170,141,113, 85, 56, 28, 0,
|
||||
@ -319,22 +320,22 @@ void jaguar_state::set_palette(uint16_t vmode)
|
||||
|
||||
static const uint8_t grn_lookup[256] =
|
||||
{
|
||||
0, 17, 34, 51, 68, 85,102,119,136,153,170,187,204,221,238,255,
|
||||
0, 19, 38, 57, 77, 96,115,134,154,173,182,211,231,250,255,255,
|
||||
0, 21, 43, 64, 86,107,129,150,172,193,215,236,255,255,255,255,
|
||||
0, 23, 47, 71, 96,119,142,166,190,214,238,255,255,255,255,255,
|
||||
0, 26, 52, 78,104,130,156,182,208,234,255,255,255,255,255,255,
|
||||
0, 28, 56, 85,113,141,170,198,226,255,255,255,255,255,255,255,
|
||||
0, 30, 61, 91,122,153,183,214,244,255,255,255,255,255,255,255,
|
||||
0, 32, 65, 98,131,164,197,230,255,255,255,255,255,255,255,255,
|
||||
0, 32, 65, 98,131,164,197,230,255,255,255,255,255,255,255,255,
|
||||
0, 30, 61, 91,122,153,183,214,244,255,255,255,255,255,255,255,
|
||||
0, 28, 56, 85,113,141,170,198,226,255,255,255,255,255,255,255,
|
||||
0, 26, 52, 78,104,130,156,182,208,234,255,255,255,255,255,255,
|
||||
0, 23, 47, 71, 96,119,142,166,190,214,238,255,255,255,255,255,
|
||||
0, 21, 43, 64, 86,107,129,150,172,193,215,236,255,255,255,255,
|
||||
0, 19, 38, 57, 77, 96,115,134,154,173,182,211,231,250,255,255,
|
||||
0, 17, 34, 51, 68, 85,102,119,136,153,170,187,204,221,238,255
|
||||
0, 17, 34, 51, 68, 85,102,119,136,153,170,187,204,221,238,255,
|
||||
0, 19, 38, 57, 77, 96,115,134,154,173,182,211,231,250,255,255,
|
||||
0, 21, 43, 64, 86,107,129,150,172,193,215,236,255,255,255,255,
|
||||
0, 23, 47, 71, 96,119,142,166,190,214,238,255,255,255,255,255,
|
||||
0, 26, 52, 78,104,130,156,182,208,234,255,255,255,255,255,255,
|
||||
0, 28, 56, 85,113,141,170,198,226,255,255,255,255,255,255,255,
|
||||
0, 30, 61, 91,122,153,183,214,244,255,255,255,255,255,255,255,
|
||||
0, 32, 65, 98,131,164,197,230,255,255,255,255,255,255,255,255,
|
||||
0, 32, 65, 98,131,164,197,230,255,255,255,255,255,255,255,255,
|
||||
0, 30, 61, 91,122,153,183,214,244,255,255,255,255,255,255,255,
|
||||
0, 28, 56, 85,113,141,170,198,226,255,255,255,255,255,255,255,
|
||||
0, 26, 52, 78,104,130,156,182,208,234,255,255,255,255,255,255,
|
||||
0, 23, 47, 71, 96,119,142,166,190,214,238,255,255,255,255,255,
|
||||
0, 21, 43, 64, 86,107,129,150,172,193,215,236,255,255,255,255,
|
||||
0, 19, 38, 57, 77, 96,115,134,154,173,182,211,231,250,255,255,
|
||||
0, 17, 34, 51, 68, 85,102,119,136,153,170,187,204,221,238,255
|
||||
};
|
||||
|
||||
static const uint8_t blu_lookup[256] =
|
||||
@ -352,11 +353,22 @@ void jaguar_state::set_palette(uint16_t vmode)
|
||||
169,169,169,169,169,169,169,169,169,170,141,113, 85, 56, 28, 0,
|
||||
135,135,135,135,135,135,135,135,135,135,130,104, 78, 52, 26, 0,
|
||||
102,102,102,102,102,102,102,102,102,102,102, 95, 71, 47, 23, 0,
|
||||
68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 64, 43, 21, 0,
|
||||
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 19, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 64, 43, 21, 0,
|
||||
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 19, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
for (int i = 0; i < 65536; i++)
|
||||
{
|
||||
const u8 r = (red_lookup[i >> 8] * (i & 0xff)) / 0xff;
|
||||
const u8 g = (grn_lookup[i >> 8] * (i & 0xff)) / 0xff;
|
||||
const u8 b = (blu_lookup[i >> 8] * (i & 0xff)) / 0xff;
|
||||
palette.set_pen_color(i, rgb_t(r, g, b));
|
||||
}
|
||||
}
|
||||
|
||||
void jaguar_state::set_palette(uint16_t vmode)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* switch off the mode */
|
||||
@ -367,33 +379,18 @@ void jaguar_state::set_palette(uint16_t vmode)
|
||||
/* RGB24 */
|
||||
case 0x002:
|
||||
for (i = 0; i < 65536; i++)
|
||||
{
|
||||
uint8_t r = (red_lookup[i >> 8] * (i & 0xff)) >> 8;
|
||||
uint8_t g = (grn_lookup[i >> 8] * (i & 0xff)) >> 8;
|
||||
uint8_t b = (blu_lookup[i >> 8] * (i & 0xff)) >> 8;
|
||||
m_pen_table[i] = rgb_t(r, g, b);
|
||||
}
|
||||
m_pen_table[i] = m_palette->pen(i);
|
||||
break;
|
||||
|
||||
/* YCC VARMOD */
|
||||
case 0x100:
|
||||
for (i = 0; i < 65536; i++)
|
||||
{
|
||||
uint8_t r = (red_lookup[i >> 8] * (i & 0xff)) >> 8;
|
||||
uint8_t g = (grn_lookup[i >> 8] * (i & 0xff)) >> 8;
|
||||
uint8_t b = (blu_lookup[i >> 8] * (i & 0xff)) >> 8;
|
||||
|
||||
/* if the low bit is set, treat it as 5-5-5 RGB instead */
|
||||
if (i & 1)
|
||||
{
|
||||
r = (i >> 11) & 31;
|
||||
g = (i >> 1) & 31;
|
||||
b = (i >> 6) & 31;
|
||||
r = (r << 3) | (r >> 2);
|
||||
g = (g << 3) | (g >> 2);
|
||||
b = (b << 3) | (b >> 2);
|
||||
}
|
||||
m_pen_table[i] = rgb_t(r, g, b);
|
||||
m_pen_table[i] = rgb_t(pal5bit(i >> 11), pal5bit(i >> 1), pal5bit(i >> 6));
|
||||
else
|
||||
m_pen_table[i] = m_palette->pen((i & ~0xff) | pal7bit(i >> 1));
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user