N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## Operating System Function

This function along with the functions listed below are internal functions used by the N64 operating system. They are presented here to prevent developers from duplicating them unnecessarily.

    __osGetCause
    __osSetCause
    __osGetCompare
    __osSetCompare
    __osGetConfig
    __osSetConfig
    __osGetSR
    __osSetSR
    __osGetFpcCsr
    __osSetFpcCsr

Syntax

#include <ultra64.h>
#include <os_internal.h>
u32 __osGetCause(void);
void __osSetCause(u32 value);
u32 __osGetCompare(void);
void __osSetCompare(u32 value);
u32 __osGetConfig(void);
void __osSetConfig(u32 value);
u32 __osGetSR(void);
void __osSetSR(u32 value);
u32 __osGetFpcCsr(void);
u32 __osSetFpcCsr(u32 value);
Explanation
The N64 operating system uses these functions internally to gain access to the various MIPS R4300 registers. The Nintendo 64 operating system contains numerous internal routines that provide access to various important MIPS R4300 registers. To reduce potential duplicate effort from developers, these routines are described in this article.
Please use the "Set" routines with extreme caution because they can interfere with the operations of the N64 operating system. These routines were designed for internal use only, so their names all have a double underscore (__) prefix notation. For more information on the use of the R4300 registers, please refer to the MIPS R4300 User's Manual and the header file R4300.h, which contains various bit definitions that can be used with the R4300 registers.
The __osGetCause routine returns the current value of the MIPS R4300 Cause register that describes the cause of the most recent exception. Its counterpart __osSetCause simply sets this register to the new value.
The __osGetCompare routine returns the current value of the R4300 Compare register. __osSetCompare simply sets this register to the new value. Developers are discouraged from using __osSetCompare because the Compare register is used by the timer functions osSetTimer and osStopTimer.
The __osGetConfig routine returns the current value of the R4300 Configuration register. Its counterpart __osSetConfig simply sets this register to the new value.
The __osGetSR routine returns the current value of the R4300 Status register. Its counterpart __osSetSR simply sets this register to the new value. When creating a thread, osCreateThread enables the kernel mode, all interrupts, and exception level in the thread's Status register, which becomes the R4300 Status register during a thread context switch.
The __osGetFpcCsr routine returns the current value of the R4300 floating-point control/status register. Its counterpart __osSetFpcCsr simply returns the current value of this register before setting it to the new value. Upon system initialization and the creation of a thread, this floating-point control/status is enabled to flush all denormalized numbers to zero and to cause an invalid operation exception when Not a Numbers (NaNs) are generated. These 2 bits are respectively defined as FPCSR_FS and FPCSR_EV in R4300.h.
See Also
__osGetTLBASID

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1998