summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvin <git@vineetk.net>2024-08-31 22:25:12 -0400
committervin <git@vineetk.net>2024-09-01 01:49:40 -0400
commitf591b4adf2cfe5d7cde5ecccf95879bfe09cf57a (patch)
tree857e5f66e4472b42dfd2c8c673b99fc47c23399b
parent279478f16f8ea4fcc3c8765ff964954368664106 (diff)
start working on ppu
-rw-r--r--ppu.c13
-rw-r--r--ppu.h26
2 files changed, 39 insertions, 0 deletions
diff --git a/ppu.c b/ppu.c
index 4ae0162..5dc20a3 100644
--- a/ppu.c
+++ b/ppu.c
@@ -13,3 +13,16 @@ ppu_tick(void)
if (ppu.scanlines >= 262)
ppu.scanlines -= 262;
}
+
+uint8_t
+ppu_read(uint16_t addr)
+{
+}
+
+void
+ppu_write(uint16_t addr, uint8_t byte)
+{
+ static uint8_t prev;
+
+ prev = byte;
+}
diff --git a/ppu.h b/ppu.h
index 6bc8b5a..ffd66d7 100644
--- a/ppu.h
+++ b/ppu.h
@@ -12,6 +12,32 @@ struct ppu {
uint8_t palette[16*2];
uint16_t cycles, scanlines;
struct rom *rom;
+
+ 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 */
};
extern struct ppu ppu;