mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
(MESS) mpt02: Fixed CDP1864 background color sequence. [Curt Coder]
This commit is contained in:
parent
00128f8980
commit
161aa0f833
@ -5,6 +5,7 @@
|
||||
#define RES_R(res) ((double)(res))
|
||||
#define RES_K(res) ((double)(res) * 1e3)
|
||||
#define RES_M(res) ((double)(res) * 1e6)
|
||||
#define RES_INF (-1)
|
||||
#define CAP_U(cap) ((double)(cap) * 1e-6)
|
||||
#define CAP_N(cap) ((double)(cap) * 1e-9)
|
||||
#define CAP_P(cap) ((double)(cap) * 1e-12)
|
||||
|
@ -22,8 +22,6 @@
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
#include "cdp1864.h"
|
||||
|
||||
|
||||
@ -38,12 +36,12 @@
|
||||
#define CDP1864_CYCLES_DMA_ACTIVE 8*8
|
||||
#define CDP1864_CYCLES_DMA_WAIT 6*8
|
||||
|
||||
static const int CDP1864_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 };
|
||||
const int cdp1864_device::bckgnd[] = { 2, 0, 4, 1 };
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// devices
|
||||
@ -51,51 +49,6 @@ const device_type CDP1864 = &device_creator<cdp1864_device>;
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// INLINE HELPERS
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// initialize_palette -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void cdp1864_device::initialize_palette()
|
||||
{
|
||||
const int resistances_r[] = { m_chr_r };
|
||||
const int resistances_g[] = { m_chr_g };
|
||||
const int resistances_b[] = { m_chr_b };
|
||||
|
||||
double color_weights_r[1], color_weights_g[1], color_weights_b[1];
|
||||
double color_weights_bkg_r[1], color_weights_bkg_g[1], color_weights_bkg_b[1];
|
||||
|
||||
compute_resistor_weights(0, 0xff, -1.0,
|
||||
1, resistances_r, color_weights_r, 0, m_chr_bkg,
|
||||
1, resistances_g, color_weights_g, 0, m_chr_bkg,
|
||||
1, resistances_b, color_weights_b, 0, m_chr_bkg);
|
||||
|
||||
compute_resistor_weights(0, 0xff, -1.0,
|
||||
1, resistances_r, color_weights_bkg_r, m_chr_bkg, 0,
|
||||
1, resistances_g, color_weights_bkg_g, m_chr_bkg, 0,
|
||||
1, resistances_b, color_weights_bkg_b, m_chr_bkg, 0);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
UINT8 r = combine_1_weights(color_weights_r, BIT(i, 0));
|
||||
UINT8 b = combine_1_weights(color_weights_b, BIT(i, 1));
|
||||
UINT8 g = combine_1_weights(color_weights_g, BIT(i, 2));
|
||||
|
||||
m_palette[i] = MAKE_RGB(r, g, b);
|
||||
|
||||
r = combine_1_weights(color_weights_bkg_r, BIT(i, 0));
|
||||
b = combine_1_weights(color_weights_bkg_b, BIT(i, 1));
|
||||
g = combine_1_weights(color_weights_bkg_g, BIT(i, 2));
|
||||
|
||||
m_palette[i + 8] = MAKE_RGB(r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
@ -398,7 +351,7 @@ WRITE8_MEMBER( cdp1864_device::dma_w )
|
||||
|
||||
for (int x = 0; x < 8; x++)
|
||||
{
|
||||
int color = CDP1864_BACKGROUND_COLOR_SEQUENCE[m_bgcolor] + 8;
|
||||
int color = bckgnd[m_bgcolor] + 8;
|
||||
|
||||
if (BIT(data, 7))
|
||||
{
|
||||
@ -458,12 +411,58 @@ UINT32 cdp1864_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap
|
||||
if (m_disp)
|
||||
{
|
||||
copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect);
|
||||
m_bitmap.fill(m_palette[CDP1864_BACKGROUND_COLOR_SEQUENCE[m_bgcolor] + 8], cliprect);
|
||||
m_bitmap.fill(m_palette[bckgnd[m_bgcolor] + 8], cliprect);
|
||||
}
|
||||
else
|
||||
{
|
||||
bitmap.fill(m_palette[0], cliprect);
|
||||
bitmap.fill(RGB_BLACK, cliprect);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// initialize_palette -
|
||||
//-------------------------------------------------
|
||||
|
||||
void cdp1864_device::initialize_palette()
|
||||
{
|
||||
const int resistances_r[] = { m_chr_r };
|
||||
const int resistances_g[] = { m_chr_g };
|
||||
const int resistances_b[] = { m_chr_b };
|
||||
|
||||
double color_weights_r[1], color_weights_g[1], color_weights_b[1];
|
||||
double color_weights_bkg_r[1], color_weights_bkg_g[1], color_weights_bkg_b[1];
|
||||
|
||||
compute_resistor_weights(0, 0xff, -1.0,
|
||||
1, resistances_r, color_weights_r, 0, m_chr_bkg,
|
||||
1, resistances_g, color_weights_g, 0, m_chr_bkg,
|
||||
1, resistances_b, color_weights_b, 0, m_chr_bkg);
|
||||
|
||||
compute_resistor_weights(0, 0xff, -1.0,
|
||||
1, resistances_r, color_weights_bkg_r, m_chr_bkg, 0,
|
||||
1, resistances_g, color_weights_bkg_g, m_chr_bkg, 0,
|
||||
1, resistances_b, color_weights_bkg_b, m_chr_bkg, 0);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
// foreground colors
|
||||
UINT8 r = 0, g = 0, b = 0;
|
||||
|
||||
if (m_chr_r != RES_INF) r = combine_1_weights(color_weights_r, BIT(i, 0));
|
||||
if (m_chr_b != RES_INF) b = combine_1_weights(color_weights_b, BIT(i, 1));
|
||||
if (m_chr_g != RES_INF) g = combine_1_weights(color_weights_g, BIT(i, 2));
|
||||
|
||||
m_palette[i] = MAKE_RGB(r, g, b);
|
||||
|
||||
// background colors
|
||||
r = 0, g = 0, b = 0;
|
||||
|
||||
if (m_chr_r != RES_INF) r = combine_1_weights(color_weights_bkg_r, BIT(i, 0));
|
||||
if (m_chr_b != RES_INF) b = combine_1_weights(color_weights_bkg_b, BIT(i, 1));
|
||||
if (m_chr_g != RES_INF) g = combine_1_weights(color_weights_bkg_g, BIT(i, 2));
|
||||
|
||||
m_palette[i + 8] = MAKE_RGB(r, g, b);
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@
|
||||
#define __CDP1864__
|
||||
|
||||
#include "emu.h"
|
||||
#include "machine/rescap.h"
|
||||
#include "video/resnet.h"
|
||||
|
||||
|
||||
@ -150,8 +151,6 @@ protected:
|
||||
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
|
||||
private:
|
||||
inline void initialize_palette();
|
||||
|
||||
enum
|
||||
{
|
||||
TIMER_INT,
|
||||
@ -159,6 +158,10 @@ private:
|
||||
TIMER_DMA,
|
||||
TIMER_HSYNC
|
||||
};
|
||||
|
||||
void initialize_palette();
|
||||
|
||||
static const int bckgnd[];
|
||||
|
||||
devcb2_read_line m_read_inlace;
|
||||
devcb2_read_line m_read_rdata;
|
||||
|
@ -60,6 +60,6 @@ MACHINE_CONFIG_FRAGMENT( nano_video )
|
||||
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, VCC, VCC, VCC)
|
||||
MCFG_CDP1864_CHROMINANCE(RES_K(1.21), 0, 0, 0) // R18 (unconfirmed)
|
||||
MCFG_CDP1864_CHROMINANCE(RES_K(1.21), RES_INF, RES_INF, 0) // R18 (unconfirmed)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
|
||||
MACHINE_CONFIG_END
|
||||
|
Loading…
Reference in New Issue
Block a user