diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 35052eae70f..f93a376cc1c 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -2965,7 +2965,6 @@ files { MAME_DIR .. "src/mame/drivers/vsnes.cpp", MAME_DIR .. "src/mame/includes/vsnes.h", MAME_DIR .. "src/mame/machine/vsnes.cpp", - MAME_DIR .. "src/mame/video/vsnes.cpp", } createMAMEProjects(_target, _subtarget, "nix") diff --git a/src/devices/video/ppu2c0x.cpp b/src/devices/video/ppu2c0x.cpp index c30980d4f4a..6fee9f3a33d 100644 --- a/src/devices/video/ppu2c0x.cpp +++ b/src/devices/video/ppu2c0x.cpp @@ -124,6 +124,7 @@ ppu2c0x_device::ppu2c0x_device(const machine_config &mconfig, device_type type, : device_t(mconfig, type, tag, owner, clock) , device_memory_interface(mconfig, *this) , device_video_interface(mconfig, *this) + , device_palette_interface(mconfig, *this) , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, address_map_constructor(), address_map_constructor(FUNC(ppu2c0x_device::ppu2c0x), this)) , m_cpu(*this, finder_base::DUMMY_TAG) , m_scanline(0) // reset the scanline count @@ -138,7 +139,6 @@ ppu2c0x_device::ppu2c0x_device(const machine_config &mconfig, device_type type, , m_tile_page(0) , m_sprite_page(0) , m_back_color(0) - , m_color_base(0) , m_scan_scale(1) // set the scan scale (this is for dual monitor vertical setups) , m_tilecount(0) , m_draw_phase(0) @@ -158,6 +158,10 @@ ppu2c0x_device::ppu2c0x_device(const machine_config &mconfig, device_type type, m_nmi_callback_proc = nmi_delegate(); } +ppu2c0x_rgb_device::ppu2c0x_rgb_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, type, tag, owner, clock) + , m_palette_data(*this, "palette", 0xc0) +{ +} // NTSC NES ppu2c02_device::ppu2c02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C02, tag, owner, clock) @@ -165,12 +169,12 @@ ppu2c02_device::ppu2c02_device(const machine_config &mconfig, const char *tag, d } // Playchoice 10 -ppu2c03b_device::ppu2c03b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C03B, tag, owner, clock) +ppu2c03b_device::ppu2c03b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_rgb_device(mconfig, PPU_2C03B, tag, owner, clock) { } // Vs. Unisystem -ppu2c04_device::ppu2c04_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C04, tag, owner, clock) +ppu2c04_device::ppu2c04_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_rgb_device(mconfig, PPU_2C04, tag, owner, clock) { } @@ -189,22 +193,22 @@ ppupalc_device::ppupalc_device(const machine_config &mconfig, const char *tag, d // The PPU_2C05 variants have different protection value, set at device start, but otherwise are all the same... // Vs. Unisystem (Ninja Jajamaru Kun) -ppu2c05_01_device::ppu2c05_01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C05_01, tag, owner, clock) +ppu2c05_01_device::ppu2c05_01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_rgb_device(mconfig, PPU_2C05_01, tag, owner, clock) { m_security_value = 0x1b; // game (jajamaru) doesn't seem to ever actually check it } // Vs. Unisystem (Mighty Bomb Jack) -ppu2c05_02_device::ppu2c05_02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C05_02, tag, owner, clock) +ppu2c05_02_device::ppu2c05_02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_rgb_device(mconfig, PPU_2C05_02, tag, owner, clock) { m_security_value = 0x3d; } // Vs. Unisystem (Gumshoe) -ppu2c05_03_device::ppu2c05_03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C05_03, tag, owner, clock) +ppu2c05_03_device::ppu2c05_03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_rgb_device(mconfig, PPU_2C05_03, tag, owner, clock) { m_security_value = 0x1c; } // Vs. Unisystem (Top Gun) -ppu2c05_04_device::ppu2c05_04_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_device(mconfig, PPU_2C05_04, tag, owner, clock) +ppu2c05_04_device::ppu2c05_04_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : ppu2c0x_rgb_device(mconfig, PPU_2C05_04, tag, owner, clock) { m_security_value = 0x1b; } @@ -230,7 +234,7 @@ void ppu2c0x_device::device_start() m_nmi_timer->adjust(attotime::never); /* allocate a screen bitmap, videomem and spriteram, a dirtychar array and the monochromatic colortable */ - m_bitmap = std::make_unique(VISIBLE_SCREEN_WIDTH, VISIBLE_SCREEN_HEIGHT); + m_bitmap = std::make_unique(VISIBLE_SCREEN_WIDTH, VISIBLE_SCREEN_HEIGHT); m_spriteram = make_unique_clear(SPRITERAM_SIZE); m_colortable = std::make_unique(ARRAY_LENGTH(default_colortable)); m_colortable_mono = std::make_unique(ARRAY_LENGTH(default_colortable_mono)); @@ -239,12 +243,14 @@ void ppu2c0x_device::device_start() for (int i = 0; i < ARRAY_LENGTH(default_colortable_mono); i++) { /* monochromatic table */ - m_colortable_mono[i] = default_colortable_mono[i] + m_color_base; + m_colortable_mono[i] = default_colortable_mono[i]; /* color table */ - m_colortable[i] = default_colortable[i] + m_color_base; + m_colortable[i] = default_colortable[i]; } + init_palette(); + // register for state saving save_item(NAME(m_scanline)); save_item(NAME(m_refresh_data)); @@ -305,12 +311,12 @@ inline void ppu2c0x_device::writebyte(offs_t address, uint8_t data) * *************************************/ -void ppu2c0x_device::init_palette(palette_device &palette, int first_entry) +void ppu2c0x_device::init_palette() { - init_palette(palette, first_entry, false); + init_palette(false); } -void ppu2c0x_device::init_palette(palette_device &palette, int first_entry, bool indirect) +void ppu2c0x_device::init_palette(bool indirect) { /* This routine builds a palette using a transformation from */ /* the YUV (Y, B-Y, R-Y) to the RGB color space */ @@ -319,17 +325,13 @@ void ppu2c0x_device::init_palette(palette_device &palette, int first_entry, bool /* 16 colors, with 4 luminance levels for each color */ /* The 16 colors circle around the YUV color space, */ - int color_intensity, color_num, color_emphasis; + const double tint = 0.22; /* adjust to taste */ + const double hue = 287.0; - double R, G, B; - - double tint = 0.22; /* adjust to taste */ - double hue = 287.0; - - double Kr = 0.2989; - double Kb = 0.1145; - double Ku = 2.029; - double Kv = 1.140; + const double Kr = 0.2989; + const double Kb = 0.1145; + const double Ku = 2.029; + const double Kv = 1.140; static const double brightness[3][4] = { @@ -338,8 +340,10 @@ void ppu2c0x_device::init_palette(palette_device &palette, int first_entry, bool { 0, 0.24, 0.47, 0.77 } }; + int entry = 0; + /* Loop through the emphasis modes (8 total) */ - for (color_emphasis = 0; color_emphasis < 8; color_emphasis++) + for (int color_emphasis = 0; color_emphasis < 8; color_emphasis++) { /* double r_mod = 0.0; @@ -360,10 +364,10 @@ void ppu2c0x_device::init_palette(palette_device &palette, int first_entry, bool */ /* loop through the 4 intensities */ - for (color_intensity = 0; color_intensity < 4; color_intensity++) + for (int color_intensity = 0; color_intensity < 4; color_intensity++) { /* loop through the 16 colors */ - for (color_num = 0; color_num < 16; color_num++) + for (int color_num = 0; color_num < 16; color_num++) { double sat; double y, u, v; @@ -397,9 +401,9 @@ void ppu2c0x_device::init_palette(palette_device &palette, int first_entry, bool v = sat * sin(rad); /* Transform to RGB */ - R = (y + Kv * v) * 255.0; - G = (y - (Kb * Ku * u + Kr * Kv * v) / (1 - Kb - Kr)) * 255.0; - B = (y + Ku * u) * 255.0; + double R = (y + Kv * v) * 255.0; + double G = (y - (Kb * Ku * u + Kr * Kv * v) / (1 - Kb - Kr)) * 255.0; + double B = (y + Ku * u) * 255.0; /* Clipping, in case of saturation */ if (R < 0) @@ -417,9 +421,9 @@ void ppu2c0x_device::init_palette(palette_device &palette, int first_entry, bool /* Round, and set the value */ if (indirect) - palette.set_indirect_color(first_entry++, rgb_t(floor(R + .5), floor(G + .5), floor(B + .5))); + set_indirect_color(entry++, rgb_t(floor(R + .5), floor(G + .5), floor(B + .5))); else - palette.set_pen_color(first_entry++, floor(R + .5), floor(G + .5), floor(B + .5)); + set_pen_color(entry++, floor(R + .5), floor(G + .5), floor(B + .5)); } } } @@ -427,24 +431,19 @@ void ppu2c0x_device::init_palette(palette_device &palette, int first_entry, bool /* color tables are modified at run-time, and are initialized on 'ppu2c0x_reset' */ } -void ppu2c0x_device::init_palette_rgb( palette_device &palette, int first_entry ) +void ppu2c0x_rgb_device::init_palette() { - int color_emphasis, color_num; - - int R, G, B; - - uint8_t *palette_data = machine().root_device().memregion("palette")->base(); - /* Loop through the emphasis modes (8 total) */ - for (color_emphasis = 0; color_emphasis < 8; color_emphasis++) + int entry = 0; + for (int color_emphasis = 0; color_emphasis < 8; color_emphasis++) { - for (color_num = 0; color_num < 64; color_num++) + for (int color_num = 0; color_num < 64; color_num++) { - R = ((color_emphasis & 1) ? 7 : palette_data[color_num * 3]); - G = ((color_emphasis & 2) ? 7 : palette_data[color_num * 3 + 1]); - B = ((color_emphasis & 4) ? 7 : palette_data[color_num * 3 + 2]); + int R = ((color_emphasis & 1) ? 7 : m_palette_data[color_num * 3]); + int G = ((color_emphasis & 2) ? 7 : m_palette_data[color_num * 3 + 1]); + int B = ((color_emphasis & 4) ? 7 : m_palette_data[color_num * 3 + 2]); - palette.set_pen_color(first_entry++, pal3bit(R), pal3bit(G), pal3bit(B)); + set_pen_color(entry++, pal3bit(R), pal3bit(G), pal3bit(B)); } } @@ -583,14 +582,14 @@ void ppu2c0x_device::shift_tile_plane_data(uint8_t &pix) m_planebuf[1] = m_planebuf[1] << 1; } -void ppu2c0x_device::draw_tile_pixel(uint8_t pix, int color, uint16_t back_pen, uint16_t *&dest, const pen_t *color_table) +void ppu2c0x_device::draw_tile_pixel(uint8_t pix, int color, pen_t back_pen, uint32_t *&dest, const pen_t *color_table) { - uint16_t pen; + pen_t pen; if (pix) { const pen_t *paldata = &color_table[4 * color]; - pen = paldata[pix]; + pen = this->pen(paldata[pix]); } else { @@ -600,7 +599,7 @@ void ppu2c0x_device::draw_tile_pixel(uint8_t pix, int color, uint16_t back_pen, *dest = pen; } -void ppu2c0x_device::draw_tile(uint8_t *line_priority, int color_byte, int color_bits, int address, int start_x, uint16_t back_pen, uint16_t *&dest, const pen_t *color_table) +void ppu2c0x_device::draw_tile(uint8_t *line_priority, int color_byte, int color_bits, int address, int start_x, pen_t back_pen, uint32_t *&dest, const pen_t *color_table) { int color = (((color_byte >> color_bits) & 0x03)); @@ -624,12 +623,10 @@ void ppu2c0x_device::draw_tile(uint8_t *line_priority, int color_byte, int color } } -void ppu2c0x_device::draw_background( uint8_t *line_priority ) +void ppu2c0x_device::draw_background(uint8_t *line_priority) { - bitmap_ind16 &bitmap = *m_bitmap; + bitmap_rgb32 &bitmap = *m_bitmap; int start_x = (m_x_fine ^ 0x07) - 7; - uint16_t back_pen; - uint16_t *dest; uint8_t scroll_x_coarse, scroll_y_coarse, scroll_y_fine, color_mask; int x, tile_index, i; @@ -651,7 +648,7 @@ void ppu2c0x_device::draw_background( uint8_t *line_priority ) } /* cache the background pen */ - back_pen = (m_back_color & color_mask) + m_color_base; + pen_t back_pen = pen(m_back_color & color_mask); /* determine where in the nametable to start drawing from */ /* based on the current scanline and scroll regs */ @@ -665,7 +662,7 @@ void ppu2c0x_device::draw_background( uint8_t *line_priority ) tile_index = ((m_refresh_data & 0xc00) | 0x2000) + scroll_y_coarse * 32; /* set up dest */ - dest = &bitmap.pix16(m_scanline, start_x); + uint32_t *dest = &bitmap.pix32(m_scanline, start_x); /* draw the 32 or 33 tiles that make up a line */ while (m_tilecount < 34) @@ -721,7 +718,7 @@ void ppu2c0x_device::draw_background( uint8_t *line_priority ) /* if the left 8 pixels for the background are off, blank 'em */ if (!(m_regs[PPU_CONTROL1] & PPU_CONTROL1_BACKGROUND_L8)) { - dest = &bitmap.pix16(m_scanline); + dest = &bitmap.pix32(m_scanline); for (i = 0; i < 8; i++) { *(dest++) = back_pen; @@ -752,10 +749,10 @@ void ppu2c0x_device::make_sprite_pixel_data(uint8_t &pixel_data, int flipx) } } -void ppu2c0x_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_ind16& bitmap) +void ppu2c0x_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_rgb32 &bitmap) { const pen_t *paldata = &m_colortable[4 * color]; - bitmap.pix16(m_scanline, sprite_xpos + pixel) = paldata[pixel_data]; + bitmap.pix32(m_scanline, sprite_xpos + pixel) = pen(paldata[pixel_data]); } void ppu2c0x_device::read_extra_sprite_bits(int sprite_index) @@ -763,9 +760,9 @@ void ppu2c0x_device::read_extra_sprite_bits(int sprite_index) // needed for some clones } -void ppu2c0x_device::draw_sprites( uint8_t *line_priority ) +void ppu2c0x_device::draw_sprites(uint8_t *line_priority) { - bitmap_ind16 &bitmap = *m_bitmap; + bitmap_rgb32 &bitmap = *m_bitmap; int sprite_xpos, sprite_ypos, sprite_index; int tile, index1; @@ -934,7 +931,7 @@ void ppu2c0x_device::draw_sprites( uint8_t *line_priority ) * *************************************/ -void ppu2c0x_device::render_scanline( void ) +void ppu2c0x_device::render_scanline() { uint8_t line_priority[VISIBLE_SCREEN_WIDTH]; @@ -951,23 +948,17 @@ void ppu2c0x_device::render_scanline( void ) draw_background(line_priority); else { - bitmap_ind16 &bitmap = *m_bitmap; - uint8_t color_mask; - uint16_t back_pen; - int i; + bitmap_rgb32 &bitmap = *m_bitmap; /* setup the color mask and colortable to use */ - if (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) - color_mask = 0xf0; - else - color_mask = 0xff; + uint8_t color_mask = (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) ? 0xf0 : 0xff; /* cache the background pen */ - back_pen = (m_back_color & color_mask) + m_color_base; + pen_t back_pen = pen(m_back_color & color_mask); // Fill this scanline with the background pen. - for (i = 0; i < bitmap.width(); i++) - bitmap.pix16(m_scanline, i) = back_pen; + for (int i = 0; i < bitmap.width(); i++) + bitmap.pix32(m_scanline, i) = back_pen; } m_draw_phase = PPU_DRAW_OAM; @@ -981,7 +972,7 @@ void ppu2c0x_device::render_scanline( void ) g_profiler.stop(); } -void ppu2c0x_device::update_scanline( void ) +void ppu2c0x_device::update_scanline() { if (m_scanline <= BOTTOM_VISIBLE_SCANLINE) { @@ -998,16 +989,11 @@ void ppu2c0x_device::update_scanline( void ) } else { - bitmap_ind16 &bitmap = *m_bitmap; - uint8_t color_mask; - uint16_t back_pen; - int i; + bitmap_rgb32 &bitmap = *m_bitmap; + pen_t back_pen; /* setup the color mask and colortable to use */ - if (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) - color_mask = 0xf0; - else - color_mask = 0xff; + uint8_t color_mask = (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) ? 0xf0 : 0xff; /* cache the background pen */ if (m_videomem_addr >= 0x3f00) @@ -1016,21 +1002,16 @@ void ppu2c0x_device::update_scanline( void ) // both the sprites and background are disabled, the PPU paints the scanline // with the palette entry at the VRAM address instead of the usual background // pen. Micro Machines makes use of this feature. - int pen_num; + int pen_num = m_palette_ram[(m_videomem_addr & 0x03) ? (m_videomem_addr & 0x1f) : 0]; - if (m_videomem_addr & 0x03) - pen_num = m_palette_ram[m_videomem_addr & 0x1f]; - else - pen_num = m_palette_ram[0]; - - back_pen = pen_num + m_color_base; + back_pen = pen(pen_num); } else - back_pen = (m_back_color & color_mask) + m_color_base; + back_pen = pen(m_back_color & color_mask); // Fill this scanline with the background pen. - for (i = 0; i < bitmap.width(); i++) - bitmap.pix16(m_scanline, i) = back_pen; + for (int i = 0; i < bitmap.width(); i++) + bitmap.pix32(m_scanline, i) = back_pen; } /* increment the fine y-scroll */ @@ -1063,7 +1044,6 @@ void ppu2c0x_device::update_scanline( void ) WRITE8_MEMBER( ppu2c0x_device::palette_write ) { - int color_base = m_color_base; int color_emphasis = (m_regs[PPU_CONTROL1] & PPU_CONTROL1_COLOR_EMPHASIS) * 2; // palette RAM is only 6 bits wide @@ -1073,8 +1053,8 @@ WRITE8_MEMBER( ppu2c0x_device::palette_write ) if (offset & 0x3) { m_palette_ram[offset & 0x1f] = data; - m_colortable[offset & 0x1f] = color_base + data + color_emphasis; - m_colortable_mono[offset & 0x1f] = color_base + (data & 0xf0) + color_emphasis; + m_colortable[offset & 0x1f] = data + color_emphasis; + m_colortable_mono[offset & 0x1f] = (data & 0xf0) + color_emphasis; } else { @@ -1084,8 +1064,8 @@ WRITE8_MEMBER( ppu2c0x_device::palette_write ) m_back_color = data; for (i = 0; i < 32; i += 4) { - m_colortable[i] = color_base + data + color_emphasis; - m_colortable_mono[i] = color_base + (data & 0xf0) + color_emphasis; + m_colortable[i] = data + color_emphasis; + m_colortable_mono[i] = (data & 0xf0) + color_emphasis; } } m_palette_ram[offset & 0xf] = m_palette_ram[(offset & 0xf) + 0x10] = data; @@ -1173,10 +1153,6 @@ READ8_MEMBER( ppu2c0x_device::read ) WRITE8_MEMBER( ppu2c0x_device::write ) { - int color_base; - - color_base = m_color_base; - if (offset >= PPU_MAX_REG) { logerror("PPU %s: Attempting to write past the chip: offset %x, data %x\n", this->tag(), offset, data); @@ -1220,7 +1196,7 @@ WRITE8_MEMBER( ppu2c0x_device::write ) { uint8_t oldColor = m_palette_ram[i]; - m_colortable[i] = color_base + oldColor + (data & PPU_CONTROL1_COLOR_EMPHASIS) * 2; + m_colortable[i] = oldColor + (data & PPU_CONTROL1_COLOR_EMPHASIS) * 2; } } @@ -1355,18 +1331,24 @@ void ppu2c0x_device::spriteram_dma( address_space &space, const uint8_t page ) * *************************************/ -void ppu2c0x_device::render( bitmap_ind16 &bitmap, int flipx, int flipy, int sx, int sy ) +void ppu2c0x_device::render(bitmap_rgb32 &bitmap, int flipx, int flipy, int sx, int sy) { copybitmap(bitmap, *m_bitmap, flipx, flipy, sx, sy, bitmap.cliprect()); } +uint32_t ppu2c0x_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + render(bitmap, 0, 0, 0, 0); + return 0; +} + /************************************* * * Utility functions * *************************************/ -int ppu2c0x_device::get_pixel( int x, int y ) +rgb_t ppu2c0x_device::get_pixel(int x, int y) { if (x >= VISIBLE_SCREEN_WIDTH) x = VISIBLE_SCREEN_WIDTH - 1; @@ -1374,5 +1356,5 @@ int ppu2c0x_device::get_pixel( int x, int y ) if (y >= VISIBLE_SCREEN_HEIGHT) y = VISIBLE_SCREEN_HEIGHT - 1; - return m_bitmap->pix16(y, x); + return rgb_t(m_bitmap->pix32(y, x)); } diff --git a/src/devices/video/ppu2c0x.h b/src/devices/video/ppu2c0x.h index a516cbb5a2a..100d557e748 100644 --- a/src/devices/video/ppu2c0x.h +++ b/src/devices/video/ppu2c0x.h @@ -61,9 +61,6 @@ #define MCFG_PPU2C0X_CPU(_tag) \ downcast(*device).set_cpu_tag(_tag); -#define MCFG_PPU2C0X_COLORBASE(_color) \ - downcast(*device).set_color_base(_color); - #define MCFG_PPU2C0X_SET_NMI(_class, _method) \ downcast(*device).set_nmi_delegate(ppu2c0x_device::nmi_delegate(&_class::_method, #_class "::" #_method, nullptr, (_class *)nullptr)); @@ -78,7 +75,8 @@ class ppu2c0x_device : public device_t, public device_memory_interface, - public device_video_interface + public device_video_interface, + public device_palette_interface { public: typedef device_delegate scanline_delegate; @@ -108,47 +106,46 @@ public: virtual DECLARE_WRITE8_MEMBER( palette_write ); void set_cpu_tag(const char *tag) { m_cpu.set_tag(tag); } - void set_color_base(int colorbase) { m_color_base = colorbase; } template void set_nmi_delegate(Object &&cb) { m_nmi_callback_proc = std::forward(cb); } /* routines */ - virtual void init_palette(palette_device &palette, int first_entry); - void init_palette(palette_device &palette, int first_entry, bool indirect); - void init_palette_rgb(palette_device &palette, int first_entry); + virtual void init_palette(); + void init_palette(bool indirect); + virtual uint32_t palette_entries() const override { return 4*16*8; } virtual void read_tile_plane_data(int address, int color); virtual void shift_tile_plane_data(uint8_t &pix); - virtual void draw_tile_pixel(uint8_t pix, int color, uint16_t back_pen, uint16_t *&dest, const pen_t *color_table); - virtual void draw_tile(uint8_t *line_priority, int color_byte, int color_bits, int address, int start_x, uint16_t back_pen, uint16_t *&dest, const pen_t *color_table); + virtual void draw_tile_pixel(uint8_t pix, int color, pen_t back_pen, uint32_t *&dest, const pen_t *color_table); + virtual void draw_tile(uint8_t *line_priority, int color_byte, int color_bits, int address, int start_x, pen_t back_pen, uint32_t *&dest, const pen_t *color_table); void draw_background( uint8_t *line_priority ); virtual void read_sprite_plane_data(int address); virtual void make_sprite_pixel_data(uint8_t &pixel_data, int flipx); - virtual void draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_ind16& bitmap); + virtual void draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_rgb32 &bitmap); virtual void read_extra_sprite_bits(int sprite_index); - void draw_sprites( uint8_t *line_priority ); + void draw_sprites(uint8_t *line_priority); void render_scanline(); void update_scanline(); - void spriteram_dma(address_space &space, const uint8_t page ); - void render( bitmap_ind16 &bitmap, int flipx, int flipy, int sx, int sy ); - int get_pixel( int x, int y ); + void spriteram_dma(address_space &space, const uint8_t page); + void render(bitmap_rgb32 &bitmap, int flipx, int flipy, int sx, int sy); + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + rgb_t get_pixel(int x, int y); - int get_colorbase() { return m_color_base; }; - int get_current_scanline() { return m_scanline; }; - void set_scanline_callback( scanline_delegate &&cb ) { m_scanline_callback_proc = std::move(cb); m_scanline_callback_proc.bind_relative_to(*owner()); }; - void set_hblank_callback( hblank_delegate &&cb ) { m_hblank_callback_proc = std::move(cb); m_hblank_callback_proc.bind_relative_to(*owner()); }; - void set_vidaccess_callback( vidaccess_delegate &&cb ) { m_vidaccess_callback_proc = std::move(cb); m_vidaccess_callback_proc.bind_relative_to(*owner()); }; - void set_scanlines_per_frame( int scanlines ) { m_scanlines_per_frame = scanlines; }; + int get_current_scanline() { return m_scanline; } + void set_scanline_callback( scanline_delegate &&cb ) { m_scanline_callback_proc = std::move(cb); m_scanline_callback_proc.bind_relative_to(*owner()); } + void set_hblank_callback( hblank_delegate &&cb ) { m_hblank_callback_proc = std::move(cb); m_hblank_callback_proc.bind_relative_to(*owner()); } + void set_vidaccess_callback( vidaccess_delegate &&cb ) { m_vidaccess_callback_proc = std::move(cb); m_vidaccess_callback_proc.bind_relative_to(*owner()); } + void set_scanlines_per_frame( int scanlines ) { m_scanlines_per_frame = scanlines; } // MMC5 has to be able to check this - int is_sprite_8x16() { return m_regs[PPU_CONTROL0] & PPU_CONTROL0_SPRITE_SIZE; }; - int get_draw_phase() { return m_draw_phase; }; - int get_tilenum() { return m_tilecount; }; + int is_sprite_8x16() { return m_regs[PPU_CONTROL0] & PPU_CONTROL0_SPRITE_SIZE; } + int get_draw_phase() { return m_draw_phase; } + int get_tilenum() { return m_tilecount; } //27/12/2002 (HACK!) - void set_latch( latch_delegate &&cb ) { m_latch = std::move(cb); m_latch.bind_relative_to(*owner()); }; + void set_latch( latch_delegate &&cb ) { m_latch = std::move(cb); m_latch.bind_relative_to(*owner()); } // void update_screen(bitmap_t &bitmap, const rectangle &cliprect); @@ -227,7 +224,7 @@ private: inline uint8_t readbyte(offs_t address); inline void writebyte(offs_t address, uint8_t data); - std::unique_ptr m_bitmap; /* target bitmap */ + std::unique_ptr m_bitmap; /* target bitmap */ std::unique_ptr m_colortable; /* color table modified at run time */ std::unique_ptr m_colortable_mono; /* monochromatic color table modified at run time */ @@ -248,7 +245,6 @@ private: int m_tile_page; /* current tile page */ int m_sprite_page; /* current sprite page */ int m_back_color; /* background color */ - int m_color_base; uint8_t m_palette_ram[0x20]; /* shouldn't be in main memory! */ int m_scan_scale; /* scan scale */ int m_tilecount; /* MMC5 can change attributes to subsets of the 34 visible tiles */ @@ -263,17 +259,27 @@ private: bool m_use_sprite_write_limitation; }; +class ppu2c0x_rgb_device : public ppu2c0x_device { +protected: + ppu2c0x_rgb_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + virtual void init_palette() override; + +private: + required_region_ptr m_palette_data; +}; + class ppu2c02_device : public ppu2c0x_device { public: ppu2c02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; -class ppu2c03b_device : public ppu2c0x_device { +class ppu2c03b_device : public ppu2c0x_rgb_device { public: ppu2c03b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; -class ppu2c04_device : public ppu2c0x_device { +class ppu2c04_device : public ppu2c0x_rgb_device { public: ppu2c04_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; @@ -288,22 +294,22 @@ public: ppupalc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; -class ppu2c05_01_device : public ppu2c0x_device { +class ppu2c05_01_device : public ppu2c0x_rgb_device { public: ppu2c05_01_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; -class ppu2c05_02_device : public ppu2c0x_device { +class ppu2c05_02_device : public ppu2c0x_rgb_device { public: ppu2c05_02_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; -class ppu2c05_03_device : public ppu2c0x_device { +class ppu2c05_03_device : public ppu2c0x_rgb_device { public: ppu2c05_03_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; -class ppu2c05_04_device : public ppu2c0x_device { +class ppu2c05_04_device : public ppu2c0x_rgb_device { public: ppu2c05_04_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; diff --git a/src/devices/video/ppu2c0x_vt.cpp b/src/devices/video/ppu2c0x_vt.cpp index 7ef5847131e..1fab5cba1f3 100644 --- a/src/devices/video/ppu2c0x_vt.cpp +++ b/src/devices/video/ppu2c0x_vt.cpp @@ -43,20 +43,20 @@ READ8_MEMBER(ppu_vt03_device::palette_read) void ppu_vt03_device::set_new_pen(int i) { if((i < 0x20) && ((i & 0x3) == 0)) { - m_palette->set_pen_color(i & 0x7f, rgb_t(0, 0, 0)); + set_pen_color(i & 0x7f, rgb_t(0, 0, 0)); } else { if(m_pal_mode == PAL_MODE_NEW_RGB) { uint16_t rgbval = (m_newpal[i&0x7f] & 0xff) | ((m_newpal[(i&0x7f)+0x80] & 0xff)<<8); uint8_t blue = (rgbval & 0x001f) << 3; uint8_t green = (rgbval & 0x3e0) >> 2; uint8_t red = (rgbval & 0x7C00) >> 7; - m_palette->set_pen_color(i & 0x7f, rgb_t(red, green, blue)); + set_pen_color(i & 0x7f, rgb_t(red, green, blue)); } else if(m_pal_mode == PAL_MODE_NEW_RGB12) { uint16_t rgbval = (m_newpal[i&0x7f] & 0x3f) | ((m_newpal[(i&0x7f)+0x80] & 0x3f)<<6); uint8_t red = (rgbval & 0x000f) << 4; uint8_t green = (rgbval & 0x0f0); uint8_t blue = (rgbval & 0xf00) >> 4; - m_palette->set_pen_color(i & 0x7f, rgb_t(red, green, blue)); + set_pen_color(i & 0x7f, rgb_t(red, green, blue)); } else { // Credit to NewRisingSun uint16_t palval = (m_newpal[i&0x7f] & 0x3f) | ((m_newpal[(i&0x7f)+0x80] & 0x3f)<<6); @@ -107,7 +107,7 @@ void ppu_vt03_device::set_new_pen(int i) int GV = G *255.0; int BV = B *255.0; - m_palette->set_pen_color(i & 0x7f, rgb_t(RV, GV ,BV)); + set_pen_color(i & 0x7f, rgb_t(RV, GV ,BV)); } } @@ -143,11 +143,10 @@ READ8_MEMBER( ppu_vt03_device::read ) } } -void ppu_vt03_device::init_palette(palette_device &palette, int first_entry) +void ppu_vt03_device::init_palette() { // todo, work out the format of the 12 palette bits instead of just calling the main init - m_palette = &palette; - ppu2c0x_device::init_palette(palette, first_entry, true); + ppu2c0x_device::init_palette(true); } void ppu_vt03_device::device_start() @@ -185,7 +184,7 @@ void ppu_vt03_device::device_reset() for (int i = 0;i < 0x20;i++) set_201x_reg(i, 0x00); - init_palette(*m_palette, 0); + init_palette(); m_read_bg4_bg3 = 0; m_va34 = 0; @@ -250,7 +249,7 @@ void ppu_vt03_device::make_sprite_pixel_data(uint8_t &pixel_data, int flipx) } } -void ppu_vt03_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_ind16& bitmap) +void ppu_vt03_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_rgb32 &bitmap) { int is4bpp = get_201x_reg(0x0) & 0x04; int is16pix = get_201x_reg(0x0) & 0x01; @@ -259,7 +258,7 @@ void ppu_vt03_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, u { if (!is16pix) { - bitmap.pix16(m_scanline, sprite_xpos + pixel) = pixel_data + (4 * color); + bitmap.pix32(m_scanline, sprite_xpos + pixel) = pen(pixel_data + (4 * color)); } else { @@ -267,9 +266,9 @@ void ppu_vt03_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, u we probably need to split them out again and draw them at xpos+8 with a cliprect - not seen used yet */ if((pixel_data & 0x03) != 0) - bitmap.pix16(m_scanline, sprite_xpos + pixel) = (pixel_data & 0x03) + (4 * color); + bitmap.pix32(m_scanline, sprite_xpos + pixel) = pen((pixel_data & 0x03) + (4 * color)); if(((pixel_data >> 5) & 0x03) != 0) - bitmap.pix16(m_scanline, sprite_xpos + pixel + 8) = ((pixel_data >> 5) & 0x03) + (4 * color); + bitmap.pix32(m_scanline, sprite_xpos + pixel + 8) = pen(((pixel_data >> 5) & 0x03) + (4 * color)); //ppu2c0x_device::draw_sprite_pixel(sprite_xpos, color, pixel, pixel_data & 0x03, bitmap); //ppu2c0x_device::draw_sprite_pixel(sprite_xpos, color, pixel + 8, (pixel_data >> 5) & 0x03, bitmap); } @@ -320,7 +319,7 @@ void ppu_vt03_device::shift_tile_plane_data(uint8_t &pix) } } -void ppu_vt03_device::draw_tile_pixel(uint8_t pix, int color, uint16_t back_pen, uint16_t *&dest, const pen_t *color_table) +void ppu_vt03_device::draw_tile_pixel(uint8_t pix, int color, pen_t back_pen, uint32_t *&dest, const pen_t *color_table) { int is4bpp = get_201x_reg(0x0) & 0x02; @@ -350,7 +349,7 @@ void ppu_vt03_device::draw_tile_pixel(uint8_t pix, int color, uint16_t back_pen, { pen = 0; // fixme backpen logic probably differs on vt03 due to extra colours } - *dest = pen; + *dest = this->pen(pen); } } @@ -388,7 +387,7 @@ void ppu_vt03_device::set_2010_reg(uint8_t data) { for (int i = 0;i < 256;i++) { - m_palette->set_pen_indirect(i, i); + set_pen_indirect(i, i); } } } diff --git a/src/devices/video/ppu2c0x_vt.h b/src/devices/video/ppu2c0x_vt.h index b7a8c68be86..15fe349ddcd 100644 --- a/src/devices/video/ppu2c0x_vt.h +++ b/src/devices/video/ppu2c0x_vt.h @@ -56,15 +56,17 @@ public: virtual DECLARE_READ8_MEMBER(palette_read) override; virtual DECLARE_WRITE8_MEMBER(palette_write) override; - virtual void init_palette( palette_device &palette, int first_entry ) override; + virtual uint32_t palette_entries() const override { return 256; } + virtual uint32_t palette_indirect_entries() const override { return 4*16*8; } + virtual void init_palette() override; virtual void read_tile_plane_data(int address, int color) override; virtual void shift_tile_plane_data(uint8_t &pix) override; - virtual void draw_tile_pixel(uint8_t pix, int color, uint16_t back_pen, uint16_t *&dest, const pen_t *color_table) override; + virtual void draw_tile_pixel(uint8_t pix, int color, pen_t back_pen, uint32_t *&dest, const pen_t *color_table) override; virtual void read_sprite_plane_data(int address) override; virtual void make_sprite_pixel_data(uint8_t &pixel_data, int flipx) override; - virtual void draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_ind16& bitmap) override; + virtual void draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_rgb32 &bitmap) override; virtual void read_extra_sprite_bits(int sprite_index) override; virtual void device_start() override; @@ -89,8 +91,6 @@ private: uint8_t m_extplanebuf[2]; uint8_t m_extra_sprite_bits; - palette_device *m_palette; - uint8_t m_201x_regs[0x20]; uint8_t m_2012_2017_descramble[0x6]; diff --git a/src/mame/drivers/cham24.cpp b/src/mame/drivers/cham24.cpp index cc8f9705425..b452734b235 100644 --- a/src/mame/drivers/cham24.cpp +++ b/src/mame/drivers/cham24.cpp @@ -91,8 +91,6 @@ public: virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; - DECLARE_PALETTE_INIT(cham24); - uint32_t screen_update_cham24(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void cham24_set_mirroring( int mirroring ); void ppu_irq(int *ppu_regs); void cham24(machine_config &config); @@ -254,11 +252,6 @@ static INPUT_PORTS_START( cham24 ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) INPUT_PORTS_END -PALETTE_INIT_MEMBER(cham24_state, cham24) -{ - m_ppu->init_palette(palette, 0); -} - void cham24_state::ppu_irq(int *ppu_regs) { m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); @@ -268,13 +261,6 @@ void cham24_state::video_start() { } -uint32_t cham24_state::screen_update_cham24(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - /* render the ppu */ - m_ppu->render(bitmap, 0, 0, 0, 0); - return 0; -} - void cham24_state::machine_start() { @@ -308,10 +294,6 @@ DRIVER_INIT_MEMBER(cham24_state,cham24) { } -static GFXDECODE_START( cham24 ) - /* none, the ppu generates one */ -GFXDECODE_END - MACHINE_CONFIG_START(cham24_state::cham24) /* basic machine hardware */ MCFG_DEVICE_ADD("maincpu", N2A03, NTSC_APU_CLOCK) @@ -322,14 +304,9 @@ MACHINE_CONFIG_START(cham24_state::cham24) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_SIZE(32*8, 262) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(cham24_state, screen_update_cham24) - MCFG_SCREEN_PALETTE("palette") + MCFG_SCREEN_UPDATE_DEVICE("ppu", ppu2c0x_device, screen_update) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", cham24) - MCFG_PALETTE_ADD("palette", 8*4*16) - MCFG_PALETTE_INIT_OWNER(cham24_state, cham24) - - MCFG_PPU2C04_ADD("ppu") + MCFG_PPU2C02_ADD("ppu") MCFG_PPU2C0X_CPU("maincpu") MCFG_PPU2C0X_SET_NMI(cham24_state, ppu_irq) diff --git a/src/mame/drivers/famibox.cpp b/src/mame/drivers/famibox.cpp index 18fee71f6da..c2b5bc27174 100644 --- a/src/mame/drivers/famibox.cpp +++ b/src/mame/drivers/famibox.cpp @@ -112,8 +112,6 @@ public: virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; - DECLARE_PALETTE_INIT(famibox); - uint32_t screen_update_famibox(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(famicombox_attract_timer_callback); TIMER_CALLBACK_MEMBER(famicombox_gameplay_timer_callback); void famicombox_bankswitch(uint8_t bank); @@ -494,11 +492,6 @@ INPUT_PORTS_END *******************************************************/ -PALETTE_INIT_MEMBER(famibox_state, famibox) -{ - m_ppu->init_palette(palette, 0); -} - void famibox_state::ppu_irq(int *ppu_regs) { m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); @@ -508,17 +501,6 @@ void famibox_state::video_start() { } -uint32_t famibox_state::screen_update_famibox(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - /* render the ppu */ - m_ppu->render(bitmap, 0, 0, 0, 0); - return 0; -} - -static GFXDECODE_START( famibox ) - /* none, the ppu generates one */ -GFXDECODE_END - void famibox_state::machine_reset() { famicombox_bankswitch(0); @@ -557,14 +539,9 @@ MACHINE_CONFIG_START(famibox_state::famibox) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_SIZE(32*8, 262) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(famibox_state, screen_update_famibox) - MCFG_SCREEN_PALETTE("palette") + MCFG_SCREEN_UPDATE_DEVICE("ppu", ppu2c0x_device, screen_update) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", famibox) - MCFG_PALETTE_ADD("palette", 8*4*16) - MCFG_PALETTE_INIT_OWNER(famibox_state, famibox) - - MCFG_PPU2C04_ADD("ppu") + MCFG_PPU2C02_ADD("ppu") MCFG_PPU2C0X_CPU("maincpu") MCFG_PPU2C0X_SET_NMI(famibox_state, ppu_irq) diff --git a/src/mame/drivers/multigam.cpp b/src/mame/drivers/multigam.cpp index 69a90357875..fb4404f570a 100644 --- a/src/mame/drivers/multigam.cpp +++ b/src/mame/drivers/multigam.cpp @@ -193,7 +193,6 @@ public: DECLARE_MACHINE_START(multigm3); DECLARE_MACHINE_RESET(multigm3); DECLARE_MACHINE_START(supergm3); - uint32_t screen_update_multigam(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(mmc1_resync_callback); void set_videorom_bank( int start, int count, int bank, int bank_size_in_kb); void set_videoram_bank( int start, int count, int bank, int bank_size_in_kb); @@ -1133,11 +1132,6 @@ INPUT_PORTS_END *******************************************************/ -PALETTE_INIT_MEMBER(multigam_state, multigam) -{ - m_ppu->init_palette(palette, 0); -} - void multigam_state::ppu_irq(int *ppu_regs) { m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); @@ -1147,17 +1141,6 @@ void multigam_state::video_start() { } -uint32_t multigam_state::screen_update_multigam(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - /* render the ppu */ - m_ppu->render(bitmap, 0, 0, 0, 0); - return 0; -} - -static GFXDECODE_START( multigam ) - /* none, the ppu generates one */ -GFXDECODE_END - /****************************************************** Machine @@ -1234,14 +1217,9 @@ MACHINE_CONFIG_START(multigam_state::multigam) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_SIZE(32*8, 262) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(multigam_state, screen_update_multigam) - MCFG_SCREEN_PALETTE("palette") + MCFG_SCREEN_UPDATE_DEVICE("ppu", ppu2c0x_device, screen_update) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", multigam) - MCFG_PALETTE_ADD("palette", 8*4*16) - MCFG_PALETTE_INIT_OWNER(multigam_state, multigam) - - MCFG_PPU2C04_ADD("ppu") + MCFG_PPU2C02_ADD("ppu") MCFG_PPU2C0X_CPU("maincpu") MCFG_PPU2C0X_SET_NMI(multigam_state, ppu_irq) diff --git a/src/mame/drivers/nes.cpp b/src/mame/drivers/nes.cpp index 74953435352..4fe503f5348 100644 --- a/src/mame/drivers/nes.cpp +++ b/src/mame/drivers/nes.cpp @@ -70,10 +70,6 @@ MACHINE_CONFIG_START(nes_state::nes) MCFG_SCREEN_SIZE(32*8, 262) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) MCFG_SCREEN_UPDATE_DRIVER(nes_state, screen_update_nes) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 4*16*8) - MCFG_PALETTE_INIT_OWNER(nes_state, nes) MCFG_PPU2C02_ADD("ppu") MCFG_PPU2C0X_CPU("maincpu") diff --git a/src/mame/drivers/nes_vt.cpp b/src/mame/drivers/nes_vt.cpp index 6ba9435b1df..e3f603404b1 100644 --- a/src/mame/drivers/nes_vt.cpp +++ b/src/mame/drivers/nes_vt.cpp @@ -116,8 +116,6 @@ public: DECLARE_WRITE8_MEMBER(nes_vh_sprite_dma_w); DECLARE_WRITE8_MEMBER(vt_hh_sprite_dma_w); void ppu_nmi(int *ppu_regs); - uint32_t screen_update_vt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_PALETTE_INIT(nesvt); /* VT03 extension handling */ DECLARE_WRITE8_MEMBER(vt03_410x_w); @@ -575,13 +573,6 @@ READ8_MEMBER(nes_vt_state::vthh_414a_r) } -uint32_t nes_vt_state::screen_update_vt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - // render the ppu - m_ppu->render(bitmap, 0, 0, 0, 0); - return 0; -} - READ8_MEMBER(nes_vt_state::spr_r) { if(m_4242 & 0x1 || m_411d & 0x04) { @@ -628,11 +619,6 @@ WRITE8_MEMBER(nes_vt_state::vtfp_4a00_w) { } -PALETTE_INIT_MEMBER(nes_vt_state, nesvt) -{ - m_ppu->init_palette(palette, 0); -} - void nes_vt_state::scanline_irq(int scanline, int vblank, int blanked) { video_irq(false, scanline, vblank, blanked); @@ -1379,14 +1365,9 @@ MACHINE_CONFIG_START(nes_vt_state::nes_vt) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((113.66/(NTSC_APU_CLOCK.dvalue()/1000000)) * (ppu2c0x_device::VBLANK_LAST_SCANLINE_NTSC-ppu2c0x_device::VBLANK_FIRST_SCANLINE+1+2))) MCFG_SCREEN_SIZE(32*8, 262) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(nes_vt_state, screen_update_vt) - MCFG_SCREEN_PALETTE("palette") + MCFG_SCREEN_UPDATE_DEVICE("ppu", ppu2c0x_device, screen_update) - MCFG_GFXDECODE_ADD("gfxdecode", "palette", vt03_helper) - - MCFG_PALETTE_ADD("palette", 256) - MCFG_PALETTE_INIT_OWNER(nes_vt_state, nesvt) - MCFG_PALETTE_INDIRECT_ENTRIES(4*16*8) + MCFG_GFXDECODE_ADD("gfxdecode", "ppu", vt03_helper) MCFG_PPU_VT03_ADD("ppu") MCFG_PPU2C0X_CPU("maincpu") diff --git a/src/mame/drivers/playch10.cpp b/src/mame/drivers/playch10.cpp index 807f48e2669..e0de3a1fb22 100644 --- a/src/mame/drivers/playch10.cpp +++ b/src/mame/drivers/playch10.cpp @@ -670,7 +670,7 @@ MACHINE_CONFIG_START(playch10_state::playch10) // video hardware MCFG_GFXDECODE_ADD("gfxdecode", "palette", playch10) - MCFG_PALETTE_ADD("palette", 256+8*4*16) + MCFG_PALETTE_ADD("palette", 256) MCFG_PALETTE_INIT_OWNER(playch10_state, playch10) MCFG_DEFAULT_LAYOUT(layout_playch10) @@ -679,7 +679,6 @@ MACHINE_CONFIG_START(playch10_state::playch10) MCFG_SCREEN_SIZE(32*8, 262) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) MCFG_SCREEN_UPDATE_DRIVER(playch10_state, screen_update_playch10_top) - MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, playch10_state, vblank_irq)) MCFG_SCREEN_ADD("bottom", RASTER) @@ -687,12 +686,10 @@ MACHINE_CONFIG_START(playch10_state::playch10) MCFG_SCREEN_SIZE(32*8, 262) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) MCFG_SCREEN_UPDATE_DRIVER(playch10_state, screen_update_playch10_bottom) - MCFG_SCREEN_PALETTE("palette") MCFG_PPU2C03B_ADD("ppu") MCFG_PPU2C0X_SET_SCREEN("bottom") MCFG_PPU2C0X_CPU("cart") - MCFG_PPU2C0X_COLORBASE(256) MCFG_PPU2C0X_SET_NMI(playch10_state, ppu_irq) MCFG_SPEAKER_STANDARD_MONO("mono") @@ -754,7 +751,7 @@ MACHINE_CONFIG_END ROM_LOAD( "pch1-c-6f.82s129an.6f", 0x0000, 0x0100, CRC(e5414ca3) SHA1(d2878411cda84ffe0afb2e538a67457f51bebffb) ) \ ROM_LOAD( "pch1-c-6e.82s129an.6e", 0x0100, 0x0100, CRC(a2625c6e) SHA1(a448b47c9289902e26a3d3c4c7d5a7968c385e81) ) \ ROM_LOAD( "pch1-c-6d.82s129an.6d", 0x0200, 0x0100, CRC(1213ebd4) SHA1(0ad386fc3eab5e53c0288ad1de33639a9e461b7c) ) \ - ROM_REGION( 0xc0, "palette", 0 ) \ + ROM_REGION( 0xc0, "ppu:palette", 0 ) \ ROM_LOAD( "rp2c0x.pal", 0x00, 0xc0, CRC(48de65dc) SHA1(d10acafc8da9ff479c270ec01180cca61efe62f5) ) diff --git a/src/mame/drivers/vsnes.cpp b/src/mame/drivers/vsnes.cpp index ad9930584fa..3225ced3197 100644 --- a/src/mame/drivers/vsnes.cpp +++ b/src/mame/drivers/vsnes.cpp @@ -192,6 +192,17 @@ WRITE8_MEMBER(vsnes_state::vsnes_coin_counter_1_w) } } + +void vsnes_state::ppu_irq_1(int *ppu_regs) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); +} + +void vsnes_state::ppu_irq_2(int *ppu_regs) +{ + m_subcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); +} + /******************************************************************************/ @@ -1714,13 +1725,7 @@ MACHINE_CONFIG_START(vsnes_state::vsnes) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_SIZE(32*8, 262) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(vsnes_state, screen_update_vsnes) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 8*4*16) - - MCFG_PALETTE_INIT_OWNER(vsnes_state,vsnes) - MCFG_VIDEO_START_OVERRIDE(vsnes_state,vsnes) + MCFG_SCREEN_UPDATE_DEVICE("ppu1", ppu2c0x_device, screen_update) MCFG_PPU2C04_ADD("ppu1") MCFG_PPU2C0X_SET_SCREEN("screen1") @@ -1783,28 +1788,19 @@ MACHINE_CONFIG_START(vsnes_state::vsdual) MCFG_MACHINE_RESET_OVERRIDE(vsnes_state,vsdual) MCFG_MACHINE_START_OVERRIDE(vsnes_state,vsdual) - - /* video hardware */ - MCFG_PALETTE_ADD("palette", 2*8*4*16) - MCFG_PALETTE_INIT_OWNER(vsnes_state,vsdual) - MCFG_DEFAULT_LAYOUT(layout_dualhsxs) MCFG_SCREEN_ADD("screen1", RASTER) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_SIZE(32*8, 262) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(vsnes_state, screen_update_vsnes) - MCFG_SCREEN_PALETTE("palette") + MCFG_SCREEN_UPDATE_DEVICE("ppu1", ppu2c0x_device, screen_update) MCFG_SCREEN_ADD("screen2", RASTER) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_SIZE(32*8, 262) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(vsnes_state, screen_update_vsnes_bottom) - MCFG_SCREEN_PALETTE("palette") - - MCFG_VIDEO_START_OVERRIDE(vsnes_state,vsdual) + MCFG_SCREEN_UPDATE_DEVICE("ppu2", ppu2c0x_device, screen_update) MCFG_PPU2C04_ADD("ppu1") MCFG_PPU2C0X_SET_SCREEN("screen1") @@ -1814,7 +1810,6 @@ MACHINE_CONFIG_START(vsnes_state::vsdual) MCFG_PPU2C04_ADD("ppu2") MCFG_PPU2C0X_SET_SCREEN("screen2") MCFG_PPU2C0X_CPU("sub") - MCFG_PPU2C0X_COLORBASE(512) MCFG_PPU2C0X_SET_NMI(vsnes_state, ppu_irq_2) /* sound hardware */ @@ -1849,13 +1844,7 @@ MACHINE_CONFIG_START(vsnes_state::vsnes_bootleg) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_SIZE(32*8, 262) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(vsnes_state, screen_update_vsnes) - MCFG_SCREEN_PALETTE("palette") - - MCFG_PALETTE_ADD("palette", 8*4*16) - - MCFG_PALETTE_INIT_OWNER(vsnes_state,vsnes) - MCFG_VIDEO_START_OVERRIDE(vsnes_state,vsnes) + MCFG_SCREEN_UPDATE_DEVICE("ppu1", ppu2c0x_device, screen_update) MCFG_PPU2C04_ADD("ppu1") MCFG_PPU2C0X_CPU("maincpu") @@ -1886,26 +1875,27 @@ MACHINE_CONFIG_END on each PPU. */ -#define PALETTE_STANDARD \ - ROM_REGION( 0xc0, "palette", 0 ) \ +#define PALETTE_STANDARD(_tag) \ + ROM_REGION( 0xc0, _tag, 0 ) \ ROM_LOAD( "rp2c0x.pal", 0x00, 0xc0, CRC(48de65dc) SHA1(d10acafc8da9ff479c270ec01180cca61efe62f5) ) -#define PALETTE_2C04_0001 \ - ROM_REGION( 0xc0, "palette", 0 ) \ +#define PALETTE_2C04_0001(_tag) \ + ROM_REGION( 0xc0, _tag, 0 ) \ ROM_LOAD( "rp2c04-0001.pal", 0x00, 0xc0, CRC(a6293faa) SHA1(190a410a3d818e124b2b9d2ef9fb3da003bb5d4c) ) -#define PALETTE_2C04_0002 \ - ROM_REGION( 0xc0, "palette", 0 ) \ +#define PALETTE_2C04_0002(_tag) \ + ROM_REGION( 0xc0, _tag, 0 ) \ ROM_LOAD( "rp2c04-0002.pal", 0x00, 0xc0, CRC(fd19ae5e) SHA1(8ed14347c5a0b1a8a4d6365d6727e0951a00131c) ) -#define PALETTE_2C04_0003 \ - ROM_REGION( 0xc0, "palette", 0 ) \ +#define PALETTE_2C04_0003(_tag) \ + ROM_REGION( 0xc0, _tag, 0 ) \ ROM_LOAD( "rp2c04-0003.pal", 0x00, 0xc0, CRC(fd6c578b) SHA1(653182ce0cbaff66a8fc5788e32cc088b6735f2e) ) -#define PALETTE_2C04_0004 \ - ROM_REGION( 0xc0, "palette", 0 ) \ +#define PALETTE_2C04_0004(_tag) \ + ROM_REGION( 0xc0, _tag, 0 ) \ ROM_LOAD( "rp2c04-0004.pal", 0x00, 0xc0, CRC(0c2e8e4d) SHA1(0f9090225eb1f08ae5072d40af3e95547cbce05f) ) + /* correct label format. revision number is stamped(red), other letters are printed(black) game code in line 1, ROM position in line 2 i.e. @@ -1935,7 +1925,7 @@ ROM_START( suprmrio ) /* Vs. Super Mario Bros. (Set E Rev 4) */ ROM_LOAD( "mds-sm4-4__2bor8b_e.2b or 8b", 0x0000, 0x2000, CRC(42418d40) SHA1(22ab61589742cfa4cc6856f7205d7b4b8310bc4d) ) ROM_LOAD( "mds-sm4-4__2aor8a_e.2a or 8a", 0x2000, 0x2000, CRC(15506b86) SHA1(69ecf7a3cc8bf719c1581ec7c0d68798817d416f) ) - PALETTE_2C04_0004 + PALETTE_2C04_0004("ppu1:palette") ROM_END ROM_START( suprmrioa ) /* Vs. Super Mario Bros. (Set unknown, possibly operator hack of E rev 4 to make the game harder) */ @@ -1949,7 +1939,7 @@ ROM_START( suprmrioa ) /* Vs. Super Mario Bros. (Set unknown, possibly operator ROM_LOAD( "mds-sm4-4__2bor8b_e.2b or 8b", 0x0000, 0x2000, CRC(42418d40) SHA1(22ab61589742cfa4cc6856f7205d7b4b8310bc4d) ) ROM_LOAD( "mds-sm4-4__2aor8a_e.2a or 8a", 0x2000, 0x2000, CRC(15506b86) SHA1(69ecf7a3cc8bf719c1581ec7c0d68798817d416f) ) - PALETTE_2C04_0004 + PALETTE_2C04_0004("ppu1:palette") ROM_END @@ -1968,7 +1958,7 @@ ROM_START( suprmriobl2 ) ROM_LOAD( "2-2764.bin", 0x0000, 0x2000, CRC(42418d40) SHA1(22ab61589742cfa4cc6856f7205d7b4b8310bc4d) ) ROM_LOAD( "5-2764.bin", 0x2000, 0x2000, CRC(15506b86) SHA1(69ecf7a3cc8bf719c1581ec7c0d68798817d416f) ) - PALETTE_2C04_0004 + PALETTE_2C04_0004("ppu1:palette") ROM_END ROM_START( suprmriobl ) @@ -1999,7 +1989,7 @@ ROM_START( suprmriobl ) ROM_LOAD( "pal16r8.6", 0x000, 0x104, CRC(bd76fb53) SHA1(2d0634e8edb3289a103719466465e9777606086e) ) ROM_LOAD( "pal16r8a.7", 0x000, 0x104, CRC(bd76fb53) SHA1(2d0634e8edb3289a103719466465e9777606086e) ) - PALETTE_2C04_0004 + PALETTE_2C04_0004("ppu1:palette") ROM_END ROM_START( skatekds ) @@ -2013,7 +2003,7 @@ ROM_START( skatekds ) ROM_LOAD( "__skatekds,.2b", 0x0000, 0x2000,CRC(f3980303) SHA1(b9a25c906d1861c89e2e40e878a34d318daf6619) ) ROM_LOAD( "__skatekds,.2a", 0x2000, 0x2000,CRC(7a0ab7eb) SHA1(b6c32791481fafddc8504adb4eaed30a2fb3a03e) ) - PALETTE_2C04_0004 + PALETTE_2C04_0004("ppu1:palette") ROM_END ROM_START( iceclimb ) @@ -2027,7 +2017,7 @@ ROM_START( iceclimb ) ROM_LOAD( "mds-ic4-4 b.8b", 0x0000, 0x2000, CRC(331460b4) SHA1(4cf94d711cdb5715d14f1ab3cadec245e0adfb1e) ) /* Matches Ice Climber Dual screen rev A rom */ ROM_LOAD( "mds-ic4-4 b.8a", 0x2000, 0x2000, CRC(4ec44fb3) SHA1(676e0ab574dec08df562c6f278e8a9cc7c8afa41) ) /* Matches Ice Climber Dual screen rev A rom */ - PALETTE_2C04_0004 + PALETTE_2C04_0004("ppu1:palette") ROM_END ROM_START( iceclimba ) /* Version A? */ @@ -2041,7 +2031,7 @@ ROM_START( iceclimba ) /* Version A? */ ROM_LOAD( "mds-ic4-4 b.8b", 0x0000, 0x2000, CRC(331460b4) SHA1(4cf94d711cdb5715d14f1ab3cadec245e0adfb1e) ) /* Matches Ice Climber Dual screen rev A rom */ ROM_LOAD( "mds-ic4-4 b.8a", 0x2000, 0x2000, CRC(4ec44fb3) SHA1(676e0ab574dec08df562c6f278e8a9cc7c8afa41) ) /* Matches Ice Climber Dual screen rev A rom */ - PALETTE_2C04_0004 + PALETTE_2C04_0004("ppu1:palette") ROM_END /* Gun games */ @@ -2056,7 +2046,7 @@ ROM_START( duckhunt ) /* Vs. Duck Hunt (Set E) */ ROM_LOAD( "mds-dh3 e.2b or 8b", 0x0000, 0x2000, CRC(0c52ec28) SHA1(c8fb6a5d4c13a7075d313326e2da9ce88780a88d) ) ROM_LOAD( "mds-dh3 e.2a or 8a", 0x2000, 0x2000, CRC(3d238df3) SHA1(e868ef3d5357ef5294e4faeecc9dbf801c5253e8) ) - PALETTE_STANDARD + PALETTE_STANDARD("ppu1:palette") ROM_END ROM_START( hogalley ) @@ -2071,7 +2061,7 @@ ROM_START( hogalley ) // there is another dump of mds-ha4-1 e-1.2b or 8b ( CRC 0x7623e954 ) where 0xFE1 = 04, the dump we use is probably the correct one ROM_LOAD( "mds-ha4-1 e-1.2a or 8a", 0x2000, 0x2000, CRC(78c842b6) SHA1(39f2a7fc1f1cbe2378a369e45b5cbb05057db3f0) ) - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") ROM_END /* From Gumshoe readme: @@ -2097,7 +2087,7 @@ ROM_START( vsgshoe ) ROM_LOAD( "mds-gm5.2b", 0x0000, 0x2000, CRC(192c3360) SHA1(5ddbe007d8bc693a0b7c92f33e6ed6b27dc1c08e) ) ROM_LOAD( "mds-gm5.2a", 0x2000, 0x2000, CRC(823dd178) SHA1(77578a48ded0c244d1ae30aafaa9259b7dd0dfc4) ) - PALETTE_STANDARD + PALETTE_STANDARD("ppu1:palette") ROM_END ROM_START( vsfdf ) @@ -2108,7 +2098,7 @@ ROM_START( vsfdf ) ROM_REGION( 0x10000,"gfx1", 0 ) /* PPU memory */ ROM_LOAD( "cha2.1", 0x00000, 0x10000, CRC(a2f88df0) SHA1(10ef432d3132b01a1fcb38d8f521edd2a029ac5e) ) - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") ROM_END ROM_START( goonies ) /* Vs. The Goonies (Set E) */ @@ -2118,7 +2108,7 @@ ROM_START( goonies ) /* Vs. The Goonies (Set E) */ ROM_REGION( 0x10000,"gfx1", 0 ) /* PPU memory */ ROM_LOAD( "mds-gn chr e.u4", 0x0000, 0x10000, CRC(4c4b61b0) SHA1(7221c2499531e591a5a99e2cb339ae3a76b662c2) ) - PALETTE_2C04_0003 + PALETTE_2C04_0003("ppu1:palette") ROM_END ROM_START( vsgradus ) @@ -2128,7 +2118,7 @@ ROM_START( vsgradus ) ROM_REGION( 0x10000,"gfx1", 0 ) /* PPU memory */ ROM_LOAD( "mds-gr__chr_e.u4", 0x0000, 0x10000, CRC(23cf2fc3) SHA1(0a3f48aec529b92abc261952e632af7ff766b1ef) ) - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") ROM_END ROM_START( btlecity ) @@ -2143,7 +2133,7 @@ ROM_START( btlecity ) ROM_LOAD( "bc.2a", 0x2000, 0x2000, CRC(a9b49a05) SHA1(c14706e6a5524f81e79c101e32deef9f3d60de3f) ) /* also compatible with 2C04-0002, 2C04-0003, 2C04-0004 via dipswitches */ - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") ROM_END ROM_START( cluclu ) @@ -2157,7 +2147,7 @@ ROM_START( cluclu ) ROM_LOAD( "cl.8b", 0x0000, 0x2000, CRC(960d9a6c) SHA1(2569d59fd880cfc2eb4638294d1429ba749f5dcb) ) ROM_LOAD( "cl.8a", 0x2000, 0x2000, CRC(e3139791) SHA1(33d9e6d2a3233ee311c2cef2d0a425ded2cf3b0f) ) - PALETTE_2C04_0004 + PALETTE_2C04_0004("ppu1:palette") ROM_END @@ -2172,7 +2162,7 @@ ROM_START( excitebk ) /* EB4-3 = Excite Bike, Palette 3, revision 'E' */ ROM_LOAD( "mds-eb4-3e.2b", 0x0000, 0x2000, CRC(80be1f50) SHA1(d8544b9a0a9d8719ab601fa9c68c4305385b14c7) ) ROM_LOAD( "mds-eb4-3e.2a", 0x2000, 0x2000, CRC(001e8e0b) SHA1(c4c2a11ade7788bac9dd61ea8de319c4111d2592) ) - PALETTE_2C04_0003 + PALETTE_2C04_0003("ppu1:palette") ROM_END ROM_START( excitebko ) /* EB4-3 = Excite Bike, Palette 3, unknown revision */ @@ -2186,7 +2176,7 @@ ROM_START( excitebko ) /* EB4-3 = Excite Bike, Palette 3, unknown revision */ ROM_LOAD( "mds-eb4-3.2b", 0x0000, 0x2000, CRC(80be1f50) SHA1(d8544b9a0a9d8719ab601fa9c68c4305385b14c7) ) /* Need to verify correct label */ ROM_LOAD( "mds-eb4-3.2a", 0x2000, 0x2000, CRC(a9b49a05) SHA1(c14706e6a5524f81e79c101e32deef9f3d60de3f) ) /* Need to verify correct label */ - PALETTE_2C04_0003 + PALETTE_2C04_0003("ppu1:palette") ROM_END ROM_START( excitebkj ) /* EB4-4 A = Excite Bike, Palette 4, rev A */ @@ -2200,7 +2190,7 @@ ROM_START( excitebkj ) /* EB4-4 A = Excite Bike, Palette 4, rev A */ ROM_LOAD( "mds-eb4-4 a.8b", 0x0000, 0x2000, CRC(62a76c52) SHA1(7ebd0dac976abe8636f4f75a3b2a473d7a54934d) ) ROM_LOAD( "mds-eb4-4 a.8a", 0x2000, 0x2000, CRC(a9b49a05) SHA1(c14706e6a5524f81e79c101e32deef9f3d60de3f) ) - PALETTE_2C04_0004 + PALETTE_2C04_0004("ppu1:palette") ROM_END ROM_START( jajamaru ) @@ -2214,7 +2204,7 @@ ROM_START( jajamaru ) ROM_LOAD( "12.bin", 0x0000, 0x2000, CRC(c91d536a) SHA1(8cb4b0819652df484553b9dd1f82391d51c90fcc) ) ROM_LOAD( "11.bin", 0x2000, 0x2000, CRC(f0034c04) SHA1(402dcf6ad443baeee3038ecab12db008a1ad2787) ) - PALETTE_STANDARD + PALETTE_STANDARD("ppu1:palette") ROM_END ROM_START( smgolf ) @@ -2228,7 +2218,7 @@ ROM_START( smgolf ) ROM_LOAD( "mds-gf4-2 f.2b or 8b", 0x0000, 0x2000, CRC(2782a3e5) SHA1(4e57aab58fb250da951a9aecd21d6aa79e697bcb) ) ROM_LOAD( "mds-gf4-2 f.2a or 8a", 0x2000, 0x2000, CRC(6e93fdef) SHA1(44f46421adabbc40135c681592cb5226b7c9012a) ) - PALETTE_2C04_0002 + PALETTE_2C04_0002("ppu1:palette") ROM_END ROM_START( smgolfb ) /* Set ID should be something like MDS-GF4-2 xx */ @@ -2242,7 +2232,7 @@ ROM_START( smgolfb ) /* Set ID should be something like MDS-GF4-2 xx */ ROM_LOAD( "mds-gf4-2 f.2b or 8b", 0x0000, 0x2000, CRC(2782a3e5) SHA1(4e57aab58fb250da951a9aecd21d6aa79e697bcb) ) /* Need to verify correct label */ ROM_LOAD( "mds-gf4-2 f.2a or 8a", 0x2000, 0x2000, CRC(6e93fdef) SHA1(44f46421adabbc40135c681592cb5226b7c9012a) ) /* Need to verify correct label */ - PALETTE_2C04_0002 + PALETTE_2C04_0002("ppu1:palette") ROM_END ROM_START( smgolfj ) @@ -2256,7 +2246,7 @@ ROM_START( smgolfj ) ROM_LOAD( "mds-gf3 b.8b", 0x0000, 0x2000, CRC(7ef68029) SHA1(a639e463fd0abfb1bff0dd17aa0c9f70a72ee139) ) ROM_LOAD( "mds-gf3 b.8a", 0x2000, 0x2000, CRC(f2285878) SHA1(e0d34161a1879975f51c12222cf366228170b0e3) ) - PALETTE_STANDARD + PALETTE_STANDARD("ppu1:palette") ROM_END ROM_START( ladygolfe ) /* Vs. Stroke & Match Golf (Ladies Version, set E) */ @@ -2270,7 +2260,7 @@ ROM_START( ladygolfe ) /* Vs. Stroke & Match Golf (Ladies Version, set E) */ ROM_LOAD( "mds-lg4 e.2b or 8b", 0x0000, 0x2000, CRC(95618947) SHA1(e8f09bffa3fa1a1cac8fa25df9fba962951c1fb3) ) ROM_LOAD( "mds-lg4 e.2a or 8a", 0x2000, 0x2000, CRC(d07407b1) SHA1(b998b46fe83e76fac3d7b71495d1da8580a731f9) ) - PALETTE_2C04_0002 + PALETTE_2C04_0002("ppu1:palette") ROM_END ROM_START( ladygolf ) @@ -2284,7 +2274,7 @@ ROM_START( ladygolf ) ROM_LOAD( "mds-lg4 e.2b or 8b", 0x0000, 0x2000, CRC(95618947) SHA1(e8f09bffa3fa1a1cac8fa25df9fba962951c1fb3) ) /* Need to verify correct label */ ROM_LOAD( "mds-lg4 e.2a or 8a", 0x2000, 0x2000, CRC(d07407b1) SHA1(b998b46fe83e76fac3d7b71495d1da8580a731f9) ) /* Need to verify correct label */ - PALETTE_2C04_0002 + PALETTE_2C04_0002("ppu1:palette") ROM_END ROM_START( nvs_machrider ) /* Set ID should be something like MDS-MR4-2 xx */ @@ -2298,7 +2288,7 @@ ROM_START( nvs_machrider ) /* Set ID should be something like MDS-MR4-2 xx */ ROM_LOAD( "mr-2b", 0x0000, 0x2000, CRC(33a2b41a) SHA1(671f37bce742e63250296e62c143f8a82f860b04) ) /* Need to verify correct label */ ROM_LOAD( "mr-2a", 0x2000, 0x2000, CRC(685899d8) SHA1(02b6a9bc21367c481d0091fa8a8f2d1b841244bf) ) /* Need to verify correct label */ - PALETTE_2C04_0002 + PALETTE_2C04_0002("ppu1:palette") ROM_END ROM_START( nvs_machridera ) @@ -2312,7 +2302,7 @@ ROM_START( nvs_machridera ) ROM_LOAD( "mds-mr4-1 a.2b or 8b", 0x0000, 0x2000, CRC(59867e36) SHA1(2b5546aa9f140277d611d6d5516b1343e5e672a0) ) ROM_LOAD( "mds-mr4-1 a.2a or 8a", 0x2000, 0x2000, CRC(ccfedc5a) SHA1(3d6321681fbe256d7c71037205d45d22fc264569) ) - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") ROM_END ROM_START( vspinbal ) /* E-1 Set; used Nintendo labels, e and 1 written in red marker */ @@ -2326,7 +2316,7 @@ ROM_START( vspinbal ) /* E-1 Set; used Nintendo labels, e and 1 written in red m ROM_LOAD( "mds-pn4_1__8b_e.8b", 0x0000, 0x2000, CRC(8822ee9e) SHA1(950113952e6d356e45e03479ba5dd5a8cb131609) ) ROM_LOAD( "mds-pn4_1__8a_e.8a", 0x2000, 0x2000, CRC(cbe98a28) SHA1(c00c5f15a33611bfe3ad420b93b1cc2cae011c3e) ) - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") ROM_END ROM_START( vspinbalj ) @@ -2340,7 +2330,7 @@ ROM_START( vspinbalj ) ROM_LOAD( "mds-pn3 b.8b", 0x0000, 0x2000, CRC(1e3fec3e) SHA1(aef18cee358af202ec48c1c36986e42e134466b1) ) ROM_LOAD( "mds-pn3 b.8a", 0x2000, 0x2000, CRC(6f963a65) SHA1(af69564b51aa42ef0815c952e0d0d0d928651685) ) - PALETTE_STANDARD + PALETTE_STANDARD("ppu1:palette") ROM_END ROM_START( vsslalom ) @@ -2353,7 +2343,7 @@ ROM_START( vsslalom ) ROM_REGION( 0x2000,"gfx1", 0 ) /* PPU memory */ ROM_LOAD( "mds-sl4.2a", 0x0000, 0x2000, CRC(977bb126) SHA1(9b12cd37246237c24a8077c6184a2f71d342ac47) ) - PALETTE_2C04_0002 + PALETTE_2C04_0002("ppu1:palette") ROM_END ROM_START( vssoccer ) @@ -2367,7 +2357,7 @@ ROM_START( vssoccer ) ROM_LOAD( "mds-sc4-2 a.2b or 8b", 0x0000, 0x2000, CRC(307b19ab) SHA1(b35ef4c2cf071db77cec1b4529b43a20cfcce172) ) ROM_LOAD( "mds-sc4-2 a.2a or 8a", 0x2000, 0x2000, CRC(7263613a) SHA1(aa5673b57833d1f32c2cb0230a809397ec6103b4) ) - PALETTE_2C04_0002 + PALETTE_2C04_0002("ppu1:palette") ROM_END ROM_START( vssoccera ) /* Set ID should be something like MDS-SC4-3 xx */ @@ -2381,7 +2371,7 @@ ROM_START( vssoccera ) /* Set ID should be something like MDS-SC4-3 xx */ ROM_LOAD( "mds-sc4-3.2b", 0x0000, 0x2000, CRC(307b19ab) SHA1(b35ef4c2cf071db77cec1b4529b43a20cfcce172) ) /* Need to verify correct label */ ROM_LOAD( "mds-sc4-3.2a", 0x2000, 0x2000, CRC(7263613a) SHA1(aa5673b57833d1f32c2cb0230a809397ec6103b4) ) /* Need to verify correct label */ - PALETTE_2C04_0003 + PALETTE_2C04_0003("ppu1:palette") ROM_END ROM_START( starlstr ) @@ -2396,7 +2386,7 @@ ROM_START( starlstr ) ROM_LOAD( "sl_05.2a", 0x2000, 0x2000, CRC(2bbb45fd) SHA1(53c3588bd25baa6b8ff41f4755db9e0e806c9719) ) /* also compatible with 2C04-0001, 2C04-0002, 2C04-0003, 2C04-0004 via dipswitches */ - PALETTE_STANDARD + PALETTE_STANDARD("ppu1:palette") ROM_END ROM_START( vstetris ) @@ -2409,7 +2399,7 @@ ROM_START( vstetris ) ROM_LOAD( "char.8b", 0x0000, 0x2000, CRC(51e8d403) SHA1(ed734994d164c4b59794249a13bce333896b3ee5) ) /* also compatible with 2C03, 2C04-0002, 2C04-0003, 2C04-0004 via dipswitches */ - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") ROM_END ROM_START( drmario ) @@ -2419,7 +2409,7 @@ ROM_START( drmario ) ROM_REGION( 0x8000,"gfx1", 0 ) /* PPU memory */ ROM_LOAD( "dm-u3chr", 0x0000, 0x8000, CRC(91871aa5) SHA1(32a4299ead7b37f49877dc9597653b07a73ddbf3) ) - PALETTE_2C04_0003 + PALETTE_2C04_0003("ppu1:palette") ROM_END ROM_START( cstlevna ) @@ -2428,7 +2418,7 @@ ROM_START( cstlevna ) /* No cart gfx - uses vram */ - PALETTE_2C04_0002 + PALETTE_2C04_0002("ppu1:palette") ROM_END ROM_START( topgun ) @@ -2437,7 +2427,7 @@ ROM_START( topgun ) /* No cart gfx - uses vram */ - PALETTE_STANDARD + PALETTE_STANDARD("ppu1:palette") ROM_END ROM_START( tkoboxng ) @@ -2449,7 +2439,7 @@ ROM_START( tkoboxng ) /* also compatible with 2C03 via dipswitches Manual clearly states "RP2C04 0004" as PPU type, but the palette files argue that this is incorrect */ - PALETTE_2C04_0003 + PALETTE_2C04_0003("ppu1:palette") ROM_END ROM_START( rbibb ) @@ -2460,7 +2450,7 @@ ROM_START( rbibb ) ROM_LOAD( "rbi-cha", 0x0000, 0x8000, CRC(a3c14889) SHA1(ef00f4fbf21cf34e946957b9b6825b8e2cb16536) ) /* also compatible with 2C03, 2C04-0002, 2C04-0003, 2C04-0004 via dipswitches */ - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") ROM_END ROM_START( rbibba ) @@ -2471,7 +2461,7 @@ ROM_START( rbibba ) ROM_LOAD( "rbi-cha", 0x0000, 0x8000, CRC(a3c14889) SHA1(ef00f4fbf21cf34e946957b9b6825b8e2cb16536) ) /* also compatible with 2C03, 2C04-0002, 2C04-0003, 2C04-0004 via dipswitches */ - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") ROM_END ROM_START( vsskykid ) @@ -2482,7 +2472,7 @@ ROM_START( vsskykid ) ROM_LOAD( "sk-cha", 0x0000, 0x8000, CRC(9bd44dad) SHA1(bf33d175b6ab991d63a0acaf83ba22d5b7ab11b9) ) /* also compatible with 2C03, 2C04-0002, 2C04-0003, 2C04-0004 via dipswitches */ - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") ROM_END ROM_START( nvs_platoon ) @@ -2492,7 +2482,7 @@ ROM_START( nvs_platoon ) ROM_REGION( 0x20000,"gfx1", 0 ) /* PPU memory */ ROM_LOAD( "chrver0.ic6", 0x00000, 0x20000, CRC(689df57d) SHA1(854aaa9feb16e3f239fba6069fbf65e69858fe73) ) - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") ROM_END ROM_START( bnglngby ) @@ -2509,7 +2499,7 @@ ROM_START( bnglngby ) ROM_REGION( 0x2000, "user1", 0 ) /* unknown */ ROM_LOAD( "mds-rb4-2 b.1a", 0x0000, 0x2000, CRC(b49939ad) SHA1(ebaab2864d9ff9876e9d2666746c4bab57e49ec3) ) /* Unknown, maps at 0xe000, maybe from another set, but we have other roms? */ - PALETTE_2C04_0002 + PALETTE_2C04_0002("ppu1:palette") ROM_END ROM_START( supxevs ) @@ -2521,7 +2511,7 @@ ROM_START( supxevs ) ROM_LOAD( "cha", 0x00000, 0x08000, CRC(e27c7434) SHA1(a033bbaf0c28504ed2a641dea28f016a88ef03ac) ) /* also compatible with 2C04-0002, 2C04-0003, 2C04-0004 via dipswitches */ - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") ROM_END ROM_START( nvs_mightybj ) @@ -2534,7 +2524,7 @@ ROM_START( nvs_mightybj ) ROM_REGION( 0x2000, "gfx1", 0 ) /* PPU memory */ ROM_LOAD( "2b.bin", 0x0000, 0x2000, CRC(5425a4d0) SHA1(09eb9d93b680c9eefde5ee6e16cf81de931cccb9) ) - PALETTE_STANDARD + PALETTE_STANDARD("ppu1:palette") ROM_END /* Dual System */ @@ -2560,7 +2550,9 @@ ROM_START( balonfgt ) ROM_LOAD( "mds-bf4 a-3.8b", 0x0000, 0x2000, CRC(f27d9aa0) SHA1(429a1ad2a07947e4c4809495bfab55bf0f0e428f) ) ROM_LOAD( "mds-bf4 a-3.8a", 0x2000, 0x2000, CRC(76e6bbf8) SHA1(a4cae3a129a787162050187453b1583c8735fb46) ) - PALETTE_2C04_0003 + PALETTE_2C04_0003("ppu1:palette") + ROM_REGION( 0xc0, "ppu2:palette", 0 ) + ROM_COPY( "ppu1:palette", 0x00, 0x00, 0xc0 ) ROM_END ROM_START( vsmahjng ) @@ -2580,7 +2572,9 @@ ROM_START( vsmahjng ) ROM_REGION( 0x4000,"gfx2", 0 ) /* PPU memory */ ROM_LOAD( "mj.8b", 0x0000, 0x2000, CRC(9dae3502) SHA1(b7ffbc17af35eeac1b06c651f6c25f71827e9c3b) ) - PALETTE_STANDARD + PALETTE_STANDARD("ppu1:palette") + ROM_REGION( 0xc0, "ppu2:palette", 0 ) + ROM_COPY( "ppu1:palette", 0x00, 0x00, 0xc0 ) ROM_END ROM_START( vsbball ) @@ -2604,7 +2598,9 @@ ROM_START( vsbball ) ROM_LOAD( "mds-ba__8b_e.8b", 0x0000, 0x2000, CRC(3ff8bec3) SHA1(28c1bf89ed1046243ca8cf122cefa0752c242577) ) ROM_LOAD( "mds-ba__8a_e.8a", 0x2000, 0x2000, CRC(13b20cfd) SHA1(cb333cbea09557a9d2bdc351fabc61fc7760c35d) ) - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") + ROM_REGION( 0xc0, "ppu2:palette", 0 ) + ROM_COPY( "ppu1:palette", 0x00, 0x00, 0xc0 ) ROM_END ROM_START( vsbballj ) @@ -2628,7 +2624,9 @@ ROM_START( vsbballj ) ROM_LOAD( "mds-ba a.8b", 0x0000, 0x2000, CRC(919147d0) SHA1(9fccdfccc2a3ec634e350880ded7053f36c377bc) ) ROM_LOAD( "mds-ba a.8a", 0x2000, 0x2000, CRC(3f7edb00) SHA1(f59d24f15bdb8903187eabc1578dcb60443614ed) ) - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") + ROM_REGION( 0xc0, "ppu2:palette", 0 ) + ROM_COPY( "ppu1:palette", 0x00, 0x00, 0xc0 ) ROM_END ROM_START( vsbballja ) @@ -2652,7 +2650,9 @@ ROM_START( vsbballja ) ROM_LOAD( "mds-ba a.8b", 0x0000, 0x2000, CRC(919147d0) SHA1(9fccdfccc2a3ec634e350880ded7053f36c377bc) ) ROM_LOAD( "mds-ba a.8a", 0x2000, 0x2000, CRC(3f7edb00) SHA1(f59d24f15bdb8903187eabc1578dcb60443614ed) ) - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") + ROM_REGION( 0xc0, "ppu2:palette", 0 ) + ROM_COPY( "ppu1:palette", 0x00, 0x00, 0xc0 ) ROM_END ROM_START( vsbballjb ) @@ -2676,7 +2676,9 @@ ROM_START( vsbballjb ) ROM_LOAD( "mds-ba a.8b", 0x0000, 0x2000, CRC(919147d0) SHA1(9fccdfccc2a3ec634e350880ded7053f36c377bc) ) ROM_LOAD( "mds-ba a.8a", 0x2000, 0x2000, CRC(3f7edb00) SHA1(f59d24f15bdb8903187eabc1578dcb60443614ed) ) - PALETTE_2C04_0001 + PALETTE_2C04_0001("ppu1:palette") + ROM_REGION( 0xc0, "ppu2:palette", 0 ) + ROM_COPY( "ppu1:palette", 0x00, 0x00, 0xc0 ) ROM_END ROM_START( vstennis ) @@ -2700,7 +2702,9 @@ ROM_START( vstennis ) ROM_LOAD( "mds-te a.8b", 0x0000, 0x2000, CRC(c81e9260) SHA1(6d4809a05364cc05485ee1add833428529af2be6) ) ROM_LOAD( "mds-te a.8a", 0x2000, 0x2000, CRC(d91eb295) SHA1(6b69bcef5421a6bcde89a2d1f514853f9f7992c3) ) - PALETTE_STANDARD + PALETTE_STANDARD("ppu1:palette") + ROM_REGION( 0xc0, "ppu2:palette", 0 ) + ROM_COPY( "ppu1:palette", 0x00, 0x00, 0xc0 ) ROM_END ROM_START( vstennisa ) @@ -2724,7 +2728,9 @@ ROM_START( vstennisa ) ROM_LOAD( "mds-te a.8b", 0x0000, 0x2000, CRC(c81e9260) SHA1(6d4809a05364cc05485ee1add833428529af2be6) ) ROM_LOAD( "mds-te a.8a", 0x2000, 0x2000, CRC(d91eb295) SHA1(6b69bcef5421a6bcde89a2d1f514853f9f7992c3) ) - PALETTE_STANDARD + PALETTE_STANDARD("ppu1:palette") + ROM_REGION( 0xc0, "ppu2:palette", 0 ) + ROM_COPY( "ppu1:palette", 0x00, 0x00, 0xc0 ) ROM_END ROM_START( vstennisb ) @@ -2748,7 +2754,9 @@ ROM_START( vstennisb ) ROM_LOAD( "8b", 0x0000, 0x2000, CRC(c81e9260) SHA1(6d4809a05364cc05485ee1add833428529af2be6) ) ROM_LOAD( "8a", 0x2000, 0x2000, CRC(d91eb295) SHA1(6b69bcef5421a6bcde89a2d1f514853f9f7992c3) ) - PALETTE_STANDARD + PALETTE_STANDARD("ppu1:palette") + ROM_REGION( 0xc0, "ppu2:palette", 0 ) + ROM_COPY( "ppu1:palette", 0x00, 0x00, 0xc0 ) ROM_END ROM_START( wrecking ) @@ -2772,7 +2780,9 @@ ROM_REGION( 0x10000,"maincpu", 0 ) /* 6502 memory */ ROM_LOAD( "wr.8b", 0x0000, 0x2000, CRC(455d77ac) SHA1(fa09d0be51cc780f6c16cd314facc84043e1e69b) ) ROM_LOAD( "wr.8a", 0x2000, 0x2000, CRC(653350d8) SHA1(d9aa699394654deaf50fadd8a652f08a340377eb) ) - PALETTE_2C04_0002 + PALETTE_2C04_0002("ppu1:palette") + ROM_REGION( 0xc0, "ppu2:palette", 0 ) + ROM_COPY( "ppu1:palette", 0x00, 0x00, 0xc0 ) ROM_END ROM_START( iceclmrd ) @@ -2796,7 +2806,9 @@ ROM_START( iceclmrd ) ROM_LOAD( "mds-ic4-4 a.8b", 0x0000, 0x2000, CRC(331460b4) SHA1(4cf94d711cdb5715d14f1ab3cadec245e0adfb1e) ) ROM_LOAD( "mds-ic4-4 a.8a", 0x2000, 0x2000, CRC(4ec44fb3) SHA1(676e0ab574dec08df562c6f278e8a9cc7c8afa41) ) - PALETTE_2C04_0004 + PALETTE_2C04_0004("ppu1:palette") + ROM_REGION( 0xc0, "ppu2:palette", 0 ) + ROM_COPY( "ppu1:palette", 0x00, 0x00, 0xc0 ) ROM_END /******************************************************************************/ diff --git a/src/mame/includes/nes.h b/src/mame/includes/nes.h index 6d660138ff1..ff201eaa39f 100644 --- a/src/mame/includes/nes.h +++ b/src/mame/includes/nes.h @@ -91,8 +91,7 @@ public: virtual void machine_reset() override; virtual void video_start() override; virtual void video_reset() override; - DECLARE_PALETTE_INIT(nes); - uint32_t screen_update_nes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_nes(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); NESCTRL_BRIGHTPIXEL_CB(bright_pixel); DECLARE_DRIVER_INIT(famicom); diff --git a/src/mame/includes/playch10.h b/src/mame/includes/playch10.h index c726a513cf2..0a9b8fa0c70 100644 --- a/src/mame/includes/playch10.h +++ b/src/mame/includes/playch10.h @@ -112,9 +112,9 @@ private: void mapper9_latch(offs_t offset); void pc10_set_mirroring(int mirroring); - uint32_t screen_update_playch10_top(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_playch10_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_playch10_single(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_playch10_top(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + uint32_t screen_update_playch10_bottom(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + uint32_t screen_update_playch10_single(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); required_device m_maincpu; required_device m_ppu; diff --git a/src/mame/includes/vsnes.h b/src/mame/includes/vsnes.h index b18f97f9df0..b154388f205 100644 --- a/src/mame/includes/vsnes.h +++ b/src/mame/includes/vsnes.h @@ -13,7 +13,6 @@ public: , m_ppu2(*this, "ppu2") , m_work_ram(*this, "work_ram") , m_work_ram_1(*this, "work_ram_1") - , m_palette(*this, "palette") , m_gfx1_rom(*this, "gfx1") { } @@ -25,7 +24,6 @@ public: required_shared_ptr m_work_ram; optional_shared_ptr m_work_ram_1; - required_device m_palette; optional_memory_region m_gfx1_rom; @@ -81,14 +79,8 @@ public: DECLARE_DRIVER_INIT(vsdual); DECLARE_MACHINE_START(vsnes); DECLARE_MACHINE_RESET(vsnes); - DECLARE_VIDEO_START(vsnes); - DECLARE_PALETTE_INIT(vsnes); DECLARE_MACHINE_START(vsdual); DECLARE_MACHINE_RESET(vsdual); - DECLARE_VIDEO_START(vsdual); - DECLARE_PALETTE_INIT(vsdual); - uint32_t screen_update_vsnes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_vsnes_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void v_set_videorom_bank( int start, int count, int vrom_start_bank ); void mapper4_set_prg( ); void mapper4_set_chr( ); diff --git a/src/mame/machine/nes.cpp b/src/mame/machine/nes.cpp index eed8dc34b5c..19beec307d0 100644 --- a/src/mame/machine/nes.cpp +++ b/src/mame/machine/nes.cpp @@ -194,14 +194,11 @@ DRIVER_INIT_MEMBER(nes_state,famicom) NESCTRL_BRIGHTPIXEL_CB(nes_state::bright_pixel) { // get the pixel at the gun position - uint32_t pix = m_ppu->get_pixel(x, y); - - // get the color base from the ppu - uint32_t color_base = m_ppu->get_colorbase(); + rgb_t pix = m_ppu->get_pixel(x, y); // check if the cursor is over a bright pixel - if ((pix == color_base + 0x20) || (pix == color_base + 0x30) || - (pix == color_base + 0x33) || (pix == color_base + 0x34)) + // FIXME: still a gross hack + if (pix.r() == 0xff && pix.b() == 0xff && pix.g() > 0x90) return true; else return false; diff --git a/src/mame/machine/playch10.cpp b/src/mame/machine/playch10.cpp index 5538175cbbc..250f9fbd626 100644 --- a/src/mame/machine/playch10.cpp +++ b/src/mame/machine/playch10.cpp @@ -220,20 +220,16 @@ READ8_MEMBER(playch10_state::pc10_in1_r) int trigger = ioport("P1")->read(); int x = ioport("GUNX")->read(); int y = ioport("GUNY")->read(); - uint32_t pix, color_base; /* no sprite hit (yet) */ ret |= 0x08; /* get the pixel at the gun position */ - pix = m_ppu->get_pixel(x, y); - - /* get the color base from the ppu */ - color_base = m_ppu->get_colorbase(); + rgb_t pix = m_ppu->get_pixel(x, y); /* look at the screen and see if the cursor is over a bright pixel */ - if ((pix == color_base + 0x20) || (pix == color_base + 0x30) || - (pix == color_base + 0x33) || (pix == color_base + 0x34)) + // FIXME: still a gross hack + if (pix.r() == 0xff && pix.b() == 0xff && pix.g() > 0x90) { ret &= ~0x08; /* sprite hit */ } diff --git a/src/mame/machine/vsnes.cpp b/src/mame/machine/vsnes.cpp index 2f90695c044..f4748d3e98a 100644 --- a/src/mame/machine/vsnes.cpp +++ b/src/mame/machine/vsnes.cpp @@ -369,17 +369,13 @@ WRITE8_MEMBER(vsnes_state::gun_in0_w) /* do the gun thing */ int x = ioport("GUNX")->read(); float y = ioport("GUNY")->read(); - uint8_t pix; y = y * 0.9375f; // scale 256 (our gun input range is 0 - 255) to 240 (screen visible area / bitmap we're using is 0 - 239) uint8_t realy = (int)y; /* get the pixel at the gun position */ - pix = m_ppu1->get_pixel(x, realy); - - - rgb_t col = m_palette->pen_color(pix); + rgb_t col = m_ppu1->get_pixel(x, realy); uint8_t bright = col.brightness(); // todo, calculate how bright it is with pix.r * 0.3 + pix.g * 0.59 + pix.b * 0.11 ? // the mame calc above is uint8_t brightness() const { return (r() * 222 + g() * 707 + b() * 71) / 1000; } (from lib/util/palette.h) @@ -387,7 +383,7 @@ WRITE8_MEMBER(vsnes_state::gun_in0_w) uint8_t r = col.r(); uint8_t g = col.g(); uint8_t b = col.b(); - printf("pix is %02x | %02x %02x %02x | %02x\n", pix, r,g,b,bright); + printf("pix is %02x %02x %02x | %02x\n", r,g,b,bright); #endif if (bright == 0xff) { @@ -398,7 +394,7 @@ WRITE8_MEMBER(vsnes_state::gun_in0_w) #if 0 // this is junk code, only works for NES palette.. /* get the color base from the ppu */ - uint32_t color_base = m_ppu1->get_colorbase(); + uint32_t color_base = 0; /* look at the screen and see if the cursor is over a bright pixel */ if ((pix == color_base + 0x20 ) || (pix == color_base + 0x30) || diff --git a/src/mame/video/nes.cpp b/src/mame/video/nes.cpp index a4306ca4ed5..3d2874acea6 100644 --- a/src/mame/video/nes.cpp +++ b/src/mame/video/nes.cpp @@ -21,11 +21,6 @@ void nes_state::video_start() m_last_frame_flip = 0; } -PALETTE_INIT_MEMBER(nes_state, nes) -{ - m_ppu->init_palette(palette, 0); -} - /*************************************************************************** @@ -33,7 +28,7 @@ PALETTE_INIT_MEMBER(nes_state, nes) ***************************************************************************/ -uint32_t nes_state::screen_update_nes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t nes_state::screen_update_nes(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { // render the ppu m_ppu->render(bitmap, 0, 0, 0, 0); diff --git a/src/mame/video/playch10.cpp b/src/mame/video/playch10.cpp index d9c3224fd35..66c8433aa3f 100644 --- a/src/mame/video/playch10.cpp +++ b/src/mame/video/playch10.cpp @@ -55,8 +55,6 @@ PALETTE_INIT_MEMBER(playch10_state, playch10) color_prom++; } - - m_ppu->init_palette_rgb(palette, 256); } void playch10_state::ppu_irq(int *ppu_regs) @@ -99,7 +97,7 @@ VIDEO_START_MEMBER(playch10_state,playch10_hboard) ***************************************************************************/ -uint32_t playch10_state::screen_update_playch10_single(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t playch10_state::screen_update_playch10_single(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { rectangle top_monitor = screen.visible_area(); @@ -125,7 +123,7 @@ uint32_t playch10_state::screen_update_playch10_single(screen_device &screen, bi return 0; } -uint32_t playch10_state::screen_update_playch10_top(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t playch10_state::screen_update_playch10_top(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { /* Single Monitor version */ if (m_pc10_bios != 1) @@ -140,7 +138,7 @@ uint32_t playch10_state::screen_update_playch10_top(screen_device &screen, bitma return 0; } -uint32_t playch10_state::screen_update_playch10_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t playch10_state::screen_update_playch10_bottom(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { /* Single Monitor version */ if (m_pc10_bios != 1) diff --git a/src/mame/video/vsnes.cpp b/src/mame/video/vsnes.cpp deleted file mode 100644 index cb7225086d4..00000000000 --- a/src/mame/video/vsnes.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Pierpaolo Prazzoli -#include "emu.h" -#include "video/ppu2c0x.h" -#include "includes/vsnes.h" - - -PALETTE_INIT_MEMBER(vsnes_state,vsnes) -{ - m_ppu1->init_palette_rgb(palette, 0); -} - -PALETTE_INIT_MEMBER(vsnes_state,vsdual) -{ - m_ppu1->init_palette_rgb(palette, 0); - m_ppu2->init_palette_rgb(palette, 8 * 4 * 16); -} - -void vsnes_state::ppu_irq_1(int *ppu_regs) -{ - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); -} - -void vsnes_state::ppu_irq_2(int *ppu_regs) -{ - m_subcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); -} - -VIDEO_START_MEMBER(vsnes_state,vsnes ) -{ -} - -VIDEO_START_MEMBER(vsnes_state,vsdual ) -{ -} - -/*************************************************************************** - - Display refresh - -***************************************************************************/ - -uint32_t vsnes_state::screen_update_vsnes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - /* render the ppu */ - m_ppu1->render(bitmap, 0, 0, 0, 0); - return 0; -} - -uint32_t vsnes_state::screen_update_vsnes_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_ppu2->render(bitmap, 0, 0, 0, 0); - return 0; -}