This commit is contained in:
Donkey Kong 2023-06-02 00:31:11 +09:30
parent 958e599519
commit e883bd3a53
13 changed files with 313 additions and 29 deletions

View File

@ -453,6 +453,8 @@ build/us/src/dk64_boot/io/conteepwrite.c.o: OPT_FLAGS = -O2
build/us/src/dk64_boot/io/conteepread.c.o: OPT_FLAGS = -O2
build/us/src/dk64_boot/io/sirawdma.c.o: OPT_FLAGS = -O2
build/us/src/dk64_boot/io/viswapcontext.c.o: OPT_FLAGS = -O2
build/us/src/dk64_boot/io/contpfs.c.o: OPT_FLAGS = -O2
build/us/src/dk64_boot/io/contpfs.c.o: MIPSISET := -mips3 -o32
build/us/src/dk64_boot/io/motor.c.o: OPT_FLAGS = -O2

View File

@ -13,7 +13,7 @@ us,boot,__osContDataCrc,160,no
us,boot,func_80002ECC,76,no
us,boot,__osSetCompare,16,yes
us,boot,guMtxL2F,184,no
us,boot,__osPiCreateAccessQueue,80,no
us,boot,__osPiCreateAccessQueue,80,yes
us,boot,func_800005A8,984,no
us,boot,func_80007360,100,yes
us,boot,__osDispatchThread,396,yes
@ -50,7 +50,7 @@ us,boot,sqrtf,16,yes
us,boot,__osPfsGetStatus,208,no
us,boot,__osSetGlobalIntMask,76,yes
us,boot,osUnmapTLBAll,80,yes
us,boot,__osPiGetAccess,68,no
us,boot,__osPiGetAccess,68,yes
us,boot,osSetThreadPri,224,yes
us,boot,__osSpGetStatus,12,yes
us,boot,memcpy,288,no
@ -112,13 +112,13 @@ us,boot,__osRestoreInt,32,yes
us,boot,__osViGetCurrentContext,12,yes
us,boot,osSetTime,36,yes
us,boot,osViSetMode,104,yes
us,boot,__osPiRelAccess,44,no
us,boot,__osPiRelAccess,44,yes
us,boot,func_80002DE4,180,no
us,boot,osInitialize,704,no
us,boot,func_800031E0,44,no
us,boot,func_80002828,184,no
us,boot,__osPackEepWriteData,172,no
us,boot,osPfsIsPlug,416,no
us,boot,osPfsIsPlug,416,yes
us,boot,send_mesg,232,yes
us,boot,__osEnqueueThread,72,yes
us,boot,osEPiRawWriteIo,352,no
@ -182,7 +182,7 @@ us,boot,osPiGetStatus,12,yes
us,boot,osSpTaskStartGo,64,yes
us,boot,func_80000CD4,184,yes
us,boot,sinf,448,no
us,boot,__osPfsRequestData,208,no
us,boot,__osPfsRequestData,208,yes
us,boot,func_80005A44,44,no
us,boot,func_800029EC,68,no
us,boot,func_800009D0,88,yes
@ -213,7 +213,7 @@ us,boot,osViSetSpecialFeatures,440,yes
us,boot,__osGetSR,16,yes
us,boot,guMtxIdentF,136,yes
us,boot,func_80007454,140,yes
us,boot,__osPfsGetInitData,208,no
us,boot,__osPfsGetInitData,208,yes
us,boot,__osViSwapContext,768,no
us,boot,viMgrMain,400,no
us,boot,__osContRamReadData,560,no

1 version section function length matching
13 us boot func_80002ECC 76 no
14 us boot __osSetCompare 16 yes
15 us boot guMtxL2F 184 no
16 us boot __osPiCreateAccessQueue 80 no yes
17 us boot func_800005A8 984 no
18 us boot func_80007360 100 yes
19 us boot __osDispatchThread 396 yes
50 us boot __osPfsGetStatus 208 no
51 us boot __osSetGlobalIntMask 76 yes
52 us boot osUnmapTLBAll 80 yes
53 us boot __osPiGetAccess 68 no yes
54 us boot osSetThreadPri 224 yes
55 us boot __osSpGetStatus 12 yes
56 us boot memcpy 288 no
112 us boot __osViGetCurrentContext 12 yes
113 us boot osSetTime 36 yes
114 us boot osViSetMode 104 yes
115 us boot __osPiRelAccess 44 no yes
116 us boot func_80002DE4 180 no
117 us boot osInitialize 704 no
118 us boot func_800031E0 44 no
119 us boot func_80002828 184 no
120 us boot __osPackEepWriteData 172 no
121 us boot osPfsIsPlug 416 no yes
122 us boot send_mesg 232 yes
123 us boot __osEnqueueThread 72 yes
124 us boot osEPiRawWriteIo 352 no
182 us boot osSpTaskStartGo 64 yes
183 us boot func_80000CD4 184 yes
184 us boot sinf 448 no
185 us boot __osPfsRequestData 208 no yes
186 us boot func_80005A44 44 no
187 us boot func_800029EC 68 no
188 us boot func_800009D0 88 yes
213 us boot __osGetSR 16 yes
214 us boot guMtxIdentF 136 yes
215 us boot func_80007454 140 yes
216 us boot __osPfsGetInitData 208 no yes
217 us boot __osViSwapContext 768 no
218 us boot viMgrMain 400 no
219 us boot __osContRamReadData 560 no

View File

@ -3981,7 +3981,7 @@ us,boot,__osContDataCrc,160,no
us,boot,func_80002ECC,76,no
us,boot,__osSetCompare,16,yes
us,boot,guMtxL2F,184,no
us,boot,__osPiCreateAccessQueue,80,no
us,boot,__osPiCreateAccessQueue,80,yes
us,boot,func_800005A8,984,no
us,boot,func_80007360,100,yes
us,boot,__osDispatchThread,396,yes
@ -4018,7 +4018,7 @@ us,boot,sqrtf,16,yes
us,boot,__osPfsGetStatus,208,no
us,boot,__osSetGlobalIntMask,76,yes
us,boot,osUnmapTLBAll,80,yes
us,boot,__osPiGetAccess,68,no
us,boot,__osPiGetAccess,68,yes
us,boot,osSetThreadPri,224,yes
us,boot,__osSpGetStatus,12,yes
us,boot,memcpy,288,no
@ -4080,13 +4080,13 @@ us,boot,__osRestoreInt,32,yes
us,boot,__osViGetCurrentContext,12,yes
us,boot,osSetTime,36,yes
us,boot,osViSetMode,104,yes
us,boot,__osPiRelAccess,44,no
us,boot,__osPiRelAccess,44,yes
us,boot,func_80002DE4,180,no
us,boot,osInitialize,704,no
us,boot,func_800031E0,44,no
us,boot,func_80002828,184,no
us,boot,__osPackEepWriteData,172,no
us,boot,osPfsIsPlug,416,no
us,boot,osPfsIsPlug,416,yes
us,boot,send_mesg,232,yes
us,boot,__osEnqueueThread,72,yes
us,boot,osEPiRawWriteIo,352,no
@ -4150,7 +4150,7 @@ us,boot,osPiGetStatus,12,yes
us,boot,osSpTaskStartGo,64,yes
us,boot,func_80000CD4,184,yes
us,boot,sinf,448,no
us,boot,__osPfsRequestData,208,no
us,boot,__osPfsRequestData,208,yes
us,boot,func_80005A44,44,no
us,boot,func_800029EC,68,no
us,boot,func_800009D0,88,yes
@ -4181,7 +4181,7 @@ us,boot,osViSetSpecialFeatures,440,yes
us,boot,__osGetSR,16,yes
us,boot,guMtxIdentF,136,yes
us,boot,func_80007454,140,yes
us,boot,__osPfsGetInitData,208,no
us,boot,__osPfsGetInitData,208,yes
us,boot,__osViSwapContext,768,no
us,boot,viMgrMain,400,no
us,boot,__osContRamReadData,560,no

1 version section function length matching
3981 us boot func_80002ECC 76 no
3982 us boot __osSetCompare 16 yes
3983 us boot guMtxL2F 184 no
3984 us boot __osPiCreateAccessQueue 80 no yes
3985 us boot func_800005A8 984 no
3986 us boot func_80007360 100 yes
3987 us boot __osDispatchThread 396 yes
4018 us boot __osPfsGetStatus 208 no
4019 us boot __osSetGlobalIntMask 76 yes
4020 us boot osUnmapTLBAll 80 yes
4021 us boot __osPiGetAccess 68 no yes
4022 us boot osSetThreadPri 224 yes
4023 us boot __osSpGetStatus 12 yes
4024 us boot memcpy 288 no
4080 us boot __osViGetCurrentContext 12 yes
4081 us boot osSetTime 36 yes
4082 us boot osViSetMode 104 yes
4083 us boot __osPiRelAccess 44 no yes
4084 us boot func_80002DE4 180 no
4085 us boot osInitialize 704 no
4086 us boot func_800031E0 44 no
4087 us boot func_80002828 184 no
4088 us boot __osPackEepWriteData 172 no
4089 us boot osPfsIsPlug 416 no yes
4090 us boot send_mesg 232 yes
4091 us boot __osEnqueueThread 72 yes
4092 us boot osEPiRawWriteIo 352 no
4150 us boot osSpTaskStartGo 64 yes
4151 us boot func_80000CD4 184 yes
4152 us boot sinf 448 no
4153 us boot __osPfsRequestData 208 no yes
4154 us boot func_80005A44 44 no
4155 us boot func_800029EC 68 no
4156 us boot func_800009D0 88 yes
4181 us boot __osGetSR 16 yes
4182 us boot guMtxIdentF 136 yes
4183 us boot func_80007454 140 yes
4184 us boot __osPfsGetInitData 208 no yes
4185 us boot __osViSwapContext 768 no
4186 us boot viMgrMain 400 no
4187 us boot __osContRamReadData 560 no

View File

@ -9,7 +9,7 @@
</mask>
<g mask="url(#anybadge_1)">
<path fill="#555" d="M0 0h71v20H0z"/>
<path fill="#c0a400" d="M71 0h67v20H71z"/>
<path fill="#c0ab00" d="M71 0h67v20H71z"/>
<path fill="url(#b)" d="M0 0h138v20H0z"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
@ -17,7 +17,7 @@
<text x="35.5" y="14">dk64_boot</text>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="105.5" y="15" fill="#010101" fill-opacity=".3">42.6305%</text>
<text x="104.5" y="14">42.6305%</text>
<text x="105.5" y="15" fill="#010101" fill-opacity=".3">44.4765%</text>
<text x="104.5" y="14">44.4765%</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -9,7 +9,7 @@
</mask>
<g mask="url(#anybadge_1)">
<path fill="#555" d="M0 0h132v20H0z"/>
<path fill="#c06100" d="M132 0h67v20H132z"/>
<path fill="#c06200" d="M132 0h67v20H132z"/>
<path fill="url(#b)" d="M0 0h199v20H0z"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
@ -17,7 +17,7 @@
<text x="66.0" y="14">Donkey Kong 64 (US)</text>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="166.5" y="15" fill="#010101" fill-opacity=".3">25.3504%</text>
<text x="165.5" y="14">25.3504%</text>
<text x="166.5" y="15" fill="#010101" fill-opacity=".3">25.4125%</text>
<text x="165.5" y="14">25.4125%</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,10 +1,103 @@
#include <ultra64.h>
#include "functions.h"
#include <os_internal.h>
#include "controller.h"
#include "siint.h"
extern u8 __osContLastCmd;
extern OSPifRam D_80014DC0; // __osContPifRam
extern u8 D_80014E01; // __osMaxControllers
extern OSPifRam D_800164F0; // __osPfsPifRam
#pragma GLOBAL_ASM("asm/nonmatchings/dk64_boot/io/pfsisplug/osPfsIsPlug.s")
s32 osPfsIsPlug(OSMesgQueue *queue, u8 *pattern)
{
s32 ret;
OSMesg dummy;
u8 bitpattern;
OSContStatus data[MAXCONTROLLERS];
int channel;
u8 bits;
int crc_error_cnt;
ret = 0;
bits = 0;
crc_error_cnt = 3;
__osSiGetAccess();
while (TRUE)
{
__osPfsRequestData(CONT_CMD_REQUEST_STATUS);
ret = __osSiRawStartDma(OS_WRITE, &D_800164F0);
osRecvMesg(queue, &dummy, OS_MESG_BLOCK);
ret = __osSiRawStartDma(OS_READ, &D_800164F0);
osRecvMesg(queue, &dummy, OS_MESG_BLOCK);
__osPfsGetInitData(&bitpattern, data);
for (channel = 0; channel < D_80014E01; channel++)
{
if ((data[channel].status & CONT_ADDR_CRC_ER) == 0)
{
crc_error_cnt--;
break;
}
}
if (D_80014E01 == channel)
crc_error_cnt = 0;
if (crc_error_cnt < 1)
{
for (channel = 0; channel < D_80014E01; channel++)
{
if (data[channel].errno == 0 && (data[channel].status & CONT_CARD_ON) != 0)
bits |= 1 << channel;
}
__osSiRelAccess();
*pattern = bits;
return ret;
}
}
}
#pragma GLOBAL_ASM("asm/nonmatchings/dk64_boot/io/pfsisplug/__osPfsRequestData.s")
void __osPfsRequestData(u8 cmd)
{
u8 *ptr;
__OSContRequesFormat requestformat;
int i;
ptr = (u8 *)&D_800164F0;
__osContLastCmd = cmd;
D_800164F0.pifstatus = CONT_CMD_EXE;
requestformat.dummy = CONT_CMD_NOP;
requestformat.txsize = CONT_CMD_REQUEST_STATUS_TX;
requestformat.rxsize = CONT_CMD_REQUEST_STATUS_RX;
requestformat.cmd = cmd;
requestformat.typeh = CONT_CMD_NOP;
requestformat.typel = CONT_CMD_NOP;
requestformat.status = CONT_CMD_NOP;
requestformat.dummy1 = CONT_CMD_NOP;
for (i = 0; i < D_80014E01; i++)
{
*(__OSContRequesFormat *)ptr = requestformat;
ptr += sizeof(__OSContRequesFormat);
}
*ptr = CONT_CMD_END;
}
#pragma GLOBAL_ASM("asm/nonmatchings/dk64_boot/io/pfsisplug/__osPfsGetInitData.s")
void __osPfsGetInitData(u8 *pattern, OSContStatus *data)
{
u8 *ptr;
__OSContRequesFormat requestformat;
int i;
u8 bits;
bits = 0;
ptr = (u8 *)&D_800164F0;
for (i = 0; i < D_80014E01; i++, ptr += sizeof(__OSContRequesFormat))
{
requestformat = *(__OSContRequesFormat *)ptr;
data->errno = CHNL_ERR(requestformat);
if (data->errno == 0)
{
data->type = (requestformat.typel << 8) | (requestformat.typeh);
data->status = requestformat.status;
bits |= 1 << i;
}
data++;
}
*pattern = bits;
}

View File

@ -1,9 +1,25 @@
#include <ultra64.h>
#include "functions.h"
extern s32 D_80010200;
extern void *D_80016320;
extern OSMesgQueue D_80016328;
#pragma GLOBAL_ASM("asm/nonmatchings/dk64_boot/io/piacs/__osPiCreateAccessQueue.s")
void __osPiCreateAccessQueue(void) {
D_80010200 = TRUE;
osCreateMesgQueue(&D_80016328, &D_80016320, 1);
osSendMesg(&D_80016328, NULL, 0);
}
#pragma GLOBAL_ASM("asm/nonmatchings/dk64_boot/io/piacs/__osPiGetAccess.s")
void __osPiGetAccess(void) {
void *sp1C;
#pragma GLOBAL_ASM("asm/nonmatchings/dk64_boot/io/piacs/__osPiRelAccess.s")
if (!D_80010200) {
__osPiCreateAccessQueue();
}
osRecvMesg(&D_80016328, &sp1C, 1);
}
void __osPiRelAccess(void) {
osSendMesg(&D_80016328, NULL, 0);
}

View File

@ -1,8 +1,6 @@
#include <ultra64.h>
#include "functions.h"
extern OSDevMgr __osPiDevMgr;
OSMesgQueue *osPiGetCmdQueue(void) {

View File

@ -20,4 +20,4 @@ s32 __osSiRawStartDma(s32 direction, void *dramAddr)
osInvalDCache(dramAddr, 64);
return 0;
}
}

View File

@ -1,5 +1,6 @@
#include <os_internal.h>
#include "viint.h"
void osViBlack(u8 active)
{
register u32 saveMask = __osDisableInt();

View File

@ -3,7 +3,6 @@
void *osViGetNextFramebuffer(void)
{
register u32 saveMask;
void *framep;
saveMask = __osDisableInt();

View File

@ -6,7 +6,110 @@
OSDevMgr __osViDevMgr = {0};
u32 D_8000EF1C = 0;
#pragma GLOBAL_ASM("asm/nonmatchings/dk64_boot/io/vimgr/osCreateViManager.s")
#pragma GLOBAL_ASM("asm/nonmatchings/dk64_boot/io/vimgr/viMgrMain.s")
/*
OSDevMgr __osViDevMgr = {0};
static OSThread viThread;
static unsigned char viThreadStack[OS_VIM_STACKSIZE];
static OSMesgQueue viEventQueue;
static OSMesg viEventBuf[5];
static OSIoMesg viRetraceMsg;
static OSIoMesg viCounterMsg;
static void viMgrMain(void *arg);
void osCreateViManager(OSPri pri)
{
u32 savedMask;
OSPri oldPri;
OSPri myPri;
if (__osViDevMgr.active == 0)
{
__osTimerServicesInit();
osCreateMesgQueue(&viEventQueue, viEventBuf, 5);
viRetraceMsg.hdr.type = OS_MESG_TYPE_VRETRACE;
viRetraceMsg.hdr.pri = OS_MESG_PRI_NORMAL;
viRetraceMsg.hdr.retQueue = NULL;
viCounterMsg.hdr.type = OS_MESG_TYPE_COUNTER;
viCounterMsg.hdr.pri = OS_MESG_PRI_NORMAL;
viCounterMsg.hdr.retQueue = NULL;
osSetEventMesg(OS_EVENT_VI, &viEventQueue, &viRetraceMsg);
osSetEventMesg(OS_EVENT_COUNTER, &viEventQueue, &viCounterMsg);
oldPri = -1;
myPri = osGetThreadPri(NULL);
if (myPri < pri)
{
oldPri = myPri;
osSetThreadPri(NULL, pri);
}
savedMask = __osDisableInt();
__osViDevMgr.active = 1;
__osViDevMgr.thread = &viThread;
__osViDevMgr.cmdQueue = &viEventQueue;
__osViDevMgr.evtQueue = &viEventQueue;
__osViDevMgr.acsQueue = NULL;
__osViDevMgr.dma = NULL;
__osViDevMgr.edma = NULL;
osCreateThread(&viThread, 0, viMgrMain, &__osViDevMgr, &viThreadStack[OS_VIM_STACKSIZE], pri);
__osViInit();
osStartThread(&viThread);
__osRestoreInt(savedMask);
if (oldPri != -1)
{
osSetThreadPri(0, oldPri);
}
}
}
static void viMgrMain(void *arg)
{
__OSViContext *vc;
OSDevMgr *dm;
OSIoMesg *mb;
static u16 retrace;
s32 first;
u32 count;
mb = NULL;
first = 0;
vc = __osViGetCurrentContext();
retrace = vc->retraceCount;
if (retrace == 0)
retrace = 1;
dm = (OSDevMgr *)arg;
while (TRUE)
{
osRecvMesg(dm->evtQueue, (OSMesg)&mb, OS_MESG_BLOCK);
switch (mb->hdr.type)
{
case OS_MESG_TYPE_VRETRACE:
__osViSwapContext();
retrace--;
if (retrace == 0)
{
vc = __osViGetCurrentContext();
if (vc->msgq != NULL)
osSendMesg(vc->msgq, vc->msg, OS_MESG_NOBLOCK);
retrace = vc->retraceCount;
}
__osViIntrCount++;
if (first)
{
count = osGetCount();
__osCurrentTime = count;
first = 0;
}
count = __osBaseCounter;
__osBaseCounter = osGetCount();
count = __osBaseCounter - count;
__osCurrentTime = __osCurrentTime + count;
break;
case OS_MESG_TYPE_COUNTER:
__osTimerInterrupt();
break;
}
}
}
*/

View File

@ -1,4 +1,76 @@
#include <ultra64.h>
#include <rcp.h>
#include "viint.h"
#pragma GLOBAL_ASM("asm/nonmatchings/dk64_boot/io/viswapcontext/__osViSwapContext.s")
/*
// TODO: Very close, something small missing
void __osViSwapContext()
{
register OSViMode *vm;
register __OSViContext *vc;
u32 origin;
u32 hStart;
u32 nomValue;
u32 field;
field = 0;
vc = __osViNext;
vm = vc->modep;
field = IO_READ(VI_CURRENT_REG) & 1; //field num
origin = osVirtualToPhysical(vc->framep) + (vm->fldRegs[field].origin);
if (vc->state & VI_STATE_XSCALE_UPDATED)
{
vc->x.scale |= (vm->comRegs.xScale & ~VI_SCALE_MASK);
}
else
{
vc->x.scale = vm->comRegs.xScale;
}
if (vc->state & VI_STATE_YSCALE_UPDATED)
{
nomValue = vm->fldRegs[field].yScale & VI_SCALE_MASK;
vc->y.scale = vc->y.factor * nomValue;
vc->y.scale |= vm->fldRegs[field].yScale & ~VI_SCALE_MASK;
}
else
{
vc->y.scale = vm->fldRegs[field].yScale;
}
hStart = vm->comRegs.hStart;
if (vc->state & VI_STATE_BLACK)
{
hStart = 0;
}
if (vc->state & VI_STATE_REPEATLINE)
{
vc->y.scale = 0;
origin = osVirtualToPhysical(vc->framep);
}
if (vc->state & VI_STATE_FADE)
{
vc->y.scale = (vc->y.offset << VI_SUBPIXEL_SH) & (VI_2_10_FPART_MASK << VI_SUBPIXEL_SH);
origin = osVirtualToPhysical(vc->framep);
}
IO_WRITE(VI_ORIGIN_REG, origin);
IO_WRITE(VI_WIDTH_REG, vm->comRegs.width);
IO_WRITE(VI_BURST_REG, vm->comRegs.burst);
IO_WRITE(VI_V_SYNC_REG, vm->comRegs.vSync);
IO_WRITE(VI_H_SYNC_REG, vm->comRegs.hSync);
IO_WRITE(VI_LEAP_REG, vm->comRegs.leap);
IO_WRITE(VI_H_START_REG, hStart);
IO_WRITE(VI_V_START_REG, vm->fldRegs[field].vStart);
IO_WRITE(VI_V_BURST_REG, vm->fldRegs[field].vBurst);
IO_WRITE(VI_INTR_REG, vm->fldRegs[field].vIntr);
IO_WRITE(VI_X_SCALE_REG, vc->x.scale);
IO_WRITE(VI_Y_SCALE_REG, vc->y.scale);
IO_WRITE(VI_CONTROL_REG, vc->control);
__osViNext = __osViCurr;
__osViCurr = vc;
*__osViNext = *__osViCurr;
}
*/