emu_nes/ppu.h

47 lines
934 B
C
Raw Normal View History

2024-07-21 13:53:04 -04:00
#ifndef PPU_H
#define PPU_H
#include <stdio.h>
#include <stdint.h>
#include "rom.h"
struct ppu {
uint8_t oam[64*4];
uint8_t vram[2048];
uint8_t palette[16*2];
uint16_t cycles, scanlines;
2024-07-21 14:48:29 -04:00
struct rom *rom;
2024-08-31 22:25:12 -04:00
struct ppu_ctrl { /* $2000 */
uint8_t nmi_enable : 1;
uint8_t master_slave : 1;
uint8_t sprite_height : 1;
uint8_t bg_tile_sel : 1;
uint8_t sprite_tile_sel : 1;
uint8_t inc_mode : 1;
uint8_t nametable_sel : 2;
} ctrl;
struct ppu_mask { /* $2001 */
uint8_t colour_emphasis : 3;
uint8_t sprite_enable : 1;
uint8_t bg_enable : 1;
uint8_t sprite_left_enable : 1;
uint8_t bg_left_enable : 1;
uint8_t grayscale : 1;
} mask;
struct ppu_status { /* $2002 */
uint8_t vblank : 1;
uint8_t sprite0_hit : 1;
uint8_t sprite_overflow : 1;
uint8_t pad : 5;
} status;
uint8_t oam_addr; /* $2003 */
uint8_t oam_data; /* $2004 */
2024-07-21 13:53:04 -04:00
};
extern struct ppu ppu;
void ppu_tick(void);
#endif /* PPU_H */