31.3424% (libultra update)

This commit is contained in:
Donkey Kong 2023-07-25 12:41:38 +09:30
parent d59a5f0faa
commit 7dc57b67a1
90 changed files with 3168 additions and 1462 deletions

View File

@ -191,10 +191,10 @@ endef
### Flags ###
# Build tool flags
CFLAGS := -c -Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm -signed $(OPT_FLAGS) $(MIPSBIT) -D_FINALROM -DF3DEX2_GBI
CFLAGS := -c -Wab,-r4300_mul -non_shared -G 0 -Xcpluscomm -signed $(OPT_FLAGS) $(MIPSBIT) -D_FINALROM -DF3DEX_GBI_2 -DTARGET_N64
CFLAGS += -woff 649,838,807
CPPFLAGS := -D_FINALROM -DN_MICRO -DF3DEX_GBI_2x
INCLUDE_CFLAGS := -I . -I include -I include/2.0L -I include/2.0L/PR
INCLUDE_CFLAGS := -I . -I include -I include/2.0L -I include/2.0L/PR -I include/libc
OPT_FLAGS := -O2
MIPSBIT := -mips2
ASFLAGS := -EB -mtune=vr4300 -march=vr4300 -mabi=32 -I include

0
include/2.0L/PR/R4300.h Executable file → Normal file
View File

674
include/2.0L/PR/abi.h Executable file → Normal file
View File

@ -1,23 +1,23 @@
#ifndef _ABI_H_
#define _ABI_H_
#define _ABI_H_
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
* *
**************************************************************************/
/**************************************************************************
*
* $Revision: 1.32 $
* $Date: 1997/02/11 08:16:37 $
* $Source: /disk6/Master/cvsmdev2/PR/include/abi.h,v $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/abi.h,v $
*
**************************************************************************/
@ -31,19 +31,19 @@
*/
/* Audio commands: */
#define A_SPNOOP 0
#define A_ADPCM 1
#define A_CLEARBUFF 2
#define A_ENVMIXER 3
#define A_LOADBUFF 4
#define A_RESAMPLE 5
#define A_SAVEBUFF 6
#define A_SEGMENT 7
#define A_SETBUFF 8
#define A_SETVOL 9
#define A_SPNOOP 0
#define A_ADPCM 1
#define A_CLEARBUFF 2
#define A_ENVMIXER 3
#define A_LOADBUFF 4
#define A_RESAMPLE 5
#define A_SAVEBUFF 6
#define A_SEGMENT 7
#define A_SETBUFF 8
#define A_SETVOL 9
#define A_DMEMMOVE 10
#define A_LOADADPCM 11
#define A_MIXER 12
#define A_MIXER 12
#define A_INTERLEAVE 13
#define A_POLEF 14
#define A_SETLOOP 15
@ -53,18 +53,18 @@
* Audio flags
*/
#define A_INIT 0x01
#define A_CONTINUE 0x00
#define A_INIT 0x01
#define A_CONTINUE 0x00
#define A_LOOP 0x02
#define A_OUT 0x02
#define A_LEFT 0x02
#define A_RIGHT 0x00
#define A_VOL 0x04
#define A_RATE 0x00
#define A_AUX 0x08
#define A_NOAUX 0x00
#define A_MAIN 0x00
#define A_MIX 0x10
#define A_LEFT 0x02
#define A_RIGHT 0x00
#define A_VOL 0x04
#define A_RATE 0x00
#define A_AUX 0x08
#define A_NOAUX 0x00
#define A_MAIN 0x00
#define A_MIX 0x10
/*
* BEGIN C-specific section: (typedef's)
@ -76,134 +76,134 @@
*/
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int gain:16;
unsigned int addr;
unsigned int cmd:8;
unsigned int flags:8;
unsigned int gain:16;
unsigned int addr;
} Aadpcm;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int gain:16;
unsigned int addr;
unsigned int cmd:8;
unsigned int flags:8;
unsigned int gain:16;
unsigned int addr;
} Apolef;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pad1:16;
unsigned int addr;
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pad1:16;
unsigned int addr;
} Aenvelope;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int dmem:16;
unsigned int pad2:16;
unsigned int count:16;
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int dmem:16;
unsigned int pad2:16;
unsigned int count:16;
} Aclearbuff;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int pad2:16;
unsigned int inL:16;
unsigned int inR:16;
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int pad2:16;
unsigned int inL:16;
unsigned int inR:16;
} Ainterleave;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:24;
unsigned int addr;
unsigned int cmd:8;
unsigned int pad1:24;
unsigned int addr;
} Aloadbuff;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pad1:16;
unsigned int addr;
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pad1:16;
unsigned int addr;
} Aenvmixer;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int gain:16;
unsigned int dmemi:16;
unsigned int dmemo:16;
unsigned int cmd:8;
unsigned int flags:8;
unsigned int gain:16;
unsigned int dmemi:16;
unsigned int dmemo:16;
} Amixer;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int dmem2:16;
unsigned int addr;
unsigned int cmd:8;
unsigned int flags:8;
unsigned int dmem2:16;
unsigned int addr;
} Apan;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pitch:16;
unsigned int addr;
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pitch:16;
unsigned int addr;
} Aresample;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pad1:16;
unsigned int addr;
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pad1:16;
unsigned int addr;
} Areverb;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:24;
unsigned int addr;
unsigned int cmd:8;
unsigned int pad1:24;
unsigned int addr;
} Asavebuff;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:24;
unsigned int pad2:2;
unsigned int number:4;
unsigned int base:24;
unsigned int cmd:8;
unsigned int pad1:24;
unsigned int pad2:2;
unsigned int number:4;
unsigned int base:24;
} Asegment;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int dmemin:16;
unsigned int dmemout:16;
unsigned int count:16;
unsigned int cmd:8;
unsigned int flags:8;
unsigned int dmemin:16;
unsigned int dmemout:16;
unsigned int count:16;
} Asetbuff;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int vol:16;
unsigned int voltgt:16;
unsigned int volrate:16;
unsigned int cmd:8;
unsigned int flags:8;
unsigned int vol:16;
unsigned int voltgt:16;
unsigned int volrate:16;
} Asetvol;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int dmemin:16;
unsigned int dmemout:16;
unsigned int count:16;
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int dmemin:16;
unsigned int dmemout:16;
unsigned int count:16;
} Admemmove;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int count:16;
unsigned int addr;
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int count:16;
unsigned int addr;
} Aloadadpcm;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int pad2:16;
unsigned int addr;
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int pad2:16;
unsigned int addr;
} Asetloop;
/*
@ -211,38 +211,38 @@ typedef struct {
*/
typedef struct {
unsigned int w0;
unsigned int w1;
uintptr_t w0;
uintptr_t w1;
} Awords;
typedef union {
Awords words;
Aadpcm adpcm;
Apolef polef;
Aclearbuff clearbuff;
Aenvelope envelope;
Ainterleave interleave;
Aloadbuff loadbuff;
Aenvmixer envmixer;
Aresample resample;
Areverb reverb;
Asavebuff savebuff;
Asegment segment;
Asetbuff setbuff;
Asetvol setvol;
Admemmove dmemmove;
Aloadadpcm loadadpcm;
Amixer mixer;
Asetloop setloop;
long long int force_union_align; /* dummy, force alignment */
Awords words;
#if IS_BIG_ENDIAN && !IS_64_BIT
Aadpcm adpcm;
Apolef polef;
Aclearbuff clearbuff;
Aenvelope envelope;
Ainterleave interleave;
Aloadbuff loadbuff;
Aenvmixer envmixer;
Aresample resample;
Areverb reverb;
Asavebuff savebuff;
Asegment segment;
Asetbuff setbuff;
Asetvol setvol;
Admemmove dmemmove;
Aloadadpcm loadadpcm;
Amixer mixer;
Asetloop setloop;
#endif
long long int force_union_align; /* dummy, force alignment */
} Acmd;
/*
* ADPCM State
*/
#define ADPCMVSIZE 8
#define ADPCMFSIZE 16
typedef short ADPCM_STATE[ADPCMFSIZE];
typedef short ADPCM_STATE[16];
/*
* Pole filter state
@ -258,7 +258,7 @@ typedef short RESAMPLE_STATE[16];
* Resampler constants
*/
#define UNITY_PITCH 0x8000
#define MAX_RATIO 1.99996 /* within .03 cents of +1 octave */
#define MAX_RATIO 1.99996 /* within .03 cents of +1 octave */
/*
* Enveloper/Mixer state
@ -269,142 +269,354 @@ typedef short ENVMIX_STATE[40];
* Macros to assemble the audio command list
*/
#define aADPCMdec(pkt, f, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_ADPCM, 24, 8) | _SHIFTL(f, 16, 8); \
_a->words.w1 = (unsigned int)(s); \
/*
* Info about parameters:
*
* A "count" in the following macros is always measured in bytes.
*
* All volumes/gains are in Q1.15 signed fixed point numbers:
* 0x8000 is the minimum volume (-100%), negating the audio curve.
* 0x0000 is silent.
* 0x7fff is maximum volume (99.997%).
*
* All DRAM addresses refer to segmented addresses. A segment table shall
* first be set up by calling aSegment for each segment. When a DRAM
* address is later used as parameter, the 8 high bits will be an index
* to the segment table and the lower 24 bits are added to the base address
* stored in the segment table for this entry. The result is the physical address.
*
* Transfers to/from DRAM are executed using DMA and hence follow these restrictions:
* All DRAM addresses should be aligned by 8 bytes, or they will be
* rounded down to the nearest multiple of 8 bytes.
* All DRAM lengths should be aligned by 8 bytes, or they will be
* rounded up to the nearest multiple of 8 bytes.
*/
/*
* Decompresses ADPCM data.
* Possible flags: A_INIT and A_LOOP.
*
* First set up internal data in DMEM:
* aLoadADPCM(cmd++, nEntries * 16, physicalAddressOfBook)
* aSetLoop(cmd++, physicalAddressOfLoopState) (if A_LOOP is set)
*
* Then before this command, call:
* aSetBuffer(cmd++, 0, in, out, count)
*
* Note: count will be rounded up to the nearest multiple of 32 bytes.
*
* ADPCM decompression works on a block of 16 (uncompressed) samples.
* The previous 2 samples and 9 bytes of input are decompressed to
* 16 new samples using the code book previously loaded.
*
* Before the algorithm starts, the previous 16 samples are loaded according to flag:
* A_INIT: all zeros
* A_LOOP: the address set by aSetLoop
* no flags: the DRAM address in the s parameter
* These 16 samples are immediately copied to the destination address.
*
* The result of "count" bytes will be written after these 16 initial samples.
* The last 16 samples written to the destination will also be written to
* the state address in DRAM.
*/
#define aADPCMdec(pkt, f, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_ADPCM, 24, 8) | _SHIFTL(f, 16, 8); \
_a->words.w1 = (uintptr_t)(s); \
}
#define aPoleFilter(pkt, f, g, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_POLEF, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(g, 0, 16)); \
_a->words.w1 = (unsigned int)(s); \
/*
* Not used in SM64.
*/
#define aPoleFilter(pkt, f, g, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_POLEF, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(g, 0, 16)); \
_a->words.w1 = (uintptr_t)(s); \
}
#define aClearBuffer(pkt, d, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_CLEARBUFF, 24, 8) | _SHIFTL(d, 0, 24); \
_a->words.w1 = (unsigned int)(c); \
/*
* Clears DMEM data, where d is address and c is count, by writing zeros.
*
* Note: c is rounded up to the nearest multiple of 16 bytes.
*/
#define aClearBuffer(pkt, d, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_CLEARBUFF, 24, 8) | _SHIFTL(d, 0, 24); \
_a->words.w1 = (uintptr_t)(c); \
}
#define aEnvMixer(pkt, f, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_ENVMIXER, 24, 8) | _SHIFTL(f, 16, 8); \
_a->words.w1 = (unsigned int)(s); \
/*
* Mixes an envelope with mono sound into 2 or 4 channels.
* Possible flags: A_INIT, A_AUX (indicates that 4 channels should be used).
*
* Before this command, call:
* aSetBuffer(cmd++, 0, inBuf, dryLeft, count)
* aSetBuffer(cmd++, A_AUX, dryRight, wetLeft, wetRight)
*
* The first time (A_INIT is set), volume also needs to be set:
* aSetVolume(cmd++, A_VOL | A_LEFT, initialVolumeLeft, 0, 0)
* aSetVolume(cmd++, A_VOL | A_RIGHT, initialVolumeRight, 0, 0)
* aSetVolume32(cmd++, A_RATE | A_LEFT, targetVolumeLeft, rampLeft)
* aSetVolume32(cmd++, A_RATE | A_RIGHT, targetVolumeRight, rampRight)
* aSetVolume(cmd++, A_AUX, dryVolume, 0, wetVolume)
*
* This command will now mix samples in inBuf into the destination buffers (dry and wet),
* but with the volume increased (or decreased) from initial volumes to target volumes,
* with the specified ramp rate. Once the target volume is reached, the volume stays
* at that level. Before the samples are finally mixed (added) into the destination
* buffers (dry and wet), the volume is changed according to dryVolume and wetVolume.
*
* Note: count will be rounded up to the nearest multiple of 16 bytes.
* Note: the wet channels are used for reverb.
*
*/
#define aEnvMixer(pkt, f, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_ENVMIXER, 24, 8) | _SHIFTL(f, 16, 8); \
_a->words.w1 = (uintptr_t)(s); \
}
#define aInterleave(pkt, l, r) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_INTERLEAVE, 24, 8); \
_a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \
/*
* Interleaves two mono channels into stereo.
*
* First call:
* aSetBuffer(cmd++, 0, 0, output, count)
*
* The count refers to the size of the output.
* A left sample will be placed before the right sample.
*
* Note: count will be rounded up to the nearest multiple of 16 bytes.
*/
#define aInterleave(pkt, l, r) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_INTERLEAVE, 24, 8); \
_a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \
}
#define aLoadBuffer(pkt, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8); \
_a->words.w1 = (unsigned int)(s); \
/*
* Loads a buffer from DRAM to DMEM.
*
* First call:
* aSetBuffer(cmd++, 0, in, 0, count)
*
* The in parameter to aSetBuffer is the destination in DMEM and the
* s parameter to this command is the source in DRAM.
*/
#define aLoadBuffer(pkt, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8); \
_a->words.w1 = (uintptr_t)(s); \
}
#define aMix(pkt, f, g, i, o) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_MIXER, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(g, 0, 16)); \
_a->words.w1 = _SHIFTL(i,16, 16) | _SHIFTL(o, 0, 16); \
/*
* Mixes audio.
* Possible flags: no flags used, although parameter present.
*
* First call:
* aSetBuffer(cmd++, 0, 0, 0, count)
*
* Input and output addresses are taken from the i and o parameters.
* The volume with which the input is changed is taken from the g parameter.
* After the volume of the input samples have been changed, the result
* is added to the output.
*
* Note: count will be rounded up to the nearest multiple of 32 bytes.
*/
#define aMix(pkt, f, g, i, o) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_MIXER, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(g, 0, 16)); \
_a->words.w1 = _SHIFTL(i,16, 16) | _SHIFTL(o, 0, 16); \
}
#define aPan(pkt, f, d, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_PAN, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(d, 0, 16)); \
_a->words.w1 = (unsigned int)(s); \
// Not present in the audio microcode.
#define aPan(pkt, f, d, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_PAN, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(d, 0, 16)); \
_a->words.w1 = (uintptr_t)(s); \
}
#define aResample(pkt, f, p, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_RESAMPLE, 24, 8) | _SHIFTL(f, 16, 8) |\
_SHIFTL(p, 0, 16)); \
_a->words.w1 = (unsigned int)(s); \
/*
* Resamples audio.
* Possible flags: A_INIT, A_OUT? (not used in SM64).
*
* First call:
* aSetBuffer(cmd++, 0, in, out, count)
*
* This command resamples the audio using the given frequency ratio (pitch)
* using a filter that uses a window of 4 source samples. This can be used
* either for just resampling audio to be able to be played back at a different
* sample rate, or to change the pitch if the result is played back at
* the same sample rate as the input.
*
* The frequency ratio is given in UQ1.15 fixed point format.
* For no change in frequency, use pitch 0x8000.
* For 1 octave up or downsampling to (roughly) half number of samples, use pitch 0xffff.
* For 1 octave down or upsampling to double as many samples, use pitch 0x4000.
*
* Note: count represents the number of output samples and is rounded up to
* the nearest multiple of 16 bytes.
*
* The state consists of the four following source samples when the algorithm stopped as
* well as a fractional position, and is initialized to all zeros if A_INIT is given.
* Otherwise it is loaded from DRAM at address s.
*
* The algorithm starts by writing the four source samples from the state (or zero)
* to just before the input address given. It then creates one output sample by examining
* the four next source samples and then moving the source position zero or more
* samples forward. The first output sample (when A_INIT is given) is always 0.
*
* When "count" samples have been written, the following four source samples
* are written to the state in DRAM as well as a fractional position.
*/
#define aResample(pkt, f, p, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_RESAMPLE, 24, 8) | _SHIFTL(f, 16, 8) |\
_SHIFTL(p, 0, 16)); \
_a->words.w1 = (uintptr_t)(s); \
}
#define aSaveBuffer(pkt, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_SAVEBUFF, 24, 8); \
_a->words.w1 = (unsigned int)(s); \
/*
* Stores a buffer in DMEM to DRAM.
*
* First call:
* aSetBuffer(cmd++, 0, 0, out, count)
*
* The out parameter to aSetBuffer is the source in DMEM and the
* s parameter to this command is the destination in DRAM.
*/
#define aSaveBuffer(pkt, s) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_SAVEBUFF, 24, 8); \
_a->words.w1 = (uintptr_t)(s); \
}
#define aSegment(pkt, s, b) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_SEGMENT, 24, 8); \
_a->words.w1 = _SHIFTL(s, 24, 8) | _SHIFTL(b, 0, 24); \
/*
* Sets up an entry in the segment table.
*
* The s parameter is a segment index, 0 to 15.
* The b parameter is the base offset.
*/
#define aSegment(pkt, s, b) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_SEGMENT, 24, 8); \
_a->words.w1 = _SHIFTL(s, 24, 8) | _SHIFTL(b, 0, 24); \
}
#define aSetBuffer(pkt, f, i, o, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_SETBUFF, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(i, 0, 16)); \
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
/*
* Sets internal DMEM buffer addresses used for later commands.
* See each command for how to use aSetBuffer.
*/
#define aSetBuffer(pkt, f, i, o, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_SETBUFF, 24, 8) | _SHIFTL(f, 16, 8) | \
_SHIFTL(i, 0, 16)); \
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
}
#define aSetVolume(pkt, f, v, t, r) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | \
_SHIFTL(v, 0, 16)); \
_a->words.w1 = _SHIFTL(t, 16, 16) | _SHIFTL(r, 0, 16); \
/*
* Sets internal volume parameters.
* See aEnvMixer for more info.
*/
#define aSetVolume(pkt, f, v, t, r) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | \
_SHIFTL(v, 0, 16)); \
_a->words.w1 = _SHIFTL(t, 16, 16) | _SHIFTL(r, 0, 16); \
}
/*
* Sets the address to ADPCM loop state.
*
* The a parameter is a DRAM address.
* See aADPCMdec for more info.
*/
#define aSetLoop(pkt, a) \
{ \
Acmd *_a = (Acmd *)pkt; \
_a->words.w0 = _SHIFTL(A_SETLOOP, 24, 8); \
_a->words.w1 = (unsigned int)(a); \
}
#define aDMEMMove(pkt, i, o, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_DMEMMOVE, 24, 8) | _SHIFTL(i, 0, 24); \
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
_a->words.w1 = (uintptr_t)(a); \
}
#define aLoadADPCM(pkt, c, d) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_LOADADPCM, 24, 8) | _SHIFTL(c, 0, 24); \
_a->words.w1 = (unsigned int) d; \
/*
* Copies memory in DMEM.
*
* Copies c bytes from address i to address o.
*
* Note: count is rounded up to the nearest multiple of 16 bytes.
*
* Note: This acts as memcpy where 16 bytes are moved at a time, therefore
* if input and output overlap, output address should be less than input address.
*/
#define aDMEMMove(pkt, i, o, c) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_DMEMMOVE, 24, 8) | _SHIFTL(i, 0, 24); \
_a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
}
/*
* Loads ADPCM book from DRAM into DMEM.
*
* This command loads ADPCM table entries from DRAM to DMEM.
*
* The count parameter c should be a multiple of 16 bytes.
* The d parameter is a DRAM address.
*/
#define aLoadADPCM(pkt, c, d) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = _SHIFTL(A_LOADADPCM, 24, 8) | _SHIFTL(c, 0, 24); \
_a->words.w1 = (uintptr_t) d; \
}
// This is a version of aSetVolume which takes a single 32-bit parameter
// instead of two 16-bit ones. According to AziAudio, it is used to set
// ramping values when neither bit 4 nor bit 8 is set in the flags parameter.
// It does not appear in the official abi.h header.
/*
* Sets internal volume parameters.
* See aEnvMixer for more info.
*/
#define aSetVolume32(pkt, f, v, tr) \
{ \
Acmd *_a = (Acmd *)pkt; \
\
_a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | \
_SHIFTL(v, 0, 16)); \
_a->words.w1 = (uintptr_t)(tr); \
}
#endif /* _LANGUAGE_C */
#endif /* !_ABI_H_ */

1242
include/2.0L/PR/gbi.h Executable file → Normal file

File diff suppressed because it is too large Load Diff

202
include/2.0L/PR/gs2dex.h Executable file → Normal file
View File

@ -6,7 +6,7 @@
Modified by
Comments Header file for S2DEX ucode.
$Id: gs2dex.h,v 1.15 1997/10/17 08:19:07 yasu Exp $
$Id: gs2dex.h,v 1.21 1998/05/28 00:14:49 has Exp $
---------------------------------------------------------------------*/
#ifndef _GS2DEX_H_
@ -16,6 +16,8 @@
extern "C" {
#endif
#include <PR/ultratypes.h>
/*===========================================================================*
* Macro
*===========================================================================*/
@ -38,66 +40,65 @@ extern "C" {
/* Non scalable background plane */
typedef struct {
u16 imageX; /* The x-coordinate of the upper-left position of the texture. (u11.5)*/
u16 imageW; /* The width of the texture. (u10.2)*/
s16 frameX; /* The upper-left position of the transferred frame. (s10.2)*/
u16 frameW; /* The width of the transferred frame. (u10.2)*/
u16 imageX; /* x-coordinate of upper-left position of texture (u10.5) */
u16 imageW; /* width of the texture (u10.2) */
s16 frameX; /* upper-left position of transferred frame (s10.2) */
u16 frameW; /* width of transferred frame (u10.2) */
u16 imageY; /* The y-coordinate of the upper-left position of the texture. (u11.5)*/
u16 imageH; /* The height of the texture. (u10.2)*/
s16 frameY; /* The upper-left position of the transferred frame. (s10.2)*/
u16 frameH; /* The height of the transferred frame. (u10.2)*/
u16 imageY; /* y-coordinate of upper-left position of texture (u10.5) */
u16 imageH; /* height of the texture (u10.2) */
s16 frameY; /* upper-left position of transferred frame (s10.2) */
u16 frameH; /* height of transferred frame (u10.2) */
u64 *imagePtr; /* The texture source address on DRAM. */
u16 imageLoad; /* Which to use, LoadBlock or LoadTile? */
u8 imageFmt; /* The format of the texel. G_IM_FMT_* */
u8 imageSiz; /* The size of the texel G_IM_SIZ_* */
u16 imagePal; /* The pallet number. */
u16 imageFlip; /* The right & left inversion of the image. Inverted by G_BG_FLAG_FLIPS*/
u64 *imagePtr; /* texture source address on DRAM */
u16 imageLoad; /* which to use, LoadBlock or LoadTile */
u8 imageFmt; /* format of texel - G_IM_FMT_* */
u8 imageSiz; /* size of texel - G_IM_SIZ_* */
u16 imagePal; /* pallet number */
u16 imageFlip; /* right & left image inversion (Inverted by G_BG_FLAG_FLIPS) */
/* Because the following are set in the initialization routine guS2DInitBg(), the user doesn't
have to set it.*/
u16 tmemW; /* The TMEM width and Work size of the frame 1 line.
/* The following is set in the initialization routine guS2DInitBg(). There is no need for the user to set it. */
u16 tmemW; /* TMEM width and Word size of frame 1 line.
At LoadBlock, GS_PIX2TMEM(imageW/4,imageSiz)
At LoadTile GS_PIX2TMEM(frameW/4,imageSiz)+1 */
u16 tmemH; /* The height of TMEM loadable at a time. (s13.2) The 4 times value.
When the normal texture, 512/tmemW*4
When the CI texture, 256/tmemW*4 */
u16 tmemLoadSH; /* The SH value
At LoadBlock, tmemSize/2-1
At LoadTile, tmemW*16-1 */
u16 tmemLoadTH; /* The TH value or the Stride value
At LoadBlock, GS_CALC_DXT(tmemW)
At LoadTile, tmemH-1 */
u16 tmemSizeW; /* The skip value of imagePtr for image 1-line.
At LoadTile GS_PIX2TMEM(frameW/4,imageSiz)+1 */
u16 tmemH; /* height of TMEM loadable at a time (s13.2) 4 times value
When the normal texture, 512/tmemW*4
When the CI texture, 256/tmemW*4 */
u16 tmemLoadSH; /* SH value
At LoadBlock, tmemSize/2-1
At LoadTile, tmemW*16-1 */
u16 tmemLoadTH; /* TH value or Stride value
At LoadBlock, GS_CALC_DXT(tmemW)
At LoadTile, tmemH-1 */
u16 tmemSizeW; /* skip value of imagePtr for image 1-line
At LoadBlock, tmemW*2
At LoadTile, GS_PIX2TMEM(imageW/4,imageSiz)*2 */
u16 tmemSize; /* The skip value of imagePtr for 1-loading.
= tmemSizeW*tmemH */
At LoadTile, GS_PIX2TMEM(imageW/4,imageSiz)*2 */
u16 tmemSize; /* skip value of imagePtr for 1-loading
= tmemSizeW*tmemH */
} uObjBg_t; /* 40 bytes */
/* Scalable background plane */
typedef struct {
u16 imageX; /* The x-coordinate of the upper-left position of the texture. (u11.5)*/
u16 imageW; /* The width of the texture. (u10.2)*/
s16 frameX; /* The upper-left position of the transferred frame. (s10.2)*/
u16 frameW; /* The width of the transferred frame. (u10.2)*/
u16 imageX; /* x-coordinate of upper-left position of texture (u10.5) */
u16 imageW; /* width of texture (u10.2) */
s16 frameX; /* upper-left position of transferred frame (s10.2) */
u16 frameW; /* width of transferred frame (u10.2) */
u16 imageY; /* The y-coordinate of the upper-left position of the texture. (u11.5)*/
u16 imageH; /* The height of the texture. (u10.2)*/
s16 frameY; /* The upper-left position of the transferred frame. (s10.2)*/
u16 frameH; /* The height of the transferred frame. (u10.2)*/
u16 imageY; /* y-coordinate of upper-left position of texture (u10.5) */
u16 imageH; /* height of texture (u10.2) */
s16 frameY; /* upper-left position of transferred frame (s10.2) */
u16 frameH; /* height of transferred frame (u10.2) */
u64 *imagePtr; /* The texture source address on DRAM. */
u16 imageLoad; /* Which to use, LoadBlock or LoadTile? */
u8 imageFmt; /* The format of the texel. G_IM_FMT_* */
u8 imageSiz; /* The size of the texel G_IM_SIZ_* */
u16 imagePal; /* The pallet number. */
u16 imageFlip; /* The right & left inversion of the image. Inverted by G_BG_FLAG_FLIPS*/
u64 *imagePtr; /* texture source address on DRAM */
u16 imageLoad; /* Which to use, LoadBlock or LoadTile? */
u8 imageFmt; /* format of texel - G_IM_FMT_* */
u8 imageSiz; /* size of texel - G_IM_SIZ_* */
u16 imagePal; /* pallet number */
u16 imageFlip; /* right & left image inversion (Inverted by G_BG_FLAG_FLIPS) */
u16 scaleW; /* The scale value of the X-direction. (u5.10)*/
u16 scaleH; /* The scale value of the Y-direction. (u5.10)*/
s32 imageYorig; /* The start point of drawing on the image. (s20.5)*/
u16 scaleW; /* scale value of X-direction (u5.10) */
u16 scaleH; /* scale value of Y-direction (u5.10) */
s32 imageYorig; /* start point of drawing on image (s20.5) */
u8 padding[4];
@ -112,24 +113,24 @@ typedef union {
/*---------------------------------------------------------------------------*
* 2D Objects
*---------------------------------------------------------------------------*/
#define G_OBJ_FLAG_FLIPS 1<<0 /* The inversion to the S-direction. */
#define G_OBJ_FLAG_FLIPT 1<<4 /* The inversion to the T-direction. */
#define G_OBJ_FLAG_FLIPS 1<<0 /* inversion to S-direction */
#define G_OBJ_FLAG_FLIPT 1<<4 /* nversion to T-direction */
typedef struct {
s16 objX; /* The x-coordinate of the upper-left end. s10.2 OBJ */
u16 scaleW; /* Scaling of the u5.10 width direction. */
u16 imageW; /* The width of the u10.5 texture. (The length of the S-direction.) */
u16 paddingX; /* Unused. Always 0. */
s16 objY; /* The y-coordinate of the s10.2 OBJ upper-left end. */
u16 scaleH; /* Scaling of the u5.10 height direction. */
u16 imageH; /* The height of the u10.5 texture. (The length of the T-direction.)*/
u16 paddingY; /* Unused. Always 0. */
u16 imageStride; /* The folding width of the texel. (In units of 64bit word.) */
u16 imageAdrs; /* The texture header position in TMEM. (In units of 64bit word.) */
u8 imageFmt; /* The format of the texel. G_IM_FMT_* */
u8 imageSiz; /* The size of the texel. G_IM_SIZ_* */
u8 imagePal; /*The pallet number. 0-7 */
u8 imageFlags; /* The display flag. G_OBJ_FLAG_FLIP* */
s16 objX; /* s10.2 OBJ x-coordinate of upper-left end */
u16 scaleW; /* u5.10 Scaling of u5.10 width direction */
u16 imageW; /* u10.5 width of u10.5 texture (length of S-direction) */
u16 paddingX; /* Unused - Always 0 */
s16 objY; /* s10.2 OBJ y-coordinate of s10.2 OBJ upper-left end */
u16 scaleH; /* u5.10 Scaling of u5.10 height direction */
u16 imageH; /* u10.5 height of u10.5 texture (length of T-direction) */
u16 paddingY; /* Unused - Always 0 */
u16 imageStride; /* folding width of texel (In units of 64bit word) */
u16 imageAdrs; /* texture header position in TMEM (In units of 64bit word) */
u8 imageFmt; /* format of texel - G_IM_FMT_* */
u8 imageSiz; /* size of texel - G_IM_SIZ_* */
u8 imagePal; /* pallet number (0-7) */
u8 imageFlags; /* The display flag - G_OBJ_FLAG_FLIP* */
} uObjSprite_t; /* 24 bytes */
typedef union {
@ -174,12 +175,12 @@ typedef union {
#define GS_TB_TLINE(pix,siz) (GS_CALC_DXT(GS_PIX2TMEM((pix),(siz))))
typedef struct {
u32 type; /* G_OBJLT_TXTRBLOCK divided into types. */
u64 *image; /* The texture source address on DRAM. */
u16 tmem; /* The transferred TMEM word address. (8byteWORD) */
u16 tsize; /* The Texture size. Specified by the macro GS_TB_TSIZE(). */
u16 tline; /* The width of the Texture 1-line. Specified by the macro GS_TB_TLINE()*/
u16 sid; /* STATE ID Multipled by 4. Either one of 0,4,8 and 12. */
u32 type; /* G_OBJLT_TXTRBLOCK divided into types */
u64 *image; /* texture source address on DRAM */
u16 tmem; /* loaded TMEM word address (8byteWORD) */
u16 tsize; /* Texture size, Specified by macro GS_TB_TSIZE() */
u16 tline; /* width of Texture 1-line, Specified by macro GS_TB_TLINE() */
u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12) */
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrBlock_t; /* 24 bytes */
@ -188,12 +189,12 @@ typedef struct {
#define GS_TT_THEIGHT(pix,siz) (((pix)<<2)-1)
typedef struct {
u32 type; /* G_OBJLT_TXTRTILE divided into types. */
u64 *image; /* The texture source address on DRAM. */
u16 tmem; /* The loaded texture source address on DRAM. (8byteWORD) */
u16 twidth; /* The width of the Texture. Specified by the macro GS_TT_TWIDTH() */
u16 theight; /* The height of the Texture. Specified by the macro GS_TT_THEIGHT()*/
u16 sid; /* STATE ID Multiplied by 4. Either one of 0,4,8 and 12. */
u32 type; /* G_OBJLT_TXTRTILE divided into types */
u64 *image; /* texture source address on DRAM */
u16 tmem; /* loaded TMEM word address (8byteWORD)*/
u16 twidth; /* width of Texture (Specified by macro GS_TT_TWIDTH()) */
u16 theight; /* height of Texture (Specified by macro GS_TT_THEIGHT()) */
u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12) */
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrTile_t; /* 24 bytes */
@ -202,12 +203,12 @@ typedef struct {
#define GS_PAL_NUM(num) ((num)-1)
typedef struct {
u32 type; /* G_OBJLT_TLUT divided into types. */
u64 *image; /* the texture source address on DRAM. */
u16 phead; /* The pallet number of the load header. Between 256 and 511. */
u16 pnum; /* The loading pallet number -1. */
u16 zero; /* Assign 0 all the time. */
u16 sid; /* STATE ID Multiplied by 4. Either one of 0,4,8 and 12. */
u32 type; /* G_OBJLT_TLUT divided into types */
u64 *image; /* texture source address on DRAM */
u16 phead; /* pallet number of load header (Between 256 and 511) */
u16 pnum; /* loading pallet number -1 */
u16 zero; /* Assign 0 all the time */
u16 sid; /* STATE ID Multipled by 4 (Either one of 0, 4, 8 and 12)*/
u32 flag; /* STATE flag */
u32 mask; /* STATE mask */
} uObjTxtrTLUT_t; /* 24 bytes */
@ -231,6 +232,21 @@ typedef struct {
* GBI Commands for S2DEX microcode
*===========================================================================*/
/* GBI Header */
#ifdef F3DEX_GBI_2
#define G_OBJ_RECTANGLE_R 0xda
#define G_OBJ_MOVEMEM 0xdc
#define G_RDPHALF_0 0xe4
#define G_OBJ_RECTANGLE 0x01
#define G_OBJ_SPRITE 0x02
#define G_SELECT_DL 0x04
#define G_OBJ_LOADTXTR 0x05
#define G_OBJ_LDTX_SPRITE 0x06
#define G_OBJ_LDTX_RECT 0x07
#define G_OBJ_LDTX_RECT_R 0x08
#define G_BG_1CYC 0x09
#define G_BG_COPY 0x0a
#define G_OBJ_RENDERMODE 0x0b
#else
#define G_BG_1CYC 0x01
#define G_BG_COPY 0x02
#define G_OBJ_RECTANGLE 0x03
@ -244,7 +260,7 @@ typedef struct {
#define G_OBJ_LDTX_RECT 0xc3
#define G_OBJ_LDTX_RECT_R 0xc4
#define G_RDPHALF_0 0xe4
#endif
/*---------------------------------------------------------------------------*
* Background wrapped screen
@ -305,7 +321,7 @@ typedef struct {
/*---------------------------------------------------------------------------*
* Set general status
*---------------------------------------------------------------------------*/
#define G_MW_GENSTAT 0x08 /* Note that it is the same value of G_MW_FOG. */
#define G_MW_GENSTAT 0x08 /* Note that it is the same value of G_MW_FOG */
#define gSPSetStatus(pkt, sid, val) \
gMoveWd((pkt), G_MW_GENSTAT, (sid), (val))
@ -352,9 +368,21 @@ extern u64 gspS2DEX_fifoTextStart[], gspS2DEX_fifoTextEnd[];
extern u64 gspS2DEX_fifoDataStart[], gspS2DEX_fifoDataEnd[];
extern u64 gspS2DEX_fifo_dTextStart[], gspS2DEX_fifo_dTextEnd[];
extern u64 gspS2DEX_fifo_dDataStart[], gspS2DEX_fifo_dDataEnd[];
extern u64 gspS2DEX2_fifoTextStart[], gspS2DEX2_fifoTextEnd[];
extern u64 gspS2DEX2_fifoDataStart[], gspS2DEX2_fifoDataEnd[];
extern u64 gspS2DEX2_xbusTextStart[], gspS2DEX2_xbusTextEnd[];
extern u64 gspS2DEX2_xbusDataStart[], gspS2DEX2_xbusDataEnd[];
extern void guS2DInitBg(uObjBg *);
extern void guS2DEmuSetScissor(u32, u32, u32, u32, u8);
extern void guS2DEmuBgRect1Cyc(Gfx **, uObjBg *);
#ifdef F3DEX_GBI_2
# define guS2DEmuBgRect1Cyc guS2D2EmuBgRect1Cyc /*Wrapper*/
# define guS2DEmuSetScissor guS2D2EmuSetScissor /*Wrapper*/
extern void guS2D2EmuSetScissor(u32, u32, u32, u32, u8);
extern void guS2D2EmuBgRect1Cyc(Gfx **, uObjBg *);
#else
extern void guS2DEmuSetScissor(u32, u32, u32, u32, u8);
extern void guS2DEmuBgRect1Cyc(Gfx **, uObjBg *);
#endif
#ifdef _LANGUAGE_C_PLUS_PLUS
}

77
include/2.0L/PR/gu.h Executable file → Normal file
View File

@ -1,49 +1,14 @@
#ifndef _GU_H_
#define _GU_H_
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/**************************************************************************
*
* $Revision: 1.46 $
* $Date: 1997/11/26 00:30:53 $
* $Source: /disk6/Master/cvsmdev2/PR/include/gu.h,v $
*
**************************************************************************/
#ifndef _ULTRA64_GU_H_
#define _ULTRA64_GU_H_
#include <PR/mbi.h>
#include <PR/ultratypes.h>
#include <PR/sptask.h>
#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
#endif
#define M_PI 3.14159265358979323846
#define M_DTOR (3.14159265358979323846/180.0)
#define FTOFIX32(x) (long)((x) * (float)0x00010000)
#define FIX32TOF(x) ((float)(x) * (1.0f / (float)0x00010000))
#define FTOFRAC8(x) ((int) MIN(((x) * (128.0f)), 127.0f) & 0xff)
#define FILTER_WRAP 0
#define FILTER_CLAMP 1
#define RAND(x) (guRandom()%x) /* random number between 0 to x */
#define GU_PI 3.1415926
/*
* Data Structures
*/
@ -69,21 +34,21 @@ typedef struct {
* Function Prototypes
*/
extern int guLoadTextureBlockMipMap(Gfx **glist, unsigned char *tbuf, Image *im,
unsigned char startTile, unsigned char pal, unsigned char cms,
unsigned char cmt, unsigned char masks, unsigned char maskt,
unsigned char shifts, unsigned char shiftt, unsigned char cfs,
unsigned char cft);
// extern int guLoadTextureBlockMipMap(Gfx **glist, unsigned char *tbuf, Image *im,
// unsigned char startTile, unsigned char pal, unsigned char cms,
// unsigned char cmt, unsigned char masks, unsigned char maskt,
// unsigned char shifts, unsigned char shiftt, unsigned char cfs,
// unsigned char cft);
extern int guGetDPLoadTextureTileSz (int ult, int lrt);
extern void guDPLoadTextureTile (Gfx *glistp, void *timg,
int texl_fmt, int texl_size,
int img_width, int img_height,
int uls, int ult, int lrs, int lrt,
int palette,
int cms, int cmt,
int masks, int maskt,
int shifts, int shiftt);
// extern int guGetDPLoadTextureTileSz (int ult, int lrt);
// extern void guDPLoadTextureTile (Gfx *glistp, void *timg,
// int texl_fmt, int texl_size,
// int img_width, int img_height,
// int uls, int ult, int lrs, int lrt,
// int palette,
// int cms, int cmt,
// int masks, int maskt,
// int shifts, int shiftt);
/*
@ -236,7 +201,7 @@ guBlinkRdpDL(u64 *rdp_dl_in, u64 nbytes_in,
#define GU_PARSEGBI_NOTEXTURES 128
*/
extern void guParseGbiDL(u64 *gbi_dl, u32 nbytes, u8 flags);
extern void guDumpGbiDL(OSTask *tp,u8 flags);
// extern void guDumpGbiDL(OSTask *tp,u8 flags);
#define GU_PARSE_GBI_TYPE 1
#define GU_PARSE_RDP_TYPE 2
@ -263,4 +228,8 @@ void guSprite2DInit(uSprite *SpritePointer,
int SourceImageOffsetS,
int SourceImageOffsetT);
#endif /* !_GU_H_ */
/* Used only in Fast3DEX2 */
void guLookAtReflect (Mtx *m, LookAt *l, float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp);
#endif

View File

@ -0,0 +1,18 @@
#ifndef _LIBULTRA_H
#define _LIBULTRA_H
#define TV_TYPE_NTSC 1
#define TV_TYPE_PAL 0
#define TV_TYPE_MPAL 2
#define RESET_TYPE_COLD_RESET 0
#define RESET_TYPE_NMI 1
#define RESET_TYPE_BOOT_DISK 2
extern u32 osTvType;
extern u32 osRomBase;
extern u32 osResetType;
extern u32 osMemSize;
extern u8 osAppNmiBuffer[64];
#endif /* _LIBULTRA_H */

8
include/2.0L/PR/mbi.h Executable file → Normal file
View File

@ -15,9 +15,9 @@
/**************************************************************************
*
* $Revision: 1.135 $
* $Date: 1997/11/26 00:30:54 $
* $Source: /disk6/Master/cvsmdev2/PR/include/mbi.h,v $
* $Revision: 1.136 $
* $Date: 1999/01/05 13:04:00 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/mbi.h,v $
*
**************************************************************************/
@ -79,6 +79,8 @@
#define M_GFXTASK 1
#define M_AUDTASK 2
#define M_VIDTASK 3
#define M_HVQTASK 6
#define M_HVQMTASK 7
/**************************************************************************
*

92
include/2.0L/PR/os_ai.h Normal file
View File

@ -0,0 +1,92 @@
/*====================================================================
* os_ai.h
*
* Copyright 1995, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
* Inc.; the contents of this file may not be disclosed to third
* parties, copied or duplicated in any form, in whole or in part,
* without the prior written permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS
* 252.227-7013, and/or in similar or successor clauses in the FAR,
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_ai.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:04 $
*---------------------------------------------------------------------*/
#ifndef _OS_AI_H_
#define _OS_AI_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* Audio interface (Ai) */
extern u32 osAiGetStatus(void);
extern u32 osAiGetLength(void);
extern s32 osAiSetFrequency(u32);
extern s32 osAiSetNextBuffer(void *, u32);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_AI_H_ */

View File

@ -0,0 +1,96 @@
/*====================================================================
* os_cache.h
*
* Copyright 1995, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
* Inc.; the contents of this file may not be disclosed to third
* parties, copied or duplicated in any form, in whole or in part,
* without the prior written permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS
* 252.227-7013, and/or in similar or successor clauses in the FAR,
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_cache.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:04 $
*---------------------------------------------------------------------*/
#ifndef _OS_CACHE_H_
#define _OS_CACHE_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
#define OS_DCACHE_ROUNDUP_ADDR(x) (void *)(((((u32)(x)+0xf)/0x10)*0x10))
#define OS_DCACHE_ROUNDUP_SIZE(x) (u32)(((((u32)(x)+0xf)/0x10)*0x10))
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* Cache operations and macros */
extern void osInvalDCache(void *, size_t);
extern void osInvalICache(void *, size_t);
extern void osWritebackDCache(void *, size_t);
extern void osWritebackDCacheAll(void);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_CACHE_H_ */

239
include/2.0L/PR/os_cont.h Normal file
View File

@ -0,0 +1,239 @@
/*====================================================================
* os_cont.h
*
* Copyright 1995, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
* Inc.; the contents of this file may not be disclosed to third
* parties, copied or duplicated in any form, in whole or in part,
* without the prior written permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS
* 252.227-7013, and/or in similar or successor clauses in the FAR,
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_cont.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:05 $
*---------------------------------------------------------------------*/
#ifndef _OS_CONT_H_
#define _OS_CONT_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#include "os_message.h"
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
/*
* Structure for controllers
*/
typedef struct {
u16 type; /* Controller Type */
u8 status; /* Controller status */
u8 errno;
}OSContStatus;
typedef struct {
u16 button;
s8 stick_x; /* -80 <= stick_x <= 80 */
s8 stick_y; /* -80 <= stick_y <= 80 */
u8 errno;
} OSContPad;
typedef struct {
void *address; /* Ram pad Address: 11 bits */
u8 databuffer[32]; /* address of the data buffer */
u8 addressCrc; /* CRC code for address */
u8 dataCrc; /* CRC code for data */
u8 errno;
} OSContRamIo;
typedef struct {
int status;
OSMesgQueue *queue;
int channel;
u8 id[32];
u8 label[32];
int version;
int dir_size;
int inode_table; /* block location */
int minode_table; /* mirrioring inode_table */
int dir_table; /* block location */
int inode_start_page; /* page # */
u8 banks;
u8 activebank;
} OSPfs;
typedef struct {
u32 file_size; /* bytes */
u32 game_code;
u16 company_code;
char ext_name[4];
char game_name[16];
} OSPfsState;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
/*
* Controllers number
*/
#ifndef _HW_VERSION_1
#define MAXCONTROLLERS 4
#else
#define MAXCONTROLLERS 6
#endif
/* controller errors */
#define CONT_NO_RESPONSE_ERROR 0x8
#define CONT_OVERRUN_ERROR 0x4
#ifdef _HW_VERSION_1
#define CONT_FRAME_ERROR 0x2
#define CONT_COLLISION_ERROR 0x1
#endif
/* Controller type */
#define CONT_ABSOLUTE 0x0001
#define CONT_RELATIVE 0x0002
#define CONT_JOYPORT 0x0004
#define CONT_EEPROM 0x8000
#define CONT_EEP16K 0x4000
#define CONT_TYPE_MASK 0x1f07
#define CONT_TYPE_NORMAL 0x0005
#define CONT_TYPE_MOUSE 0x0002
#define CONT_TYPE_VOICE 0x0100
/* Controller status */
#define CONT_CARD_ON 0x01
#define CONT_CARD_PULL 0x02
#define CONT_ADDR_CRC_ER 0x04
#define CONT_EEPROM_BUSY 0x80
/* Buttons */
#define CONT_A 0x8000
#define CONT_B 0x4000
#define CONT_G 0x2000
#define CONT_START 0x1000
#define CONT_UP 0x0800
#define CONT_DOWN 0x0400
#define CONT_LEFT 0x0200
#define CONT_RIGHT 0x0100
#define CONT_L 0x0020
#define CONT_R 0x0010
#define CONT_E 0x0008
#define CONT_D 0x0004
#define CONT_C 0x0002
#define CONT_F 0x0001
/* Nintendo's official button names */
#define A_BUTTON CONT_A
#define B_BUTTON CONT_B
#define L_TRIG CONT_L
#define R_TRIG CONT_R
#define Z_TRIG CONT_G
#define START_BUTTON CONT_START
#define U_JPAD CONT_UP
#define L_JPAD CONT_LEFT
#define R_JPAD CONT_RIGHT
#define D_JPAD CONT_DOWN
#define U_CBUTTONS CONT_E
#define L_CBUTTONS CONT_C
#define R_CBUTTONS CONT_F
#define D_CBUTTONS CONT_D
/* Controller error number */
#define CONT_ERR_NO_CONTROLLER PFS_ERR_NOPACK /* 1 */
#define CONT_ERR_CONTRFAIL CONT_OVERRUN_ERROR /* 4 */
#define CONT_ERR_INVALID PFS_ERR_INVALID /* 5 */
#define CONT_ERR_DEVICE PFS_ERR_DEVICE /* 11 */
#define CONT_ERR_NOT_READY 12
#define CONT_ERR_VOICE_MEMORY 13
#define CONT_ERR_VOICE_WORD 14
#define CONT_ERR_VOICE_NO_RESPONSE 15
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* Controller interface */
extern s32 osContInit(OSMesgQueue *, u8 *, OSContStatus *);
extern s32 osContReset(OSMesgQueue *, OSContStatus *);
extern s32 osContStartQuery(OSMesgQueue *);
extern s32 osContStartReadData(OSMesgQueue *);
#ifndef _HW_VERSION_1
extern s32 osContSetCh(u8);
#endif
extern void osContGetQuery(OSContStatus *);
extern void osContGetReadData(OSContPad *);
/* MOTOR interface */
extern s32 osMotorInit(OSMesgQueue *, OSPfs *, int);
extern s32 osMotorStop(OSPfs *);
extern s32 osMotorStart(OSPfs *);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_CONT_H_ */

107
include/2.0L/PR/os_eeprom.h Normal file
View File

@ -0,0 +1,107 @@
/*====================================================================
* os_eeprom.h
*
* Copyright 1995, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
* Inc.; the contents of this file may not be disclosed to third
* parties, copied or duplicated in any form, in whole or in part,
* without the prior written permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS
* 252.227-7013, and/or in similar or successor clauses in the FAR,
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_eeprom.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:06 $
*---------------------------------------------------------------------*/
#ifndef _OS_EEPROM_H_
#define _OS_EEPROM_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#include "os_message.h"
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
/* EEPROM TYPE */
#define EEPROM_TYPE_4K 0x01
#define EEPROM_TYPE_16K 0x02
/* definition for EEPROM */
#define EEPROM_MAXBLOCKS 64
#define EEP16K_MAXBLOCKS 256
#define EEPROM_BLOCK_SIZE 8
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* EEPROM interface */
extern s32 osEepromProbe(OSMesgQueue *);
extern s32 osEepromRead(OSMesgQueue *, u8, u8 *);
extern s32 osEepromWrite(OSMesgQueue *, u8, u8 *);
extern s32 osEepromLongRead(OSMesgQueue *, u8, u8 *, int);
extern s32 osEepromLongWrite(OSMesgQueue *, u8, u8 *, int);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_EEPROM_H_ */

View File

@ -0,0 +1,119 @@
/*====================================================================
* os_exception.h
*
* Copyright 1995, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
* Inc.; the contents of this file may not be disclosed to third
* parties, copied or duplicated in any form, in whole or in part,
* without the prior written permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS
* 252.227-7013, and/or in similar or successor clauses in the FAR,
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_exception.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:07 $
*---------------------------------------------------------------------*/
#ifndef _OS_EXCEPTION_H_
#define _OS_EXCEPTION_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
typedef u32 OSIntMask;
typedef u32 OSHWIntr;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
/* Flags for debugging purpose */
#define OS_FLAG_CPU_BREAK 1 /* Break exception has occurred */
#define OS_FLAG_FAULT 2 /* CPU fault has occurred */
/* Interrupt masks */
#define OS_IM_NONE 0x00000001
#define OS_IM_SW1 0x00000501
#define OS_IM_SW2 0x00000601
#define OS_IM_CART 0x00000c01
#define OS_IM_PRENMI 0x00001401
#define OS_IM_RDBWRITE 0x00002401
#define OS_IM_RDBREAD 0x00004401
#define OS_IM_COUNTER 0x00008401
#define OS_IM_CPU 0x0000ff01
#define OS_IM_SP 0x00010401
#define OS_IM_SI 0x00020401
#define OS_IM_AI 0x00040401
#define OS_IM_VI 0x00080401
#define OS_IM_PI 0x00100401
#define OS_IM_DP 0x00200401
#define OS_IM_ALL 0x003fff01
#define RCP_IMASK 0x003f0000
#define RCP_IMASKSHIFT 16
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* Interrupt operations */
extern OSIntMask osGetIntMask(void);
extern OSIntMask osSetIntMask(OSIntMask);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_EXCEPTION_H_ */

128
include/2.0L/PR/os_internal.h Executable file → Normal file
View File

@ -1,118 +1,18 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
#ifndef _ULTRA64_OS_INTERNAL_H_
#define _ULTRA64_OS_INTERNAL_H_
/**************************************************************************
*
* $Revision: 1.18 $
* $Date: 1997/02/11 08:26:14 $
* $Source: /disk6/Master/cvsmdev2/PR/include/os_internal.h,v $
*
**************************************************************************/
/* Internal functions used by the operating system */
/* Do not include this header in application code */
#ifndef _OS_INTERNAL_H_
#define _OS_INTERNAL_H_
/* Variables */
//extern u64 osClockRate;
/* Functions */
/*u32 __osProbeTLB(void *);
u32 __osDisableInt(void);
void __osRestoreInt(u32);*/
OSThread *__osGetCurrFaultedThread(void);
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* Routines to get/fetch coprocessor 0 registers */
extern u32 __osGetCause(void);
extern void __osSetCause(u32);
extern u32 __osGetCompare(void);
extern void __osSetCompare(u32);
extern u32 __osGetConfig(void);
extern void __osSetConfig(u32);
extern void __osSetCount(u32);
extern u32 __osGetSR(void);
extern void __osSetSR(u32);
extern u32 __osDisableInt(void);
extern void __osRestoreInt(u32);
/* Routines to get/set floating-point control and status register */
extern u32 __osSetFpcCsr(u32);
extern u32 __osGetFpcCsr(void);
/* Routine for HW interrupt "handler" */
extern void __osSetHWIntrRoutine(OSHWIntr, s32 (*handler)(void));
/* Routine for global interrupt mask */
extern void __osSetGlobalIntMask(OSHWIntr);
extern void __osResetGlobalIntMask(OSHWIntr);
/* Routine for global interrupt mask */
extern s32 __osLeoInterrupt(void);
/* Routines for fetch TLB info */
extern u32 __osGetTLBASID(void);
extern u32 __osGetTLBPageMask(s32);
extern u32 __osGetTLBHi(s32);
extern u32 __osGetTLBLo0(s32);
extern u32 __osGetTLBLo1(s32);
/* Serial interface (Si) */
extern u32 __osSiGetStatus(void);
extern s32 __osSiRawWriteIo(u32, u32);
extern s32 __osSiRawReadIo(u32, u32 *);
extern s32 __osSiRawStartDma(s32, void *);
/* Signal processor interface (Sp) */
extern u32 __osSpGetStatus(void);
extern void __osSpSetStatus(u32);
extern s32 __osSpSetPc(u32);
extern s32 __osSiRawWriteIo(u32, u32);
extern s32 __osSpRawReadIo(u32, u32 *);
extern s32 __osSpRawStartDma(s32, u32, void *, u32);
/* Error handling */
extern void __osError(s16, s16, ...);
extern OSThread * __osGetCurrFaultedThread(void);
extern OSThread * __osGetNextFaultedThread(OSThread *);
/* Development board functions */
extern void __osGIOInit(s32);
extern void __osGIOInterrupt(s32);
extern void __osGIORawInterrupt(s32);
/* For debugger use */
extern OSThread * __osGetActiveQueue(void);
/* Debug port */
extern void __osSyncPutChars(int, int, const char *);
extern int __osSyncGetChars(char *);
extern void __osAsyncPutChars(int, int, const char *);
extern int __osAsyncGetChars(char *);
extern int __osAtomicInc(unsigned int *p);
extern int __osAtomicDec(unsigned int *p);
/* routine for rdb port */
extern u32 __osRdbSend(u8 *buf, u32 size, u32 type);
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_INTERNAL_H */

10
include/2.0L/PR/os_libc.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef _OS_LIBC_H_
#define _OS_LIBC_H_
#include "ultratypes.h"
// Old deprecated functions from strings.h, replaced by memcpy/memset.
extern void bcopy(const void *, void *, size_t);
extern void bzero(void *, size_t);
#endif /* !_OS_LIBC_H_ */

View File

@ -0,0 +1,164 @@
/*====================================================================
* os_message.h
*
* Copyright 1995, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
* Inc.; the contents of this file may not be disclosed to third
* parties, copied or duplicated in any form, in whole or in part,
* without the prior written permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS
* 252.227-7013, and/or in similar or successor clauses in the FAR,
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_message.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:15 $
*---------------------------------------------------------------------*/
#ifndef _OS_MESSAGE_H_
#define _OS_MESSAGE_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#include <PR/os_thread.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
typedef u32 OSEvent;
/*
* Structure for message
*/
typedef void * OSMesg;
/*
* Structure for message queue
*/
typedef struct OSMesgQueue_s {
OSThread *mtqueue; /* Queue to store threads blocked
on empty mailboxes (receive) */
OSThread *fullqueue; /* Queue to store threads blocked
on full mailboxes (send) */
s32 validCount; /* Contains number of valid message */
s32 first; /* Points to first valid message */
s32 msgCount; /* Contains total # of messages */
OSMesg *msg; /* Points to message buffer array */
} OSMesgQueue;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
/* Events */
#ifdef _FINALROM
#define OS_NUM_EVENTS 15
#else
#define OS_NUM_EVENTS 23
#endif
#define OS_EVENT_SW1 0 /* CPU SW1 interrupt */
#define OS_EVENT_SW2 1 /* CPU SW2 interrupt */
#define OS_EVENT_CART 2 /* Cartridge interrupt: used by rmon */
#define OS_EVENT_COUNTER 3 /* Counter int: used by VI/Timer Mgr */
#define OS_EVENT_SP 4 /* SP task done interrupt */
#define OS_EVENT_SI 5 /* SI (controller) interrupt */
#define OS_EVENT_AI 6 /* AI interrupt */
#define OS_EVENT_VI 7 /* VI interrupt: used by VI/Timer Mgr */
#define OS_EVENT_PI 8 /* PI interrupt: used by PI Manager */
#define OS_EVENT_DP 9 /* DP full sync interrupt */
#define OS_EVENT_CPU_BREAK 10 /* CPU breakpoint: used by rmon */
#define OS_EVENT_SP_BREAK 11 /* SP breakpoint: used by rmon */
#define OS_EVENT_FAULT 12 /* CPU fault event: used by rmon */
#define OS_EVENT_THREADSTATUS 13 /* CPU thread status: used by rmon */
#define OS_EVENT_PRENMI 14 /* Pre NMI interrupt */
#ifndef _FINALROM
#define OS_EVENT_RDB_READ_DONE 15 /* RDB read ok event: used by rmon */
#define OS_EVENT_RDB_LOG_DONE 16 /* read of log data complete */
#define OS_EVENT_RDB_DATA_DONE 17 /* read of hostio data complete */
#define OS_EVENT_RDB_REQ_RAMROM 18 /* host needs ramrom access */
#define OS_EVENT_RDB_FREE_RAMROM 19 /* host is done with ramrom access */
#define OS_EVENT_RDB_DBG_DONE 20
#define OS_EVENT_RDB_FLUSH_PROF 21
#define OS_EVENT_RDB_ACK_PROF 22
#endif
/* Flags to turn blocking on/off when sending/receiving message */
#define OS_MESG_NOBLOCK 0
#define OS_MESG_BLOCK 1
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/* Get count of valid messages in queue */
#define MQ_GET_COUNT(mq) ((mq)->validCount)
/* Figure out if message queue is empty or full */
#define MQ_IS_EMPTY(mq) (MQ_GET_COUNT(mq) == 0)
#define MQ_IS_FULL(mq) (MQ_GET_COUNT(mq) >= (mq)->msgCount)
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* Message operations */
extern void osCreateMesgQueue(OSMesgQueue *, OSMesg *, s32);
extern s32 osSendMesg(OSMesgQueue *, OSMesg, s32);
extern s32 osJamMesg(OSMesgQueue *, OSMesg, s32);
extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32);
/* Event operations */
extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_MESSAGE_H_ */

11
include/2.0L/PR/os_misc.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef _ULTRA64_OS_MISC_H_
#define _ULTRA64_OS_MISC_H_
#include <PR/ultratypes.h>
/* Miscellaneous OS functions */
void osInitialize(void);
u32 osGetCount(void);
uintptr_t osVirtualToPhysical(void *);
#endif

102
include/2.0L/PR/os_pi.h Normal file
View File

@ -0,0 +1,102 @@
#ifndef _ULTRA64_PI_H_
#define _ULTRA64_PI_H_
/* Ultra64 Parallel Interface */
/* Types */
typedef struct {
#if !defined(VERSION_EU) && !defined(VERSION_SH)
u32 errStatus;
#endif
void *dramAddr;
void *C2Addr;
u32 sectorSize;
u32 C1ErrNum;
u32 C1ErrSector[4];
} __OSBlockInfo;
typedef struct {
u32 cmdType; // 0
u16 transferMode; // 4
u16 blockNum; // 6
s32 sectorNum; // 8
uintptr_t devAddr; // c
#if defined(VERSION_EU) || defined(VERSION_SH)
u32 unk10; //error status added moved to blockinfo
#endif
u32 bmCtlShadow; // 10
u32 seqCtlShadow; // 14
__OSBlockInfo block[2]; // 18
} __OSTranxInfo;
typedef struct OSPiHandle_s {
struct OSPiHandle_s *next;
u8 type;
u8 latency;
u8 pageSize;
u8 relDuration;
u8 pulse;
u8 domain;
u32 baseAddress;
u32 speed;
__OSTranxInfo transferInfo;
} OSPiHandle;
typedef struct {
u8 type;
uintptr_t address;
} OSPiInfo;
typedef struct {
u16 type;
u8 pri;
u8 status;
OSMesgQueue *retQueue;
} OSIoMesgHdr;
typedef struct {
/*0x00*/ OSIoMesgHdr hdr;
/*0x08*/ void *dramAddr;
/*0x0C*/ uintptr_t devAddr;
/*0x10*/ size_t size;
#if defined(VERSION_EU) || defined(VERSION_SH)
OSPiHandle *piHandle; // from the official definition
#endif
} OSIoMesg;
/* Definitions */
#define OS_READ 0 // device -> RDRAM
#define OS_WRITE 1 // device <- RDRAM
#define OS_MESG_PRI_NORMAL 0
#define OS_MESG_PRI_HIGH 1
/* Functions */
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr,
size_t nbytes, OSMesgQueue *mq);
void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt);
OSMesgQueue *osPiGetCmdQueue(void);
s32 osPiWriteIo(uintptr_t devAddr, u32 data);
s32 osPiReadIo(uintptr_t devAddr, u32 *data);
s32 osPiRawStartDma(s32 dir, u32 cart_addr, void *dram_addr, size_t size);
s32 osEPiRawStartDma(OSPiHandle *piHandle, s32 dir, u32 cart_addr, void *dram_addr, size_t size);
/* Enhanced PI interface */
extern OSPiHandle *osCartRomInit(void);
extern OSPiHandle *osLeoDiskInit(void);
extern OSPiHandle *osDriveRomInit(void);
extern s32 osEPiDeviceType(OSPiHandle *, OSPiInfo *);
extern s32 osEPiRawWriteIo(OSPiHandle *, u32 , u32);
extern s32 osEPiRawReadIo(OSPiHandle *, u32 , u32 *);
extern s32 osEPiWriteIo(OSPiHandle *, u32 , u32 );
extern s32 osEPiReadIo(OSPiHandle *, u32 , u32 *);
extern s32 osEPiStartDma(OSPiHandle *, OSIoMesg *, s32);
extern s32 osEPiLinkHandle(OSPiHandle *);
#endif

92
include/2.0L/PR/os_rdp.h Normal file
View File

@ -0,0 +1,92 @@
/*====================================================================
* os_rdp.h
*
* Copyright 1995, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
* Inc.; the contents of this file may not be disclosed to third
* parties, copied or duplicated in any form, in whole or in part,
* without the prior written permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS
* 252.227-7013, and/or in similar or successor clauses in the FAR,
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_rdp.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:16 $
*---------------------------------------------------------------------*/
#ifndef _OS_RDP_H_
#define _OS_RDP_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* Display processor interface (Dp) */
extern u32 osDpGetStatus(void);
extern void osDpSetStatus(u32);
extern void osDpGetCounters(u32 *);
extern s32 osDpSetNextBuffer(void *, u64);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_RDP_H_ */

View File

@ -0,0 +1,75 @@
#ifndef _ULTRA64_THREAD_H_
#define _ULTRA64_THREAD_H_
#include "ultratypes.h"
/* Recommended priorities for system threads */
#define OS_PRIORITY_MAX 255
#define OS_PRIORITY_VIMGR 254
#define OS_PRIORITY_RMON 250
#define OS_PRIORITY_RMONSPIN 200
#define OS_PRIORITY_PIMGR 150
#define OS_PRIORITY_SIMGR 140
#define OS_PRIORITY_APPMAX 127
#define OS_PRIORITY_IDLE 0
#define OS_STATE_STOPPED 1
#define OS_STATE_RUNNABLE 2
#define OS_STATE_RUNNING 4
#define OS_STATE_WAITING 8
/* Types */
typedef s32 OSPri;
typedef s32 OSId;
typedef union
{
struct {f32 f_odd; f32 f_even;} f;
} __OSfp;
typedef struct
{
/* registers */
/*0x20*/ u64 at, v0, v1, a0, a1, a2, a3;
/*0x58*/ u64 t0, t1, t2, t3, t4, t5, t6, t7;
/*0x98*/ u64 s0, s1, s2, s3, s4, s5, s6, s7;
/*0xD8*/ u64 t8, t9, gp, sp, s8, ra;
/*0x108*/ u64 lo, hi;
/*0x118*/ u32 sr, pc, cause, badvaddr, rcp;
/*0x12C*/ u32 fpcsr;
__OSfp fp0, fp2, fp4, fp6, fp8, fp10, fp12, fp14;
__OSfp fp16, fp18, fp20, fp22, fp24, fp26, fp28, fp30;
} __OSThreadContext;
typedef struct
{
u32 flag;
u32 count;
u64 time;
} __OSThreadprofile_s;
typedef struct OSThread_s
{
/*0x00*/ struct OSThread_s *next;
/*0x04*/ OSPri priority;
/*0x08*/ struct OSThread_s **queue;
/*0x0C*/ struct OSThread_s *tlnext;
/*0x10*/ u16 state;
/*0x12*/ u16 flags;
/*0x14*/ OSId id;
/*0x18*/ int fp;
/*0x1C*/ __OSThreadprofile_s *thprof;
/*0x20*/ __OSThreadContext context;
} OSThread;
/* Functions */
void osCreateThread(OSThread *thread, OSId id, void (*entry)(void *),
void *arg, void *sp, OSPri pri);
OSId osGetThreadId(OSThread *thread);
OSPri osGetThreadPri(OSThread *thread);
void osSetThreadPri(OSThread *thread, OSPri pri);
void osStartThread(OSThread *thread);
void osStopThread(OSThread *thread);
#endif

27
include/2.0L/PR/os_time.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef _ULTRA64_TIME_H_
#define _ULTRA64_TIME_H_
#include <PR/ultratypes.h>
#include <PR/os_message.h>
/* Types */
typedef struct OSTimer_str
{
struct OSTimer_str *next;
struct OSTimer_str *prev;
u64 interval;
u64 remaining;
OSMesgQueue *mq;
OSMesg *msg;
} OSTimer;
typedef u64 OSTime;
/* Functions */
OSTime osGetTime(void);
void osSetTime(OSTime time);
u32 osSetTimer(OSTimer *, OSTime, u64, OSMesgQueue *, OSMesg);
#endif

107
include/2.0L/PR/os_tlb.h Normal file
View File

@ -0,0 +1,107 @@
/*====================================================================
* os_tlb.h
*
* Copyright 1995, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
* Inc.; the contents of this file may not be disclosed to third
* parties, copied or duplicated in any form, in whole or in part,
* without the prior written permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
* in Technical Data and Computer Software clause at DFARS
* 252.227-7013, and/or in similar or successor clauses in the FAR,
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
* Copyright Laws of the United States.
*====================================================================*/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_tlb.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:20 $
*---------------------------------------------------------------------*/
#ifndef _OS_TLB_H_
#define _OS_TLB_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
typedef u32 OSPageMask;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
/*
* Page size argument for TLB routines
*/
#define OS_PM_4K 0x0000000
#define OS_PM_16K 0x0006000
#define OS_PM_64K 0x001e000
#define OS_PM_256K 0x007e000
#define OS_PM_1M 0x01fe000
#define OS_PM_4M 0x07fe000
#define OS_PM_16M 0x1ffe000
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* TLB management routines */
extern void osMapTLB(s32, OSPageMask, void *, u32, u32, s32);
extern void osMapTLBRdb(void);
extern void osUnmapTLB(s32);
extern void osUnmapTLBAll(void);
extern void osSetTLBASID(s32);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_TLB_H_ */

118
include/2.0L/PR/os_vi.h Normal file
View File

@ -0,0 +1,118 @@
#ifndef _ULTRA64_VI_H_
#define _ULTRA64_VI_H_
#include <PR/ultratypes.h>
#include <PR/os_message.h>
/* Ultra64 Video Interface */
/* Special Features */
#define OS_VI_GAMMA_ON 0x0001
#define OS_VI_GAMMA_OFF 0x0002
#define OS_VI_GAMMA_DITHER_ON 0x0004
#define OS_VI_GAMMA_DITHER_OFF 0x0008
#define OS_VI_DIVOT_ON 0x0010
#define OS_VI_DIVOT_OFF 0x0020
#define OS_VI_DITHER_FILTER_ON 0x0040
#define OS_VI_DITHER_FILTER_OFF 0x0080
#define OS_VI_GAMMA 0x08
#define OS_VI_GAMMA_DITHER 0x04
#define OS_VI_DIVOT 0x10
#define OS_VI_DITHER_FILTER 0x10000
#define OS_VI_UNK200 0x200
#define OS_VI_UNK100 0x100
/* Types */
typedef struct
{
u32 ctrl;
u32 width;
u32 burst;
u32 vSync;
u32 hSync;
u32 leap;
u32 hStart;
u32 xScale;
u32 vCurrent;
} OSViCommonRegs;
typedef struct
{
u32 origin;
u32 yScale;
u32 vStart;
u32 vBurst;
u32 vIntr;
} OSViFieldRegs;
typedef struct
{
u8 type;
OSViCommonRegs comRegs;
OSViFieldRegs fldRegs[2];
} OSViMode;
typedef struct
{
/* 0x00 */ u16 unk00; //some kind of flags. swap buffer sets to 0x10
/* 0x02 */ u16 retraceCount;
/* 0x04 */ void* buffer;
/* 0x08 */ OSViMode *unk08;
/* 0x0c */ u32 features;
/* 0x10 */ OSMesgQueue *mq;
/* 0x14 */ OSMesg *msg;
/* 0x18 */ u32 unk18;
/* 0x1c */ u32 unk1c;
/* 0x20 */ u32 unk20;
/* 0x24 */ f32 unk24;
/* 0x28 */ u16 unk28;
/* 0x2c */ u32 unk2c;
} OSViContext;
void osCreateViManager(OSPri pri);
void osViSetMode(OSViMode *mode);
void osViSetEvent(OSMesgQueue *mq, OSMesg msg, u32 retraceCount);
void osViBlack(u8 active);
void osViSetSpecialFeatures(u32 func);
void osViSwapBuffer(void *vaddr);
void osViSetYScale(f32 scale);
#define OS_VI_NTSC_LPN1 0 /* NTSC */
#define OS_VI_NTSC_LPF1 1
#define OS_VI_NTSC_LAN1 2
#define OS_VI_NTSC_LAF1 3
#define OS_VI_NTSC_LPN2 4
#define OS_VI_NTSC_LPF2 5
#define OS_VI_NTSC_LAN2 6
#define OS_VI_NTSC_LAF2 7
#define OS_VI_NTSC_HPN1 8
#define OS_VI_NTSC_HPF1 9
#define OS_VI_NTSC_HAN1 10
#define OS_VI_NTSC_HAF1 11
#define OS_VI_NTSC_HPN2 12
#define OS_VI_NTSC_HPF2 13
#define OS_VI_PAL_LPN1 14 /* PAL */
#define OS_VI_PAL_LPF1 15
#define OS_VI_PAL_LAN1 16
#define OS_VI_PAL_LAF1 17
#define OS_VI_PAL_LPN2 18
#define OS_VI_PAL_LPF2 19
#define OS_VI_PAL_LAN2 20
#define OS_VI_PAL_LAF2 21
#define OS_VI_PAL_HPN1 22
#define OS_VI_PAL_HPF1 23
#define OS_VI_PAL_HAN1 24
#define OS_VI_PAL_HAF1 25
#define OS_VI_PAL_HPN2 26
#define OS_VI_PAL_HPF2 27
extern OSViMode osViModeTable[]; /* Global VI mode table */
#endif

1
include/2.0L/PR/rcp.h Executable file → Normal file
View File

@ -879,4 +879,3 @@ The Indy development board use cartridge domain 1:
#endif
#endif /* _RCP_H_ */

268
include/2.0L/PR/sptask.h Executable file → Normal file
View File

@ -1,122 +1,12 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
#ifndef _ULTRA64_SPTASK_H_
#define _ULTRA64_SPTASK_H_
/**************************************************************************
*
* $Revision: 1.8 $
* $Date: 1997/11/10 10:48:35 $
* $Source: /disk6/Master/cvsmdev2/PR/include/sptask.h,v $
*
**************************************************************************/
#ifndef _SPTASK_H_
#define _SPTASK_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
/*
* Task List Structure.
*
* Things an app might pass to the SP via the task list.
* Not every task ucode would need/use every field, but
*
* - type (audio, gfx, video, ...)
* - flags
* - wait for DP to drain before running new task
* - SEE BIT DEFINITIONS UNDER "Task Flags field"
* - pointer to boot ucode
* - size of boot ucode
* - pointer to ucode
* - size of ucode
* - pointer to initial DMEM data
* - size of initial DMEM data
* - pointer to DRAM stack
* - size of DRAM stack (max)
* - pointer to output buffer
* - pointer to store output buffer length
* - generic data pointer (for display list, etc.)
* - generic data length (for display list, etc.)
* - pointer to buffer where to store saved DMEM (in yield case)
* - size of buffer to store saved DMEM.
*
* IMPORTANT!!! Watch alignment issues.
*
* IMPORTANT!!! Watch data cache issues. The RCP may write data into the
* dram_stack, output_buff, output_buff_size, and the yield_data_ptr areas.
* These buffers should be cache aligned and use the entire line (16 bytes) to
* avoid corruption by writebacks by the CPU (cache tearing).
*
* IMPORTANT!!! all addresses are virtual addresses. Library does
* any necessary translation.
*
*/
typedef struct {
u32 type;
u32 flags;
u64 *ucode_boot;
u32 ucode_boot_size;
u64 *ucode;
u32 ucode_size;
u64 *ucode_data;
u32 ucode_data_size;
u64 *dram_stack;
u32 dram_stack_size;
u64 *output_buff;
u64 *output_buff_size;
u64 *data_ptr;
u32 data_size;
u64 *yield_data_ptr;
u32 yield_data_size;
} OSTask_t;
typedef union {
OSTask_t t;
long long int force_structure_alignment;
} OSTask;
typedef u32 OSYieldResult;
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_ASSEMBLY
/*
* For the RSP ucode:
* offsets into the task structure
*/
#include <PR/sptaskoff.h>
#endif
/* Task Types */
#define M_GFXTASK 1
#define M_AUDTASK 2
#define M_VIDTASK 3
#define M_HVQTASK 6
#define M_HVQMTASK 7
/*
* Task Flags field
@ -130,72 +20,108 @@ typedef u32 OSYieldResult;
#define OS_TASK_USR2 0x0040
#define OS_TASK_USR3 0x0080
/*
* Size of Yield buffer. The taskHdrPtr->t.yield_data_ptr must point to a
* buffer of this size. (The size is in bytes). ONLY If the task will NEVER
* yield it may be a null pointer. The buffer must be aligned to a 64 bit
* boundary. The taskHdrPtr->t.yield_data_ptr must be set to point to the
* buffer BEFORE the task is started.
*/
#if (defined(F3DEX_GBI)||defined(F3DLP_GBI)|| defined(F3DEX2_GBI))
#define OS_YIELD_DATA_SIZE 0xc00
#if (defined(F3DEX_GBI) || defined(F3DLP_GBI) || defined(F3DEX_GBI_2))
#define OS_YIELD_DATA_SIZE 0xc00
#else
#define OS_YIELD_DATA_SIZE 0x900
#define OS_YIELD_DATA_SIZE 0x900
#endif
#define OS_YIELD_AUDIO_SIZE 0x400
#define OS_YIELD_AUDIO_SIZE 0x400
/**************************************************************************
*
* Global definitions
*
*/
/* Flags */
#define M_TASK_FLAG0 1
#define M_TASK_FLAG1 2
/* SpStatus */
#define SPSTATUS_CLEAR_HALT 0x00000001
#define SPSTATUS_SET_HALT 0x00000002
#define SPSTATUS_CLEAR_BROKE 0x00000004
#define SPSTATUS_CLEAR_INTR 0x00000008
#define SPSTATUS_SET_INTR 0x00000010
#define SPSTATUS_CLEAR_SSTEP 0x00000020
#define SPSTATUS_SET_SSTEP 0x00000040
#define SPSTATUS_CLEAR_INTR_ON_BREAK 0x00000080
#define SPSTATUS_SET_INTR_ON_BREAK 0x00000100
#define SPSTATUS_CLEAR_SIGNAL0 0x00000200
#define SPSTATUS_SET_SIGNAL0 0x00000400
#define SPSTATUS_CLEAR_SIGNAL1 0x00000800
#define SPSTATUS_SET_SIGNAL1 0x00001000
#define SPSTATUS_CLEAR_SIGNAL2 0x00002000
#define SPSTATUS_SET_SIGNAL2 0x00004000
#define SPSTATUS_CLEAR_SIGNAL3 0x00008000
#define SPSTATUS_SET_SIGNAL3 0x00010000
#define SPSTATUS_CLEAR_SIGNAL4 0x00020000
#define SPSTATUS_SET_SIGNAL4 0x00040000
#define SPSTATUS_CLEAR_SIGNAL5 0x00080000
#define SPSTATUS_SET_SIGNAL5 0x00100000
#define SPSTATUS_CLEAR_SIGNAL6 0x00200000
#define SPSTATUS_SET_SIGNAL6 0x00800000
#define SPSTATUS_CLEAR_SIGNAL7 0x01000000
#define SPSTATUS_SET_SIGNAL7 0x02000000
#define SPSTATUS_HALT 0x0001
#define SPSTATUS_BROKE 0x0002
#define SPSTATUS_DMA_BUSY 0x0004
#define SPSTATUS_DMA_FULL 0x0008
#define SPSTATUS_IO_FULL 0x0010
#define SPSTATUS_SINGLE_STEP 0x0020
#define SPSTATUS_INTERRUPT_ON_BREAK 0x0040
#define SPSTATUS_SIGNAL0_SET 0x0080
#define SPSTATUS_SIGNAL1_SET 0x0100
#define SPSTATUS_SIGNAL2_SET 0x0200
#define SPSTATUS_SIGNAL3_SET 0x0400
#define SPSTATUS_SIGNAL4_SET 0x0800
#define SPSTATUS_SIGNAL5_SET 0x1000
#define SPSTATUS_SIGNAL6_SET 0x2000
#define SPSTATUS_SIGNAL7_SET 0x4000
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* Types */
/* Types */
/**************************************************************************
*
* Macro definitions
*
*/
typedef struct
{
/*0x00*/ u32 type;
/*0x04*/ u32 flags;
/*0x08*/ u64 *ucode_boot;
/*0x0C*/ u32 ucode_boot_size;
/*0x10*/ u64 *ucode;
/*0x14*/ u32 ucode_size;
/*0x18*/ u64 *ucode_data;
/*0x1C*/ u32 ucode_data_size;
/*0x20*/ u64 *dram_stack;
/*0x24*/ u32 dram_stack_size;
/*0x28*/ u64 *output_buff;
/*0x2C*/ u64 *output_buff_size;
/*0x30*/ u64 *data_ptr;
/*0x34*/ u32 data_size;
/*0x38*/ u64 *yield_data_ptr;
/*0x3C*/ u32 yield_data_size;
} OSTask_t; // size = 0x40
typedef union {
OSTask_t t;
long long int force_structure_alignment;
} OSTask;
typedef u32 OSYieldResult;
/* Functions */
/*
* this macro simulates atomic action.
*/
#define osSpTaskStart(tp) \
{ \
osSpTaskLoad((tp)); \
osSpTaskStartGo((tp)); \
}
void osSpTaskLoad(OSTask *task);
void osSpTaskLoad(OSTask *task);
void osSpTaskYield(void);
OSYieldResult osSpTaskYielded(OSTask *task);
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/*
* break this up into two steps for debugging.
*/
extern void osSpTaskLoad(OSTask *tp);
extern void osSpTaskStartGo(OSTask *tp);
extern void osSpTaskYield(void);
extern OSYieldResult osSpTaskYielded(OSTask *tp);
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_SPTASK_H */

201
include/2.0L/PR/ucode.h Executable file → Normal file
View File

@ -1,186 +1,23 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
#ifndef _ULTRA64_UCODE_H_
#define _ULTRA64_UCODE_H_
/**************************************************************************
*
* $Revision: 1.13 $
* $Date: 1997/11/07 04:55:12 $
* $Source: /disk6/Master/cvsmdev2/PR/include/ucode.h,v $
*
**************************************************************************/
#define SP_DRAM_STACK_SIZE8 0x400
#define SP_UCODE_SIZE 0x1000
#define SP_UCODE_DATA_SIZE 0x800
#ifndef _UCODE_H_
#define _UCODE_H_
// standard boot ucode
extern u64 rspF3DBootStart[], rspF3DBootEnd[];
// F3D ucode
extern u64 rspF3DStart[], rspF3DEnd[];
// F3D ucode data
extern u64 rspF3DDataStart[], rspF3DDataEnd[];
// aspMain (audio) ucode
extern u64 rspAspMainStart[], rspAspMainEnd[];
// aspMain ucode data
extern u64 rspAspMainDataStart[], rspAspMainDataEnd[];
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/*
* This is the recommended size of the SP DRAM stack area, used
* by the graphics ucode. This stack is used primarily for the
* matrix stack, so it needs to be AT LEAST (10 * 64bytes) in size.
*/
#define SP_DRAM_STACK_SIZE8 (1024)
#define SP_DRAM_STACK_SIZE64 (SP_DRAM_STACK_SIZE8 >> 3)
/*
* This is the size of the IMEM, which is also the size of the
* graphics microcode. (other ucode might be less)
* This value is used in apps to tell the OS how much ucode to
* load.
*/
#define SP_UCODE_SIZE 4096
/*
* This is 1/2 the size of DMEM, which is the maximum amount of
* initialized DMEM data any of the ucode tasks need to start up.
* This value is dependent on all of the task ucodes, and is therefore
* fixed per release.
*/
#define SP_UCODE_DATA_SIZE 2048
/**************************************************************************
*
* Extern variables
*
*/
/*
* Symbols generated by "rsp2elf", included by "makerom" that indicate
* the location and size of the SP microcode objects. The ucode objects
* are loaded as part of the codesegment (arbitrary, could do other
* ways)
*
*/
/* standard boot ucode: */
extern long long int rspbootTextStart[], rspbootTextEnd[];
/* standard 3D ucode: */
extern long long int gspFast3DTextStart[], gspFast3DTextEnd[];
extern long long int gspFast3DDataStart[], gspFast3DDataEnd[];
/* 3D ucode with output to DRAM: */
extern long long int gspFast3D_dramTextStart[], gspFast3D_dramTextEnd[];
extern long long int gspFast3D_dramDataStart[], gspFast3D_dramDataEnd[];
/* 3D ucode with output through DRAM FIFO to RDP: */
extern long long int gspFast3D_fifoTextStart[], gspFast3D_fifoTextEnd[];
extern long long int gspFast3D_fifoDataStart[], gspFast3D_fifoDataEnd[];
/* 3D ucode without nearclip: */
extern long long int gspF3DNoNTextStart[], gspF3DNoNTextEnd[];
extern long long int gspF3DNoNDataStart[], gspF3DNoNDataEnd[];
/* 3D ucode without nearclip with output to DRAM: */
extern long long int gspF3DNoN_dramTextStart[];
extern long long int gspF3DNoN_dramTextEnd[];
extern long long int gspF3DNoN_dramDataStart[];
extern long long int gspF3DNoN_dramDataEnd[];
/* 3D ucode without nearclip with output through DRAM FIFO to RDP: */
extern long long int gspF3DNoN_fifoTextStart[];
extern long long int gspF3DNoN_fifoTextEnd[];
extern long long int gspF3DNoN_fifoDataStart[];
extern long long int gspF3DNoN_fifoDataEnd[];
/* 3D line ucode: */
extern long long int gspLine3DTextStart[], gspLine3DTextEnd[];
extern long long int gspLine3DDataStart[], gspLine3DDataEnd[];
/* 3D line ucode with output to DRAM: */
extern long long int gspLine3D_dramTextStart[], gspLine3D_dramTextEnd[];
extern long long int gspLine3D_dramDataStart[], gspLine3D_dramDataEnd[];
/* 3D line ucode with output through DRAM FIFO to RDP: */
extern long long int gspLine3D_fifoTextStart[], gspLine3D_fifoTextEnd[];
extern long long int gspLine3D_fifoDataStart[], gspLine3D_fifoDataEnd[];
/* 2D sprite ucode: */
extern long long int gspSprite2DTextStart[], gspSprite2DTextEnd[];
extern long long int gspSprite2DDataStart[], gspSprite2DDataEnd[];
/* 2D sprite ucode with output to DRAM: */
extern long long int gspSprite2D_dramTextStart[], gspSprite2D_dramTextEnd[];
extern long long int gspSprite2D_dramDataStart[], gspSprite2D_dramDataEnd[];
/* 2D sprite ucode with output through DRAM FIFO to RDP: */
extern long long int gspSprite2D_fifoTextStart[], gspSprite2D_fifoTextEnd[];
extern long long int gspSprite2D_fifoDataStart[], gspSprite2D_fifoDataEnd[];
/* basic audio ucode: */
extern long long int aspMainTextStart[], aspMainTextEnd[];
extern long long int aspMainDataStart[], aspMainDataEnd[];
/*========== F3DEX/F3DLX/F3DLP/L3DEX ==========*/
/* FIFO version only */
extern long long int gspF3DEX_fifoTextStart[], gspF3DEX_fifoTextEnd[];
extern long long int gspF3DEX_fifoDataStart[], gspF3DEX_fifoDataEnd[];
extern long long int gspF3DEX_NoN_fifoTextStart[], gspF3DEX_NoN_fifoTextEnd[];
extern long long int gspF3DEX_NoN_fifoDataStart[], gspF3DEX_NoN_fifoDataEnd[];
extern long long int gspF3DLX_fifoTextStart[], gspF3DLX_fifoTextEnd[];
extern long long int gspF3DLX_fifoDataStart[], gspF3DLX_fifoDataEnd[];
extern long long int gspF3DLX_NoN_fifoTextStart[], gspF3DLX_NoN_fifoTextEnd[];
extern long long int gspF3DLX_NoN_fifoDataStart[], gspF3DLX_NoN_fifoDataEnd[];
extern long long int gspF3DLX_Rej_fifoTextStart[], gspF3DLX_Rej_fifoTextEnd[];
extern long long int gspF3DLX_Rej_fifoDataStart[], gspF3DLX_Rej_fifoDataEnd[];
extern long long int gspF3DLP_Rej_fifoTextStart[], gspF3DLP_Rej_fifoTextEnd[];
extern long long int gspF3DLP_Rej_fifoDataStart[], gspF3DLP_Rej_fifoDataEnd[];
extern long long int gspL3DEX_fifoTextStart[], gspL3DEX_fifoTextEnd[];
extern long long int gspL3DEX_fifoDataStart[], gspL3DEX_fifoDataEnd[];
/*========== F3DEX2/F3DLX2/F3DLP2/L3DEX2 ==========*/
/* FIFO version only */
extern long long int gspF3DEX2_fifoTextStart[], gspF3DEX2_fifoTextEnd[];
extern long long int gspF3DEX2_fifoDataStart[], gspF3DEX2_fifoDataEnd[];
extern long long int gspF3DEX2_NoN_fifoTextStart[],gspF3DEX2_NoN_fifoTextEnd[];
extern long long int gspF3DEX2_NoN_fifoDataStart[],gspF3DEX2_NoN_fifoDataEnd[];
extern long long int gspF3DLX2_fifoTextStart[], gspF3DLX2_fifoTextEnd[];
extern long long int gspF3DLX2_fifoDataStart[], gspF3DLX2_fifoDataEnd[];
extern long long int gspF3DLX2_NoN_fifoTextStart[],gspF3DLX2_NoN_fifoTextEnd[];
extern long long int gspF3DLX2_NoN_fifoDataStart[],gspF3DLX2_NoN_fifoDataEnd[];
extern long long int gspF3DLX2_Rej_fifoTextStart[],gspF3DLX2_Rej_fifoTextEnd[];
extern long long int gspF3DLX2_Rej_fifoDataStart[],gspF3DLX2_Rej_fifoDataEnd[];
extern long long int gspF3DLP2_Rej_fifoTextStart[],gspF3DLP2_Rej_fifoTextEnd[];
extern long long int gspF3DLP2_Rej_fifoDataStart[],gspF3DLP2_Rej_fifoDataEnd[];
extern long long int gspL3DEX2_fifoTextStart[], gspL3DEX2_fifoTextEnd[];
extern long long int gspL3DEX2_fifoDataStart[], gspL3DEX2_fifoDataEnd[];
/**************************************************************************
*
* Function prototypes
*
*/
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_UCODE_H */

124
include/2.0L/PR/ultratypes.h Executable file → Normal file
View File

@ -1,90 +1,46 @@
#ifndef _ULTRATYPES_H_
#define _ULTRATYPES_H_
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*************************************************************************
*
* File: ultratypes.h
*
* This file contains various types used in Ultra64 interfaces.
*
* $Revision: 1.6 $
* $Date: 1997/12/17 04:02:06 $
* $Source: /disk6/Master/cvsmdev2/PR/include/ultratypes.h,v $
*
**************************************************************************/
/**********************************************************************
* General data types for R4300
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
typedef unsigned char u8; /* unsigned 8-bit */
typedef unsigned short u16; /* unsigned 16-bit */
typedef unsigned long u32; /* unsigned 32-bit */
typedef unsigned long long u64; /* unsigned 64-bit */
typedef signed char s8; /* signed 8-bit */
typedef short s16; /* signed 16-bit */
typedef long s32; /* signed 32-bit */
typedef long long s64; /* signed 64-bit */
typedef volatile unsigned char vu8; /* unsigned 8-bit */
typedef volatile unsigned short vu16; /* unsigned 16-bit */
typedef volatile unsigned long vu32; /* unsigned 32-bit */
typedef volatile unsigned long long vu64; /* unsigned 64-bit */
typedef volatile signed char vs8; /* signed 8-bit */
typedef volatile short vs16; /* signed 16-bit */
typedef volatile long vs32; /* signed 32-bit */
typedef volatile long long vs64; /* signed 64-bit */
typedef float f32; /* single prec floating point */
typedef double f64; /* double prec floating point */
#if !defined(_SIZE_T) && !defined(_SIZE_T_) && !defined(_SIZE_T_DEF)
#define _SIZE_T
#define _SIZE_T_DEF /* exeGCC size_t define label */
#if (_MIPS_SZLONG == 32)
typedef unsigned int size_t;
#endif
#if (_MIPS_SZLONG == 64)
typedef unsigned long size_t;
#endif
#endif
#endif /* _LANGUAGE_C */
/*************************************************************************
* Common definitions
*/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef _ULTRA64_TYPES_H_
#define _ULTRA64_TYPES_H_
#ifndef NULL
#define NULL 0
#endif
#endif /* _ULTRATYPES_H_ */
#define TRUE 1
#define FALSE 0
#ifndef _LANGUAGE_ASSEMBLY
typedef signed char s8;
typedef unsigned char u8;
typedef signed short int s16;
typedef unsigned short int u16;
typedef signed int s32;
typedef unsigned int u32;
typedef signed long long int s64;
typedef unsigned long long int u64;
typedef volatile u8 vu8;
typedef volatile u16 vu16;
typedef volatile u32 vu32;
typedef volatile u64 vu64;
typedef volatile s8 vs8;
typedef volatile s16 vs16;
typedef volatile s32 vs32;
typedef volatile s64 vs64;
typedef float f32;
typedef double f64;
#ifdef TARGET_N64
typedef u32 size_t;
typedef s32 ssize_t;
typedef u32 uintptr_t;
typedef s32 intptr_t;
typedef s32 ptrdiff_t;
#else
#include <stddef.h>
#endif
#endif // _LANGUAGE_ASSEMBLY
#endif

View File

@ -22,6 +22,8 @@
#ifndef _ULTRA64_H_
#define _ULTRA64_H_
#include <math.h>
#include <PR/ultratypes.h>
#include <PR/rcp.h>
#include <PR/os.h>

View File

@ -1,6 +1,6 @@
#ifndef _CONTROLLER_H
#define _CONTROLLER_H
#include <os_internal.h>
#include <ultra64.h>
#include <rcp.h>
//should go somewhere else but

16
include/libc/math.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef MATH_H
#define MATH_H
#define M_PI 3.14159265358979323846
#define M_PIF 3.14159265358979323846f
#define FLT_MAX (3.40282346639e+38f)
#define FLT_MIN (3.40282346639e+38f)
float sinf(float);
double sin(double);
float cosf(float);
double cos(double);
float sqrtf(float);
#endif

42
include/libc/stdarg.h Normal file
View File

@ -0,0 +1,42 @@
#ifndef STDARG_H
#define STDARG_H
/* When not building with IDO, use the builtin vaarg macros for portability. */
#ifndef __sgi
#define va_list __builtin_va_list
#define va_start __builtin_va_start
#define va_arg __builtin_va_arg
#define va_end __builtin_va_end
#else
typedef char *va_list;
#define _FP 1
#define _INT 0
#define _STRUCT 2
#define _VA_FP_SAVE_AREA 0x10
#define _VA_ALIGN(p, a) (((unsigned int)(((char *)p) + ((a) > 4 ? (a) : 4) - 1)) & -((a) > 4 ? (a) : 4))
#define va_start(vp, parmN) (vp = ((va_list)&parmN + sizeof(parmN)))
#define __va_stack_arg(list, mode) \
( \
((list) = (char *)_VA_ALIGN(list, __builtin_alignof(mode)) + \
_VA_ALIGN(sizeof(mode), 4)), \
(((char *)list) - (_VA_ALIGN(sizeof(mode), 4) - sizeof(mode))))
#define __va_double_arg(list, mode) \
( \
(((long)list & 0x1) /* 1 byte aligned? */ \
? (list = (char *)((long)list + 7), (char *)((long)list - 6 - _VA_FP_SAVE_AREA)) \
: (((long)list & 0x2) /* 2 byte aligned? */ \
? (list = (char *)((long)list + 10), (char *)((long)list - 24 - _VA_FP_SAVE_AREA)) \
: __va_stack_arg(list, mode))))
#define va_arg(list, mode) ((mode *)(((__builtin_classof(mode) == _FP && \
__builtin_alignof(mode) == sizeof(double)) \
? __va_double_arg(list, mode) \
: __va_stack_arg(list, mode))))[-1]
#define va_end(__list)
#endif
#endif

10
include/libc/stddef.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef STDDEF_H
#define STDDEF_H
#include "PR/ultratypes.h"
#ifndef offsetof
#define offsetof(st, m) ((size_t)&(((st *)0)->m))
#endif
#endif

6
include/libc/stdio.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef STDIO_H
#define STDIO_H
extern int sprintf(char *s, const char *fmt, ...);
#endif

19
include/libc/stdlib.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef STDLIB_H
#define STDLIB_H
typedef struct lldiv_t
{
long long quot;
long long rem;
} lldiv_t;
typedef struct ldiv_t
{
long quot;
long rem;
} ldiv_t;
lldiv_t lldiv(long long num, long long denom);
ldiv_t ldiv(long num, long denom);
#endif

10
include/libc/string.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef STRING_H
#define STRING_H
#include "PR/ultratypes.h"
void *memcpy(void *dst, const void *src, size_t size);
size_t strlen(const char *str);
char *strchr(const char *str, s32 ch);
#endif

View File

@ -1,6 +1,6 @@
#ifndef _OSINT_H
#define _OSINT_H
#include <os_internal.h>
#include <ultra64.h>
typedef struct __OSEventState
{
OSMesgQueue *messageQueue;

View File

@ -1,6 +1,6 @@
#ifndef _PIINT_H
#define _PIINT_H
#include <os_internal.h>
#include <ultra64.h>
#include <rcp.h>
//https://github.com/LuigiBlood/64dd/wiki/Memory-Map

View File

@ -1,6 +1,6 @@
#ifndef _SIINT_H
#define _SIINT_H
#include <os_internal.h>
#include <ultra64.h>
#include <rcp.h>
void __osSiGetAccess(void);

View File

@ -1424,7 +1424,8 @@ typedef struct {
u8 unk3;
Actor* player_pointer; // 0x04
CharacterChange8Array unk8[2]; // TODO: How many elements are there here?
u8 pad_unknown[0x208 - 0x80];
f32 unk88[3][4][4]; // TODO: How many?
u8 pad_unknownB8[0x210 - 0x148];
f32 look_at_eye_x; // 0x210 maybe an array?
f32 look_at_eye_y; // 0x214
f32 look_at_eye_z; // 0x218

View File

@ -1,6 +1,6 @@
#ifndef _VIINT_H
#define _VIINT_H
#include <os_internal.h>
#include <ultra64.h>
#define OS_TV_TYPE_PAL 0
#define OS_TV_TYPE_NTSC 1

View File

@ -46,7 +46,7 @@ us,.code,func_80025D1C,156,yes
us,.code,func_800262C0,120,yes
us,.code,func_8002646C,196,yes
us,.code,func_80026FD0,100,yes
us,.code,func_800257D4,220,no
us,.code,func_800257D4,220,yes
us,.code,func_80027448,2424,no
us,.code,func_8002448C,140,yes
us,.code,func_80027034,88,yes

1 version section function length matching
46 us .code func_800262C0 120 yes
47 us .code func_8002646C 196 yes
48 us .code func_80026FD0 100 yes
49 us .code func_800257D4 220 no yes
50 us .code func_80027448 2424 no
51 us .code func_8002448C 140 yes
52 us .code func_80027034 88 yes

View File

@ -21,7 +21,7 @@ us,boot,guTranslate,84,yes
us,boot,func_80000D8C,188,yes
us,boot,__osAiDeviceBusy,48,yes
us,boot,osEepromLongRead,140,yes
us,boot,func_80001700,1012,no
us,boot,func_80001700,1012,yes
us,boot,func_80002790,152,no
us,boot,func_800022D4,288,yes
us,boot,func_80002724,44,yes

1 version section function length matching
21 us boot func_80000D8C 188 yes
22 us boot __osAiDeviceBusy 48 yes
23 us boot osEepromLongRead 140 yes
24 us boot func_80001700 1012 no yes
25 us boot func_80002790 152 no
26 us boot func_800022D4 288 yes
27 us boot func_80002724 44 yes

View File

@ -1975,7 +1975,7 @@ us,.code,func_8060B7D0,28,yes
us,.code,func_8063DB0C,48,yes
us,.code,func_80604C80,60,yes
us,.code,func_805FF1B0,324,yes
us,.code,func_806FB3D0,72,no
us,.code,func_806FB3D0,72,yes
us,.code,func_806E0178,284,yes
us,.code,func_806D239C,268,yes
us,.code,func_8065E138,1276,no

1 version section function length matching
1975 us .code func_8063DB0C 48 yes
1976 us .code func_80604C80 60 yes
1977 us .code func_805FF1B0 324 yes
1978 us .code func_806FB3D0 72 no yes
1979 us .code func_806E0178 284 yes
1980 us .code func_806D239C 268 yes
1981 us .code func_8065E138 1276 no

View File

@ -1975,7 +1975,7 @@ us,.code,func_8060B7D0,28,yes
us,.code,func_8063DB0C,48,yes
us,.code,func_80604C80,60,yes
us,.code,func_805FF1B0,324,yes
us,.code,func_806FB3D0,72,no
us,.code,func_806FB3D0,72,yes
us,.code,func_806E0178,284,yes
us,.code,func_806D239C,268,yes
us,.code,func_8065E138,1276,no
@ -3667,7 +3667,7 @@ us,.code,func_80025D1C,156,yes
us,.code,func_800262C0,120,yes
us,.code,func_8002646C,196,yes
us,.code,func_80026FD0,100,yes
us,.code,func_800257D4,220,no
us,.code,func_800257D4,220,yes
us,.code,func_80027448,2424,no
us,.code,func_8002448C,140,yes
us,.code,func_80027034,88,yes
@ -3987,7 +3987,7 @@ us,boot,guTranslate,84,yes
us,boot,func_80000D8C,188,yes
us,boot,__osAiDeviceBusy,48,yes
us,boot,osEepromLongRead,140,yes
us,boot,func_80001700,1012,no
us,boot,func_80001700,1012,yes
us,boot,func_80002790,152,no
us,boot,func_800022D4,288,yes
us,boot,func_80002724,44,yes

1 version section function length matching
1975 us .code func_8063DB0C 48 yes
1976 us .code func_80604C80 60 yes
1977 us .code func_805FF1B0 324 yes
1978 us .code func_806FB3D0 72 no yes
1979 us .code func_806E0178 284 yes
1980 us .code func_806D239C 268 yes
1981 us .code func_8065E138 1276 no
3667 us .code func_800262C0 120 yes
3668 us .code func_8002646C 196 yes
3669 us .code func_80026FD0 100 yes
3670 us .code func_800257D4 220 no yes
3671 us .code func_80027448 2424 no
3672 us .code func_8002448C 140 yes
3673 us .code func_80027034 88 yes
3987 us boot func_80000D8C 188 yes
3988 us boot __osAiDeviceBusy 48 yes
3989 us boot osEepromLongRead 140 yes
3990 us boot func_80001700 1012 no yes
3991 us boot func_80002790 152 no
3992 us boot func_800022D4 288 yes
3993 us boot func_80002724 44 yes

View File

@ -9,7 +9,7 @@
</mask>
<g mask="url(#anybadge_1)">
<path fill="#555" d="M0 0h50v20H0z"/>
<path fill="#c07400" d="M50 0h67v20H50z"/>
<path fill="#c07800" d="M50 0h67v20H50z"/>
<path fill="url(#b)" d="M0 0h117v20H0z"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
@ -17,7 +17,7 @@
<text x="25.0" y="14">critter</text>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="84.5" y="15" fill="#010101" fill-opacity=".3">30.2950%</text>
<text x="83.5" y="14">30.2950%</text>
<text x="84.5" y="15" fill="#010101" fill-opacity=".3">31.2722%</text>
<text x="83.5" y="14">31.2722%</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 0h71v20H0z"/>
<path fill="#c0bf00" d="M71 0h67v20H71z"/>
<path fill="#bac000" 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">49.6178%</text>
<text x="104.5" y="14">49.6178%</text>
<text x="105.5" y="15" fill="#010101" fill-opacity=".3">51.4422%</text>
<text x="104.5" y="14">51.4422%</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -17,7 +17,7 @@
<text x="38.5" y="14">global_asm</text>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="111.5" y="15" fill="#010101" fill-opacity=".3">31.6031%</text>
<text x="110.5" y="14">31.6031%</text>
<text x="111.5" y="15" fill="#010101" fill-opacity=".3">31.6089%</text>
<text x="110.5" y="14">31.6089%</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -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">31.2633%</text>
<text x="165.5" y="14">31.2633%</text>
<text x="166.5" y="15" fill="#010101" fill-opacity=".3">31.3424%</text>
<text x="165.5" y="14">31.3424%</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -144,7 +144,6 @@ extern s32 D_807F6C28;
void func_80024000(Critter*, s32, f32);
void func_80024578(Critter *);
s32 func_800257D4(s32);
s32 func_80025AD0(s32, s32);
void func_80025DB8(CritterStruct6*, CritterStruct6*, u8, s16, u8);
void func_800262C0(Critter*, CritterController*);
@ -382,13 +381,12 @@ void func_80025500(Critter *arg0) {
// Displaylist stuff
#pragma GLOBAL_ASM("asm/nonmatchings/critter/code_0/func_800255C4.s")
// Displaylist stuff
#pragma GLOBAL_ASM("asm/nonmatchings/critter/code_0/func_800257D4.s")
extern Gfx D_01000118;
extern f32 D_02000180[];
extern f32 D_02000200[];
/*
// TODO: Displaylist stuff
Gfx *func_800257D4(Gfx *arg0) {
gSPDisplayList(arg0++, 0x01000118);
gSPDisplayList(arg0++, &D_01000118);
gDPPipeSync(arg0++);
gDPSetCycleType(arg0++, G_CYC_1CYCLE);
gSPClearGeometryMode(arg0++, G_ZBUFFER | G_SHADE | G_CULL_BOTH |
@ -396,13 +394,12 @@ Gfx *func_800257D4(Gfx *arg0) {
G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH |
G_CLIPPING | 0x0040F9FA);
gSPMatrix(arg0++,
(&character_change_array[cc_player_index] + (D_807444FC << 6) + 0x88),
(&character_change_array[cc_player_index].unk88[D_807444FC]),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(arg0++, 0x20002000, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
gSPMatrix(arg0++, 0x20001800, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPMatrix(arg0++, &D_02000200, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
gSPMatrix(arg0++, &D_02000180, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
return arg0;
}
*/
void func_800258B0(f32 arg0[4][4], s16 arg1, s16 arg2, s16 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7) {
s32 temp;

View File

@ -1,12 +1,54 @@
#include <ultra64.h>
#include "functions.h"
#include <os_internal.h>
#include <ultra64.h>
#include <rcp.h>
#include "piint.h"
#pragma GLOBAL_ASM("asm/nonmatchings/dk64_boot/dk64_boot_CA20/osEPiRawStartDma.s")
/*
#define OS_RAMROM_STACKSIZE 1024
#ifndef WAIT_ON_IOBUSY
#define WAIT_ON_IOBUSY(stat) \
stat = IO_READ(PI_STATUS_REG); \
while (stat & (PI_STATUS_IO_BUSY | PI_STATUS_DMA_BUSY)) \
stat = IO_READ(PI_STATUS_REG);
#endif
#define UPDATE_REG(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] != pihandle) \
{ \
OSPiHandle *cHandle = __osCurrentHandle[domain]; \
if (domain == PI_DOMAIN1) \
{ \
UPDATE_REG(PI_BSD_DOM1_LAT_REG, latency); \
UPDATE_REG(PI_BSD_DOM1_PGS_REG, pageSize); \
UPDATE_REG(PI_BSD_DOM1_RLS_REG, relDuration); \
UPDATE_REG(PI_BSD_DOM1_PWD_REG, pulse); \
UPDATE_REG(PI_BSD_DOM1_PGS_REG, domain); \
} \
else \
{ \
UPDATE_REG(PI_BSD_DOM2_LAT_REG, latency); \
UPDATE_REG(PI_BSD_DOM2_PGS_REG, pageSize); \
UPDATE_REG(PI_BSD_DOM2_RLS_REG, relDuration); \
UPDATE_REG(PI_BSD_DOM2_PWD_REG, pulse); \
UPDATE_REG(PI_BSD_DOM2_PGS_REG, domain); \
} \
__osCurrentHandle[domain] = pihandle; \
}
*/
/*
// TODO: I think we need the 2.0I version of EPI_SYNC
s32 osEPiRawStartDma(OSPiHandle *pihandle, s32 direction, u32 devAddr, void *dramAddr, u32 size)

View File

@ -200,12 +200,6 @@ int *m; /* maximum lookup bits, returns actual */
return y != 0 && g != 1;
}
#pragma GLOBAL_ASM("asm/nonmatchings/dk64_boot/inflate/func_80001700.s")
#if FALSE
// TODO: Hmmmm....
//^inflate_codes
/* static */ int func_80001700(struct huft *tl, struct huft *td, s32 bl, s32 bd) // int inflate_codes(struct huft *tl, struct huft *td, s32 bl, s32 bd)
{
register unsigned e; /* table entry flag/number of extra bits */
@ -215,7 +209,6 @@ int *m; /* maximum lookup bits, returns actual */
unsigned ml, md; /* masks for bl and bd bits */
register u32 b; /* bit buffer */
register unsigned k; /* number of bits in bit buffer */
register u8 tmp;
/* make local copies of globals */
b = D_80013AB4; // b = bb; /* initialize bit buffer */
@ -239,10 +232,7 @@ int *m; /* maximum lookup bits, returns actual */
if (e == 16) /* then it's a literal */
{
tmp = (u8)t->v.n;
D_80013AC4[w++] = tmp;
// crc1 += tmp;
// crc2 ^= tmp << (crc1 & 0x17);
D_80013AC4[w++] = t->v.n;
}
else /* it's an EOB or a length */
{//L80000EAC
@ -271,11 +261,12 @@ int *m; /* maximum lookup bits, returns actual */
/* do the copy */
do{
tmp = D_80013AC4[d++];
D_80013AC4[w++] = tmp;
// crc1 += tmp;
// crc2 ^= tmp << (crc1 & 0x17);
}while(--n);
e = n;
n = 0;
do{
D_80013AC4[w++] = D_80013AC4[d++];
}while(--e);
}while(n != 0);
}
}
@ -288,8 +279,6 @@ int *m; /* maximum lookup bits, returns actual */
return 0;
}
#endif
/* static */ int func_80001AF4(void) // int inflate_stored(void)
/* "decompress" an inflated type 0 (stored) block. */
{

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include <rcp.h>
#include "osint.h"

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "controller.h"
s32 osEepromLongRead(OSMesgQueue *mq, u8 address, u8 *buffer, int length)

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "controller.h"
#include "siint.h"
#include <rcp.h>

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "controller.h"
u16 __osSumcalc(u8 *ptr, int length)

View File

@ -1,6 +1,6 @@
#include <ultra64.h>
#include "functions.h"
#include <os_internal.h>
#include <ultra64.h>
#include <rcp.h>
#include "controller.h"
#include "siint.h"

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#pragma GLOBAL_ASM("asm/nonmatchings/dk64_boot/io/crc/__osContAddressCrc.s")

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
// #include <ultra64.h>
#include <rcp.h>
u32 osDpGetStatus() {

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include <rcp.h>
void osDpSetStatus(u32 data)

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include <rcp.h>
#include "piint.h"

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "controller.h"
#include "siint.h"

View File

@ -1,6 +1,6 @@
#include <ultra64.h>
#include "functions.h"
#include <os_internal.h>
#include <ultra64.h>
#include "controller.h"
#include "siint.h"

View File

@ -1,7 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include <os_internal.h>
#include <ultra64.h>
#include "controller.h"
#include "siint.h"

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "piint.h"
u32 osPiGetStatus()

View File

@ -1,7 +1,7 @@
#include <ultra64.h>
#include "functions.h"
#include <os_internal.h>
#include <ultra64.h>
#include "piint.h"
// OSDevMgr __osPiDevMgr = {0};

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "piint.h"
s32 osPiRawStartDma(s32 direction, u32 devAddr, void *dramAddr, u32 size)

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include <rcp.h>
void __osSpSetStatus(u32 data) {

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include <sptask.h>
#include <bstring.h>
#include <rcp.h>

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include <rcp.h>
void osSpTaskYield(void)

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include <rcp.h>
#include <sptask.h>

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "viint.h"
void osViBlack(u8 active)

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "viint.h"
void *osViGetCurrentFramebuffer(void)

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "viint.h"
void *osViGetNextFramebuffer(void)

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include <rcp.h>
#include "viint.h"
#include "osint.h"

View File

@ -1,4 +1,5 @@
#include <os_internal.h>
#include <ultra64.h>
#include <ultra64.h>
#include "viint.h"
void osViSetMode(OSViMode *modep)

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include <rcp.h>
#include "viint.h"

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "viint.h"
void osViSwapBuffer(void* frameBufPtr) {

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "osint.h"
void osCreateMesgQueue(OSMesgQueue *mq, OSMesg *msg, s32 msgCount)

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include <R4300.h>
void __osCleanupThread(void);

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "osint.h"
OSId osGetThreadId(OSThread *thread)

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "osint.h"
OSTime osGetTime()

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "osint.h"
__OSEventState __osEventStateTab[OS_NUM_EVENTS];

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include <R4300.h>
void __osSetGlobalIntMask(OSHWIntr mask)

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "osint.h"
void osSetThreadPri(OSThread *t, OSPri pri)

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "osint.h"
void osSetTime(OSTime time) {

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "osint.h"
int osSetTimer(OSTimer *t, OSTime value, OSTime interval, OSMesgQueue *mq, OSMesg msg)

View File

@ -1,5 +1,5 @@
#include <os_internal.h>
#include <ultra64.h>
#include "osint.h"
void osStopThread(OSThread *t)

View File

@ -1,4 +1,4 @@
#include <os_internal.h>
#include <ultra64.h>
#include "osint.h"
void osYieldThread(void) {

View File

@ -616,14 +616,11 @@ void func_806FB370(u8 HUDItemIndex, u8 playerIndex, u8 arg2) {
}
*/
#pragma GLOBAL_ASM("asm/nonmatchings/global_asm/hud/func_806FB3D0.s")
/*
// TODO: Same deal as above
// TODO: Could use some cleanup
// Might need a middle struct with an array of 4x15 HUDDisplays
u8 func_806FB3D0(u8 HUDItemIndex, u8 playerIndex) {
return D_80754280[playerIndex].hud_item[HUDItemIndex].unk_2c;
return ((HUDDisplay*)&D_80754280[0].hud_item[(playerIndex * 0xF) + HUDItemIndex])->unk_2c;
}
*/
s32 func_806FB418(void) {
s32 kongIndex;

View File

@ -31,3 +31,7 @@ D_8071FC40 = 0x8071FC40;
D_8002A010 = 0x8002A010;
D_80029F74 = 0x80029F74;
D_01000118 = 0x01000118;
D_02000180 = 0x02000180;
D_02000200 = 0x02000200;