Skip to content

Commit

Permalink
Lay the groundwork for PPU window support
Browse files Browse the repository at this point in the history
  • Loading branch information
Hydr8gon committed Nov 15, 2024
1 parent 1278ef3 commit b25051a
Show file tree
Hide file tree
Showing 4 changed files with 400 additions and 117 deletions.
41 changes: 28 additions & 13 deletions src/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#define SECTION_INC 1

// The frame section data structure's size in bytes
#define SECTION_SIZE 0x30
#define SECTION_SIZE 0x40

// Flags for tracking JIT block state
#define FLAG_SX (1 << 0)
Expand Down Expand Up @@ -163,14 +163,25 @@
#define M7D (M7C + 0x2)
#define M7X (M7D + 0x2)
#define M7Y (M7X + 0x2)
#define FILL_COLOR (M7Y + 0x2)
#define BGXSC (FILL_COLOR + 0x2)
#define OBSEL (BGXSC + 0x4)
#define WBGSEL (M7Y + 0x2)
#define SUB_COLOR (WBGSEL + 0x2)
#define MAIN_COLOR (SUB_COLOR + 0x2)
#define BGXSC (MAIN_COLOR + 0x2)
#define WHX (BGXSC + 0x4)
#define OBSEL (WHX + 0x4)
#define M7SEL (OBSEL + 0x1)
#define TS (M7SEL + 0x1)
#define WOBJSEL (M7SEL + 0x1)
#define WBGLOG (WOBJSEL + 0x1)
#define WOBJLOG (WBGLOG + 0x1)
#define CGWSEL (WOBJLOG + 0x1)
#define CGADSUB (CGWSEL + 0x1)
#define TS (CGADSUB + 0x1)
#define TM (TS + 0x1)
#define BG_MODE (TM + 0x1)
#define SPLIT_LINE (BG_MODE + 0x1)
#define TSW (TM + 0x1)
#define TMW (TSW + 0x1)
#define BG_MODE (TMW + 0x1)
#define FORCE_BLANK (BG_MODE + 0x1)
#define SPLIT_LINE (FORCE_BLANK + 0x1)
// Start of frame values
#define MASK_SEL (SPLIT_LINE + 0x1)
#define FB_OFFSET (MASK_SEL + 0x8)
Expand All @@ -184,18 +195,22 @@
// End of frame values
#define RDP_INIT (FRAMEBUFFER + 0x8)
#define RDP_FRAME (RDP_INIT + 0x40)
#define RDP_SECTION (RDP_FRAME + 0x18)
#define RDP_TILE (RDP_SECTION + 0x30)
#define RDP_FILL (RDP_FRAME + 0x18)
#define RDP_TILE (RDP_FILL + 0x38)
#define RDP_TILE7 (RDP_TILE + 0x28)
#define TILE_PARAMS (RDP_TILE7 + 0x78)
#define LAYER_CHART (TILE_PARAMS + 0x20)
#define OBJ_SIZES (LAYER_CHART + 0x90)
#define SCRN_OFSH (OBJ_SIZES + 0x20)
#define SCRN_OFSV (SCRN_OFSH + 0x8)
#define TILE_JUMPS (SCRN_OFSV + 0x8)
#define MAX_OBJECT (TILE_JUMPS + 0xC)
#define SCRN_OFSV (OBJ_SIZES + 0x20)
#define FILL_JUMPS (SCRN_OFSV + 0x8)
#define TILE_JUMPS (FILL_JUMPS + 0x10)
#define TEXREC_OFS (TILE_JUMPS + 0xC)
#define FILLREC_MASK (TEXREC_OFS + 0x4)
#define LDBLK_BITS (FILLREC_MASK + 0x4)
#define MAX_OBJECT (LDBLK_BITS + 0x4)
#define WRAP_BOUND (MAX_OBJECT + 0x2)
#define PRIO_CHECKS (WRAP_BOUND + 0x2)
#define WIN_BOUNDS (PRIO_CHECKS + 0x8)
#define VEC_DATA 0xF70

// Macros that convert addresses between cached and uncached
Expand Down
9 changes: 5 additions & 4 deletions src/memory.S
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,11 @@ write_iomap:
.word write_bg4vofs, write_vmain, write_vmaddl, write_vmaddh // 0x2114-0x2117
.word write_vmdatal, write_vmdatah, write_m7sel, write_m7a // 0x2118-0x211B
.word write_m7b, write_m7c, write_m7d, write_m7x // 0x211C-0x211F
.word write_m7y, write_cgadd, write_cgdata, write_unk // 0x2120-0x2123
.word write_unk:(0x212B - 0x2123) // 0x2124-0x212B
.word write_tm, write_ts, write_unk, write_unk // 0x212C-0x212F
.word write_unk, write_cgadsub, write_coldata, write_setini // 0x2130-0x2133
.word write_m7y, write_cgadd, write_cgdata, write_w12sel // 0x2120-0x2123
.word write_w34sel, write_wobjsel, write_wh0, write_wh1 // 0x2124-0x2127
.word write_wh2, write_wh3, write_wbglog, write_wobjlog // 0x2128-0x212B
.word write_tm, write_ts, write_tmw, write_tsw // 0x212C-0x212F
.word write_cgwsel, write_cgadsub, write_coldata, write_setini // 0x2130-0x2133
.word write_unk:(0x213F - 0x2133) // 0x2134-0x213F
.word write_apuio0, write_apuio1, write_apuio2, write_apuio3 // 0x2140-0x2143
.word write_apuio0, write_apuio1, write_apuio2, write_apuio3 // 0x2144-0x2147
Expand Down
Loading

0 comments on commit b25051a

Please sign in to comment.