From a84cadcfaa2e6ee506dc70bd0bc25f67307bb41c Mon Sep 17 00:00:00 2001 From: Zack Buhman Date: Sat, 13 Sep 2025 21:10:08 -0500 Subject: [PATCH] voodoo2.h: initial --- .gitignore | 3 + generate.py | 35 ++++++ voodoo2.h | 337 ++++++++++++++++++++++++++++++++++++++++++++++++++++ voodoo2.py | 215 +++++++++++++++++++++++++++++++++ voodoo2.txt | 194 ++++++++++++++++++++++++++++++ 5 files changed, 784 insertions(+) create mode 100644 .gitignore create mode 100644 generate.py create mode 100644 voodoo2.h create mode 100644 voodoo2.py create mode 100644 voodoo2.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f8a518d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.pyc +__pycache__ +*.gch diff --git a/generate.py b/generate.py new file mode 100644 index 0000000..ab78179 --- /dev/null +++ b/generate.py @@ -0,0 +1,35 @@ +import io + +def should_autonewline(line): + return ( + "static_assert" not in line + and "extern" not in line + and (len(line.split()) < 2 or line.split()[1] != '=') # hacky; meh + ) + +def _render(out, lines): + indent = " " + level = 0 + for l in lines: + if l and (l[0] == "}" or l[0] == ")"): + level -= 2 + assert level >= 0 + + if len(l) == 0: + out.write("\n") + else: + out.write(indent * level + l + "\n") + + if l and (l[-1] == "{" or l[-1] == "("): + level += 2 + + if level == 0 and l and l[-1] == ";": + if should_autonewline(l): + out.write("\n") + return out + +def renderer(): + out = io.StringIO() + def render(lines): + return _render(out, lines) + return render, out diff --git a/voodoo2.h b/voodoo2.h new file mode 100644 index 0000000..39218a7 --- /dev/null +++ b/voodoo2.h @@ -0,0 +1,337 @@ +#pragma once + +#include +#include + +typedef volatile uint32_t reg32; + + +struct voodoo2_reg { + reg32 status; // (r ) Voodoo2 Graphics Status + reg32 intrCtrl; // (rw) Interrupt Status and Control + reg32 vertexAx; // ( w) Vertex A x-coordinate location (12.4 format) + reg32 vertexAy; // ( w) Vertex A y-coordinate location (12.4 format) + reg32 vertexBx; // ( w) Vertex B x-coordinate location (12.4 format) + reg32 vertexBy; // ( w) Vertex B y-coordinate location (12.4 format) + reg32 vertexCx; // ( w) Vertex C x-coordinate location (12.4 format) + reg32 vertexCy; // ( w) Vertex C y-coordinate location (12.4 format) + reg32 startR; // ( w) Starting Red parameter (12.12 format) + reg32 startG; // ( w) Starting Green parameter (12.12 format) + reg32 startB; // ( w) Starting Blue parameter (12.12 format) + reg32 startZ; // ( w) Starting Z parameter (20.12 format) + reg32 startA; // ( w) Starting Alpha parameter (12.12 format) + reg32 startS; // ( w) Starting S/W parameter (14.18 format) + reg32 startT; // ( w) Starting T/W parameter (14.18 format) + reg32 startW; // ( w) Starting 1/W parameter (2.30 format) + reg32 dRdX; // ( w) Change in Red with respect to X (12.12 format) + reg32 dGdX; // ( w) Change in Green with respect to X (12.12 format) + reg32 dBdX; // ( w) Change in Blue with respect to X (12.12 format) + reg32 dZdX; // ( w) Change in Z with respect to X (20.12 format) + reg32 dAdX; // ( w) Change in Alpha with respect to X (12.12 format) + reg32 dSdX; // ( w) Change in S/W with respect to X (14.18 format) + reg32 dTdX; // ( w) Change in T/W with respect to X (14.18 format) + reg32 dWdX; // ( w) Change in 1/W with respect to X (2.30 format) + reg32 dRdY; // ( w) Change in Red with respect to Y (12.12 format) + reg32 dGdY; // ( w) Change in Green with respect to Y (12.12 format) + reg32 dBdY; // ( w) Change in Blue with respect to Y (12.12 format) + reg32 dZdY; // ( w) Change in Z with respect to Y (20.12 format) + reg32 dAdY; // ( w) Change in Alpha with respect to Y (12.12 format) + reg32 dSdY; // ( w) Change in S/W with respect to Y (14.18 format) + reg32 dTdY; // ( w) Change in T/W with respect to Y (14.18 format) + reg32 dWdY; // ( w) Change in 1/W with respect to Y (2.30 format) + reg32 triangleCMD; // ( w) Execute TRIANGLE command (floating point) + reg32 _reserved0[1]; + reg32 fvertexAx; // ( w) Vertex A x-coordinate location (floating point) + reg32 fvertexAy; // ( w) Vertex A y-coordinate location (floating point) + reg32 fvertexBx; // ( w) Vertex B x-coordinate location (floating point) + reg32 fvertexBy; // ( w) Vertex B y-coordinate location (floating point) + reg32 fvertexCx; // ( w) Vertex C x-coordinate location (floating point) + reg32 fvertexCy; // ( w) Vertex C y-coordinate location (floating point) + reg32 fstartR; // ( w) Starting Red parameter (floating point) + reg32 fstartG; // ( w) Starting Green parameter (floating point) + reg32 fstartB; // ( w) Starting Blue parameter (floating point) + reg32 fstartZ; // ( w) Starting Z parameter (floating point) + reg32 fstartA; // ( w) Starting Alpha parameter (floating point) + reg32 fstartS; // ( w) Starting S/W parameter (floating point) + reg32 fstartT; // ( w) Starting T/W parameter (floating point) + reg32 fstartW; // ( w) Starting 1/W parameter (floating point) + reg32 fdRdX; // ( w) Change in Red with respect to X (floating point) + reg32 fdGdX; // ( w) Change in Green with respect to X (floating point) + reg32 fdBdX; // ( w) Change in Blue with respect to X (floating point) + reg32 fdZdX; // ( w) Change in Z with respect to X (floating point) + reg32 fdAdX; // ( w) Change in Alpha with respect to X (floating point) + reg32 fdSdX; // ( w) Change in S/W with respect to X (floating point) + reg32 fdTdX; // ( w) Change in T/W with respect to X (floating point) + reg32 fdWdX; // ( w) Change in 1/W with respect to X (floating point) + reg32 fdRdY; // ( w) Change in Red with respect to Y (floating point) + reg32 fdGdY; // ( w) Change in Green with respect to Y (floating point) + reg32 fdBdY; // ( w) Change in Blue with respect to Y (floating point) + reg32 fdZdY; // ( w) Change in Z with respect to Y (floating point) + reg32 fdAdY; // ( w) Change in Alpha with respect to Y (floating point) + reg32 fdSdY; // ( w) Change in S/W with respect to Y (floating point) + reg32 fdTdY; // ( w) Change in T/W with respect to Y (floating point) + reg32 fdWdY; // ( w) Change in 1/W with respect to Y (floating point) + reg32 ftriangleCMD; // ( w) Execute TRIANGLE command (floating point) + reg32 fbzColorPath; // (rw) Chuck Color Path Control + reg32 fogMode; // (rw) Fog Mode Control + reg32 alphaMode; // (rw) Alpha Mode Control + reg32 fbzMode; // (rw) RGB Buffer and Depth-Buffer Control + reg32 lfbMode; // (rw) Linear Frame Buffer Mode Control + reg32 clipLeftRight; // (rw) Left and Right of Clipping Register + reg32 clipLowYHighY; // (rw) Top and Bottom of Clipping Register + reg32 nopCMD; // ( w) Execute NOP command + reg32 fastfillCMD; // ( w) Execute FASTFILL command + reg32 swapbufferCMD; // ( w) Execute SWAPBUFFER command + reg32 fogColor; // ( w) Fog Color Value + reg32 zaColor; // ( w) Constant Alpha/Depth Value + reg32 chromaKey; // ( w) Chroma Key Compare Value + reg32 chromaRange; // ( w) Chroma Range Compare Values,modes,enable + reg32 userIntrCMD; // ( w) Execute USERINTERRUPT command + reg32 stipple; // (rw) Rendering Stipple Value + reg32 color0; // (rw) Constant Color #0 + reg32 color1; // (rw) Constant Color #1 + reg32 fbiPixelsIn; // (r ) Pixel Counter (Number pixels processed) + reg32 fbiChromaFail; // (r ) Pixel Counter (Number pixels failed Chroma test) + reg32 fbiZfuncFail; // (r ) Pixel Counter (Number pixels failed Z test) + reg32 fbiAfuncFail; // (r ) Pixel Counter (Number pixels failed Alpha test) + reg32 fbiPixelsOut; // (r ) Pixel Counter (Number pixels drawn) + reg32 fogTable[32]; // ( w) Fog Table + reg32 cmdFifoBaseAddr; // (rw) CMDFIFO base address and size + reg32 cmdFifoBump; // (rw) CMDFIFO bump depth + reg32 cmdFifoRdPtr; // (rw) CMDFIFO current read pointer + reg32 cmdFifoAMin; // (rw) CMDFIFO current minimum address + reg32 cmdFifoAMax; // (rw) CMDFIFO current maximum address + reg32 cmdFifoDepth; // (rw) CMDFIFO current depth + reg32 cmdFifoHoles; // (rw) CMDFIFO number of holes + reg32 _reserved1[1]; + reg32 fbiInit4; // (rw) Chuck Hardware Initialization (register 4) + reg32 vRetrace; // (r ) Vertical Retrace Counter + reg32 backPorch; // (rw) Video Backporch Timing Generator + reg32 videoDimensions; // (rw) Video Screen Dimensions + reg32 fbiInit0; // (rw) Chuck Hardware Initialization (register 0) + reg32 fbiInit1; // (rw) Chuck Hardware Initialization (register 1) + reg32 fbiInit2; // (rw) Chuck Hardware Initialization (register 2) + reg32 fbiInit3; // (rw) Chuck Hardware Initialization (register 3) + reg32 hSync; // ( w) Horizontal Sync Timing Generator + reg32 vSync; // ( w) Vertical Sync Timing Generator + reg32 clutData; // ( w) Video Color Lookup Table Initialization + reg32 dacData; // ( w) External DAC Initialization + reg32 maxRgbDelta; // ( w) Max. RGB difference for Video Filtering + reg32 hBorder; // ( w) Horizontal Border Color Control + reg32 vBorder; // ( w) Vertical Border Color Control + reg32 borderColor; // ( w) Video Border Color + reg32 hvRetrace; // (r ) Horizontal and Vertical Retrace Counters (synced) + reg32 fbiInit5; // (rw) Chuck Hardware Initialization (register 5) + reg32 fbiInit6; // (rw) Chuck Hardware Initialization (register 6) + reg32 fbiInit7; // (rw) Chuck Hardware Initialization (register 7) + reg32 _reserved2[2]; + reg32 fbiSwapHistory; // (r ) Swap History Register + reg32 fbiTrianglesOut; // (r ) Triangle Counter (Number triangles drawn) + reg32 sSetupMode; // ( w) Triangle setup mode + reg32 sVx; // ( w) Triangle setup X + reg32 sVy; // ( w) Triangle setup Y + reg32 sARGB; // ( w) Triangle setup Alpha, Red, Green, Blue + reg32 sRed; // ( w) Triangle setup Red value + reg32 sGreen; // ( w) Triangle setup Green value + reg32 sBlue; // ( w) Triangle setup Blue value + reg32 sAlpha; // ( w) Triangle setup Alpha value + reg32 sVz; // ( w) Triangle setup Z + reg32 sWb; // ( w) Triangle setup Global W + reg32 sWtmu0; // ( w) Triangle setup Tmu0 & Tmu1 W + reg32 sS_W0; // ( w) Triangle setup Tmu0 & Tmu1 S/W + reg32 sT_W0; // ( w) Triangle setup Tmu0 & Tmu1 T/W + reg32 sWtmu1; // ( w) Triangle setup Tmu1 only W + reg32 sS_Wtmu1; // ( w) Triangle setup Tmu1 only S/W + reg32 sT_Wtmu1; // ( w) Triangle setup Tmu1 only T/W + reg32 sDrawTriCMD; // ( w) Triangle setup (Draw) + reg32 sBeginTriCMD; // ( w) Triangle setup Start New triangle + reg32 _reserved3[6]; + reg32 bltSrcBaseAddr; // (rw) BitBLT Source base address + reg32 bltDstBaseAddr; // (rw) BitBLT Destination base address + reg32 bltXYStrides; // (rw) BitBLT Source and Destination strides + reg32 bltSrcChromaRange; // (rw) BiBLT Source Chroma key range + reg32 bltDstChromaRange; // (rw) BitBLT Destination Chroma key range + reg32 bltClipX; // (rw) BitBLT Min/Max X clip values + reg32 bltClipY; // (rw) BitBLT Min/Max Y clip values + reg32 _reserved4[1]; + reg32 bltSrcXY; // (rw) BitBLT Source starting XY coordinates + reg32 bltDstXY; // (rw) BitBLT Destination starting XY coordinates + reg32 bltSize; // (rw) BitBLT width and height + reg32 bltRop; // (rw) BitBLT Raster operations + reg32 bltColor; // (rw) BitBLT and foreground background colors + reg32 _reserved5[1]; + reg32 bltCommand; // (rw) BitBLT command mode + reg32 bltData; // ( w) BitBLT data for CPU-to-Screen BitBLTs + reg32 textureMode; // ( w) Texture Mode Control + reg32 tLOD; // ( w) Texture LOD Settings + reg32 tDetail; // ( w) Texture LOD Settings + reg32 texBaseAddr; // ( w) Texture Base Address + reg32 texBaseAddr_1; // ( w) Texture Base Address (supplemental LOD 1) + reg32 texBaseAddr_2; // ( w) Texture Base Address (supplemental LOD 2) + reg32 texBaseAddr_3_8; // ( w) Texture Base Address (supplemental LOD 3-8) + reg32 trexInit0; // ( w) Bruce Hardware Initialization (register 0) + reg32 trexInit1; // ( w) Bruce Hardware Initialization (register 1) + reg32 nccTable0[12]; // ( w) Narrow Channel Compression Table 0 (12 entries) + reg32 nccTable1[12]; // ( w) Narrow Channel Compression Table 1 (12 entries) +}; + +static_assert((offsetof (struct voodoo2_reg, status)) == 0x000); +static_assert((offsetof (struct voodoo2_reg, intrCtrl)) == 0x004); +static_assert((offsetof (struct voodoo2_reg, vertexAx)) == 0x008); +static_assert((offsetof (struct voodoo2_reg, vertexAy)) == 0x00c); +static_assert((offsetof (struct voodoo2_reg, vertexBx)) == 0x010); +static_assert((offsetof (struct voodoo2_reg, vertexBy)) == 0x014); +static_assert((offsetof (struct voodoo2_reg, vertexCx)) == 0x018); +static_assert((offsetof (struct voodoo2_reg, vertexCy)) == 0x01c); +static_assert((offsetof (struct voodoo2_reg, startR)) == 0x020); +static_assert((offsetof (struct voodoo2_reg, startG)) == 0x024); +static_assert((offsetof (struct voodoo2_reg, startB)) == 0x028); +static_assert((offsetof (struct voodoo2_reg, startZ)) == 0x02c); +static_assert((offsetof (struct voodoo2_reg, startA)) == 0x030); +static_assert((offsetof (struct voodoo2_reg, startS)) == 0x034); +static_assert((offsetof (struct voodoo2_reg, startT)) == 0x038); +static_assert((offsetof (struct voodoo2_reg, startW)) == 0x03c); +static_assert((offsetof (struct voodoo2_reg, dRdX)) == 0x040); +static_assert((offsetof (struct voodoo2_reg, dGdX)) == 0x044); +static_assert((offsetof (struct voodoo2_reg, dBdX)) == 0x048); +static_assert((offsetof (struct voodoo2_reg, dZdX)) == 0x04c); +static_assert((offsetof (struct voodoo2_reg, dAdX)) == 0x050); +static_assert((offsetof (struct voodoo2_reg, dSdX)) == 0x054); +static_assert((offsetof (struct voodoo2_reg, dTdX)) == 0x058); +static_assert((offsetof (struct voodoo2_reg, dWdX)) == 0x05c); +static_assert((offsetof (struct voodoo2_reg, dRdY)) == 0x060); +static_assert((offsetof (struct voodoo2_reg, dGdY)) == 0x064); +static_assert((offsetof (struct voodoo2_reg, dBdY)) == 0x068); +static_assert((offsetof (struct voodoo2_reg, dZdY)) == 0x06c); +static_assert((offsetof (struct voodoo2_reg, dAdY)) == 0x070); +static_assert((offsetof (struct voodoo2_reg, dSdY)) == 0x074); +static_assert((offsetof (struct voodoo2_reg, dTdY)) == 0x078); +static_assert((offsetof (struct voodoo2_reg, dWdY)) == 0x07c); +static_assert((offsetof (struct voodoo2_reg, triangleCMD)) == 0x080); +static_assert((offsetof (struct voodoo2_reg, fvertexAx)) == 0x088); +static_assert((offsetof (struct voodoo2_reg, fvertexAy)) == 0x08c); +static_assert((offsetof (struct voodoo2_reg, fvertexBx)) == 0x090); +static_assert((offsetof (struct voodoo2_reg, fvertexBy)) == 0x094); +static_assert((offsetof (struct voodoo2_reg, fvertexCx)) == 0x098); +static_assert((offsetof (struct voodoo2_reg, fvertexCy)) == 0x09c); +static_assert((offsetof (struct voodoo2_reg, fstartR)) == 0x0a0); +static_assert((offsetof (struct voodoo2_reg, fstartG)) == 0x0a4); +static_assert((offsetof (struct voodoo2_reg, fstartB)) == 0x0a8); +static_assert((offsetof (struct voodoo2_reg, fstartZ)) == 0x0ac); +static_assert((offsetof (struct voodoo2_reg, fstartA)) == 0x0b0); +static_assert((offsetof (struct voodoo2_reg, fstartS)) == 0x0b4); +static_assert((offsetof (struct voodoo2_reg, fstartT)) == 0x0b8); +static_assert((offsetof (struct voodoo2_reg, fstartW)) == 0x0bc); +static_assert((offsetof (struct voodoo2_reg, fdRdX)) == 0x0c0); +static_assert((offsetof (struct voodoo2_reg, fdGdX)) == 0x0c4); +static_assert((offsetof (struct voodoo2_reg, fdBdX)) == 0x0c8); +static_assert((offsetof (struct voodoo2_reg, fdZdX)) == 0x0cc); +static_assert((offsetof (struct voodoo2_reg, fdAdX)) == 0x0d0); +static_assert((offsetof (struct voodoo2_reg, fdSdX)) == 0x0d4); +static_assert((offsetof (struct voodoo2_reg, fdTdX)) == 0x0d8); +static_assert((offsetof (struct voodoo2_reg, fdWdX)) == 0x0dc); +static_assert((offsetof (struct voodoo2_reg, fdRdY)) == 0x0e0); +static_assert((offsetof (struct voodoo2_reg, fdGdY)) == 0x0e4); +static_assert((offsetof (struct voodoo2_reg, fdBdY)) == 0x0e8); +static_assert((offsetof (struct voodoo2_reg, fdZdY)) == 0x0ec); +static_assert((offsetof (struct voodoo2_reg, fdAdY)) == 0x0f0); +static_assert((offsetof (struct voodoo2_reg, fdSdY)) == 0x0f4); +static_assert((offsetof (struct voodoo2_reg, fdTdY)) == 0x0f8); +static_assert((offsetof (struct voodoo2_reg, fdWdY)) == 0x0fc); +static_assert((offsetof (struct voodoo2_reg, ftriangleCMD)) == 0x100); +static_assert((offsetof (struct voodoo2_reg, fbzColorPath)) == 0x104); +static_assert((offsetof (struct voodoo2_reg, fogMode)) == 0x108); +static_assert((offsetof (struct voodoo2_reg, alphaMode)) == 0x10c); +static_assert((offsetof (struct voodoo2_reg, fbzMode)) == 0x110); +static_assert((offsetof (struct voodoo2_reg, lfbMode)) == 0x114); +static_assert((offsetof (struct voodoo2_reg, clipLeftRight)) == 0x118); +static_assert((offsetof (struct voodoo2_reg, clipLowYHighY)) == 0x11c); +static_assert((offsetof (struct voodoo2_reg, nopCMD)) == 0x120); +static_assert((offsetof (struct voodoo2_reg, fastfillCMD)) == 0x124); +static_assert((offsetof (struct voodoo2_reg, swapbufferCMD)) == 0x128); +static_assert((offsetof (struct voodoo2_reg, fogColor)) == 0x12c); +static_assert((offsetof (struct voodoo2_reg, zaColor)) == 0x130); +static_assert((offsetof (struct voodoo2_reg, chromaKey)) == 0x134); +static_assert((offsetof (struct voodoo2_reg, chromaRange)) == 0x138); +static_assert((offsetof (struct voodoo2_reg, userIntrCMD)) == 0x13c); +static_assert((offsetof (struct voodoo2_reg, stipple)) == 0x140); +static_assert((offsetof (struct voodoo2_reg, color0)) == 0x144); +static_assert((offsetof (struct voodoo2_reg, color1)) == 0x148); +static_assert((offsetof (struct voodoo2_reg, fbiPixelsIn)) == 0x14c); +static_assert((offsetof (struct voodoo2_reg, fbiChromaFail)) == 0x150); +static_assert((offsetof (struct voodoo2_reg, fbiZfuncFail)) == 0x154); +static_assert((offsetof (struct voodoo2_reg, fbiAfuncFail)) == 0x158); +static_assert((offsetof (struct voodoo2_reg, fbiPixelsOut)) == 0x15c); +static_assert((offsetof (struct voodoo2_reg, fogTable[0])) == 0x160); +static_assert((offsetof (struct voodoo2_reg, cmdFifoBaseAddr)) == 0x1e0); +static_assert((offsetof (struct voodoo2_reg, cmdFifoBump)) == 0x1e4); +static_assert((offsetof (struct voodoo2_reg, cmdFifoRdPtr)) == 0x1e8); +static_assert((offsetof (struct voodoo2_reg, cmdFifoAMin)) == 0x1ec); +static_assert((offsetof (struct voodoo2_reg, cmdFifoAMax)) == 0x1f0); +static_assert((offsetof (struct voodoo2_reg, cmdFifoDepth)) == 0x1f4); +static_assert((offsetof (struct voodoo2_reg, cmdFifoHoles)) == 0x1f8); +static_assert((offsetof (struct voodoo2_reg, fbiInit4)) == 0x200); +static_assert((offsetof (struct voodoo2_reg, vRetrace)) == 0x204); +static_assert((offsetof (struct voodoo2_reg, backPorch)) == 0x208); +static_assert((offsetof (struct voodoo2_reg, videoDimensions)) == 0x20c); +static_assert((offsetof (struct voodoo2_reg, fbiInit0)) == 0x210); +static_assert((offsetof (struct voodoo2_reg, fbiInit1)) == 0x214); +static_assert((offsetof (struct voodoo2_reg, fbiInit2)) == 0x218); +static_assert((offsetof (struct voodoo2_reg, fbiInit3)) == 0x21c); +static_assert((offsetof (struct voodoo2_reg, hSync)) == 0x220); +static_assert((offsetof (struct voodoo2_reg, vSync)) == 0x224); +static_assert((offsetof (struct voodoo2_reg, clutData)) == 0x228); +static_assert((offsetof (struct voodoo2_reg, dacData)) == 0x22c); +static_assert((offsetof (struct voodoo2_reg, maxRgbDelta)) == 0x230); +static_assert((offsetof (struct voodoo2_reg, hBorder)) == 0x234); +static_assert((offsetof (struct voodoo2_reg, vBorder)) == 0x238); +static_assert((offsetof (struct voodoo2_reg, borderColor)) == 0x23c); +static_assert((offsetof (struct voodoo2_reg, hvRetrace)) == 0x240); +static_assert((offsetof (struct voodoo2_reg, fbiInit5)) == 0x244); +static_assert((offsetof (struct voodoo2_reg, fbiInit6)) == 0x248); +static_assert((offsetof (struct voodoo2_reg, fbiInit7)) == 0x24c); +static_assert((offsetof (struct voodoo2_reg, fbiSwapHistory)) == 0x258); +static_assert((offsetof (struct voodoo2_reg, fbiTrianglesOut)) == 0x25c); +static_assert((offsetof (struct voodoo2_reg, sSetupMode)) == 0x260); +static_assert((offsetof (struct voodoo2_reg, sVx)) == 0x264); +static_assert((offsetof (struct voodoo2_reg, sVy)) == 0x268); +static_assert((offsetof (struct voodoo2_reg, sARGB)) == 0x26c); +static_assert((offsetof (struct voodoo2_reg, sRed)) == 0x270); +static_assert((offsetof (struct voodoo2_reg, sGreen)) == 0x274); +static_assert((offsetof (struct voodoo2_reg, sBlue)) == 0x278); +static_assert((offsetof (struct voodoo2_reg, sAlpha)) == 0x27c); +static_assert((offsetof (struct voodoo2_reg, sVz)) == 0x280); +static_assert((offsetof (struct voodoo2_reg, sWb)) == 0x284); +static_assert((offsetof (struct voodoo2_reg, sWtmu0)) == 0x288); +static_assert((offsetof (struct voodoo2_reg, sS_W0)) == 0x28c); +static_assert((offsetof (struct voodoo2_reg, sT_W0)) == 0x290); +static_assert((offsetof (struct voodoo2_reg, sWtmu1)) == 0x294); +static_assert((offsetof (struct voodoo2_reg, sS_Wtmu1)) == 0x298); +static_assert((offsetof (struct voodoo2_reg, sT_Wtmu1)) == 0x29c); +static_assert((offsetof (struct voodoo2_reg, sDrawTriCMD)) == 0x2a0); +static_assert((offsetof (struct voodoo2_reg, sBeginTriCMD)) == 0x2a4); +static_assert((offsetof (struct voodoo2_reg, bltSrcBaseAddr)) == 0x2c0); +static_assert((offsetof (struct voodoo2_reg, bltDstBaseAddr)) == 0x2c4); +static_assert((offsetof (struct voodoo2_reg, bltXYStrides)) == 0x2c8); +static_assert((offsetof (struct voodoo2_reg, bltSrcChromaRange)) == 0x2cc); +static_assert((offsetof (struct voodoo2_reg, bltDstChromaRange)) == 0x2d0); +static_assert((offsetof (struct voodoo2_reg, bltClipX)) == 0x2d4); +static_assert((offsetof (struct voodoo2_reg, bltClipY)) == 0x2d8); +static_assert((offsetof (struct voodoo2_reg, bltSrcXY)) == 0x2e0); +static_assert((offsetof (struct voodoo2_reg, bltDstXY)) == 0x2e4); +static_assert((offsetof (struct voodoo2_reg, bltSize)) == 0x2e8); +static_assert((offsetof (struct voodoo2_reg, bltRop)) == 0x2ec); +static_assert((offsetof (struct voodoo2_reg, bltColor)) == 0x2f0); +static_assert((offsetof (struct voodoo2_reg, bltCommand)) == 0x2f8); +static_assert((offsetof (struct voodoo2_reg, bltData)) == 0x2fc); +static_assert((offsetof (struct voodoo2_reg, textureMode)) == 0x300); +static_assert((offsetof (struct voodoo2_reg, tLOD)) == 0x304); +static_assert((offsetof (struct voodoo2_reg, tDetail)) == 0x308); +static_assert((offsetof (struct voodoo2_reg, texBaseAddr)) == 0x30c); +static_assert((offsetof (struct voodoo2_reg, texBaseAddr_1)) == 0x310); +static_assert((offsetof (struct voodoo2_reg, texBaseAddr_2)) == 0x314); +static_assert((offsetof (struct voodoo2_reg, texBaseAddr_3_8)) == 0x318); +static_assert((offsetof (struct voodoo2_reg, trexInit0)) == 0x31c); +static_assert((offsetof (struct voodoo2_reg, trexInit1)) == 0x320); +static_assert((offsetof (struct voodoo2_reg, nccTable0[0])) == 0x324); +static_assert((offsetof (struct voodoo2_reg, nccTable1[0])) == 0x354); diff --git a/voodoo2.py b/voodoo2.py new file mode 100644 index 0000000..53cbba2 --- /dev/null +++ b/voodoo2.py @@ -0,0 +1,215 @@ +import sys +from dataclasses import dataclass +import enum + +from generate import renderer + +def calculate_line_columns(line): + columns = [] + span_start = 0 + span_end = 0 + last_c = None + for i, c in enumerate(line): + if c == ' ': + if last_c != ' ': + span_start = i + span_end = i + elif last_c == ' ': + assert span_end >= span_start + if span_end > span_start: + columns.append(span_end) + + last_c = c + + + print(columns) + +def debug_columns(lines): + for line in lines: + calculate_line_columns(line) + +def columnize(line): + _columns = [18, 45, 51, 65, 70, 82] + ix = 0 + for col in _columns: + if ix > len(line): + yield "" + else: + yield line[ix:col+1] + ix = col+1 + if ix > len(line): + yield "" + else: + yield line[ix:] + +def columnize_lines(lines): + for line in lines: + if not line.strip(): + continue + columns = list(columnize(line)) + yield columns + +@dataclass +class RegisterLine: + name: str + start_address: int + end_address: int + bits: tuple[int, int] + chips: set[str] + r_w: set[str] + pipelined: bool + fifo: bool + description: str + +def parse_address(s): + assert s.startswith("0x") + s = s.removeprefix("0x") + assert s.endswith(")") + s = s.removesuffix(")") + addr16s, addr10s = s.split("(") + addr16 = int(addr16s, 16) + addr10 = int(addr10s, 10) + assert addr16 == addr10 + return addr16 + +def parse_address_range(s): + if " to " in s: + start, end = s.split(" to ") + return parse_address(start), parse_address(end) + else: + address = parse_address(s) + return address, address + +def parse_bits(s): + if s == "n/a": + return 31, 0 + elif ":" in s: + high, low = s.split(":") + return int(high, 10), int(low, 10) + else: + v = int(s, 10) + return v, v + +def parse_chips(s): + valid_chips = {"Chuck", "Bruce*", "Bruce%", "Bruce-1"} + for chip in s.split("+"): + assert chip in valid_chips, s + if chip == "Bruce-1": + chip = "Bruce1" + yield chip + +def parse_r_w(s): + valid_r_w = {"R", "R/W", "W"} + assert s in valid_r_w, s + return set(map(str.lower, s.split("/"))) + +def parse_pipelined_fifo(s): + if s == "(n/a) / No": + return False, False + elif s == "No / Yes": + return False, True + elif s == "Yes / No": + return True, False + elif s == "Yes / Yes": + return True, True + elif s == "Yes / n/a": + return True, False + elif s == "n/a": + return False, False + else: + assert False, s + +def parse(lines): + next_address = 0 + for columns in columnize_lines(lines): + name, address_s, *rest = map(str.strip, columns) + start_address, end_address = parse_address_range(address_s) + assert next_address == start_address + next_address = end_address + 4 + if name == 'reserved': + continue + + #print(columns) + bits_s, chips_s, r_w_s, pipelined_fifo_s, description = rest + bits = parse_bits(bits_s) + chips = set(parse_chips(chips_s)) + r_w = parse_r_w(r_w_s) + pipelined, fifo = parse_pipelined_fifo(pipelined_fifo_s) + + yield RegisterLine( + name=name, + start_address=start_address, + end_address=end_address, + bits=bits, + chips=chips, + r_w=r_w, + pipelined=pipelined, + fifo=fifo, + description=description, + ) + +def format_rw(r_w): + if r_w == {"r", "w"}: + return "rw" + if r_w == {"w"}: + return " w" + if r_w == {"r"}: + return "r " + return ','.join(sorted(r_w)) + +def sanitize(name): + return name.replace("/", "_") + +def format_register_line(rl, max_length): + if rl.start_address == rl.end_address: + space = ' ' * (max_length - len(rl.name)) + return f"reg32 {sanitize(rl.name)};{space} // ({format_rw(rl.r_w)}) {rl.description}" + else: + length = (rl.end_address - rl.start_address) // 4 + 1 + length_s = f"[{length}]" + space = ' ' * (max_length - (len(rl.name) + len(length_s))) + return f"reg32 {sanitize(rl.name)}{length_s};{space} // ({format_rw(rl.r_w)}) {rl.description}" + +def render_register_struct(rls, max_length): + last_address = -4 + reserved_ix = 0 + + yield "struct voodoo2_reg {" + for rl in rls: + assert rl.start_address >= last_address + 4 + if rl.start_address != last_address + 4: + padding = rl.start_address - (last_address + 4) + yield f"reg32 _reserved{reserved_ix}[{padding // 4}];" + reserved_ix += 1 + yield format_register_line(rl, max_length) + last_address = rl.end_address + yield "};" + +def render_static_assert(rls, max_length): + for rl in rls: + if rl.start_address == rl.end_address: + space = ' ' * (max_length - len(rl.name)) + yield f"static_assert((offsetof (struct voodoo2_reg, {sanitize(rl.name)})){space} == 0x{rl.start_address:03x});" + else: + space = ' ' * (max_length - (len(rl.name) + 3)) + yield f"static_assert((offsetof (struct voodoo2_reg, {sanitize(rl.name)}[0])){space} == 0x{rl.start_address:03x});" + +def render_all(rls): + max_length = max(len(rl.name) for rl in rls) + yield "#pragma once" + yield "" + yield "#include " + yield "#include " + yield "" + yield "typedef volatile uint32_t reg32;" + yield "" + yield from render_register_struct(rls, max_length) + yield from render_static_assert(rls, max_length) + +with open(sys.argv[1], 'r') as f: + buf = f.read() +lines = buf.split('\n') +rls = list(parse(lines)) +render, out = renderer() +render(render_all(rls)) +sys.stdout.write(out.getvalue()) diff --git a/voodoo2.txt b/voodoo2.txt new file mode 100644 index 0000000..71a473a --- /dev/null +++ b/voodoo2.txt @@ -0,0 +1,194 @@ +status 0x000(0) 31:0 Chuck R Yes / n/a Voodoo2 Graphics Status +intrCtrl 0x004(4) 31:0 Chuck R/W Yes / No Interrupt Status and Control +vertexAx 0x008(8) 15:0 Chuck+Bruce% W Yes / Yes Vertex A x-coordinate location (12.4 format) +vertexAy 0x00c(12) 15:0 Chuck+Bruce% W Yes / Yes Vertex A y-coordinate location (12.4 format) +vertexBx 0x010(16) 15:0 Chuck+Bruce% W Yes / Yes Vertex B x-coordinate location (12.4 format) +vertexBy 0x014(20) 15:0 Chuck+Bruce% W Yes / Yes Vertex B y-coordinate location (12.4 format) +vertexCx 0x018(24) 15:0 Chuck+Bruce% W Yes / Yes Vertex C x-coordinate location (12.4 format) +vertexCy 0x01c(28) 15:0 Chuck+Bruce% W Yes / Yes Vertex C y-coordinate location (12.4 format) + +startR 0x020(32) 23:0 Chuck W Yes / Yes Starting Red parameter (12.12 format) +startG 0x024(36) 23:0 Chuck W Yes / Yes Starting Green parameter (12.12 format) +startB 0x028(40) 23:0 Chuck W Yes / Yes Starting Blue parameter (12.12 format) +startZ 0x02c(44) 31:0 Chuck W Yes / Yes Starting Z parameter (20.12 format) +startA 0x030(48) 23:0 Chuck W Yes / Yes Starting Alpha parameter (12.12 format) +startS 0x034(52) 31:0 Bruce* W Yes / Yes Starting S/W parameter (14.18 format) +startT 0x038(56) 31:0 Bruce* W Yes / Yes Starting T/W parameter (14.18 format) +startW 0x03c(60) 31:0 Chuck+Bruce* W Yes / Yes Starting 1/W parameter (2.30 format) + +dRdX 0x040(64) 23:0 Chuck W Yes / Yes Change in Red with respect to X (12.12 format) +dGdX 0x044(68) 23:0 Chuck W Yes / Yes Change in Green with respect to X (12.12 format) +dBdX 0x048(72) 23:0 Chuck W Yes / Yes Change in Blue with respect to X (12.12 format) +dZdX 0x04c(76) 31:0 Chuck W Yes / Yes Change in Z with respect to X (20.12 format) +dAdX 0x050(80) 23:0 Chuck W Yes / Yes Change in Alpha with respect to X (12.12 format) +dSdX 0x054(84) 31:0 Bruce* W Yes / Yes Change in S/W with respect to X (14.18 format) +dTdX 0x058(88) 31:0 Bruce* W Yes / Yes Change in T/W with respect to X (14.18 format) +dWdX 0x05c(92) 31:0 Chuck+Bruce* W Yes / Yes Change in 1/W with respect to X (2.30 format) + +dRdY 0x060(96) 23:0 Chuck W Yes / Yes Change in Red with respect to Y (12.12 format) +dGdY 0x064(100) 23:0 Chuck W Yes / Yes Change in Green with respect to Y (12.12 format) +dBdY 0x068(104) 23:0 Chuck W Yes / Yes Change in Blue with respect to Y (12.12 format) +dZdY 0x06c(108) 31:0 Chuck W Yes / Yes Change in Z with respect to Y (20.12 format) +dAdY 0x070(112) 23:0 Chuck W Yes / Yes Change in Alpha with respect to Y (12.12 format) +dSdY 0x074(116) 31:0 Bruce* W Yes / Yes Change in S/W with respect to Y (14.18 format) +dTdY 0x078(120) 31:0 Bruce* W Yes / Yes Change in T/W with respect to Y (14.18 format) +dWdY 0x07c(124) 31:0 Chuck+Bruce* W Yes / Yes Change in 1/W with respect to Y (2.30 format) + +triangleCMD 0x080(128) 31 Chuck+Bruce% W Yes / Yes Execute TRIANGLE command (floating point) +reserved 0x084(132) n/a n/a W n/a +fvertexAx 0x088(136) 31:0 Chuck+Bruce% W Yes / Yes Vertex A x-coordinate location (floating point) +fvertexAy 0x08c(140) 31:0 Chuck+Bruce% W Yes / Yes Vertex A y-coordinate location (floating point) +fvertexBx 0x090(144) 31:0 Chuck+Bruce% W Yes / Yes Vertex B x-coordinate location (floating point) +fvertexBy 0x094(148) 31:0 Chuck+Bruce% W Yes / Yes Vertex B y-coordinate location (floating point) +fvertexCx 0x098(152) 31:0 Chuck+Bruce% W Yes / Yes Vertex C x-coordinate location (floating point) +fvertexCy 0x09c(156) 31:0 Chuck+Bruce% W Yes / Yes Vertex C y-coordinate location (floating point) + +fstartR 0x0a0(160) 31:0 Chuck W Yes / Yes Starting Red parameter (floating point) +fstartG 0x0a4(164) 31:0 Chuck W Yes / Yes Starting Green parameter (floating point) +fstartB 0x0a8(168) 31:0 Chuck W Yes / Yes Starting Blue parameter (floating point) +fstartZ 0x0ac(172) 31:0 Chuck W Yes / Yes Starting Z parameter (floating point) +fstartA 0x0b0(176) 31:0 Chuck W Yes / Yes Starting Alpha parameter (floating point) +fstartS 0x0b4(180) 31:0 Bruce* W Yes / Yes Starting S/W parameter (floating point) +fstartT 0x0b8(184) 31:0 Bruce* W Yes / Yes Starting T/W parameter (floating point) +fstartW 0x0bc(188) 31:0 Chuck+Bruce* W Yes / Yes Starting 1/W parameter (floating point) + +fdRdX 0x0c0(192) 31:0 Chuck W Yes / Yes Change in Red with respect to X (floating point) +fdGdX 0x0c4(196) 31:0 Chuck W Yes / Yes Change in Green with respect to X (floating point) +fdBdX 0x0c8(200) 31:0 Chuck W Yes / Yes Change in Blue with respect to X (floating point) +fdZdX 0x0cc(204) 31:0 Chuck W Yes / Yes Change in Z with respect to X (floating point) +fdAdX 0x0d0(208) 31:0 Chuck W Yes / Yes Change in Alpha with respect to X (floating point) +fdSdX 0x0d4(212) 31:0 Bruce* W Yes / Yes Change in S/W with respect to X (floating point) +fdTdX 0x0d8(216) 31:0 Bruce* W Yes / Yes Change in T/W with respect to X (floating point) +fdWdX 0x0dc(220) 31:0 Chuck+Bruce* W Yes / Yes Change in 1/W with respect to X (floating point) + +fdRdY 0x0e0(224) 31:0 Chuck W Yes / Yes Change in Red with respect to Y (floating point) +fdGdY 0x0e4(228) 31:0 Chuck W Yes / Yes Change in Green with respect to Y (floating point) +fdBdY 0x0e8(232) 31:0 Chuck W Yes / Yes Change in Blue with respect to Y (floating point) +fdZdY 0x0ec(236) 31:0 Chuck W Yes / Yes Change in Z with respect to Y (floating point) +fdAdY 0x0f0(240) 31:0 Chuck W Yes / Yes Change in Alpha with respect to Y (floating point) +fdSdY 0x0f4(244) 31:0 Bruce* W Yes / Yes Change in S/W with respect to Y (floating point) +fdTdY 0x0f8(248) 31:0 Bruce* W Yes / Yes Change in T/W with respect to Y (floating point) +fdWdY 0x0fc(252) 31:0 Chuck+Bruce* W Yes / Yes Change in 1/W with respect to Y (floating point) + +ftriangleCMD 0x100(256) 31 Chuck+Bruce% W Yes / Yes Execute TRIANGLE command (floating point) +fbzColorPath 0x104(260) 29:0 Chuck+Bruce% R/W Yes / Yes Chuck Color Path Control +fogMode 0x108(264) 7:0 Chuck R/W Yes / Yes Fog Mode Control +alphaMode 0x10c(268) 31:0 Chuck R/W Yes / Yes Alpha Mode Control +fbzMode 0x110(272) 21:0 Chuck R/W No / Yes RGB Buffer and Depth-Buffer Control +lfbMode 0x114(276) 16:0 Chuck R/W No / Yes Linear Frame Buffer Mode Control +clipLeftRight 0x118(280) 31:0 Chuck R/W No / Yes Left and Right of Clipping Register +clipLowYHighY 0x11c(284) 31:0 Chuck R/W No / Yes Top and Bottom of Clipping Register + +nopCMD 0x120(288) 1:0 Chuck+Bruce% W No / Yes Execute NOP command +fastfillCMD 0x124(292) n/a Chuck W No / Yes Execute FASTFILL command +swapbufferCMD 0x128(296) 9:0 Chuck W No / Yes Execute SWAPBUFFER command +fogColor 0x12c(300) 23:0 Chuck W No / Yes Fog Color Value +zaColor 0x130(304) 31:0 Chuck W No / Yes Constant Alpha/Depth Value +chromaKey 0x134(308) 23:0 Chuck+Bruce* W No / Yes Chroma Key Compare Value +chromaRange 0x138(312) 27:0 Chuck+Bruce* W No / Yes Chroma Range Compare Values,modes,enable +userIntrCMD 0x13c(316) 9:0 Chuck W No / Yes Execute USERINTERRUPT command + +stipple 0x140(320) 31:0 Chuck R/W No / Yes Rendering Stipple Value +color0 0x144(324) 31:0 Chuck R/W No / Yes Constant Color #0 +color1 0x148(328) 31:0 Chuck R/W No / Yes Constant Color #1 +fbiPixelsIn 0x14c(332) 23:0 Chuck R n/a Pixel Counter (Number pixels processed) +fbiChromaFail 0x150(336) 23:0 Chuck R n/a Pixel Counter (Number pixels failed Chroma test) +fbiZfuncFail 0x154(340) 23:0 Chuck R n/a Pixel Counter (Number pixels failed Z test) +fbiAfuncFail 0x158(344) 23:0 Chuck R n/a Pixel Counter (Number pixels failed Alpha test) +fbiPixelsOut 0x15c(348) 23:0 Chuck R n/a Pixel Counter (Number pixels drawn) + +fogTable 0x160(352) to 0x1dc(476) 31:0 Chuck W No / Yes Fog Table + +cmdFifoBaseAddr 0x1e0(480) 25:0 Chuck R/W (n/a) / No CMDFIFO base address and size +cmdFifoBump 0x1e4(484) 15:0 Chuck R/W (n/a) / No CMDFIFO bump depth +cmdFifoRdPtr 0x1e8(488) 31:0 Chuck R/W (n/a) / No CMDFIFO current read pointer +cmdFifoAMin 0x1ec(492) 31:0 Chuck R/W (n/a) / No CMDFIFO current minimum address +cmdFifoAMax 0x1f0(496) 31:0 Chuck R/W (n/a) / No CMDFIFO current maximum address +cmdFifoDepth 0x1f4(500) 15:0 Chuck R/W (n/a) / No CMDFIFO current depth +cmdFifoHoles 0x1f8(504) 15:0 Chuck R/W (n/a) / No CMDFIFO number of holes +reserved 0x1fc(508) n/a n/a n/a n/a + +fbiInit4 0x200(512) 12:0 Chuck R/W (n/a) / No Chuck Hardware Initialization (register 4) +vRetrace 0x204(516) 12:0 Chuck R (n/a) / No Vertical Retrace Counter +backPorch 0x208(520) 24:0 Chuck R/W (n/a) / No Video Backporch Timing Generator +videoDimensions 0x20c(524) 26:0 Chuck R/W (n/a) / No Video Screen Dimensions +fbiInit0 0x210(528) 31:0 Chuck R/W (n/a) / No Chuck Hardware Initialization (register 0) +fbiInit1 0x214(532) 31:0 Chuck R/W (n/a) / No Chuck Hardware Initialization (register 1) +fbiInit2 0x218(536) 31:0 Chuck R/W (n/a) / No Chuck Hardware Initialization (register 2) +fbiInit3 0x21c(540) 31:0 Chuck R/W (n/a) / No Chuck Hardware Initialization (register 3) + +hSync 0x220(544) 26:0 Chuck W (n/a) / No Horizontal Sync Timing Generator +vSync 0x224(548) 28:0 Chuck W (n/a) / No Vertical Sync Timing Generator +clutData 0x228(552) 29:0 Chuck W No / Yes Video Color Lookup Table Initialization +dacData 0x22c(556) 13:0 Chuck W (n/a) / No External DAC Initialization + +maxRgbDelta 0x230(560) 23:0 Chuck W (n/a) / No Max. RGB difference for Video Filtering +hBorder 0x234(564) 24:0 Chuck W (n/a) / No Horizontal Border Color Control +vBorder 0x238(568) 24:0 Chuck W (n/a) / No Vertical Border Color Control +borderColor 0x23c(572) 23:0 Chuck W (n/a) / No Video Border Color + +hvRetrace 0x240(576) 26:0 Chuck R (n/a) / No Horizontal and Vertical Retrace Counters (synced) + +fbiInit5 0x244(580) 31:0 Chuck R/W (n/a) / No Chuck Hardware Initialization (register 5) +fbiInit6 0x248(584) 31:0 Chuck R/W (n/a) / No Chuck Hardware Initialization (register 6) +fbiInit7 0x24c(588) 31:0 Chuck R/W (n/a) / No Chuck Hardware Initialization (register 7) +reserved 0x250(592) n/a n/a n/a n/a +reserved 0x254(596) n/a n/a n/a n/a +fbiSwapHistory 0x258(600) 31:0 Chuck R n/a Swap History Register +fbiTrianglesOut 0x25c(604) 23:0 Chuck R n/a Triangle Counter (Number triangles drawn) +sSetupMode 0x260(608) 19:0 Chuck W Yes / Yes Triangle setup mode +sVx 0x264(612) 31:0 Chuck+Bruce* W Yes / Yes Triangle setup X +sVy 0x268(616) 31:0 Chuck+Bruce* W Yes / Yes Triangle setup Y +sARGB 0x26c(620) 31:0 Chuck+Bruce* W Yes / Yes Triangle setup Alpha, Red, Green, Blue +sRed 0x270(624) 31:0 Chuck W Yes / Yes Triangle setup Red value +sGreen 0x274(628) 31:0 Chuck W Yes / Yes Triangle setup Green value +sBlue 0x278(632) 31:0 Chuck W Yes / Yes Triangle setup Blue value +sAlpha 0x27c(636) 31:0 Chuck W Yes / Yes Triangle setup Alpha value +sVz 0x280(640) 31:0 Chuck W Yes / Yes Triangle setup Z +sWb 0x284(644) 31:0 Chuck+Bruce* W Yes / Yes Triangle setup Global W +sWtmu0 0x288(648) 31:0 Bruce* W Yes / Yes Triangle setup Tmu0 & Tmu1 W +sS/W0 0x28c(652) 31:0 Bruce* W Yes / Yes Triangle setup Tmu0 & Tmu1 S/W +sT/W0 0x290(656) 31:0 Bruce* W Yes / Yes Triangle setup Tmu0 & Tmu1 T/W +sWtmu1 0x294(660) 31:0 Bruce-1 W Yes / Yes Triangle setup Tmu1 only W +sS/Wtmu1 0x298(664) 31:0 Bruce-1 W Yes / Yes Triangle setup Tmu1 only S/W +sT/Wtmu1 0x29c(668) 31:0 Bruce-1 W Yes / Yes Triangle setup Tmu1 only T/W +sDrawTriCMD 0x2a0(672) 31:0 Chuck+Bruce* W Yes / Yes Triangle setup (Draw) +sBeginTriCMD 0x2a4(676) 31:0 Chuck W Yes / Yes Triangle setup Start New triangle +reserved 0x2a8(680) n/a n/a n/a n/a +reserved 0x2ac(684) n/a n/a n/a n/a +reserved 0x2b0(688) n/a n/a n/a n/a +reserved 0x2b4(692) n/a n/a n/a n/a +reserved 0x2b8(696) n/a n/a n/a n/a +reserved 0x2bc(700) n/a n/a n/a n/a + +bltSrcBaseAddr 0x2c0(704) 21:0 Chuck R/W Yes / Yes BitBLT Source base address +bltDstBaseAddr 0x2c4(708) 21:0 Chuck R/W Yes / Yes BitBLT Destination base address +bltXYStrides 0x2c8(712) 27:0 Chuck R/W Yes / Yes BitBLT Source and Destination strides +bltSrcChromaRange 0x2cc(716) 31:0 Chuck R/W Yes / Yes BiBLT Source Chroma key range +bltDstChromaRange 0x2d0(720) 31:0 Chuck R/W Yes / Yes BitBLT Destination Chroma key range +bltClipX 0x2d4(724) 27:0 Chuck R/W Yes / Yes BitBLT Min/Max X clip values +bltClipY 0x2d8(728) 27:0 Chuck R/W Yes / Yes BitBLT Min/Max Y clip values +reserved 0x2dc(732) + +bltSrcXY 0x2e0(736) 26:0 Chuck R/W Yes / Yes BitBLT Source starting XY coordinates +bltDstXY 0x2e4(740) 31:0 Chuck R/W Yes / Yes BitBLT Destination starting XY coordinates +bltSize 0x2e8(744) 31:0 Chuck R/W Yes / Yes BitBLT width and height +bltRop 0x2ec(748) 15:0 Chuck R/W Yes / Yes BitBLT Raster operations +bltColor 0x2f0(752) 31:0 Chuck R/W Yes / Yes BitBLT and foreground background colors +reserved 0x2f4(756) +bltCommand 0x2f8(760) 31:0 Chuck R/W Yes / Yes BitBLT command mode +bltData 0x2fc(764) 31:0 Chuck W Yes / Yes BitBLT data for CPU-to-Screen BitBLTs + +textureMode 0x300(768) 30:0 Bruce* W Yes / Yes Texture Mode Control +tLOD 0x304(772) 27:0 Bruce* W Yes / Yes Texture LOD Settings +tDetail 0x308(776) 21:0 Bruce* W Yes / Yes Texture LOD Settings +texBaseAddr 0x30c(780) 18:0 Bruce* W Yes / Yes Texture Base Address +texBaseAddr_1 0x310(784) 18:0 Bruce* W Yes / Yes Texture Base Address (supplemental LOD 1) +texBaseAddr_2 0x314(788) 18:0 Bruce* W Yes / Yes Texture Base Address (supplemental LOD 2) +texBaseAddr_3_8 0x318(792) 18:0 Bruce* W Yes / Yes Texture Base Address (supplemental LOD 3-8) +trexInit0 0x31c(796) 31:0 Bruce* W No / Yes Bruce Hardware Initialization (register 0) +trexInit1 0x320(800) 31:0 Bruce* W No / Yes Bruce Hardware Initialization (register 1) + +nccTable0 0x324(804) to 0x350(848) 31:0 Bruce* W No / Yes Narrow Channel Compression Table 0 (12 entries) +nccTable1 0x354(852) to 0x380(896) 31:0 Bruce* W No / Yes Narrow Channel Compression Table 1 (12 entries) +reserved 0x384(900) to 0x3fc(1020) n/a n/a n/a n/a