Start cleaning up palette configuration:

* Basically, initialisers go in the constructor arguments, and things for setting format go in set_format.
* Initialisation patterns can be specified with an enum discriminator or with a FUNC and optionally a tag.
* Formats can be specified with an enum discriminator or a size and function pointer.
* You must always supply the number of entries when setting the format.
* When initislising with a paletter initialisation member, you can specify the entries and indirecte entries together.
* The palette_device now has a standard constructor, so use .set_entries if you are specifying entry count with no format/initialisation.
* Also killed an overload on delegates that wasn't being useful.
This commit is contained in:
Vas Crabb 2018-12-29 05:53:50 +11:00
parent 65bfb2654f
commit f1f0591f43
1949 changed files with 16542 additions and 19253 deletions

View File

@ -171,7 +171,7 @@ const tiny_rom_entry *a2bus_aevm80_device::device_rom_region() const
a2bus_videx80_device::a2bus_videx80_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, type, tag, owner, clock),
device_a2bus_card_interface(mconfig, *this), m_rom(nullptr), m_chrrom(nullptr), m_framecnt(0),
m_crtc(*this, VIDEOTERM_MC6845_NAME), m_palette(*this, ":palette"),
m_crtc(*this, VIDEOTERM_MC6845_NAME), m_palette(*this, ":a2video"),
m_rambank(0)
{
}

View File

@ -15,7 +15,6 @@
#include "a2bus.h"
#include "video/mc6845.h"
#include "emupal.h"
//**************************************************************************
// TYPE DEFINITIONS
@ -46,7 +45,7 @@ protected:
int m_framecnt;
required_device<mc6845_device> m_crtc;
required_device<palette_device> m_palette;
required_device<device_palette_interface> m_palette;
private:
DECLARE_WRITE_LINE_MEMBER(vsync_changed);

View File

@ -94,7 +94,7 @@ MACHINE_CONFIG_START(acorn_vdu80_device::device_add_mconfig)
MCFG_SCREEN_UPDATE_DEVICE("mc6845", mc6845_device, screen_update)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_acorn_vdu80)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, m_palette, palette_device::MONOCHROME);
H46505(config, m_crtc, 2_MHz_XTAL);
m_crtc->set_screen("screen");

View File

@ -131,7 +131,7 @@ MACHINE_CONFIG_START(c64_xl80_device::device_add_mconfig)
MCFG_SCREEN_REFRESH_RATE(50)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_c64_xl80)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, m_palette, palette_device::MONOCHROME);
H46505(config, m_crtc, XTAL(14'318'181) / 8);
m_crtc->set_screen(MC6845_SCREEN_TAG);

View File

@ -94,7 +94,7 @@ MACHINE_CONFIG_START(cbm2_hrg_a_device::device_add_mconfig)
MCFG_SCREEN_SIZE(512, 512)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 512-1)
MCFG_SCREEN_REFRESH_RATE(25)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, "palette", palette_device::MONOCHROME);
MCFG_DEVICE_ADD(EF9365_TAG, EF9365, 1750000)
MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
@ -110,7 +110,7 @@ MACHINE_CONFIG_START(cbm2_hrg_b_device::device_add_mconfig)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_REFRESH_RATE(50)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, "palette", palette_device::MONOCHROME);
MCFG_DEVICE_ADD(EF9366_TAG, EF9365, 1750000)
MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)

View File

@ -91,7 +91,7 @@ MACHINE_CONFIG_START(compis_hrg_device::device_add_mconfig)
m_crtc->set_display_pixels_callback(FUNC(compis_hrg_device::display_pixels), this);
m_crtc->set_screen(SCREEN_TAG);
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, m_palette, palette_device::MONOCHROME);
MACHINE_CONFIG_END
@ -109,7 +109,7 @@ MACHINE_CONFIG_START(compis_uhrg_device::device_add_mconfig)
m_crtc->set_display_pixels_callback(FUNC(compis_uhrg_device::display_pixels), this);
m_crtc->set_screen(SCREEN_TAG);
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, m_palette, palette_device::MONOCHROME);
MACHINE_CONFIG_END

View File

@ -146,7 +146,7 @@ MACHINE_CONFIG_START(comx_clm_device::device_add_mconfig)
MCFG_SCREEN_REFRESH_RATE(50)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_comx_clm)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, m_palette, palette_device::MONOCHROME);
MC6845(config, m_crtc, XTAL(14'318'181)/7);
m_crtc->set_screen(MC6845_SCREEN_TAG);

View File

@ -422,7 +422,7 @@ void ecb_grip21_device::device_add_mconfig(machine_config &config)
screen.set_size(640, 480);
screen.set_visarea(0, 640-1, 0, 480-1);
PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
PALETTE(config, m_palette, palette_device::MONOCHROME);
// sound hardware
SPEAKER(config, "mono").front_center();

View File

@ -101,7 +101,7 @@ MACHINE_CONFIG_START(tk02_device::device_add_mconfig)
MCFG_SCREEN_RAW_PARAMS(XTAL(8'000'000) * 2, 1024, 0, 640, 312, 0, 250)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, m_palette, palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tk02)

View File

@ -27,7 +27,7 @@ MACHINE_CONFIG_START(nascom_avc_device::device_add_mconfig)
MCFG_SCREEN_RAW_PARAMS(16250000, 1024, 0, 768, 320, 0, 256)
MCFG_SCREEN_UPDATE_DEVICE("mc6845", mc6845_device, screen_update)
MCFG_PALETTE_ADD_3BIT_RGB("palette")
PALETTE(config, m_palette, palette_device::RGB_3BIT);
MC6845(config, m_crtc, XTAL(16'000'000) / 8);
m_crtc->set_screen("screen");

View File

@ -97,7 +97,7 @@ MACHINE_CONFIG_START(cbm8000_hsg_a_device::device_add_mconfig)
MCFG_SCREEN_SIZE(512, 512)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 512-1)
MCFG_SCREEN_REFRESH_RATE(25)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, "palette", palette_device::MONOCHROME);
MCFG_DEVICE_ADD(EF9365_TAG, EF9365, 1750000)
MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
@ -113,7 +113,7 @@ MACHINE_CONFIG_START(cbm8000_hsg_b_device::device_add_mconfig)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_REFRESH_RATE(50)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, "palette", palette_device::MONOCHROME);
MCFG_DEVICE_ADD(EF9366_TAG, EF9365, 1750000)
MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)

View File

@ -46,7 +46,7 @@ void sv806_device::device_add_mconfig(machine_config &config)
screen.set_raw((XTAL(12'000'000) / 6) * 8, 864, 0, 640, 317, 0, 192);
screen.set_screen_update("crtc", FUNC(hd6845_device::screen_update));
PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
PALETTE(config, m_palette, palette_device::MONOCHROME);
HD6845(config, m_crtc, XTAL(12'000'000) / 6);
m_crtc->set_screen("80col");

View File

@ -105,7 +105,7 @@ MACHINE_CONFIG_START(vic20_video_pak_device::device_add_mconfig)
MCFG_SCREEN_REFRESH_RATE(50)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_vic20_video_pak)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, m_palette, palette_device::MONOCHROME);
H46505(config, m_crtc, XTAL(14'318'181) / 8);
m_crtc->set_screen(MC6845_SCREEN_TAG);

View File

@ -122,7 +122,7 @@ MACHINE_CONFIG_START(wangpc_tig_device::device_add_mconfig)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette")
PALETTE(config, m_palette, palette_device::MONOCHROME_HIGHLIGHT);
UPD7220(config, m_hgdc0, XTAL(52'832'000)/28);
m_hgdc0->set_addrmap(0, &wangpc_tig_device::upd7220_0_map);

View File

@ -10,11 +10,12 @@
***************************************************************************/
#include "emu.h"
#include "debugger.h"
#include "dspp.h"
#include "dsppfe.h"
#include "dsppdasm.h"
#include "debugger.h"
//**************************************************************************
// CONSTANTS
@ -1473,7 +1474,7 @@ void dspp_device::process_next_dma(int32_t channel)
int16_t dspp_device::decode_sqxd(int8_t data, int16_t prev)
{
int16_t temp = sign_extend8(data & 0xfe);
int32_t expanded = (temp * abs(temp)) << 1;
int32_t expanded = (temp * iabs(temp)) << 1;
int16_t output;
if (data & 1)

View File

@ -613,7 +613,7 @@ MACHINE_CONFIG_START(ie15_device::device_add_mconfig)
ie15core(config);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ie15)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
ioport_constructor ie15_device::device_input_ports() const

View File

@ -212,7 +212,7 @@ public:
m_orig_config.m_overscalex = m_overscalex = scalex;
m_orig_config.m_overscaley = m_overscaley = scaley;
}
void set_overlay_palette(const char *tag) { m_overlay_palette.set_tag(tag); }
template <typename T> void set_overlay_palette(T &&tag) { m_overlay_palette.set_tag(std::forward<T>(tag)); }
protected:
// timer IDs

View File

@ -228,7 +228,7 @@ inline void cdp1869_device::update_prd_changed_timer()
inline rgb_t cdp1869_device::get_rgb(int i, int c, int l)
{
int luma = 0, r, g, b;
int luma = 0;
luma += (l & 4) ? CDP1869_WEIGHT_RED : 0;
luma += (l & 1) ? CDP1869_WEIGHT_GREEN : 0;
@ -236,9 +236,9 @@ inline rgb_t cdp1869_device::get_rgb(int i, int c, int l)
luma = (luma * 0xff) / 100;
r = (c & 4) ? luma : 0;
g = (c & 1) ? luma : 0;
b = (c & 2) ? luma : 0;
int const r = (c & 4) ? luma : 0;
int const g = (c & 1) ? luma : 0;
int const b = (c & 2) ? luma : 0;
return rgb_t(r, g, b);
}
@ -368,10 +368,10 @@ cdp1869_device::cdp1869_device(const machine_config &mconfig, const char *tag, d
// device_add_mconfig - add device configuration
//-------------------------------------------------
MACHINE_CONFIG_START(cdp1869_device::device_add_mconfig)
MCFG_PALETTE_ADD("palette", 8+64)
MCFG_PALETTE_INIT_OWNER(cdp1869_device, cdp1869)
MACHINE_CONFIG_END
void cdp1869_device::device_add_mconfig(machine_config &config)
{
PALETTE(config, m_palette, FUNC(cdp1869_device::cdp1869_palette), 8 + 64);
}
//-------------------------------------------------
@ -481,15 +481,13 @@ device_memory_interface::space_config_vector cdp1869_device::memory_space_config
// initialize_palette - initialize palette
//-------------------------------------------------
PALETTE_INIT_MEMBER(cdp1869_device, cdp1869)
void cdp1869_device::cdp1869_palette(palette_device &palette) const
{
// color-on-color display (CFC=0)
int i;
// color-on-color display (CFC=0)
for (i = 0; i < 8; i++)
{
palette.set_pen_color(i, get_rgb(i, i, 15));
}
// tone-on-tone display (CFC=1)
for (int c = 0; c < 8; c++)

View File

@ -239,7 +239,7 @@ protected:
inline void write_char_ram_byte(offs_t pma, offs_t cma, uint8_t pmd, uint8_t data);
inline int read_pcb(offs_t pma, offs_t cma, uint8_t pmd);
inline void update_prd_changed_timer();
inline rgb_t get_rgb(int i, int c, int l);
static rgb_t get_rgb(int i, int c, int l);
inline int get_lines();
inline uint16_t get_pmemsize(int cols, int rows);
inline uint16_t get_pma();
@ -288,7 +288,7 @@ private:
uint8_t m_wnfreq; // white noise range select
uint8_t m_wnamp; // white noise output amplitude
DECLARE_PALETTE_INIT(cdp1869);
void cdp1869_palette(palette_device &palette) const;
};

View File

@ -20,14 +20,9 @@
class voltage_regulator_device : public device_t, public device_sound_interface
{
public:
void set_output(double analogue_dc) { m_output = (analogue_dc * 32768) / 5.0f; }
voltage_regulator_device &set_output(double analogue_dc) { m_output = (analogue_dc * 32768) / 5.0f; return *this; }
voltage_regulator_device(const machine_config &mconfig, const char *tag, device_t *owner)
: voltage_regulator_device(mconfig, tag, owner, (uint32_t)0)
{
}
voltage_regulator_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
voltage_regulator_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
virtual bool issound() override { return false; }

View File

@ -119,7 +119,7 @@ DEFINE_DEVICE_TYPE(SEGA315_5246, sega315_5246_device, "sega315_5246", "Sega 315-
DEFINE_DEVICE_TYPE(SEGA315_5377, sega315_5377_device, "sega315_5377", "Sega 315-5377 Gamegear VDP")
PALETTE_INIT_MEMBER(sega315_5124_device, sega315_5124)
void sega315_5124_device::sega315_5124_palette(palette_device &palette) const
{
for (int i = 0; i < 64; i++)
{
@ -128,8 +128,8 @@ PALETTE_INIT_MEMBER(sega315_5124_device, sega315_5124)
const int b = (i & 0x30) >> 4;
palette.set_pen_color(i, pal2bit(r), pal2bit(g), pal2bit(b));
}
/* sms and sg1000-mark3 uses a different palette for modes 0 to 3 - see http://www.smspower.org/Development/Palette */
/* TMS9918 palette */
// sms and sg1000-mark3 uses a different palette for modes 0 to 3 - see http://www.smspower.org/Development/Palette
// TMS9918 palette
palette.set_pen_color(64+ 0, 0, 0, 0); // palette.set_pen_color(64+ 0, 0, 0, 0);
palette.set_pen_color(64+ 1, 0, 0, 0); // palette.set_pen_color(64+ 1, 0, 0, 0);
palette.set_pen_color(64+ 2, 0, 170, 0); // palette.set_pen_color(64+ 2, 33, 200, 66);
@ -149,7 +149,7 @@ PALETTE_INIT_MEMBER(sega315_5124_device, sega315_5124)
}
PALETTE_INIT_MEMBER(sega315_5377_device, sega315_5377)
void sega315_5377_device::sega315_5377_palette(palette_device &palette) const
{
for (int i = 0; i < 4096; i++)
{
@ -1931,10 +1931,10 @@ void sega315_5124_device::device_reset()
// device_add_mconfig - add machine configuration
//-------------------------------------------------
MACHINE_CONFIG_START(sega315_5124_device::device_add_mconfig)
MCFG_PALETTE_ADD("palette", SEGA315_5124_PALETTE_SIZE)
MCFG_PALETTE_INIT_OWNER(sega315_5124_device, sega315_5124)
MACHINE_CONFIG_END
void sega315_5124_device::device_add_mconfig(machine_config &config)
{
PALETTE(config, m_palette, FUNC(sega315_5124_device::sega315_5124_palette), SEGA315_5124_PALETTE_SIZE);
}
void sega315_5377_device::device_reset()
{
@ -1946,7 +1946,9 @@ void sega315_5377_device::device_reset()
// device_add_mconfig - add machine configuration
//-------------------------------------------------
MACHINE_CONFIG_START(sega315_5377_device::device_add_mconfig)
MCFG_PALETTE_ADD("palette", SEGA315_5377_PALETTE_SIZE)
MCFG_PALETTE_INIT_OWNER(sega315_5377_device, sega315_5377)
MACHINE_CONFIG_END
void sega315_5377_device::device_add_mconfig(machine_config &config)
{
sega315_5246_device::device_add_mconfig(config);
m_palette->set_entries(SEGA315_5377_PALETTE_SIZE);
m_palette->set_init(FUNC(sega315_5377_device::sega315_5377_palette));
}

View File

@ -70,8 +70,6 @@ public:
DECLARE_READ8_MEMBER( vcount_read );
DECLARE_READ8_MEMBER( hcount_read );
DECLARE_PALETTE_INIT( sega315_5124 );
void hcount_latch() { hcount_latch_at_hpos(screen().hpos()); };
void hcount_latch_at_hpos(int hpos);
@ -83,7 +81,6 @@ public:
virtual void set_sega315_5124_compatibility_mode(bool sega315_5124_compatibility_mode) { }
void sega315_5124(address_map &map);
protected:
static constexpr unsigned SEGA315_5377_CRAM_SIZE = 0x40; /* 32 colors x 2 bytes per color = 64 bytes */
static constexpr unsigned SEGA315_5124_CRAM_SIZE = 0x20; /* 32 colors x 1 bytes per color = 32 bytes */
@ -97,6 +94,10 @@ protected:
virtual space_config_vector memory_space_config() const override;
void sega315_5124_palette(palette_device &palette) const;
void sega315_5124(address_map &map);
void set_display_settings();
void set_frame_timing();
virtual void update_palette();
@ -228,7 +229,7 @@ protected:
virtual void blit_scanline(int *line_buffer, int *priority_selected, int pixel_offset_x, int pixel_plot_y, int line) override;
private:
DECLARE_PALETTE_INIT( sega315_5377 );
void sega315_5377_palette(palette_device &palette) const;
};

View File

@ -221,13 +221,12 @@ sega315_5313_device::sega315_5313_device(const machine_config &mconfig, const ch
// add machine configuration
//-------------------------------------------------
MACHINE_CONFIG_START(sega315_5313_device::device_add_mconfig)
MCFG_PALETTE_ADD("palette", 0x200)
MCFG_PALETTE_INIT_OWNER(sega315_5124_device, sega315_5124)
void sega315_5313_device::device_add_mconfig(machine_config &config)
{
sega315_5313_mode4_device::device_add_mconfig(config);
MCFG_DEVICE_ADD("snsnd", SEGAPSG, DERIVED_CLOCK(1, 15))
MCFG_MIXER_ROUTE(ALL_OUTPUTS, *this, 0.5, 0)
MACHINE_CONFIG_END
SEGAPSG(config, m_snsnd, DERIVED_CLOCK(1, 15)).add_route(ALL_OUTPUTS, *this, 0.5, AUTO_ALLOC_INPUT, 0);
}
TIMER_CALLBACK_MEMBER(sega315_5313_device::irq6_on_timer_callback)
{

View File

@ -16,54 +16,56 @@
#include "screen.h"
/* LCD I/O Registers */
#define DISPCNT HWLO(0x000) /* 0x4000000 2 R/W LCD Control */
#define GRNSWAP HWHI(0x000) /* 0x4000002 2 R/W Undocumented - Green Swap */
#define DISPSTAT HWLO(0x004) /* 0x4000004 2 R/W General LCD Status (STAT,LYC) */
#define VCOUNT HWHI(0x004) /* 0x4000006 2 R Vertical Counter (LY) */
#define BG0CNT HWLO(0x008) /* 0x4000008 2 R/W BG0 Control */
#define BG1CNT HWHI(0x008) /* 0x400000a 2 R/W BG1 Control */
#define BG2CNT HWLO(0x00c) /* 0x400000c 2 R/W BG2 Control */
#define BG3CNT HWHI(0x00c) /* 0x400000e 2 R/W BG3 Control */
#define BG0HOFS HWLO(0x010) /* 0x4000010 2 W BG0 X-Offset */
#define BG0VOFS HWHI(0x010) /* 0x4000012 2 W BG0 Y-Offset */
#define BG1HOFS HWLO(0x014) /* 0x4000014 2 W BG1 X-Offset */
#define BG1VOFS HWHI(0x014) /* 0x4000016 2 W BG1 Y-Offset */
#define BG2HOFS HWLO(0x018) /* 0x4000018 2 W BG2 X-Offset */
#define BG2VOFS HWHI(0x018) /* 0x400001a 2 W BG2 Y-Offset */
#define BG3HOFS HWLO(0x01c) /* 0x400001c 2 W BG3 X-Offset */
#define BG3VOFS HWHI(0x01c) /* 0x400001e 2 W BG3 Y-Offset */
#define BG2PA HWLO(0x020) /* 0x4000020 2 W BG2 Rotation/Scaling Parameter A (dx) */
#define BG2PB HWHI(0x020) /* 0x4000022 2 W BG2 Rotation/Scaling Parameter B (dmx) */
#define BG2PC HWLO(0x024) /* 0x4000024 2 W BG2 Rotation/Scaling Parameter C (dy) */
#define BG2PD HWHI(0x024) /* 0x4000026 2 W BG2 Rotation/Scaling Parameter D (dmy) */
#define BG2X WORD(0x028) /* 0x4000028 4 W BG2 Reference Point X-Coordinate */
#define BG2Y WORD(0x02c) /* 0x400002c 4 W BG2 Reference Point Y-Coordinate */
#define BG3PA HWLO(0x030) /* 0x4000030 2 W BG3 Rotation/Scaling Parameter A (dx) */
#define BG3PB HWHI(0x030) /* 0x4000032 2 W BG3 Rotation/Scaling Parameter B (dmx) */
#define BG3PC HWLO(0x034) /* 0x4000034 2 W BG3 Rotation/Scaling Parameter C (dy) */
#define BG3PD HWHI(0x034) /* 0x4000036 2 W BG3 Rotation/Scaling Parameter D (dmy) */
#define BG3X WORD(0x038) /* 0x4000038 4 W BG3 Reference Point X-Coordinate */
#define BG3Y WORD(0x03c) /* 0x400003c 4 W BG3 Reference Point Y-Coordinate */
#define WIN0H HWLO(0x040) /* 0x4000040 2 W Window 0 Horizontal Dimensions */
#define WIN1H HWHI(0x040) /* 0x4000042 2 W Window 1 Horizontal Dimensions */
#define WIN0V HWLO(0x044) /* 0x4000044 2 W Window 0 Vertical Dimensions */
#define WIN1V HWHI(0x044) /* 0x4000046 2 W Window 1 Vertical Dimensions */
#define WININ HWLO(0x048) /* 0x4000048 2 R/W Inside of Window 0 and 1 */
#define WINOUT HWHI(0x048) /* 0x400004a 2 R/W Inside of OBJ Window & Outside of Windows */
#define MOSAIC HWLO(0x04c) /* 0x400004c 2 W Mosaic Size */
/* 0x400004e 2 - Unused */
#define BLDCNT HWLO(0x050) /* 0x4000050 2 R/W Color Special Effects Selection */
#define BLDALPHA HWHI(0x050) /* 0x4000052 2 W Alpha Blending Coefficients */
#define BLDY HWLO(0x054) /* 0x4000054 2 W Brightness (Fade-In/Out) Coefficient */
/* 0x4000056 2 - Unused */
namespace {
// LCD I/O Registers
#define DISPCNT HWLO(0x000) // 0x4000000 2 R/W LCD Control
#define GRNSWAP HWHI(0x000) // 0x4000002 2 R/W Undocumented - Green Swap
#define DISPSTAT HWLO(0x004) // 0x4000004 2 R/W General LCD Status (STAT,LYC)
#define VCOUNT HWHI(0x004) // 0x4000006 2 R Vertical Counter (LY)
#define BG0CNT HWLO(0x008) // 0x4000008 2 R/W BG0 Control
#define BG1CNT HWHI(0x008) // 0x400000a 2 R/W BG1 Control
#define BG2CNT HWLO(0x00c) // 0x400000c 2 R/W BG2 Control
#define BG3CNT HWHI(0x00c) // 0x400000e 2 R/W BG3 Control
#define BG0HOFS HWLO(0x010) // 0x4000010 2 W BG0 X-Offset
#define BG0VOFS HWHI(0x010) // 0x4000012 2 W BG0 Y-Offset
#define BG1HOFS HWLO(0x014) // 0x4000014 2 W BG1 X-Offset
#define BG1VOFS HWHI(0x014) // 0x4000016 2 W BG1 Y-Offset
#define BG2HOFS HWLO(0x018) // 0x4000018 2 W BG2 X-Offset
#define BG2VOFS HWHI(0x018) // 0x400001a 2 W BG2 Y-Offset
#define BG3HOFS HWLO(0x01c) // 0x400001c 2 W BG3 X-Offset
#define BG3VOFS HWHI(0x01c) // 0x400001e 2 W BG3 Y-Offset
#define BG2PA HWLO(0x020) // 0x4000020 2 W BG2 Rotation/Scaling Parameter A (dx)
#define BG2PB HWHI(0x020) // 0x4000022 2 W BG2 Rotation/Scaling Parameter B (dmx)
#define BG2PC HWLO(0x024) // 0x4000024 2 W BG2 Rotation/Scaling Parameter C (dy)
#define BG2PD HWHI(0x024) // 0x4000026 2 W BG2 Rotation/Scaling Parameter D (dmy)
#define BG2X WORD(0x028) // 0x4000028 4 W BG2 Reference Point X-Coordinate
#define BG2Y WORD(0x02c) // 0x400002c 4 W BG2 Reference Point Y-Coordinate
#define BG3PA HWLO(0x030) // 0x4000030 2 W BG3 Rotation/Scaling Parameter A (dx)
#define BG3PB HWHI(0x030) // 0x4000032 2 W BG3 Rotation/Scaling Parameter B (dmx)
#define BG3PC HWLO(0x034) // 0x4000034 2 W BG3 Rotation/Scaling Parameter C (dy)
#define BG3PD HWHI(0x034) // 0x4000036 2 W BG3 Rotation/Scaling Parameter D (dmy)
#define BG3X WORD(0x038) // 0x4000038 4 W BG3 Reference Point X-Coordinate
#define BG3Y WORD(0x03c) // 0x400003c 4 W BG3 Reference Point Y-Coordinate
#define WIN0H HWLO(0x040) // 0x4000040 2 W Window 0 Horizontal Dimensions
#define WIN1H HWHI(0x040) // 0x4000042 2 W Window 1 Horizontal Dimensions
#define WIN0V HWLO(0x044) // 0x4000044 2 W Window 0 Vertical Dimensions
#define WIN1V HWHI(0x044) // 0x4000046 2 W Window 1 Vertical Dimensions
#define WININ HWLO(0x048) // 0x4000048 2 R/W Inside of Window 0 and 1
#define WINOUT HWHI(0x048) // 0x400004a 2 R/W Inside of OBJ Window & Outside of Windows
#define MOSAIC HWLO(0x04c) // 0x400004c 2 W Mosaic Size
// 0x400004e 2 - Unused
#define BLDCNT HWLO(0x050) // 0x4000050 2 R/W Color Special Effects Selection
#define BLDALPHA HWHI(0x050) // 0x4000052 2 W Alpha Blending Coefficients
#define BLDY HWLO(0x054) // 0x4000054 2 W Brightness (Fade-In/Out) Coefficient
// 0x4000056 2 - Unused
#define DISPSTAT_SET(val) HWLO_SET(0x004, val)
#define DISPSTAT_RESET(val) HWLO_RESET(0x004, val)
#define VERBOSE_LEVEL (0)
static inline void ATTR_PRINTF(3,4) verboselog(device_t &device, int n_level, const char *s_fmt, ...)
inline void ATTR_PRINTF(3,4) verboselog(device_t &device, int n_level, const char *s_fmt, ...)
{
if (VERBOSE_LEVEL >= n_level)
{
@ -139,6 +141,8 @@ private:
uint16_t m_attr2;
};
} // anonymous namespace
DEFINE_DEVICE_TYPE(GBA_LCD, gba_lcd_device, "gba_lcd", "GBA LCD")
gba_lcd_device::gba_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
@ -1728,7 +1732,7 @@ TIMER_CALLBACK_MEMBER(gba_lcd_device::perform_scan)
m_scan_timer->adjust(screen().time_until_pos((scanline + 1) % 228, 0));
}
PALETTE_INIT_MEMBER(gba_lcd_device, gba)
void gba_lcd_device::gba_palette(palette_device &palette) const
{
for (uint8_t b = 0; b < 32; b++)
{
@ -1809,6 +1813,5 @@ MACHINE_CONFIG_START(gba_lcd_device::device_add_mconfig)
MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, gba_lcd_device, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 32768)
MCFG_PALETTE_INIT_OWNER(gba_lcd_device, gba)
PALETTE(config, "palette", FUNC(gba_lcd_device::gba_palette), 32768);
MACHINE_CONFIG_END

View File

@ -9,7 +9,6 @@
By R. Belmont, Ryan Holtz
***************************************************************************/
#ifndef MAME_VIDEO_GBA_LCD_H
#define MAME_VIDEO_GBA_LCD_H
@ -209,8 +208,7 @@ private:
uint32_t decrease_brightness(uint32_t color);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_PALETTE_INIT(gba);
void gba_palette(palette_device &palette) const;
devcb_write_line m_int_hblank_cb; /* H-Blank interrupt callback function */
devcb_write_line m_int_vblank_cb; /* V-Blank interrupt callback function */

View File

@ -123,18 +123,16 @@ inline void hd66421_device::writebyte(offs_t address, uint8_t data)
//-------------------------------------------------
hd66421_device::hd66421_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, HD66421, tag, owner, clock),
device_memory_interface(mconfig, *this),
m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, address_map_constructor(), address_map_constructor(FUNC(hd66421_device::hd66421), this)),
m_cmd(0),
m_x(0),
m_y(0),
m_palette(*this, "palette")
: device_t(mconfig, HD66421, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, address_map_constructor(), address_map_constructor(FUNC(hd66421_device::hd66421), this))
, m_cmd(0)
, m_x(0)
, m_y(0)
, m_palette(*this, "palette")
{
for (auto & elem : m_reg)
{
for (auto &elem : m_reg)
elem = 0;
}
}
@ -264,14 +262,14 @@ uint32_t hd66421_device::update_screen(screen_device &screen, bitmap_ind16 &bitm
return 0;
}
PALETTE_INIT_MEMBER(hd66421_device, hd66421)
void hd66421_device::hd66421_palette(palette_device &palette) const
{
// init palette
for (int i = 0; i < 4; i++)
{
palette.set_pen_color(i, rgb_t::white());
#ifndef HD66421_BRIGHTNESS_DOES_NOT_WORK
palette.set_pen_contrast(i, 1.0 * i / (4 - 1));
palette.set_pen_contrast(i, double(i) / (4 - 1));
#endif
}
}
@ -281,7 +279,7 @@ PALETTE_INIT_MEMBER(hd66421_device, hd66421)
// device_add_mconfig - add device configuration
//-------------------------------------------------
MACHINE_CONFIG_START(hd66421_device::device_add_mconfig)
MCFG_PALETTE_ADD("palette", 4)
MCFG_PALETTE_INIT_OWNER(hd66421_device, hd66421)
MACHINE_CONFIG_END
void hd66421_device::device_add_mconfig(machine_config &config)
{
PALETTE(config, m_palette, FUNC(hd66421_device::hd66421_palette), 4);
}

View File

@ -62,7 +62,7 @@ private:
void hd66421(address_map &map);
DECLARE_PALETTE_INIT(hd66421);
void hd66421_palette(palette_device &palette) const;
};

View File

@ -178,32 +178,29 @@ void i8244_device::device_reset()
}
PALETTE_INIT_MEMBER(i8244_device, i8244)
void i8244_device::i8244_palette(palette_device &palette) const
{
static const uint8_t i8244_colors[3*16] =
static constexpr rgb_t i8244_colors[16] =
{
0x00, 0x00, 0x00, // i r g b
0x00, 0x00, 0xAA, // i r g B
0x00, 0xAA, 0x00, // i r G b
0x00, 0xAA, 0xAA, // i r G B
0xAA, 0x00, 0x00, // i R g b
0xAA, 0x00, 0xAA, // i R g B
0xAA, 0xAA, 0x00, // i R G b
0xAA, 0xAA, 0xAA, // i R G B
0x55, 0x55, 0x55, // I r g b
0x55, 0x55, 0xFF, // I r g B
0x55, 0xFF, 0x55, // I r G b
0x55, 0xFF, 0xFF, // I r G B
0xFF, 0x55, 0x55, // I R g b
0xFF, 0x55, 0xFF, // I R g B
0xFF, 0xFF, 0x55, // I R G b
0xFF, 0xFF, 0xFF, // I R G B
{ 0x00, 0x00, 0x00 }, // i r g b
{ 0x00, 0x00, 0xaa }, // i r g B
{ 0x00, 0xaa, 0x00 }, // i r G b
{ 0x00, 0xaa, 0xaa }, // i r G B
{ 0xaa, 0x00, 0x00 }, // i R g b
{ 0xaa, 0x00, 0xaa }, // i R g B
{ 0xaa, 0xaa, 0x00 }, // i R G b
{ 0xaa, 0xaa, 0xaa }, // i R G B
{ 0x55, 0x55, 0x55 }, // I r g b
{ 0x55, 0x55, 0xff }, // I r g B
{ 0x55, 0xff, 0x55 }, // I r G b
{ 0x55, 0xff, 0xff }, // I r G B
{ 0xff, 0x55, 0x55 }, // I R g b
{ 0xff, 0x55, 0xff }, // I R g B
{ 0xff, 0xff, 0x55 }, // I R G b
{ 0xff, 0xff, 0xff } // I R G B
};
for ( int i = 0; i < 16; i++ )
{
palette.set_pen_color( i, i8244_colors[i*3], i8244_colors[i*3+1], i8244_colors[i*3+2] );
}
palette.set_pen_colors( 0, i8244_colors );
}

View File

@ -58,7 +58,7 @@ public:
DECLARE_WRITE8_MEMBER(write);
DECLARE_READ_LINE_MEMBER(vblank);
DECLARE_READ_LINE_MEMBER(hblank);
DECLARE_PALETTE_INIT(i8244);
void i8244_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

View File

@ -297,7 +297,7 @@ imagetek_i4300_device::imagetek_i4300_device(const machine_config &mconfig, cons
void imagetek_i4100_device::device_add_mconfig(machine_config &config)
{
PALETTE(config, m_palette, 0x1000).set_format(PALETTE_FORMAT_GGGGGRRRRRBBBBBx);
PALETTE(config, m_palette).set_format(palette_device::GRBx_555, 0x1000);
BUFFERED_SPRITERAM16(config, m_spriteram);
}

View File

@ -202,7 +202,7 @@ struct legacy_poly_manager
static void **allocate_array(running_machine &machine, size_t *itemsize, uint32_t itemcount);
static void *poly_item_callback(void *param, int threadid);
static void poly_state_presave(legacy_poly_manager *poly);
static void poly_state_presave(legacy_poly_manager &poly);
@ -1359,7 +1359,7 @@ static void *poly_item_callback(void *param, int threadid)
ensure everything is synced before saving
-------------------------------------------------*/
static void poly_state_presave(legacy_poly_manager *poly)
static void poly_state_presave(legacy_poly_manager &poly)
{
poly_wait(poly, "pre-save");
poly_wait(&poly, "pre-save");
}

View File

@ -13,28 +13,19 @@
///*************************************************************************
// INTERFACE CONFIGURATION MACROS
///*************************************************************************
#define MCFG_UPD7227_ADD(_tag, _sx, _sy) \
MCFG_DEVICE_ADD(_tag, UPD7227, 0) \
downcast<upd7227_device &>(*device).set_offsets(_sx, _sy);
///*************************************************************************
// TYPE DEFINITIONS
///*************************************************************************
// ======================> upd7227_device
class upd7227_device : public device_t,
public device_memory_interface
class upd7227_device : public device_t, public device_memory_interface
{
public:
// construction/destruction
upd7227_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
upd7227_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
upd7227_device(const machine_config &mconfig, const char *tag, device_t *owner, int sx, int sy) : upd7227_device(mconfig, tag, owner, 0)
{ set_offsets(sx, sy); }
// inline configuration helpers
void set_offsets(int sx, int sy) { m_sx = sx; m_sy = sy; }

View File

@ -46,7 +46,6 @@ protected:
using basetype = delegate<Signature>;
template <class FunctionClass> using member_func_type = typename basetype::template traits<FunctionClass>::member_func_type;
template <class FunctionClass> using const_member_func_type = typename basetype::template traits<FunctionClass>::const_member_func_type;
template <class FunctionClass> using static_func_type = typename basetype::template traits<FunctionClass>::static_func_type;
template <class FunctionClass> using static_ref_func_type = typename basetype::template traits<FunctionClass>::static_ref_func_type;
public:
@ -57,7 +56,6 @@ public:
template <class FunctionClass> named_delegate(member_func_type<FunctionClass> funcptr, const char *name, FunctionClass *object) : basetype(funcptr, object), m_name(name) { }
template <class FunctionClass> named_delegate(const_member_func_type<FunctionClass> funcptr, const char *name, FunctionClass *object) : basetype(funcptr, object), m_name(name) { }
explicit named_delegate(std::function<Signature> funcptr, const char *name) : basetype(funcptr), m_name(name) { }
template <class FunctionClass> named_delegate(static_func_type<FunctionClass> funcptr, const char *name, FunctionClass *object) : basetype(funcptr, object), m_name(name) { }
template <class FunctionClass> named_delegate(static_ref_func_type<FunctionClass> funcptr, const char *name, FunctionClass *object) : basetype(funcptr, object), m_name(name) { }
named_delegate &operator=(const basetype &src) { basetype::operator=(src); m_name = src.m_name; return *this; }
@ -78,7 +76,6 @@ class device_delegate : public named_delegate<Signature>, public device_delegate
using basetype = named_delegate<Signature>;
template <class FunctionClass> using member_func_type = typename basetype::template member_func_type<FunctionClass>;
template <class FunctionClass> using const_member_func_type = typename basetype::template const_member_func_type<FunctionClass>;
template <class FunctionClass> using static_func_type = typename basetype::template static_func_type<FunctionClass>;
template <class FunctionClass> using static_ref_func_type = typename basetype::template static_ref_func_type<FunctionClass>;
public:
@ -88,7 +85,6 @@ public:
device_delegate(const basetype &src, delegate_late_bind &object) : basetype(src, object), device_delegate_helper(src.m_device_name) { }
template <class FunctionClass> device_delegate(member_func_type<FunctionClass> funcptr, const char *name, FunctionClass *object) : basetype(funcptr, name, object), device_delegate_helper(safe_tag(dynamic_cast<device_t *>(object))) { }
template <class FunctionClass> device_delegate(const_member_func_type<FunctionClass> funcptr, const char *name, FunctionClass *object) : basetype(funcptr, name, object), device_delegate_helper(safe_tag(dynamic_cast<device_t *>(object))) { }
template <class FunctionClass> device_delegate(static_func_type<FunctionClass> funcptr, const char *name, FunctionClass *object) : basetype(funcptr, name, object), device_delegate_helper(safe_tag(dynamic_cast<device_t *>(object))) { }
template <class FunctionClass> device_delegate(static_ref_func_type<FunctionClass> funcptr, const char *name, FunctionClass *object) : basetype(funcptr, name, object), device_delegate_helper(safe_tag(dynamic_cast<device_t *>(object))) { }
device_delegate(std::function<Signature> funcptr, const char *name) : basetype(funcptr, name), device_delegate_helper(nullptr) { }
device_delegate &operator=(const thistype &src) { basetype::operator=(src); m_device_name = src.m_device_name; return *this; }
@ -98,9 +94,7 @@ public:
template <class FunctionClass> device_delegate(member_func_type<FunctionClass> funcptr, const char *name, const char *devname, FunctionClass *) : basetype(funcptr, name, static_cast<FunctionClass *>(nullptr)), device_delegate_helper(devname) { }
template <class FunctionClass> device_delegate(const_member_func_type<FunctionClass> funcptr, const char *name, const char *devname) : basetype(funcptr, name, static_cast<FunctionClass *>(nullptr)), device_delegate_helper(devname) { }
template <class FunctionClass> device_delegate(const_member_func_type<FunctionClass> funcptr, const char *name, const char *devname, FunctionClass *) : basetype(funcptr, name, static_cast<FunctionClass *>(nullptr)), device_delegate_helper(devname) { }
template <class FunctionClass> device_delegate(static_func_type<FunctionClass> funcptr, const char *name, const char *devname, FunctionClass *) : basetype(funcptr, name, static_cast<FunctionClass *>(nullptr)), device_delegate_helper(devname) { }
template <class FunctionClass> device_delegate(static_ref_func_type<FunctionClass> funcptr, const char *name, const char *devname, FunctionClass *) : basetype(funcptr, name, static_cast<FunctionClass *>(nullptr)), device_delegate_helper(devname) { }
device_delegate(static_func_type<device_t> funcptr, const char *name) : basetype(funcptr, name, static_cast<device_t *>(nullptr)), device_delegate_helper(nullptr) { }
device_delegate(static_ref_func_type<device_t> funcptr, const char *name) : basetype(funcptr, name, static_cast<device_t *>(nullptr)), device_delegate_helper(nullptr) { }
// and constructors that provide a search root

View File

@ -42,9 +42,6 @@ class device_palette_interface : public device_interface
static constexpr int MAX_SHADOW_PRESETS = 4;
public:
// construction/destruction
device_palette_interface(const machine_config &mconfig, device_t &device);
// getters
u32 entries() const { return palette_entries(); }
u32 indirect_entries() const { return palette_indirect_entries(); }
@ -66,6 +63,7 @@ public:
void set_pen_blue_level(pen_t pen, u8 level) { m_palette->entry_set_blue_level(pen, level); }
void set_pen_color(pen_t pen, u8 r, u8 g, u8 b) { m_palette->entry_set_color(pen, rgb_t(r, g, b)); }
void set_pen_colors(pen_t color_base, const rgb_t *colors, int color_count) { while (color_count--) set_pen_color(color_base++, *colors++); }
template <size_t N> void set_pen_colors(pen_t color_base, const rgb_t (&colors)[N]) { set_pen_colors(color_base, colors, N); }
void set_pen_colors(pen_t color_base, const std::vector<rgb_t> &colors) { for (unsigned int i=0; i != colors.size(); i++) set_pen_color(color_base+i, colors[i]); }
void set_pen_contrast(pen_t pen, double bright) { m_palette->entry_set_contrast(pen, bright); }
@ -82,6 +80,9 @@ public:
void set_shadow_mode(int mode) { assert(mode >= 0 && mode < MAX_SHADOW_PRESETS); m_shadow_table = m_shadow_tables[mode].base; }
protected:
// construction/destruction
device_palette_interface(const machine_config &mconfig, device_t &device);
// interface-level overrides
virtual void interface_validity_check(validity_checker &valid) const override;
virtual void interface_pre_start() override;

View File

@ -44,22 +44,23 @@ device_sound_interface::~device_sound_interface()
device_sound_interface &device_sound_interface::add_route(u32 output, const char *target, double gain, u32 input, u32 mixoutput)
{
assert(!device().started());
m_route_list.emplace_back(sound_route{ output, input, mixoutput, float(gain), device().mconfig().current_device(), target });
return *this;
return add_route(output, device().mconfig().current_device(), target, gain, input, mixoutput);
}
device_sound_interface &device_sound_interface::add_route(u32 output, device_sound_interface &target, double gain, u32 input, u32 mixoutput)
{
assert(!device().started());
m_route_list.emplace_back(sound_route{ output, input, mixoutput, float(gain), target.device(), DEVICE_SELF });
return *this;
return add_route(output, target.device(), DEVICE_SELF, gain, input, mixoutput);
}
device_sound_interface &device_sound_interface::add_route(u32 output, speaker_device &target, double gain, u32 input, u32 mixoutput)
{
return add_route(output, target, DEVICE_SELF, gain, input, mixoutput);
}
device_sound_interface &device_sound_interface::add_route(u32 output, device_t &base, const char *target, double gain, u32 input, u32 mixoutput)
{
assert(!device().started());
m_route_list.emplace_back(sound_route{ output, input, mixoutput, float(gain), target, DEVICE_SELF });
m_route_list.emplace_back(sound_route{ output, input, mixoutput, float(gain), base, target });
return *this;
}

View File

@ -18,6 +18,7 @@
#define MAME_EMU_DISOUND_H
#include <functional>
#include <utility>
//**************************************************************************
@ -74,6 +75,12 @@ public:
std::vector<sound_route> const &routes() const { return m_route_list; }
// configuration helpers
template <typename T, bool R>
device_sound_interface &add_route(u32 output, const device_finder<T, R> &target, double gain, u32 input = AUTO_ALLOC_INPUT, u32 mixoutput = 0)
{
const std::pair<device_t &, const char *> ft(target.finder_target());
return add_route(output, ft.first, ft.second, gain, input, mixoutput);
}
device_sound_interface &add_route(u32 output, const char *target, double gain, u32 input = AUTO_ALLOC_INPUT, u32 mixoutput = 0);
device_sound_interface &add_route(u32 output, device_sound_interface &target, double gain, u32 input = AUTO_ALLOC_INPUT, u32 mixoutput = 0);
device_sound_interface &add_route(u32 output, speaker_device &target, double gain, u32 input = AUTO_ALLOC_INPUT, u32 mixoutput = 0);
@ -99,6 +106,7 @@ public:
protected:
// configuration access
std::vector<sound_route> &routes() { return m_route_list; }
device_sound_interface &add_route(u32 output, device_t &base, const char *tag, double gain, u32 input, u32 mixoutput);
// optional operation overrides
virtual void interface_validity_check(validity_checker &valid) const override;

View File

@ -164,8 +164,6 @@ template <typename D, typename T, typename Ret, typename... Params>
struct rw_device_class<D, Ret (T::*)(Params...) const, std::enable_if_t<std::is_constructible<D, Ret (T::*)(Params...) const, const char *, const char *, T *>::value> > { using type = T; };
template <typename D, typename T, typename Ret, typename... Params>
struct rw_device_class<D, Ret (*)(T &, Params...), std::enable_if_t<std::is_constructible<D, Ret (*)(T &, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename D, typename T, typename Ret, typename... Params>
struct rw_device_class<D, Ret (*)(T *, Params...), std::enable_if_t<std::is_constructible<D, Ret (*)(T *, Params...), const char *, const char *, T *>::value> > { using type = T; };
template <typename D, typename T> using rw_device_class_t = typename rw_device_class <D, T>::type;

View File

@ -18,22 +18,323 @@
DEFINE_DEVICE_TYPE(PALETTE, palette_device, "palette", "palette")
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 entries)
: device_t(mconfig, PALETTE, tag, owner, (uint32_t)0),
device_palette_interface(mconfig, *this),
m_entries(0),
m_indirect_entries(0),
m_enable_shadows(0),
m_enable_hilights(0),
m_membits(0),
m_membits_supplied(false),
m_endianness(),
m_endianness_supplied(false),
m_prom_region(*this, finder_base::DUMMY_TAG),
m_init(palette_init_delegate()),
m_raw_to_rgb(raw_to_rgb_converter())
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, init_delegate &&init, u32 entries, u32 indirect)
: palette_device(mconfig, tag, owner, 0U)
{
set_entries(entries);
set_indirect_entries(indirect);
set_init(std::move(init));
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, black_t, u32 entries)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_all_black), this), entries)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, mono_t)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_monochrome), this), 2)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, mono_inv_t)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_monochrome_inverted), this), 2)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, mono_hi_t)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_monochrome_highlight), this), 3)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, rgb_3b_t)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_3bit_rgb), this), 8)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, rbg_3b_t)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_3bit_rbg), this), 8)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, grb_3b_t)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_3bit_grb), this), 8)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, gbr_3b_t)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_3bit_gbr), this), 8)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, brg_3b_t)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_3bit_brg), this), 8)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, bgr_3b_t)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_3bit_bgr), this), 8)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, rgb_555_t)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_rgb_555), this), 32768)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, grb_555_t)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_grb_555), this), 32768)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, bgr_555_t)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_bgr_555), this), 32768)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, rgb_565_t)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_rgb_565), this), 65536)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, bgr_565_t)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_bgr_565), this), 65536)
{
}
palette_device::palette_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, PALETTE, tag, owner, clock)
, device_palette_interface(mconfig, *this)
, m_entries(0)
, m_indirect_entries(0)
, m_enable_shadows(0)
, m_enable_hilights(0)
, m_membits(0)
, m_membits_supplied(false)
, m_endianness()
, m_endianness_supplied(false)
, m_prom_region(*this, finder_base::DUMMY_TAG)
, m_init()
, m_raw_to_rgb()
{
}
palette_device &palette_device::set_format(int bytes_per_entry, raw_to_rgb_converter::raw_to_rgb_func func, u32 entries)
{
set_format(raw_to_rgb_converter(bytes_per_entry, func));
set_entries(entries);
return *this;
}
palette_device &palette_device::set_format(rgb_332_t, u32 entries)
{
set_format(1, &raw_to_rgb_converter::standard_rgb_decoder<3,3,2, 5,2,0>, entries);
return *this;
}
palette_device &palette_device::set_format(bgr_233_t, u32 entries)
{
set_format(1, &raw_to_rgb_converter::standard_rgb_decoder<3,3,2, 0,3,6>, entries);
return *this;
}
palette_device &palette_device::set_format(rgb_332_inv_t, u32 entries)
{
set_format(1, &raw_to_rgb_converter::inverted_rgb_decoder<3,3,2, 5,2,0>, entries);
return *this;
}
palette_device &palette_device::set_format(bgr_233_inv_t, u32 entries)
{
set_format(1, &raw_to_rgb_converter::inverted_rgb_decoder<3,3,2, 0,3,6>, entries);
return *this;
}
palette_device &palette_device::set_format(xrgb_333_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<3,3,3, 6,3,0>, entries);
return *this;
}
palette_device &palette_device::set_format(xrbg_333_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<3,3,3, 6,0,3>, entries);
return *this;
}
palette_device &palette_device::set_format(xbgr_333_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<3,3,3, 0,3,6>, entries);
return *this;
}
palette_device &palette_device::set_format(xrgb_444_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 8,4,0>, entries);
return *this;
}
palette_device &palette_device::set_format(xrbg_444_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 8,0,4>, entries);
return *this;
}
palette_device &palette_device::set_format(xbrg_444_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 4,0,8>, entries);
return *this;
}
palette_device &palette_device::set_format(xbgr_444_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 0,4,8>, entries);
return *this;
}
palette_device &palette_device::set_format(rgbx_444_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 12,8,4>, entries);
return *this;
}
palette_device &palette_device::set_format(gbrx_444_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 4,12,8>, entries);
return *this;
}
palette_device &palette_device::set_format(irgb_4444_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_irgb_decoder<4,4,4,4, 12,8,4,0>, entries);
return *this;
}
palette_device &palette_device::set_format(rgbi_4444_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_irgb_decoder<4,4,4,4, 0,12,8,4>, entries);
return *this;
}
palette_device &palette_device::set_format(xrgb_555_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 10,5,0>, entries);
return *this;
}
palette_device &palette_device::set_format(xgrb_555_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 5,10,0>, entries);
return *this;
}
palette_device &palette_device::set_format(xgbr_555_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 0,10,5>, entries);
return *this;
}
palette_device &palette_device::set_format(xbrg_555_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 5,0,10>, entries);
return *this;
}
palette_device &palette_device::set_format(xbgr_555_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 0,5,10>, entries);
return *this;
}
palette_device &palette_device::set_format(rgbx_555_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 11,6,1>, entries);
return *this;
}
palette_device &palette_device::set_format(grbx_555_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 6,11,1>, entries);
return *this;
}
palette_device &palette_device::set_format(brgx_555_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 6,1,11>, entries);
return *this;
}
palette_device &palette_device::set_format(xrbg_inv_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::inverted_rgb_decoder<5,5,5, 10,0,5>, entries);
return *this;
}
palette_device &palette_device::set_format(irgb_1555_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::IRRRRRGGGGGBBBBB_decoder, entries);
return *this;
}
palette_device &palette_device::set_format(rgb_565_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<5,6,5, 11,5,0>, entries);
return *this;
}
palette_device &palette_device::set_format(bgr_565_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::standard_rgb_decoder<5,6,5, 0,5,11>, entries);
return *this;
}
palette_device &palette_device::set_format(xrgb_888_t, u32 entries)
{
set_format(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 16,8,0>, entries);
return *this;
}
palette_device &palette_device::set_format(xgrb_888_t, u32 entries)
{
set_format(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 8,16,0>, entries);
return *this;
}
palette_device &palette_device::set_format(xbrg_888_t, u32 entries)
{
set_format(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 8,0,16>, entries);
return *this;
}
palette_device &palette_device::set_format(xbgr_888_t, u32 entries)
{
set_format(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 0,8,16>, entries);
return *this;
}
palette_device &palette_device::set_format(rgbx_888_t, u32 entries)
{
set_format(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 24,16,8>, entries);
return *this;
}
palette_device &palette_device::set_format(grbx_888_t, u32 entries)
{
set_format(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 16,24,8>, entries);
return *this;
}
palette_device &palette_device::set_format(bgrx_888_t, u32 entries)
{
set_format(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 8,16,24>, entries);
return *this;
}
palette_device &palette_device::set_format(rrrrggggbbbbrgbx_t, u32 entries)
{
set_format(2, &raw_to_rgb_converter::RRRRGGGGBBBBRGBx_decoder, entries);
return *this;
}
@ -346,7 +647,7 @@ void palette_device::palette_init_3bit_bgr(palette_device &palette)
bit 0 -- 2.2kohm resistor -- RED/GREEN/BLUE
-------------------------------------------------*/
void palette_device::palette_init_RRRRGGGGBBBB_proms(palette_device &palette)
void palette_device::palette_init_rgb_444_proms(palette_device &palette)
{
if (!m_prom_region.found())
throw emu_fatalerror("Unable to find color PROM region '%s'.", m_prom_region.finder_tag());
@ -385,49 +686,46 @@ void palette_device::palette_init_RRRRGGGGBBBB_proms(palette_device &palette)
/*-------------------------------------------------
RRRRR_GGGGG_BBBBB/BBBBB_GGGGG_RRRRR -
standard 5-5-5 palette for games using a
15-bit color space
-------------------------------------------------*/
void palette_device::palette_init_RRRRRGGGGGBBBBB(palette_device &palette)
void palette_device::palette_init_rgb_555(palette_device &palette)
{
int i;
for (i = 0; i < 0x8000; i++)
for (int i = 0; i < 0x8000; i++)
palette.set_pen_color(i, rgbexpand<5,5,5>(i, 10, 5, 0));
}
void palette_device::palette_init_BBBBBGGGGGRRRRR(palette_device &palette)
void palette_device::palette_init_grb_555(palette_device &palette)
{
int i;
for (int i = 0; i < 0x8000; i++)
palette.set_pen_color(i, rgbexpand<5,5,5>(i, 5, 10, 0));
}
for (i = 0; i < 0x8000; i++)
void palette_device::palette_init_bgr_555(palette_device &palette)
{
for (int i = 0; i < 0x8000; i++)
palette.set_pen_color(i, rgbexpand<5,5,5>(i, 0, 5, 10));
}
/*-------------------------------------------------
RRRRR_GGGGGG_BBBBB/BBBBB_GGGGGG_RRRRR -
standard 5-6-5 palette for games using a
16-bit color space
-------------------------------------------------*/
void palette_device::palette_init_RRRRRGGGGGGBBBBB(palette_device &palette)
void palette_device::palette_init_rgb_565(palette_device &palette)
{
int i;
for (i = 0; i < 0x10000; i++)
for (int i = 0; i < 0x10000; i++)
palette.set_pen_color(i, rgbexpand<5,6,5>(i, 11, 5, 0));
}
void palette_device::palette_init_BBBBBGGGGGGRRRRR(palette_device &palette)
void palette_device::palette_init_bgr_565(palette_device &palette)
{
int i;
for (i = 0; i < 0x10000; i++)
for (int i = 0; i < 0x10000; i++)
palette.set_pen_color(i, rgbexpand<5,6,5>(i, 0, 5, 11));
}

View File

@ -90,187 +90,41 @@
******************************************************************************/
#pragma once
#ifndef MAME_EMU_EMUPAL_H
#define MAME_EMU_EMUPAL_H
#pragma once
//**************************************************************************
// CONSTANTS
//**************************************************************************
#define PALETTE_INIT_NAME(_Name) palette_init_##_Name
#define DECLARE_PALETTE_INIT(_Name) void PALETTE_INIT_NAME(_Name)(palette_device &palette)
#define PALETTE_INIT_MEMBER(_Class, _Name) void _Class::PALETTE_INIT_NAME(_Name)(palette_device &palette)
#define PALETTE_DECODER_NAME(_Name) _Name##_decoder
#define DECLARE_PALETTE_DECODER(_Name) static rgb_t PALETTE_DECODER_NAME(_Name)(u32 raw)
#define PALETTE_DECODER_MEMBER(_Class, _Name) rgb_t _Class::PALETTE_DECODER_NAME(_Name)(u32 raw)
// standard 3-3-2 formats
#define PALETTE_FORMAT_BBGGGRRR raw_to_rgb_converter(1, &raw_to_rgb_converter::standard_rgb_decoder<3,3,2, 0,3,6>)
#define PALETTE_FORMAT_RRRGGGBB raw_to_rgb_converter(1, &raw_to_rgb_converter::standard_rgb_decoder<3,3,2, 5,2,0>)
// data-inverted 3-3-2 formats
#define PALETTE_FORMAT_BBGGGRRR_inverted raw_to_rgb_converter(1, &raw_to_rgb_converter::inverted_rgb_decoder<3,3,2, 0,3,6>)
#define PALETTE_FORMAT_RRRGGGBB_inverted raw_to_rgb_converter(1, &raw_to_rgb_converter::inverted_rgb_decoder<3,3,2, 5,2,0>)
// standard 3-3-3 formats
#define PALETTE_FORMAT_xxxxxxxBBBGGGRRR raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<3,3,3, 0,3,6>)
#define PALETTE_FORMAT_xxxxxxxRRRBBBGGG raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<3,3,3, 6,0,3>)
#define PALETTE_FORMAT_xxxxxxxRRRGGGBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<3,3,3, 6,3,0>)
// standard 4-4-4 formats
#define PALETTE_FORMAT_xxxxBBBBGGGGRRRR raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 0,4,8>)
#define PALETTE_FORMAT_xxxxBBBBRRRRGGGG raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 4,0,8>)
#define PALETTE_FORMAT_xxxxRRRRBBBBGGGG raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 8,0,4>)
#define PALETTE_FORMAT_xxxxRRRRGGGGBBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 8,4,0>)
#define PALETTE_FORMAT_RRRRGGGGBBBBxxxx raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 12,8,4>)
#define PALETTE_FORMAT_GGGGBBBBRRRRxxxx raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<4,4,4, 4,12,8>)
// standard 4-4-4-4 formats
#define PALETTE_FORMAT_IIIIRRRRGGGGBBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_irgb_decoder<4,4,4,4, 12,8,4,0>)
#define PALETTE_FORMAT_RRRRGGGGBBBBIIII raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_irgb_decoder<4,4,4,4, 0,12,8,4>)
// standard 5-5-5 formats
#define PALETTE_FORMAT_xBBBBBGGGGGRRRRR raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 0,5,10>)
#define PALETTE_FORMAT_xBBBBBRRRRRGGGGG raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 5,0,10>)
#define PALETTE_FORMAT_xRRRRRGGGGGBBBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 10,5,0>)
#define PALETTE_FORMAT_xGGGGGRRRRRBBBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 5,10,0>)
#define PALETTE_FORMAT_xGGGGGBBBBBRRRRR raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 0,10,5>)
#define PALETTE_FORMAT_BBBBBRRRRRGGGGGx raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 6,1,11>)
#define PALETTE_FORMAT_GGGGGRRRRRBBBBBx raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 6,11,1>)
#define PALETTE_FORMAT_RRRRRGGGGGBBBBBx raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 11,6,1>)
#define PALETTE_FORMAT_RRRRGGGGBBBBRGBx raw_to_rgb_converter(2, &raw_to_rgb_converter::RRRRGGGGBBBBRGBx_decoder)
// exotic 5-5-5 formats
#define PALETTE_FORMAT_xRGBRRRRGGGGBBBB_bit0 raw_to_rgb_converter(2, &raw_to_rgb_converter::xRGBRRRRGGGGBBBB_bit0_decoder)
#define PALETTE_FORMAT_xRGBRRRRGGGGBBBB_bit4 raw_to_rgb_converter(2, &raw_to_rgb_converter::xRGBRRRRGGGGBBBB_bit4_decoder)
// data-inverted 5-5-5 formats
#define PALETTE_FORMAT_xRRRRRBBBBBGGGGG_inverted raw_to_rgb_converter(2, &raw_to_rgb_converter::inverted_rgb_decoder<5,5,5, 10,0,5>)
// standard 5-6-5 formats
#define PALETTE_FORMAT_RRRRRGGGGGGBBBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,6,5, 11,5,0>)
#define PALETTE_FORMAT_BBBBBGGGGGGRRRRR raw_to_rgb_converter(2, &raw_to_rgb_converter::standard_rgb_decoder<5,6,5, 0,5,11>)
// standard 5-5-5-1 formats
#define PALETTE_FORMAT_IRRRRRGGGGGBBBBB raw_to_rgb_converter(2, &raw_to_rgb_converter::IRRRRRGGGGGBBBBB_decoder)
// standard 8-8-8 formats
#define PALETTE_FORMAT_XRGB raw_to_rgb_converter(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 16,8,0>)
#define PALETTE_FORMAT_XBGR raw_to_rgb_converter(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 0,8,16>)
#define PALETTE_FORMAT_XBRG raw_to_rgb_converter(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 8,0,16>)
#define PALETTE_FORMAT_XGRB raw_to_rgb_converter(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 8,16,0>)
#define PALETTE_FORMAT_RGBX raw_to_rgb_converter(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 24,16,8>)
#define PALETTE_FORMAT_GRBX raw_to_rgb_converter(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 16,24,8>)
#define PALETTE_FORMAT_BGRX raw_to_rgb_converter(4, &raw_to_rgb_converter::standard_rgb_decoder<8,8,8, 8,16,24>)
//**************************************************************************
// DEVICE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_PALETTE_ADD(_tag, _entries) \
MCFG_DEVICE_ADD(_tag, PALETTE, _entries)
MCFG_DEVICE_ADD(_tag, PALETTE, 0) \
downcast<palette_device &>(*device).set_entries(_entries);
#define MCFG_PALETTE_ADD_INIT_BLACK(_tag, _entries) \
MCFG_PALETTE_ADD(_tag, _entries) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_all_black), downcast<palette_device *>(device)));
#define MCFG_PALETTE_MODIFY MCFG_DEVICE_MODIFY
#define MCFG_PALETTE_INIT_OWNER(_class, _method) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(&_class::PALETTE_INIT_NAME(_method), #_class "::palette_init_" #_method, this));
#define MCFG_PALETTE_INIT_DEVICE(_tag, _class, _method) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(&_class::PALETTE_INIT_NAME(_method), #_class "::palette_init_" #_method, _tag));
#define MCFG_PALETTE_FORMAT(_format) \
downcast<palette_device &>(*device).set_format(PALETTE_FORMAT_##_format);
#define MCFG_PALETTE_FORMAT_CLASS(_bytes_per_entry, _class, _method) \
downcast<palette_device &>(*device).set_format(raw_to_rgb_converter(_bytes_per_entry, &_class::PALETTE_DECODER_NAME(_method)));
#define MCFG_PALETTE_MEMBITS(_width) \
downcast<palette_device &>(*device).set_membits(_width);
#define MCFG_PALETTE_ENDIANNESS(_endianness) \
downcast<palette_device &>(*device).set_endianness(_endianness);
#define MCFG_PALETTE_ENTRIES(_entries) \
downcast<palette_device &>(*device).set_entries(_entries);
#define MCFG_PALETTE_INDIRECT_ENTRIES(_entries) \
downcast<palette_device &>(*device).set_indirect_entries(_entries);
#define MCFG_PALETTE_ENABLE_SHADOWS() \
downcast<palette_device &>(*device).enable_shadows();
#define MCFG_PALETTE_ENABLE_HILIGHTS() \
downcast<palette_device &>(*device).enable_hilights();
// monochrome palettes
#define MCFG_PALETTE_ADD_MONOCHROME(_tag) \
MCFG_PALETTE_ADD(_tag, 2) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_monochrome), downcast<palette_device *>(device)));
#define MCFG_PALETTE_ADD_MONOCHROME_INVERTED(_tag) \
MCFG_PALETTE_ADD(_tag, 2) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_monochrome_inverted), downcast<palette_device *>(device)));
#define MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT(_tag) \
MCFG_PALETTE_ADD(_tag, 3) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_monochrome_highlight), downcast<palette_device *>(device)));
// 8-bit palettes
#define MCFG_PALETTE_ADD_3BIT_RGB(_tag) \
MCFG_PALETTE_ADD(_tag, 8) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_3bit_rgb), downcast<palette_device *>(device)));
#define MCFG_PALETTE_ADD_3BIT_RBG(_tag) \
MCFG_PALETTE_ADD(_tag, 8) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_3bit_rbg), downcast<palette_device *>(device)));
#define MCFG_PALETTE_ADD_3BIT_BRG(_tag) \
MCFG_PALETTE_ADD(_tag, 8) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_3bit_brg), downcast<palette_device *>(device)));
#define MCFG_PALETTE_ADD_3BIT_GRB(_tag) \
MCFG_PALETTE_ADD(_tag, 8) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_3bit_grb), downcast<palette_device *>(device)));
#define MCFG_PALETTE_ADD_3BIT_GBR(_tag) \
MCFG_PALETTE_ADD(_tag, 8) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_3bit_gbr), downcast<palette_device *>(device)));
#define MCFG_PALETTE_ADD_3BIT_BGR(_tag) \
MCFG_PALETTE_ADD(_tag, 8) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_3bit_bgr), downcast<palette_device *>(device)));
// 15-bit palettes
#define MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB(_tag) \
MCFG_PALETTE_ADD(_tag, 32768) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_RRRRRGGGGGBBBBB), downcast<palette_device *>(device)));
// 16-bit palettes
#define MCFG_PALETTE_ADD_BBBBBGGGGGRRRRR(_tag) \
MCFG_PALETTE_ADD(_tag, 32768) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_BBBBBGGGGGRRRRR), downcast<palette_device *>(device)));
#define MCFG_PALETTE_ADD_RRRRRGGGGGGBBBBB(_tag) \
MCFG_PALETTE_ADD(_tag, 65536) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_RRRRRGGGGGGBBBBB), downcast<palette_device *>(device)));
#define MCFG_PALETTE_ADD_BBBBBGGGGGGRRRRR(_tag) \
MCFG_PALETTE_ADD(_tag, 65536) \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_BBBBBGGGGGGRRRRR), downcast<palette_device *>(device)));
// other standard palettes
#define MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS(_tag, _region, _entries) \
MCFG_PALETTE_ADD(_tag, _entries) \
downcast<palette_device &>(*device).set_prom_region(_region); \
downcast<palette_device &>(*device).set_init(palette_init_delegate(FUNC(palette_device::palette_init_RRRRGGGGBBBB_proms), downcast<palette_device *>(device)));
// not implemented yet
#if 0
@ -293,14 +147,16 @@ typedef device_delegate<void (palette_device &)> palette_init_delegate;
class raw_to_rgb_converter
{
public:
// helper function
typedef rgb_t (*raw_to_rgb_func)(u32 raw);
public:
// constructor
raw_to_rgb_converter(int bytes_per_entry = 0, raw_to_rgb_func func = nullptr)
: m_bytes_per_entry(bytes_per_entry),
m_func(func) { }
raw_to_rgb_converter() { }
raw_to_rgb_converter(int bytes_per_entry, raw_to_rgb_func func)
: m_bytes_per_entry(bytes_per_entry)
, m_func(func)
{ }
// getters
int bytes_per_entry() const { return m_bytes_per_entry; }
@ -344,11 +200,10 @@ public:
static rgb_t xRGBRRRRGGGGBBBB_bit0_decoder(u32 raw); // bits 14/13/12 are LSb
static rgb_t xRGBRRRRGGGGBBBB_bit4_decoder(u32 raw); // bits 14/13/12 are MSb
private:
// internal data
int m_bytes_per_entry;
raw_to_rgb_func m_func;
int m_bytes_per_entry = 0;
raw_to_rgb_func m_func = nullptr;
};
@ -360,29 +215,189 @@ DECLARE_DEVICE_TYPE(PALETTE, palette_device)
class palette_device : public device_t, public device_palette_interface
{
public:
typedef device_delegate<void (palette_device &)> init_delegate;
// black-fill on start
enum black_t { BLACK };
// monochrome
enum mono_t { MONOCHROME };
enum mono_inv_t { MONOCHROME_INVERTED };
enum mono_hi_t { MONOCHROME_HIGHLIGHT };
// 3-bit (8-colour) - components here are LSB to MSB
enum rgb_3b_t { RGB_3BIT };
enum rbg_3b_t { RBG_3BIT };
enum grb_3b_t { GRB_3BIT };
enum gbr_3b_t { GBR_3BIT };
enum brg_3b_t { BRG_3BIT };
enum bgr_3b_t { BGR_3BIT };
// 8-bit
enum rgb_332_t { RGB_332, RRRGGGBB };
enum bgr_233_t { BGR_233, BBGGGRRR };
enum rgb_332_inv_t { RGB_332_inverted, RRRGGGBB_inverted };
enum bgr_233_inv_t { BGR_233_inverted, BBGGGRRR_inverted };
// 15-bit
enum rgb_555_t { RGB_555, RRRRRGGGGGBBBBB };
enum grb_555_t { GRB_555, GGGGGRRRRRBBBBB };
enum bgr_555_t { BGR_555, BBBBBGGGGGRRRRR };
// 16-bit
enum xrgb_333_t { xRGB_333, xxxxxxxRRRGGGBBB };
enum xrbg_333_t { xRBG_333, xxxxxxxRRRBBBGGG };
enum xbgr_333_t { xBGR_333, xxxxxxxBBBGGGRRR };
enum xrgb_444_t { xRGB_444, xxxxRRRRGGGGBBBB };
enum xrbg_444_t { xRBG_444, xxxxRRRRBBBBGGGG };
enum xbrg_444_t { xBRG_444, xxxxBBBBRRRRGGGG };
enum xbgr_444_t { xBGR_444, xxxxBBBBGGGGRRRR };
enum rgbx_444_t { RGBx_444, RRRRGGGGBBBBxxxx };
enum gbrx_444_t { GBRx_444, GGGGBBBBRRRRxxxx };
enum irgb_4444_t { IRGB_4444, IIIIRRRRGGGGBBBB };
enum rgbi_4444_t { RGBI_4444, RRRRGGGGBBBBIIII };
enum xrgb_555_t { xRGB_555, xRRRRRGGGGGBBBBB };
enum xgrb_555_t { xGRB_555, xGGGGGRRRRRBBBBB };
enum xgbr_555_t { xGBR_555, xGGGGGBBBBBRRRRR };
enum xbrg_555_t { xBRG_555, xBBBBBRRRRRGGGGG };
enum xbgr_555_t { xBGR_555, xBBBBBGGGGGRRRRR };
enum rgbx_555_t { RGBx_555, RRRRRGGGGGBBBBBx };
enum grbx_555_t { GRBx_555, GGGGGRRRRRBBBBBx };
enum brgx_555_t { BRGx_555, BBBBBRRRRRGGGGGx };
enum xrbg_inv_t { xRBG_555_inverted, xRRRRRBBBBBGGGGG_inverted };
enum irgb_1555_t { IRGB_1555, IRRRRRGGGGGBBBBB };
enum rgb_565_t { RGB_565, RRRRRGGGGGGBBBBB };
enum bgr_565_t { BGR_565, BBBBBGGGGGGBBBBB };
// 32-bit
enum xrgb_888_t { xRGB_888 };
enum xgrb_888_t { xGRB_888 };
enum xbrg_888_t { xBRG_888 };
enum xbgr_888_t { xBGR_888 };
enum rgbx_888_t { RGBx_888 };
enum grbx_888_t { GRBx_888 };
enum bgrx_888_t { BGRx_888 };
// other standard formats
enum rgb_444_prom_t { RGB_444_PROMS, RRRRGGGGBBBB_PROMS };
// exotic formats
enum rrrrggggbbbbrgbx_t { RRRRGGGGBBBBRGBx };
// construction/destruction
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 entries);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, init_delegate &&init, u32 entries = 0U, u32 indirect = 0U);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, black_t, u32 entries = 0U);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, mono_t);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, mono_inv_t);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, mono_hi_t);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, rgb_3b_t);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, rbg_3b_t);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, grb_3b_t);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, gbr_3b_t);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, brg_3b_t);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, bgr_3b_t);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, rgb_555_t);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, grb_555_t);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, bgr_555_t);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, rgb_565_t);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, bgr_565_t);
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
template <typename T>
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, rgb_444_prom_t, T &&region, u32 entries)
: palette_device(mconfig, tag, owner, init_delegate(FUNC(palette_device::palette_init_rgb_444_proms), this), entries)
{
set_prom_region(std::forward<T>(region));
}
// FIXME: these should be aware of current device for resolving the tag
template <class FunctionClass>
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, void (FunctionClass::*init)(palette_device &), const char *name, u32 entries = 0U, u32 indirect = 0U)
: palette_device(mconfig, tag, owner, init_delegate(init, name, nullptr, static_cast<FunctionClass *>(nullptr)), entries, indirect)
{ }
template <class FunctionClass>
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, void (FunctionClass::*init)(palette_device &) const, const char *name, u32 entries = 0U, u32 indirect = 0U)
: palette_device(mconfig, tag, owner, init_delegate(init, name, nullptr, static_cast<FunctionClass *>(nullptr)), entries, indirect)
{ }
template <class FunctionClass>
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, const char *devname, void (FunctionClass::*init)(palette_device &), const char *name, u32 entries = 0U, u32 indirect = 0U)
: palette_device(mconfig, tag, owner, init_delegate(init, name, devname, static_cast<FunctionClass *>(nullptr)), entries, indirect)
{ }
template <class FunctionClass>
palette_device(const machine_config &mconfig, const char *tag, device_t *owner, const char *devname, void (FunctionClass::*init)(palette_device &) const, const char *name, u32 entries = 0U, u32 indirect = 0U)
: palette_device(mconfig, tag, owner, init_delegate(init, name, devname, static_cast<FunctionClass *>(nullptr)), entries, indirect)
{ }
// configuration
template <typename Object> void set_init(Object &&init) { m_init = std::forward<Object>(init); }
void set_init(palette_init_delegate callback) { m_init = callback; }
template <class FunctionClass> void set_init(const char *devname, void (FunctionClass::*callback)(palette_device &), const char *name)
{
set_init(palette_init_delegate(callback, name, devname, static_cast<FunctionClass *>(nullptr)));
}
template <class FunctionClass> void set_init(void (FunctionClass::*callback)(palette_device &), const char *name)
{
set_init(palette_init_delegate(callback, name, nullptr, static_cast<FunctionClass *>(nullptr)));
}
palette_device &set_format(raw_to_rgb_converter raw_to_rgb) { m_raw_to_rgb = raw_to_rgb; return *this; }
palette_device &set_format(int bytes_per_entry, raw_to_rgb_converter::raw_to_rgb_func func, u32 entries);
palette_device &set_format(rgb_332_t, u32 entries);
palette_device &set_format(bgr_233_t, u32 entries);
palette_device &set_format(rgb_332_inv_t, u32 entries);
palette_device &set_format(bgr_233_inv_t, u32 entries);
palette_device &set_format(xrgb_333_t, u32 entries);
palette_device &set_format(xrbg_333_t, u32 entries);
palette_device &set_format(xbgr_333_t, u32 entries);
palette_device &set_format(xrgb_444_t, u32 entries);
palette_device &set_format(xrbg_444_t, u32 entries);
palette_device &set_format(xbrg_444_t, u32 entries);
palette_device &set_format(xbgr_444_t, u32 entries);
palette_device &set_format(rgbx_444_t, u32 entries);
palette_device &set_format(gbrx_444_t, u32 entries);
palette_device &set_format(irgb_4444_t, u32 entries);
palette_device &set_format(rgbi_4444_t, u32 entries);
palette_device &set_format(xrgb_555_t, u32 entries);
palette_device &set_format(xgrb_555_t, u32 entries);
palette_device &set_format(xgbr_555_t, u32 entries);
palette_device &set_format(xbrg_555_t, u32 entries);
palette_device &set_format(xbgr_555_t, u32 entries);
palette_device &set_format(rgbx_555_t, u32 entries);
palette_device &set_format(grbx_555_t, u32 entries);
palette_device &set_format(brgx_555_t, u32 entries);
palette_device &set_format(xrbg_inv_t, u32 entries);
palette_device &set_format(irgb_1555_t, u32 entries);
palette_device &set_format(rgb_565_t, u32 entries);
palette_device &set_format(bgr_565_t, u32 entries);
palette_device &set_format(xrgb_888_t, u32 entries);
palette_device &set_format(xgrb_888_t, u32 entries);
palette_device &set_format(xbrg_888_t, u32 entries);
palette_device &set_format(xbgr_888_t, u32 entries);
palette_device &set_format(rgbx_888_t, u32 entries);
palette_device &set_format(grbx_888_t, u32 entries);
palette_device &set_format(bgrx_888_t, u32 entries);
palette_device &set_format(rrrrggggbbbbrgbx_t, u32 entries);
template <typename T> palette_device &set_format(T x, u32 entries, u32 indirect) { set_format(x, entries); set_indirect_entries(indirect); return *this; }
palette_device &set_membits(int membits) { m_membits = membits; m_membits_supplied = true; return *this; }
palette_device &set_endianness(endianness_t endianness) { m_endianness = endianness; m_endianness_supplied = true; return *this; }
palette_device &set_entries(u32 entries) { m_entries = entries; return *this; }
palette_device &set_entries(u32 entries, u32 indirect) { m_entries = entries; m_indirect_entries = indirect; return *this; }
palette_device &set_indirect_entries(u32 entries) { m_indirect_entries = entries; return *this; }
palette_device &enable_shadows() { m_enable_shadows = true; return *this; }
palette_device &enable_hilights() { m_enable_hilights = true; return *this; }
template <typename T> palette_device &set_prom_region(T &&region) { m_prom_region.set_tag(std::forward<T>(region)); return *this; }
void set_format(raw_to_rgb_converter raw_to_rgb) { m_raw_to_rgb = raw_to_rgb; }
void set_membits(int membits) { m_membits = membits; m_membits_supplied = true; }
void set_endianness(endianness_t endianness) { m_endianness = endianness; m_endianness_supplied = true; }
void set_entries(u32 entries) { m_entries = entries; }
void set_indirect_entries(u32 entries) { m_indirect_entries = entries; }
void enable_shadows() { m_enable_shadows = true; }
void enable_hilights() { m_enable_hilights = true; }
void set_prom_region(const char *region) { m_prom_region.set_tag(region); }
// FIXME: these should be aware of current device for resolving the tag
template <class FunctionClass>
void set_init(void (FunctionClass::*init)(palette_device &), const char *name)
{
m_init = init_delegate(init, name, nullptr, static_cast<FunctionClass *>(nullptr));
}
template <class FunctionClass>
void set_init(void (FunctionClass::*init)(palette_device &) const, const char *name)
{
m_init = init_delegate(init, name, nullptr, static_cast<FunctionClass *>(nullptr));
}
template <class FunctionClass>
void set_init(const char *devname, void (FunctionClass::*init)(palette_device &), const char *name)
{
m_init = init_delegate(init, name, devname, static_cast<FunctionClass *>(nullptr));
}
template <class FunctionClass>
void set_init(const char *devname, void (FunctionClass::*init)(palette_device &) const, const char *name)
{
m_init = init_delegate(init, name, devname, static_cast<FunctionClass *>(nullptr));
}
// palette RAM accessors
memory_array &basemem() { return m_paletteram; }
@ -411,23 +426,6 @@ public:
DECLARE_READ32_MEMBER(read32);
DECLARE_WRITE32_MEMBER(write32);
// generic palette init routines
void palette_init_all_black(palette_device &palette);
void palette_init_monochrome(palette_device &palette);
void palette_init_monochrome_inverted(palette_device &palette);
void palette_init_monochrome_highlight(palette_device &palette);
void palette_init_3bit_rgb(palette_device &palette);
void palette_init_3bit_rbg(palette_device &palette);
void palette_init_3bit_brg(palette_device &palette);
void palette_init_3bit_grb(palette_device &palette);
void palette_init_3bit_gbr(palette_device &palette);
void palette_init_3bit_bgr(palette_device &palette);
void palette_init_RRRRGGGGBBBB_proms(palette_device &palette);
void palette_init_RRRRRGGGGGBBBBB(palette_device &palette);
void palette_init_BBBBBGGGGGRRRRR(palette_device &palette);
void palette_init_RRRRRGGGGGGBBBBB(palette_device &palette);
void palette_init_BBBBBGGGGGGRRRRR(palette_device &palette);
// helper to update palette when data changed
void update() { if (!m_init.isnull()) m_init(*this); }
@ -441,6 +439,24 @@ protected:
virtual bool palette_shadows_enabled() const override { return m_enable_shadows; }
virtual bool palette_hilights_enabled() const override { return m_enable_hilights; }
// generic palette init routines
void palette_init_all_black(palette_device &palette);
void palette_init_monochrome(palette_device &palette);
void palette_init_monochrome_inverted(palette_device &palette);
void palette_init_monochrome_highlight(palette_device &palette);
void palette_init_3bit_rgb(palette_device &palette);
void palette_init_3bit_rbg(palette_device &palette);
void palette_init_3bit_brg(palette_device &palette);
void palette_init_3bit_grb(palette_device &palette);
void palette_init_3bit_gbr(palette_device &palette);
void palette_init_3bit_bgr(palette_device &palette);
void palette_init_rgb_444_proms(palette_device &palette);
void palette_init_rgb_555(palette_device &palette);
void palette_init_grb_555(palette_device &palette);
void palette_init_bgr_555(palette_device &palette);
void palette_init_rgb_565(palette_device &palette);
void palette_init_bgr_565(palette_device &palette);
private:
void update_for_write(offs_t byte_offset, int bytes_modified, bool indirect = false);
@ -454,7 +470,7 @@ private:
endianness_t m_endianness; // endianness of palette RAM, if different from native
bool m_endianness_supplied; // true if endianness forced in static config
optional_memory_region m_prom_region; // region where the color PROMs are
palette_init_delegate m_init;
init_delegate m_init;
// palette RAM
raw_to_rgb_converter m_raw_to_rgb; // format of palette RAM

View File

@ -161,11 +161,27 @@ void compute_res_net_all(std::vector<rgb_t> &rgb, const u8 *prom, const res_net_
/* legacy interface */
namespace emu { namespace detail {
template <std::size_t I, typename T, std::size_t N, typename U>
constexpr auto combine_weights(T const (&tab)[N], U w) { return tab[I] * w; }
template <std::size_t I, typename T, std::size_t N, typename U, typename... V>
constexpr auto combine_weights(T const (&tab)[N], U w0, V... w) { return (tab[I] * w0) + combine_weights<I + 1>(tab, w...); }
} } // namespace emu::detail
double compute_resistor_weights(
int minval, int maxval, double scaler,
int count_1, const int * resistances_1, double * weights_1, int pulldown_1, int pullup_1,
int count_2, const int * resistances_2, double * weights_2, int pulldown_2, int pullup_2,
int count_3, const int * resistances_3, double * weights_3, int pulldown_3, int pullup_3 );
int minval, int maxval, double scaler,
int count_1, const int * resistances_1, double * weights_1, int pulldown_1, int pullup_1,
int count_2, const int * resistances_2, double * weights_2, int pulldown_2, int pullup_2,
int count_3, const int * resistances_3, double * weights_3, int pulldown_3, int pullup_3);
template <typename T, std::size_t N, typename... U>
constexpr int combine_weights(T const (&tab)[N], U... w)
{
return int(emu::detail::combine_weights<0U>(tab, w...) + 0.5);
}
#define combine_8_weights(tab,w0,w1,w2,w3,w4,w5,w6,w7) (int(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2) + (tab)[3]*(w3) + (tab)[4]*(w4) + (tab)[5]*(w5) + (tab)[6]*(w6) + (tab)[7]*(w7)) + 0.5))
#define combine_7_weights(tab,w0,w1,w2,w3,w4,w5,w6) (int(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2) + (tab)[3]*(w3) + (tab)[4]*(w4) + (tab)[5]*(w5) + (tab)[6]*(w6)) + 0.5))

View File

@ -72,7 +72,6 @@
* only works for GCC (for now; MSVC info is also readily available)
***************************************************************************/
#ifndef MAME_UTIL_DELEGATE_H
#define MAME_UTIL_DELEGATE_H
@ -164,7 +163,8 @@ class binding_type_exception : public std::exception
{
public:
binding_type_exception(const std::type_info &target_type, const std::type_info &actual_type)
: m_target_type(target_type), m_actual_type(actual_type) { }
: m_target_type(target_type), m_actual_type(actual_type)
{ }
const std::type_info &m_target_type;
const std::type_info &m_actual_type;
};
@ -175,13 +175,13 @@ public:
// delegate_traits is a meta-template that is used to provide a static function pointer
// and member function pointer of the appropriate type and number of parameters
template<typename _ClassType, typename _ReturnType, typename... Params>
template <typename ClassType, typename ReturnType, typename... Params>
struct delegate_traits
{
using static_func_type = _ReturnType(*)(_ClassType *, Params...);
using static_ref_func_type = _ReturnType(*)(_ClassType &, Params...);
using member_func_type = _ReturnType(_ClassType::*)(Params...);
using const_member_func_type = _ReturnType(_ClassType::*)(Params...) const;
using static_func_type = ReturnType (*)(ClassType *, Params...);
using static_ref_func_type = ReturnType (*)(ClassType &, Params...);
using member_func_type = ReturnType (ClassType::*)(Params...);
using const_member_func_type = ReturnType (ClassType::*)(Params...) const;
};
@ -203,25 +203,27 @@ class delegate_mfp
public:
// default constructor
delegate_mfp()
: m_rawdata(s_null_mfp),
m_realobject(nullptr),
m_stubfunction(nullptr) { }
: m_rawdata(s_null_mfp)
, m_realobject(nullptr)
, m_stubfunction(nullptr)
{ }
// copy constructor
delegate_mfp(const delegate_mfp &src)
: m_rawdata(src.m_rawdata),
m_realobject(src.m_realobject),
m_stubfunction(src.m_stubfunction) { }
: m_rawdata(src.m_rawdata)
, m_realobject(src.m_realobject)
, m_stubfunction(src.m_stubfunction)
{ }
// construct from any member function pointer
template<typename _MemberFunctionType, class _MemberFunctionClass, typename _ReturnType, typename _StaticFunctionType>
delegate_mfp(_MemberFunctionType mfp, _MemberFunctionClass *, _ReturnType *, _StaticFunctionType)
: m_rawdata(s_null_mfp),
m_realobject(nullptr),
m_stubfunction(make_generic<_StaticFunctionType>(&delegate_mfp::method_stub<_MemberFunctionClass, _ReturnType>))
template <typename MemberFunctionType, class MemberFunctionClass, typename ReturnType, typename StaticFunctionType>
delegate_mfp(MemberFunctionType mfp, MemberFunctionClass *, ReturnType *, StaticFunctionType)
: m_rawdata(s_null_mfp)
, m_realobject(nullptr)
, m_stubfunction(make_generic<StaticFunctionType>(&delegate_mfp::method_stub<MemberFunctionClass, ReturnType>))
{
assert(sizeof(mfp) <= sizeof(m_rawdata));
*reinterpret_cast<_MemberFunctionType *>(&m_rawdata) = mfp;
*reinterpret_cast<MemberFunctionType *>(&m_rawdata) = mfp;
}
// comparison helpers
@ -232,30 +234,30 @@ public:
delegate_generic_class *real_object(delegate_generic_class *original) const { return m_realobject; }
// binding helper
template<typename _FunctionType>
void update_after_bind(_FunctionType &funcptr, delegate_generic_class *&object)
template <typename FunctionType>
void update_after_bind(FunctionType &funcptr, delegate_generic_class *&object)
{
m_realobject = object;
object = reinterpret_cast<delegate_generic_class *>(this);
funcptr = reinterpret_cast<_FunctionType>(m_stubfunction);
funcptr = reinterpret_cast<FunctionType>(m_stubfunction);
}
private:
// helper stubs for calling encased member function pointers
template<class _FunctionClass, typename _ReturnType, typename... Params>
static _ReturnType method_stub(delegate_generic_class *object, Params ... args)
template <class FunctionClass, typename ReturnType, typename... Params>
static ReturnType method_stub(delegate_generic_class *object, Params ... args)
{
delegate_mfp *_this = reinterpret_cast<delegate_mfp *>(object);
using mfptype = _ReturnType(_FunctionClass::*)(Params...);
using mfptype = ReturnType(FunctionClass::*)(Params...);
mfptype &mfp = *reinterpret_cast<mfptype *>(&_this->m_rawdata);
return (reinterpret_cast<_FunctionClass *>(_this->m_realobject)->*mfp)(std::forward<Params>(args)...);
return (reinterpret_cast<FunctionClass *>(_this->m_realobject)->*mfp)(std::forward<Params>(args)...);
}
// helper to convert a function of a given type to a generic function, forcing template
// instantiation to match the source type
template <typename _SourceType>
static delegate_generic_function make_generic(_SourceType funcptr)
template <typename SourceType>
static delegate_generic_function make_generic(SourceType funcptr)
{
return reinterpret_cast<delegate_generic_function>(funcptr);
}
@ -263,7 +265,7 @@ private:
struct raw_mfp_data
{
#if defined (__INTEL_COMPILER) && defined (_M_X64) // needed for "Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.2.176 Build 20140130" at least
#if defined(__INTEL_COMPILER) && defined(_M_X64) // needed for "Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.2.176 Build 20140130" at least
int data[((sizeof(void *) + 4 * sizeof(int)) + (sizeof(int) - 1)) / sizeof(int)];
#else // all other cases - for MSVC maximum size is one pointer, plus 3 ints; all other implementations seem to be smaller
int data[((sizeof(void *) + 3 * sizeof(int)) + (sizeof(int) - 1)) / sizeof(int)];
@ -288,20 +290,22 @@ class delegate_mfp
public:
// default constructor
delegate_mfp()
: m_function(0),
m_this_delta(0) { }
: m_function(0)
, m_this_delta(0)
{ }
// copy constructor
delegate_mfp(const delegate_mfp &src)
: m_function(src.m_function),
m_this_delta(src.m_this_delta) { }
: m_function(src.m_function)
, m_this_delta(src.m_this_delta)
{ }
// construct from any member function pointer
template<typename _MemberFunctionType, class _MemberFunctionClass, typename _ReturnType, typename _StaticFunctionType>
delegate_mfp(_MemberFunctionType mfp, _MemberFunctionClass *, _ReturnType *, _StaticFunctionType)
template <typename MemberFunctionType, class MemberFunctionClass, typename ReturnType, typename StaticFunctionType>
delegate_mfp(MemberFunctionType mfp, MemberFunctionClass *, ReturnType *, StaticFunctionType)
{
assert(sizeof(mfp) == sizeof(*this));
*reinterpret_cast<_MemberFunctionType *>(this) = mfp;
*reinterpret_cast<MemberFunctionType *>(this) = mfp;
}
// comparison helpers
@ -312,10 +316,10 @@ public:
static delegate_generic_class *real_object(delegate_generic_class *original) { return original; }
// binding helper
template<typename _FunctionType>
void update_after_bind(_FunctionType &funcptr, delegate_generic_class *&object)
template <typename FunctionType>
void update_after_bind(FunctionType &funcptr, delegate_generic_class *&object)
{
funcptr = reinterpret_cast<_FunctionType>(convert_to_generic(object));
funcptr = reinterpret_cast<FunctionType>(convert_to_generic(object));
}
private:
@ -351,12 +355,12 @@ public:
}
// construct from any member function pointer
template<typename _MemberFunctionType, class _MemberFunctionClass, typename _ReturnType, typename _StaticFunctionType>
delegate_mfp(_MemberFunctionType mfp, _MemberFunctionClass *, _ReturnType *, _StaticFunctionType)
template <typename MemberFunctionType, class MemberFunctionClass, typename ReturnType, typename StaticFunctionType>
delegate_mfp(MemberFunctionType mfp, MemberFunctionClass *, ReturnType *, StaticFunctionType)
{
//assert(sizeof(mfp) == 12 || sizeof(mfp) == 16);
m_size = sizeof(mfp);
*reinterpret_cast<_MemberFunctionType *>(this) = mfp;
*reinterpret_cast<MemberFunctionType *>(this) = mfp;
}
// comparison helpers
@ -367,10 +371,10 @@ public:
static delegate_generic_class *real_object(delegate_generic_class *original) { return original; }
// binding helper
template<typename _FunctionType>
void update_after_bind(_FunctionType &funcptr, delegate_generic_class *&object)
template <typename FunctionType>
void update_after_bind(FunctionType &funcptr, delegate_generic_class *&object)
{
funcptr = reinterpret_cast<_FunctionType>(m_function);
funcptr = reinterpret_cast<FunctionType>(m_function);
if (m_size == SINGLE_MEMFUNCPTR_SIZE + sizeof(int))
object = reinterpret_cast<delegate_generic_class *>(reinterpret_cast<std::uint8_t *>(object) + m_this_delta);
}
@ -402,112 +406,94 @@ private:
// ======================> delegate_base
// general delegate class template supporting up to 5 parameters
template<typename _ReturnType, typename... Params>
template <typename ReturnType, typename... Params>
class delegate_base
{
public:
// define our traits
template<class _FunctionClass>
struct traits
{
using member_func_type = typename delegate_traits<_FunctionClass, _ReturnType, Params...>::member_func_type;
using const_member_func_type = typename delegate_traits<_FunctionClass, _ReturnType, Params...>::const_member_func_type;
using static_func_type = typename delegate_traits<_FunctionClass, _ReturnType, Params...>::static_func_type;
using static_ref_func_type = typename delegate_traits<_FunctionClass, _ReturnType, Params...>::static_ref_func_type;
};
using functional_type = std::function<_ReturnType(Params...)>;
template <class FunctionClass> using traits = delegate_traits<FunctionClass, ReturnType, Params...>;
using functional_type = std::function<ReturnType (Params...)>;
using generic_static_func = typename traits<delegate_generic_class>::static_func_type;
typedef MEMBER_ABI generic_static_func generic_member_func;
// generic constructor
delegate_base()
: m_function(nullptr),
m_object(nullptr),
m_latebinder(nullptr),
m_raw_function(nullptr),
m_std_func(nullptr){ }
: m_function(nullptr)
, m_object(nullptr)
, m_latebinder(nullptr)
, m_raw_function(nullptr)
, m_std_func(nullptr)
{ }
// copy constructor
delegate_base(const delegate_base &src)
: m_function(src.m_function),
m_object(nullptr),
m_latebinder(src.m_latebinder),
m_raw_function(src.m_raw_function),
m_raw_mfp(src.m_raw_mfp),
m_std_func(src.m_std_func)
: m_function(src.m_function)
, m_object(nullptr)
, m_latebinder(src.m_latebinder)
, m_raw_function(src.m_raw_function)
, m_raw_mfp(src.m_raw_mfp)
, m_std_func(src.m_std_func)
{
bind(src.object());
}
// copy constructor with late bind
delegate_base(const delegate_base &src, delegate_late_bind &object)
: m_function(src.m_function),
m_object(nullptr),
m_latebinder(src.m_latebinder),
m_raw_function(src.m_raw_function),
m_raw_mfp(src.m_raw_mfp),
m_std_func(src.m_std_func)
: m_function(src.m_function)
, m_object(nullptr)
, m_latebinder(src.m_latebinder)
, m_raw_function(src.m_raw_function)
, m_raw_mfp(src.m_raw_mfp)
, m_std_func(src.m_std_func)
{
late_bind(object);
}
// construct from member function with object pointer
template<class _FunctionClass>
delegate_base(typename traits<_FunctionClass>::member_func_type funcptr, _FunctionClass *object)
: m_function(nullptr),
m_object(nullptr),
m_latebinder(&late_bind_helper<_FunctionClass>),
m_raw_function(nullptr),
m_raw_mfp(funcptr, object, static_cast<_ReturnType *>(nullptr), static_cast<generic_static_func>(nullptr)),
m_std_func(nullptr)
template <class FunctionClass>
delegate_base(typename traits<FunctionClass>::member_func_type funcptr, FunctionClass *object)
: m_function(nullptr)
, m_object(nullptr)
, m_latebinder(&late_bind_helper<FunctionClass>)
, m_raw_function(nullptr)
, m_raw_mfp(funcptr, object, static_cast<ReturnType *>(nullptr), static_cast<generic_static_func>(nullptr))
, m_std_func(nullptr)
{
bind(reinterpret_cast<delegate_generic_class *>(object));
}
template<class _FunctionClass>
delegate_base(typename traits<_FunctionClass>::const_member_func_type funcptr, _FunctionClass *object)
: m_function(nullptr),
m_object(nullptr),
m_latebinder(&late_bind_helper<_FunctionClass>),
m_raw_function(nullptr),
m_raw_mfp(funcptr, object, static_cast<_ReturnType *>(nullptr), static_cast<generic_static_func>(nullptr)),
m_std_func(nullptr)
{
bind(reinterpret_cast<delegate_generic_class *>(object));
}
// construct from static function with object pointer
template<class _FunctionClass>
delegate_base(typename traits<_FunctionClass>::static_func_type funcptr, _FunctionClass *object)
: m_function(reinterpret_cast<generic_static_func>(funcptr)),
m_object(nullptr),
m_latebinder(&late_bind_helper<_FunctionClass>),
m_raw_function(reinterpret_cast<generic_static_func>(funcptr)),
m_std_func(nullptr)
template <class FunctionClass>
delegate_base(typename traits<FunctionClass>::const_member_func_type funcptr, FunctionClass *object)
: m_function(nullptr)
, m_object(nullptr)
, m_latebinder(&late_bind_helper<FunctionClass>)
, m_raw_function(nullptr)
, m_raw_mfp(funcptr, object, static_cast<ReturnType *>(nullptr), static_cast<generic_static_func>(nullptr))
, m_std_func(nullptr)
{
bind(reinterpret_cast<delegate_generic_class *>(object));
}
// construct from static reference function with object reference
template<class _FunctionClass>
delegate_base(typename traits<_FunctionClass>::static_ref_func_type funcptr, _FunctionClass *object)
: m_function(reinterpret_cast<generic_static_func>(funcptr)),
m_object(nullptr),
m_latebinder(&late_bind_helper<_FunctionClass>),
m_raw_function(reinterpret_cast<generic_static_func>(funcptr)),
m_std_func(nullptr)
template <class FunctionClass>
delegate_base(typename traits<FunctionClass>::static_ref_func_type funcptr, FunctionClass *object)
: m_function(reinterpret_cast<generic_static_func>(funcptr))
, m_object(nullptr)
, m_latebinder(&late_bind_helper<FunctionClass>)
, m_raw_function(reinterpret_cast<generic_static_func>(funcptr))
, m_std_func(nullptr)
{
bind(reinterpret_cast<delegate_generic_class *>(object));
}
// construct from static reference function with object reference
delegate_base(functional_type funcptr)
: m_function(nullptr),
m_object(nullptr),
m_latebinder(nullptr),
m_raw_function(nullptr),
m_std_func(funcptr)
: m_function(nullptr)
, m_object(nullptr)
, m_latebinder(nullptr)
, m_raw_function(nullptr)
, m_std_func(funcptr)
{
}
// copy operator
@ -535,7 +521,8 @@ public:
// call the function
_ReturnType operator()(Params... args) const {
ReturnType operator()(Params... args) const
{
if (is_mfp() && (HAS_DIFFERENT_ABI))
return (*reinterpret_cast<generic_member_func>(m_function)) (m_object, std::forward<Params>(args)...);
else if (m_std_func)
@ -562,13 +549,13 @@ protected:
using late_bind_func = delegate_generic_class*(*)(delegate_late_bind &object);
// late binding helper
template<class _FunctionClass>
template <class FunctionClass>
static delegate_generic_class *late_bind_helper(delegate_late_bind &object)
{
_FunctionClass *result = dynamic_cast<_FunctionClass *>(&object);
if (result == nullptr) {
throw binding_type_exception(typeid(_FunctionClass), typeid(object));
}
FunctionClass *result = dynamic_cast<FunctionClass *>(&object);
if (!result)
throw binding_type_exception(typeid(FunctionClass), typeid(object));
return reinterpret_cast<delegate_generic_class *>(result);
}
@ -601,21 +588,20 @@ protected:
template <typename Signature>
class delegate;
template<typename _ReturnType, typename... Params>
class delegate<_ReturnType (Params...)> : public delegate_base<_ReturnType, Params...>
template <typename ReturnType, typename... Params>
class delegate<ReturnType (Params...)> : public delegate_base<ReturnType, Params...>
{
using basetype = delegate_base<_ReturnType, Params...>;
using basetype = delegate_base<ReturnType, Params...>;
public:
// create a standard set of constructors
delegate() : basetype() { }
explicit delegate(const basetype &src) : basetype(src) { }
delegate(const basetype &src, delegate_late_bind &object) : basetype(src, object) { }
template<class _FunctionClass> delegate(typename basetype::template traits<_FunctionClass>::member_func_type funcptr, _FunctionClass *object) : basetype(funcptr, object) { }
template<class _FunctionClass> delegate(typename basetype::template traits<_FunctionClass>::const_member_func_type funcptr, _FunctionClass *object) : basetype(funcptr, object) { }
explicit delegate(std::function<_ReturnType(Params...)> funcptr) : basetype(funcptr) { }
template<class _FunctionClass> delegate(typename basetype::template traits<_FunctionClass>::static_func_type funcptr, _FunctionClass *object) : basetype(funcptr, object) { }
template<class _FunctionClass> delegate(typename basetype::template traits<_FunctionClass>::static_ref_func_type funcptr,_FunctionClass *object) : basetype(funcptr, object) { }
template <class FunctionClass> delegate(typename basetype::template traits<FunctionClass>::member_func_type funcptr, FunctionClass *object) : basetype(funcptr, object) { }
template <class FunctionClass> delegate(typename basetype::template traits<FunctionClass>::const_member_func_type funcptr, FunctionClass *object) : basetype(funcptr, object) { }
explicit delegate(std::function<ReturnType (Params...)> funcptr) : basetype(funcptr) { }
template <class FunctionClass> delegate(typename basetype::template traits<FunctionClass>::static_ref_func_type funcptr, FunctionClass *object) : basetype(funcptr, object) { }
delegate &operator=(const basetype &src) { *static_cast<basetype *>(this) = src; return *this; }
};

View File

@ -578,9 +578,7 @@ MACHINE_CONFIG_START(_1942_state::_1942)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_1942)
MCFG_PALETTE_ADD(m_palette, 64*4+4*32*8+16*16)
MCFG_PALETTE_INDIRECT_ENTRIES(256)
MCFG_PALETTE_INIT_OWNER(_1942_state, 1942)
PALETTE(config, m_palette, FUNC(_1942_state::_1942_palette), 64*4+4*32*8+16*16, 256);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
@ -634,7 +632,7 @@ MACHINE_CONFIG_START(_1942p_state::_1942p)
/* basic machine hardware */
MCFG_DEVICE_ADD("maincpu", Z80, MAIN_CPU_CLOCK_1942P) /* 4 MHz - verified on PCB */
MCFG_DEVICE_PROGRAM_MAP(_1942p_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", _1942p_state, irq0_line_hold) // note, powerups won't move down the screen with the original '1942' logic.
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", _1942p_state, irq0_line_hold) // note, powerups won't move down the screen with the original '1942' logic.
MCFG_DEVICE_ADD("audiocpu", Z80, SOUND_CPU_CLOCK_1942P) /* 4 MHz - verified on PCB */
MCFG_DEVICE_PROGRAM_MAP(_1942p_sound_map)
@ -645,9 +643,7 @@ MACHINE_CONFIG_START(_1942p_state::_1942p)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_1942p)
MCFG_PALETTE_ADD(m_palette, 0x500)
MCFG_PALETTE_INDIRECT_ENTRIES(0x400)
MCFG_PALETTE_INIT_OWNER(_1942p_state, 1942p)
PALETTE(config, m_palette, FUNC(_1942p_state::_1942p_palette), 0x500, 0x400);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);

View File

@ -331,12 +331,10 @@ MACHINE_CONFIG_START(_1943_state::_1943)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(_1943_state, screen_update_1943)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_1943)
MCFG_PALETTE_ADD("palette", 32*4+16*16+16*16+16*16)
MCFG_PALETTE_INDIRECT_ENTRIES(256)
MCFG_PALETTE_INIT_OWNER(_1943_state, 1943)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_1943)
PALETTE(config, m_palette, FUNC(_1943_state::_1943_palette), 32*4+16*16+16*16+16*16, 256);
// sound hardware
SPEAKER(config, "mono").front_center();

View File

@ -380,7 +380,7 @@ void k3_state::flagrall(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &k3_state::flagrall_map);
m_maincpu->set_vblank_int("screen", FUNC(k3_state::irq4_line_hold));
GFXDECODE(config, m_gfxdecode, "palette", gfx_1945kiii);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_1945kiii);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);
@ -388,9 +388,9 @@ void k3_state::flagrall(machine_config &config)
m_screen->set_size(64*8, 32*8);
m_screen->set_visarea(0*8, 40*8-1, 0*8, 30*8-1);
m_screen->set_screen_update(FUNC(k3_state::screen_update));
m_screen->set_palette("palette");
m_screen->set_palette(m_palette);
PALETTE(config, m_palette, 0x200).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x200);
SPEAKER(config, "mono").front_center();

View File

@ -364,7 +364,7 @@ MACHINE_CONFIG_START(_2mindril_state::drill)
MCFG_DEVICE_PROGRAM_MAP(drill_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", _2mindril_state, drill_vblank_irq)
//MCFG_DEVICE_PERIODIC_INT_DRIVER(_2mindril_state, drill_device_irq, 60)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_2mindril)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_2mindril);
tc0510nio_device &tc0510nio(TC0510NIO(config, "tc0510nio", 0));
tc0510nio.read_0_callback().set_ioport("DSW");
@ -384,8 +384,7 @@ MACHINE_CONFIG_START(_2mindril_state::drill)
MCFG_SCREEN_UPDATE_DRIVER(_2mindril_state, screen_update_f3)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, _2mindril_state, screen_vblank_f3))
MCFG_PALETTE_ADD("palette", 0x2000)
MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x2000);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();

View File

@ -53,14 +53,14 @@ class _3x3puzzle_state : public driver_device
{
public:
_3x3puzzle_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_videoram1(*this, "videoram1"),
m_videoram2(*this, "videoram2"),
m_videoram3(*this, "videoram3"),
m_maincpu(*this, "maincpu"),
m_oki(*this, "oki"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen")
: driver_device(mconfig, type, tag)
, m_videoram1(*this, "videoram1")
, m_videoram2(*this, "videoram2")
, m_videoram3(*this, "videoram3")
, m_maincpu(*this, "maincpu")
, m_oki(*this, "oki")
, m_gfxdecode(*this, "gfxdecode")
, m_screen(*this, "screen")
{ }
void _3x3puzzle(machine_config &config);
@ -403,10 +403,9 @@ MACHINE_CONFIG_START(_3x3puzzle_state::_3x3puzzle)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_3x3puzzle)
GFXDECODE(config, m_gfxdecode, "palette", gfx_3x3puzzle);
MCFG_PALETTE_ADD("palette", 0x600/2)
MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
PALETTE(config, "palette").set_format(palette_device::xBGR_555, 0x600 / 2);
/* sound hardware */
SPEAKER(config, "mono").front_center();

View File

@ -702,9 +702,7 @@ void fortyl_state::common(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_40love);
PALETTE(config, m_palette, 1024);
m_palette->set_prom_region("proms");
m_palette->set_init("palette", FUNC(palette_device::palette_init_RRRRGGGGBBBB_proms));
PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 1024);
/* sound hardware */
SPEAKER(config, "speaker").front_center();

View File

@ -485,11 +485,11 @@ MACHINE_CONFIG_START(_4enraya_state::_4enraya )
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(_4enraya_state, screen_update_4enraya)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_4enraya)
MCFG_PALETTE_ADD_3BIT_RGB("palette")
PALETTE(config, m_palette, palette_device::RGB_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();

View File

@ -296,8 +296,8 @@ void rugby_state::rugby_map(address_map &map)
map(0x0e00, 0x0e00).w("crtc", FUNC(mc6845_device::address_w));
map(0x0e01, 0x0e01).rw("crtc", FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w));
map(0x2000, 0xffff).rom().region("maincpu", 0x2000);
map(0x6000, 0x6fff).ram().w(FUNC(_4roses_state::funworld_videoram_w)).share("videoram");
map(0x7000, 0x7fff).ram().w(FUNC(_4roses_state::funworld_colorram_w)).share("colorram");
map(0x6000, 0x6fff).ram().w(FUNC(rugby_state::funworld_videoram_w)).share("videoram");
map(0x7000, 0x7fff).ram().w(FUNC(rugby_state::funworld_colorram_w)).share("colorram");
}
READ8_MEMBER(rugby_state::rugby_opcode_r)
@ -474,9 +474,7 @@ MACHINE_CONFIG_START(_4roses_state::_4roses)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_4roses)
MCFG_PALETTE_ADD("palette", 0x1000)
MCFG_PALETTE_INIT_OWNER(_4roses_state,funworld)
MCFG_VIDEO_START_OVERRIDE(_4roses_state,funworld)
PALETTE(config, "palette", FUNC(_4roses_state::funworld_palette), 0x1000);
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK/8)); /* 2MHz, guess */
crtc.set_screen("screen");

View File

@ -459,8 +459,8 @@
class _5clown_state : public driver_device
{
public:
_5clown_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
_5clown_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_ay8910(*this, "ay8910"),
@ -475,6 +475,10 @@ public:
void init_fclown();
protected:
virtual void machine_start() override;
virtual void video_start() override;
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
@ -507,9 +511,7 @@ private:
DECLARE_READ8_MEMBER(pia1_b_r);
DECLARE_WRITE8_MEMBER(fclown_ay8910_w);
TILE_GET_INFO_MEMBER(get_fclown_tile_info);
virtual void machine_start() override;
virtual void video_start() override;
DECLARE_PALETTE_INIT(_5clown);
void _5clown_palette(palette_device &palette) const;
uint32_t screen_update_fclown(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void fcaudio_map(address_map &map);
@ -578,42 +580,36 @@ uint32_t _5clown_state::screen_update_fclown(screen_device &screen, bitmap_ind16
return 0;
}
PALETTE_INIT_MEMBER(_5clown_state, _5clown)
void _5clown_state::_5clown_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
/*
7654 3210
---- ---x RED component.
---- --x- GREEN component.
---- -x-- BLUE component.
---- x--- background killer.
xxxx ---- unused.
*/
int i;
/*
7654 3210
---- ---x RED component.
---- --x- GREEN component.
---- -x-- BLUE component.
---- x--- background killer.
xxxx ---- unused.
*/
/* 0000KBGR */
if (color_prom == nullptr) return;
uint8_t const *const color_prom = memregion("proms")->base();
if (!color_prom)
return;
for (i = 0;i < m_palette->entries();i++)
for (int i = 0; i < m_palette->entries(); i++)
{
int bit0, bit1, bit2, bit3, r, g, b, bk;
// background killer
int const bk = BIT(color_prom[i], 3);
/* background killer */
bit3 = (color_prom[i] >> 3) & 0x01;
bk = bit3;
// red component
int const r = BIT(color_prom[i], 0) * 0xff;
/* red component */
bit0 = (color_prom[i] >> 0) & 0x01;
r = (bit0 * 0xff);
// green component
int const g = BIT(color_prom[i], 1) * 0xff;
/* green component */
bit1 = (color_prom[i] >> 1) & 0x01;
g = (bit1 * 0xff);
/* blue component */
bit2 = (color_prom[i] >> 2) & 0x01;
b = bk * (bit2 * 0xff);
// blue component
int const b = bk * BIT(color_prom[i], 2) * 0xff;
m_palette->set_pen_color(i, rgb_t(r, g, b));
}
@ -1053,11 +1049,10 @@ MACHINE_CONFIG_START(_5clown_state::fclown)
MCFG_SCREEN_SIZE((39+1)*8, (31+1)*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(_5clown_state, screen_update_fclown)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fclown)
MCFG_PALETTE_ADD("palette", 256)
MCFG_PALETTE_INIT_OWNER(_5clown_state, _5clown)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_fclown);
PALETTE(config, m_palette, FUNC(_5clown_state::_5clown_palette), 256);
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK/16)); /* guess */
crtc.set_screen("screen");

View File

@ -425,8 +425,7 @@ void _8080bw_state::invadpt2(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_invadpt2));
PALETTE(config, m_palette, 8);
m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
invaders_samples_audio(config);
@ -544,8 +543,7 @@ void _8080bw_state::spcewarla(machine_config &config)
WATCHDOG_TIMER(config, m_watchdog).set_vblank_count("screen", 255);
PALETTE(config, m_palette, 8);
m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
PALETTE(config, m_palette, palette_device::RBG_3BIT);
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_invadpt2));
}
@ -672,8 +670,7 @@ void _8080bw_state::cosmo(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_cosmo));
PALETTE(config, m_palette, 8);
m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
PALETTE(config, m_palette, palette_device::RGB_3BIT);
/* sound hardware */
invaders_samples_audio(config);
@ -838,7 +835,7 @@ void _8080bw_state::spacecom(machine_config &config)
m_screen->set_visarea(0*8, 32*8-1, 0*8, 28*8-1);
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_spacecom));
PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
invaders_audio(config);
@ -952,8 +949,7 @@ void _8080bw_state::invrvnge(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_invadpt2));
PALETTE(config, m_palette, 8);
m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@ -1127,8 +1123,7 @@ void _8080bw_state::lrescue(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_invadpt2));
PALETTE(config, m_palette, 8);
m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@ -1161,7 +1156,7 @@ void _8080bw_state::escmars(machine_config &config)
m_screen->set_raw(MW8080BW_PIXEL_CLOCK, MW8080BW_HTOTAL, MW8080BW_HBEND, MW8080BW_HPIXCOUNT, MW8080BW_VTOTAL, MW8080BW_VBEND, MW8080BW_VBSTART);
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_mw8080bw));
PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@ -1407,8 +1402,7 @@ void _8080bw_state::rollingc(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_rollingc));
PALETTE(config, m_palette, 16);
m_palette->set_init(FUNC(_8080bw_state::palette_init_rollingc));
PALETTE(config, m_palette, FUNC(_8080bw_state::rollingc_palette), 16);
/* sound hardware */
invaders_samples_audio(config);
@ -1556,8 +1550,7 @@ void _8080bw_state::schaser(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_schaser));
PALETTE(config, m_palette, 8);
m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@ -1686,8 +1679,7 @@ void _8080bw_state::schasercv(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_schasercv));
PALETTE(config, m_palette, 8);
m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
invaders_samples_audio(config);
@ -1787,8 +1779,7 @@ void _8080bw_state::sflush(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_sflush));
PALETTE(config, m_palette, 8);
m_palette->set_init(FUNC(_8080bw_state::palette_init_sflush));
PALETTE(config, m_palette, FUNC(_8080bw_state::sflush_palette), 8);
}
@ -1892,8 +1883,7 @@ void _8080bw_state::lupin3(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_indianbt));
PALETTE(config, m_palette, 8);
m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
PALETTE(config, m_palette, palette_device::RGB_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@ -1933,8 +1923,7 @@ void _8080bw_state::lupin3a(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_lupin3));
PALETTE(config.replace(), m_palette, 8);
m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
PALETTE(config.replace(), m_palette, palette_device::RBG_3BIT);
}
@ -2065,8 +2054,7 @@ void _8080bw_state::polaris(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_polaris));
PALETTE(config, m_palette, 8);
m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@ -2192,8 +2180,7 @@ void _8080bw_state::ballbomb(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_ballbomb));
PALETTE(config, m_palette, 8);
m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
invaders_samples_audio(config);
@ -2441,8 +2428,7 @@ void _8080bw_state::indianbt(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_indianbt));
PALETTE(config, m_palette, 8);
m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
PALETTE(config, m_palette, palette_device::RGB_3BIT);
/* sound hardware */
invaders_samples_audio(config);
@ -2468,8 +2454,7 @@ void _8080bw_state::indianbtbr(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_indianbt));
PALETTE(config, m_palette, 8);
m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
PALETTE(config, m_palette, palette_device::RGB_3BIT);
/* sound hardware */
invaders_samples_audio(config);
@ -2544,8 +2529,7 @@ void _8080bw_state::steelwkr(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_invadpt2));
PALETTE(config, m_palette, 8);
m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
invaders_samples_audio(config);
@ -2769,7 +2753,7 @@ void _8080bw_state::shuttlei(machine_config &config)
m_screen->set_visarea(0*8, 32*8-1, 0*8, 24*8-1);
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_shuttlei));
PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
invaders_samples_audio(config);

View File

@ -325,9 +325,7 @@ void _88games_state::_88games(machine_config &config)
screen.set_palette("palette");
screen.screen_vblank().set(FUNC(_88games_state::vblank_irq));
palette_device &palette(PALETTE(config, "palette", 2048));
palette.enable_shadows();
palette.set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
PALETTE(config, "palette").set_format(palette_device::xBGR_555, 2048).enable_shadows();
K052109(config, m_k052109, 0);
m_k052109->set_palette("palette");

View File

@ -61,6 +61,10 @@ public:
void a5105(machine_config &config);
protected:
virtual void machine_reset() override;
virtual void video_start() override;
private:
DECLARE_READ8_MEMBER(a5105_memsel_r);
DECLARE_READ8_MEMBER(key_r);
@ -71,7 +75,7 @@ private:
DECLARE_WRITE8_MEMBER( a5105_upd765_w );
DECLARE_WRITE8_MEMBER(pcg_addr_w);
DECLARE_WRITE8_MEMBER(pcg_val_w);
DECLARE_PALETTE_INIT(a5105);
void a5105_palette(palette_device &palette) const;
DECLARE_FLOPPY_FORMATS( floppy_formats );
UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
@ -87,8 +91,6 @@ private:
uint16_t m_pcg_internal_addr;
uint8_t m_key_mux;
uint8_t m_memsel[4];
virtual void machine_reset() override;
virtual void video_start() override;
required_device<z80_device> m_maincpu;
required_device<screen_device> m_screen;
required_device<upd7220_device> m_hgdc;
@ -108,16 +110,13 @@ private:
/* TODO */
UPD7220_DISPLAY_PIXELS_MEMBER( a5105_state::hgdc_display_pixels )
{
const rgb_t *palette = m_palette->palette()->entry_list_raw();
rgb_t const *const palette = m_palette->palette()->entry_list_raw();
int xi,gfx;
uint8_t pen;
int const gfx = m_video_ram[(address & 0x1ffff) >> 1];
gfx = m_video_ram[(address & 0x1ffff) >> 1];
for(xi=0;xi<16;xi++)
for (int xi = 0; xi < 16; xi++)
{
pen = ((gfx >> xi) & 1) ? 7 : 0;
int const pen = ((gfx >> xi) & 1) ? 7 : 0;
bitmap.pix32(y, x + xi) = palette[pen];
}
@ -125,38 +124,32 @@ UPD7220_DISPLAY_PIXELS_MEMBER( a5105_state::hgdc_display_pixels )
UPD7220_DRAW_TEXT_LINE_MEMBER( a5105_state::hgdc_draw_text )
{
const rgb_t *palette = m_palette->palette()->entry_list_raw();
int x;
int xi,yi;
int tile,color;
uint8_t tile_data;
rgb_t const *const palette = m_palette->palette()->entry_list_raw();
for( x = 0; x < pitch; x++ )
for (int x = 0; x < pitch; x++)
{
tile = (m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] & 0xff);
color = ((m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] >> 8) & 0x0f);
int const tile = (m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] & 0xff);
int const color = ((m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] >> 8) & 0x0f);
for( yi = 0; yi < lr; yi++)
for (int yi = 0; yi < lr; yi++)
{
tile_data = m_char_ram[(tile*8+yi) & 0x7ff];
uint8_t tile_data = m_char_ram[(tile*8+yi) & 0x7ff];
if(cursor_on && cursor_addr == addr+x && m_screen->frame_number() & 0x10)
tile_data^=0xff;
if (cursor_on && cursor_addr == addr+x && m_screen->frame_number() & 0x10)
tile_data ^= 0xff;
for( xi = 0; xi < 8; xi++)
for (int xi = 0; xi < 8; xi++)
{
int res_x,res_y;
int pen = (tile_data >> xi) & 1 ? color : 0;
res_x = x * 8 + xi;
res_y = y + yi;
int const res_x = x * 8 + xi;
int const res_y = y + yi;
if(yi >= 8) { pen = 0; }
if (yi >= 8)
pen = 0;
if(!m_screen->visible_area().contains(res_x+0, res_y))
continue;
bitmap.pix32(res_y, res_x) = palette[pen];
if (m_screen->visible_area().contains(res_x+0, res_y))
bitmap.pix32(res_y, res_x) = palette[pen];
}
}
}
@ -526,18 +519,16 @@ static GFXDECODE_START( gfx_a5105 )
GFXDECODE_END
PALETTE_INIT_MEMBER(a5105_state, a5105)
void a5105_state::a5105_palette(palette_device &palette) const
{
int i;
int r,g,b;
for ( i = 0; i < 16; i++ )
for (int i = 0; i < 16; i++)
{
r = i & 4 ? ((i & 8) ? 0xaa : 0xff) : 0x00;
g = i & 2 ? ((i & 8) ? 0xaa : 0xff) : 0x00;
b = i & 1 ? ((i & 8) ? 0xaa : 0xff) : 0x00;
int const x = (i & 8) ? 0xaa : 0xff;
int const r = (i & 4) ? x : 0x00;
int const g = (i & 2) ? x : 0x00;
int const b = (i & 1) ? x : 0x00;
palette.set_pen_color(i, rgb_t(r,g,b));
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@ -583,9 +574,8 @@ MACHINE_CONFIG_START(a5105_state::a5105)
MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update)
MCFG_SCREEN_SIZE(40*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 25*8-1)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_a5105)
MCFG_PALETTE_ADD("palette", 16)
MCFG_PALETTE_INIT_OWNER(a5105_state, a5105)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_a5105);
PALETTE(config, m_palette, FUNC(a5105_state::a5105_palette), 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();

View File

@ -144,8 +144,7 @@ MACHINE_CONFIG_START(a51xx_state::a5120)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_a51xx)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(a51xx_state::a5130)

View File

@ -562,7 +562,7 @@ void a7150_state::a7150(machine_config &config)
screen.set_screen_update(FUNC(a7150_state::screen_update_k7072));
screen.set_palette(m_palette);
PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
PALETTE(config, m_palette, palette_device::MONOCHROME);
}
/* ROM definition */

View File

@ -136,7 +136,7 @@ protected:
DECLARE_READ8_MEMBER(bios_or_cart_r);
DECLARE_READ8_MEMBER(tia_r);
DECLARE_WRITE8_MEMBER(tia_w);
DECLARE_PALETTE_INIT(a7800);
void a7800_palette(palette_device &palette) const;
TIMER_DEVICE_CALLBACK_MEMBER(interrupt);
TIMER_CALLBACK_MEMBER(maria_startdma);
DECLARE_READ8_MEMBER(riot_joystick_r);
@ -183,7 +183,7 @@ public:
void a7800_pal(machine_config &config);
protected:
DECLARE_PALETTE_INIT(a7800p);
void a7800p_palette(palette_device &palette) const;
};
@ -553,7 +553,7 @@ upon display type.
rgb_t(0xA1,0x8F,0x1A), rgb_t(0xB2,0xA0,0x2B), rgb_t(0xC3,0xB1,0x3C), rgb_t(0xD4,0xC2,0x4D), \
rgb_t(0xE5,0xD3,0x5E), rgb_t(0xF6,0xE4,0x6F), rgb_t(0xFF,0xF5,0x82), rgb_t(0xFF,0xFF,0x96 )
static const rgb_t a7800_palette[256] =
static constexpr rgb_t a7800_colors[256] =
{
NTSC_GREY,
NTSC_GOLD,
@ -573,7 +573,7 @@ static const rgb_t a7800_palette[256] =
NTSC_LIGHT_ORANGE
};
static const rgb_t a7800p_palette[256] =
static constexpr rgb_t a7800p_colors[256] =
{
NTSC_GREY,
NTSC_ORANGE_GREEN,
@ -1307,15 +1307,15 @@ define NTSC_LIGHT_ORANGE
***************************************************************************/
/* Initialise the palette */
PALETTE_INIT_MEMBER(a7800_state, a7800)
void a7800_state::a7800_palette(palette_device &palette) const
{
palette.set_pen_colors(0, a7800_palette, ARRAY_LENGTH(a7800_palette));
palette.set_pen_colors(0, a7800_colors);
}
PALETTE_INIT_MEMBER(a7800_pal_state,a7800p)
void a7800_pal_state::a7800p_palette(palette_device &palette) const
{
palette.set_pen_colors(0, a7800p_palette, ARRAY_LENGTH(a7800p_palette));
palette.set_pen_colors(0, a7800p_colors);
}
@ -1388,7 +1388,7 @@ void a7800_state::a7800_ntsc(machine_config &config)
m_screen->set_screen_update("maria", FUNC(atari_maria_device::screen_update));
m_screen->set_palette("palette");
PALETTE(config, "palette", ARRAY_LENGTH(a7800_palette)).set_init(FUNC(a7800_state::palette_init_a7800));
PALETTE(config, "palette", FUNC(a7800_state::a7800_palette), ARRAY_LENGTH(a7800_colors));
ATARI_MARIA(config, m_maria, 0);
m_maria->set_dmacpu_tag(m_maincpu);
@ -1420,7 +1420,7 @@ void a7800_pal_state::a7800_pal(machine_config &config)
m_screen->set_raw(7093788, 454, 0, 320, 313, 35, 35 + 228 + 32);
subdevice<palette_device>("palette")->set_init(FUNC(a7800_pal_state::palette_init_a7800p));
subdevice<palette_device>("palette")->set_init(FUNC(a7800_pal_state::a7800p_palette));
/* devices */
subdevice<mos6532_new_device>("riot")->set_clock(CLK_PAL);

View File

@ -423,7 +423,7 @@ void aa310_state::aa310(machine_config &config)
m_screen->set_raw(16_MHz_XTAL, 1024, 0, 735, 624/2, 0, 292); // RiscOS 3 default screen settings
m_screen->set_screen_update(FUNC(archimedes_state::screen_update));
PALETTE(config, m_palette, 32768);
PALETTE(config, m_palette).set_entries(32768);
RAM(config, m_ram).set_default_size("1M");

View File

@ -148,11 +148,11 @@ MACHINE_CONFIG_START(ac1_state::ac1)
MCFG_SCREEN_SIZE(64*6, 16*8)
MCFG_SCREEN_VISIBLE_AREA(0, 64*6-1, 0, 16*8-1)
MCFG_SCREEN_UPDATE_DRIVER(ac1_state, screen_update_ac1)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ac1 )
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, m_palette, palette_device::MONOCHROME);
SPEAKER(config, "mono").front_center();
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25);

View File

@ -71,7 +71,7 @@ private:
DECLARE_READ8_MEMBER(sheila_r);
DECLARE_WRITE8_MEMBER(sheila_w);
DECLARE_PALETTE_INIT(accomm);
void accomm_palette(palette_device &palette) const;
INTERRUPT_GEN_MEMBER(vbl_int);
virtual void machine_reset() override;
@ -145,9 +145,9 @@ static const rgb_t electron_palette[8]=
rgb_t(0x000,0x000,0x000)
};
PALETTE_INIT_MEMBER(accomm_state, accomm)
void accomm_state::accomm_palette(palette_device &palette) const
{
palette.set_pen_colors(0, electron_palette, ARRAY_LENGTH(electron_palette));
palette.set_pen_colors(0, electron_palette);
}
READ8_MEMBER(accomm_state::read_keyboard1)
@ -830,8 +830,7 @@ void accomm_state::accomm(machine_config &config)
screen.set_video_attributes(VIDEO_UPDATE_SCANLINE);
screen.set_palette("palette");
palette_device &palette(PALETTE(config, "palette", 16));
palette.set_init(palette_init_delegate(FUNC(accomm_state::palette_init_accomm), this));
PALETTE(config, "palette", FUNC(accomm_state::accomm_palette), 16);
config.set_default_layout(layout_accomm);

View File

@ -335,10 +335,10 @@ MACHINE_CONFIG_START(aceal_state::ace)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(4*8, 32*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aceal_state, screen_update_ace)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ace)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
/* ???? */

View File

@ -47,23 +47,24 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(starspnr_coinage_r);
DECLARE_CUSTOM_INPUT_MEMBER(starspnr_payout_r);
private:
protected:
enum
{
TIMER_ACEFRUIT_REFRESH
};
virtual void machine_start() override;
virtual void video_start() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
DECLARE_WRITE8_MEMBER(acefruit_colorram_w);
DECLARE_WRITE8_MEMBER(acefruit_coin_w);
DECLARE_WRITE8_MEMBER(acefruit_sound_w);
DECLARE_WRITE8_MEMBER(acefruit_lamp_w);
DECLARE_WRITE8_MEMBER(acefruit_solenoid_w);
virtual void machine_start() override;
virtual void video_start() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
DECLARE_PALETTE_INIT(acefruit);
void acefruit_palette(palette_device &palette) const;
uint32_t screen_update_acefruit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(acefruit_vblank);
void acefruit_update_irq(int vpos);
@ -309,7 +310,7 @@ WRITE8_MEMBER(acefruit_state::acefruit_solenoid_w)
m_solenoids[i] = BIT(data, i);
}
PALETTE_INIT_MEMBER(acefruit_state, acefruit)
void acefruit_state::acefruit_palette(palette_device &palette) const
{
/* sprites */
palette.set_pen_color( 0, rgb_t(0x00, 0x00, 0x00) );
@ -635,7 +636,7 @@ MACHINE_CONFIG_START(acefruit_state::acefruit)
WATCHDOG_TIMER(config, "watchdog");
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_acefruit)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_acefruit);
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@ -644,14 +645,12 @@ MACHINE_CONFIG_START(acefruit_state::acefruit)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 255)
MCFG_SCREEN_UPDATE_DRIVER(acefruit_state, screen_update_acefruit)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_PALETTE_ADD("palette", 16)
MCFG_PALETTE_INIT_OWNER(acefruit_state, acefruit)
PALETTE(config, m_palette, FUNC(acefruit_state::acefruit_palette), 16);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
/* sound hardware */
MACHINE_CONFIG_END

View File

@ -72,8 +72,8 @@ JALCF1 BIN 1,048,576 02-07-99 1:11a JALCF1.BIN
class acommand_state : public driver_device
{
public:
acommand_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
acommand_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
m_oki1(*this, "oki1"),
@ -482,11 +482,10 @@ MACHINE_CONFIG_START(acommand_state::acommand)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(acommand_state, screen_update_acommand)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_acommand)
MCFG_PALETTE_ADD("palette", 0x4000)
MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_acommand);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x4000);
MEGASYS1_TILEMAP(config, m_bgtmap, m_palette, 0x0f00);
MEGASYS1_TILEMAP(config, m_txtmap, m_palette, 0x2700);

View File

@ -307,8 +307,7 @@ MACHINE_CONFIG_START(actfancr_state::actfancr)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_actfan)
MCFG_PALETTE_ADD("palette", 768)
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
PALETTE(config, "palette").set_format(palette_device::xBGR_444, 768);
DECO_BAC06(config, m_tilegen[0], 0);
m_tilegen[0]->set_gfx_region_wide(2, 2, 2);
@ -369,8 +368,7 @@ MACHINE_CONFIG_START(actfancr_state::triothep)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_triothep)
MCFG_PALETTE_ADD("palette", 768)
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
PALETTE(config, "palette").set_format(palette_device::xBGR_444, 768);
DECO_BAC06(config, m_tilegen[0], 0);
m_tilegen[0]->set_gfx_region_wide(2, 2, 0);

View File

@ -172,8 +172,8 @@ Quick Jack administration/service mode:
class adp_state : public driver_device
{
public:
adp_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
adp_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_microtouch(*this, "microtouch"),
m_maincpu(*this, "maincpu"),
m_duart(*this, "duart"),
@ -207,8 +207,8 @@ private:
DECLARE_WRITE16_MEMBER(input_w);
DECLARE_MACHINE_START(skattv);
DECLARE_MACHINE_RESET(skattv);
DECLARE_PALETTE_INIT(adp);
DECLARE_PALETTE_INIT(fstation);
void adp_palette(palette_device &device) const;
void fstation_palette(palette_device &device) const;
IRQ_CALLBACK_MEMBER(duart_iack_handler);
//INTERRUPT_GEN_MEMBER(adp_int);
void skattva_nvram_init(nvram_device &nvram, void *base, size_t size);
@ -263,35 +263,19 @@ MACHINE_RESET_MEMBER(adp_state,skattv)
m_mux_data = 0;
}
PALETTE_INIT_MEMBER(adp_state,adp)
void adp_state::adp_palette(palette_device &palette) const
{
int i;
for (i = 0; i < palette.entries(); i++)
for (int i = 0; i < palette.entries(); i++)
{
int bit0, bit1, bit2, r, g, b;
int const r = 0x21 * BIT(i, 0) + 0x47 * BIT(i, 3) + 0x97 * BIT(i, 0);
int const g = 0x21 * BIT(i, 1) + 0x47 * BIT(i, 3) + 0x97 * BIT(i, 1);
int const b = 0x21 * BIT(i, 2) + 0x47 * BIT(i, 3) + 0x97 * BIT(i, 2);
// red component
bit0 = (i >> 0) & 0x01;
bit1 = (i >> 3) & 0x01;
bit2 = (i >> 0) & 0x01;
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// green component
bit0 = (i >> 1) & 0x01;
bit1 = (i >> 3) & 0x01;
bit2 = (i >> 1) & 0x01;
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// blue component
bit0 = (i >> 2) & 0x01;
bit1 = (i >> 3) & 0x01;
bit2 = (i >> 2) & 0x01;
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r,g,b));
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
PALETTE_INIT_MEMBER(adp_state,fstation)
void adp_state::fstation_palette(palette_device &palette) const
{
for (int i = 0; i < palette.entries(); i++)
palette.set_pen_color(i, rgb_t(pal3bit(i>>5), pal3bit(i>>2), pal2bit(i>>0)));
@ -583,11 +567,9 @@ MACHINE_CONFIG_START(adp_state::quickjac)
MCFG_SCREEN_SIZE(384, 280)
MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 280-1)
MCFG_SCREEN_UPDATE_DEVICE("acrtc", hd63484_device, update_screen)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_PALETTE_ADD("palette", 0x10)
MCFG_PALETTE_INIT_OWNER(adp_state,adp)
PALETTE(config, m_palette, FUNC(adp_state::adp_palette), 0x10);
HD63484(config, m_acrtc, 0).set_addrmap(0, &adp_state::adp_hd63484_map);
@ -624,11 +606,11 @@ void adp_state::ramdac_map(address_map &map)
MACHINE_CONFIG_START(adp_state::funland)
quickjac(config);
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(funland_mem)
MCFG_DEVICE_REMOVE("palette")
MCFG_PALETTE_ADD_INIT_BLACK("palette", 0x100)
PALETTE(config.replace(), m_palette, palette_device::BLACK, 0x100);
ramdac_device &ramdac(RAMDAC(config, "ramdac", 0, m_palette));
ramdac.set_addrmap(0, &adp_state::ramdac_map);
@ -638,6 +620,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(adp_state::fstation)
funland(config);
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(fstation_mem)
@ -645,8 +628,7 @@ MACHINE_CONFIG_START(adp_state::fstation)
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
MCFG_PALETTE_MODIFY("palette")
MCFG_PALETTE_INIT_OWNER(adp_state, fstation)
m_palette->set_init(FUNC(adp_state::fstation_palette));
MACHINE_CONFIG_END

View File

@ -87,7 +87,7 @@ void advision_state::advision(machine_config &config)
screen.set_visarea(84, 235, 60, 142);
screen.set_palette(m_palette);
PALETTE(config, m_palette, 8).set_init(FUNC(advision_state::palette_init_advision));
PALETTE(config, m_palette, FUNC(advision_state::advision_palette), 8);
/* sound hardware */
SPEAKER(config, "speaker").front_center();

View File

@ -265,7 +265,7 @@ MACHINE_CONFIG_START(aeroboto_state::formatz)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_aeroboto)
MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();

View File

@ -1483,11 +1483,10 @@ MACHINE_CONFIG_START(aerofgt_state::pspikes)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+4, 44*8+4-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_pspikes)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pspikes)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pspikes);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
VSYSTEM_SPR2(config, m_spr_old[0], 0);
m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_old_tile_callback), this);
@ -1533,11 +1532,10 @@ MACHINE_CONFIG_START(aerofgt_state::spikes91)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 320-1, 0*8+4, 224+4-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_spikes91)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_spikes91)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_spikes91);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
//VSYSTEM_GGA(config, "gga", 0);
@ -1569,11 +1567,10 @@ MACHINE_CONFIG_START(aerofgt_state::pspikesb)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+4, 44*8+4-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_pspikesb)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pspikesb)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pspikesb);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
//VSYSTEM_GGA(config, "gga", 0);
@ -1614,11 +1611,10 @@ MACHINE_CONFIG_START(aerofgt_state::kickball)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+4, 44*8+4-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_pspikes)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kickball)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_kickball);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
VSYSTEM_SPR2(config, m_spr_old[0], 0);
m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_old_tile_callback), this);
@ -1661,11 +1657,10 @@ MACHINE_CONFIG_START(aerofgt_state::pspikesc)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+4, 44*8+4-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_pspikes)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pspikes)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pspikes);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
//VSYSTEM_GGA(config, "gga", 0);
@ -1705,11 +1700,10 @@ MACHINE_CONFIG_START(aerofgt_state::karatblz)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 45*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_karatblz)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turbofrc)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified
@ -1762,11 +1756,10 @@ MACHINE_CONFIG_START(aerofgt_state::karatblzbl)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 45*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_karatblz)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turbofrc)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
VSYSTEM_SPR2(config, m_spr_old[0], 0);
m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_old_tile_callback), this);
@ -1819,11 +1812,10 @@ MACHINE_CONFIG_START(aerofgt_state::spinlbrk)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 45*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_spinlbrk)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turbofrc)
MCFG_PALETTE_ADD_INIT_BLACK("palette", 1024) // doesn't fully initialize palette at start-up ...
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc);
PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xRGB_555, 1024); // doesn't fully initialize palette at start-up ...
VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified
@ -1878,11 +1870,10 @@ MACHINE_CONFIG_START(aerofgt_state::turbofrc)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 44*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_turbofrc)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turbofrc)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified
@ -1937,11 +1928,10 @@ MACHINE_CONFIG_START(aerofgt_state::aerofgtb)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+12, 40*8-1+12, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_turbofrc)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turbofrc)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified
@ -2008,11 +1998,10 @@ MACHINE_CONFIG_START(aerofgt_state::aerofgt)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_aerofgt)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_aerofgt)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_aerofgt);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
VSYSTEM_SPR(config, m_spr, 0);
m_spr->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_tile_callback), this);
@ -2058,11 +2047,10 @@ MACHINE_CONFIG_START(aerofgt_state::aerfboot)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+12, 40*8-1+12, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_aerfboot)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_aerfboot)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_aerfboot);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
//VSYSTEM_GGA(config, "gga", 0);
@ -2097,11 +2085,10 @@ MACHINE_CONFIG_START(aerofgt_state::aerfboo2)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+12, 40*8-1+12, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_aerfboo2)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_aerfboo2)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_aerfboo2);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
//VSYSTEM_GGA(config, "gga", 0);
@ -2135,9 +2122,8 @@ MACHINE_CONFIG_START(aerofgt_state::wbbc97)
MCFG_SCREEN_VISIBLE_AREA(0*8+14, 44*8-1+4, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_wbbc97)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wbbc97)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_wbbc97);
PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
//VSYSTEM_GGA(config, "gga", 0);

View File

@ -593,11 +593,10 @@ MACHINE_CONFIG_START(airbustr_state::airbustr)
MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(airbustr_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, airbustr_state, screen_vblank))
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_airbustr)
MCFG_PALETTE_ADD("palette", 768)
MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_airbustr);
PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 768);
KANEKO_PANDORA(config, m_pandora, 0);
m_pandora->set_gfx_region(1);

View File

@ -392,7 +392,7 @@ INPUT_PORTS_END
MACHINE_CONFIG_START(airraid_state::airraid)
/* basic machine hardware */
MCFG_DEVICE_ADD("maincpu", Z80,XTAL(12'000'000)/2) /* verified on pcb */
MCFG_DEVICE_ADD(m_maincpu, Z80,XTAL(12'000'000)/2) /* verified on pcb */
MCFG_DEVICE_PROGRAM_MAP(airraid_map)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", airraid_state, cshooter_scanline, "airraid_vid:screen", 0, 1)
@ -403,8 +403,7 @@ MACHINE_CONFIG_START(airraid_state::airraid)
MCFG_QUANTUM_PERFECT_CPU("maincpu")
MCFG_PALETTE_ADD("palette", 0x100)
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 0x100);
AIRRAID_VIDEO(config, m_airraid_video, 0);

View File

@ -194,9 +194,8 @@ void ajax_state::ajax(machine_config &config)
screen.set_screen_update(FUNC(ajax_state::screen_update));
screen.set_palette(m_palette);
PALETTE(config, m_palette, 2048);
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->enable_shadows();
m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
K052109(config, m_k052109, 0);
m_k052109->set_palette(m_palette);

View File

@ -44,7 +44,7 @@ private:
DECLARE_WRITE8_MEMBER(hanaroku_out_2_w);
DECLARE_WRITE8_MEMBER(albazc_vregs_w);
virtual void video_start() override;
DECLARE_PALETTE_INIT(albazc);
void albazc_palette(palette_device &palette) const;
uint32_t screen_update_hanaroku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void hanaroku_map(address_map &map);
@ -63,17 +63,14 @@ private:
/* video */
PALETTE_INIT_MEMBER(albazc_state, albazc)
void albazc_state::albazc_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
int i;
int r, g, b;
for (i = 0; i < 0x200; i++)
uint8_t const *const color_prom(memregion("proms")->base());
for (int i = 0; i < 0x200; i++)
{
b = (color_prom[i * 2 + 1] & 0x1f);
g = ((color_prom[i * 2 + 1] & 0xe0) | ((color_prom[i * 2 + 0]& 0x03) <<8)) >> 5;
r = (color_prom[i * 2 + 0] & 0x7c) >> 2;
int const b = (color_prom[i * 2 + 1] & 0x1f);
int const g = ((color_prom[i * 2 + 1] & 0xe0) | ((color_prom[i * 2 + 0] & 0x03) <<8)) >> 5;
int const r = (color_prom[i * 2 + 0] & 0x7c) >> 2;
palette.set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b));
}
@ -296,12 +293,11 @@ MACHINE_CONFIG_START(albazc_state::hanaroku)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0, 48*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(albazc_state, screen_update_hanaroku)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hanaroku)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_hanaroku)
MCFG_PALETTE_ADD("palette", 0x200)
MCFG_PALETTE_INIT_OWNER(albazc_state, albazc)
PALETTE(config, "palette", FUNC(albazc_state::albazc_palette), 0x200);
/* sound hardware */
SPEAKER(config, "mono").front_center();

View File

@ -390,9 +390,8 @@ MACHINE_CONFIG_START(albazg_state::yumefuda)
crtc.set_show_border_area(false);
crtc.set_char_width(8);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_yumefuda )
MCFG_PALETTE_ADD("palette", 0x80)
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_yumefuda)
PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x80);
/* sound hardware */

View File

@ -1000,7 +1000,7 @@ void aleck64_state::aleck64(machine_config &config)
screen.set_screen_update(FUNC(aleck64_state::screen_update_n64));
screen.screen_vblank().set(FUNC(aleck64_state::screen_vblank_n64));
PALETTE(config, "palette", 0x1000);
PALETTE(config, "palette").set_entries(0x1000);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();

View File

@ -329,7 +329,7 @@ static INPUT_PORTS_START( sr16 )
INPUT_PORTS_END
PALETTE_INIT_MEMBER(alesis_state, alesis)
void alesis_state::alesis_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@ -432,8 +432,7 @@ MACHINE_CONFIG_START(alesis_state::hr16)
MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD_MONOCHROME("palette")
MCFG_PALETTE_INIT_OWNER(alesis_state, alesis)
PALETTE(config, "palette", FUNC(alesis_state::alesis_palette), 2);
MCFG_CASSETTE_ADD( "cassette" )
MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED)

View File

@ -322,10 +322,9 @@ MACHINE_CONFIG_START(alg_state::alg_r1)
MCFG_LASERDISC_SCREEN("screen")
MCFG_LASERDISC_OVERLAY_DRIVER(512*2, 262, amiga_state, screen_update_amiga)
MCFG_LASERDISC_OVERLAY_CLIP((129-8)*2, (449+8-1)*2, 44-8, 244+8-1)
MCFG_LASERDISC_OVERLAY_PALETTE("palette")
MCFG_LASERDISC_OVERLAY_PALETTE(m_palette)
MCFG_PALETTE_ADD("palette", 4097)
MCFG_PALETTE_INIT_OWNER(alg_state,amiga)
PALETTE(config, m_palette, FUNC(alg_state::amiga_palette), 4097);
MCFG_VIDEO_START_OVERRIDE(alg_state,alg)

View File

@ -216,9 +216,7 @@ void aliens_state::aliens(machine_config &config)
screen.set_screen_update(FUNC(aliens_state::screen_update_aliens));
screen.set_palette("palette");
palette_device &palette(PALETTE(config, "palette", 512));
palette.enable_shadows();
palette.set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
PALETTE(config, "palette").set_format(palette_device::xBGR_555, 512).enable_shadows();
K052109(config, m_k052109, 0);
m_k052109->set_palette("palette");

View File

@ -1927,13 +1927,11 @@ MACHINE_CONFIG_START(alpha68k_state::sstingry)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_sstingry)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sstingry)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_sstingry)
MCFG_PALETTE_ADD("palette", 256 + 1)
MCFG_PALETTE_INDIRECT_ENTRIES(256)
MCFG_PALETTE_INIT_OWNER(alpha68k_state,kyros)
PALETTE(config, m_palette, FUNC(alpha68k_state::kyros_palette), 256 + 1, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@ -1979,13 +1977,11 @@ MACHINE_CONFIG_START(alpha68k_state::kyros)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_kyros)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kyros)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_kyros)
MCFG_PALETTE_ADD("palette", 256 + 1)
MCFG_PALETTE_INDIRECT_ENTRIES(256)
MCFG_PALETTE_INIT_OWNER(alpha68k_state,kyros)
PALETTE(config, m_palette, FUNC(alpha68k_state::kyros_palette), 256 + 1, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@ -2030,13 +2026,11 @@ MACHINE_CONFIG_START(alpha68k_state::jongbou)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_kyros)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jongbou)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_jongbou)
MCFG_PALETTE_ADD("palette", 256 + 1)
MCFG_PALETTE_INDIRECT_ENTRIES(256)
MCFG_PALETTE_INIT_OWNER(alpha68k_state,kyros)
PALETTE(config, m_palette, FUNC(alpha68k_state::kyros_palette), 256 + 1, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@ -2069,13 +2063,11 @@ MACHINE_CONFIG_START(alpha68k_state::alpha68k_I)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_I)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_alpha68k_I)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_alpha68k_I)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_INDIRECT_ENTRIES(256)
MCFG_PALETTE_INIT_OWNER(alpha68k_state,paddlem)
PALETTE(config, m_palette, FUNC(alpha68k_state::paddlem_palette), 1024, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@ -2122,9 +2114,9 @@ MACHINE_CONFIG_START(alpha68k_state::alpha68k_II)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_II)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_alpha68k_II)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_alpha68k_II)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRGBRRRRGGGGBBBB_bit0)
@ -2188,9 +2180,9 @@ MACHINE_CONFIG_START(alpha68k_state::alpha68k_V)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_V)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_alpha68k_V)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_alpha68k_V)
MCFG_PALETTE_ADD("palette", 4096)
MCFG_PALETTE_FORMAT(xRGBRRRRGGGGBBBB_bit0)
@ -2243,13 +2235,11 @@ MACHINE_CONFIG_START(alpha68k_state::tnextspc)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_I)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_alpha68k_I)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_alpha68k_I)
MCFG_PALETTE_ADD("palette", 1024)
MCFG_PALETTE_INDIRECT_ENTRIES(256)
MCFG_PALETTE_INIT_OWNER(alpha68k_state,paddlem)
PALETTE(config, m_palette, FUNC(alpha68k_state::paddlem_palette), 1024, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();

View File

@ -52,7 +52,7 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
DECLARE_PALETTE_INIT(alphasmart);
void alphasmart_palette(palette_device &palette) const;
virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER(kb_r);
@ -398,7 +398,7 @@ static INPUT_PORTS_START( alphasmart )
PORT_CONFSETTING (0x01, DEF_STR(Normal))
INPUT_PORTS_END
PALETTE_INIT_MEMBER(alphasmart_state, alphasmart)
void alphasmart_state::alphasmart_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@ -454,8 +454,7 @@ MACHINE_CONFIG_START(alphasmart_state::alphasmart)
MCFG_SCREEN_VISIBLE_AREA(0, (6*40)-1, 0, (9*4)-1)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 2)
MCFG_PALETTE_INIT_OWNER(alphasmart_state, alphasmart)
PALETTE(config, "palette", FUNC(alphasmart_state::alphasmart_palette), 2);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
MACHINE_CONFIG_END

View File

@ -1224,7 +1224,7 @@ MACHINE_CONFIG_START(alphatp_12_state::alphatp2)
MCFG_SCREEN_RAW_PARAMS(12.8544_MHz_XTAL, 824, 0, 640, 312, 0, 288)
MCFG_SCREEN_UPDATE_DRIVER(alphatp_12_state, screen_update)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, m_palette, palette_device::MONOCHROME);
CRT5027(config, m_crtc, 12.8544_MHz_XTAL / 8);
m_crtc->set_char_width(8);
@ -1301,7 +1301,7 @@ MACHINE_CONFIG_START(alphatp_34_state::alphatp3)
MCFG_SCREEN_RAW_PARAMS(12.8544_MHz_XTAL, 824, 0, 640, 312, 0, 288)
MCFG_SCREEN_UPDATE_DRIVER(alphatp_34_state, screen_update)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, m_palette, palette_device::MONOCHROME);
CRT5037(config, m_crtc, 12.8544_MHz_XTAL / 8);
m_crtc->set_char_width(8);

View File

@ -78,6 +78,11 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(alphatro_break);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
enum
{
@ -102,7 +107,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(txdata_callback);
DECLARE_WRITE_LINE_MEMBER(hrq_w);
DECLARE_WRITE_LINE_MEMBER(fdc_irq_w);
DECLARE_PALETTE_INIT(alphatro);
void alphatro_palette(palette_device &palette) const;
TIMER_DEVICE_CALLBACK_MEMBER(timer_c);
TIMER_DEVICE_CALLBACK_MEMBER(timer_p);
MC6845_UPDATE_ROW(crtc_update_row);
@ -116,6 +121,7 @@ private:
void cartbank_map(address_map &map);
void monbank_map(address_map &map);
void rombank_map(address_map &map);
void update_banking();
const bool m_is_ntsc;
uint8_t *m_ram_ptr;
@ -127,10 +133,6 @@ private:
u8 m_port_10, m_port_20, m_port_30, m_port_f0;
bool m_cass_state;
bool m_cassold, m_fdc_irq;
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
void update_banking();
required_region_ptr<u8> m_p_chargen;
required_device<cpu_device> m_maincpu;
required_device<mc6845_device> m_crtc;
@ -660,7 +662,7 @@ image_init_result alphatro_state::load_cart(device_image_interface &image, gener
return image_init_result::PASS;
}
PALETTE_INIT_MEMBER(alphatro_state, alphatro)
void alphatro_state::alphatro_palette(palette_device &palette) const
{
// RGB colours
palette.set_pen_color(0, 0x00, 0x00, 0x00);
@ -741,9 +743,8 @@ MACHINE_CONFIG_START(alphatro_state::alphatro)
screen.set_raw(16_MHz_XTAL, 1016, 0, 640, 314, 0, 240);
screen.set_screen_update("crtc", FUNC(mc6845_device::screen_update));
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_alphatro)
MCFG_PALETTE_ADD("palette", 9) // 8 colours + amber
MCFG_PALETTE_INIT_OWNER(alphatro_state, alphatro)
GFXDECODE(config, "gfxdecode", m_palette, gfx_alphatro);
PALETTE(config, m_palette, FUNC(alphatro_state::alphatro_palette), 9); // 8 colours + amber
/* sound hardware */
SPEAKER(config, "mono").front_center();

View File

@ -298,7 +298,7 @@ MACHINE_CONFIG_START(alto2_state::alto2)
screen.set_screen_update("maincpu", FUNC(alto2_cpu_device::screen_update));
screen.set_palette("palette");
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, "palette", palette_device::MONOCHROME);
// Sound hardware
SPEAKER(config, "mono").front_center();

View File

@ -432,8 +432,8 @@
class amaticmg_state : public driver_device
{
public:
amaticmg_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
amaticmg_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_attr(*this, "attr"),
m_vram(*this, "vram"),
m_maincpu(*this, "maincpu"),
@ -446,27 +446,36 @@ public:
void amaticmg2(machine_config &config);
void amaticmg(machine_config &config);
void amaticmg4(machine_config &config);
void init_ama8000_3_o();
void init_ama8000_2_i();
void init_ama8000_2_v();
void init_ama8000_1_x();
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
private:
required_shared_ptr<uint8_t> m_attr;
required_shared_ptr<uint8_t> m_vram;
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
output_finder<7> m_lamps;
uint8_t m_nmi_mask;
DECLARE_WRITE8_MEMBER(rombank_w);
DECLARE_WRITE8_MEMBER(nmi_mask_w);
DECLARE_WRITE8_MEMBER(unk80_w);
uint8_t m_nmi_mask;
DECLARE_WRITE8_MEMBER(out_a_w);
DECLARE_WRITE8_MEMBER(out_c_w);
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
DECLARE_PALETTE_INIT(amaticmg);
DECLARE_PALETTE_INIT(amaticmg2);
void amaticmg_palette(palette_device &palette) const;
void amaticmg2_palette(palette_device &palette) const;
uint32_t screen_update_amaticmg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_amaticmg2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(amaticmg2_irq);
@ -477,11 +486,6 @@ private:
void amaticmg4_portmap(address_map &map);
void amaticmg_map(address_map &map);
void amaticmg_portmap(address_map &map);
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
output_finder<7> m_lamps;
};
@ -542,47 +546,46 @@ uint32_t amaticmg_state::screen_update_amaticmg2(screen_device &screen, bitmap_i
return 0;
}
PALETTE_INIT_MEMBER(amaticmg_state, amaticmg)
void amaticmg_state::amaticmg_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
int bit0, bit1, bit2 , r, g, b;
int i;
uint8_t const *const color_prom = memregion("proms")->base();
for (i = 0; i < 0x200; ++i)
for (int i = 0; i < 0x200; ++i)
{
int bit0, bit1, bit2;
bit0 = 0;
bit1 = (color_prom[0] >> 6) & 0x01;
bit2 = (color_prom[0] >> 7) & 0x01;
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = (color_prom[0] >> 0) & 0x01;
bit1 = (color_prom[0] >> 1) & 0x01;
bit2 = (color_prom[0] >> 2) & 0x01;
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = (color_prom[0] >> 3) & 0x01;
bit1 = (color_prom[0] >> 4) & 0x01;
bit2 = (color_prom[0] >> 5) & 0x01;
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit1 = BIT(color_prom[i], 6);
bit2 = BIT(color_prom[i], 7);
int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
}
PALETTE_INIT_MEMBER(amaticmg_state,amaticmg2)
void amaticmg_state::amaticmg2_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
int r, g, b;
int i;
for (i = 0; i < memregion("proms")->bytes(); i+=2)
for (int i = 0, n = memregion("proms")->bytes(); i < n; i += 2)
{
b = ((color_prom[1] & 0xf8) >> 3);
g = ((color_prom[0] & 0xc0) >> 6) | ((color_prom[1] & 0x7) << 2);
r = ((color_prom[0] & 0x3e) >> 1);
int const b = ((color_prom[1] & 0xf8) >> 3);
int const g = ((color_prom[0] & 0xc0) >> 6) | ((color_prom[1] & 0x7) << 2);
int const r = ((color_prom[0] & 0x3e) >> 1);
palette.set_pen_color(i >> 1, pal5bit(r), pal5bit(g), pal5bit(b));
color_prom+=2;
color_prom += 2;
}
}
@ -869,7 +872,7 @@ MACHINE_CONFIG_START(amaticmg_state::amaticmg)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(amaticmg_state, screen_update_amaticmg)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
mc6845_device &crtc(MC6845(config, "crtc", CRTC_CLOCK));
crtc.set_screen("screen");
@ -877,10 +880,8 @@ MACHINE_CONFIG_START(amaticmg_state::amaticmg)
crtc.set_char_width(4);
crtc.out_vsync_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); // no NMI mask?
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_amaticmg)
MCFG_PALETTE_ADD("palette", 0x200)
MCFG_PALETTE_INIT_OWNER(amaticmg_state, amaticmg)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_amaticmg);
PALETTE(config, m_palette, FUNC(amaticmg_state::amaticmg_palette), 0x200);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@ -911,9 +912,8 @@ MACHINE_CONFIG_START(amaticmg_state::amaticmg2)
subdevice<mc6845_device>("crtc")->out_vsync_callback().set(FUNC(amaticmg_state::amaticmg2_irq));
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_amaticmg2)
MCFG_PALETTE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(0x10000)
MCFG_PALETTE_INIT_OWNER(amaticmg_state,amaticmg2)
m_palette->set_init(FUNC(amaticmg_state::amaticmg2_palette));
m_palette->set_entries(0x10000);
MACHINE_CONFIG_END
@ -931,9 +931,8 @@ MACHINE_CONFIG_START(amaticmg_state::amaticmg4)
subdevice<mc6845_device>("crtc")->out_vsync_callback().set(FUNC(amaticmg_state::amaticmg2_irq));
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_amaticmg2)
MCFG_PALETTE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(0x10000)
MCFG_PALETTE_INIT_OWNER(amaticmg_state,amaticmg2)
m_palette->set_init(FUNC(amaticmg_state::amaticmg2_palette));
m_palette->set_entries(0x10000);
MACHINE_CONFIG_END

View File

@ -60,8 +60,8 @@
class ambush_state : public driver_device
{
public:
ambush_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
ambush_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_gfxdecode(*this, "gfxdecode"),
m_outlatch(*this, "outlatch%u", 1),
m_video_ram(*this, "video_ram"),
@ -79,10 +79,10 @@ public:
void dkong3abl(machine_config &config);
private:
DECLARE_PALETTE_INIT(ambush);
DECLARE_PALETTE_INIT(mario);
DECLARE_PALETTE_INIT(mariobla);
DECLARE_PALETTE_INIT(dkong3);
void ambush_palette(palette_device &palette) const;
void mario_palette(palette_device &palette) const;
void mariobla_palette(palette_device &palette) const;
void dkong3_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_bootleg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@ -306,126 +306,126 @@ INPUT_PORTS_END
// PALETTES
//**************************************************************************
PALETTE_INIT_MEMBER( ambush_state, ambush )
void ambush_state::ambush_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("colors")->base();
uint8_t const *const color_prom = memregion("colors")->base();
for (int i = 0; i < palette.entries(); i++)
{
int bit0, bit1, bit2, r, g, b;
int bit0, bit1, bit2;
// red component
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// green component
bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (color_prom[i] >> 5) & 0x01;
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// blue component
bit0 = 0;
bit1 = (color_prom[i] >> 6) & 0x01;
bit2 = (color_prom[i] >> 7) & 0x01;
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit1 = BIT(color_prom[i], 6);
bit2 = BIT(color_prom[i], 7);
int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r,g,b));
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
PALETTE_INIT_MEMBER( ambush_state, mario )
void ambush_state::mario_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("colors")->base();
uint8_t const *const color_prom = memregion("colors")->base();
for (int i = 0; i < palette.entries(); i++)
{
int bit0, bit1, bit2, r, g, b;
int bit0, bit1, bit2;
// red component
bit0 = (color_prom[i] >> 5) & 1;
bit1 = (color_prom[i] >> 6) & 1;
bit2 = (color_prom[i] >> 7) & 1;
r = 255 - (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
bit0 = BIT(color_prom[i], 5);
bit1 = BIT(color_prom[i], 6);
bit2 = BIT(color_prom[i], 7);
int const r = 255 - (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
// green component
bit0 = (color_prom[i] >> 2) & 1;
bit1 = (color_prom[i] >> 3) & 1;
bit2 = (color_prom[i] >> 4) & 1;
g = 255 - (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
bit0 = BIT(color_prom[i], 2);
bit1 = BIT(color_prom[i], 3);
bit2 = BIT(color_prom[i], 4);
int const g = 255 - (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
// blue component
bit0 = (color_prom[i] >> 0) & 1;
bit1 = (color_prom[i] >> 1) & 1;
b = 255 - (0x55 * bit0 + 0xaa * bit1);
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
int const b = 255 - (0x55 * bit0 + 0xaa * bit1);
palette.set_pen_color(i, rgb_t(r,g,b));
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
PALETTE_INIT_MEMBER(ambush_state, mariobla)
void ambush_state::mariobla_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("colors")->base();
uint8_t const *const color_prom = memregion("colors")->base();
for (int c = 0; c < palette.entries(); c++)
{
int i = bitswap<9>(c, 2, 7, 6, 8, 5, 4, 3, 1, 0);
int bit0, bit1, bit2, r, g, b;
int const i = bitswap<9>(c, 2, 7, 6, 8, 5, 4, 3, 1, 0);
int bit0, bit1, bit2;
// red component
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// green component
bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (color_prom[i] >> 5) & 0x01;
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// blue component
bit0 = 0;
bit1 = (color_prom[i] >> 6) & 0x01;
bit2 = (color_prom[i] >> 7) & 0x01;
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit1 = BIT(color_prom[i], 6);
bit2 = BIT(color_prom[i], 7);
int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(c, rgb_t(r, g, b));
}
}
PALETTE_INIT_MEMBER( ambush_state, dkong3 )
void ambush_state::dkong3_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("colors")->base();
uint8_t const *const color_prom = memregion("colors")->base();
for (int i = 0; i < palette.entries(); i++)
{
int bit0, bit1, bit2, bit3, r, g, b;
int bit0, bit1, bit2, bit3;
// red component
bit0 = (color_prom[i] >> 4) & 0x01;
bit1 = (color_prom[i] >> 5) & 0x01;
bit2 = (color_prom[i] >> 6) & 0x01;
bit3 = (color_prom[i] >> 7) & 0x01;
r = 255 - (0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
bit0 = BIT(color_prom[i], 4);
bit1 = BIT(color_prom[i], 5);
bit2 = BIT(color_prom[i], 6);
bit3 = BIT(color_prom[i], 7);
int const r = 255 - (0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
// green component
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
bit3 = (color_prom[i] >> 3) & 0x01;
g = 255 - (0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
bit3 = BIT(color_prom[i], 3);
int const g = 255 - (0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
// blue component
bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
b = 255 - (0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
bit0 = BIT(color_prom[i + 0x200], 0);
bit1 = BIT(color_prom[i + 0x200], 1);
bit2 = BIT(color_prom[i + 0x200], 2);
bit3 = BIT(color_prom[i + 0x200], 3);
int const b = 255 - (0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
palette.set_pen_color(i, rgb_t(r,g,b));
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@ -740,10 +740,9 @@ MACHINE_CONFIG_START(ambush_state::ambush_base)
MCFG_SCREEN_UPDATE_DRIVER(ambush_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ambush)
GFXDECODE(config, m_gfxdecode, "palette", gfx_ambush);
MCFG_PALETTE_ADD("palette", 256)
MCFG_PALETTE_INIT_OWNER(ambush_state, ambush)
PALETTE(config, "palette", FUNC(ambush_state::ambush_palette), 256);
// sound hardware
SPEAKER(config, "mono").front_center();
@ -788,8 +787,7 @@ MACHINE_CONFIG_START(ambush_state::mariobl)
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_mariobl)
MCFG_PALETTE_MODIFY("palette")
MCFG_PALETTE_INIT_OWNER(ambush_state, mario)
subdevice<palette_device>("palette")->set_init(FUNC(ambush_state::mario_palette));
ay8910_device &ay1(AY8910(config.replace(), "ay1", XTAL(18'432'000)/6/2));
ay1.port_a_read_callback().set_ioport("buttons");
@ -803,8 +801,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(ambush_state::mariobla)
mariobl(config);
MCFG_PALETTE_MODIFY("palette")
MCFG_PALETTE_INIT_OWNER(ambush_state, mariobla)
subdevice<palette_device>("palette")->set_init(FUNC(ambush_state::mariobla_palette));
auto &outlatch(*subdevice<ls259_device>("outlatch"));
outlatch.q_out_cb<5>().set(FUNC(ambush_state::color_bank_1_w));
@ -813,12 +810,12 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(ambush_state::dkong3abl)
mariobl(config);
MCFG_MACHINE_START_OVERRIDE(ambush_state, dkong3abl)
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_dkong3abl)
MCFG_PALETTE_MODIFY("palette")
MCFG_PALETTE_INIT_OWNER(ambush_state, dkong3)
subdevice<palette_device>("palette")->set_init(FUNC(ambush_state::dkong3_palette));
MACHINE_CONFIG_END

View File

@ -1561,8 +1561,7 @@ MACHINE_CONFIG_START(amiga_state::amiga_base)
// video
pal_video(config);
MCFG_PALETTE_ADD("palette", 4096)
MCFG_PALETTE_INIT_OWNER(amiga_state, amiga)
PALETTE(config, m_palette, FUNC(amiga_state::amiga_palette), 4096);
MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga)

View File

@ -391,9 +391,6 @@
*********************************************************************************/
#define MASTER_CLOCK XTAL(6'000'000)
#include "emu.h"
#include "includes/ampoker2.h"
@ -407,6 +404,9 @@
#include "sigmapkr.lh"
#define MASTER_CLOCK XTAL(6'000'000)
void ampoker2_state::machine_start()
{
m_lamps.resolve();
@ -1189,9 +1189,8 @@ MACHINE_CONFIG_START(ampoker2_state::ampoker2)
MCFG_SCREEN_UPDATE_DRIVER(ampoker2_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ampoker2)
MCFG_PALETTE_ADD("palette", 512)
MCFG_PALETTE_INIT_OWNER(ampoker2_state, ampoker2)
GFXDECODE(config, m_gfxdecode, "palette", gfx_ampoker2);
PALETTE(config, "palette", FUNC(ampoker2_state::ampoker2_palette), 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();

View File

@ -267,11 +267,10 @@ MACHINE_CONFIG_START(amspdwy_state::amspdwy)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0+16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(amspdwy_state, screen_update_amspdwy)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_amspdwy)
MCFG_PALETTE_ADD("palette", 32)
MCFG_PALETTE_FORMAT(BBGGGRRR_inverted)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_amspdwy);
PALETTE(config, m_palette).set_format(palette_device::BGR_233_inverted, 32);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();

View File

@ -267,14 +267,10 @@ INPUT_PORTS_END
/* Steph 2000-10-27 I remapped the 'Machine Name' Dip Switches (easier to understand) */
INPUT_CHANGED_MEMBER(amstrad_state::cpc_monitor_changed)
{
if ( (m_io_green_display->read()) & 0x01 )
{
PALETTE_INIT_NAME( amstrad_cpc_green )(*m_palette);
}
if ((m_io_green_display->read()) & 0x01)
amstrad_cpc_green_palette(*m_palette);
else
{
PALETTE_INIT_NAME( amstrad_cpc )(*m_palette);
}
amstrad_cpc_palette(*m_palette);
}
@ -931,10 +927,9 @@ MACHINE_CONFIG_START(amstrad_state::amstrad_base)
MCFG_SCREEN_UPDATE_DRIVER(amstrad_state, screen_update_amstrad)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, amstrad_state, screen_vblank_amstrad))
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_PALETTE_ADD("palette", 32)
MCFG_PALETTE_INIT_OWNER(amstrad_state,amstrad_cpc)
PALETTE(config, m_palette, FUNC(amstrad_state::amstrad_cpc_palette), 32);
HD6845(config, m_crtc, 16_MHz_XTAL / 16);
m_crtc->set_screen(nullptr);
@ -1026,8 +1021,7 @@ MACHINE_CONFIG_START(amstrad_state::kccomp)
MCFG_MACHINE_START_OVERRIDE(amstrad_state,kccomp)
MCFG_MACHINE_RESET_OVERRIDE(amstrad_state,kccomp)
MCFG_PALETTE_MODIFY("palette")
MCFG_PALETTE_INIT_OWNER(amstrad_state,kccomp)
m_palette->set_init(FUNC(amstrad_state::kccomp_palette));
MACHINE_CONFIG_END
@ -1055,10 +1049,9 @@ MACHINE_CONFIG_START(amstrad_state::cpcplus)
MCFG_SCREEN_UPDATE_DRIVER(amstrad_state, screen_update_amstrad)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, amstrad_state, screen_vblank_amstrad))
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_PALETTE_ADD("palette", 4096)
MCFG_PALETTE_INIT_OWNER(amstrad_state,amstrad_plus)
PALETTE(config, m_palette, FUNC(amstrad_state::amstrad_plus_palette), 4096);
AMS40489(config, m_crtc, 40_MHz_XTAL / 40);
m_crtc->set_screen(nullptr);
@ -1134,10 +1127,9 @@ MACHINE_CONFIG_START(amstrad_state::gx4000)
MCFG_SCREEN_UPDATE_DRIVER(amstrad_state, screen_update_amstrad)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, amstrad_state, screen_vblank_amstrad))
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_PALETTE(m_palette)
MCFG_PALETTE_ADD("palette", 4096)
MCFG_PALETTE_INIT_OWNER(amstrad_state,amstrad_plus)
PALETTE(config, m_palette, FUNC(amstrad_state::amstrad_plus_palette), 4096);
AMS40489(config, m_crtc, 40_MHz_XTAL / 40);
m_crtc->set_screen(nullptr);
@ -1171,9 +1163,8 @@ MACHINE_CONFIG_START(amstrad_state::aleste)
m_ay->port_a_read_callback().set(FUNC(amstrad_state::amstrad_psg_porta_read));
m_ay->add_route(ALL_OUTPUTS, "mono", 0.25);
MCFG_PALETTE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(32+64)
MCFG_PALETTE_INIT_OWNER(amstrad_state,aleste)
m_palette->set_entries(32+64);
m_palette->set_init(FUNC(amstrad_state::aleste_palette));
MCFG_DEVICE_ADD("rtc", MC146818, 4.194304_MHz_XTAL)

View File

@ -102,8 +102,8 @@
class amusco_state : public driver_device
{
public:
amusco_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
amusco_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_pit(*this, "pit8253"),
@ -120,6 +120,10 @@ public:
DECLARE_WRITE_LINE_MEMBER(coin_irq);
protected:
virtual void video_start() override;
virtual void machine_start() override;
private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
DECLARE_READ8_MEMBER(mc6845_r);
@ -133,10 +137,7 @@ private:
DECLARE_WRITE8_MEMBER(rtc_control_w);
MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr);
MC6845_UPDATE_ROW(update_row);
DECLARE_PALETTE_INIT(amusco);
virtual void video_start() override;
virtual void machine_start() override;
void amusco_palette(palette_device &palette) const;
void amusco_mem_map(address_map &map);
void amusco_io_map(address_map &map);
@ -483,13 +484,13 @@ MC6845_UPDATE_ROW(amusco_state::update_row)
m_bg_tilemap->draw(*m_screen, bitmap, rowrect, 0, 0);
}
PALETTE_INIT_MEMBER(amusco_state,amusco)
void amusco_state::amusco_palette(palette_device &palette) const
{
// add some templates first
for (int i = 0; i < 8; i++)
{
for(int j=0;j<8;j++)
palette.set_pen_color(i*8+j, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
for (int j = 0; j < 8; j++)
palette.set_pen_color((i * 8) + j, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
}
// override colors
@ -580,10 +581,8 @@ MACHINE_CONFIG_START(amusco_state::amusco)
MCFG_SCREEN_VISIBLE_AREA(0*8, 74*8-1, 0*10, 24*10-1) // visible scr: 74*8 24*10
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_amusco)
MCFG_PALETTE_ADD("palette",8*8)
MCFG_PALETTE_INIT_OWNER(amusco_state, amusco)
GFXDECODE(config, m_gfxdecode, "palette", gfx_amusco);
PALETTE(config, "palette", FUNC(amusco_state::amusco_palette), 8*8);
R6545_1(config, m_crtc, CRTC_CLOCK); /* guess */
m_crtc->set_screen(m_screen);

View File

@ -446,7 +446,7 @@ MACHINE_CONFIG_START(amust_state::amust)
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, m_palette, palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_amust)
/* sound hardware */

View File

@ -550,10 +550,8 @@ MACHINE_CONFIG_START(angelkds_state::angelkds)
MCFG_SCREEN_UPDATE_DRIVER(angelkds_state, screen_update_angelkds)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_angelkds)
MCFG_PALETTE_ADD("palette", 0x100)
MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
GFXDECODE(config, m_gfxdecode, "palette", gfx_angelkds);
PALETTE(config, "palette").set_format(palette_device::xBGR_444, 0x100);
SPEAKER(config, "mono").front_center();
@ -574,6 +572,7 @@ MACHINE_CONFIG_END
void angelkds_state::spcpostn(machine_config &config)
{
angelkds(config);
/* encryption */
sega_317_0005_device &maincpu(SEGA_317_0005(config.replace(), m_maincpu, XTAL(6'000'000)));
maincpu.set_addrmap(AS_PROGRAM, &angelkds_state::main_map);

View File

@ -429,7 +429,7 @@ MACHINE_CONFIG_START(anzterm_state::anzterm)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_RAW_PARAMS(15974400/4, 1024, 0, 104*8, 260, 0, 24*10) // this is totally wrong, it just stops a validation error
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, "palette", palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_anzterm)
MACHINE_CONFIG_END

View File

@ -74,8 +74,8 @@
class apc_state : public driver_device
{
public:
apc_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
apc_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_hgdc1(*this, "upd7220_chr"),
m_hgdc2(*this, "upd7220_btm"),
@ -989,7 +989,7 @@ MACHINE_CONFIG_START(apc_state::apc)
m_screen->set_size(640, 494);
m_screen->set_visarea(0*8, 640-1, 0*8, 494-1);
MCFG_PALETTE_ADD_3BIT_BRG(m_palette)
PALETTE(config, m_palette, palette_device::BRG_3BIT);
MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_apc)

View File

@ -377,7 +377,7 @@ void apexc_state::apexc(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_apexc);
PALETTE(config, m_palette, ARRAY_LENGTH(palette_table)).set_init(FUNC(apexc_state::palette_init_apexc));
PALETTE(config, m_palette, FUNC(apexc_state::apexc_palette), ARRAY_LENGTH(palette_table));
APEXC_CYLINDER(config, m_cylinder);
APEXC_TAPE_PUNCHER(config, m_tape_puncher);

View File

@ -30,8 +30,9 @@ class apogee_state : public radio86_state
{
public:
apogee_state(const machine_config &mconfig, device_type type, const char *tag)
: radio86_state(mconfig, type, tag),
m_speaker(*this, "speaker") { }
: radio86_state(mconfig, type, tag)
, m_speaker(*this, "speaker")
{ }
void apogee(machine_config &config);
@ -177,9 +178,8 @@ WRITE_LINE_MEMBER(apogee_state::pit8253_out2_changed)
I8275_DRAW_CHARACTER_MEMBER(apogee_state::display_pixels)
{
int i;
const rgb_t *palette = m_palette->palette()->entry_list_raw();
const uint8_t *charmap = m_charmap + (gpa & 1) * 0x400;
rgb_t const *const palette = m_palette->palette()->entry_list_raw();
uint8_t const *const charmap = &m_charmap[(gpa & 1) * 0x400];
uint8_t pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff;
if (vsp) {
pixels = 0;
@ -190,7 +190,7 @@ I8275_DRAW_CHARACTER_MEMBER(apogee_state::display_pixels)
if (rvv) {
pixels ^= 0xff;
}
for(i=0;i<6;i++) {
for(int i=0;i<6;i++) {
bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0];
}
}
@ -250,7 +250,7 @@ void apogee_state::apogee(machine_config &config)
screen.set_visarea(0, 78*6-1, 0, 30*10-1);
GFXDECODE(config, "gfxdecode", m_palette, gfx_apogee);
PALETTE(config, m_palette, 3).set_init(FUNC(apogee_state::palette_init_radio86));
PALETTE(config, m_palette, FUNC(apogee_state::radio86_palette), 3);
SPEAKER(config, "mono").front_center();
WAVE(config, "wave", m_cassette).add_route(ALL_OUTPUTS, "mono", 0.25);

View File

@ -134,7 +134,6 @@ private:
emu_timer *m_ready_start_timer, *m_ready_end_timer, *m_kbd_strobe_timer;
DECLARE_PALETTE_INIT(apple2);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER(ram_r);
@ -605,7 +604,7 @@ MACHINE_CONFIG_START(apple1_state::apple1)
MCFG_SCREEN_UPDATE_DRIVER(apple1_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD_MONOCHROME("palette")
PALETTE(config, "palette", palette_device::MONOCHROME);
PIA6821(config, m_pia, 0);
m_pia->readpa_handler().set(FUNC(apple1_state::pia_keyboard_r));

View File

@ -103,8 +103,8 @@ II Plus: RAM options reduced to 16/32/48 KB.
class apple2_state : public driver_device
{
public:
apple2_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
apple2_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, A2_CPU_TAG),
m_screen(*this, "screen"),
m_scantimer(*this, "scantimer"),
@ -150,7 +150,6 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
DECLARE_PALETTE_INIT(apple2);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_jp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@ -400,10 +399,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(apple2_state::apple2_interrupt)
}
}
PALETTE_INIT_MEMBER(apple2_state, apple2)
{
m_video->palette_init_apple2(palette);
}
uint32_t apple2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
@ -1387,10 +1382,7 @@ MACHINE_CONFIG_START(apple2_state::apple2_common)
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(1021800*14, (65*7)*2, 0, (40*7)*2, 262, 0, 192);
m_screen->set_screen_update(FUNC(apple2_state::screen_update));
m_screen->set_palette("palette");
palette_device &palette(PALETTE(config, "palette", 16));
palette.set_init(DEVICE_SELF, FUNC(apple2_state::palette_init_apple2));
m_screen->set_palette(m_video);
/* sound hardware */
SPEAKER(config, "mono").front_center();

View File

@ -204,12 +204,11 @@ Address bus A0-A11 is Y0-Y11
class apple2e_state : public driver_device
{
public:
apple2e_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
apple2e_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, A2_CPU_TAG),
m_screen(*this, "screen"),
m_scantimer(*this, "scantimer"),
m_palette(*this, "palette"),
m_ram(*this, RAM_TAG),
m_rom(*this, "maincpu"),
m_cecbanks(*this, "cecexp"),
@ -252,7 +251,6 @@ public:
required_device<cpu_device> m_maincpu;
required_device<screen_device> m_screen;
required_device<timer_device> m_scantimer;
required_device<palette_device> m_palette;
required_device<ram_device> m_ram;
required_memory_region m_rom;
optional_memory_region m_cecbanks;
@ -290,7 +288,6 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
DECLARE_PALETTE_INIT(apple2);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER(ram0000_r);
@ -1041,11 +1038,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(apple2e_state::apple2_interrupt)
}
}
PALETTE_INIT_MEMBER(apple2e_state, apple2)
{
m_video->palette_init_apple2(palette);
}
uint32_t apple2e_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bool old_page2 = m_video->m_page2;
@ -3977,10 +3969,7 @@ MACHINE_CONFIG_START(apple2e_state::apple2e)
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(1021800*14, (65*7)*2, 0, (40*7)*2, 262, 0, 192);
m_screen->set_screen_update(FUNC(apple2e_state::screen_update));
m_screen->set_palette("palette");
PALETTE(config, m_palette, 16);
m_palette->set_init(DEVICE_SELF, FUNC(apple2e_state::palette_init_apple2));
m_screen->set_palette(m_video);
/* sound hardware */
SPEAKER(config, "mono").front_center();

View File

@ -357,7 +357,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
DECLARE_PALETTE_INIT(apple2gs);
void palette_init(palette_device &palette);
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void apple2gs(machine_config &config);
@ -1579,7 +1579,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(apple2gs_state::apple2_interrupt)
}
}
PALETTE_INIT_MEMBER(apple2gs_state, apple2gs)
void apple2gs_state::palette_init(palette_device &palette)
{
static const unsigned char apple2gs_palette[] =
{
@ -4583,8 +4583,7 @@ void apple2gs_state::apple2gs(machine_config &config)
m_screen->set_visarea(0,703,0,230);
m_screen->set_screen_update(FUNC(apple2gs_state::screen_update));
palette_device &palette(PALETTE(config, "palette", 256));
palette.set_init(DEVICE_SELF, FUNC(apple2gs_state::palette_init_apple2gs));
PALETTE(config, "palette", FUNC(apple2gs_state::palette_init), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();

View File

@ -72,12 +72,12 @@ void apple3_state::apple3(machine_config &config)
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(14.318181_MHz_XTAL, 910, 0, 560, 262, 0, 192);
m_screen->set_screen_update(FUNC(apple3_state::screen_update));
m_screen->set_palette("palette");
m_screen->set_palette(m_palette);
m_screen->screen_vblank().set(m_via[1], FUNC(via6522_device::write_cb1));
m_screen->screen_vblank().append(m_via[1], FUNC(via6522_device::write_cb2));
m_screen->screen_vblank().append(FUNC(apple3_state::vbl_w));
PALETTE(config, m_palette, 32).set_init(FUNC(apple3_state::palette_init_apple3));
PALETTE(config, m_palette, FUNC(apple3_state::palette_init), 32);
/* keyboard controller */
AY3600(config, m_ay3600, 0);

View File

@ -100,12 +100,17 @@ public:
m_io_k3b0(*this, "K3b_0"),
m_io_k0b(*this, "K0b"),
m_expansion(*this, "expansion"),
m_palette(*this, "palette"){ }
m_palette(*this, "palette")
{ }
void applix(machine_config &config);
void init_applix();
protected:
virtual void machine_reset() override;
virtual void video_start() override;
private:
DECLARE_READ16_MEMBER(applix_inputs_r);
DECLARE_WRITE16_MEMBER(palette_w);
@ -143,11 +148,10 @@ private:
TIMER_DEVICE_CALLBACK_MEMBER(cass_timer);
MC6845_UPDATE_ROW(crtc_update_row);
void applix_palette(palette_device &palette) const;
uint8_t m_video_latch;
uint8_t m_pa;
virtual void machine_reset() override;
virtual void video_start() override;
DECLARE_PALETTE_INIT(applix);
uint8_t m_palette_latch[4];
required_shared_ptr<uint16_t> m_base;
@ -756,33 +760,28 @@ static void applix_floppies(device_slot_interface &device)
}
PALETTE_INIT_MEMBER(applix_state, applix)
{ // shades need to be verified - the names on the right are from the manual
const uint8_t colors[16*3] = {
0x00, 0x00, 0x00, // 0 Black
0x40, 0x40, 0x40, // 1 Dark Grey
0x00, 0x00, 0x80, // 2 Dark Blue
0x00, 0x00, 0xff, // 3 Mid Blue
0x00, 0x80, 0x00, // 4 Dark Green
0x00, 0xff, 0x00, // 5 Green
0x00, 0xff, 0xff, // 6 Blue Grey
0x00, 0x7f, 0x7f, // 7 Light Blue
0x7f, 0x00, 0x00, // 8 Dark Red
0xff, 0x00, 0x00, // 9 Red
0x7f, 0x00, 0x7f, // 10 Dark Violet
0xff, 0x00, 0xff, // 11 Violet
0x7f, 0x7f, 0x00, // 12 Brown
0xff, 0xff, 0x00, // 13 Yellow
0xbf, 0xbf, 0xbf, // 14 Light Grey
0xff, 0xff, 0xff }; // 15 White
void applix_state::applix_palette(palette_device &palette) const
{
// shades need to be verified - the names on the right are from the manual
constexpr rgb_t colors[16] = {
{ 0x00, 0x00, 0x00 }, // 0 Black
{ 0x40, 0x40, 0x40 }, // 1 Dark Grey
{ 0x00, 0x00, 0x80 }, // 2 Dark Blue
{ 0x00, 0x00, 0xff }, // 3 Mid Blue
{ 0x00, 0x80, 0x00 }, // 4 Dark Green
{ 0x00, 0xff, 0x00 }, // 5 Green
{ 0x00, 0xff, 0xff }, // 6 Blue Grey
{ 0x00, 0x7f, 0x7f }, // 7 Light Blue
{ 0x7f, 0x00, 0x00 }, // 8 Dark Red
{ 0xff, 0x00, 0x00 }, // 9 Red
{ 0x7f, 0x00, 0x7f }, // 10 Dark Violet
{ 0xff, 0x00, 0xff }, // 11 Violet
{ 0x7f, 0x7f, 0x00 }, // 12 Brown
{ 0xff, 0xff, 0x00 }, // 13 Yellow
{ 0xbf, 0xbf, 0xbf }, // 14 Light Grey
{ 0xff, 0xff, 0xff } }; // 15 White
uint8_t r, b, g, i, color_count = 0;
for (i = 0; i < 48; color_count++)
{
r = colors[i++]; g = colors[i++]; b = colors[i++];
palette.set_pen_color(color_count, rgb_t(r, g, b));
}
palette.set_pen_colors(0, colors);
}
@ -792,32 +791,31 @@ void applix_state::video_start()
MC6845_UPDATE_ROW( applix_state::crtc_update_row )
{
// The display is bitmapped. 2 modes are supported here, 320x200x16 and 640x200x4.
// Need to display a border colour.
// There is a monochrome mode, but no info found as yet.
const rgb_t *palette = m_palette->palette()->entry_list_raw();
uint8_t i;
uint16_t chr,x;
uint32_t mem, vidbase = (m_video_latch & 15) << 14, *p = &bitmap.pix32(y);
// The display is bitmapped. 2 modes are supported here, 320x200x16 and 640x200x4.
// Need to display a border colour.
// There is a monochrome mode, but no info found as yet.
rgb_t const *const palette = m_palette->palette()->entry_list_raw();
uint32_t const vidbase = (m_video_latch & 15) << 14;
uint32_t *p = &bitmap.pix32(y);
for (x = 0; x < x_count; x++)
for (uint16_t x = 0; x < x_count; x++)
{
mem = vidbase + ma + x + (ra<<12);
chr = m_base[mem];
uint32_t const mem = vidbase + ma + x + (ra<<12);
uint16_t chr = m_base[mem];
if (BIT(m_pa, 3))
// 640 x 200 x 4of16 mode
{
for (i = 0; i < 8; i++)
// 640 x 200 x 4of16 mode
for (int i = 0; i < 8; i++)
{
*p++ = palette[m_palette_latch[chr>>14]];
chr <<= 2;
}
}
else
// 320 x 200 x 16 mode
{
for (i = 0; i < 4; i++)
// 320 x 200 x 16 mode
for (int i = 0; i < 4; i++)
{
*p++ = palette[chr>>12];
*p++ = palette[chr>>12];
@ -875,8 +873,7 @@ MACHINE_CONFIG_START(applix_state::applix)
MCFG_SCREEN_SIZE(640, 200)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
MCFG_PALETTE_ADD("palette", 16)
MCFG_PALETTE_INIT_OWNER(applix_state, applix)
PALETTE(config, m_palette, FUNC(applix_state::applix_palette), 16);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();

Some files were not shown because too many files have changed in this diff Show More