Match 50 functions in Libultra (#636)

* Fix script disasm

* Stuff

* Work on libultra

* More Libultra Work

* My Libultra work for now

* Fix all OS warnings

* fix gitignore
This commit is contained in:
JoshDuMan 2022-01-31 06:40:55 -05:00 committed by GitHub
parent 96e85f4da1
commit e1766601f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
161 changed files with 1208 additions and 5092 deletions

View File

@ -21,7 +21,7 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_exception.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:07 $
@ -63,6 +63,7 @@ typedef u32 OSHWIntr;
/* Interrupt masks */
#define OS_IM_NONE 0x00000001
#define OS_IM_RCP 0x00000401 // MODIFIED HEADER FILE, MISSING DEFINE
#define OS_IM_SW1 0x00000501
#define OS_IM_SW2 0x00000601
#define OS_IM_CART 0x00000c01

View File

@ -18,6 +18,7 @@ extern void __osDequeueThread(OSThread **, OSThread *);
extern void __osEnqueueThread(OSThread **, OSThread *);
extern OSThread *__osPopThread(OSThread **);
extern void __osDispatchThread(void);
extern void __osCleanupThread(void);
extern void __osSetTimerIntr(OSTime);
extern OSTime __osInsertTimer(OSTimer *);
@ -36,6 +37,7 @@ extern OSTime __osCurrentTime;
extern u32 __osBaseCounter;
extern u32 __osViIntrCount;
extern u32 __osTimerCounter;
extern u32 __osShutdown;
extern __OSEventState __osEventStateTab[OS_NUM_EVENTS];

151
include/PR/piint.h Normal file
View File

@ -0,0 +1,151 @@
#ifndef _PIINT_H_
#define _PIINT_H_
#include "PR/os_internal.h"
#include "PR/rcp.h"
//https://github.com/LuigiBlood/64dd/wiki/Memory-Map
#define LEO_BASE_REG 0x05000000
#define LEO_CMD (LEO_BASE_REG + 0x508)
#define LEO_STATUS (LEO_BASE_REG + 0x508)
#define LEO_BM_CTL (LEO_BASE_REG + 0x510)
#define LEO_BM_STATUS (LEO_BASE_REG + 0x510)
#define LEO_SEQ_CTL (LEO_BASE_REG + 0x518)
#define LEO_SEQ_STATUS (LEO_BASE_REG + 0x518)
#define LEO_C2_BUFF (LEO_BASE_REG + 0x000) //C2 Sector Buffer
#define LEO_SECTOR_BUFF (LEO_BASE_REG + 0x400) //Data Sector Buffer
#define LEO_DATA (LEO_BASE_REG + 0x500) //Data
#define LEO_MISC_REG (LEO_BASE_REG + 0x504) //Misc Register
#define LEO_CUR_TK (LEO_BASE_REG + 0x50C) //Current Track
#define LEO_ERR_SECTOR (LEO_BASE_REG + 0x514) //Sector Error Status
#define LEO_CUR_SECTOR (LEO_BASE_REG + 0x51C) //Current Sector
#define LEO_HARD_RESET (LEO_BASE_REG + 0x520) //Hard Reset
#define LEO_C1_S0 (LEO_BASE_REG + 0x524) //C1
#define LEO_HOST_SECBYTE (LEO_BASE_REG + 0x528) //Sector Size (in bytes)
#define LEO_C1_S2 (LEO_BASE_REG + 0x52C) //C1
#define LEO_SEC_BYTE (LEO_BASE_REG + 0x530) //Sectors per Block, Full Size
#define LEO_C1_S4 (LEO_BASE_REG + 0x534) //C1
#define LEO_C1_S6 (LEO_BASE_REG + 0x538) //C1
#define LEO_CUR_ADDR (LEO_BASE_REG + 0x53C) //Current Address?
#define LEO_ID_REG (LEO_BASE_REG + 0x540) //ID
#define LEO_TEST_REG (LEO_BASE_REG + 0x544) //Test Read
#define LEO_TEST_PIN_SEL (LEO_BASE_REG + 0x548) //Test Write
#define LEO_RAM_ADDR (LEO_BASE_REG + 0x580) //Microsequencer RAM
#define LEO_STATUS_PRESENCE_MASK 0xFFFF
#define LEO_STATUS_DATA_REQUEST 0x40000000
#define LEO_STATUS_C2_TRANSFER 0x10000000
#define LEO_STATUS_BUFFER_MANAGER_ERROR 0x08000000
#define LEO_STATUS_BUFFER_MANAGER_INTERRUPT 0x04000000
#define LEO_STATUS_MECHANIC_INTERRUPT 0x02000000
#define LEO_STATUS_DISK_PRESENT 0x01000000
#define LEO_STATUS_BUSY_STATE 0x00800000
#define LEO_STATUS_RESET_STATE 0x00400000
#define LEO_STATUS_MOTOR_NOT_SPINNING 0x00100000
#define LEO_STATUS_HEAD_RETRACTED 0x00080000
#define LEO_STATUS_WRITE_PROTECT_ERROR 0x00040000
#define LEO_STATUS_MECHANIC_ERROR 0x00020000
#define LEO_STATUS_DISK_CHANGE 0x00010000
#define LEO_STATUS_MODE_MASK (LEO_STATUS_MOTOR_NOT_SPINNING | LEO_STATUS_HEAD_RETRACTED)
#define LEO_STATUS_MODE_SLEEP (LEO_STATUS_MOTOR_NOT_SPINNING | LEO_STATUS_HEAD_RETRACTED)
#define LEO_STATUS_MODE_STANDBY (LEO_STATUS_HEAD_RETRACTED)
#define LEO_STATUS_MODE_ACTIVE 0
#define LEO_CUR_TK_INDEX_LOCK 0x60000000
#define LEO_BM_STATUS_RUNNING 0x80000000 //Running
#define LEO_BM_STATUS_ERROR 0x04000000 //Error
#define LEO_BM_STATUS_MICRO 0x02000000 //Micro Status?
#define LEO_BM_STATUS_BLOCK 0x01000000 //Block Transfer
#define LEO_BM_STATUS_C1CORRECTION 0x00800000 //C1 Correction
#define LEO_BM_STATUS_C1DOUBLE 0x00400000 //C1 Double
#define LEO_BM_STATUS_C1SINGLE 0x00200000 //C1 Single
#define LEO_BM_STATUS_C1ERROR 0x00010000 //C1 Error
#define LEO_BM_CTL_START 0x80000000 //Start Buffer Manager
#define LEO_BM_CTL_MODE 0x40000000 //Buffer Manager Mode
#define LEO_BM_CTL_IMASK 0x20000000 //BM Interrupt Mask
#define LEO_BM_CTL_RESET 0x10000000 //Buffer Manager Reset
#define LEO_BM_CTL_DISABLE_OR 0x08000000 //Disable OR Check?
#define LEO_BM_CTL_DISABLE_C1 0x04000000 //Disable C1 Correction
#define LEO_BM_CTL_BLOCK 0x02000000 //Block Transfer
#define LEO_BM_CTL_CLR_MECHANIC_INTR 0x01000000 //Mechanic Interrupt Reset
#define LEO_BM_CTL_CONTROL_MASK 0xFF000000
#define LEO_BM_CTL_SECTOR_MASK 0x00FF0000
#define LEO_BM_CTL_SECTOR_SHIFT 16
#define LEO_CMD_TYPE_0 0 //TODO: name
#define LEO_CMD_TYPE_1 1 //TODO: name
#define LEO_CMD_TYPE_2 2 //TODO: name
#define LEO_ERROR_GOOD 0
#define LEO_ERROR_4 4 //maybe busy?
#define LEO_ERROR_22 22 //
#define LEO_ERROR_23 23 //unrecovered read error?
#define LEO_ERROR_24 24 //no reference position found?
#define LEO_ERROR_29 29 //
extern OSDevMgr __osPiDevMgr;
extern OSPiHandle *__osCurrentHandle[2];
extern OSPiHandle CartRomHandle;
extern OSPiHandle LeoDiskHandle;
extern OSMesgQueue __osPiAccessQueue;
extern u32 __osPiAccessQueueEnabled;
int __osPiDeviceBusy(void);
void __osDevMgrMain(void *);
void __osPiCreateAccessQueue(void);
void __osPiRelAccess(void);
void __osPiGetAccess(void);
s32 __osEPiRawWriteIo(OSPiHandle *, u32 , u32);
s32 __osEPiRawReadIo(OSPiHandle *, u32 , u32 *);
s32 __osEPiRawStartDma(OSPiHandle *, s32 , u32 , void *, u32 );
OSMesgQueue *osPiGetCmdQueue(void);
#define WAIT_ON_IOBUSY(stat) \
while (stat = IO_READ(PI_STATUS_REG), stat & (PI_STATUS_IO_BUSY | PI_STATUS_DMA_BUSY)) \
; \
(void)0
#define UPDATE_REG(pihandle, reg, var) \
if (cHandle->var != pihandle->var) \
IO_WRITE(reg, pihandle->var)
#define EPI_SYNC(pihandle, stat, domain) \
\
WAIT_ON_IOBUSY(stat); \
\
domain = pihandle->domain; \
if (__osCurrentHandle[domain]->type != pihandle->type) \
{ \
OSPiHandle *cHandle = __osCurrentHandle[domain]; \
if (domain == PI_DOMAIN1) \
{ \
UPDATE_REG(pihandle, PI_BSD_DOM1_LAT_REG, latency); \
UPDATE_REG(pihandle, PI_BSD_DOM1_PGS_REG, pageSize); \
UPDATE_REG(pihandle, PI_BSD_DOM1_RLS_REG, relDuration); \
UPDATE_REG(pihandle, PI_BSD_DOM1_PWD_REG, pulse); \
} \
else \
{ \
UPDATE_REG(pihandle, PI_BSD_DOM2_LAT_REG, latency); \
UPDATE_REG(pihandle, PI_BSD_DOM2_PGS_REG, pageSize); \
UPDATE_REG(pihandle, PI_BSD_DOM2_RLS_REG, relDuration); \
UPDATE_REG(pihandle, PI_BSD_DOM2_PWD_REG, pulse); \
} \
cHandle->type = pihandle->type; \
cHandle->latency = pihandle->latency; \
cHandle->pageSize = pihandle->pageSize; \
cHandle->relDuration = pihandle->relDuration; \
cHandle->pulse = pihandle->pulse; \
}(void)0
#endif

70
include/PR/viint.h Normal file
View File

@ -0,0 +1,70 @@
#ifndef _VIINT_H
#define _VIINT_H
#include "PR/os_internal.h"
#define OS_TV_TYPE_PAL 0
#define OS_TV_TYPE_NTSC 1
#define OS_TV_TYPE_MPAL 2
#define VI_STATE_MODE_UPDATED 0x01
#define VI_STATE_XSCALE_UPDATED 0x02
#define VI_STATE_YSCALE_UPDATED 0x04
#define VI_STATE_CTRL_UPDATED 0x08 // related to control regs changing
#define VI_STATE_BUFFER_UPDATED 0x10 // swap buffer
#define VI_STATE_BLACK 0x20 // probably related to a black screen
#define VI_STATE_REPEATLINE 0x40 // repeat line?
#define VI_STATE_FADE 0x80 // fade
#define VI_CTRL_ANTIALIAS_MODE_3 0x00300 /* Bit [9:8] anti-alias mode */
#define VI_CTRL_ANTIALIAS_MODE_2 0x00200 /* Bit [9:8] anti-alias mode */
#define VI_CTRL_ANTIALIAS_MODE_1 0x00100 /* Bit [9:8] anti-alias mode */
#define VI_SCALE_MASK 0xfff //see rcp scale_x/scale_y
#define VI_2_10_FPART_MASK 0x3ff
#define VI_SUBPIXEL_SH 0x10
#define BURST(hsync_width, color_width, vsync_width, color_start) \
(hsync_width | (color_width << 8) | (vsync_width << 16) | (color_start << 20))
#define WIDTH(v) v
#define VSYNC(v) v
#define HSYNC(duration, leap) (duration | (leap << 16))
#define LEAP(upper, lower) ((upper << 16) | lower)
#define START(start, end) ((start << 16) | end)
#define FTOFIX(val, i, f) ((u32)(val * (f32)(1 << f)) & ((1 << (i + f)) - 1))
#define F210(val) FTOFIX(val, 2, 10)
#define SCALE(scaleup, off) (F210((1.0f / (f32)scaleup)) | (F210((f32)off) << 16))
#define VCURRENT(v) v //seemingly unused
#define ORIGIN(v) v
#define VINTR(v) v
#define HSTART START
typedef struct
{
/* 0x0 */ f32 factor;
/* 0x4 */ u16 offset;
/* 0x8 */ u32 scale;
} __OSViScale;
typedef struct
{
/* 0x0 */ u16 state;
/* 0x2 */ u16 retraceCount;
/* 0x4 */ void *framep;
/* 0x8 */ OSViMode *modep;
/* 0xC */ u32 control;
/* 0x10 */ OSMesgQueue *msgq;
/* 0x14 */ OSMesg msg;
/* 0x18 */ __OSViScale x;
/* 0x24 */ __OSViScale y;
} __OSViContext; // 0x30 bytes
void __osViSwapContext(void);
extern __OSViContext *__osViCurr;
extern __OSViContext *__osViNext;
extern u32 __additional_scanline;
__OSViContext *__osViGetCurrentContext(void);
void __osViInit(void);
#endif

View File

@ -17,9 +17,6 @@ void nuBoot(void);
void boot_idle(void);
void boot_main(void);
void osCleanupThread(void);
OSThread* osGetActiveQueue(void);
f32 signF(f32 val);
void* heap_malloc(s32 size);

View File

@ -14,10 +14,10 @@ extern EvtScript N(handleEvent_80219500);
s32 N(defenseTable_80218E10)[] = {
ELEMENT_NORMAL, 0,
ELEMENT_WATER, 4294967294,
ELEMENT_ICE, 4294967294,
ELEMENT_WATER, -2,
ELEMENT_ICE, -2,
ELEMENT_FIRE, 99,
ELEMENT_BLAST, 4294967295,
ELEMENT_BLAST, -1,
ELEMENT_END,
};

View File

@ -14,14 +14,14 @@ BSS s32 D_8009A5B8;
BSS char D_8009A5BC[0x4];
BSS s32 D_8009A5C0;
BSS char D_8009A5C4[0x4];
BSS s32 D_8009A5C8;
BSS s32 __osBaseCounter;
BSS s32 D_8009A5CC;
BSS s32 D_8009A5D0;
BSS s32 D_8009A5D4;
BSS s32 timeFreezeMode;
BSS s32 nuGfxZBuffer;
BSS u32 nuContDataLockKey;
BSS s32 D_8009A5E4;
BSS s32 __osViIntrCount;
BSS s32 D_8009A5E8;
BSS float D_8009A5EC;
BSS u32 nuGfxCfbCounter;
@ -31,7 +31,7 @@ BSS s32 D_8009A5FC;
BSS s32 gGameState;
BSS s16 gNpcCount;
BSS s16 D_8009A606;
BSS s32 D_8009A608;
BSS s32 __osCurrentTime;
BSS s32 D_8009A60C;
BSS s32 nuGfxUcode;
BSS u32 nuContNum;
@ -40,7 +40,7 @@ BSS u8 D_8009A61C;
BSS s32 D_8009A620;
BSS char D_8009A624[0x4];
BSS s32 D_8009A628;
BSS s32 D_8009A62C;
BSS s32 __osTimerCounter;
BSS s32 D_8009A630;
BSS s16 gCurrentCamID;
BSS s32 nuPiCartHandle;
@ -249,7 +249,7 @@ BSS s32 D_800AF8F0;
BSS char D_800AF8F4[0x4];
BSS s32 D_800AF8F8;
BSS s32 D_800AF8FC;
BSS s32 D_800AF900;
BSS s32 siAccessBuf;
BSS char D_800AF904[0xC];
BSS s32 D_800AF910;
BSS char D_800AF914[0x4];
@ -347,7 +347,7 @@ BSS s8 D_800D9668[0x18];
BSS s8 D_800D9680[0x100];
BSS s8 rspbootUcodeBuffer[0x100];
BSS s8 D_800D9880[0x700];
BSS s8 D_800D9F80[0x80];
BSS s8 __osEventStateTab[0x80];
BSS s8 D_800DA000[0x3C];
BSS s32 D_800DA03C;
BSS s8 D_800DA040[0x400];
@ -363,7 +363,7 @@ BSS s8 D_800DAAC0[0x18];
BSS s8 nuContPfs[0x1A0];
BSS s8 nuSiMesgQ[0x18];
BSS s8 D_800DAC90[0x18];
BSS s8 D_800DACA8[0x18];
BSS s8 __osSiAccessQueue[0x18];
BSS s8 gCurrentSaveFile[0x1380];
BSS s8 nuContDataMutexQ[0x20];
BSS s32 D_800DC060;

View File

@ -275,7 +275,7 @@ void crash_screen_draw(OSThread* faultedThread) {
}
OSThread* crash_screen_get_faulted_thread(void) {
OSThread* thread = osGetActiveQueue();
OSThread* thread = __osGetActiveQueue();
while (thread->priority != -1) {
if (thread->priority > 0 && thread->priority < 0x7F && (thread->flags & 3)) {

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "os/3c490_len_3c0", osDevMgrMain);

View File

@ -1,5 +0,0 @@
#include "common.h"
u8 hdwrBugFlag = 0; // Local Static to osAiSetNextBuffer.
INCLUDE_ASM(s32, "os/3ca80_len_a0", osAiSetNextBuffer, void* buf, u32 unk);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/41420_len_120", osStartThread, OSThread* thread);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/41540_len_c0", osStopThread, OSThread* thread);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "os/41600_len_40", osDequeueThread);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/41640_len_50", osYieldThread, void);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "os/41690_len_10", osGetActiveQueue);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(OSTime, "os/416a0_len_90", osGetTime, void);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/41730_len_20", osSetTime, OSTime time);

View File

@ -1,4 +0,0 @@
#include "common.h"
INCLUDE_ASM(int, "os/41750_len_450", osSetTimer, OSTimer* timer, OSTime start, OSTime end, OSMesgQueue* queue,
OSMesg mesg);

View File

@ -1,9 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "os/41880", osTimerServicesInit);
INCLUDE_ASM(s32, "os/41880", osTimerInterrupt);
INCLUDE_ASM(s32, "os/41880", osSetTimerIntr);
INCLUDE_ASM(s32, "os/41880", osInsertTimer);

View File

@ -1,4 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/41ba0_len_c0", osMapTLB, s32 unk, OSPageMask pageMask, void* buf, u32 unk1, u32 unk2,
s32 unk3);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "os/41c60_len_c0", __osProbeTLB);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/41d20_len_40", osUnmapTLB, s32 unk);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/41d60_len_50", osUnmapTLBAll, void);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void*, "os/41db0_len_40", osViGetCurrentFramebuffer, void);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void*, "os/41df0_len_40", osViGetNextFramebuffer, void);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(u32, "os/41e30_len_40", osViGetCurrentMode, void);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/421b0_len_60", osViSetEvent, OSMesgQueue* queue, OSMesg mesg, u32 unk);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/42210_len_50", osViSetMode, OSViMode* mode);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/42260_len_170", osViSetSpecialFeatures, u32 feat);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/423d0_len_50", osViSetYScale, f32 scale);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/42420_len_50", osViSwapBuffer, void* buf);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "os/42470_len_310", osViSwapContext);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/42780_len_120", osViBlack, u8 unk);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/42900_len_80", guMtxF2L, float mf[4][4], Mtx* m);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/42980_len_80", guMtxL2F, float mf[4][4], Mtx* m);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/42a00_len_100", guMtxCatF, float m[4][4], float n[4][4], float r[4][4]);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/42b00_len_c0", guScale, Mtx* m, float x, float y, float z);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/42bc0_len_60", guScaleF, float mf[4][4], float x, float y, float z);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/42c20_len_e0", guTranslate, Mtx* m, float x, float y, float z);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/42d00_len_60", guTranslateF, float mf[4][4], float x, float y, float z);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "os/42d60_len_80", guMtxCat);

View File

@ -1,4 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/42de0_len_90", guMtxXFML, Mtx* m, float x, float y, float z, float* ox, float* oy,
float* oz);

View File

@ -1,4 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/42e70_len_390", guMtxXFMF, float mf[4][4], float x, float y, float z, float* ox, float* oy,
float* oz);

View File

@ -1,5 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "os/467f0_len_90", osSetGlobalIntMask);
INCLUDE_ASM(s32, "os/467f0_len_90", osResetGlobalIntMask);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(s32, "os/47a70_len_10", osGetSR);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/47e30_len_60", osMapTLBRdb, void);

27
src/os/aisetnextbuf.c Normal file
View File

@ -0,0 +1,27 @@
#include "PR/osint.h"
#include "PR/rcp.h"
s32 osAiSetNextBuffer(void *bufPtr, u32 size) {
static u8 hdwrBugFlag = FALSE;
char *bptr;
if (__osAiDeviceBusy()) {
return -1;
}
bptr = bufPtr;
if (hdwrBugFlag) {
bptr -= 0x2000;
}
if ((((u32)bufPtr + size) & 0x1fff) == 0) {
hdwrBugFlag = TRUE;
} else {
hdwrBugFlag = FALSE;
}
IO_WRITE(AI_DRAM_ADDR_REG, osVirtualToPhysical(bptr));
IO_WRITE(AI_LEN_REG, size);
return 0;
}

26
src/os/createthread.c Normal file
View File

@ -0,0 +1,26 @@
#include "PR/R4300.h"
#include "PR/osint.h"
void osCreateThread(OSThread *t, OSId id, void (*entry)(void *), void *arg, void *sp, OSPri p) {
register u32 saveMask;
OSIntMask mask;
t->id = id;
t->priority = p;
t->next = NULL;
t->queue = NULL;
t->context.pc = (u32)entry;
t->context.a0 = (s64)(s32)arg; // Double cast gets rid of compiler warning
t->context.sp = (s64)(s32)sp - 16;
t->context.ra = (u64)__osCleanupThread;
mask = OS_IM_ALL;
t->context.sr = SR_IMASK | SR_EXL | SR_IE;
t->context.rcp = (mask & RCP_IMASK) >> RCP_IMASKSHIFT;
t->context.fpcsr = (u32)(FPCSR_FS | FPCSR_EV);
t->fp = 0;
t->state = OS_STATE_STOPPED;
t->flags = 0;
saveMask = __osDisableInt();
t->tlnext = __osActiveQueue;
__osActiveQueue = t;
__osRestoreInt(saveMask);
}

108
src/os/devmgr.c Normal file
View File

@ -0,0 +1,108 @@
#include "PR/rcp.h"
#include "PR/piint.h"
void __osDevMgrMain(void *args) {
OSIoMesg *mb = NULL;
OSMesg em;
OSMesg dummy;
s32 ret = 0;
OSDevMgr *dm = (OSDevMgr *)args;
s32 messageSend = 0;
while (TRUE)
{
osRecvMesg(dm->cmdQueue, (OSMesg)&mb, OS_MESG_BLOCK);
if (mb->piHandle != NULL &&
mb->piHandle->type == DEVICE_TYPE_64DD &&
(mb->piHandle->transferInfo.cmdType == LEO_CMD_TYPE_0 ||
mb->piHandle->transferInfo.cmdType == LEO_CMD_TYPE_1))
{
__OSBlockInfo *blockInfo;
__OSTranxInfo *info;
info = &mb->piHandle->transferInfo;
blockInfo = &info->block[info->blockNum];
info->sectorNum = -1;
if (info->transferMode != LEO_SECTOR_MODE) {
blockInfo->dramAddr = (void *)((u32)blockInfo->dramAddr - blockInfo->sectorSize);
}
if (info->transferMode == LEO_TRACK_MODE && mb->piHandle->transferInfo.cmdType == LEO_CMD_TYPE_0) {
messageSend = 1;
} else {
messageSend = 0;
}
osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK);
__osResetGlobalIntMask(OS_IM_PI);
__osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, (info->bmCtlShadow | 0x80000000));
doMessageSend:
osRecvMesg(dm->evtQueue, &em, OS_MESG_BLOCK);
info = &mb->piHandle->transferInfo;
blockInfo = &info->block[info->blockNum];
if (blockInfo->errStatus == LEO_ERROR_29) {
u32 stat;
__osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, info->bmCtlShadow | LEO_BM_CTL_RESET);
__osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, info->bmCtlShadow);
__osEPiRawReadIo(mb->piHandle, LEO_STATUS, &stat);
if (stat & LEO_STATUS_MECHANIC_INTERRUPT) {
__osEPiRawWriteIo(mb->piHandle, LEO_BM_CTL, info->bmCtlShadow | LEO_BM_CTL_CLR_MECHANIC_INTR);
}
blockInfo->errStatus = LEO_ERROR_4;
IO_WRITE(PI_STATUS_REG, PI_CLR_INTR);
__osSetGlobalIntMask(OS_IM_PI | SR_IBIT4);
}
osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK);
if (messageSend == 1 && mb->piHandle->transferInfo.block[0].errStatus == LEO_ERROR_GOOD) {
messageSend = 0;
goto doMessageSend;
}
osSendMesg(dm->acsQueue, NULL, OS_MESG_NOBLOCK);
if (mb->piHandle->transferInfo.blockNum == 1) {
osYieldThread();
}
} else {
switch (mb->hdr.type) {
case OS_MESG_TYPE_DMAREAD:
osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK);
ret = dm->dma(OS_READ, mb->devAddr, mb->dramAddr, mb->size);
break;
case OS_MESG_TYPE_DMAWRITE:
osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK);
ret = dm->dma(OS_WRITE, mb->devAddr, mb->dramAddr, mb->size);
break;
case OS_MESG_TYPE_EDMAREAD:
osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK);
ret = dm->edma(mb->piHandle, OS_READ, mb->devAddr, mb->dramAddr,
mb->size);
break;
case OS_MESG_TYPE_EDMAWRITE:
osRecvMesg(dm->acsQueue, &dummy, OS_MESG_BLOCK);
ret = dm->edma(mb->piHandle, OS_WRITE, mb->devAddr, mb->dramAddr,
mb->size);
break;
case OS_MESG_TYPE_LOOPBACK:
osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK);
ret = -1;
break;
default:
ret = -1;
break;
}
if (ret == 0) {
osRecvMesg(dm->evtQueue, &em, OS_MESG_BLOCK);
osSendMesg(mb->hdr.retQueue, mb, OS_MESG_NOBLOCK);
osSendMesg(dm->acsQueue, NULL, OS_MESG_NOBLOCK);
}
}
}
}

5
src/os/getactivequeue.c Normal file
View File

@ -0,0 +1,5 @@
#include "PR/osint.h"
OSThread *__osGetActiveQueue(void) {
return __osActiveQueue;
}

15
src/os/gettime.c Normal file
View File

@ -0,0 +1,15 @@
#include "PR/osint.h"
OSTime osGetTime() {
u32 tmptime;
u32 elapseCount;
OSTime currentCount;
register u32 saveMask;
saveMask = __osDisableInt();
tmptime = osGetCount();
elapseCount = tmptime - __osBaseCounter;
currentCount = __osCurrentTime;
__osRestoreInt(saveMask);
return currentCount + elapseCount;
}

12
src/os/guMtxCat.c Normal file
View File

@ -0,0 +1,12 @@
#include "common.h"
void guMtxCatL(Mtx *m, Mtx *n, Mtx *res) {
float mf[4][4], nf[4][4], resf[4][4];
guMtxL2F(mf, m);
guMtxL2F(nf, n);
guMtxCatF(mf, nf, resf);
guMtxF2L(resf, res);
}

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/guMtxIdent", guMtxIdent, Mtx* m);

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/guMtxIdentF", guMtxIdentF, float mf[4][4]);

7
src/os/guMtxXFMF.c Normal file
View File

@ -0,0 +1,7 @@
#include "common.h"
void guMtxXFMF(f32 mf[4][4], f32 x, f32 y, f32 z, f32 *ox, f32 *oy, f32 *oz) {
*ox = mf[0][0]*x + mf[1][0]*y + mf[2][0]*z + mf[3][0];
*oy = mf[0][1]*x + mf[1][1]*y + mf[2][1]*z + mf[3][1];
*oz = mf[0][2]*x + mf[1][2]*y + mf[2][2]*z + mf[3][2];
}

10
src/os/guMtxXFML.c Normal file
View File

@ -0,0 +1,10 @@
#include "common.h"
void guMtxXFML(Mtx *m, float x, float y, float z, float *ox, float *oy, float *oz)
{
float mf[4][4];
guMtxL2F(mf, m);
guMtxXFMF(mf, x, y, z, ox, oy, oz);
}

View File

@ -1,5 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/osCreateThread", osCreateThread, OSThread* thread, OSId id, void (*entrypoint)(void*),
void* unk1,
void* unk2, OSPri pri);

View File

@ -1,4 +1,4 @@
#include "common.h"
#include "PR/os_internal.h"
s32 osEPiLinkHandle(OSPiHandle* EPiHandle) {
u32 saveMask = __osDisableInt();

View File

@ -1,10 +1,10 @@
#include "common.h"
#include "PR/piint.h"
s32 osEPiReadIo(OSPiHandle* pihandle, u32 devAddr, u32* data) {
s32 ret;
osPiGetAccess();
ret = osEPiRawReadIo(pihandle, devAddr, data);
osPiRelAccess();
__osPiGetAccess();
ret = __osEPiRawReadIo(pihandle, devAddr, data);
__osPiRelAccess();
return ret;
}

View File

@ -1,4 +1,4 @@
#include "common.h"
#include "PR/piint.h"
s32 osEPiStartDma(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
if (!__osPiDevMgr.active) {

View File

@ -1,11 +1,11 @@
#include "common.h"
#include "PR/piint.h"
s32 osEPiWriteIo(OSPiHandle* handle, u32 devAddr, u32 data) {
register s32 ret;
osPiGetAccess();
ret = osEPiRawWriteIo(handle, devAddr, data);
osPiRelAccess();
__osPiGetAccess();
ret = __osEPiRawWriteIo(handle, devAddr, data);
__osPiRelAccess();
return ret;
}

View File

@ -1,3 +1,9 @@
#include "common.h"
#include "PR/osint.h"
INCLUDE_ASM(OSPri, "os/osGetThreadPri", osGetThreadPri, OSThread* thread);
OSPri osGetThreadPri(OSThread *thread) {
if (thread == NULL) {
thread = __osRunningThread;
}
return thread->priority;
}

View File

@ -19,8 +19,8 @@ void osSetThreadPri(OSThread* thread, OSPri pri) {
if (thread->priority != pri) {
thread->priority = pri;
if (thread != __osRunningThread && thread->state != 1) {
osDequeueThread(thread->queue, thread);
osEnqueueThread(thread->queue, thread);
__osDequeueThread(thread->queue, thread);
__osEnqueueThread(thread->queue, thread);
}
if (__osRunningThread->priority < __osRunQueue->priority) {
__osRunningThread->state = 2;

View File

@ -1,9 +1,7 @@
#include "common.h"
#include "PR/rcp.h"
s32 osSiDeviceBusy(void) {
// in oot, status is HW_REG(SI_STATUS_REG, u32);
// however, this macro doesn't exist in our libultra version apparently
u32 status = *(volatile u32*)(SI_STATUS_REG | 0xA0000000);
register u32 status = IO_READ(SI_STATUS_REG);
if (status & (SI_STATUS_DMA_BUSY | SI_STATUS_RD_BUSY)) {
return TRUE;

View File

@ -1,3 +0,0 @@
#include "common.h"
INCLUDE_ASM(void, "os/osViRepeatLine", osViRepeatLine, u8 unk);

View File

@ -1,4 +1,5 @@
#include "common.h"
#include "PR/osint.h"
#include "PR/R4300.h"
u32 osVirtualToPhysical(void *addr) {
if (IS_KSEG0(addr)) {

View File

@ -0,0 +1,9 @@
#include "PR/os_internal.h"
void __osResetGlobalIntMask(OSHWIntr mask) {
register u32 saveMask = __osDisableInt();
__OSGlobalIntMask &= ~(mask & ~OS_IM_RCP);
__osRestoreInt(saveMask);
}

View File

@ -1,8 +1,6 @@
#include "common.h"
#include <PR/osint.h>
u32 __osPreNMI = 0;
s32 osSendMesg(OSMesgQueue *mq, OSMesg msg, s32 flags)
{
register u32 saveMask;

View File

@ -1,4 +1,21 @@
#include "common.h"
#include <PR/osint.h>
INCLUDE_ASM(void, "os/seteventmesg", osSetEventMesg, OSEvent event, OSMesgQueue* queue, OSMesg mesg);
u32 __osPreNMI = 0;
void osSetEventMesg(OSEvent event, OSMesgQueue *mq, OSMesg msg) {
register u32 saveMask = __osDisableInt();
__OSEventState *es = &__osEventStateTab[event];
es->messageQueue = mq;
es->message = msg;
if (event == OS_EVENT_PRENMI) {
if (__osShutdown && !__osPreNMI) {
osSendMesg(mq, msg, OS_MESG_NOBLOCK);
}
__osPreNMI = TRUE;
}
__osRestoreInt(saveMask);
}

View File

@ -0,0 +1,9 @@
#include "PR/os_internal.h"
void __osSetGlobalIntMask(OSHWIntr mask) {
register u32 saveMask = __osDisableInt();
__OSGlobalIntMask |= mask;
__osRestoreInt(saveMask);
}

5
src/os/settime.c Normal file
View File

@ -0,0 +1,5 @@
#include "PR/osint.h"
void osSetTime(OSTime time) {
__osCurrentTime = time;
}

40
src/os/settimer.c Normal file
View File

@ -0,0 +1,40 @@
#include "PR/osint.h"
int osSetTimer(OSTimer *t, OSTime countdown, OSTime interval, OSMesgQueue *mq, OSMesg msg) {
register u32 saveMask;
OSTime time;
OSTimer* next;
u32 count;
u32 value;
t->next = NULL;
t->prev = NULL;
t->value = countdown;
t->interval = interval;
if (countdown == 0) {
t->value = interval;
}
t->mq = mq;
t->msg = msg;
saveMask = __osDisableInt();
if (__osTimerList->next != __osTimerList) {
next = __osTimerList->next;
count = osGetCount();
value = count - __osTimerCounter;
if (value < next->value) {
next->value -= value;
} else {
next->value = 1;
}
}
time = __osInsertTimer(t);
__osSetTimerIntr(__osTimerList->next->value);
__osRestoreInt(saveMask);
return 0;
}

34
src/os/startthread.c Normal file
View File

@ -0,0 +1,34 @@
#include "PR/osint.h"
void osStartThread(OSThread *t) {
register u32 saveMask = __osDisableInt();
switch (t->state) {
case OS_STATE_WAITING:
t->state = OS_STATE_RUNNABLE;
__osEnqueueThread(&__osRunQueue, t);
break;
case OS_STATE_STOPPED:
if (t->queue == NULL || t->queue == &__osRunQueue)
{
t->state = OS_STATE_RUNNABLE;
__osEnqueueThread(&__osRunQueue, t);
}
else
{
t->state = OS_STATE_WAITING;
__osEnqueueThread(t->queue, t);
__osEnqueueThread(&__osRunQueue, __osPopThread(t->queue));
}
break;
}
if (__osRunningThread == NULL) {
__osDispatchThread();
} else if (__osRunningThread->priority < __osRunQueue->priority) {
__osRunningThread->state = OS_STATE_RUNNABLE;
__osEnqueueAndYield(&__osRunQueue);
}
__osRestoreInt(saveMask);
}

24
src/os/stopthread.c Normal file
View File

@ -0,0 +1,24 @@
#include "PR/osint.h"
void osStopThread(OSThread *t) {
register u32 saveMask = __osDisableInt();
register u16 state = OS_STATE_RUNNING;
if (t != NULL) {
state = t->state;
}
switch (state) {
case OS_STATE_RUNNING:
__osRunningThread->state = OS_STATE_STOPPED;
__osEnqueueAndYield(NULL);
break;
case OS_STATE_RUNNABLE:
case OS_STATE_WAITING:
t->state = OS_STATE_STOPPED;
__osDequeueThread(t->queue, t);
break;
}
__osRestoreInt(saveMask);
}

18
src/os/thread.c Normal file
View File

@ -0,0 +1,18 @@
#include "PR/osint.h"
void __osDequeueThread(OSThread **queue, OSThread *t) {
register OSThread *pred;
register OSThread *succ;
pred = (OSThread *) queue;
succ = pred->next;
while (succ != NULL) {
if (succ == t) {
pred->next = t->next;
return;
}
pred = succ;
succ = pred->next;
}
}

98
src/os/timerintr.c Normal file
View File

@ -0,0 +1,98 @@
#include "PR/osint.h"
void __osTimerServicesInit(void) {
__osCurrentTime = 0;
__osBaseCounter = 0;
__osViIntrCount = 0;
__osTimerList->prev = __osTimerList;
__osTimerList->next = __osTimerList->prev;
__osTimerList->value = 0;
__osTimerList->interval = __osTimerList->value;
__osTimerList->mq = NULL;
__osTimerList->msg = 0;
}
void __osTimerInterrupt(void) {
OSTimer *t;
u32 count;
u32 elapsed_cycles;
if (__osTimerList->next != __osTimerList) {
while (TRUE) {
t = __osTimerList->next;
if (t == __osTimerList) {
__osSetCompare(0);
__osTimerCounter = 0;
break;
}
count = osGetCount();
elapsed_cycles = count - __osTimerCounter;
__osTimerCounter = count;
if (elapsed_cycles < t->value)
{
t->value -= elapsed_cycles;
__osSetTimerIntr(t->value);
break;
} else {
t->prev->next = t->next;
t->next->prev = t->prev;
t->next = NULL;
t->prev = NULL;
if (t->mq != NULL) {
osSendMesg(t->mq, t->msg, OS_MESG_NOBLOCK);
}
if (t->interval != 0) {
t->value = t->interval;
__osInsertTimer(t);
}
}
}
}
}
void __osSetTimerIntr(OSTime tim) {
OSTime NewTime;
u32 savedMask;
if (tim < 468) {
tim = 468;
}
savedMask = __osDisableInt();
__osTimerCounter = osGetCount();
NewTime = __osTimerCounter + tim;
__osSetCompare(NewTime);
__osRestoreInt(savedMask);
}
OSTime __osInsertTimer(OSTimer *t) {
OSTimer *timep;
OSTime tim;
u32 savedMask;
savedMask = __osDisableInt();
timep = __osTimerList->next;
tim = t->value;
while (timep != __osTimerList && tim > timep->value) {
tim -= timep->value;
timep = timep->next;
}
t->value = tim;
if (timep != __osTimerList) {
timep->value -= tim;
}
t->next = timep;
t->prev = timep->prev;
timep->prev->next = t;
timep->prev = t;
__osRestoreInt(savedMask);
return tim;
}

13
src/os/viblack.c Normal file
View File

@ -0,0 +1,13 @@
#include "PR/viint.h"
void osViBlack(u8 active) {
register u32 saveMask = __osDisableInt();
if (active) {
__osViNext->state |= VI_STATE_BLACK;
} else {
__osViNext->state &= ~VI_STATE_BLACK;
}
__osRestoreInt(saveMask);
}

View File

@ -0,0 +1,9 @@
#include "PR/viint.h"
void *osViGetCurrentFramebuffer(void) {
register u32 saveMask = __osDisableInt();
void *framep = __osViCurr->framep;
__osRestoreInt(saveMask);
return framep;
}

9
src/os/vigetmode.c Normal file
View File

@ -0,0 +1,9 @@
#include "PR/viint.h"
u32 osViGetCurrentMode(void) {
register u32 savedMask = __osDisableInt();
register u32 modeType = __osViCurr->modep->type;
__osRestoreInt(savedMask);
return modeType;
}

View File

@ -0,0 +1,9 @@
#include "PR/viint.h"
void *osViGetNextFramebuffer(void) {
register u32 saveMask = __osDisableInt();
void *framep = __osViNext->framep;
__osRestoreInt(saveMask);
return framep;
}

13
src/os/virepeatline.c Normal file
View File

@ -0,0 +1,13 @@
#include "PR/viint.h"
void osViRepeatLine(u8 active) {
register u32 saveMask = __osDisableInt();
if (active) {
__osViNext->state |= VI_STATE_REPEATLINE;
} else {
__osViNext->state &= ~VI_STATE_REPEATLINE;
}
__osRestoreInt(saveMask);
}

10
src/os/visetevent.c Normal file
View File

@ -0,0 +1,10 @@
#include "PR/viint.h"
void osViSetEvent(OSMesgQueue *mq, OSMesg m, u32 retraceCount) {
register u32 saveMask = __osDisableInt();
__osViNext->msgq = mq;
__osViNext->msg = m;
__osViNext->retraceCount = retraceCount;
__osRestoreInt(saveMask);
}

11
src/os/visetmode.c Normal file
View File

@ -0,0 +1,11 @@
#include "common.h"
#include "PR/viint.h"
void osViSetMode(OSViMode *modep) {
register u32 saveMask = __osDisableInt();
__osViNext->modep = modep;
__osViNext->state = VI_STATE_MODE_UPDATED;
__osViNext->control = __osViNext->modep->comRegs.ctrl;
__osRestoreInt(saveMask);
}

44
src/os/visetspecial.c Normal file
View File

@ -0,0 +1,44 @@
#include "PR/rcp.h"
#include "PR/viint.h"
void osViSetSpecialFeatures(u32 func) {
register u32 saveMask = __osDisableInt();
if ((func & OS_VI_GAMMA_ON) != 0) {
__osViNext->control |= VI_CTRL_GAMMA_ON;
}
if ((func & OS_VI_GAMMA_OFF) != 0) {
__osViNext->control &= ~VI_CTRL_GAMMA_ON;
}
if ((func & OS_VI_GAMMA_DITHER_ON) != 0) {
__osViNext->control |= VI_CTRL_GAMMA_DITHER_ON;
}
if ((func & OS_VI_GAMMA_DITHER_OFF) != 0) {
__osViNext->control &= ~VI_CTRL_GAMMA_DITHER_ON;
}
if ((func & OS_VI_DIVOT_ON) != 0) {
__osViNext->control |= VI_CTRL_DIVOT_ON;
}
if ((func & OS_VI_DIVOT_OFF) != 0) {
__osViNext->control &= ~VI_CTRL_DIVOT_ON;
}
if ((func & OS_VI_DITHER_FILTER_ON) != 0) {
__osViNext->control |= VI_CTRL_DITHER_FILTER_ON;
__osViNext->control &= ~VI_CTRL_ANTIALIAS_MASK;
}
if ((func & OS_VI_DITHER_FILTER_OFF) != 0) {
__osViNext->control &= ~VI_CTRL_DITHER_FILTER_ON;
__osViNext->control |= __osViNext->modep->comRegs.ctrl & VI_CTRL_ANTIALIAS_MASK;
}
__osViNext->state |= VI_STATE_CTRL_UPDATED;
__osRestoreInt(saveMask);
}

9
src/os/visetyscale.c Normal file
View File

@ -0,0 +1,9 @@
#include "PR/viint.h"
void osViSetYScale(f32 value) {
register u32 saveMask;
saveMask = __osDisableInt();
__osViNext->y.factor = value;
__osViNext->state |= VI_STATE_YSCALE_UPDATED;
__osRestoreInt(saveMask);
}

9
src/os/viswapbuf.c Normal file
View File

@ -0,0 +1,9 @@
#include "PR/viint.h"
void osViSwapBuffer(void* frameBufPtr) {
u32 saveMask = __osDisableInt();
__osViNext->framep = frameBufPtr;
__osViNext->state |= VI_STATE_BUFFER_UPDATED;
__osRestoreInt(saveMask);
}

68
src/os/viswapcontext.c Normal file
View File

@ -0,0 +1,68 @@
#include "PR/rcp.h"
#include "PR/viint.h"
void __osViSwapContext() {
register OSViMode *vm;
register __OSViContext *vc;
u32 origin;
u32 vStart;
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;
}
vStart = (vm->fldRegs[field].vStart - (__additional_scanline << 0x10)) + __additional_scanline;
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, 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;
}

9
src/os/yieldthread.c Normal file
View File

@ -0,0 +1,9 @@
#include "PR/osint.h"
void osYieldThread(void) {
register u32 saveMask = __osDisableInt();
__osRunningThread->state = OS_STATE_RUNNABLE;
__osEnqueueAndYield(&__osRunQueue);
__osRestoreInt(saveMask);
}

View File

@ -846,7 +846,7 @@ def disassemble(bytes, midx, symbol_map={}, comments=True, romstart=0, namespace
out += f"ActorPartBlueprint {struct['name']}[] = {{\n"
for _ in range(0, struct["length"] // 36):
d = unpack(">IbbbbbbhIIIIhxxxxxx", bytes.read(36))
d = unpack(">IbbbbbbhIIIIbbxxxxxx", bytes.read(36))
out += INDENT + "{\n"
out += INDENT + INDENT + f".flags = {read_flags(d[0], 'ActorPartFlags')},\n"
@ -859,6 +859,7 @@ def disassemble(bytes, midx, symbol_map={}, comments=True, romstart=0, namespace
out += INDENT + INDENT + f".eventFlags = {read_flags(d[10], 'ActorEventFlags')},\n"
out += INDENT + INDENT + f".elementImmunityFlags = {read_flags(d[11], 'ElementImmunityFlags')},\n"
out += INDENT + INDENT + f".unk_1C = {d[12]},\n"
out += INDENT + INDENT + f".unk_1D = {d[13]},\n"
out += INDENT + "},\n"
out += f"}};\n"

View File

@ -2,7 +2,7 @@
.section .data
dlabel D_80094670
dlabel __osTimerList
.word 0x800D9210, 0x00000000, 0x00000000, 0x00000000
dlabel D_80094680
@ -26,7 +26,7 @@ dlabel D_80094694
dlabel D_80094698
.word 0x00000000
dlabel D_8009469C
dlabel __additional_scanline
.word 0x00000000
dlabel osViModeTable
@ -62,10 +62,10 @@ dlabel D_800958F4
dlabel D_800958F8
.word 0x02E6D354
dlabel D_800958FC
dlabel __osShutdown
.word 0x00000000
dlabel D_80095900
dlabel __OSGlobalIntMask
.word 0x003FFF01, 0x00000000, 0x00000000, 0x00000000
dlabel D_80095910
@ -101,10 +101,10 @@ dlabel D_800959A4
dlabel D_800959A8
.word 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
dlabel D_800959D0
dlabel __osViCurr
.word D_80095970
dlabel D_800959D4
dlabel __osViNext
.word D_800959A0, 0x00000000, 0x00000000
dlabel D_800959E0

View File

@ -1,267 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.section .rodata
dlabel jtbl_80099B20
.word .L800613D4_3C7D4, .L800612F4_3C6F4, .L80061328_3C728, .L800613E4_3C7E4, .L800613E4_3C7E4, .L8006135C_3C75C, .L80061398_3C798, 0
.section .text
glabel osDevMgrMain
/* 3C490 80061090 27BDFFB8 */ addiu $sp, $sp, -0x48
/* 3C494 80061094 AFB20030 */ sw $s2, 0x30($sp)
/* 3C498 80061098 00809021 */ addu $s2, $a0, $zero
/* 3C49C 8006109C AFB40038 */ sw $s4, 0x38($sp)
/* 3C4A0 800610A0 24140002 */ addiu $s4, $zero, 2
/* 3C4A4 800610A4 AFB5003C */ sw $s5, 0x3c($sp)
/* 3C4A8 800610A8 24150001 */ addiu $s5, $zero, 1
/* 3C4AC 800610AC AFBF0040 */ sw $ra, 0x40($sp)
/* 3C4B0 800610B0 AFB30034 */ sw $s3, 0x34($sp)
/* 3C4B4 800610B4 AFB1002C */ sw $s1, 0x2c($sp)
/* 3C4B8 800610B8 AFB00028 */ sw $s0, 0x28($sp)
/* 3C4BC 800610BC AFA00018 */ sw $zero, 0x18($sp)
.L800610C0:
/* 3C4C0 800610C0 8E440008 */ lw $a0, 8($s2)
/* 3C4C4 800610C4 27A50018 */ addiu $a1, $sp, 0x18
/* 3C4C8 800610C8 0C0195BC */ jal osRecvMesg
/* 3C4CC 800610CC 24060001 */ addiu $a2, $zero, 1
/* 3C4D0 800610D0 8FA20018 */ lw $v0, 0x18($sp)
/* 3C4D4 800610D4 8C500014 */ lw $s0, 0x14($v0)
/* 3C4D8 800610D8 1200007C */ beqz $s0, .L800612CC
/* 3C4DC 800610DC 00000000 */ nop
/* 3C4E0 800610E0 92020004 */ lbu $v0, 4($s0)
/* 3C4E4 800610E4 14540078 */ bne $v0, $s4, .L800612C8
/* 3C4E8 800610E8 00000000 */ nop
/* 3C4EC 800610EC 8E020014 */ lw $v0, 0x14($s0)
/* 3C4F0 800610F0 2C420002 */ sltiu $v0, $v0, 2
/* 3C4F4 800610F4 10400074 */ beqz $v0, .L800612C8
/* 3C4F8 800610F8 2402FFFF */ addiu $v0, $zero, -1
/* 3C4FC 800610FC 9603001A */ lhu $v1, 0x1a($s0)
/* 3C500 80061100 AE02001C */ sw $v0, 0x1c($s0)
/* 3C504 80061104 000310C0 */ sll $v0, $v1, 3
/* 3C508 80061108 00431021 */ addu $v0, $v0, $v1
/* 3C50C 8006110C 00021080 */ sll $v0, $v0, 2
/* 3C510 80061110 02021021 */ addu $v0, $s0, $v0
/* 3C514 80061114 96030018 */ lhu $v1, 0x18($s0)
/* 3C518 80061118 2451002C */ addiu $s1, $v0, 0x2c
/* 3C51C 8006111C 24020003 */ addiu $v0, $zero, 3
/* 3C520 80061120 10620005 */ beq $v1, $v0, .L80061138
/* 3C524 80061124 00000000 */ nop
/* 3C528 80061128 8E220004 */ lw $v0, 4($s1)
/* 3C52C 8006112C 8E23000C */ lw $v1, 0xc($s1)
/* 3C530 80061130 00431023 */ subu $v0, $v0, $v1
/* 3C534 80061134 AE220004 */ sw $v0, 4($s1)
.L80061138:
/* 3C538 80061138 96020018 */ lhu $v0, 0x18($s0)
/* 3C53C 8006113C 14540005 */ bne $v0, $s4, .L80061154
/* 3C540 80061140 00009821 */ addu $s3, $zero, $zero
/* 3C544 80061144 8FA20018 */ lw $v0, 0x18($sp)
/* 3C548 80061148 8C420014 */ lw $v0, 0x14($v0)
/* 3C54C 8006114C 8C420014 */ lw $v0, 0x14($v0)
/* 3C550 80061150 2C530001 */ sltiu $s3, $v0, 1
.L80061154:
/* 3C554 80061154 8E440010 */ lw $a0, 0x10($s2)
/* 3C558 80061158 27A5001C */ addiu $a1, $sp, 0x1c
/* 3C55C 8006115C 0C0195BC */ jal osRecvMesg
/* 3C560 80061160 24060001 */ addiu $a2, $zero, 1
/* 3C564 80061164 3C040010 */ lui $a0, 0x10
/* 3C568 80061168 0C01AD0C */ jal osResetGlobalIntMask
/* 3C56C 8006116C 34840401 */ ori $a0, $a0, 0x401
/* 3C570 80061170 3C050500 */ lui $a1, 0x500
/* 3C574 80061174 8FA20018 */ lw $v0, 0x18($sp)
/* 3C578 80061178 34A50510 */ ori $a1, $a1, 0x510
/* 3C57C 8006117C 8E030024 */ lw $v1, 0x24($s0)
/* 3C580 80061180 8C440014 */ lw $a0, 0x14($v0)
/* 3C584 80061184 3C068000 */ lui $a2, 0x8000
/* 3C588 80061188 0C01ADB8 */ jal osEPiRawWriteIo
/* 3C58C 8006118C 00663025 */ or $a2, $v1, $a2
.L80061190:
/* 3C590 80061190 8E44000C */ lw $a0, 0xc($s2)
/* 3C594 80061194 27A50020 */ addiu $a1, $sp, 0x20
/* 3C598 80061198 0C0195BC */ jal osRecvMesg
/* 3C59C 8006119C 24060001 */ addiu $a2, $zero, 1
/* 3C5A0 800611A0 8FA20018 */ lw $v0, 0x18($sp)
/* 3C5A4 800611A4 8C500014 */ lw $s0, 0x14($v0)
/* 3C5A8 800611A8 9603001A */ lhu $v1, 0x1a($s0)
/* 3C5AC 800611AC 000310C0 */ sll $v0, $v1, 3
/* 3C5B0 800611B0 00431021 */ addu $v0, $v0, $v1
/* 3C5B4 800611B4 00021080 */ sll $v0, $v0, 2
/* 3C5B8 800611B8 02021021 */ addu $v0, $s0, $v0
/* 3C5BC 800611BC 2451002C */ addiu $s1, $v0, 0x2c
/* 3C5C0 800611C0 8E230000 */ lw $v1, ($s1)
/* 3C5C4 800611C4 2402001D */ addiu $v0, $zero, 0x1d
/* 3C5C8 800611C8 14620027 */ bne $v1, $v0, .L80061268
/* 3C5CC 800611CC 02002021 */ addu $a0, $s0, $zero
/* 3C5D0 800611D0 3C050500 */ lui $a1, 0x500
/* 3C5D4 800611D4 8E020024 */ lw $v0, 0x24($s0)
/* 3C5D8 800611D8 34A50510 */ ori $a1, $a1, 0x510
/* 3C5DC 800611DC 3C061000 */ lui $a2, 0x1000
/* 3C5E0 800611E0 0C01ADB8 */ jal osEPiRawWriteIo
/* 3C5E4 800611E4 00463025 */ or $a2, $v0, $a2
/* 3C5E8 800611E8 8FA20018 */ lw $v0, 0x18($sp)
/* 3C5EC 800611EC 8E060024 */ lw $a2, 0x24($s0)
/* 3C5F0 800611F0 8C440014 */ lw $a0, 0x14($v0)
/* 3C5F4 800611F4 3C050500 */ lui $a1, 0x500
/* 3C5F8 800611F8 0C01ADB8 */ jal osEPiRawWriteIo
/* 3C5FC 800611FC 34A50510 */ ori $a1, $a1, 0x510
/* 3C600 80061200 8FA20018 */ lw $v0, 0x18($sp)
/* 3C604 80061204 3C050500 */ lui $a1, 0x500
/* 3C608 80061208 8C440014 */ lw $a0, 0x14($v0)
/* 3C60C 8006120C 34A50508 */ ori $a1, $a1, 0x508
/* 3C610 80061210 0C01AD5C */ jal osEPiRawReadIo
/* 3C614 80061214 27A60024 */ addiu $a2, $sp, 0x24
/* 3C618 80061218 8FA20024 */ lw $v0, 0x24($sp)
/* 3C61C 8006121C 3C030200 */ lui $v1, 0x200
/* 3C620 80061220 00431024 */ and $v0, $v0, $v1
/* 3C624 80061224 10400008 */ beqz $v0, .L80061248
/* 3C628 80061228 3C050500 */ lui $a1, 0x500
/* 3C62C 8006122C 8FA20018 */ lw $v0, 0x18($sp)
/* 3C630 80061230 34A50510 */ ori $a1, $a1, 0x510
/* 3C634 80061234 8E030024 */ lw $v1, 0x24($s0)
/* 3C638 80061238 8C440014 */ lw $a0, 0x14($v0)
/* 3C63C 8006123C 3C060100 */ lui $a2, 0x100
/* 3C640 80061240 0C01ADB8 */ jal osEPiRawWriteIo
/* 3C644 80061244 00663025 */ or $a2, $v1, $a2
.L80061248:
/* 3C648 80061248 3C03A460 */ lui $v1, 0xa460
/* 3C64C 8006124C 34630010 */ ori $v1, $v1, 0x10
/* 3C650 80061250 3C040010 */ lui $a0, 0x10
/* 3C654 80061254 24020004 */ addiu $v0, $zero, 4
/* 3C658 80061258 AE220000 */ sw $v0, ($s1)
/* 3C65C 8006125C AC740000 */ sw $s4, ($v1)
/* 3C660 80061260 0C01ACFC */ jal osSetGlobalIntMask
/* 3C664 80061264 34840C01 */ ori $a0, $a0, 0xc01
.L80061268:
/* 3C668 80061268 8FA50018 */ lw $a1, 0x18($sp)
/* 3C66C 8006126C 8CA40004 */ lw $a0, 4($a1)
/* 3C670 80061270 0C019608 */ jal osSendMesg
/* 3C674 80061274 00003021 */ addu $a2, $zero, $zero
/* 3C678 80061278 16750006 */ bne $s3, $s5, .L80061294
/* 3C67C 8006127C 00000000 */ nop
/* 3C680 80061280 8FA20018 */ lw $v0, 0x18($sp)
/* 3C684 80061284 8C420014 */ lw $v0, 0x14($v0)
/* 3C688 80061288 8C42002C */ lw $v0, 0x2c($v0)
/* 3C68C 8006128C 1040FFC0 */ beqz $v0, .L80061190
/* 3C690 80061290 00009821 */ addu $s3, $zero, $zero
.L80061294:
/* 3C694 80061294 8E440010 */ lw $a0, 0x10($s2)
/* 3C698 80061298 00002821 */ addu $a1, $zero, $zero
/* 3C69C 8006129C 0C019608 */ jal osSendMesg
/* 3C6A0 800612A0 00003021 */ addu $a2, $zero, $zero
/* 3C6A4 800612A4 8FA20018 */ lw $v0, 0x18($sp)
/* 3C6A8 800612A8 8C420014 */ lw $v0, 0x14($v0)
/* 3C6AC 800612AC 9442001A */ lhu $v0, 0x1a($v0)
/* 3C6B0 800612B0 1455FF83 */ bne $v0, $s5, .L800610C0
/* 3C6B4 800612B4 00000000 */ nop
/* 3C6B8 800612B8 0C019890 */ jal osYieldThread
/* 3C6BC 800612BC 00000000 */ nop
/* 3C6C0 800612C0 08018430 */ j .L800610C0
/* 3C6C4 800612C4 00000000 */ nop
.L800612C8:
/* 3C6C8 800612C8 8FA20018 */ lw $v0, 0x18($sp)
.L800612CC:
/* 3C6CC 800612CC 94420000 */ lhu $v0, ($v0)
/* 3C6D0 800612D0 2443FFF6 */ addiu $v1, $v0, -0xa
/* 3C6D4 800612D4 2C620007 */ sltiu $v0, $v1, 7
/* 3C6D8 800612D8 10400042 */ beqz $v0, .L800613E4_3C7E4
/* 3C6DC 800612DC 00031080 */ sll $v0, $v1, 2
/* 3C6E0 800612E0 3C01800A */ lui $at, %hi(jtbl_80099B20)
/* 3C6E4 800612E4 00220821 */ addu $at, $at, $v0
/* 3C6E8 800612E8 8C229B20 */ lw $v0, %lo(jtbl_80099B20)($at)
/* 3C6EC 800612EC 00400008 */ jr $v0
/* 3C6F0 800612F0 00000000 */ nop
.L800612F4_3C6F4:
/* 3C6F4 800612F4 8E440010 */ lw $a0, 0x10($s2)
/* 3C6F8 800612F8 27A5001C */ addiu $a1, $sp, 0x1c
/* 3C6FC 800612FC 0C0195BC */ jal osRecvMesg
/* 3C700 80061300 24060001 */ addiu $a2, $zero, 1
/* 3C704 80061304 8FA20018 */ lw $v0, 0x18($sp)
/* 3C708 80061308 8C45000C */ lw $a1, 0xc($v0)
/* 3C70C 8006130C 8C460008 */ lw $a2, 8($v0)
/* 3C710 80061310 8C470010 */ lw $a3, 0x10($v0)
/* 3C714 80061314 8E420014 */ lw $v0, 0x14($s2)
/* 3C718 80061318 0040F809 */ jalr $v0
/* 3C71C 8006131C 00002021 */ addu $a0, $zero, $zero
/* 3C720 80061320 080184FA */ j .L800613E8
/* 3C724 80061324 00000000 */ nop
.L80061328_3C728:
/* 3C728 80061328 8E440010 */ lw $a0, 0x10($s2)
/* 3C72C 8006132C 27A5001C */ addiu $a1, $sp, 0x1c
/* 3C730 80061330 0C0195BC */ jal osRecvMesg
/* 3C734 80061334 24060001 */ addiu $a2, $zero, 1
/* 3C738 80061338 8FA20018 */ lw $v0, 0x18($sp)
/* 3C73C 8006133C 8C45000C */ lw $a1, 0xc($v0)
/* 3C740 80061340 8C460008 */ lw $a2, 8($v0)
/* 3C744 80061344 8C470010 */ lw $a3, 0x10($v0)
/* 3C748 80061348 8E420014 */ lw $v0, 0x14($s2)
/* 3C74C 8006134C 0040F809 */ jalr $v0
/* 3C750 80061350 24040001 */ addiu $a0, $zero, 1
/* 3C754 80061354 080184FA */ j .L800613E8
/* 3C758 80061358 00000000 */ nop
.L8006135C_3C75C:
/* 3C75C 8006135C 8E440010 */ lw $a0, 0x10($s2)
/* 3C760 80061360 27A5001C */ addiu $a1, $sp, 0x1c
/* 3C764 80061364 0C0195BC */ jal osRecvMesg
/* 3C768 80061368 24060001 */ addiu $a2, $zero, 1
/* 3C76C 8006136C 8FA20018 */ lw $v0, 0x18($sp)
/* 3C770 80061370 8C430010 */ lw $v1, 0x10($v0)
/* 3C774 80061374 AFA30010 */ sw $v1, 0x10($sp)
/* 3C778 80061378 8C440014 */ lw $a0, 0x14($v0)
/* 3C77C 8006137C 8C46000C */ lw $a2, 0xc($v0)
/* 3C780 80061380 8C470008 */ lw $a3, 8($v0)
/* 3C784 80061384 8E420018 */ lw $v0, 0x18($s2)
/* 3C788 80061388 0040F809 */ jalr $v0
/* 3C78C 8006138C 00002821 */ addu $a1, $zero, $zero
/* 3C790 80061390 080184FA */ j .L800613E8
/* 3C794 80061394 00000000 */ nop
.L80061398_3C798:
/* 3C798 80061398 8E440010 */ lw $a0, 0x10($s2)
/* 3C79C 8006139C 27A5001C */ addiu $a1, $sp, 0x1c
/* 3C7A0 800613A0 0C0195BC */ jal osRecvMesg
/* 3C7A4 800613A4 24060001 */ addiu $a2, $zero, 1
/* 3C7A8 800613A8 8FA20018 */ lw $v0, 0x18($sp)
/* 3C7AC 800613AC 8C430010 */ lw $v1, 0x10($v0)
/* 3C7B0 800613B0 AFA30010 */ sw $v1, 0x10($sp)
/* 3C7B4 800613B4 8C440014 */ lw $a0, 0x14($v0)
/* 3C7B8 800613B8 8C46000C */ lw $a2, 0xc($v0)
/* 3C7BC 800613BC 8C470008 */ lw $a3, 8($v0)
/* 3C7C0 800613C0 8E420018 */ lw $v0, 0x18($s2)
/* 3C7C4 800613C4 0040F809 */ jalr $v0
/* 3C7C8 800613C8 24050001 */ addiu $a1, $zero, 1
/* 3C7CC 800613CC 080184FA */ j .L800613E8
/* 3C7D0 800613D0 00000000 */ nop
.L800613D4_3C7D4:
/* 3C7D4 800613D4 8FA50018 */ lw $a1, 0x18($sp)
/* 3C7D8 800613D8 8CA40004 */ lw $a0, 4($a1)
/* 3C7DC 800613DC 0C019608 */ jal osSendMesg
/* 3C7E0 800613E0 00003021 */ addu $a2, $zero, $zero
.L800613E4_3C7E4:
/* 3C7E4 800613E4 2402FFFF */ addiu $v0, $zero, -1
.L800613E8:
/* 3C7E8 800613E8 1440FF35 */ bnez $v0, .L800610C0
/* 3C7EC 800613EC 27A50020 */ addiu $a1, $sp, 0x20
/* 3C7F0 800613F0 8E44000C */ lw $a0, 0xc($s2)
/* 3C7F4 800613F4 0C0195BC */ jal osRecvMesg
/* 3C7F8 800613F8 24060001 */ addiu $a2, $zero, 1
/* 3C7FC 800613FC 8FA50018 */ lw $a1, 0x18($sp)
/* 3C800 80061400 8CA40004 */ lw $a0, 4($a1)
/* 3C804 80061404 0C019608 */ jal osSendMesg
/* 3C808 80061408 00003021 */ addu $a2, $zero, $zero
/* 3C80C 8006140C 8E440010 */ lw $a0, 0x10($s2)
/* 3C810 80061410 00002821 */ addu $a1, $zero, $zero
/* 3C814 80061414 0C019608 */ jal osSendMesg
/* 3C818 80061418 00003021 */ addu $a2, $zero, $zero
/* 3C81C 8006141C 08018430 */ j .L800610C0
/* 3C820 80061420 00000000 */ nop
/* 3C824 80061424 8FBF0040 */ lw $ra, 0x40($sp)
/* 3C828 80061428 8FB5003C */ lw $s5, 0x3c($sp)
/* 3C82C 8006142C 8FB40038 */ lw $s4, 0x38($sp)
/* 3C830 80061430 8FB30034 */ lw $s3, 0x34($sp)
/* 3C834 80061434 8FB20030 */ lw $s2, 0x30($sp)
/* 3C838 80061438 8FB1002C */ lw $s1, 0x2c($sp)
/* 3C83C 8006143C 8FB00028 */ lw $s0, 0x28($sp)
/* 3C840 80061440 03E00008 */ jr $ra
/* 3C844 80061444 27BD0048 */ addiu $sp, $sp, 0x48
/* 3C848 80061448 00000000 */ nop
/* 3C84C 8006144C 00000000 */ nop

View File

@ -1,7 +1,7 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel osPiGetAccess
glabel __osPiGetAccess
/* 3C8A4 800614A4 3C028009 */ lui $v0, %hi(__osPiAccessQueueEnabled)
/* 3C8A8 800614A8 8C423D90 */ lw $v0, %lo(__osPiAccessQueueEnabled)($v0)
/* 3C8AC 800614AC 27BDFFE0 */ addiu $sp, $sp, -0x20

View File

@ -1,7 +1,7 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel osPiRelAccess
glabel __osPiRelAccess
/* 3C910 80061510 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 3C914 80061514 AFBF0010 */ sw $ra, 0x10($sp)
/* 3C918 80061518 3C04800B */ lui $a0, %hi(gOsPiMessageQueue)

View File

@ -1,48 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel osAiSetNextBuffer
/* 3CA80 80061680 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 3CA84 80061684 AFB00010 */ sw $s0, 0x10($sp)
/* 3CA88 80061688 00808021 */ addu $s0, $a0, $zero
/* 3CA8C 8006168C AFB10014 */ sw $s1, 0x14($sp)
/* 3CA90 80061690 AFBF0018 */ sw $ra, 0x18($sp)
/* 3CA94 80061694 0C01AE14 */ jal osAiDeviceBusy
/* 3CA98 80061698 00A08821 */ addu $s1, $a1, $zero
/* 3CA9C 8006169C 14400018 */ bnez $v0, .L80061700
/* 3CAA0 800616A0 2402FFFF */ addiu $v0, $zero, -1
/* 3CAA4 800616A4 3C028009 */ lui $v0, %hi(hdwrBugFlag)
/* 3CAA8 800616A8 90423DA0 */ lbu $v0, %lo(hdwrBugFlag)($v0)
/* 3CAAC 800616AC 10400002 */ beqz $v0, .L800616B8
/* 3CAB0 800616B0 02002021 */ addu $a0, $s0, $zero
/* 3CAB4 800616B4 2484E000 */ addiu $a0, $a0, -0x2000
.L800616B8:
/* 3CAB8 800616B8 02111021 */ addu $v0, $s0, $s1
/* 3CABC 800616BC 30421FFF */ andi $v0, $v0, 0x1fff
/* 3CAC0 800616C0 14400004 */ bnez $v0, .L800616D4
/* 3CAC4 800616C4 24020001 */ addiu $v0, $zero, 1
/* 3CAC8 800616C8 3C018009 */ lui $at, %hi(hdwrBugFlag)
/* 3CACC 800616CC 080185B7 */ j .L800616DC
/* 3CAD0 800616D0 A0223DA0 */ sb $v0, %lo(hdwrBugFlag)($at)
.L800616D4:
/* 3CAD4 800616D4 3C018009 */ lui $at, %hi(hdwrBugFlag)
/* 3CAD8 800616D8 A0203DA0 */ sb $zero, %lo(hdwrBugFlag)($at)
.L800616DC:
/* 3CADC 800616DC 0C0187A4 */ jal osVirtualToPhysical
/* 3CAE0 800616E0 00000000 */ nop
/* 3CAE4 800616E4 3C05A450 */ lui $a1, 0xa450
/* 3CAE8 800616E8 34A50004 */ ori $a1, $a1, 4
/* 3CAEC 800616EC 00402021 */ addu $a0, $v0, $zero
/* 3CAF0 800616F0 00001021 */ addu $v0, $zero, $zero
/* 3CAF4 800616F4 3C03A450 */ lui $v1, 0xa450
/* 3CAF8 800616F8 AC640000 */ sw $a0, ($v1)
/* 3CAFC 800616FC ACB10000 */ sw $s1, ($a1)
.L80061700:
/* 3CB00 80061700 8FBF0018 */ lw $ra, 0x18($sp)
/* 3CB04 80061704 8FB10014 */ lw $s1, 0x14($sp)
/* 3CB08 80061708 8FB00010 */ lw $s0, 0x10($sp)
/* 3CB0C 8006170C 03E00008 */ jr $ra
/* 3CB10 80061710 27BD0020 */ addiu $sp, $sp, 0x20
/* 3CB14 80061714 00000000 */ nop
/* 3CB18 80061718 00000000 */ nop
/* 3CB1C 8006171C 00000000 */ nop

View File

@ -5,11 +5,11 @@ glabel osSiCreateAccessQueue
/* 41170 80065D70 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 41174 80065D74 24020001 */ addiu $v0, $zero, 1
/* 41178 80065D78 AFB00010 */ sw $s0, 0x10($sp)
/* 4117C 80065D7C 3C10800E */ lui $s0, %hi(D_800DACA8)
/* 41180 80065D80 2610ACA8 */ addiu $s0, $s0, %lo(D_800DACA8)
/* 4117C 80065D7C 3C10800E */ lui $s0, %hi(__osSiAccessQueue)
/* 41180 80065D80 2610ACA8 */ addiu $s0, $s0, %lo(__osSiAccessQueue)
/* 41184 80065D84 02002021 */ addu $a0, $s0, $zero
/* 41188 80065D88 3C05800B */ lui $a1, %hi(D_800AF900)
/* 4118C 80065D8C 24A5F900 */ addiu $a1, $a1, %lo(D_800AF900)
/* 41188 80065D88 3C05800B */ lui $a1, %hi(siAccessBuf)
/* 4118C 80065D8C 24A5F900 */ addiu $a1, $a1, %lo(siAccessBuf)
/* 41190 80065D90 AFBF0014 */ sw $ra, 0x14($sp)
/* 41194 80065D94 3C018009 */ lui $at, %hi(__osSiAccessQueueEnabled)
/* 41198 80065D98 AC224640 */ sw $v0, %lo(__osSiAccessQueueEnabled)($at)

View File

@ -10,20 +10,20 @@ glabel osSiGetAccess
/* 411D8 80065DD8 24020001 */ addiu $v0, $zero, 1
/* 411DC 80065DDC 3C018009 */ lui $at, %hi(__osSiAccessQueueEnabled)
/* 411E0 80065DE0 AC224640 */ sw $v0, %lo(__osSiAccessQueueEnabled)($at)
/* 411E4 80065DE4 3C04800E */ lui $a0, %hi(D_800DACA8)
/* 411E8 80065DE8 2484ACA8 */ addiu $a0, $a0, %lo(D_800DACA8)
/* 411EC 80065DEC 3C05800B */ lui $a1, %hi(D_800AF900)
/* 411F0 80065DF0 24A5F900 */ addiu $a1, $a1, %lo(D_800AF900)
/* 411E4 80065DE4 3C04800E */ lui $a0, %hi(__osSiAccessQueue)
/* 411E8 80065DE8 2484ACA8 */ addiu $a0, $a0, %lo(__osSiAccessQueue)
/* 411EC 80065DEC 3C05800B */ lui $a1, %hi(siAccessBuf)
/* 411F0 80065DF0 24A5F900 */ addiu $a1, $a1, %lo(siAccessBuf)
/* 411F4 80065DF4 0C019560 */ jal osCreateMesgQueue
/* 411F8 80065DF8 24060001 */ addiu $a2, $zero, 1
/* 411FC 80065DFC 3C04800E */ lui $a0, %hi(D_800DACA8)
/* 41200 80065E00 2484ACA8 */ addiu $a0, $a0, %lo(D_800DACA8)
/* 411FC 80065DFC 3C04800E */ lui $a0, %hi(__osSiAccessQueue)
/* 41200 80065E00 2484ACA8 */ addiu $a0, $a0, %lo(__osSiAccessQueue)
/* 41204 80065E04 00002821 */ addu $a1, $zero, $zero
/* 41208 80065E08 0C019608 */ jal osSendMesg
/* 4120C 80065E0C 00003021 */ addu $a2, $zero, $zero
.L80065E10:
/* 41210 80065E10 3C04800E */ lui $a0, %hi(D_800DACA8)
/* 41214 80065E14 2484ACA8 */ addiu $a0, $a0, %lo(D_800DACA8)
/* 41210 80065E10 3C04800E */ lui $a0, %hi(__osSiAccessQueue)
/* 41214 80065E14 2484ACA8 */ addiu $a0, $a0, %lo(__osSiAccessQueue)
/* 41218 80065E18 27A50010 */ addiu $a1, $sp, 0x10
/* 4121C 80065E1C 0C0195BC */ jal osRecvMesg
/* 41220 80065E20 24060001 */ addiu $a2, $zero, 1

View File

@ -4,8 +4,8 @@
glabel osSiRelAccess
/* 41230 80065E30 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 41234 80065E34 AFBF0010 */ sw $ra, 0x10($sp)
/* 41238 80065E38 3C04800E */ lui $a0, %hi(D_800DACA8)
/* 4123C 80065E3C 2484ACA8 */ addiu $a0, $a0, %lo(D_800DACA8)
/* 41238 80065E38 3C04800E */ lui $a0, %hi(__osSiAccessQueue)
/* 4123C 80065E3C 2484ACA8 */ addiu $a0, $a0, %lo(__osSiAccessQueue)
/* 41240 80065E40 00002821 */ addu $a1, $zero, $zero
/* 41244 80065E44 0C019608 */ jal osSendMesg
/* 41248 80065E48 00003021 */ addu $a2, $zero, $zero

View File

@ -1,83 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel osStartThread
/* 41420 80066020 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 41424 80066024 AFB00010 */ sw $s0, 0x10($sp)
/* 41428 80066028 00808021 */ addu $s0, $a0, $zero
/* 4142C 8006602C AFBF001C */ sw $ra, 0x1c($sp)
/* 41430 80066030 AFB20018 */ sw $s2, 0x18($sp)
/* 41434 80066034 0C01ACD8 */ jal __osDisableInt
/* 41438 80066038 AFB10014 */ sw $s1, 0x14($sp)
/* 4143C 8006603C 96030010 */ lhu $v1, 0x10($s0)
/* 41440 80066040 00409021 */ addu $s2, $v0, $zero
/* 41444 80066044 24020001 */ addiu $v0, $zero, 1
/* 41448 80066048 10620008 */ beq $v1, $v0, .L8006606C
/* 4144C 8006604C 24020008 */ addiu $v0, $zero, 8
/* 41450 80066050 1462001E */ bne $v1, $v0, .L800660CC
/* 41454 80066054 24020002 */ addiu $v0, $zero, 2
/* 41458 80066058 A6020010 */ sh $v0, 0x10($s0)
/* 4145C 8006605C 3C048009 */ lui $a0, %hi(__osRunQueue)
/* 41460 80066060 24844658 */ addiu $a0, $a0, %lo(__osRunQueue)
/* 41464 80066064 08019831 */ j .L800660C4
/* 41468 80066068 02002821 */ addu $a1, $s0, $zero
.L8006606C:
/* 4146C 8006606C 8E020008 */ lw $v0, 8($s0)
/* 41470 80066070 50400006 */ beql $v0, $zero, .L8006608C
/* 41474 80066074 24020002 */ addiu $v0, $zero, 2
/* 41478 80066078 3C118009 */ lui $s1, %hi(__osRunQueue)
/* 4147C 8006607C 26314658 */ addiu $s1, $s1, %lo(__osRunQueue)
/* 41480 80066080 14510007 */ bne $v0, $s1, .L800660A0
/* 41484 80066084 02002821 */ addu $a1, $s0, $zero
/* 41488 80066088 24020002 */ addiu $v0, $zero, 2
.L8006608C:
/* 4148C 8006608C A6020010 */ sh $v0, 0x10($s0)
/* 41490 80066090 3C048009 */ lui $a0, %hi(__osRunQueue)
/* 41494 80066094 24844658 */ addiu $a0, $a0, %lo(__osRunQueue)
/* 41498 80066098 08019831 */ j .L800660C4
/* 4149C 8006609C 02002821 */ addu $a1, $s0, $zero
.L800660A0:
/* 414A0 800660A0 8E040008 */ lw $a0, 8($s0)
/* 414A4 800660A4 24020008 */ addiu $v0, $zero, 8
/* 414A8 800660A8 0C01AC5D */ jal osEnqueueThread
/* 414AC 800660AC A6020010 */ sh $v0, 0x10($s0)
/* 414B0 800660B0 8E040008 */ lw $a0, 8($s0)
/* 414B4 800660B4 0C01AC6F */ jal __osPopThread
/* 414B8 800660B8 00000000 */ nop
/* 414BC 800660BC 02202021 */ addu $a0, $s1, $zero
/* 414C0 800660C0 00402821 */ addu $a1, $v0, $zero
.L800660C4:
/* 414C4 800660C4 0C01AC5D */ jal osEnqueueThread
/* 414C8 800660C8 00000000 */ nop
.L800660CC:
/* 414CC 800660CC 3C048009 */ lui $a0, %hi(__osRunningThread)
/* 414D0 800660D0 8C844660 */ lw $a0, %lo(__osRunningThread)($a0)
/* 414D4 800660D4 14800005 */ bnez $a0, .L800660EC
/* 414D8 800660D8 00000000 */ nop
/* 414DC 800660DC 0C01AC75 */ jal osDispatchThread
/* 414E0 800660E0 00000000 */ nop
/* 414E4 800660E4 08019846 */ j .L80066118
/* 414E8 800660E8 00000000 */ nop
.L800660EC:
/* 414EC 800660EC 3C028009 */ lui $v0, %hi(__osRunQueue)
/* 414F0 800660F0 8C424658 */ lw $v0, %lo(__osRunQueue)($v0)
/* 414F4 800660F4 8C830004 */ lw $v1, 4($a0)
/* 414F8 800660F8 8C420004 */ lw $v0, 4($v0)
/* 414FC 800660FC 0062182A */ slt $v1, $v1, $v0
/* 41500 80066100 10600005 */ beqz $v1, .L80066118
/* 41504 80066104 24020002 */ addiu $v0, $zero, 2
/* 41508 80066108 A4820010 */ sh $v0, 0x10($a0)
/* 4150C 8006610C 3C048009 */ lui $a0, %hi(__osRunQueue)
/* 41510 80066110 0C01AC1B */ jal __osEnqueueAndYield
/* 41514 80066114 24844658 */ addiu $a0, $a0, %lo(__osRunQueue)
.L80066118:
/* 41518 80066118 0C01ACF4 */ jal __osRestoreInt
/* 4151C 8006611C 02402021 */ addu $a0, $s2, $zero
/* 41520 80066120 8FBF001C */ lw $ra, 0x1c($sp)
/* 41524 80066124 8FB20018 */ lw $s2, 0x18($sp)
/* 41528 80066128 8FB10014 */ lw $s1, 0x14($sp)
/* 4152C 8006612C 8FB00010 */ lw $s0, 0x10($sp)
/* 41530 80066130 03E00008 */ jr $ra
/* 41534 80066134 27BD0020 */ addiu $sp, $sp, 0x20
/* 41538 80066138 00000000 */ nop
/* 4153C 8006613C 00000000 */ nop

View File

@ -1,57 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel osStopThread
/* 41540 80066140 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 41544 80066144 AFB00010 */ sw $s0, 0x10($sp)
/* 41548 80066148 00808021 */ addu $s0, $a0, $zero
/* 4154C 8006614C AFBF0018 */ sw $ra, 0x18($sp)
/* 41550 80066150 0C01ACD8 */ jal __osDisableInt
/* 41554 80066154 AFB10014 */ sw $s1, 0x14($sp)
/* 41558 80066158 24030004 */ addiu $v1, $zero, 4
/* 4155C 8006615C 12000002 */ beqz $s0, .L80066168
/* 41560 80066160 00408821 */ addu $s1, $v0, $zero
/* 41564 80066164 96030010 */ lhu $v1, 0x10($s0)
.L80066168:
/* 41568 80066168 3063FFFF */ andi $v1, $v1, 0xffff
/* 4156C 8006616C 24020004 */ addiu $v0, $zero, 4
/* 41570 80066170 1062000C */ beq $v1, $v0, .L800661A4
/* 41574 80066174 28620005 */ slti $v0, $v1, 5
/* 41578 80066178 10400005 */ beqz $v0, .L80066190
/* 4157C 8006617C 24020002 */ addiu $v0, $zero, 2
/* 41580 80066180 10620010 */ beq $v1, $v0, .L800661C4
/* 41584 80066184 00000000 */ nop
/* 41588 80066188 08019876 */ j .L800661D8
/* 4158C 8006618C 00000000 */ nop
.L80066190:
/* 41590 80066190 24020008 */ addiu $v0, $zero, 8
/* 41594 80066194 1062000B */ beq $v1, $v0, .L800661C4
/* 41598 80066198 00000000 */ nop
/* 4159C 8006619C 08019876 */ j .L800661D8
/* 415A0 800661A0 00000000 */ nop
.L800661A4:
/* 415A4 800661A4 3C038009 */ lui $v1, %hi(__osRunningThread)
/* 415A8 800661A8 8C634660 */ lw $v1, %lo(__osRunningThread)($v1)
/* 415AC 800661AC 00002021 */ addu $a0, $zero, $zero
/* 415B0 800661B0 24020001 */ addiu $v0, $zero, 1
/* 415B4 800661B4 0C01AC1B */ jal __osEnqueueAndYield
/* 415B8 800661B8 A4620010 */ sh $v0, 0x10($v1)
/* 415BC 800661BC 08019876 */ j .L800661D8
/* 415C0 800661C0 00000000 */ nop
.L800661C4:
/* 415C4 800661C4 8E040008 */ lw $a0, 8($s0)
/* 415C8 800661C8 24020001 */ addiu $v0, $zero, 1
/* 415CC 800661CC 02002821 */ addu $a1, $s0, $zero
/* 415D0 800661D0 0C019880 */ jal osDequeueThread
/* 415D4 800661D4 A6020010 */ sh $v0, 0x10($s0)
.L800661D8:
/* 415D8 800661D8 0C01ACF4 */ jal __osRestoreInt
/* 415DC 800661DC 02202021 */ addu $a0, $s1, $zero
/* 415E0 800661E0 8FBF0018 */ lw $ra, 0x18($sp)
/* 415E4 800661E4 8FB10014 */ lw $s1, 0x14($sp)
/* 415E8 800661E8 8FB00010 */ lw $s0, 0x10($sp)
/* 415EC 800661EC 03E00008 */ jr $ra
/* 415F0 800661F0 27BD0020 */ addiu $sp, $sp, 0x20
/* 415F4 800661F4 00000000 */ nop
/* 415F8 800661F8 00000000 */ nop
/* 415FC 800661FC 00000000 */ nop

View File

@ -1,23 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel osDequeueThread
/* 41600 80066200 8C820000 */ lw $v0, ($a0)
/* 41604 80066204 10400009 */ beqz $v0, .L8006622C
/* 41608 80066208 00000000 */ nop
.L8006620C:
/* 4160C 8006620C 54450004 */ bnel $v0, $a1, .L80066220
/* 41610 80066210 00402021 */ addu $a0, $v0, $zero
/* 41614 80066214 8C420000 */ lw $v0, ($v0)
/* 41618 80066218 0801988B */ j .L8006622C
/* 4161C 8006621C AC820000 */ sw $v0, ($a0)
.L80066220:
/* 41620 80066220 8C420000 */ lw $v0, ($v0)
/* 41624 80066224 1440FFF9 */ bnez $v0, .L8006620C
/* 41628 80066228 00000000 */ nop
.L8006622C:
/* 4162C 8006622C 03E00008 */ jr $ra
/* 41630 80066230 00000000 */ nop
/* 41634 80066234 00000000 */ nop
/* 41638 80066238 00000000 */ nop
/* 4163C 8006623C 00000000 */ nop

Some files were not shown because too many files have changed in this diff Show More