#include <ppu.h>
Public Member Functions | |
Ppu (Memory &memory) | |
void | Init () |
void | Reset () |
void | HandleFrameStart () |
void | RunLine (int line) |
void | HandlePixel (int x, int y) |
void | LatchHV () |
int | GetPixel (int x, int y, bool sub, int *r, int *g, int *b) |
void | EvaluateSprites (int line) |
void | CalculateMode7Starts (int y) |
bool | GetWindowState (int layer, int x) |
bool | CheckOverscan () |
void | HandleVblank () |
void | HandleOPT (int layer, int *lx, int *ly) |
uint16_t | GetOffsetValue (int col, int row) |
int | GetPixelForBgLayer (int x, int y, int layer, bool priority) |
uint8_t | Read (uint8_t adr, bool latch) |
void | Write (uint8_t adr, uint8_t val) |
uint16_t | GetVramRemap () |
void | PutPixels (uint8_t *pixel_data) |
const std::vector< uint8_t > & | GetFrameBuffer () const |
Public Member Functions inherited from yaze::SharedRom | |
SharedRom ()=default | |
virtual | ~SharedRom ()=default |
std::shared_ptr< Rom > | shared_rom () |
auto | rom () |
Public Attributes | |
bool | frame_overscan_ = false |
bool | overscan_ = false |
bool | forced_blank_ |
uint8_t | brightness |
uint8_t | mode |
bool | bg3priority |
bool | even_frame |
bool | pseudo_hires_ |
bool | interlace |
bool | frame_interlace |
bool | direct_color_ |
Private Member Functions | |
int | GetPixelForMode7 (int x, int layer, bool priority) |
Additional Inherited Members | |
Static Public Attributes inherited from yaze::SharedRom | |
static std::shared_ptr< Rom > | shared_rom_ = nullptr |
|
inline |
|
inline |
Definition at line 259 of file ppu.h.
References frame_buffer_, and pixelOutputFormat.
void yaze::emu::Ppu::Reset | ( | ) |
Definition at line 39 of file ppu.cc.
References add_subscreen_, bg3priority, bg_layer_, brightness, cgram, cgram_buffer_, cgram_pointer_, cgram_second_write_, clip_mode_, counters_latched_, direct_color_, even_frame, fixed_color_b_, fixed_color_g_, fixed_color_r_, forced_blank_, frame_interlace, frame_overscan_, h_count_, h_count_second_, half_color_, high_oam_, interlace, layer_, m7charFill, m7extBg, m7largeField, m7matrix, m7prev, m7startX, m7startY, m7xFlip, m7yFlip, math_enabled_array_, mode, mosaic_size_, mosaic_startline_, oam, oam_adr_, oam_adr_written_, oam_buffer_, oam_in_high_, oam_in_high_written_, oam_second_write_, obj_interlace_, obj_pixel_buffer_, obj_priority_, obj_priority_buffer_, obj_size_, obj_tile_adr1_, obj_tile_adr2_, overscan_, pixelBuffer, ppu1_open_bus_, ppu2_open_bus_, prevent_math_mode_, pseudo_hires_, range_over_, scroll_prev2_, scroll_prev_, subtract_color_, time_over_, v_count_, v_count_second_, vram, vram_increment_, vram_increment_on_high_, vram_pointer, vram_read_buffer_, vram_remap_mode_, window1left, window1right, window2left, window2right, and windowLayer.
void yaze::emu::Ppu::HandleFrameStart | ( | ) |
Definition at line 137 of file ppu.cc.
References even_frame, mosaic_startline_, range_over_, and time_over_.
void yaze::emu::Ppu::RunLine | ( | int | line | ) |
Definition at line 145 of file ppu.cc.
References CalculateMode7Starts(), EvaluateSprites(), forced_blank_, HandlePixel(), mode, and obj_pixel_buffer_.
void yaze::emu::Ppu::HandlePixel | ( | int | x, |
int | y ) |
Definition at line 157 of file ppu.cc.
References add_subscreen_, brightness, clip_mode_, even_frame, fixed_color_b_, fixed_color_g_, fixed_color_r_, forced_blank_, GetPixel(), GetWindowState(), half_color_, math_enabled_array_, mode, pixelBuffer, pixelOutputFormat, prevent_math_mode_, pseudo_hires_, and subtract_color_.
Referenced by RunLine().
|
inline |
int yaze::emu::Ppu::GetPixel | ( | int | x, |
int | y, | ||
bool | sub, | ||
int * | r, | ||
int * | g, | ||
int * | b ) |
Definition at line 224 of file ppu.cc.
References bg3priority, bg_layer_, cgram, direct_color_, even_frame, GetPixelForBgLayer(), GetPixelForMode7(), GetWindowState(), HandleOPT(), interlace, layer_, m7extBg, mode, mosaic_size_, mosaic_startline_, obj_pixel_buffer_, and obj_priority_buffer_.
Referenced by HandlePixel().
void yaze::emu::Ppu::EvaluateSprites | ( | int | line | ) |
Definition at line 466 of file ppu.cc.
References even_frame, high_oam_, oam, oam_adr_, obj_interlace_, obj_pixel_buffer_, obj_priority_, obj_priority_buffer_, obj_size_, obj_tile_adr1_, obj_tile_adr2_, range_over_, time_over_, and vram.
Referenced by RunLine().
void yaze::emu::Ppu::CalculateMode7Starts | ( | int | y | ) |
Definition at line 561 of file ppu.cc.
References bg_layer_, m7matrix, m7startX, m7startY, m7yFlip, mosaic_size_, and mosaic_startline_.
Referenced by RunLine().
bool yaze::emu::Ppu::GetWindowState | ( | int | layer, |
int | x ) |
Definition at line 320 of file ppu.cc.
References window1left, window1right, window2left, window2right, and windowLayer.
Referenced by GetPixel(), and HandlePixel().
|
inline |
Definition at line 299 of file ppu.h.
References frame_overscan_, and overscan_.
void yaze::emu::Ppu::HandleVblank | ( | ) |
Definition at line 582 of file ppu.cc.
References forced_blank_, frame_interlace, interlace, oam_adr_, oam_adr_written_, oam_in_high_, oam_in_high_written_, and oam_second_write_.
void yaze::emu::Ppu::HandleOPT | ( | int | layer, |
int * | lx, | ||
int * | ly ) |
Definition at line 350 of file ppu.cc.
References bg_layer_, GetOffsetValue(), and mode.
Referenced by GetPixel().
uint16_t yaze::emu::Ppu::GetOffsetValue | ( | int | col, |
int | row ) |
int yaze::emu::Ppu::GetPixelForBgLayer | ( | int | x, |
int | y, | ||
int | layer, | ||
bool | priority ) |
uint8_t yaze::emu::Ppu::Read | ( | uint8_t | adr, |
bool | latch ) |
Definition at line 592 of file ppu.cc.
References cgram, cgram_pointer_, cgram_second_write_, counters_latched_, even_frame, GetVramRemap(), h_count_, h_count_second_, high_oam_, LatchHV(), m7matrix, memory_, oam, oam_adr_, oam_in_high_, oam_second_write_, ppu1_open_bus_, ppu2_open_bus_, range_over_, time_over_, v_count_, v_count_second_, vram, vram_increment_, vram_increment_on_high_, vram_pointer, and vram_read_buffer_.
void yaze::emu::Ppu::Write | ( | uint8_t | adr, |
uint8_t | val ) |
Definition at line 727 of file ppu.cc.
References add_subscreen_, bg3priority, bg_layer_, brightness, cgram, cgram_buffer_, cgram_pointer_, cgram_second_write_, clip_mode_, direct_color_, fixed_color_b_, fixed_color_g_, fixed_color_r_, forced_blank_, GetVramRemap(), half_color_, high_oam_, interlace, layer_, m7charFill, m7extBg, m7largeField, m7matrix, m7prev, m7xFlip, m7yFlip, math_enabled_array_, memory_, mode, mosaic_size_, mosaic_startline_, oam, oam_adr_, oam_adr_written_, oam_buffer_, oam_in_high_, oam_in_high_written_, oam_second_write_, obj_interlace_, obj_priority_, obj_size_, obj_tile_adr1_, obj_tile_adr2_, overscan_, prevent_math_mode_, pseudo_hires_, scroll_prev2_, scroll_prev_, subtract_color_, vram, vram_increment_, vram_increment_on_high_, vram_pointer, vram_read_buffer_, vram_remap_mode_, window1left, window1right, window2left, window2right, and windowLayer.
uint16_t yaze::emu::Ppu::GetVramRemap | ( | ) |
Definition at line 1017 of file ppu.cc.
References vram_pointer, and vram_remap_mode_.
void yaze::emu::Ppu::PutPixels | ( | uint8_t * | pixel_data | ) |
Definition at line 1032 of file ppu.cc.
References even_frame, frame_interlace, frame_overscan_, and pixelBuffer.
|
inline |
Definition at line 317 of file ppu.h.
References frame_buffer_.
|
private |
Definition at line 301 of file ppu.cc.
References m7charFill, m7largeField, m7matrix, m7startX, m7startY, m7xFlip, and vram.
Referenced by GetPixel().
bool yaze::emu::Ppu::frame_overscan_ = false |
Definition at line 284 of file ppu.h.
Referenced by CheckOverscan(), PutPixels(), and Reset().
bool yaze::emu::Ppu::overscan_ = false |
Definition at line 285 of file ppu.h.
Referenced by CheckOverscan(), Reset(), and Write().
bool yaze::emu::Ppu::forced_blank_ |
Definition at line 288 of file ppu.h.
Referenced by HandlePixel(), HandleVblank(), Reset(), RunLine(), and Write().
uint8_t yaze::emu::Ppu::brightness |
Definition at line 289 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
uint8_t yaze::emu::Ppu::mode |
Definition at line 290 of file ppu.h.
Referenced by GetPixel(), GetPixelForBgLayer(), HandleOPT(), HandlePixel(), Reset(), RunLine(), and Write().
bool yaze::emu::Ppu::bg3priority |
Definition at line 291 of file ppu.h.
Referenced by GetPixel(), Reset(), and Write().
bool yaze::emu::Ppu::even_frame |
Definition at line 292 of file ppu.h.
Referenced by EvaluateSprites(), GetPixel(), HandleFrameStart(), HandlePixel(), PutPixels(), Read(), and Reset().
bool yaze::emu::Ppu::pseudo_hires_ |
Definition at line 293 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
bool yaze::emu::Ppu::interlace |
Definition at line 294 of file ppu.h.
Referenced by GetPixel(), HandleVblank(), Reset(), and Write().
bool yaze::emu::Ppu::frame_interlace |
Definition at line 295 of file ppu.h.
Referenced by HandleVblank(), PutPixels(), and Reset().
bool yaze::emu::Ppu::direct_color_ |
Definition at line 297 of file ppu.h.
Referenced by GetPixel(), Reset(), and Write().
|
private |
Definition at line 332 of file ppu.h.
Referenced by EvaluateSprites(), GetOffsetValue(), GetPixelForBgLayer(), GetPixelForMode7(), Read(), Reset(), and Write().
|
private |
|
private |
|
private |
|
private |
Definition at line 336 of file ppu.h.
Referenced by GetVramRemap(), Reset(), and Write().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Definition at line 348 of file ppu.h.
Referenced by EvaluateSprites(), HandleVblank(), Read(), Reset(), and Write().
|
private |
Definition at line 349 of file ppu.h.
Referenced by HandleVblank(), Reset(), and Write().
|
private |
|
private |
Definition at line 351 of file ppu.h.
Referenced by HandleVblank(), Reset(), and Write().
|
private |
|
private |
|
private |
Definition at line 356 of file ppu.h.
Referenced by EvaluateSprites(), HandleFrameStart(), Read(), and Reset().
|
private |
Definition at line 357 of file ppu.h.
Referenced by EvaluateSprites(), HandleFrameStart(), Read(), and Reset().
|
private |
Definition at line 358 of file ppu.h.
Referenced by EvaluateSprites(), Reset(), and Write().
|
private |
Definition at line 359 of file ppu.h.
Referenced by EvaluateSprites(), Reset(), and Write().
|
private |
Definition at line 360 of file ppu.h.
Referenced by EvaluateSprites(), Reset(), and Write().
|
private |
Definition at line 361 of file ppu.h.
Referenced by EvaluateSprites(), Reset(), and Write().
|
private |
Definition at line 362 of file ppu.h.
Referenced by EvaluateSprites(), Reset(), and Write().
|
private |
Definition at line 363 of file ppu.h.
Referenced by EvaluateSprites(), GetPixel(), Reset(), and RunLine().
|
private |
Definition at line 364 of file ppu.h.
Referenced by EvaluateSprites(), GetPixel(), and Reset().
|
private |
Definition at line 367 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 368 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 369 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 370 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 371 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 372 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 373 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 374 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 375 of file ppu.h.
Referenced by HandlePixel(), Reset(), and Write().
|
private |
Definition at line 378 of file ppu.h.
Referenced by GetPixel(), Reset(), and Write().
|
private |
Definition at line 381 of file ppu.h.
Referenced by CalculateMode7Starts(), GetPixelForMode7(), Read(), Reset(), and Write().
|
private |
|
private |
Definition at line 383 of file ppu.h.
Referenced by GetPixelForMode7(), Reset(), and Write().
|
private |
Definition at line 384 of file ppu.h.
Referenced by GetPixelForMode7(), Reset(), and Write().
|
private |
Definition at line 385 of file ppu.h.
Referenced by GetPixelForMode7(), Reset(), and Write().
|
private |
Definition at line 386 of file ppu.h.
Referenced by CalculateMode7Starts(), Reset(), and Write().
|
private |
Definition at line 387 of file ppu.h.
Referenced by GetPixel(), Reset(), and Write().
|
private |
Definition at line 390 of file ppu.h.
Referenced by CalculateMode7Starts(), GetPixelForMode7(), and Reset().
|
private |
Definition at line 391 of file ppu.h.
Referenced by CalculateMode7Starts(), GetPixelForMode7(), and Reset().
|
private |
Definition at line 394 of file ppu.h.
Referenced by GetWindowState(), Reset(), and Write().
|
private |
Definition at line 395 of file ppu.h.
Referenced by GetWindowState(), Reset(), and Write().
|
private |
Definition at line 396 of file ppu.h.
Referenced by GetWindowState(), Reset(), and Write().
|
private |
Definition at line 397 of file ppu.h.
Referenced by GetWindowState(), Reset(), and Write().
|
private |
Definition at line 398 of file ppu.h.
Referenced by GetWindowState(), Reset(), and Write().
|
private |
|
private |
Definition at line 402 of file ppu.h.
Referenced by CalculateMode7Starts(), GetPixel(), HandleFrameStart(), Reset(), and Write().
|
private |
Definition at line 404 of file ppu.h.
Referenced by CalculateMode7Starts(), GetOffsetValue(), GetPixel(), GetPixelForBgLayer(), HandleOPT(), Reset(), and Write().
|
private |
|
private |
|
private |
Definition at line 407 of file ppu.h.
Referenced by CalculateMode7Starts(), GetPixel(), Reset(), and Write().
|
private |
Definition at line 411 of file ppu.h.
Referenced by HandlePixel(), PutPixels(), and Reset().
|
private |
Definition at line 412 of file ppu.h.
Referenced by HandlePixel(), and Init().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Definition at line 434 of file ppu.h.
Referenced by GetFrameBuffer(), and Init().
|
private |