summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/video/ppu2c0x.h
diff options
context:
space:
mode:
author David Haywood <28625134+DavidHaywood@users.noreply.github.com>2020-03-15 19:26:47 +0000
committer GitHub <noreply@github.com>2020-03-15 15:26:47 -0400
commit389126869f170f35ab1f52f5e22103cc4c861e57 (patch)
treec48ec5db338c369f8c139676c3d1ad80c4587424 /src/devices/video/ppu2c0x.h
parent07c987b5bc07b17f3fe9db4595ce4379e2417584 (diff)
Plug & Play / sh6578 work (#6447)
* PPU refactoring (nw) * PPU refactoring (nw) * start making a new device (nw) * PPU device refinements (nw) * tear things down (nw) * refactoring (nw) * more refactor and teardown (nw) * (nw) * rebuilding (nw) * (nw) * (nw) * (nw) * (nw) * checkpoint (nw)
Diffstat (limited to 'src/devices/video/ppu2c0x.h')
-rw-r--r--src/devices/video/ppu2c0x.h42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/devices/video/ppu2c0x.h b/src/devices/video/ppu2c0x.h
index 66857549c63..e785a605fdb 100644
--- a/src/devices/video/ppu2c0x.h
+++ b/src/devices/video/ppu2c0x.h
@@ -29,6 +29,10 @@
#define PPU_DRAW_BG 0
#define PPU_DRAW_OAM 1
+/* constant definitions */
+#define VISIBLE_SCREEN_WIDTH (32*8) /* Visible screen width */
+#define VISIBLE_SCREEN_HEIGHT (30*8) /* Visible screen height */
+#define SPRITERAM_SIZE 0x100 /* spriteram size */
///*************************************************************************
// TYPE DEFINITIONS
@@ -81,15 +85,20 @@ public:
virtual void shift_tile_plane_data(uint8_t &pix);
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 draw_background( uint8_t *line_priority );
+ void draw_background_pen();
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_rgb32 &bitmap);
virtual void read_extra_sprite_bits(int sprite_index);
- void draw_sprites(uint8_t *line_priority);
+ virtual void draw_sprites(uint8_t *line_priority);
void render_scanline();
+ virtual void scanline_increment_fine_ycounter();
+ void update_visible_enabled_scanline();
+ void update_visible_disabled_scanline();
+ void update_visible_scanline();
void update_scanline();
void spriteram_dma(address_space &space, const uint8_t page);
@@ -119,6 +128,8 @@ public:
void ppu2c0x(address_map &map);
protected:
+ ppu2c0x_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock, address_map_constructor internal_map);
+
// registers definition
enum
{
@@ -178,41 +189,44 @@ protected:
int m_scanline; /* scanline count */
std::unique_ptr<uint8_t[]> m_spriteram; /* sprite ram */
+ int m_line_write_increment_large;
+ bool m_paletteram_in_ppuspace; // sh6578 doesn't have the palette in PPU space, so various side-effects don't apply
+ std::vector<uint8_t> m_palette_ram; /* shouldn't be in main memory! */
+ std::unique_ptr<bitmap_rgb32> m_bitmap; /* target bitmap */
+ int m_regs[PPU_MAX_REG]; /* registers */
+ int m_tile_page; /* current tile page */
+ int m_back_color; /* background color */
+ int m_refresh_data; /* refresh-related */
+ int m_x_fine; /* refresh-related */
+ int m_tilecount; /* MMC5 can change attributes to subsets of the 34 visible tiles */
+ std::unique_ptr<pen_t[]> m_colortable; /* color table modified at run time */
+ std::unique_ptr<pen_t[]> m_colortable_mono; /* monochromatic color table modified at run time */
+ latch_delegate m_latch;
+
+ uint8_t readbyte(offs_t address);
private:
static constexpr device_timer_id TIMER_HBLANK = 0;
static constexpr device_timer_id TIMER_NMI = 1;
static constexpr device_timer_id TIMER_SCANLINE = 2;
- inline uint8_t readbyte(offs_t address);
inline void writebyte(offs_t address, uint8_t data);
- std::unique_ptr<bitmap_rgb32> m_bitmap; /* target bitmap */
- std::unique_ptr<pen_t[]> m_colortable; /* color table modified at run time */
- std::unique_ptr<pen_t[]> m_colortable_mono; /* monochromatic color table modified at run time */
scanline_delegate m_scanline_callback_proc; /* optional scanline callback */
hblank_delegate m_hblank_callback_proc; /* optional hblank callback */
vidaccess_delegate m_vidaccess_callback_proc; /* optional video access callback */
devcb_write_line m_int_callback; /* nmi access callback from interface */
- int m_regs[PPU_MAX_REG]; /* registers */
- int m_refresh_data; /* refresh-related */
int m_refresh_latch; /* refresh-related */
- int m_x_fine; /* refresh-related */
int m_toggle; /* used to latch hi-lo scroll */
int m_add; /* vram increment amount */
int m_videomem_addr; /* videomem address pointer */
int m_data_latch; /* latched videomem data */
int m_buffered_data;
- int m_tile_page; /* current tile page */
int m_sprite_page; /* current sprite page */
- int m_back_color; /* background color */
- 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 */
int m_draw_phase; /* MMC5 uses different regs for BG and OAM */
- latch_delegate m_latch;
// timers
emu_timer *m_hblank_timer; /* hblank period at end of each scanline */