diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-02-25 13:08:00 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-02-25 13:08:00 +0100 |
commit | 5850f4ab766256791f72301349e30d4cd304c675 (patch) | |
tree | ae72fb95eb7a028eb0a86fdc07340d97942f285a /src/ppu | |
parent | 1a2bd8b70c12d497acb2eba548d161b2bfc4f9b6 (diff) |
ppusim done
Diffstat (limited to 'src/ppu')
-rw-r--r-- | src/ppu/internals.c | 11 | ||||
-rw-r--r-- | src/ppu/internals.h | 2 | ||||
-rw-r--r-- | src/ppu/ppu.c | 2 | ||||
-rw-r--r-- | src/ppu/ppu.h | 2 |
4 files changed, 9 insertions, 8 deletions
diff --git a/src/ppu/internals.c b/src/ppu/internals.c index 7826ece..e4817f1 100644 --- a/src/ppu/internals.c +++ b/src/ppu/internals.c @@ -4,8 +4,9 @@ #include "ppu/internals.h" bool hh_ppu_vram_valid_address(hh_ppu_addr_t addr) { + #warning unimlemented (void) addr; // compiler bruh - return true; // TODO + return true; } void hh_ppu_vram_write(hh_s_ppu_vram_data data) { @@ -36,7 +37,7 @@ hh_s_ppu_vram_data hh_ppu_2nat_fam(hh_s_ppu_loc_fam_entry e) { data[0] = HH_RESIZE(e.tilemap_index, 9, 0) << 0 | HH_RESIZE(e.palette_index, 2, 0) << 10 | HH_RESIZE(e.position_y, 2, 0) << 13; - data[1] = HH_RESIZE(e.position_y, 4, 0) << 0 | + data[1] = HH_RESIZE(e.position_y, 7, 3) << 0 | HH_RESIZE(e.position_x, 8, 0) << 5 | e.vertical_flip << 14 | e.horizontal_flip << 15; @@ -64,7 +65,7 @@ hh_s_ppu_vram_data hh_ppu_2nat_aux(hh_s_ppu_loc_aux aux) { return out; } -hh_s_ppu_vram_data hh_ppu_2nat_sprite(hh_ppu_loc_sprite_data_t sprite_data) { +hh_s_ppu_vram_data hh_ppu_2nat_sprite(const hh_ppu_loc_sprite_data_t sprite_data) { hh_ppu_data_t* data = malloc(sizeof(hh_ppu_data_t) * HH_PPU_VRAM_TMM_SPRITE_SIZE); for (unsigned i = 0; i < HH_PPU_SPRITE_WIDTH * HH_PPU_SPRITE_HEIGHT; i++) { @@ -84,9 +85,9 @@ hh_s_ppu_vram_data hh_ppu_2nat_sprite(hh_ppu_loc_sprite_data_t sprite_data) { hh_s_ppu_vram_data hh_ppu_2nat_color(hh_ppu_rgb_color_t rgb) { hh_ppu_data_t* data = malloc(sizeof(hh_ppu_data_t) * HH_PPU_VRAM_PAL_ENTRY_SIZE); - data[0] = HH_RESIZE(rgb[0], 3, 0) << 0 | + data[0] = HH_RESIZE(rgb[0], 3, 0) << 8 | HH_RESIZE(rgb[1], 3, 0) << 4 | - HH_RESIZE(rgb[2], 3, 0) << 8; + HH_RESIZE(rgb[2], 3, 0) << 0; hh_s_ppu_vram_data out = { .data = data, diff --git a/src/ppu/internals.h b/src/ppu/internals.h index 6e9dda7..8f50c52 100644 --- a/src/ppu/internals.h +++ b/src/ppu/internals.h @@ -25,6 +25,6 @@ void hh_ppu_vram_write(hh_s_ppu_vram_data data); hh_s_ppu_vram_data hh_ppu_2nat_bam(hh_s_ppu_loc_bam_entry); hh_s_ppu_vram_data hh_ppu_2nat_fam(hh_s_ppu_loc_fam_entry); hh_s_ppu_vram_data hh_ppu_2nat_aux(hh_s_ppu_loc_aux); -hh_s_ppu_vram_data hh_ppu_2nat_sprite(hh_ppu_loc_sprite_data_t); +hh_s_ppu_vram_data hh_ppu_2nat_sprite(const hh_ppu_loc_sprite_data_t); hh_s_ppu_vram_data hh_ppu_2nat_color(hh_ppu_rgb_color_t); diff --git a/src/ppu/ppu.c b/src/ppu/ppu.c index e2fccb9..5f33c55 100644 --- a/src/ppu/ppu.c +++ b/src/ppu/ppu.c @@ -18,7 +18,7 @@ void hh_ppu_update_background(unsigned index, hh_s_ppu_loc_bam_entry e) { free(s.data); } -void hh_ppu_update_sprite(unsigned tilemap_index, hh_s_ppu_loc_sprite sprite) { +void hh_ppu_update_sprite(unsigned tilemap_index, const hh_s_ppu_loc_sprite sprite) { hh_s_ppu_vram_data s = hh_ppu_2nat_sprite(sprite); s.offset = HH_PPU_VRAM_TMM_OFFSET + HH_PPU_VRAM_TMM_SPRITE_SIZE * tilemap_index; hh_ppu_vram_write(s); diff --git a/src/ppu/ppu.h b/src/ppu/ppu.h index 90f964e..cab0e30 100644 --- a/src/ppu/ppu.h +++ b/src/ppu/ppu.h @@ -13,7 +13,7 @@ void hh_ppu_update_background(unsigned index, hh_s_ppu_loc_bam_entry e); /* @brief update aux register */ void hh_ppu_update_aux(hh_s_ppu_loc_aux aux); /* @brief update single sprite */ -void hh_ppu_update_sprite(unsigned tilemap_index, hh_s_ppu_loc_sprite sprite); +void hh_ppu_update_sprite(unsigned tilemap_index, const hh_s_ppu_loc_sprite sprite); /* @brief update entire palette table */ void hh_ppu_update_palette_table(hh_ppu_loc_palette_table_t table); /* @brief update single palette */ |