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)
13 if (ppu.scanlines >= 262) 13 if (ppu.scanlines >= 262)
14 ppu.scanlines -= 262; 14 ppu.scanlines -= 262;
15} 15}
16
17uint8_t
18ppu_read(uint16_t addr)
19{
20}
21
22void
23ppu_write(uint16_t addr, uint8_t byte)
24{
25 static uint8_t prev;
26
27 prev = byte;
28}
diff --git a/ppu.h b/ppu.h
index 6bc8b5a..ffd66d7 100644
--- a/ppu.h
+++ b/ppu.h
@@ -12,6 +12,32 @@ struct ppu {
12 uint8_t palette[16*2]; 12 uint8_t palette[16*2];
13 uint16_t cycles, scanlines; 13 uint16_t cycles, scanlines;
14 struct rom *rom; 14 struct rom *rom;
15
16 struct ppu_ctrl { /* $2000 */
17 uint8_t nmi_enable : 1;
18 uint8_t master_slave : 1;
19 uint8_t sprite_height : 1;
20 uint8_t bg_tile_sel : 1;
21 uint8_t sprite_tile_sel : 1;
22 uint8_t inc_mode : 1;
23 uint8_t nametable_sel : 2;
24 } ctrl;
25 struct ppu_mask { /* $2001 */
26 uint8_t colour_emphasis : 3;
27 uint8_t sprite_enable : 1;
28 uint8_t bg_enable : 1;
29 uint8_t sprite_left_enable : 1;
30 uint8_t bg_left_enable : 1;
31 uint8_t grayscale : 1;
32 } mask;
33 struct ppu_status { /* $2002 */
34 uint8_t vblank : 1;
35 uint8_t sprite0_hit : 1;
36 uint8_t sprite_overflow : 1;
37 uint8_t pad : 5;
38 } status;
39 uint8_t oam_addr; /* $2003 */
40 uint8_t oam_data; /* $2004 */
15}; 41};
16extern struct ppu ppu; 42extern struct ppu ppu;
17 43