// // Created by william on 7/23/24. // #ifndef NES_EMULATOR_DBG_NAMETABLE_H #define NES_EMULATOR_DBG_NAMETABLE_H #include #include "../include/types.h" #include "dbg_pattern_table.h" #define NAMETABLE_BANK_SIZE 0x3c0 #define NAMETABLE_ROW_WIDTH 32 #define NAMETABLE_COL_HEIGHT 30 typedef struct dbg_tile { int tile_id; int attribute; } DebugTile; typedef struct dbg_nametable { DebugTile bank_0[NAMETABLE_BANK_SIZE]; DebugTile bank_1[NAMETABLE_BANK_SIZE]; bool vertical_mirroring; bool initialized; } DebugNameTable; /** * Initializes the debug tile_id. */ void dbg_nametable_init(); /** * Updates the debug tile_id. Updates the tiles from the PPU memory. */ void dbg_nametable_update(); /** * Renders a tile_id bank to a buffer. * @param bank * @param buffer */ void dbg_nametable_render_bank(int bank, pixel *buffer); #endif //NES_EMULATOR_DBG_NAMETABLE_H