diff options
Diffstat (limited to 'src/devices/video/voodoo.cpp')
-rw-r--r-- | src/devices/video/voodoo.cpp | 747 |
1 files changed, 654 insertions, 93 deletions
diff --git a/src/devices/video/voodoo.cpp b/src/devices/video/voodoo.cpp index 92d937346d5..8e4a6215b2f 100644 --- a/src/devices/video/voodoo.cpp +++ b/src/devices/video/voodoo.cpp @@ -177,6 +177,549 @@ bits(7:4) and bit(24)), X, and Y: #define EAT_CYCLES (1) +namespace { + +/************************************* + * + * Alias map of the first 64 + * registers when remapped + * + *************************************/ + +const uint8_t register_alias_map[0x40] = +{ + vdstatus, 0x004/4, vertexAx, vertexAy, + vertexBx, vertexBy, vertexCx, vertexCy, + startR, dRdX, dRdY, startG, + dGdX, dGdY, startB, dBdX, + dBdY, startZ, dZdX, dZdY, + startA, dAdX, dAdY, startS, + dSdX, dSdY, startT, dTdX, + dTdY, startW, dWdX, dWdY, + + triangleCMD,0x084/4, fvertexAx, fvertexAy, + fvertexBx, fvertexBy, fvertexCx, fvertexCy, + fstartR, fdRdX, fdRdY, fstartG, + fdGdX, fdGdY, fstartB, fdBdX, + fdBdY, fstartZ, fdZdX, fdZdY, + fstartA, fdAdX, fdAdY, fstartS, + fdSdX, fdSdY, fstartT, fdTdX, + fdTdY, fstartW, fdWdX, fdWdY +}; + + +/************************************* + * + * Table of per-register access rights + * + *************************************/ + +const uint8_t voodoo_register_access[0x100] = +{ + /* 0x000 */ + REG_RP, 0, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x040 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x080 */ + REG_WPF, 0, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x0c0 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x100 */ + REG_WPF, REG_RWPF, REG_RWPF, REG_RWPF, + REG_RWF, REG_RWF, REG_RWF, REG_RWF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, 0, 0, + + /* 0x140 */ + REG_RWF, REG_RWF, REG_RWF, REG_R, + REG_R, REG_R, REG_R, REG_R, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x180 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x1c0 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + 0, 0, 0, 0, + 0, 0, 0, 0, + + /* 0x200 */ + REG_RW, REG_R, REG_RW, REG_RW, + REG_RW, REG_RW, REG_RW, REG_RW, + REG_W, REG_W, REG_W, REG_W, + REG_W, 0, 0, 0, + + /* 0x240 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + + /* 0x280 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + + /* 0x2c0 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + + /* 0x300 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x340 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x380 */ + REG_WF +}; + +const uint8_t voodoo2_register_access[0x100] = +{ + /* 0x000 */ + REG_RP, REG_RWPT, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x040 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x080 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x0c0 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x100 */ + REG_WPF, REG_RWPF, REG_RWPF, REG_RWPF, + REG_RWF, REG_RWF, REG_RWF, REG_RWF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x140 */ + REG_RWF, REG_RWF, REG_RWF, REG_R, + REG_R, REG_R, REG_R, REG_R, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x180 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x1c0 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_RWT, REG_RWT, REG_RWT, REG_RWT, + REG_RWT, REG_RWT, REG_RWT, REG_RW, + + /* 0x200 */ + REG_RWT, REG_R, REG_RWT, REG_RWT, + REG_RWT, REG_RWT, REG_RWT, REG_RWT, + REG_WT, REG_WT, REG_WF, REG_WT, + REG_WT, REG_WT, REG_WT, REG_WT, + + /* 0x240 */ + REG_R, REG_RWT, REG_RWT, REG_RWT, + 0, 0, REG_R, REG_R, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x280 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, 0, 0, + 0, 0, 0, 0, + + /* 0x2c0 */ + REG_RWPF, REG_RWPF, REG_RWPF, REG_RWPF, + REG_RWPF, REG_RWPF, REG_RWPF, REG_RWPF, + REG_RWPF, REG_RWPF, REG_RWPF, REG_RWPF, + REG_RWPF, REG_RWPF, REG_RWPF, REG_WPF, + + /* 0x300 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x340 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x380 */ + REG_WF +}; + +const uint8_t banshee_register_access[0x100] = +{ + /* 0x000 */ + REG_RP, REG_RWPT, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x040 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x080 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x0c0 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x100 */ + REG_WPF, REG_RWPF, REG_RWPF, REG_RWPF, + REG_RWF, REG_RWF, REG_RWF, REG_RWF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x140 */ + REG_RWF, REG_RWF, REG_RWF, REG_R, + REG_R, REG_R, REG_R, REG_R, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x180 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x1c0 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + 0, 0, 0, REG_RWF, + REG_RWF, REG_RWF, REG_RWF, 0, + + /* 0x200 */ + REG_RWF, REG_RWF, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + + /* 0x240 */ + 0, 0, 0, REG_WT, + REG_RWF, REG_RWF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_R, REG_R, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + + /* 0x280 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, 0, 0, + 0, 0, 0, 0, + + /* 0x2c0 */ + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + + /* 0x300 */ + REG_WPF, REG_WPF, REG_WPF, REG_WPF, + REG_WPF, REG_WPF, REG_WPF, 0, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x340 */ + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + REG_WF, REG_WF, REG_WF, REG_WF, + + /* 0x380 */ + REG_WF +}; + + +/************************************* + * + * Register string table for debug + * + *************************************/ + +const char *const voodoo_reg_name[] = +{ + /* 0x000 */ + "status", "{intrCtrl}", "vertexAx", "vertexAy", + "vertexBx", "vertexBy", "vertexCx", "vertexCy", + "startR", "startG", "startB", "startZ", + "startA", "startS", "startT", "startW", + /* 0x040 */ + "dRdX", "dGdX", "dBdX", "dZdX", + "dAdX", "dSdX", "dTdX", "dWdX", + "dRdY", "dGdY", "dBdY", "dZdY", + "dAdY", "dSdY", "dTdY", "dWdY", + /* 0x080 */ + "triangleCMD", "reserved084", "fvertexAx", "fvertexAy", + "fvertexBx", "fvertexBy", "fvertexCx", "fvertexCy", + "fstartR", "fstartG", "fstartB", "fstartZ", + "fstartA", "fstartS", "fstartT", "fstartW", + /* 0x0c0 */ + "fdRdX", "fdGdX", "fdBdX", "fdZdX", + "fdAdX", "fdSdX", "fdTdX", "fdWdX", + "fdRdY", "fdGdY", "fdBdY", "fdZdY", + "fdAdY", "fdSdY", "fdTdY", "fdWdY", + /* 0x100 */ + "ftriangleCMD", "fbzColorPath", "fogMode", "alphaMode", + "fbzMode", "lfbMode", "clipLeftRight","clipLowYHighY", + "nopCMD", "fastfillCMD", "swapbufferCMD","fogColor", + "zaColor", "chromaKey", "{chromaRange}","{userIntrCMD}", + /* 0x140 */ + "stipple", "color0", "color1", "fbiPixelsIn", + "fbiChromaFail","fbiZfuncFail", "fbiAfuncFail", "fbiPixelsOut", + "fogTable160", "fogTable164", "fogTable168", "fogTable16c", + "fogTable170", "fogTable174", "fogTable178", "fogTable17c", + /* 0x180 */ + "fogTable180", "fogTable184", "fogTable188", "fogTable18c", + "fogTable190", "fogTable194", "fogTable198", "fogTable19c", + "fogTable1a0", "fogTable1a4", "fogTable1a8", "fogTable1ac", + "fogTable1b0", "fogTable1b4", "fogTable1b8", "fogTable1bc", + /* 0x1c0 */ + "fogTable1c0", "fogTable1c4", "fogTable1c8", "fogTable1cc", + "fogTable1d0", "fogTable1d4", "fogTable1d8", "fogTable1dc", + "{cmdFifoBaseAddr}","{cmdFifoBump}","{cmdFifoRdPtr}","{cmdFifoAMin}", + "{cmdFifoAMax}","{cmdFifoDepth}","{cmdFifoHoles}","reserved1fc", + /* 0x200 */ + "fbiInit4", "vRetrace", "backPorch", "videoDimensions", + "fbiInit0", "fbiInit1", "fbiInit2", "fbiInit3", + "hSync", "vSync", "clutData", "dacData", + "maxRgbDelta", "{hBorder}", "{vBorder}", "{borderColor}", + /* 0x240 */ + "{hvRetrace}", "{fbiInit5}", "{fbiInit6}", "{fbiInit7}", + "reserved250", "reserved254", "{fbiSwapHistory}","{fbiTrianglesOut}", + "{sSetupMode}", "{sVx}", "{sVy}", "{sARGB}", + "{sRed}", "{sGreen}", "{sBlue}", "{sAlpha}", + /* 0x280 */ + "{sVz}", "{sWb}", "{sWtmu0}", "{sS/Wtmu0}", + "{sT/Wtmu0}", "{sWtmu1}", "{sS/Wtmu1}", "{sT/Wtmu1}", + "{sDrawTriCMD}","{sBeginTriCMD}","reserved2a8", "reserved2ac", + "reserved2b0", "reserved2b4", "reserved2b8", "reserved2bc", + /* 0x2c0 */ + "{bltSrcBaseAddr}","{bltDstBaseAddr}","{bltXYStrides}","{bltSrcChromaRange}", + "{bltDstChromaRange}","{bltClipX}","{bltClipY}","reserved2dc", + "{bltSrcXY}", "{bltDstXY}", "{bltSize}", "{bltRop}", + "{bltColor}", "reserved2f4", "{bltCommand}", "{bltData}", + /* 0x300 */ + "textureMode", "tLOD", "tDetail", "texBaseAddr", + "texBaseAddr_1","texBaseAddr_2","texBaseAddr_3_8","trexInit0", + "trexInit1", "nccTable0.0", "nccTable0.1", "nccTable0.2", + "nccTable0.3", "nccTable0.4", "nccTable0.5", "nccTable0.6", + /* 0x340 */ + "nccTable0.7", "nccTable0.8", "nccTable0.9", "nccTable0.A", + "nccTable0.B", "nccTable1.0", "nccTable1.1", "nccTable1.2", + "nccTable1.3", "nccTable1.4", "nccTable1.5", "nccTable1.6", + "nccTable1.7", "nccTable1.8", "nccTable1.9", "nccTable1.A", + /* 0x380 */ + "nccTable1.B" +}; + +const char *const banshee_reg_name[] = +{ + /* 0x000 */ + "status", "intrCtrl", "vertexAx", "vertexAy", + "vertexBx", "vertexBy", "vertexCx", "vertexCy", + "startR", "startG", "startB", "startZ", + "startA", "startS", "startT", "startW", + /* 0x040 */ + "dRdX", "dGdX", "dBdX", "dZdX", + "dAdX", "dSdX", "dTdX", "dWdX", + "dRdY", "dGdY", "dBdY", "dZdY", + "dAdY", "dSdY", "dTdY", "dWdY", + /* 0x080 */ + "triangleCMD", "reserved084", "fvertexAx", "fvertexAy", + "fvertexBx", "fvertexBy", "fvertexCx", "fvertexCy", + "fstartR", "fstartG", "fstartB", "fstartZ", + "fstartA", "fstartS", "fstartT", "fstartW", + /* 0x0c0 */ + "fdRdX", "fdGdX", "fdBdX", "fdZdX", + "fdAdX", "fdSdX", "fdTdX", "fdWdX", + "fdRdY", "fdGdY", "fdBdY", "fdZdY", + "fdAdY", "fdSdY", "fdTdY", "fdWdY", + /* 0x100 */ + "ftriangleCMD", "fbzColorPath", "fogMode", "alphaMode", + "fbzMode", "lfbMode", "clipLeftRight","clipLowYHighY", + "nopCMD", "fastfillCMD", "swapbufferCMD","fogColor", + "zaColor", "chromaKey", "chromaRange", "userIntrCMD", + /* 0x140 */ + "stipple", "color0", "color1", "fbiPixelsIn", + "fbiChromaFail","fbiZfuncFail", "fbiAfuncFail", "fbiPixelsOut", + "fogTable160", "fogTable164", "fogTable168", "fogTable16c", + "fogTable170", "fogTable174", "fogTable178", "fogTable17c", + /* 0x180 */ + "fogTable180", "fogTable184", "fogTable188", "fogTable18c", + "fogTable190", "fogTable194", "fogTable198", "fogTable19c", + "fogTable1a0", "fogTable1a4", "fogTable1a8", "fogTable1ac", + "fogTable1b0", "fogTable1b4", "fogTable1b8", "fogTable1bc", + /* 0x1c0 */ + "fogTable1c0", "fogTable1c4", "fogTable1c8", "fogTable1cc", + "fogTable1d0", "fogTable1d4", "fogTable1d8", "fogTable1dc", + "reserved1e0", "reserved1e4", "reserved1e8", "colBufferAddr", + "colBufferStride","auxBufferAddr","auxBufferStride","reserved1fc", + /* 0x200 */ + "clipLeftRight1","clipTopBottom1","reserved208","reserved20c", + "reserved210", "reserved214", "reserved218", "reserved21c", + "reserved220", "reserved224", "reserved228", "reserved22c", + "reserved230", "reserved234", "reserved238", "reserved23c", + /* 0x240 */ + "reserved240", "reserved244", "reserved248", "swapPending", + "leftOverlayBuf","rightOverlayBuf","fbiSwapHistory","fbiTrianglesOut", + "sSetupMode", "sVx", "sVy", "sARGB", + "sRed", "sGreen", "sBlue", "sAlpha", + /* 0x280 */ + "sVz", "sWb", "sWtmu0", "sS/Wtmu0", + "sT/Wtmu0", "sWtmu1", "sS/Wtmu1", "sT/Wtmu1", + "sDrawTriCMD", "sBeginTriCMD", "reserved2a8", "reserved2ac", + "reserved2b0", "reserved2b4", "reserved2b8", "reserved2bc", + /* 0x2c0 */ + "reserved2c0", "reserved2c4", "reserved2c8", "reserved2cc", + "reserved2d0", "reserved2d4", "reserved2d8", "reserved2dc", + "reserved2e0", "reserved2e4", "reserved2e8", "reserved2ec", + "reserved2f0", "reserved2f4", "reserved2f8", "reserved2fc", + /* 0x300 */ + "textureMode", "tLOD", "tDetail", "texBaseAddr", + "texBaseAddr_1","texBaseAddr_2","texBaseAddr_3_8","reserved31c", + "trexInit1", "nccTable0.0", "nccTable0.1", "nccTable0.2", + "nccTable0.3", "nccTable0.4", "nccTable0.5", "nccTable0.6", + /* 0x340 */ + "nccTable0.7", "nccTable0.8", "nccTable0.9", "nccTable0.A", + "nccTable0.B", "nccTable1.0", "nccTable1.1", "nccTable1.2", + "nccTable1.3", "nccTable1.4", "nccTable1.5", "nccTable1.6", + "nccTable1.7", "nccTable1.8", "nccTable1.9", "nccTable1.A", + /* 0x380 */ + "nccTable1.B" +}; + + +/************************************* + * + * Register string table for debug + * + *************************************/ + +const char *const banshee_io_reg_name[] = +{ + /* 0x000 */ + "status", "pciInit0", "sipMonitor", "lfbMemoryConfig", + "miscInit0", "miscInit1", "dramInit0", "dramInit1", + "agpInit", "tmuGbeInit", "vgaInit0", "vgaInit1", + "dramCommand", "dramData", "reserved38", "reserved3c", + + /* 0x040 */ + "pllCtrl0", "pllCtrl1", "pllCtrl2", "dacMode", + "dacAddr", "dacData", "rgbMaxDelta", "vidProcCfg", + "hwCurPatAddr", "hwCurLoc", "hwCurC0", "hwCurC1", + "vidInFormat", "vidInStatus", "vidSerialParallelPort","vidInXDecimDeltas", + + /* 0x080 */ + "vidInDecimInitErrs","vidInYDecimDeltas","vidPixelBufThold","vidChromaMin", + "vidChromaMax", "vidCurrentLine","vidScreenSize","vidOverlayStartCoords", + "vidOverlayEndScreenCoord","vidOverlayDudx","vidOverlayDudxOffsetSrcWidth","vidOverlayDvdy", + "vga[b0]", "vga[b4]", "vga[b8]", "vga[bc]", + + /* 0x0c0 */ + "vga[c0]", "vga[c4]", "vga[c8]", "vga[cc]", + "vga[d0]", "vga[d4]", "vga[d8]", "vga[dc]", + "vidOverlayDvdyOffset","vidDesktopStartAddr","vidDesktopOverlayStride","vidInAddr0", + "vidInAddr1", "vidInAddr2", "vidInStride", "vidCurrOverlayStartAddr" +}; + + +/************************************* + * + * Register string table for debug + * + *************************************/ + +const char *const banshee_agp_reg_name[] = +{ + /* 0x000 */ + "agpReqSize", "agpHostAddressLow","agpHostAddressHigh","agpGraphicsAddress", + "agpGraphicsStride","agpMoveCMD","reserved18", "reserved1c", + "cmdBaseAddr0", "cmdBaseSize0", "cmdBump0", "cmdRdPtrL0", + "cmdRdPtrH0", "cmdAMin0", "reserved38", "cmdAMax0", + + /* 0x040 */ + "reserved40", "cmdFifoDepth0","cmdHoleCnt0", "reserved4c", + "cmdBaseAddr1", "cmdBaseSize1", "cmdBump1", "cmdRdPtrL1", + "cmdRdPtrH1", "cmdAMin1", "reserved68", "cmdAMax1", + "reserved70", "cmdFifoDepth1","cmdHoleCnt1", "reserved7c", + + /* 0x080 */ + "cmdFifoThresh","cmdHoleInt", "reserved88", "reserved8c", + "reserved90", "reserved94", "reserved98", "reserved9c", + "reserveda0", "reserveda4", "reserveda8", "reservedac", + "reservedb0", "reservedb4", "reservedb8", "reservedbc", + + /* 0x0c0 */ + "reservedc0", "reservedc4", "reservedc8", "reservedcc", + "reservedd0", "reservedd4", "reservedd8", "reserveddc", + "reservede0", "reservede4", "reservede8", "reservedec", + "reservedf0", "reservedf4", "reservedf8", "reservedfc", + + /* 0x100 */ + "yuvBaseAddress","yuvStride", "reserved108", "reserved10c", + "reserved110", "reserved114", "reserved118", "reserved11c", + "crc1", "reserved124", "reserved128", "reserved12c", + "crc2", "reserved134", "reserved138", "reserved13c" +}; + +} // anonymous namespace + + struct voodoo_device::poly_extra_data { voodoo_device * device; @@ -430,7 +973,7 @@ void voodoo_device::voodoo_set_init_enable(uint32_t newval) { pci.init_enable = newval; if (LOG_REGISTERS) - logerror("VOODOO.%d.REG:initEnable write = %08X\n", index, newval); + logerror("VOODOO.REG:initEnable write = %08X\n", newval); } @@ -443,8 +986,6 @@ void voodoo_device::voodoo_set_init_enable(uint32_t newval) void voodoo_device::init_fbi(voodoo_device* vd,fbi_state *f, void *memory, int fbmem) { - int pen; - /* allocate frame buffer RAM and set pointers */ f->ram = (uint8_t *)memory; f->mask = fbmem - 1; @@ -461,13 +1002,13 @@ void voodoo_device::init_fbi(voodoo_device* vd,fbi_state *f, void *memory, int f f->clut_dirty = true; if (vd->vd_type <= TYPE_VOODOO_2) { - for (pen = 0; pen < 32; pen++) + for (int pen = 0; pen < 32; pen++) vd->fbi.clut[pen] = rgb_t(pen, pal5bit(pen), pal5bit(pen), pal5bit(pen)); vd->fbi.clut[32] = rgb_t(32,0xff,0xff,0xff); } else { - for (pen = 0; pen < 512; pen++) + for (int pen = 0; pen < 512; pen++) vd->fbi.clut[pen] = rgb_t(pen,pen,pen); } @@ -534,6 +1075,8 @@ void voodoo_device::tmu_shared_state::init() EXTRACT_4444_TO_8888(val, a, r, g, b); argb4444[val] = rgb_t(a, r, g, b); } + + rgb565 = nullptr; } @@ -607,8 +1150,6 @@ void voodoo_device::voodoo_postload() void voodoo_device::init_save_state(voodoo_device *vd) { - int index, subindex; - vd->machine().save().register_postload(save_prepost_delegate(FUNC(voodoo_device::voodoo_postload), vd)); /* register states: core */ @@ -686,44 +1227,38 @@ void voodoo_device::init_save_state(voodoo_device *vd) vd->save_item(NAME(vd->fbi.lfb_stats.clip_fail)); vd->save_item(NAME(vd->fbi.lfb_stats.stipple_count)); vd->save_item(NAME(vd->fbi.sverts)); - for (index = 0; index < ARRAY_LENGTH(vd->fbi.svert); index++) - { - vd->save_item(NAME(vd->fbi.svert[index].x), index); - vd->save_item(NAME(vd->fbi.svert[index].y), index); - vd->save_item(NAME(vd->fbi.svert[index].a), index); - vd->save_item(NAME(vd->fbi.svert[index].r), index); - vd->save_item(NAME(vd->fbi.svert[index].g), index); - vd->save_item(NAME(vd->fbi.svert[index].b), index); - vd->save_item(NAME(vd->fbi.svert[index].z), index); - vd->save_item(NAME(vd->fbi.svert[index].wb), index); - vd->save_item(NAME(vd->fbi.svert[index].w0), index); - vd->save_item(NAME(vd->fbi.svert[index].s0), index); - vd->save_item(NAME(vd->fbi.svert[index].t0), index); - vd->save_item(NAME(vd->fbi.svert[index].w1), index); - vd->save_item(NAME(vd->fbi.svert[index].s1), index); - vd->save_item(NAME(vd->fbi.svert[index].t1), index); - } + vd->save_item(STRUCT_MEMBER(vd->fbi.svert, x)); + vd->save_item(STRUCT_MEMBER(vd->fbi.svert, y)); + vd->save_item(STRUCT_MEMBER(vd->fbi.svert, a)); + vd->save_item(STRUCT_MEMBER(vd->fbi.svert, r)); + vd->save_item(STRUCT_MEMBER(vd->fbi.svert, g)); + vd->save_item(STRUCT_MEMBER(vd->fbi.svert, b)); + vd->save_item(STRUCT_MEMBER(vd->fbi.svert, z)); + vd->save_item(STRUCT_MEMBER(vd->fbi.svert, wb)); + vd->save_item(STRUCT_MEMBER(vd->fbi.svert, w0)); + vd->save_item(STRUCT_MEMBER(vd->fbi.svert, s0)); + vd->save_item(STRUCT_MEMBER(vd->fbi.svert, t0)); + vd->save_item(STRUCT_MEMBER(vd->fbi.svert, w1)); + vd->save_item(STRUCT_MEMBER(vd->fbi.svert, s1)); + vd->save_item(STRUCT_MEMBER(vd->fbi.svert, t1)); vd->save_item(NAME(vd->fbi.fifo.size)); vd->save_item(NAME(vd->fbi.fifo.in)); vd->save_item(NAME(vd->fbi.fifo.out)); - for (index = 0; index < ARRAY_LENGTH(vd->fbi.cmdfifo); index++) - { - vd->save_item(NAME(vd->fbi.cmdfifo[index].enable), index); - vd->save_item(NAME(vd->fbi.cmdfifo[index].count_holes), index); - vd->save_item(NAME(vd->fbi.cmdfifo[index].base), index); - vd->save_item(NAME(vd->fbi.cmdfifo[index].end), index); - vd->save_item(NAME(vd->fbi.cmdfifo[index].rdptr), index); - vd->save_item(NAME(vd->fbi.cmdfifo[index].amin), index); - vd->save_item(NAME(vd->fbi.cmdfifo[index].amax), index); - vd->save_item(NAME(vd->fbi.cmdfifo[index].depth), index); - vd->save_item(NAME(vd->fbi.cmdfifo[index].holes), index); - } + vd->save_item(STRUCT_MEMBER(vd->fbi.cmdfifo, enable)); + vd->save_item(STRUCT_MEMBER(vd->fbi.cmdfifo, count_holes)); + vd->save_item(STRUCT_MEMBER(vd->fbi.cmdfifo, base)); + vd->save_item(STRUCT_MEMBER(vd->fbi.cmdfifo, end)); + vd->save_item(STRUCT_MEMBER(vd->fbi.cmdfifo, rdptr)); + vd->save_item(STRUCT_MEMBER(vd->fbi.cmdfifo, amin)); + vd->save_item(STRUCT_MEMBER(vd->fbi.cmdfifo, amax)); + vd->save_item(STRUCT_MEMBER(vd->fbi.cmdfifo, depth)); + vd->save_item(STRUCT_MEMBER(vd->fbi.cmdfifo, holes)); vd->save_item(NAME(vd->fbi.fogblend)); vd->save_item(NAME(vd->fbi.fogdelta)); vd->save_item(NAME(vd->fbi.clut)); /* register states: tmu */ - for (index = 0; index < ARRAY_LENGTH(vd->tmu); index++) + for (int index = 0; index < ARRAY_LENGTH(vd->tmu); index++) { tmu_state *tmu = &vd->tmu[index]; if (tmu->ram == nullptr) @@ -739,16 +1274,13 @@ void voodoo_device::init_save_state(voodoo_device *vd) vd->save_item(NAME(tmu->dsdy), index); vd->save_item(NAME(tmu->dtdy), index); vd->save_item(NAME(tmu->dwdy), index); - for (subindex = 0; subindex < ARRAY_LENGTH(tmu->ncc); subindex++) - { - vd->save_item(NAME(tmu->ncc[subindex].ir), index * ARRAY_LENGTH(tmu->ncc) + subindex); - vd->save_item(NAME(tmu->ncc[subindex].ig), index * ARRAY_LENGTH(tmu->ncc) + subindex); - vd->save_item(NAME(tmu->ncc[subindex].ib), index * ARRAY_LENGTH(tmu->ncc) + subindex); - vd->save_item(NAME(tmu->ncc[subindex].qr), index * ARRAY_LENGTH(tmu->ncc) + subindex); - vd->save_item(NAME(tmu->ncc[subindex].qg), index * ARRAY_LENGTH(tmu->ncc) + subindex); - vd->save_item(NAME(tmu->ncc[subindex].qb), index * ARRAY_LENGTH(tmu->ncc) + subindex); - vd->save_item(NAME(tmu->ncc[subindex].y), index * ARRAY_LENGTH(tmu->ncc) + subindex); - } + vd->save_item(STRUCT_MEMBER(tmu->ncc, ir), index); + vd->save_item(STRUCT_MEMBER(tmu->ncc, ig), index); + vd->save_item(STRUCT_MEMBER(tmu->ncc, ib), index); + vd->save_item(STRUCT_MEMBER(tmu->ncc, qr), index); + vd->save_item(STRUCT_MEMBER(tmu->ncc, qg), index); + vd->save_item(STRUCT_MEMBER(tmu->ncc, qb), index); + vd->save_item(STRUCT_MEMBER(tmu->ncc, y), index); } /* register states: banshee */ @@ -1079,7 +1611,7 @@ void voodoo_device::recompute_video_memory() } fbi.rowpixels = fbi.tile_width * fbi.x_tiles; -// logerror("VOODOO.%d.VIDMEM: buffer_pages=%X fifo=%X-%X tiles=%X rowpix=%d\n", index, buffer_pages, fifo_start_page, fifo_last_page, fbi.x_tiles, fbi.rowpixels); +// logerror("VOODOO.VIDMEM: buffer_pages=%X fifo=%X-%X tiles=%X rowpix=%d\n", buffer_pages, fifo_start_page, fifo_last_page, fbi.x_tiles, fbi.rowpixels); /* first RGB buffer always starts at 0 */ fbi.rgboffs[0] = 0; @@ -1091,7 +1623,7 @@ void voodoo_device::recompute_video_memory() switch (memory_config) { case 3: /* reserved */ - logerror("VOODOO.%d.ERROR:Unexpected memory configuration in recompute_video_memory!\n", index); + logerror("VOODOO.ERROR:Unexpected memory configuration in recompute_video_memory!\n"); case 0: /* 2 color buffers, 1 aux buffer */ fbi.rgboffs[2] = ~0; @@ -2062,9 +2594,12 @@ void voodoo_device::cmdfifo_w(voodoo_device *vd, cmdfifo_info *f, offs_t offset, vd->pci.op_pending = true; vd->pci.op_end_time = vd->machine().time() + attotime(0, (attoseconds_t)cycles * vd->attoseconds_per_cycle); - if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", vd->index, - vd->machine().time().seconds(), (uint32_t)(vd->machine().time().attoseconds() >> 32), (uint32_t)vd->machine().time().attoseconds(), - vd->pci.op_end_time.seconds(), (uint32_t)(vd->pci.op_end_time.attoseconds() >> 32), (uint32_t)vd->pci.op_end_time.attoseconds()); + if (LOG_FIFO_VERBOSE) + { + vd->logerror("VOODOO.FIFO:direct write start at %d.%018d end at %d.%018d\n", + vd->machine().time().seconds(), vd->machine().time().attoseconds(), + vd->pci.op_end_time.seconds(), vd->pci.op_end_time.attoseconds()); + } } } } @@ -2120,7 +2655,7 @@ void voodoo_device::check_stalled_cpu(attotime current_time) /* resume if necessary */ if (resume || !pci.op_pending) { - if (LOG_FIFO) logerror("VOODOO.%d.FIFO:Stall condition cleared; resuming\n", index); + if (LOG_FIFO) logerror("VOODOO.FIFO:Stall condition cleared; resuming\n"); pci.stall_state = NOT_STALLED; /* either call the callback, or trigger the trigger */ @@ -2191,7 +2726,7 @@ int32_t voodoo_device::register_w(voodoo_device *vd, offs_t offset, uint32_t dat /* first make sure this register is readable */ if (!(vd->regaccess[regnum] & REGISTER_WRITE)) { - vd->logerror("VOODOO.%d.ERROR:Invalid attempt to write %s\n", vd->index, vd->regnames[regnum]); + vd->logerror("VOODOO.ERROR:Invalid attempt to write %s\n", vd->regnames[regnum]); return 0; } @@ -2874,7 +3409,7 @@ int32_t voodoo_device::register_w(voodoo_device *vd, offs_t offset, uint32_t dat break; case trexInit1: - vd->logerror("VOODOO.%d.REG:%s(%d) write = %08X\n", vd->index, (regnum < 0x384 / 4) ? vd->regnames[regnum] : "oob", chips, data); + vd->logerror("VOODOO.REG:%s(%d) write = %08X\n", (regnum < 0x384 / 4) ? vd->regnames[regnum] : "oob", chips, data); /* send tmu config data to the frame buffer */ vd->send_config = (TREXINIT_SEND_TMU_CONFIG(data) > 0); goto default_case; @@ -2906,9 +3441,9 @@ default_case: if (LOG_REGISTERS) { if (regnum < fvertexAx || regnum > fdWdY) - vd->logerror("VOODOO.%d.REG:%s(%d) write = %08X\n", vd->index, (regnum < 0x384/4) ? vd->regnames[regnum] : "oob", chips, origdata); + vd->logerror("VOODOO.REG:%s(%d) write = %08X\n", (regnum < 0x384/4) ? vd->regnames[regnum] : "oob", chips, origdata); else - vd->logerror("VOODOO.%d.REG:%s(%d) write = %f\n", vd->index, (regnum < 0x384/4) ? vd->regnames[regnum] : "oob", chips, (double) u2f(origdata)); + vd->logerror("VOODOO.REG:%s(%d) write = %f\n", (regnum < 0x384/4) ? vd->regnames[regnum] : "oob", chips, (double) u2f(origdata)); } return cycles; @@ -2950,7 +3485,7 @@ int32_t voodoo_device::lfb_direct_w(offs_t offset, uint32_t data, uint32_t mem_m uint32_t const destmax = (fbi.mask + 1 - fbi.lfb_base*4) / 2; uint32_t const bufoffs = y * fbi.rowpixels + x; if (bufoffs >= destmax) { - logerror("lfb_direct_w: Buffer offset out of bounds x=%i y=%i offset=%08X bufoffs=%08X data=%08X\n", x, y, offset, (uint32_t) bufoffs, data); + logerror("lfb_direct_w: Buffer offset out of bounds x=%i y=%i offset=%08X bufoffs=%08X data=%08X\n", x, y, offset, bufoffs, data); return 0; } if (ACCESSING_BITS_0_15) @@ -2959,7 +3494,7 @@ int32_t voodoo_device::lfb_direct_w(offs_t offset, uint32_t data, uint32_t mem_m dest[bufoffs + 1] = data>>16; // Need to notify that frame buffer has changed fbi.video_changed = true; - if (LOG_LFB) logerror("VOODOO.%d.LFB:write direct (%d,%d) = %08X & %08X\n", index, x, y, data, mem_mask); + if (LOG_LFB) logerror("VOODOO.LFB:write direct (%d,%d) = %08X & %08X\n", x, y, data, mem_mask); return 0; } @@ -3215,7 +3750,7 @@ int32_t voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, uint32_t data, ui DECLARE_DITHER_POINTERS_NO_DITHER_VAR; uint32_t bufoffs; - if (LOG_LFB) vd->logerror("VOODOO.%d.LFB:write raw mode %X (%d,%d) = %08X & %08X\n", vd->index, LFBMODE_WRITE_FORMAT(vd->reg[lfbMode].u), x, y, data, mem_mask); + if (LOG_LFB) vd->logerror("VOODOO.LFB:write raw mode %X (%d,%d) = %08X & %08X\n", LFBMODE_WRITE_FORMAT(vd->reg[lfbMode].u), x, y, data, mem_mask); /* determine the screen Y */ scry = y; @@ -3273,7 +3808,7 @@ int32_t voodoo_device::lfb_w(voodoo_device* vd, offs_t offset, uint32_t data, ui { DECLARE_DITHER_POINTERS; - if (LOG_LFB) vd->logerror("VOODOO.%d.LFB:write pipelined mode %X (%d,%d) = %08X & %08X\n", vd->index, LFBMODE_WRITE_FORMAT(vd->reg[lfbMode].u), x, y, data, mem_mask); + if (LOG_LFB) vd->logerror("VOODOO.LFB:write pipelined mode %X (%d,%d) = %08X & %08X\n", LFBMODE_WRITE_FORMAT(vd->reg[lfbMode].u), x, y, data, mem_mask); /* determine the screen Y */ scry = y; @@ -3554,9 +4089,12 @@ void voodoo_device::flush_fifos(voodoo_device *vd, attotime current_time) if (!vd->pci.op_pending) fatalerror("flush_fifos called with no pending operation\n"); - if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.%d.FIFO:flush_fifos start -- pending=%d.%08X%08X cur=%d.%08X%08X\n", vd->index, - vd->pci.op_end_time.seconds(), (uint32_t)(vd->pci.op_end_time.attoseconds() >> 32), (uint32_t)vd->pci.op_end_time.attoseconds(), - current_time.seconds(), (uint32_t)(current_time.attoseconds() >> 32), (uint32_t)current_time.attoseconds()); + if (LOG_FIFO_VERBOSE) + { + vd->logerror("VOODOO.FIFO:flush_fifos start -- pending=%d.%018d cur=%d.%018d\n", + vd->pci.op_end_time.seconds(), vd->pci.op_end_time.attoseconds(), + current_time.seconds(), current_time.attoseconds()); + } /* loop while we still have cycles to burn */ while (vd->pci.op_end_time <= current_time) @@ -3580,7 +4118,7 @@ void voodoo_device::flush_fifos(voodoo_device *vd, attotime current_time) { vd->pci.op_pending = false; in_flush = false; - if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.%d.FIFO:flush_fifos end -- CMDFIFO empty\n", vd->index); + if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.FIFO:flush_fifos end -- CMDFIFO empty\n"); return; } } @@ -3592,7 +4130,7 @@ void voodoo_device::flush_fifos(voodoo_device *vd, attotime current_time) { vd->pci.op_pending = false; in_flush = false; - if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.%d.FIFO:flush_fifos end -- CMDFIFO empty\n", vd->index); + if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.FIFO:flush_fifos end -- CMDFIFO empty\n"); return; } } @@ -3609,7 +4147,7 @@ void voodoo_device::flush_fifos(voodoo_device *vd, attotime current_time) { vd->pci.op_pending = false; in_flush = false; - if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.%d.FIFO:flush_fifos end -- FIFOs empty\n", vd->index); + if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.FIFO:flush_fifos end -- FIFOs empty\n"); return; } @@ -3652,13 +4190,19 @@ void voodoo_device::flush_fifos(voodoo_device *vd, attotime current_time) /* account for those cycles */ vd->pci.op_end_time += attotime(0, (attoseconds_t)cycles * vd->attoseconds_per_cycle); - if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.%d.FIFO:update -- pending=%d.%08X%08X cur=%d.%08X%08X\n", vd->index, - vd->pci.op_end_time.seconds(), (uint32_t)(vd->pci.op_end_time.attoseconds() >> 32), (uint32_t)vd->pci.op_end_time.attoseconds(), - current_time.seconds(), (uint32_t)(current_time.attoseconds() >> 32), (uint32_t)current_time.attoseconds()); + if (LOG_FIFO_VERBOSE) + { + vd->logerror("VOODOO.FIFO:update -- pending=%d.%018d cur=%d.%018d\n", + vd->pci.op_end_time.seconds(), vd->pci.op_end_time.attoseconds(), + current_time.seconds(), current_time.attoseconds()); + } } - if (LOG_FIFO_VERBOSE) vd->logerror("VOODOO.%d.FIFO:flush_fifos end -- pending command complete at %d.%08X%08X\n", vd->index, - vd->pci.op_end_time.seconds(), (uint32_t)(vd->pci.op_end_time.attoseconds() >> 32), (uint32_t)vd->pci.op_end_time.attoseconds()); + if (LOG_FIFO_VERBOSE) + { + vd->logerror("VOODOO.FIFO:flush_fifos end -- pending command complete at %d.%018d\n", + vd->pci.op_end_time.seconds(), vd->pci.op_end_time.attoseconds()); + } in_flush = false; } @@ -3769,9 +4313,12 @@ void voodoo_device::voodoo_w(offs_t offset, u32 data, u32 mem_mask) pci.op_pending = true; pci.op_end_time = machine().time() + attotime(0, (attoseconds_t)cycles * attoseconds_per_cycle); - if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:direct write start at %d.%08X%08X end at %d.%08X%08X\n", index, - machine().time().seconds(), (uint32_t)(machine().time().attoseconds() >> 32), (uint32_t)machine().time().attoseconds(), - pci.op_end_time.seconds(), (uint32_t)(pci.op_end_time.attoseconds() >> 32), (uint32_t)pci.op_end_time.attoseconds()); + if (LOG_FIFO_VERBOSE) + { + logerror("VOODOO.FIFO:direct write start at %d.%018d end at %d.%018d\n", + machine().time().seconds(), machine().time().attoseconds(), + pci.op_end_time.seconds(), pci.op_end_time.attoseconds()); + } } g_profiler.stop(); return; @@ -3808,7 +4355,7 @@ void voodoo_device::voodoo_w(offs_t offset, u32 data, u32 mem_mask) valid[2] = valid[3] = FBIINIT0_TEXMEM_TO_MEMORY_FIFO(reg[fbiInit0].u); /* flush everything we can */ - if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:voodoo_w moving PCI FIFO to memory FIFO\n", index); + if (LOG_FIFO_VERBOSE) logerror("VOODOO.FIFO:voodoo_w moving PCI FIFO to memory FIFO\n"); while (!pci.fifo.empty() && valid[(pci.fifo.peek() >> 22) & 3]) { fbi.fifo.add(pci.fifo.remove()); @@ -3819,7 +4366,7 @@ void voodoo_device::voodoo_w(offs_t offset, u32 data, u32 mem_mask) if (FBIINIT0_STALL_PCIE_FOR_HWM(reg[fbiInit0].u) && fbi.fifo.items() >= 2 * 32 * FBIINIT0_MEMORY_FIFO_HWM(reg[fbiInit0].u)) { - if (LOG_FIFO) logerror("VOODOO.%d.FIFO:voodoo_w hit memory FIFO HWM -- stalling\n", index); + if (LOG_FIFO) logerror("VOODOO.FIFO:voodoo_w hit memory FIFO HWM -- stalling\n"); stall_cpu(STALLED_UNTIL_FIFO_LWM, machine().time()); } } @@ -3828,14 +4375,14 @@ void voodoo_device::voodoo_w(offs_t offset, u32 data, u32 mem_mask) if (FBIINIT0_STALL_PCIE_FOR_HWM(reg[fbiInit0].u) && pci.fifo.space() <= 2 * FBIINIT0_PCI_FIFO_LWM(reg[fbiInit0].u)) { - if (LOG_FIFO) logerror("VOODOO.%d.FIFO:voodoo_w hit PCI FIFO free LWM -- stalling\n", index); + if (LOG_FIFO) logerror("VOODOO.FIFO:voodoo_w hit PCI FIFO free LWM -- stalling\n"); stall_cpu(STALLED_UNTIL_FIFO_LWM, machine().time()); } /* if we weren't ready, and this is a non-FIFO access, stall until the FIFOs are clear */ if (stall) { - if (LOG_FIFO_VERBOSE) logerror("VOODOO.%d.FIFO:voodoo_w wrote non-FIFO register -- stalling until clear\n", index); + if (LOG_FIFO_VERBOSE) logerror("VOODOO.FIFO:voodoo_w wrote non-FIFO register -- stalling until clear\n"); stall_cpu(STALLED_UNTIL_FIFO_EMPTY, machine().time()); } @@ -3861,7 +4408,7 @@ uint32_t voodoo_device::register_r(voodoo_device *vd, offs_t offset) /* first make sure this register is readable */ if (!(vd->regaccess[regnum] & REGISTER_READ)) { - vd->logerror("VOODOO.%d.ERROR:Invalid attempt to read %s\n", vd->index, regnum < 225 ? vd->regnames[regnum] : "unknown register"); + vd->logerror("VOODOO.ERROR:Invalid attempt to read %s\n", regnum < 225 ? vd->regnames[regnum] : "unknown register"); return 0xffffffff; } @@ -4035,7 +4582,7 @@ uint32_t voodoo_device::register_r(voodoo_device *vd, offs_t offset) logit = false; if (logit) - vd->logerror("VOODOO.%d.REG:%s read = %08X\n", vd->index, vd->regnames[regnum], result); + vd->logerror("VOODOO.REG:%s read = %08X\n", vd->regnames[regnum], result); } return result; @@ -4124,7 +4671,7 @@ static uint32_t lfb_r(voodoo_device *vd, offs_t offset, bool lfb_3d) if (LFBMODE_BYTE_SWIZZLE_READS(vd->reg[lfbMode].u)) data = swapendian_int32(data); - if (LOG_LFB) vd->logerror("VOODOO.%d.LFB:read (%d,%d) = %08X\n", vd->index, x, y, data); + if (LOG_LFB) vd->logerror("VOODOO.LFB:read (%d,%d) = %08X\n", x, y, data); return data; } @@ -5063,11 +5610,6 @@ void voodoo_device::device_start() if (!m_screen || !m_cpu) throw device_missing_dependencies(); - const raster_info *info; - void *fbmem, *tmumem[2]; - uint32_t tmumem0, tmumem1; - int val; - /* validate configuration */ assert(m_fbmem > 0); @@ -5083,7 +5625,7 @@ void voodoo_device::device_start() /* create a table of precomputed 1/n and log2(n) values */ /* n ranges from 1.0000 to 2.0000 */ - for (val = 0; val <= (1 << RECIPLOG_LOOKUP_BITS); val++) + for (int val = 0; val <= (1 << RECIPLOG_LOOKUP_BITS); val++) { uint32_t value = (1 << RECIPLOG_LOOKUP_BITS) + val; voodoo_reciplog[val*2 + 0] = (1 << (RECIPLOG_LOOKUP_PREC + RECIPLOG_LOOKUP_BITS)) / value; @@ -5091,7 +5633,7 @@ void voodoo_device::device_start() } /* create dithering tables */ - for (val = 0; val < 256*16*2; val++) + for (int val = 0; val < 256*16*2; val++) { int g = (val >> 0) & 1; int x = (val >> 1) & 3; @@ -5166,7 +5708,8 @@ void voodoo_device::device_start() trigger = 51324 + index; /* build the rasterizer table */ - for (info = predef_raster_table; info->callback; info++) + std::fill(std::begin(raster_hash), std::end(raster_hash), nullptr); + for (const raster_info *info = predef_raster_table; info->callback; info++) add_rasterizer(this, info); /* set up the PCI FIFO */ @@ -5177,8 +5720,9 @@ void voodoo_device::device_start() pci.continue_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(voodoo_device::stall_cpu_callback), this), nullptr); /* allocate memory */ - tmumem0 = m_tmumem0; - tmumem1 = m_tmumem1; + void *fbmem, *tmumem[2]; + uint32_t tmumem0 = m_tmumem0; + uint32_t tmumem1 = m_tmumem1; if (vd_type <= TYPE_VOODOO_2) { /* separate FB/TMU memory */ @@ -5214,7 +5758,8 @@ void voodoo_device::device_start() } /* initialize some registers */ - memset(reg, 0, sizeof(reg)); + for (voodoo_reg &r : reg) + r.u = 0; pci.init_enable = 0; reg[fbiInit0].u = (1 << 4) | (0x10 << 6); reg[fbiInit1].u = (1 << 1) | (1 << 8) | (1 << 12) | (2 << 20); @@ -5890,9 +6435,25 @@ voodoo_device::voodoo_device(const machine_config &mconfig, device_type type, co , m_pciint(*this) , m_screen_finder(*this, finder_base::DUMMY_TAG) , m_cpu_finder(*this, finder_base::DUMMY_TAG) + , index(0) , m_screen(nullptr) , m_cpu(nullptr) , vd_type(vdt) + , chipmask(0) + , freq(0) + , attoseconds_per_cycle(0) + , extra_cycles(0) + , trigger(0) + , regaccess(nullptr) + , regnames(nullptr) + , alt_regmap(0) + , poly(nullptr) + , thread_stats(nullptr) + , last_status_pc(0) + , last_status_value(0) + , next_rasterizer(0) + , send_config(false) + , tmu_config(0) { } |