mirror of
https://github.com/holub/mame
synced 2025-06-29 23:48:56 +03:00
Define a standard 3-bit RGB palette and use it for Monkey Magic
This commit is contained in:
parent
4b0ef72821
commit
b25e97668a
@ -815,6 +815,17 @@ void palette_device::palette_init_monochrome_yellow(palette_device &palette)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*-------------------------------------------------
|
||||||
|
3bit_rgb - 8-color rgb
|
||||||
|
-------------------------------------------------*/
|
||||||
|
|
||||||
|
void palette_device::palette_init_3bit_rgb(palette_device &palette)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
palette.set_pen_color(i, rgb_t(pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------------------------
|
/*-------------------------------------------------
|
||||||
RRRR_GGGG_BBBB - standard 4-4-4 palette,
|
RRRR_GGGG_BBBB - standard 4-4-4 palette,
|
||||||
assuming the commonly used resistor values:
|
assuming the commonly used resistor values:
|
||||||
|
@ -232,6 +232,10 @@
|
|||||||
MCFG_PALETTE_ADD(_tag, 2) \
|
MCFG_PALETTE_ADD(_tag, 2) \
|
||||||
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_monochrome_yellow), downcast<palette_device *>(device)));
|
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_monochrome_yellow), downcast<palette_device *>(device)));
|
||||||
|
|
||||||
|
#define MCFG_PALETTE_ADD_3BIT_RGB(_tag) \
|
||||||
|
MCFG_PALETTE_ADD(_tag, 8) \
|
||||||
|
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_3bit_rgb), downcast<palette_device *>(device)));
|
||||||
|
|
||||||
#define MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB(_tag) \
|
#define MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB(_tag) \
|
||||||
MCFG_PALETTE_ADD(_tag, 32768) \
|
MCFG_PALETTE_ADD(_tag, 32768) \
|
||||||
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_RRRRRGGGGGBBBBB), downcast<palette_device *>(device)));
|
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_RRRRRGGGGGBBBBB), downcast<palette_device *>(device)));
|
||||||
@ -396,6 +400,7 @@ public:
|
|||||||
void palette_init_monochrome_green(palette_device &palette);
|
void palette_init_monochrome_green(palette_device &palette);
|
||||||
void palette_init_monochrome_green_highlight(palette_device &palette);
|
void palette_init_monochrome_green_highlight(palette_device &palette);
|
||||||
void palette_init_monochrome_yellow(palette_device &palette);
|
void palette_init_monochrome_yellow(palette_device &palette);
|
||||||
|
void palette_init_3bit_rgb(palette_device &palette);
|
||||||
void palette_init_RRRRGGGGBBBB_proms(palette_device &palette);
|
void palette_init_RRRRGGGGBBBB_proms(palette_device &palette);
|
||||||
void palette_init_RRRRRGGGGGBBBBB(palette_device &palette);
|
void palette_init_RRRRRGGGGGBBBBB(palette_device &palette);
|
||||||
void palette_init_BBBBBGGGGGRRRRR(palette_device &palette);
|
void palette_init_BBBBBGGGGGRRRRR(palette_device &palette);
|
||||||
|
@ -69,12 +69,13 @@ public:
|
|||||||
: driver_device(mconfig, type, tag),
|
: driver_device(mconfig, type, tag),
|
||||||
m_maincpu(*this, "maincpu"),
|
m_maincpu(*this, "maincpu"),
|
||||||
m_screen(*this, "screen"),
|
m_screen(*this, "screen"),
|
||||||
|
m_palette(*this, "palette"),
|
||||||
m_vram(*this, "vram"),
|
m_vram(*this, "vram"),
|
||||||
m_tiles(*this, "tiles"),
|
m_tiles(*this, "tiles"),
|
||||||
m_colors(*this, "colors"),
|
m_colors(*this, "colors"),
|
||||||
m_ball_x(0x00),
|
m_ball_x(0x00),
|
||||||
m_ball_y(0x00),
|
m_ball_y(0x00),
|
||||||
m_color(0)
|
m_color(0x00)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
DECLARE_READ8_MEMBER(vblank_r);
|
DECLARE_READ8_MEMBER(vblank_r);
|
||||||
@ -91,16 +92,14 @@ protected:
|
|||||||
private:
|
private:
|
||||||
required_device<cpu_device> m_maincpu;
|
required_device<cpu_device> m_maincpu;
|
||||||
required_device<screen_device> m_screen;
|
required_device<screen_device> m_screen;
|
||||||
|
required_device<palette_device> m_palette;
|
||||||
required_shared_ptr<UINT8> m_vram;
|
required_shared_ptr<UINT8> m_vram;
|
||||||
required_region_ptr<UINT8> m_tiles;
|
required_region_ptr<UINT8> m_tiles;
|
||||||
required_region_ptr<UINT8> m_colors;
|
required_region_ptr<UINT8> m_colors;
|
||||||
|
|
||||||
static const rgb_t m_palette[];
|
|
||||||
|
|
||||||
UINT8 m_ball_x;
|
UINT8 m_ball_x;
|
||||||
UINT8 m_ball_y;
|
UINT8 m_ball_y;
|
||||||
|
UINT8 m_color;
|
||||||
int m_color;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -157,7 +156,7 @@ static INPUT_PORTS_START( mmagic )
|
|||||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
|
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
|
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
|
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Debug?") // debug? checked once at startup
|
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Debug?") // checked once at startup
|
||||||
|
|
||||||
PORT_START("paddle")
|
PORT_START("paddle")
|
||||||
PORT_BIT(0xff, 0x80, IPT_PADDLE) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_CENTERDELTA(0)
|
PORT_BIT(0xff, 0x80, IPT_PADDLE) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_CENTERDELTA(0)
|
||||||
@ -216,15 +215,15 @@ UINT32 mmagic_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
|
|||||||
{
|
{
|
||||||
UINT8 gfx = m_tiles[(code << 4) + tx];
|
UINT8 gfx = m_tiles[(code << 4) + tx];
|
||||||
|
|
||||||
bitmap.pix32(y * 12 + tx, x * 8 + 0) = BIT(gfx, 4) ? rgb_t::black : m_palette[color];
|
bitmap.pix32(y * 12 + tx, x * 8 + 0) = BIT(gfx, 4) ? rgb_t::black : m_palette->pen_color(color);
|
||||||
bitmap.pix32(y * 12 + tx, x * 8 + 1) = BIT(gfx, 5) ? rgb_t::black : m_palette[color];
|
bitmap.pix32(y * 12 + tx, x * 8 + 1) = BIT(gfx, 5) ? rgb_t::black : m_palette->pen_color(color);
|
||||||
bitmap.pix32(y * 12 + tx, x * 8 + 2) = BIT(gfx, 6) ? rgb_t::black : m_palette[color];
|
bitmap.pix32(y * 12 + tx, x * 8 + 2) = BIT(gfx, 6) ? rgb_t::black : m_palette->pen_color(color);
|
||||||
bitmap.pix32(y * 12 + tx, x * 8 + 3) = BIT(gfx, 7) ? rgb_t::black : m_palette[color];
|
bitmap.pix32(y * 12 + tx, x * 8 + 3) = BIT(gfx, 7) ? rgb_t::black : m_palette->pen_color(color);
|
||||||
|
|
||||||
bitmap.pix32(y * 12 + tx, x * 8 + 4) = BIT(gfx, 0) ? rgb_t::black : m_palette[color];
|
bitmap.pix32(y * 12 + tx, x * 8 + 4) = BIT(gfx, 0) ? rgb_t::black : m_palette->pen_color(color);
|
||||||
bitmap.pix32(y * 12 + tx, x * 8 + 5) = BIT(gfx, 1) ? rgb_t::black : m_palette[color];
|
bitmap.pix32(y * 12 + tx, x * 8 + 5) = BIT(gfx, 1) ? rgb_t::black : m_palette->pen_color(color);
|
||||||
bitmap.pix32(y * 12 + tx, x * 8 + 6) = BIT(gfx, 2) ? rgb_t::black : m_palette[color];
|
bitmap.pix32(y * 12 + tx, x * 8 + 6) = BIT(gfx, 2) ? rgb_t::black : m_palette->pen_color(color);
|
||||||
bitmap.pix32(y * 12 + tx, x * 8 + 7) = BIT(gfx, 3) ? rgb_t::black : m_palette[color];
|
bitmap.pix32(y * 12 + tx, x * 8 + 7) = BIT(gfx, 3) ? rgb_t::black : m_palette->pen_color(color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,23 +240,6 @@ UINT32 mmagic_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
|
||||||
// PALETTE
|
|
||||||
//**************************************************************************
|
|
||||||
|
|
||||||
const rgb_t mmagic_state::m_palette[] =
|
|
||||||
{
|
|
||||||
rgb_t(0x00, 0x00, 0x00),
|
|
||||||
rgb_t(0xff, 0x00, 0x00),
|
|
||||||
rgb_t(0x00, 0xff, 0x00),
|
|
||||||
rgb_t(0xff, 0xff, 0x00),
|
|
||||||
rgb_t(0x00, 0x00, 0xff),
|
|
||||||
rgb_t(0xff, 0x00, 0xff),
|
|
||||||
rgb_t(0x00, 0xff, 0xff),
|
|
||||||
rgb_t(0xff, 0xff, 0xff)
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
// AUDIO EMULATION
|
// AUDIO EMULATION
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
@ -297,6 +279,8 @@ static MACHINE_CONFIG_START( mmagic, mmagic_state )
|
|||||||
MCFG_SCREEN_RAW_PARAMS(XTAL_6_144MHz, 384, 0, 256, 264, 0, 192)
|
MCFG_SCREEN_RAW_PARAMS(XTAL_6_144MHz, 384, 0, 256, 264, 0, 192)
|
||||||
MCFG_SCREEN_UPDATE_DRIVER(mmagic_state, screen_update)
|
MCFG_SCREEN_UPDATE_DRIVER(mmagic_state, screen_update)
|
||||||
|
|
||||||
|
MCFG_PALETTE_ADD_3BIT_RGB("palette")
|
||||||
|
|
||||||
// sound hardware
|
// sound hardware
|
||||||
// TODO: SN76477 + discrete sound
|
// TODO: SN76477 + discrete sound
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
Loading…
Reference in New Issue
Block a user