diff options
Diffstat (limited to 'src/devices/video/ppu2c0x_sh6578.cpp')
-rw-r--r-- | src/devices/video/ppu2c0x_sh6578.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/devices/video/ppu2c0x_sh6578.cpp b/src/devices/video/ppu2c0x_sh6578.cpp index c74fa5e54fb..8187856bc34 100644 --- a/src/devices/video/ppu2c0x_sh6578.cpp +++ b/src/devices/video/ppu2c0x_sh6578.cpp @@ -51,12 +51,14 @@ void ppu_sh6578_device::ppu_internal_map(address_map& map) void ppu_sh6578_device::device_start() { - ppu2c0x_device::device_start(); + start_nopalram(); m_palette_ram.resize(0x40); for (int i = 0; i < 0x40; i++) m_palette_ram[i] = 0x00; + + save_item(NAME(m_palette_ram)); } void ppu_sh6578_device::device_reset() @@ -89,7 +91,7 @@ void ppu_sh6578_device::scanline_increment_fine_ycounter() void ppu_sh6578_device::draw_sprite_pixel(int sprite_xpos, int color, int pixel, uint8_t pixel_data, bitmap_rgb32& bitmap) { uint8_t palval = m_palette_ram[(pixel_data | color << 2)] & 0x3f; - bitmap.pix32(m_scanline, sprite_xpos + pixel) = this->pen(palval); + bitmap.pix32(m_scanline, sprite_xpos + pixel) = m_nespens[palval]; } void ppu_sh6578_device::read_tile_plane_data(int address, int color) @@ -101,7 +103,7 @@ void ppu_sh6578_device::read_tile_plane_data(int address, int color) m_extplanebuf[1] = readbyte(address + 24); } -void ppu_sh6578_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) +void ppu_sh6578_device::draw_tile(uint8_t* line_priority, int color_byte, int color_bits, int address, int start_x, uint32_t back_pen, uint32_t*& dest) { int color = color_byte; @@ -136,12 +138,12 @@ void ppu_sh6578_device::draw_tile(uint8_t* line_priority, int color_byte, int co if (!trans) { - pen = this->pen(palval); + pen = m_nespens[palval]; } else { uint8_t palval = m_palette_ram[0x0] & 0x3f; - pen = this->pen(palval); + pen = m_nespens[palval]; } *dest = pen; @@ -158,23 +160,24 @@ void ppu_sh6578_device::draw_background(uint8_t* line_priority) { bitmap_rgb32& bitmap = *m_bitmap; - uint8_t color_mask; - const pen_t* color_table; + uint8_t color_mask = 0xff; + //const pen_t* color_table; /* setup the color mask and colortable to use */ + + //TODO FIX if (m_regs[PPU_CONTROL1] & PPU_CONTROL1_DISPLAY_MONO) { color_mask = 0xf0; - color_table = m_colortable_mono.get(); } else { color_mask = 0xff; - color_table = m_colortable.get(); } + /* cache the background pen */ - pen_t back_pen = pen(m_back_color & color_mask); + pen_t back_pen = m_nespens[m_back_color & color_mask]; /* determine where in the nametable to start drawing from */ /* based on the current scanline and scroll regs */ @@ -225,7 +228,7 @@ void ppu_sh6578_device::draw_background(uint8_t* line_priority) // plus something that accounts for y address += scroll_y_fine; - draw_tile(line_priority, (color_byte >> 4) & 0xf, 0, address, start_x, back_pen, dest, color_table); + draw_tile(line_priority, (color_byte >> 4) & 0xf, 0, address, start_x, back_pen, dest); start_x += 8; |