mirror of
https://gitlab.com/ryandwyer/perfect-dark
synced 2026-08-03 08:33:20 -04:00
Replace libultra headers with ones from SM64
This commit is contained in:
@@ -0,0 +1,428 @@
|
||||
#ifndef _ABI_H_
|
||||
#define _ABI_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.32 $
|
||||
* $Date: 1997/02/11 08:16:37 $
|
||||
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/abi.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Header file for the Audio Binary Interface.
|
||||
* This is included in the Media Binary Interface file
|
||||
* mbi.h.
|
||||
*
|
||||
* This file follows the framework used for graphics.
|
||||
*
|
||||
*/
|
||||
|
||||
/* 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_DMEMMOVE 10
|
||||
#define A_LOADADPCM 11
|
||||
#define A_MIXER 12
|
||||
#define A_INTERLEAVE 13
|
||||
#define A_POLEF 14
|
||||
#define A_SETLOOP 15
|
||||
|
||||
#define ACMD_SIZE 32
|
||||
/*
|
||||
* Audio flags
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
/*
|
||||
* BEGIN C-specific section: (typedef's)
|
||||
*/
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/*
|
||||
* Data Structures.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
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;
|
||||
} Apolef;
|
||||
|
||||
typedef struct {
|
||||
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;
|
||||
} Aclearbuff;
|
||||
|
||||
typedef struct {
|
||||
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;
|
||||
} Aloadbuff;
|
||||
|
||||
typedef struct {
|
||||
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;
|
||||
} Amixer;
|
||||
|
||||
typedef struct {
|
||||
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;
|
||||
} Aresample;
|
||||
|
||||
typedef struct {
|
||||
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;
|
||||
} Asavebuff;
|
||||
|
||||
typedef struct {
|
||||
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;
|
||||
} Asetbuff;
|
||||
|
||||
typedef struct {
|
||||
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;
|
||||
} Admemmove;
|
||||
|
||||
typedef struct {
|
||||
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;
|
||||
} Asetloop;
|
||||
|
||||
/*
|
||||
* Generic Acmd Packet
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned int w0;
|
||||
unsigned int 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 */
|
||||
} Acmd;
|
||||
|
||||
/*
|
||||
* ADPCM State
|
||||
*/
|
||||
typedef short ADPCM_STATE[16];
|
||||
|
||||
/*
|
||||
* Pole filter state
|
||||
*/
|
||||
typedef short POLEF_STATE[4];
|
||||
|
||||
/*
|
||||
* Resampler state
|
||||
*/
|
||||
typedef short RESAMPLE_STATE[16];
|
||||
|
||||
/*
|
||||
* Resampler constants
|
||||
*/
|
||||
#define UNITY_PITCH 0x8000
|
||||
#define MAX_RATIO 1.99996 /* within .03 cents of +1 octave */
|
||||
|
||||
/*
|
||||
* Enveloper/Mixer state
|
||||
*/
|
||||
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); \
|
||||
}
|
||||
|
||||
#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); \
|
||||
}
|
||||
|
||||
#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); \
|
||||
}
|
||||
|
||||
#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); \
|
||||
}
|
||||
|
||||
#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); \
|
||||
}
|
||||
|
||||
#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); \
|
||||
}
|
||||
|
||||
#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); \
|
||||
}
|
||||
|
||||
#define aSaveBuffer(pkt, s) \
|
||||
{ \
|
||||
Acmd *_a = (Acmd *)pkt; \
|
||||
\
|
||||
_a->words.w0 = _SHIFTL(A_SAVEBUFF, 24, 8); \
|
||||
_a->words.w1 = (unsigned int)(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); \
|
||||
}
|
||||
|
||||
#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); \
|
||||
}
|
||||
|
||||
#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); \
|
||||
}
|
||||
|
||||
#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; \
|
||||
}
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* The below command is seemingly declared manually and used for the
|
||||
* sound driver.
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// This is a version of aSetAudio 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.
|
||||
|
||||
#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 = (unsigned int)(tr); \
|
||||
}
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#endif /* !_ABI_H_ */
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,971 @@
|
||||
/*
|
||||
* Graphics Binary Interface
|
||||
* This supports Fast3D, Fast3DEX, and Fast3DEX2.
|
||||
*/
|
||||
|
||||
/* Fast3DZEX support */
|
||||
.ifdef F3DZEX_GBI
|
||||
.set F3DEX_GBI_2, 1
|
||||
.endif
|
||||
|
||||
/* Macros */
|
||||
|
||||
/* commands with no parameters */
|
||||
.macro f3d_noparam cmd
|
||||
.word (\cmd << 24), 0x00000000
|
||||
.endm
|
||||
|
||||
.macro gsImmp1 cmd, param
|
||||
.word (\cmd << 24), \param
|
||||
.endm
|
||||
|
||||
/* DMA helper */
|
||||
.macro gsDma1p cmd, segAddr, length, params
|
||||
.word (\cmd << 24) | ((\params & 0xFFFF) << 16) | (\length & 0xFFFF)
|
||||
.word \segAddr
|
||||
.endm
|
||||
|
||||
/* DMA helper 3*/
|
||||
.macro gsDma3p cmd, byte2, byte3, byte4, segAddr
|
||||
.byte \cmd, \byte2, \byte3, \byte4
|
||||
.word \segAddr
|
||||
.endm
|
||||
|
||||
/* Helper for RGBA colors. */
|
||||
.macro sDPRGBColor cmd r, g, b, a
|
||||
.word \cmd << 24
|
||||
.byte \r, \g, \b, \a
|
||||
.endm
|
||||
|
||||
/* Opcodes */
|
||||
|
||||
.ifdef F3DEX_GBI_2
|
||||
.set G_MTX, 0xDA
|
||||
.set G_MOVEMEM, 0xDC
|
||||
.set G_VTX, 0x01
|
||||
.set G_DL, 0xDE
|
||||
.set G_TRI2, 0x06
|
||||
.set G_RDPHALF_1, 0xE1
|
||||
.set G_RDPHALF_2, 0xF1
|
||||
.set G_GEOMETRYMODE, 0xD9 /* Fast3DEX2 uses one GeometryMode opcode. */
|
||||
.set G_ENDDL, 0xDF
|
||||
.set G_SETOTHERMODE_L, 0xE2
|
||||
.set G_SETOTHERMODE_H, 0xE3
|
||||
.set G_TEXTURE, 0xD7
|
||||
.set G_MOVEWORD, 0xDB
|
||||
.set G_TRI1, 0x05
|
||||
.set G_NOOP, 0xC0
|
||||
.set G_RDPLOADSYNC, 0xE6
|
||||
.set G_RDPPIPESYNC, 0xE7
|
||||
.set G_RDPTILESYNC, 0xE8
|
||||
.set G_RDPFULLSYNC, 0xE9
|
||||
.set G_LOADTLUT, 0xF0
|
||||
.set G_SETTILESIZE, 0xF2
|
||||
.set G_LOADBLOCK, 0xF3
|
||||
.set G_SETTILE, 0xF5
|
||||
.set G_SETFILLCOLOR, 0xF7
|
||||
.set G_SETFOGCOLOR, 0xF8
|
||||
.set G_SETBLENDCOLOR, 0xF9
|
||||
.set G_SETPRIMCOLOR, 0xFA
|
||||
.set G_SETENVCOLOR, 0xFB
|
||||
.set G_SETCOMBINE, 0xFC
|
||||
.set G_SETTIMG, 0xFD
|
||||
.set G_TEXRECT, 0xE4
|
||||
|
||||
.else /* F3D and F3DEX */
|
||||
.set G_MTX, 0x01
|
||||
.set G_MOVEMEM, 0x03
|
||||
.set G_VTX, 0x04
|
||||
.set G_DL, 0x06
|
||||
.set G_TRI2, 0xB1
|
||||
.set G_RDPHALF_CONT, 0xB2
|
||||
.set G_RDPHALF_2, 0xB3
|
||||
.set G_RDPHALF_1, 0xB4
|
||||
.set G_CLEARGEOMETRYMODE, 0xB6
|
||||
.set G_SETGEOMETRYMODE, 0xB7
|
||||
.set G_ENDDL, 0xB8
|
||||
.set G_SETOTHERMODE_L, 0xB9
|
||||
.set G_SETOTHERMODE_H, 0xBA
|
||||
.set G_TEXTURE, 0xBB
|
||||
.set G_MOVEWORD, 0xBC
|
||||
.set G_TRI1, 0xBF
|
||||
.set G_NOOP, 0xC0
|
||||
.set G_TEXRECT, 0xE4
|
||||
.set G_RDPLOADSYNC, 0xE6
|
||||
.set G_RDPPIPESYNC, 0xE7
|
||||
.set G_RDPTILESYNC, 0xE8
|
||||
.set G_RDPFULLSYNC, 0xE9
|
||||
.set G_LOADTLUT, 0xF0
|
||||
.set G_SETTILESIZE, 0xF2
|
||||
.set G_LOADBLOCK, 0xF3
|
||||
.set G_SETTILE, 0xF5
|
||||
.set G_FILLRECT, 0xF6
|
||||
.set G_SETFILLCOLOR, 0xF7
|
||||
.set G_SETFOGCOLOR, 0xF8
|
||||
.set G_SETBLENDCOLOR, 0xF9
|
||||
.set G_SETPRIMCOLOR, 0xFA
|
||||
.set G_SETENVCOLOR, 0xFB
|
||||
.set G_SETCOMBINE, 0xFC
|
||||
.set G_SETTIMG, 0xFD
|
||||
.endif
|
||||
|
||||
/* Arguments */
|
||||
|
||||
/* gSPMatrix */
|
||||
.ifdef F3DEX_GBI_2
|
||||
.set G_MTX_MODELVIEW, 0x00
|
||||
.set G_MTX_PROJECTION, 0x04
|
||||
.set G_MTX_MUL, 0x00
|
||||
.set G_MTX_LOAD, 0x02
|
||||
.set G_MTX_NOPUSH, 0x00
|
||||
.set G_MTX_PUSH, 0x01
|
||||
|
||||
.else /* F3D and F3DEX */
|
||||
.set G_MTX_MODELVIEW, 0x00
|
||||
.set G_MTX_PROJECTION, 0x01
|
||||
.set G_MTX_MUL, 0x00
|
||||
.set G_MTX_LOAD, 0x02
|
||||
.set G_MTX_NOPUSH, 0x00
|
||||
.set G_MTX_PUSH, 0x04
|
||||
.endif
|
||||
|
||||
/* gSPLight */
|
||||
.ifdef F3DEX_GBI_2
|
||||
.set G_MVO_L0, (2*24)
|
||||
.else
|
||||
.set G_MV_L0, 0x86
|
||||
.endif
|
||||
|
||||
/* gSPDisplayList / gSPBranchDisplayList */
|
||||
.set G_DL_PUSH, 0x00
|
||||
.set G_DL_NOPUSH, 0x01
|
||||
|
||||
/* gSPXGeometryMode */
|
||||
.ifdef F3DEX_GBI_2
|
||||
.set G_ZBUFFER, 0x00000001
|
||||
.set G_SHADE, 0x00000004
|
||||
.set G_SHADING_SMOOTH, 0x00200000
|
||||
.set G_CULL_FRONT, 0x00000200
|
||||
.set G_CULL_BACK, 0x00000400
|
||||
.set G_FOG, 0x00010000
|
||||
.set G_LIGHTING, 0x00020000
|
||||
.set G_TEXTURE_GEN, 0x00040000
|
||||
.set G_TEXTURE_GEN_LINEAR, 0x00080000
|
||||
|
||||
.else /* F3D and F3DEX */
|
||||
.set G_ZBUFFER, 0x00000001
|
||||
.set G_SHADE, 0x00000004
|
||||
.set G_SHADING_SMOOTH, 0x00000200
|
||||
.set G_CULL_FRONT, 0x00001000
|
||||
.set G_CULL_BACK, 0x00002000
|
||||
.set G_FOG, 0x00010000
|
||||
.set G_LIGHTING, 0x00020000
|
||||
.set G_TEXTURE_GEN, 0x00040000
|
||||
.set G_TEXTURE_GEN_LINEAR, 0x00080000
|
||||
.endif
|
||||
|
||||
/*
|
||||
* Used for matching F3DEX2-style geometry mode usage.
|
||||
* Ignored when building with Fast3DEX2.
|
||||
*/
|
||||
.set G_ORDER_SFIRST, 0
|
||||
.set G_ORDER_CFIRST, 1
|
||||
|
||||
/* gSPSetOtherMode (L) */
|
||||
.set G_MDSFT_ALPHACOMPARE, 0
|
||||
.set G_MDSFT_ZSRCSEL, 2
|
||||
.set G_MDSFT_RENDERMODE, 3
|
||||
.set G_MDSFT_BLENDER, 16
|
||||
|
||||
.set G_AC_NONE, (0 << G_MDSFT_ALPHACOMPARE)
|
||||
.set G_AC_THRESHOLD, (1 << G_MDSFT_ALPHACOMPARE)
|
||||
.set G_AC_DITHER, (3 << G_MDSFT_ALPHACOMPARE)
|
||||
|
||||
.set G_ZS_PIXEL, (0 << G_MDSFT_ZSRCSEL)
|
||||
.set G_ZS_PRIM, (1 << G_MDSFT_ZSRCSEL)
|
||||
|
||||
/************************* Set Render Mode *************************/
|
||||
|
||||
/* Cycle-Independent Blender Settings */
|
||||
|
||||
.set AA_EN, 0x8
|
||||
.set Z_CMP, 0x10
|
||||
.set Z_UPD, 0x20
|
||||
.set IM_RD, 0x40
|
||||
.set CLR_ON_CVG, 0x80
|
||||
.set CVG_DST_CLAMP, 0
|
||||
.set CVG_DST_WRAP, 0x100
|
||||
.set CVG_DST_FULL, 0x200
|
||||
.set CVG_DST_SAVE, 0x300
|
||||
.set ZMODE_OPA, 0
|
||||
.set ZMODE_INTER, 0x400
|
||||
.set ZMODE_XLU, 0x800
|
||||
.set ZMODE_DEC, 0xc00
|
||||
.set CVG_X_ALPHA, 0x1000
|
||||
.set ALPHA_CVG_SEL, 0x2000
|
||||
.set FORCE_BL, 0x4000
|
||||
.set TEX_EDGE, 0x0000 /* used to be 0x8000 */
|
||||
|
||||
/* Cycle-Dependent Blender Settings */
|
||||
/* Blender runs the formula: (P * A + M - B) / (A + B) */
|
||||
/* P and M values */
|
||||
.set G_BL_CLR_IN, 0 /* 1st cycle: get color from input pixel.
|
||||
2nd cycle: param is the numerator of the formula as computed for the first cycle. */
|
||||
.set G_BL_CLR_MEM, 1 /* Takes color from the framebuffer */
|
||||
.set G_BL_CLR_BL, 2 /* Takes color from the blend color register */
|
||||
.set G_BL_CLR_FOG, 3 /* Takes color from the fog color register */
|
||||
/* A values */
|
||||
.set G_BL_A_IN, 0 /* Parameter is alpha value of input pixel */
|
||||
.set G_BL_A_FOG, 1 /* Alpha value from the fog color register */
|
||||
.set G_BL_A_SHADE, 2 /* Calculated alpha value for the pixel, presumably */
|
||||
/* B values */
|
||||
.set G_BL_1MA, 0 /* 1.0 - source alpha */
|
||||
.set G_BL_A_MEM, 1 /* Framebuffer alpha value */
|
||||
.set G_BL_1, 2 /* Constant 1.0 */
|
||||
/* A and B values */
|
||||
.set G_BL_0, 3 /* Constant 0.0 */
|
||||
|
||||
.macro .BL_DEPENDENT_SETTING label, p, a, m, b
|
||||
.set \label\()_CYCLE1, ((\p << 30) | (\a << 26) | (\m << 22) | (\b << 18))
|
||||
.set \label\()_CYCLE2, ((\p << 28) | (\a << 24) | (\m << 20) | (\b << 16))
|
||||
.endm
|
||||
|
||||
.macro .BL_DEPENDENT_SETTING_CYCLE1_ONLY label, p, a, m, b
|
||||
.set \label, ((\p << 30) | (\a << 26) | (\m << 22) | (\b << 18))
|
||||
.endm
|
||||
|
||||
.BL_DEPENDENT_SETTING BL_DEP_SETTING_ZERO, G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_IN, G_BL_1MA /* Basically (0, 0, 0 ,0) */
|
||||
|
||||
/* Properly label these later! */
|
||||
.BL_DEPENDENT_SETTING BL_DEP_SETTING_1, G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_A_MEM
|
||||
.BL_DEPENDENT_SETTING BL_DEP_SETTING_2, G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA
|
||||
.BL_DEPENDENT_SETTING BL_DEP_SETTING_3, G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1
|
||||
.BL_DEPENDENT_SETTING BL_DEP_SETTING_4, G_BL_CLR_IN, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_1
|
||||
.BL_DEPENDENT_SETTING BL_DEP_SETTING_5, G_BL_CLR_IN, G_BL_0, G_BL_CLR_BL, G_BL_A_MEM
|
||||
|
||||
.BL_DEPENDENT_SETTING_CYCLE1_ONLY BL_DEP_SETTING_FOG_SHADE_A, G_BL_CLR_FOG, G_BL_A_SHADE, G_BL_CLR_IN, G_BL_1MA
|
||||
.BL_DEPENDENT_SETTING_CYCLE1_ONLY BL_DEP_SETTING_FOG_PRIM_A, G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_IN, G_BL_1MA
|
||||
.BL_DEPENDENT_SETTING_CYCLE1_ONLY BL_DEP_SETTING_PASS, G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1
|
||||
|
||||
.macro .SET_RENDER_MODE label, indeptSettings, deptSettings
|
||||
.set \label , (\indeptSettings | \deptSettings\()_CYCLE1)
|
||||
.set \label\()2 , (\indeptSettings | \deptSettings\()_CYCLE2)
|
||||
.endm
|
||||
|
||||
/* TODO: Make these more readable */
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_OPA_SURF, (AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | ALPHA_CVG_SEL), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_RA_ZB_OPA_SURF, (AA_EN | Z_CMP | Z_UPD | CVG_DST_CLAMP | ZMODE_OPA | ALPHA_CVG_SEL), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_XLU_SURF, (AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | FORCE_BL | ZMODE_XLU), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_OPA_DECAL, (AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | ALPHA_CVG_SEL | ZMODE_DEC), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_RA_ZB_OPA_DECAL, (AA_EN | Z_CMP | CVG_DST_WRAP | ALPHA_CVG_SEL | ZMODE_DEC), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_XLU_DECAL, (AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | FORCE_BL | ZMODE_DEC), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_OPA_INTER, (AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ALPHA_CVG_SEL | ZMODE_INTER), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_RA_ZB_OPA_INTER, (AA_EN | Z_CMP | Z_UPD | CVG_DST_CLAMP | ALPHA_CVG_SEL | ZMODE_INTER), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_XLU_INTER, (AA_EN | Z_CMP | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | FORCE_BL | ZMODE_INTER), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_XLU_LINE, (AA_EN | Z_CMP | IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | ALPHA_CVG_SEL | FORCE_BL | ZMODE_XLU), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_DEC_LINE, (AA_EN | Z_CMP | IM_RD | CVG_DST_SAVE | CVG_X_ALPHA | ALPHA_CVG_SEL | FORCE_BL | ZMODE_DEC), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_TEX_EDGE, (AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_TEX_INTER, (AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_INTER | TEX_EDGE), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_SUB_SURF, (AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_FULL | ZMODE_OPA | ALPHA_CVG_SEL), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_PCL_SURF, (AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | G_AC_DITHER), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_OPA_TERR, (AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | ALPHA_CVG_SEL), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_TEX_TERR, (AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_ZB_SUB_TERR, (AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_FULL | ZMODE_OPA | ALPHA_CVG_SEL), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_OPA_SURF, (AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | ALPHA_CVG_SEL), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_RA_OPA_SURF, (AA_EN | CVG_DST_CLAMP | ZMODE_OPA | ALPHA_CVG_SEL), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_AA_XLU_SURF, (AA_EN | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | FORCE_BL | ZMODE_OPA), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_XLU_LINE, (AA_EN | IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | ALPHA_CVG_SEL | FORCE_BL | ZMODE_OPA), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_DEC_LINE, (AA_EN | IM_RD | CVG_DST_FULL | CVG_X_ALPHA | ALPHA_CVG_SEL | FORCE_BL | ZMODE_OPA), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_TEX_EDGE, (AA_EN | IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_AA_SUB_SURF, (AA_EN | IM_RD | CVG_DST_FULL | ZMODE_OPA | ALPHA_CVG_SEL), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_AA_PCL_SURF, (AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | G_AC_DITHER), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_OPA_TERR, (AA_EN | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | ALPHA_CVG_SEL), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_TEX_TERR, (AA_EN | IM_RD | CVG_DST_CLAMP | CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_AA_SUB_TERR, (AA_EN | IM_RD | CVG_DST_FULL | ZMODE_OPA | ALPHA_CVG_SEL), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_ZB_OPA_SURF, (Z_CMP | Z_UPD | CVG_DST_FULL | ALPHA_CVG_SEL | ZMODE_OPA), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_ZB_XLU_SURF, (Z_CMP | IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_XLU), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_ZB_OPA_DECAL, (Z_CMP | CVG_DST_FULL | ALPHA_CVG_SEL | ZMODE_DEC), BL_DEP_SETTING_1
|
||||
.SET_RENDER_MODE G_RM_ZB_XLU_DECAL, (Z_CMP | IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_DEC), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_ZB_CLD_SURF, (Z_CMP | IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_XLU), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_ZB_OVL_SURF, (Z_CMP | IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_DEC), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_ZB_PCL_SURF, (Z_CMP | Z_UPD | CVG_DST_FULL | ZMODE_OPA | G_AC_DITHER), BL_DEP_SETTING_3
|
||||
.SET_RENDER_MODE G_RM_OPA_SURF, (CVG_DST_CLAMP | FORCE_BL | ZMODE_OPA), BL_DEP_SETTING_3
|
||||
.SET_RENDER_MODE G_RM_XLU_SURF, (IM_RD | CVG_DST_FULL | FORCE_BL | ZMODE_OPA), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_TEX_EDGE, (CVG_DST_CLAMP | CVG_X_ALPHA | ALPHA_CVG_SEL | FORCE_BL | ZMODE_OPA | TEX_EDGE | AA_EN), BL_DEP_SETTING_3
|
||||
.SET_RENDER_MODE G_RM_CLD_SURF, (IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_OPA), BL_DEP_SETTING_2
|
||||
.SET_RENDER_MODE G_RM_PCL_SURF, (CVG_DST_FULL | FORCE_BL | ZMODE_OPA | G_AC_DITHER), BL_DEP_SETTING_3
|
||||
.SET_RENDER_MODE G_RM_ADD, (IM_RD | CVG_DST_SAVE | FORCE_BL | ZMODE_OPA), BL_DEP_SETTING_4
|
||||
.SET_RENDER_MODE G_RM_NOOP, (0), BL_DEP_SETTING_ZERO
|
||||
.SET_RENDER_MODE G_RM_VISCVG, (IM_RD | FORCE_BL), BL_DEP_SETTING_5
|
||||
.SET_RENDER_MODE G_RM_OPA_CI, (CVG_DST_CLAMP | ZMODE_OPA), BL_DEP_SETTING_3
|
||||
|
||||
/* Custom version of G_RM_AA_ZB_XLU_SURF with Z_UPD */
|
||||
.SET_RENDER_MODE G_RM_CUSTOM_AA_ZB_XLU_SURF, (AA_EN | Z_CMP | Z_UPD | IM_RD | CVG_DST_WRAP | CLR_ON_CVG | FORCE_BL | ZMODE_XLU), BL_DEP_SETTING_2
|
||||
|
||||
/* Special mode types only for mode 1 */
|
||||
.set G_RM_FOG_SHADE_A, BL_DEP_SETTING_FOG_SHADE_A
|
||||
.set G_RM_FOG_PRIM_A, BL_DEP_SETTING_FOG_PRIM_A
|
||||
.set G_RM_PASS, BL_DEP_SETTING_PASS
|
||||
|
||||
/*******************************************************************/
|
||||
|
||||
/* gSPSetOtherMode (H) */
|
||||
.set G_MDSFT_ALPHADITHER, 4
|
||||
.set G_MDSFT_RGBDITHER, 6
|
||||
.set G_MDSFT_COMBKEY, 8
|
||||
.set G_MDSFT_TEXTCONV, 9
|
||||
.set G_MDSFT_TEXTFILT, 12
|
||||
.set G_MDSFT_TEXTLUT, 14
|
||||
.set G_MDSFT_TEXTLOD, 16
|
||||
.set G_MDSFT_TEXTDETAIL, 17
|
||||
.set G_MDSFT_TEXTPERSP, 19
|
||||
.set G_MDSFT_CYCLETYPE, 20
|
||||
.set G_MDSFT_PIPELINE, 23
|
||||
|
||||
.set G_CYC_1CYCLE, (0 << G_MDSFT_CYCLETYPE)
|
||||
.set G_CYC_2CYCLE, (1 << G_MDSFT_CYCLETYPE)
|
||||
.set G_CYC_COPY, (2 << G_MDSFT_CYCLETYPE)
|
||||
.set G_CYC_FILL, (3 << G_MDSFT_CYCLETYPE)
|
||||
|
||||
.set G_TP_NONE, (0 << G_MDSFT_TEXTPERSP)
|
||||
.set G_TP_PERSP, (1 << G_MDSFT_TEXTPERSP)
|
||||
|
||||
.set G_TD_CLAMP, (0 << G_MDSFT_TEXTDETAIL)
|
||||
.set G_TD_SHARPEN, (1 << G_MDSFT_TEXTDETAIL)
|
||||
.set G_TD_DETAIL, (2 << G_MDSFT_TEXTDETAIL)
|
||||
|
||||
.set G_TL_TILE, (0 << G_MDSFT_TEXTLOD)
|
||||
.set G_TL_LOD, (1 << G_MDSFT_TEXTLOD)
|
||||
|
||||
.set G_TT_NONE, (0 << G_MDSFT_TEXTLUT)
|
||||
.set G_TT_RGBA16, (2 << G_MDSFT_TEXTLUT)
|
||||
.set G_TT_IA16, (3 << G_MDSFT_TEXTLUT)
|
||||
|
||||
.set G_TF_POINT, (0 << G_MDSFT_TEXTFILT)
|
||||
.set G_TF_AVERAGE, (3 << G_MDSFT_TEXTFILT)
|
||||
.set G_TF_BILERP, (2 << G_MDSFT_TEXTFILT)
|
||||
|
||||
.set G_TC_CONV, (0 << G_MDSFT_TEXTCONV)
|
||||
.set G_TC_FILTCONV, (5 << G_MDSFT_TEXTCONV)
|
||||
.set G_TC_FILT, (6 << G_MDSFT_TEXTCONV)
|
||||
|
||||
.set G_CK_NONE, (0 << G_MDSFT_COMBKEY)
|
||||
.set G_CK_KEY, (1 << G_MDSFT_COMBKEY)
|
||||
|
||||
.set G_CD_MAGICSQ, (0 << G_MDSFT_RGBDITHER)
|
||||
.set G_CD_BAYER, (1 << G_MDSFT_RGBDITHER)
|
||||
.set G_CD_NOISE, (2 << G_MDSFT_RGBDITHER)
|
||||
|
||||
/* gDPSetTile */
|
||||
.set G_TX_LOADTILE, 0x7
|
||||
.set G_TX_RENDERTILE, 0x0
|
||||
|
||||
/* axis clamp and mirror flags */
|
||||
.set G_TX_NOMIRROR, 0x0
|
||||
.set G_TX_WRAP, 0x0
|
||||
.set G_TX_MIRROR, 0x1
|
||||
.set G_TX_CLAMP, 0x2
|
||||
|
||||
/* mask flags */
|
||||
.set G_TX_NOMASK, 0x0
|
||||
|
||||
/* shift flags */
|
||||
.set G_TX_NOLOD, 0x0
|
||||
|
||||
/* gDPSetCombine */
|
||||
.set G_CCMUX_COMBINED, 0
|
||||
.set G_CCMUX_TEXEL0, 1
|
||||
.set G_CCMUX_TEXEL1, 2
|
||||
.set G_CCMUX_PRIMITIVE, 3
|
||||
.set G_CCMUX_SHADE, 4
|
||||
.set G_CCMUX_ENVIRONMENT, 5
|
||||
.set G_CCMUX_CENTER, 6
|
||||
.set G_CCMUX_SCALE, 6
|
||||
.set G_CCMUX_COMBINED_ALPHA, 7
|
||||
.set G_CCMUX_TEXEL0_ALPHA, 8
|
||||
.set G_CCMUX_TEXEL1_ALPHA, 9
|
||||
.set G_CCMUX_PRIMITIVE_ALPHA, 10
|
||||
.set G_CCMUX_SHADE_ALPHA, 11
|
||||
.set G_CCMUX_ENV_ALPHA, 12
|
||||
.set G_CCMUX_LOD_FRACTION, 13
|
||||
.set G_CCMUX_PRIM_LOD_FRAC, 14
|
||||
.set G_CCMUX_NOISE, 7
|
||||
.set G_CCMUX_K4, 7
|
||||
.set G_CCMUX_K5, 15
|
||||
.set G_CCMUX_1, 6
|
||||
.set G_CCMUX_0, 31
|
||||
|
||||
/* alpha combiner */
|
||||
.set G_ACMUX_COMBINED, 0
|
||||
.set G_ACMUX_TEXEL0, 1
|
||||
.set G_ACMUX_TEXEL1, 2
|
||||
.set G_ACMUX_PRIMITIVE, 3
|
||||
.set G_ACMUX_SHADE, 4
|
||||
.set G_ACMUX_ENVIRONMENT, 5
|
||||
.set G_ACMUX_LOD_FRACTION, 0
|
||||
.set G_ACMUX_PRIM_LOD_FRAC, 6
|
||||
.set G_ACMUX_1, 6
|
||||
.set G_ACMUX_0, 7
|
||||
|
||||
/* gDPSetTextureImage */
|
||||
/* fmt */
|
||||
.set G_IM_FMT_RGBA, 0x00
|
||||
.set G_IM_FMT_YUV, 0x01
|
||||
.set G_IM_FMT_CI, 0x02
|
||||
.set G_IM_FMT_IA, 0x03
|
||||
.set G_IM_FMT_I, 0x04
|
||||
|
||||
/* size */
|
||||
.set G_IM_SIZ_4b, 0x00
|
||||
.set G_IM_SIZ_8b, 0x01
|
||||
.set G_IM_SIZ_16b, 0x02
|
||||
.set G_IM_SIZ_32b, 0x03
|
||||
|
||||
.set G_TX_DXT_FRAC, 11
|
||||
.set G_TEXTURE_IMAGE_FRAC, 2
|
||||
|
||||
/* gDPLoadBlock*/
|
||||
.set G_TX_DXT_FRAC, 11
|
||||
.set G_TEXTURE_IMAGE_FRAC, 2
|
||||
|
||||
/* gSPNumLights / gSPFogFactor */
|
||||
|
||||
/* Index in DMEM table */
|
||||
.set G_MW_NUMLIGHT, 0x02
|
||||
.set G_MW_FOG, 0x08
|
||||
.set G_MW_PERSPNORM, 0x0E
|
||||
|
||||
/* Offsets in DMEM table */
|
||||
.set G_MWO_NUMLIGHT, 0x00
|
||||
.set G_MWO_FOG, 0x00
|
||||
|
||||
/* Parameter for gsSPNumLights; not really needed but is good for formality. */
|
||||
.set NUMLIGHTS_0, 1
|
||||
.set NUMLIGHTS_1, 1
|
||||
.set NUMLIGHTS_2, 2
|
||||
.set NUMLIGHTS_3, 3
|
||||
.set NUMLIGHTS_4, 4
|
||||
.set NUMLIGHTS_5, 5
|
||||
.set NUMLIGHTS_6, 6
|
||||
.set NUMLIGHTS_7, 7
|
||||
|
||||
/* GBI macros */
|
||||
|
||||
/* gsMoveWd */
|
||||
.macro gsMoveWd index, offset, data
|
||||
.ifdef F3DEX_GBI_2
|
||||
.word G_MOVEWORD << 24 | ((\index & 0xFF) << 16) | (\offset & 0xFFFF)
|
||||
.else
|
||||
.word G_MOVEWORD << 24 | ((\offset & 0xFFFF) << 8) | (\index & 0xFF)
|
||||
.endif
|
||||
.word \data
|
||||
.endm
|
||||
|
||||
.set G_MWO_NUMLIGHT, 0x00
|
||||
/*
|
||||
* gSPNumLights
|
||||
* Parameter:
|
||||
* n = NUMLIGHTS_* (ranges from 0 to 7)
|
||||
*/
|
||||
.macro gsSPNumLights n
|
||||
.ifdef F3DEX_GBI_2
|
||||
gsMoveWd G_MW_NUMLIGHT, G_MWO_NUMLIGHT, (\n * 24)
|
||||
.else
|
||||
gsMoveWd G_MW_NUMLIGHT, G_MWO_NUMLIGHT, ((\n + 1) * 32 + 0x80000000)
|
||||
.endif
|
||||
.endm
|
||||
|
||||
/* gSPMatrix */
|
||||
.macro gsSPMatrix matrix, params
|
||||
.ifdef F3DEX_GBI_2
|
||||
gsDma3p G_MTX, 0x38, 0, (\params ^ G_MTX_PUSH), \matrix
|
||||
.else /* Fast3D and Fast3DEX */
|
||||
gsDma1p G_MTX, \matrix, 64, \params
|
||||
.endif
|
||||
.endm
|
||||
|
||||
/* gSPLight */
|
||||
.macro gsSPLight light, num
|
||||
.ifdef F3DEX_GBI_2
|
||||
gsDma3p G_MOVEMEM, 8, ((G_MVO_L0+((\num-1)*24))/8), 10, \light
|
||||
.else /* Fast3D and Fast3DEX */
|
||||
gsDma1p G_MOVEMEM, \light, 16, ((\num)-1)*2+G_MV_L0
|
||||
.endif
|
||||
.endm
|
||||
|
||||
/* gSPVertex */
|
||||
.macro gsSPVertex verts, num, index
|
||||
.ifdef F3DEX_GBI_2
|
||||
.word (G_VTX << 24) | ((\num & 0xFF) << 12) | (((\index+\num) & 0x7F) << 1)
|
||||
.word \verts
|
||||
.else /* Fast3D and Fast3DEX */
|
||||
.ifdef F3DEX_GBI
|
||||
gsDma1p G_VTX, \verts, (\num)<<10|(16*(\num)-1), (2*\index)
|
||||
.else /* Fast3D */
|
||||
gsDma1p G_VTX, \verts, 16*\num, ((\num)-1)<<4|(\index)
|
||||
.endif
|
||||
.endif
|
||||
.endm
|
||||
|
||||
/*
|
||||
* gSPGeometryMode
|
||||
* In Fast3DEX2 it is better to use this, as the RSP geometry mode
|
||||
* is able to be set and cleared in a single command.
|
||||
*/
|
||||
.macro gsSPGeometryMode cc, ff, order
|
||||
.ifdef F3DEX_GBI_2
|
||||
.word (G_GEOMETRYMODE << 24) | ((~(\cc)) & 0x00FFFFFF)
|
||||
.word \ff
|
||||
.else
|
||||
.if \order == 0
|
||||
gsSPSetGeometryMode \ff
|
||||
gsSPClearGeometryMode \cc
|
||||
.else
|
||||
gsSPClearGeometryMode \cc
|
||||
gsSPSetGeometryMode \ff
|
||||
.endif
|
||||
.endif
|
||||
.endm
|
||||
|
||||
/* gSPSetGeometryMode */
|
||||
.macro gsSPSetGeometryMode, flags
|
||||
.ifdef F3DEX_GBI_2
|
||||
.word (G_GEOMETRYMODE << 24) | 0x00FFFFFF
|
||||
.word \flags
|
||||
.else /* Fast3D and Fast3DEX */
|
||||
.word G_SETGEOMETRYMODE << 24
|
||||
.word \flags
|
||||
.endif
|
||||
.endm
|
||||
|
||||
/* gSPClearGeometryMode */
|
||||
.macro gsSPClearGeometryMode, flags
|
||||
.ifdef F3DEX_GBI_2
|
||||
.word (G_GEOMETRYMODE << 24) | ((~(\flags)) & 0x00FFFFFF)
|
||||
.word 0
|
||||
.else /* Fast3D and Fast3DEX */
|
||||
.word G_CLEARGEOMETRYMODE << 24
|
||||
.word \flags
|
||||
.endif
|
||||
.endm
|
||||
|
||||
/* gSPPerspNormalize */
|
||||
.macro gsSPPerspNormalize, perspNorm
|
||||
.ifndef F3D_OLD
|
||||
gsMoveWd G_MW_PERSPNORM, 0, \perspNorm
|
||||
.else
|
||||
gsImmp1 G_RDPHALF_1, \perspNorm
|
||||
.endif
|
||||
.endm
|
||||
|
||||
/* gSPEndDisplayList */
|
||||
.macro gsSPEndDisplayList
|
||||
f3d_noparam G_ENDDL
|
||||
.endm
|
||||
|
||||
/* gSPSetOtherMode */
|
||||
.macro gsSPSetOtherMode cmd, sft, len, data
|
||||
.ifdef F3DEX_GBI_2
|
||||
.word ((\cmd & 0xFF) << 24) | ((32 - (\sft & 0xFF) - (\len & 0xFF)) << 8) | ((\len-1) & 0xFF)
|
||||
.word \data
|
||||
.else /* Fast3D and Fast3DEX2 */
|
||||
.word ((\cmd & 0xFF) << 24) | ((\sft & 0xFF) << 8) | (\len & 0xFF)
|
||||
.word \data
|
||||
.endif
|
||||
.endm
|
||||
|
||||
.macro gsSPTexture scaleS, scaleT, level, tile, enable
|
||||
.ifdef F3DEX_GBI_2
|
||||
.word (G_TEXTURE << 24) | ((\level & 0x7) << 11) | ((\tile & 0x7) << 8) | (\enable*2)
|
||||
.word ((\scaleS & 0xFFFF) << 16) | (\scaleT & 0xFFFF)
|
||||
.else /* Fast3D and Fast3DEX */
|
||||
.word (G_TEXTURE << 24) | ((\level & 0x7) << 11) | ((\tile & 0x7) << 8) | \enable
|
||||
.word ((\scaleS & 0xFFFF) << 16) | (\scaleT & 0xFFFF)
|
||||
.endif
|
||||
.endm
|
||||
|
||||
/* gSPSetRenderMode */
|
||||
.macro gsDPSetRenderMode cycle1Mode, cycle2Mode
|
||||
gsSPSetOtherMode G_SETOTHERMODE_L, G_MDSFT_RENDERMODE, 29, \cycle1Mode | \cycle2Mode
|
||||
.endm
|
||||
|
||||
/* gDPSetTexturePersp */
|
||||
.macro gsDPSetTexturePersp type
|
||||
gsSPSetOtherMode G_SETOTHERMODE_H, G_MDSFT_TEXTPERSP, 1, \type
|
||||
.endm
|
||||
|
||||
/* gDPSetCycleType */
|
||||
.macro gsDPSetCycleType type
|
||||
gsSPSetOtherMode G_SETOTHERMODE_H, G_MDSFT_CYCLETYPE, 2, \type
|
||||
.endm
|
||||
|
||||
/* gDPSetTextureDetail */
|
||||
.macro gsDPSetTextureDetail type
|
||||
gsSPSetOtherMode G_SETOTHERMODE_H, G_MDSFT_TEXTDETAIL, 2, \type
|
||||
.endm
|
||||
|
||||
/* gDPSetTextureLOD*/
|
||||
.macro gsDPSetTextureLOD type
|
||||
gsSPSetOtherMode G_SETOTHERMODE_H, G_MDSFT_TEXTLOD, 1, \type
|
||||
.endm
|
||||
|
||||
/* gDPSetTextureTLUT */
|
||||
.macro gsDPSetTextureLUT type
|
||||
gsSPSetOtherMode G_SETOTHERMODE_H, G_MDSFT_TEXTLUT, 2, \type
|
||||
.endm
|
||||
|
||||
/* gDPSetTextureFilter */
|
||||
.macro gsDPSetTextureFilter type
|
||||
gsSPSetOtherMode G_SETOTHERMODE_H, G_MDSFT_TEXTFILT, 2, \type
|
||||
.endm
|
||||
|
||||
/* gDPSetTextureConvert */
|
||||
.macro gsDPSetTextureConvert type
|
||||
gsSPSetOtherMode G_SETOTHERMODE_H, G_MDSFT_TEXTCONV, 3, \type
|
||||
.endm
|
||||
|
||||
/* gDPSetCombineKey */
|
||||
.macro gsDPSetCombineKey type
|
||||
gsSPSetOtherMode G_SETOTHERMODE_H, G_MDSFT_COMBKEY, 1, \type
|
||||
.endm
|
||||
|
||||
/* gDPSetColorDither */
|
||||
.macro gsDPSetColorDither mode
|
||||
gsSPSetOtherMode G_SETOTHERMODE_H, G_MDSFT_RGBDITHER, 2, \mode
|
||||
.endm
|
||||
|
||||
/* gsDPSetAlphaCompare */
|
||||
.macro gsDPSetAlphaCompare type
|
||||
gsSPSetOtherMode G_SETOTHERMODE_L, G_MDSFT_ALPHACOMPARE, 2, \type
|
||||
.endm
|
||||
|
||||
/* gDPSetDepthSource */
|
||||
.macro gsDPSetDepthSource src
|
||||
gsSPSetOtherMode G_SETOTHERMODE_L, G_MDSFT_ZSRCSEL, 1, \src
|
||||
.endm
|
||||
|
||||
/* gSPDisplayList */
|
||||
.macro gsSPDisplayList dl
|
||||
gsDma1p G_DL, \dl, 0, G_DL_PUSH
|
||||
.endm
|
||||
|
||||
/* gSPBranchDisplayList */
|
||||
.macro gsSPBranchList dl
|
||||
gsDma1p G_DL, \dl, 0, G_DL_NOPUSH
|
||||
.endm
|
||||
|
||||
/*
|
||||
* gSP1Triangle
|
||||
* Note: flag has no effect on this implementation of gSP1Triangle.
|
||||
*/
|
||||
.macro gsSP1Triangle v0, v1, v2, flag
|
||||
.ifndef F3DEX_GBI_2
|
||||
.word G_TRI1 << 24
|
||||
.ifdef F3DEX_GBI /* Fast3DEX */
|
||||
.word (\v0*2 << 16) | (\v1*2 << 8) | \v2*2
|
||||
.else /* Fast3D */
|
||||
.word (\v0*10 << 16) | (\v1*10 << 8) | \v2*10
|
||||
.endif
|
||||
.else /* Fast3DEX2 */
|
||||
.byte G_TRI1, \v0*2, \v1*2, \v2*2
|
||||
.word 0
|
||||
.endif
|
||||
.endm
|
||||
|
||||
/*
|
||||
* gSP2Triangles
|
||||
* Note: flag has no effect on this implementation of gSP2Triangles.
|
||||
*/
|
||||
.macro gsSP2Triangles v0, v1, v2, flag0, v3, v4, v5, flag1
|
||||
.ifdef F3DEX_GBI_SHARED /* Fast3DEX and Fast3DEX2 have the same G_TRI2 syntax. */
|
||||
.word (G_TRI2 << 24) | (\v0*2 << 16) | (\v1*2 << 8) | \v2*2
|
||||
.word (0x00 << 24) | (\v3*2 << 16) | (\v4*2 << 8) | \v5*2
|
||||
.else /* Backwards compatibility with Fast3D. */
|
||||
gsSP1Triangle \v0, \v1, \v2, \flag0
|
||||
gsSP1Triangle \v3, \v4, \v5, \flag1
|
||||
.endif
|
||||
.endm
|
||||
|
||||
/* gDPNoOp */
|
||||
.macro gsDPNoOp
|
||||
f3d_noparam G_NOOP
|
||||
.endm
|
||||
|
||||
/* gSPTextureRectangle */
|
||||
.macro gsSPTextureRectangle xl, yl, xh, yh, tile, s, t, dsdx, dtdy
|
||||
.word (G_TEXRECT << 24) | (\xh << 12) | \yh
|
||||
.word (\tile << 24) | (\xl << 12) | \yl
|
||||
.ifdef F3D_OLD
|
||||
.word (G_RDPHALF_2 << 24)
|
||||
.else
|
||||
.word (G_RDPHALF_1 << 24)
|
||||
.endif
|
||||
.word (\s << 16) | \t
|
||||
.ifdef F3D_OLD
|
||||
.word (G_RDPHALF_CONT << 24)
|
||||
.else
|
||||
.word (G_RDPHALF_2 << 24)
|
||||
.endif
|
||||
.word (\dsdx << 16) | \dtdy
|
||||
.endm
|
||||
|
||||
/* gDPLoadSync */
|
||||
.macro gsDPLoadSync
|
||||
f3d_noparam G_RDPLOADSYNC
|
||||
.endm
|
||||
|
||||
/* gDPPipeSync*/
|
||||
.macro gsDPPipeSync
|
||||
f3d_noparam G_RDPPIPESYNC
|
||||
.endm
|
||||
|
||||
/* gDPFullSync*/
|
||||
.macro gsDPFullSync
|
||||
f3d_noparam G_RDPFULLSYNC
|
||||
.endm
|
||||
|
||||
/* gDPLoadTLUTCmd */
|
||||
.macro gsDPLoadTLUTCmd tile, count
|
||||
.word G_LOADTLUT << 24
|
||||
.word ((\tile & 0x7) << 24) | ((\count - 1) & 0x3FF) << 14
|
||||
.endm
|
||||
|
||||
/* gDPTileSync */
|
||||
.macro gsDPTileSync
|
||||
f3d_noparam G_RDPTILESYNC
|
||||
.endm
|
||||
|
||||
/* gDPSetTileSize */
|
||||
.macro gsDPSetTileSize tile, uls, ult, lrs, lrt
|
||||
.word (G_SETTILESIZE << 24) | ((\uls & 0x0FFF) << 12) | (\ult & 0x0FFF)
|
||||
.word ((\tile & 0x7) << 24) | ((\lrs & 0x0FFF) << 12) | (\lrt & 0x0FFF)
|
||||
.endm
|
||||
|
||||
/* gsDPLoadBlock */
|
||||
.macro gsDPLoadBlock tile, uls, ult, lrs, dxt
|
||||
.word (G_LOADBLOCK << 24) | ((\uls & 0x0FFF) << 12) | (\ult & 0x0FFF)
|
||||
.word ((\tile & 0x7) << 24) | ((\lrs & 0x0FFF) << 12) | (\dxt & 0x0FFF)
|
||||
.endm
|
||||
|
||||
/* gDPSetTile */
|
||||
.macro gsDPSetTile fmt, siz, line, tmem, tile, palette, cmt, maskt, shiftt, cms, masks, shifts
|
||||
.word (G_SETTILE << 24) | ((\fmt & 0x7) << 21) | ((\siz & 0x3) << 19) | ((\line & 0x1FF) << 9) | (\tmem & 0x1FF)
|
||||
.word ((\tile & 0x7) << 24) | ((\palette & 0xF) << 20) | ((\cmt & 0x3) << 18) | ((\maskt & 0xF) << 14) | ((\shiftt & 0xF) << 10) | ((\cms & 0x3) << 8) | ((\masks & 0xF) << 4) | (\shifts & 0xF)
|
||||
.endm
|
||||
|
||||
/* gDPFillRectangle */
|
||||
.macro gsDPFillRectangle ulx, uly, lrx, lry
|
||||
.word (G_FILLRECT << 24) | ((\lrx & 0x3FF) << 14) | ((\lry & 0x3FF) << 2)
|
||||
.word ((\ulx & 0x3FF) << 14) | ((\uly & 0x3FF) << 2)
|
||||
.endm
|
||||
|
||||
/* gDPSetFillColor */
|
||||
.macro gsDPSetFillColor fillValue
|
||||
.word G_SETFILLCOLOR << 24
|
||||
.word \fillValue
|
||||
.endm
|
||||
|
||||
/* gDPSetFogColor */
|
||||
.macro gsDPSetFogColor r, g, b, a
|
||||
sDPRGBColor G_SETFOGCOLOR, \r, \g, \b, \a
|
||||
.endm
|
||||
|
||||
/* gDPSetBlendColor */
|
||||
.macro gsDPSetBlendColor r, g, b, a
|
||||
sDPRGBColor G_SETBLENDCOLOR, \r, \g, \b, \a
|
||||
.endm
|
||||
|
||||
/* gDPSetPrimColor */
|
||||
.macro gsDPSetPrimColor m, l, r, g, b, a
|
||||
.word (G_SETPRIMCOLOR << 24) | ((\m & 0xFF) << 8) | (\l & 0xFF)
|
||||
.word (\r << 24) | (\g << 16) | (\b << 8) | \a
|
||||
.endm
|
||||
|
||||
/* gDPSetEnvColor */
|
||||
.macro gsDPSetEnvColor r, g, b, a
|
||||
sDPRGBColor G_SETENVCOLOR, \r, \g, \b, \a
|
||||
.endm
|
||||
|
||||
/* gDPSetCombine */
|
||||
.macro gsDPSetCombine muxs0, muxs1
|
||||
.word (G_SETCOMBINE << 24) | (\muxs0 & 0x00FFFFFF)
|
||||
.word \muxs1
|
||||
.endm
|
||||
|
||||
/* gDPSetCombineMode */
|
||||
.macro gsDPSetCombineModeLERP a0, b0, c0, d0, Aa0, Ab0, Ac0, Ad0, a1, b1, c1, d1, Aa1, Ab1, Ac1, Ad1
|
||||
.word (G_SETCOMBINE << 24) | ((\a0 & 0xF) << 20) | ((\c0 & 0x1F) << 15) | ((\Aa0 & 0x7) << 12) | ((\Ac0 & 0x7) << 9) | ((\a1 & 0xF) << 5) | (\c1 & 0x1F)
|
||||
.word ((\b0 & 0xF) << 28) | ((\b1 & 0xF) << 24) | ((\Aa1 & 0x7) << 21) | ((\Ac1 & 0x7) << 18) | ((\d0 & 0x7) << 15) | ((\Ab0 & 0x7) << 12) | ((\Ad0 & 0x7) << 9) | ((\d1 & 0x7) << 6) | ((\Ab1 & 0x7) << 3) | (\Ad1 & 0x7)
|
||||
.endm
|
||||
|
||||
/* gDPSetCombineMode1Cycle */
|
||||
.macro gsDPSetCombineModeLERP1Cycle a0, b0, c0, d0, Aa0, Ab0, Ac0, Ad0
|
||||
gsDPSetCombineModeLERP \a0, \b0, \c0, \d0, \Aa0, \Ab0, \Ac0, \Ad0, \a0, \b0, \c0, \d0, \Aa0, \Ab0, \Ac0, \Ad0
|
||||
.endm
|
||||
|
||||
/* gDPSetTextureImage */
|
||||
.macro gsDPSetTextureImage fmt, size, width, segAddr
|
||||
.word (G_SETTIMG << 24) | ((\fmt & 0x7) << 21) | ((\size & 0x3) << 19) | ((\width-1) & 0x0FFF)
|
||||
.word \segAddr
|
||||
.endm
|
||||
|
||||
/* gDPLoadTextureBlock */
|
||||
/* Calculate gDPLoadBlock for 8, 16, and 32 bit textures */
|
||||
.macro _calc_gsDPLoadBlockNot4b width, height, shift, incr, byteSize
|
||||
.if (((\width * \byteSize) / 8) > 1) /* result of TXL2WORDS is greater than 1 */
|
||||
gsDPLoadBlock G_TX_LOADTILE, 0, 0, (((\width * \height) + \incr) >> \shift) - 1, (((1 << G_TX_DXT_FRAC) + ((\width * \byteSize) / 8) - 1) / ((\width * \byteSize) / 8))
|
||||
.else /* result of TXL2WORDS is 1 */
|
||||
gsDPLoadBlock G_TX_LOADTILE, 0, 0, (((\width * \height) + \incr) >> \shift) - 1, (1 << G_TX_DXT_FRAC)
|
||||
.endif
|
||||
.endm
|
||||
|
||||
/* Calculate gDPLoadBlock for 4-bit textures */
|
||||
.macro _calc_gsDPLoadBlock4b width, height
|
||||
.if ((\width / 16) > 1) /* result of TXL2WORDS_4b is greater than 1 */
|
||||
gsDPLoadBlock G_TX_LOADTILE, 0, 0, (((\width * \height) + 3) >> 2) - 1, (((1 << G_TX_DXT_FRAC) + (\width / 16) - 1) / (\width / 16))
|
||||
.else /* result of TXL2WORDS_4b is 1 */
|
||||
gsDPLoadBlock G_TX_LOADTILE, 0, 0, (((\width * \height) + 3) >> 2) - 1, (1 << G_TX_DXT_FRAC)
|
||||
.endif
|
||||
.endm
|
||||
|
||||
/* Calculate gDPLoadBlock using texture bit size, width, and height */
|
||||
.macro _calc_gsDPLoadBlock siz, width, height
|
||||
.if (\siz == G_IM_SIZ_4b)
|
||||
_calc_gsDPLoadBlock4b \width, \height
|
||||
.elseif (\siz == G_IM_SIZ_8b)
|
||||
_calc_gsDPLoadBlockNot4b \width, \height, 1, 1, 1
|
||||
.elseif (\siz == G_IM_SIZ_16b)
|
||||
_calc_gsDPLoadBlockNot4b \width, \height, 0, 0, 2
|
||||
.elseif (\siz == G_IM_SIZ_32b)
|
||||
_calc_gsDPLoadBlockNot4b \width, \height, 0, 0, 4
|
||||
.endif
|
||||
.endm
|
||||
|
||||
/*
|
||||
* gDPLoadTextureBlock is a macro that allows you to easily load a texture in the f3d family of ucodes
|
||||
* Parameters:
|
||||
* timg = label to the texture data
|
||||
* fmt = image format (G_IM_FMT_RGBA, G_IM_FMT_CI, G_IM_FMT_IA, G_IM_FMT_I, or G_IM_FMT_YUV)
|
||||
* siz = bits per pixel (G_IM_SIZ_4b, G_IM_SIZ_8b, G_IM_SIZ_16b, or G_IM_SIZ_32b)
|
||||
* width = width of the texture in pixels
|
||||
* height = height of the texture in pixels
|
||||
* pal = palette id to use if using G_IM_FMT_CI, otherwise it should be 0.
|
||||
* cms = Clamp & Mirror flags for the S axis
|
||||
* cmt = Clamp & Mirror flags for the T axis
|
||||
* masks = Sets how much of the S axis is shown before clamping. This is usually just log2(width).
|
||||
* maskt = Sets how much of the T axis is shown before clamping. This is usually just log2(height).
|
||||
* shifts = Sets the amount to shift S axis values after perspective division. This is usually G_TX_NOLOD.
|
||||
* shiftt = Sets the amount to shift T axis values after perspective division. This is usually G_TX_NOLOD.
|
||||
*/
|
||||
.macro gsDPLoadTextureBlock timg, fmt, siz, width, height, pal, cms, cmt, masks, maskt, shifts, shiftt
|
||||
.if (\siz == G_IM_SIZ_32b)
|
||||
gsDPSetTextureImage \fmt, \siz, 1, \timg
|
||||
gsDPSetTile \fmt, \siz, 0, 0, G_TX_LOADTILE, 0, \cmt, \maskt, \shiftt, \cms, \masks, \shifts
|
||||
.else
|
||||
gsDPSetTextureImage \fmt, G_IM_SIZ_16b, 1, \timg
|
||||
gsDPSetTile \fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, \cmt, \maskt, \shiftt, \cms, \masks, \shifts
|
||||
.endif
|
||||
|
||||
gsDPLoadSync
|
||||
_calc_gsDPLoadBlock \siz, \width, \height
|
||||
gsDPPipeSync
|
||||
|
||||
.if (\siz == G_IM_SIZ_4b)
|
||||
gsDPSetTile \fmt, \siz, (7 >> 3), 0, G_TX_RENDERTILE, \pal, \cmt, \maskt, \shiftt, \cms, \masks, \shifts
|
||||
.elseif (\siz == G_IM_SIZ_8b)
|
||||
gsDPSetTile \fmt, \siz, ((\width + 7) >> 3), 0, G_TX_RENDERTILE, \pal, \cmt, \maskt, \shiftt, \cms, \masks, \shifts
|
||||
.else
|
||||
gsDPSetTile \fmt, \siz, (((\width * 2) + 7) >> 3), 0, G_TX_RENDERTILE, \pal, \cmt, \maskt, \shiftt, \cms, \masks, \shifts
|
||||
.endif
|
||||
|
||||
gsDPSetTileSize G_TX_RENDERTILE, 0, 0, ((\width - 1) << G_TEXTURE_IMAGE_FRAC), ((\height - 1) << G_TEXTURE_IMAGE_FRAC)
|
||||
.endm
|
||||
|
||||
/*
|
||||
* gDPLoadTLUT_pal16, loads 16 colors into the TLUT
|
||||
* Parameters:
|
||||
* pal = palette number to use.
|
||||
* timg_pal = label to palette data
|
||||
*/
|
||||
.macro gsDPLoadTLUT_pal16 pal, timg_pal
|
||||
gsDPSetTextureImage G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, \timg_pal
|
||||
gsDPTileSync
|
||||
gsDPSetTile 0, 0, 0, (256+(((\pal)&0xf)*16)), G_TX_LOADTILE, 0, 0, 0, 0, 0, 0, 0
|
||||
gsDPLoadSync
|
||||
gsDPLoadTLUTCmd G_TX_LOADTILE, 16
|
||||
gsDPPipeSync
|
||||
.endm
|
||||
|
||||
/*
|
||||
* gDPLoadTLUT_pal256, loads 256 colors into the TLUT
|
||||
* Parameters:
|
||||
* timg_pal = label to palette data
|
||||
*/
|
||||
.macro gsDPLoadTLUT_pal256 timg_pal
|
||||
gsDPSetTextureImage G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, \timg_pal
|
||||
gsDPTileSync
|
||||
gsDPSetTile 0, 0, 0, 256, G_TX_LOADTILE, 0, 0, 0, 0, 0, 0, 0
|
||||
gsDPLoadSync
|
||||
gsDPLoadTLUTCmd G_TX_LOADTILE, 256
|
||||
gsDPPipeSync
|
||||
.endm
|
||||
|
||||
/*
|
||||
* gDPLoadTextureBlock_4b is a macro that allows you to easily load a 4-bit texture in the Fast3D family of ucodes.
|
||||
* Parameters:
|
||||
* timg = label to the texture data
|
||||
* fmt = image format (G_IM_FMT_RGBA, G_IM_FMT_CI, G_IM_FMT_IA, G_IM_FMT_I, or G_IM_FMT_YUV)
|
||||
* width = width of the texture in pixels
|
||||
* height = height of the texture in pixels
|
||||
* pal = palette id to use if using G_IM_FMT_CI, otherwise it should be 0.
|
||||
* cms = Clamp & Mirror flags for the S axis
|
||||
* cmt = Clamp & Mirror flags for the T axis
|
||||
* masks = Sets how much of the S axis is shown before clamping. This is usually just log2(width).
|
||||
* maskt = Sets how much of the T axis is shown before clamping. This is usually just log2(height).
|
||||
* shifts = Sets the amount to shift S axis values after perspective division. This is usually G_TX_NOLOD.
|
||||
* shiftt = Sets the amount to shift T axis values after perspective division. This is usually G_TX_NOLOD.
|
||||
*/
|
||||
|
||||
.macro gsDPLoadTextureBlock_4b timg, fmt, width, height, pal, cms, cmt, masks, maskt, shifts, shiftt
|
||||
gsDPSetTextureImage \fmt, G_IM_SIZ_16b, 1, \timg
|
||||
gsDPSetTile \fmt, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, \cmt, \maskt, \shiftt, \cms, \masks, \shifts
|
||||
gsDPLoadSync
|
||||
_calc_gsDPLoadBlock4b \width, \height
|
||||
gsDPPipeSync
|
||||
gsDPSetTile \fmt, G_IM_SIZ_4b, ((((\width) >> 1) + 7) >> 3), 0, G_TX_RENDERTILE, \pal, \cmt, \maskt, \shiftt, \cms, \masks, \shifts
|
||||
gsDPSetTileSize G_TX_RENDERTILE, 0, 0, ((\width) - 1) << G_TEXTURE_IMAGE_FRAC, ((\height) - 1) << G_TEXTURE_IMAGE_FRAC
|
||||
.endm
|
||||
|
||||
/*
|
||||
* gSPFogFactor
|
||||
* Parameters:
|
||||
* fm = z multiplier
|
||||
* fo = z offset
|
||||
*
|
||||
* FOG FORMULA: alpha(fog) = (eyespace z) * fm + fo (CLAMPED 0 to 255)
|
||||
* note: (eyespace z) ranges [-1, 1]
|
||||
*/
|
||||
.macro gsSPFogFactor fm, fo
|
||||
gsMoveWd G_MW_FOG, G_MWO_FOG, ((\fm & 0xFFFF) << 16) | (\fo & 0xFFFF)
|
||||
.endm
|
||||
|
||||
/*
|
||||
* gSPFogPosition
|
||||
* Parameters:
|
||||
* min = Place where fog starts (0 at the near plane, and 1000 at the far plane)
|
||||
* max = Place where fog saturates (0 at the near plane, and 1000 at the far plane)
|
||||
*
|
||||
* This macro will throw an error if min or max is outside the range [0, 1000]
|
||||
*
|
||||
* Note: The min can be larger than max, as that just makes objects fade when they
|
||||
* get closer to the camera.
|
||||
*/
|
||||
.macro gsSPFogPosition min, max
|
||||
.if (\min >= 0 && \min <= 1000 && \max >= 0 && \max <= 1000)
|
||||
gsMoveWd G_MW_FOG, G_MWO_FOG, (((128000 / (\max - \min)) & 0xFFFF) << 16) | ((((500 - \min) * 256) / (\max - \min)) & 0xFFFF)
|
||||
.elseif \min < 0 || \min > 1000
|
||||
.error "[gsSPFogPosition]: min should be in the range [0, 1000]"
|
||||
.elseif \max < 0 || \max > 1000
|
||||
.error "[gsSPFogPosition]: max should be in the range [0, 1000]"
|
||||
.endif
|
||||
.endm
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,392 @@
|
||||
/*---------------------------------------------------------------------
|
||||
Copyright (C) 1997, Nintendo.
|
||||
|
||||
File gs2dex.h
|
||||
Coded by Yoshitaka Yasumoto. Jul 31, 1997.
|
||||
Modified by
|
||||
Comments Header file for S2DEX ucode.
|
||||
|
||||
$Id: gs2dex.h,v 1.21 1998/05/28 00:14:49 has Exp $
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _GS2DEX_H_
|
||||
#define _GS2DEX_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
/*===========================================================================*
|
||||
* Macro
|
||||
*===========================================================================*/
|
||||
#define GS_CALC_DXT(line) (((1<< G_TX_DXT_FRAC)-1)/(line)+1)
|
||||
#define GS_PIX2TMEM(pix, siz) ((pix)>>(4-(siz)))
|
||||
#define GS_PIX2DXT(pix, siz) GS_CALC_DXT(GS_PIX2TMEM((pix), (siz)))
|
||||
|
||||
/*===========================================================================*
|
||||
* Data structures for S2DEX microcode
|
||||
*===========================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Background
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define G_BGLT_LOADBLOCK 0x0033
|
||||
#define G_BGLT_LOADTILE 0xfff4
|
||||
|
||||
#define G_BG_FLAG_FLIPS 0x01
|
||||
#define G_BG_FLAG_FLIPT 0x10
|
||||
|
||||
/* Non scalable background plane */
|
||||
typedef struct {
|
||||
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; /* 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; /* 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) */
|
||||
|
||||
/* 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; /* 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; /* skip value of imagePtr for 1-loading
|
||||
= tmemSizeW*tmemH */
|
||||
} uObjBg_t; /* 40 bytes */
|
||||
|
||||
/* Scalable background plane */
|
||||
typedef struct {
|
||||
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; /* 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; /* 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; /* 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];
|
||||
|
||||
} uObjScaleBg_t; /* 40 bytes */
|
||||
|
||||
typedef union {
|
||||
uObjBg_t b;
|
||||
uObjScaleBg_t s;
|
||||
long long int force_structure_alignment;
|
||||
} uObjBg;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* 2D Objects
|
||||
*---------------------------------------------------------------------------*/
|
||||
#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; /* 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 {
|
||||
uObjSprite_t s;
|
||||
long long int force_structure_alignment;
|
||||
} uObjSprite;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* 2D Matrix
|
||||
*---------------------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
s32 A, B, C, D; /* s15.16 */
|
||||
s16 X, Y; /* s10.2 */
|
||||
u16 BaseScaleX; /* u5.10 */
|
||||
u16 BaseScaleY; /* u5.10 */
|
||||
} uObjMtx_t; /* 24 bytes */
|
||||
|
||||
typedef union {
|
||||
uObjMtx_t m;
|
||||
long long int force_structure_alignment;
|
||||
} uObjMtx;
|
||||
|
||||
typedef struct {
|
||||
s16 X, Y; /* s10.2 */
|
||||
u16 BaseScaleX; /* u5.10 */
|
||||
u16 BaseScaleY; /* u5.10 */
|
||||
} uObjSubMtx_t; /* 8 bytes */
|
||||
|
||||
typedef union {
|
||||
uObjSubMtx_t m;
|
||||
long long int force_structure_alignment;
|
||||
} uObjSubMtx;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Loading into TMEM
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define G_OBJLT_TXTRBLOCK 0x00001033
|
||||
#define G_OBJLT_TXTRTILE 0x00fc1034
|
||||
#define G_OBJLT_TLUT 0x00000030
|
||||
|
||||
#define GS_TB_TSIZE(pix,siz) (GS_PIX2TMEM((pix),(siz))-1)
|
||||
#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; /* 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 */
|
||||
|
||||
#define GS_TT_TWIDTH(pix,siz) ((GS_PIX2TMEM((pix), (siz))<<2)-1)
|
||||
#define GS_TT_THEIGHT(pix,siz) (((pix)<<2)-1)
|
||||
|
||||
typedef struct {
|
||||
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 */
|
||||
|
||||
#define GS_PAL_HEAD(head) ((head)+256)
|
||||
#define GS_PAL_NUM(num) ((num)-1)
|
||||
|
||||
typedef struct {
|
||||
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 */
|
||||
|
||||
typedef union {
|
||||
uObjTxtrBlock_t block;
|
||||
uObjTxtrTile_t tile;
|
||||
uObjTxtrTLUT_t tlut;
|
||||
long long int force_structure_alignment;
|
||||
} uObjTxtr;
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Loading into TMEM & 2D Objects
|
||||
*---------------------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
uObjTxtr txtr;
|
||||
uObjSprite sprite;
|
||||
} uObjTxSprite; /* 48 bytes */
|
||||
|
||||
/*===========================================================================*
|
||||
* 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
|
||||
#define G_OBJ_SPRITE 0x04
|
||||
#define G_OBJ_MOVEMEM 0x05
|
||||
#define G_SELECT_DL 0xb0
|
||||
#define G_OBJ_RENDERMODE 0xb1
|
||||
#define G_OBJ_RECTANGLE_R 0xb2
|
||||
#define G_OBJ_LOADTXTR 0xc1
|
||||
#define G_OBJ_LDTX_SPRITE 0xc2
|
||||
#define G_OBJ_LDTX_RECT 0xc3
|
||||
#define G_OBJ_LDTX_RECT_R 0xc4
|
||||
#define G_RDPHALF_0 0xe4
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Background wrapped screen
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define gSPBgRectangle(pkt, m, mptr) gDma0p((pkt),(m),(mptr),0)
|
||||
#define gsSPBgRectangle(m, mptr) gsDma0p( (m),(mptr),0)
|
||||
#define gSPBgRectCopy(pkt, mptr) gSPBgRectangle((pkt), G_BG_COPY, (mptr))
|
||||
#define gsSPBgRectCopy(mptr) gsSPBgRectangle( G_BG_COPY, (mptr))
|
||||
#define gSPBgRect1Cyc(pkt, mptr) gSPBgRectangle((pkt), G_BG_1CYC, (mptr))
|
||||
#define gsSPBgRect1Cyc(mptr) gsSPBgRectangle( G_BG_1CYC, (mptr))
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* 2D Objects
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define gSPObjSprite(pkt, mptr) gDma0p((pkt),G_OBJ_SPRITE, (mptr),0)
|
||||
#define gsSPObjSprite(mptr) gsDma0p( G_OBJ_SPRITE, (mptr),0)
|
||||
#define gSPObjRectangle(pkt, mptr) gDma0p((pkt),G_OBJ_RECTANGLE, (mptr),0)
|
||||
#define gsSPObjRectangle(mptr) gsDma0p( G_OBJ_RECTANGLE, (mptr),0)
|
||||
#define gSPObjRectangleR(pkt, mptr) gDma0p((pkt),G_OBJ_RECTANGLE_R,(mptr),0)
|
||||
#define gsSPObjRectangleR(mptr) gsDma0p( G_OBJ_RECTANGLE_R,(mptr),0)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* 2D Matrix
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define gSPObjMatrix(pkt, mptr) gDma1p((pkt),G_OBJ_MOVEMEM,(mptr),0,23)
|
||||
#define gsSPObjMatrix(mptr) gsDma1p( G_OBJ_MOVEMEM,(mptr),0,23)
|
||||
#define gSPObjSubMatrix(pkt, mptr) gDma1p((pkt),G_OBJ_MOVEMEM,(mptr),2, 7)
|
||||
#define gsSPObjSubMatrix(mptr) gsDma1p( G_OBJ_MOVEMEM,(mptr),2, 7)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Loading into TMEM
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define gSPObjLoadTxtr(pkt, tptr) gDma0p((pkt),G_OBJ_LOADTXTR, (tptr),23)
|
||||
#define gsSPObjLoadTxtr(tptr) gsDma0p( G_OBJ_LOADTXTR, (tptr),23)
|
||||
#define gSPObjLoadTxSprite(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_SPRITE,(tptr),47)
|
||||
#define gsSPObjLoadTxSprite(tptr) gsDma0p( G_OBJ_LDTX_SPRITE,(tptr),47)
|
||||
#define gSPObjLoadTxRect(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_RECT, (tptr),47)
|
||||
#define gsSPObjLoadTxRect(tptr) gsDma0p( G_OBJ_LDTX_RECT, (tptr),47)
|
||||
#define gSPObjLoadTxRectR(pkt, tptr) gDma0p((pkt),G_OBJ_LDTX_RECT_R,(tptr),47)
|
||||
#define gsSPObjLoadTxRectR(tptr) gsDma0p( G_OBJ_LDTX_RECT_R,(tptr),47)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Select Display List
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define gSPSelectDL(pkt, mptr, sid, flag, mask) \
|
||||
{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
|
||||
gDma1p((pkt), G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_PUSH); }
|
||||
#define gsSPSelectDL(mptr, sid, flag, mask) \
|
||||
{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
|
||||
gsDma1p(G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_PUSH); }
|
||||
#define gSPSelectBranchDL(pkt, mptr, sid, flag, mask) \
|
||||
{ gDma1p((pkt), G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
|
||||
gDma1p((pkt), G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_NOPUSH); }
|
||||
#define gsSPSelectBranchDL(mptr, sid, flag, mask) \
|
||||
{ gsDma1p(G_RDPHALF_0, (flag), (u32)(mptr) & 0xffff, (sid)); \
|
||||
gsDma1p(G_SELECT_DL, (mask), (u32)(mptr) >> 16, G_DL_NOPUSH); }
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Set general status
|
||||
*---------------------------------------------------------------------------*/
|
||||
#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))
|
||||
#define gsSPSetStatus(sid, val) \
|
||||
gsMoveWd( G_MW_GENSTAT, (sid), (val))
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Set Object Render Mode
|
||||
*---------------------------------------------------------------------------*/
|
||||
#define G_OBJRM_NOTXCLAMP 0x01
|
||||
#define G_OBJRM_XLU 0x02 /* Ignored */
|
||||
#define G_OBJRM_ANTIALIAS 0x04 /* Ignored */
|
||||
#define G_OBJRM_BILERP 0x08
|
||||
#define G_OBJRM_SHRINKSIZE_1 0x10
|
||||
#define G_OBJRM_SHRINKSIZE_2 0x20
|
||||
#define G_OBJRM_WIDEN 0x40
|
||||
|
||||
#define gSPObjRenderMode(pkt, mode) gImmp1((pkt),G_OBJ_RENDERMODE,(mode))
|
||||
#define gsSPObjRenderMode(mode) gsImmp1( G_OBJ_RENDERMODE,(mode))
|
||||
|
||||
/*===========================================================================*
|
||||
* Render Mode Macro
|
||||
*===========================================================================*/
|
||||
#define RM_RA_SPRITE(clk) \
|
||||
AA_EN | CVG_DST_CLAMP | \
|
||||
CVG_X_ALPHA | ALPHA_CVG_SEL | ZMODE_OPA | TEX_EDGE | \
|
||||
GBL_c##clk(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)
|
||||
|
||||
#define G_RM_SPRITE G_RM_OPA_SURF
|
||||
#define G_RM_SPRITE2 G_RM_OPA_SURF2
|
||||
#define G_RM_RA_SPRITE RM_RA_SPRITE(1)
|
||||
#define G_RM_RA_SPRITE2 RM_RA_SPRITE(2)
|
||||
#define G_RM_AA_SPRITE G_RM_AA_TEX_TERR
|
||||
#define G_RM_AA_SPRITE2 G_RM_AA_TEX_TERR2
|
||||
#define G_RM_XLU_SPRITE G_RM_XLU_SURF
|
||||
#define G_RM_XLU_SPRITE2 G_RM_XLU_SURF2
|
||||
#define G_RM_AA_XLU_SPRITE G_RM_AA_XLU_SURF
|
||||
#define G_RM_AA_XLU_SPRITE2 G_RM_AA_XLU_SURF2
|
||||
|
||||
/*===========================================================================*
|
||||
* External functions
|
||||
*===========================================================================*/
|
||||
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 *);
|
||||
|
||||
#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
|
||||
}
|
||||
#endif
|
||||
#endif /* _GS2DEX_H_ */
|
||||
|
||||
/*======== End of gs2dex.h ========*/
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef _ULTRA64_GU_H_
|
||||
#define _ULTRA64_GU_H_
|
||||
|
||||
#define GU_PI 3.1415926
|
||||
/* Functions */
|
||||
|
||||
void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, float aspect,
|
||||
float near, float far, float scale);
|
||||
void guPerspective(Mtx *m, u16 *perspNorm, float fovy, float aspect, float near,
|
||||
float far, float scale);
|
||||
void guOrtho(Mtx *m, float left, float right, float bottom, float top,
|
||||
float near, float far, float scale);
|
||||
void guTranslate(Mtx *m, float x, float y, float z);
|
||||
void guRotate(Mtx *m, float a, float x, float y, float z);
|
||||
void guScale(Mtx *m, float x, float y, float z);
|
||||
void guMtxF2L(float mf[4][4], Mtx *m);
|
||||
void guMtxIdent(Mtx *m);
|
||||
void guMtxIdentF(float mf[4][4]);
|
||||
void guMtxL2F(float mf[4][4], Mtx *m);
|
||||
void guNormalize(float *, float *, float *);
|
||||
|
||||
/* 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
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef _ULTRA64_LIBAUDIO_H_
|
||||
#define _ULTRA64_LIBAUDIO_H_
|
||||
|
||||
#include "abi.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 *offset;
|
||||
s32 len;
|
||||
} ALSeqData;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
s16 revision;
|
||||
s16 seqCount;
|
||||
ALSeqData seqArray[1];
|
||||
} ALSeqFile;
|
||||
|
||||
void alSeqFileNew(ALSeqFile *f, u8 *base);
|
||||
|
||||
#endif
|
||||
@@ -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 */
|
||||
@@ -0,0 +1,104 @@
|
||||
#ifndef _MBI_H_
|
||||
#define _MBI_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.136 $
|
||||
* $Date: 1999/01/05 13:04:00 $
|
||||
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/mbi.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Header file for the Media Binary Interface
|
||||
*
|
||||
* NOTE: This file is included by the RSP microcode, so any C-specific
|
||||
* constructs must be bracketed by #ifdef _LANGUAGE_C
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* the SHIFT macros are used to build display list commands, inserting
|
||||
* bit-fields into a 32-bit word. They take a value, a shift amount,
|
||||
* and a width.
|
||||
*
|
||||
* For the left shift, the lower bits of the value are masked,
|
||||
* then shifted left.
|
||||
*
|
||||
* For the right shift, the value is shifted right, then the lower bits
|
||||
* are masked.
|
||||
*
|
||||
* (NOTE: _SHIFTL(v, 0, 32) won't work, just use an assignment)
|
||||
*
|
||||
*/
|
||||
#define _SHIFTL(v, s, w) \
|
||||
((unsigned int) (((unsigned int)(v) & ((0x01 << (w)) - 1)) << (s)))
|
||||
#define _SHIFTR(v, s, w) \
|
||||
((unsigned int)(((unsigned int)(v) >> (s)) & ((0x01 << (w)) - 1)))
|
||||
|
||||
#define _SHIFT _SHIFTL /* old, for compatibility only */
|
||||
|
||||
#define G_ON (1)
|
||||
#define G_OFF (0)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Graphics Binary Interface
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef F3D_OLD
|
||||
#include <PR/gbi_old.h>
|
||||
#else
|
||||
#include <PR/gbi.h>
|
||||
#endif
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Audio Binary Interface
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <PR/abi.h>
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Task list
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#define M_GFXTASK 1
|
||||
#define M_AUDTASK 2
|
||||
#define M_VIDTASK 3
|
||||
#define M_HVQTASK 6
|
||||
#define M_HVQMTASK 7
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Segment macros and definitions
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#define NUM_SEGMENTS (16)
|
||||
#define SEGMENT_OFFSET(a) ((unsigned int)(a) & 0x00ffffff)
|
||||
#define SEGMENT_NUMBER(a) (((unsigned int)(a) << 4) >> 28)
|
||||
#define SEGMENT_ADDR(num, off) (((num) << 24) + (off))
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#endif /* !_MBI_H_ */
|
||||
@@ -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_ */
|
||||
@@ -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 *, s32);
|
||||
extern void osInvalICache(void *, s32);
|
||||
extern void osWritebackDCache(void *, s32);
|
||||
extern void osWritebackDCacheAll(void);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_CACHE_H_ */
|
||||
@@ -0,0 +1,207 @@
|
||||
|
||||
/*====================================================================
|
||||
* 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;
|
||||
|
||||
|
||||
#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 *);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_CONT_H_ */
|
||||
@@ -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_ */
|
||||
@@ -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_ */
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef _ULTRA64_OS_INTERNAL_H_
|
||||
#define _ULTRA64_OS_INTERNAL_H_
|
||||
|
||||
/* Internal functions used by the operating system */
|
||||
/* Do not include this header in application code */
|
||||
|
||||
/* Variables */
|
||||
|
||||
//extern u64 osClockRate;
|
||||
|
||||
/* Functions */
|
||||
|
||||
/*u32 __osProbeTLB(void *);
|
||||
u32 __osDisableInt(void);
|
||||
void __osRestoreInt(u32);*/
|
||||
OSThread *__osGetCurrFaultedThread(void);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,98 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_libc.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_libc.h,v $
|
||||
$Revision: 1.3 $
|
||||
$Date: 1999/07/13 01:43:47 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_LIBC_H_
|
||||
#define _OS_LIBC_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
|
||||
*
|
||||
*/
|
||||
|
||||
/* byte string operations */
|
||||
|
||||
|
||||
extern void bcopy(const void *, void *, int);
|
||||
extern int bcmp(const void *, const void *, int);
|
||||
extern void bzero(void *, int);
|
||||
|
||||
/* Printf */
|
||||
|
||||
extern int sprintf(char *s, const char *fmt, ...);
|
||||
extern void osSyncPrintf(const char *fmt, ...);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_LIBC_H_ */
|
||||
@@ -0,0 +1,163 @@
|
||||
|
||||
/*====================================================================
|
||||
* 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>
|
||||
|
||||
#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_ */
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef _ULTRA64_OS_MISC_H_
|
||||
#define _ULTRA64_OS_MISC_H_
|
||||
|
||||
/* Miscellaneous OS functions */
|
||||
|
||||
void osInitialize(void);
|
||||
u32 osGetCount(void);
|
||||
|
||||
u32 osVirtualToPhysical(void *);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,85 @@
|
||||
#ifndef _ULTRA64_PI_H_
|
||||
#define _ULTRA64_PI_H_
|
||||
|
||||
/* Ultra64 Parallel Interface */
|
||||
|
||||
/* Types */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 errStatus;
|
||||
void *dramAddr;
|
||||
void *C2Addr;
|
||||
u32 sectorSize;
|
||||
u32 C1ErrNum;
|
||||
u32 C1ErrSector[4];
|
||||
} __OSBlockInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 cmdType;
|
||||
u16 transferMode;
|
||||
u16 blockNum;
|
||||
s32 sectorNum;
|
||||
u32 devAddr;
|
||||
u32 bmCtlShadow;
|
||||
u32 seqCtlShadow;
|
||||
__OSBlockInfo block[2];
|
||||
} __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;
|
||||
u32 address;
|
||||
} OSPiInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u16 type;
|
||||
u8 pri;
|
||||
u8 status;
|
||||
OSMesgQueue *retQueue;
|
||||
} OSIoMesgHdr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/*0x00*/ OSIoMesgHdr hdr;
|
||||
/*0x08*/ void *dramAddr;
|
||||
/*0x0C*/ u32 devAddr;
|
||||
/*0x10*/ u32 size;
|
||||
//OSPiHandle *piHandle; //from the official definition
|
||||
} 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,
|
||||
u32 devAddr, void *vAddr, u32 nbytes, OSMesgQueue *mq);
|
||||
void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf,
|
||||
s32 cmdMsgCnt);
|
||||
OSMesgQueue *osPiGetCmdQueue(void);
|
||||
s32 osPiWriteIo(u32 devAddr, u32 data);
|
||||
s32 osPiReadIo(u32 devAddr, u32 *data);
|
||||
|
||||
#endif
|
||||
@@ -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_ */
|
||||
@@ -0,0 +1,75 @@
|
||||
#ifndef _ULTRA64_THREAD_H_
|
||||
#define _ULTRA64_THREAD_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
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef _ULTRA64_TIME_H_
|
||||
#define _ULTRA64_TIME_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
|
||||
@@ -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_ */
|
||||
@@ -0,0 +1,114 @@
|
||||
#ifndef _ULTRA64_VI_H_
|
||||
#define _ULTRA64_VI_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);
|
||||
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,113 @@
|
||||
#ifndef _ULTRA64_SPTASK_H_
|
||||
#define _ULTRA64_SPTASK_H_
|
||||
|
||||
/* Task Types */
|
||||
#define M_GFXTASK 1
|
||||
#define M_AUDTASK 2
|
||||
#define M_VIDTASK 3
|
||||
#define M_HVQTASK 6
|
||||
#define M_HVQMTASK 7
|
||||
|
||||
#if (defined(F3DEX_GBI) || defined(F3DLP_GBI) || defined(F3DEX_GBI_2))
|
||||
#define OS_YIELD_DATA_SIZE 0xc00
|
||||
#else
|
||||
#define OS_YIELD_DATA_SIZE 0x900
|
||||
#endif
|
||||
#define OS_YIELD_AUDIO_SIZE 0x400
|
||||
|
||||
/* 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
|
||||
|
||||
/* Types */
|
||||
/* Types */
|
||||
|
||||
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 */
|
||||
|
||||
#define osSpTaskStart(p) \
|
||||
osSpTaskLoad(p); \
|
||||
osSpTaskStartGo(p);
|
||||
|
||||
void osSpTaskLoad(OSTask *task);
|
||||
void osSpTaskStartGo(OSTask *task);
|
||||
void osSpTaskYield(void);
|
||||
OSYieldResult osSpTaskYielded(OSTask *task);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef _ULTRA64_UCODE_H_
|
||||
#define _ULTRA64_UCODE_H_
|
||||
|
||||
#define SP_DRAM_STACK_SIZE8 0x400
|
||||
#define SP_UCODE_SIZE 0x1000
|
||||
#define SP_UCODE_DATA_SIZE 0x800
|
||||
|
||||
// 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[];
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef _ULTRA64_TYPES_H_
|
||||
#define _ULTRA64_TYPES_H_
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL (void *)0
|
||||
#endif
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
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;
|
||||
|
||||
typedef unsigned long size_t;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user