clean-ups

This commit is contained in:
Romain Dolbeau 2022-09-21 23:38:09 +02:00
parent be8a2ec995
commit f722c396c9
4 changed files with 85 additions and 43 deletions

View File

@ -5,3 +5,6 @@ vid_decl_rom.o
vid_decl_rom.raw
vid_decl_rom.srec
*.bin
VidRom*
NuBusFPGADrvr*.s
NuBusFPGARAMDskDrvr*.s

View File

@ -90,7 +90,7 @@ OSErr cNuBusFPGACtl(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
case -1:
asm volatile(".word 0xfe16\n");
break;
case cscReset:
case cscReset: /* 0x0 */
{
VDPageInfo *vPInfo = (VDPageInfo *)*(long *)pb->csParam;
dStore->curMode = nativeVidMode;
@ -101,11 +101,11 @@ OSErr cNuBusFPGACtl(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
ret = noErr;
}
break;
case cscKillIO:
case cscKillIO: /* 0x1 */
asm volatile(".word 0xfe16\n");
ret = noErr;
break;
case cscSetMode: /* 2 */
case cscSetMode: /* 0x2 */
{
VDPageInfo *vPInfo = (VDPageInfo *)*(long *)pb->csParam;
@ -115,7 +115,7 @@ OSErr cNuBusFPGACtl(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
vPInfo->csBaseAddr = (void*)(vPInfo->csPage * 1024 * 1024 * 4);
}
break;
case cscSetEntries: /* 3 */
case cscSetEntries: /* 0x3 */
if (1) {
VDSetEntryRecord **vdentry = (VDSetEntryRecord **)(long *)pb->csParam;
int csCount = (*vdentry)->csCount;
@ -163,7 +163,7 @@ OSErr cNuBusFPGACtl(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
}
cscSetMode_done:
break;
case cscSetGamma: /* 4 */
case cscSetGamma: /* 0x4 */
{
VDGammaRecord *vdgamma = (VDGammaRecord *)*(long *)pb->csParam;
GammaTbl *gammaTbl = (GammaTbl*)vdgamma->csGTable;
@ -205,7 +205,7 @@ OSErr cNuBusFPGACtl(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
ret = noErr;
}
break;
case cscGrayPage: /* 5 == cscGrayScreen */
case cscGrayPage: /* 0x5 == cscGrayScreen */
{
VDPageInfo *vPInfo = (VDPageInfo *)*(long *)pb->csParam;
const uint8_t idx = dStore->curMode % 4; // checkme
@ -280,7 +280,7 @@ OSErr cNuBusFPGACtl(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
ret = noErr;
}
break;
case cscSetGray: /* 6 */
case cscSetGray: /* 0x6 */
{
VDGrayRecord *vGInfo = (VDGrayRecord *)*(long *)pb->csParam;
dStore->gray = vGInfo->csMode;
@ -288,20 +288,20 @@ OSErr cNuBusFPGACtl(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
}
break;
case cscSetInterrupt: /* 7 */
case cscSetInterrupt: /* 0x7 */
{
VDFlagRecord *vdflag = (VDFlagRecord *)*(long *)pb->csParam;
ret = changeIRQ(dce, 1 - vdflag->csMode, controlErr);
}
break;
case cscDirectSetEntries: /* 8 */
case cscDirectSetEntries: /* 0x8 */
asm volatile(".word 0xfe16\n");
return controlErr;
break;
case cscSetDefaultMode: /* 9 */
{ /* fixme: NVRAM */
case cscSetDefaultMode: /* 0x9 */
{
VDDefMode *vddefm = (VDDefMode *)*(long *)pb->csParam;
ret = updatePRAM(dce, vddefm->csID, dStore->curDepth, 0);
@ -319,6 +319,9 @@ OSErr cNuBusFPGACtl(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
}
break;
/* cscSetSync */ /* 0xb */
/* 0xc ... 0xf : undefined */
case cscSavePreferredConfiguration: /* 0x10 */
{
VDSwitchInfoRec *vdswitch = *(VDSwitchInfoRec **)(long *)pb->csParam;
@ -326,6 +329,22 @@ OSErr cNuBusFPGACtl(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
ret = updatePRAM(dce, vdswitch->csData, vdswitch->csMode, 0);
}
break;
/* 0x11 .. 0x15 : undefined */
/* cscSetHardwareCursor */ /* 0x16 */
/* cscDrawHardwareCursor */ /* 0x17 */
/* cscSetConvolution */ /* 0x18 */
/* cscSetPowerState */ /* 0x19 */
/* cscPrivateControlCall */ /* 0x1a */
/* 0x1b : undefined */
/* cscSetMultiConnect */ /* 0x1c */
/* cscSetClutBehavior */ /* 0x1d */
/* 0x1e : undefined */
/* cscSetDetailedTiming */ /* 0x1f */
/* 0x20 : undefined */
/* cscDoCommunication */ /* 0x21 */
/* cscProbeConnection */ /* 0x22 */
default: /* always return controlErr for unknown csCode */
asm volatile(".word 0xfe16\n");
@ -343,10 +362,10 @@ OSErr reconfHW(AuxDCEPtr dce, unsigned char mode, unsigned char depth, unsigned
OSErr err = noErr;
char busMode = 1;
write_reg(dce, GOBOFB_DEBUG, 0xBEEF0031);
write_reg(dce, GOBOFB_DEBUG, mode);
write_reg(dce, GOBOFB_DEBUG, depth);
write_reg(dce, GOBOFB_DEBUG, page);
/* write_reg(dce, GOBOFB_DEBUG, 0xBEEF0031); */
/* write_reg(dce, GOBOFB_DEBUG, mode); */
/* write_reg(dce, GOBOFB_DEBUG, depth); */
/* write_reg(dce, GOBOFB_DEBUG, page); */
if ((mode == dStore->curMode) &&
(depth == dStore->curDepth) &&

View File

@ -210,6 +210,8 @@ OSErr cNuBusFPGAStatus(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
ret = noErr;
break;
/* cscGetScanProc */ /* 0xf*/ /* undocumented ? could be called according to #mac68k */
case cscGetPreferredConfiguration: /* 0x10 */
{ /* fixme: NVRAM */
VDSwitchInfoRec *vdswitch = *(VDSwitchInfoRec **)(long *)pb->csParam;
@ -351,18 +353,31 @@ OSErr cNuBusFPGAStatus(CntrlParamPtr pb, /* DCtlPtr */ AuxDCEPtr dce)
ret = statusErr;
break;
case cscRetrieveGammaTable: /* 0x17 */
case cscRetrieveGammaTable: /* 0x15 */
asm volatile(".word 0xfe16\n");
ret = statusErr;
break;
/* cscSupportsHardwareCursor */ /* 0x16 */ /* never called, unfortunately */
/* cscGetHardwareCursorDrawState */ /* 0x17 */ /* never called, unfortunately */
case cscGetConvolution: /* 0x18 */
ret = statusErr;
break;
break;
/* cscGetPowerState */ /* 0x19 */
/* cscPrivateStatusCall */ /* 0x1a */
/* cscGetDDCBlock */ /* 0x1b */
case cscGetMultiConnect: /* 0x1c */
ret = statusErr;
break;
/* cscGetClutBehavior */ /* 0x1d */
/* cscGetTimingRanges */ /* 0x1e */
/* cscGetDetailedTiming */ /* 0x1f */
/* cscGetCommunicationInfo */ /* 0x20 */
default: /* always return statusErr for unknown csCode */
asm volatile(".word 0xfe16\n");

View File

@ -4,39 +4,40 @@
#include <stdint.h>
struct one_res {
const unsigned short hres;
const unsigned short vres;
const unsigned short hres;
const unsigned short vres;
const unsigned char native_only;
};
#define NUM_RES 16
#if 1
static struct one_res res_db[NUM_RES] = {
{ 1920, 1080 },
{ 1680, 1050 }, // should be unsuitable
{ 1600, 900 },
{ 1440, 900 },
{ 1280, 1024 },
{ 1280, 960 },
{ 1280, 800 },
{ 1152, 870 },
{ 1152, 864 },
{ 1024, 768 },
{ 832, 624 },
{ 800, 600 },
{ 768, 576 },
{ 640, 480 },
{ 512, 384 },
{ 0, 0 }
{ 1920, 1080, 0 },
{ 1680, 1050, 0 }, // should be unsuitable
{ 1600, 900, 1 }, // freaks out my monitor on 1920x1080, it thinks it's 1680x1050...
{ 1440, 900, 0 },
{ 1280, 1024, 0 },
{ 1280, 960, 0 },
{ 1280, 800, 0 },
{ 1152, 870, 0 },
{ 1152, 864, 0 },
{ 1024, 768, 0 },
{ 832, 624, 0 },
{ 800, 600, 0 },
{ 768, 576, 0 },
{ 640, 480, 0 },
{ 512, 384, 0 },
{ 0, 0, 0 }
};
#else
static struct one_res res_db[NUM_RES] = {
{ 1920, 1080 },
{ 1600, 900 },
/* { 640, 480 }, */
{ 0, 0}
{ 1920, 1080, 0 },
{ 1600, 900, 1 },
/* { 640, 480, 0 }, */
{ 0, 0, 0}
};
#endif
@ -64,7 +65,10 @@ int main(int argc, char **argv) {
const unsigned short vres = res_db[i].vres;
FILE *fd;
if ((hres * vres) % 128) // unsuitable
if ((hres * vres) % 128) // unsuitable, safety net
continue;
if (res_db[i].native_only && ((hres != maxhres) || (vres != maxvres)))
continue;
snprintf(filename, 512, "VidRomRes_%hux%hu.s", hres, vres);
@ -264,6 +268,7 @@ int main(int argc, char **argv) {
fprintf(fd, "\tOSLstEntry\tsRsrc_GoboFB_R%hux%hu,_sRsrc_GoboFB_R%hux%hu/* video sRsrc List */\n", hres, vres, hres, vres);
}
}
/* fprintf(fd, "\tOSLstEntry\tsRsrc_RAMDsk,_sRsrc_RAMDsk\n"); */
fprintf(fd, "\tDatLstEntry endOfList, 0\n");
fclose(fd);