summaryrefslogtreecommitdiff
path: root/ppu.h
diff options
context:
space:
mode:
authorvin <git@vineetk.net>2024-09-01 15:39:32 -0400
committervin <git@vineetk.net>2024-09-01 15:39:32 -0400
commit2084552c536a8299a3578c8b9b687cff98e6d9a3 (patch)
tree0a4db4405e2dfaf4d9ee63c1f86b2836790bfbe1 /ppu.h
parentf591b4adf2cfe5d7cde5ecccf95879bfe09cf57a (diff)
add basic ppu register reading
Diffstat (limited to 'ppu.h')
-rw-r--r--ppu.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/ppu.h b/ppu.h
index ffd66d7..c5483e1 100644
--- a/ppu.h
+++ b/ppu.h
@@ -7,12 +7,23 @@
#include "rom.h"
struct ppu {
- uint8_t oam[64*4];
uint8_t vram[2048];
+ uint8_t oam[64*4];
+ uint8_t oam_addr; /* $2003 */
uint8_t palette[16*2];
uint16_t cycles, scanlines;
struct rom *rom;
+ uint8_t last_read;
+
+ struct ppu_regs {
+ uint16_t v : 15; /* current vram address */
+ uint16_t t : 15; /* temporary vram address */
+ uint8_t x : 3; /* fine x scroll */
+ uint8_t w : 1; /* first/second write toggle */
+ uint8_t padding : 6;
+ } regs;
+
struct ppu_ctrl { /* $2000 */
uint8_t nmi_enable : 1;
uint8_t master_slave : 1;
@@ -36,8 +47,6 @@ struct ppu {
uint8_t sprite_overflow : 1;
uint8_t pad : 5;
} status;
- uint8_t oam_addr; /* $2003 */
- uint8_t oam_data; /* $2004 */
};
extern struct ppu ppu;