Replace libultra headers with ones from SM64
This commit is contained in:
parent
fa27805616
commit
8028b2f9d7
|
|
@ -44515,6 +44515,8 @@ void func0f08e224(struct doorobj *door)
|
|||
}
|
||||
}
|
||||
|
||||
extern u32 osCicId;
|
||||
|
||||
void func0f08e2ac(struct doorobj *door)
|
||||
{
|
||||
bool pass = true;
|
||||
|
|
|
|||
|
|
@ -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 ========*/
|
||||
|
|
@ -18,4 +18,9 @@ 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
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef _ULTRA64_LIBAUDIO_H_
|
||||
#define _ULTRA64_LIBAUDIO_H_
|
||||
|
||||
#include "abi.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
extern u32 osTvType;
|
||||
extern u32 osRomBase;
|
||||
extern u32 osResetType;
|
||||
extern u32 osCicId;
|
||||
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_ */
|
||||
|
|
@ -13,4 +13,6 @@
|
|||
/*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_ */
|
||||
|
|
@ -61,7 +61,7 @@ typedef struct
|
|||
/*0x08*/ void *dramAddr;
|
||||
/*0x0C*/ u32 devAddr;
|
||||
/*0x10*/ u32 size;
|
||||
OSPiHandle *piHandle; //from the official definition
|
||||
//OSPiHandle *piHandle; //from the official definition
|
||||
} OSIoMesg;
|
||||
|
||||
/* Definitions */
|
||||
|
|
@ -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_ */
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef _ULTRA64_TIME_H_
|
||||
#define _ULTRA64_TIME_H_
|
||||
#include "message.h"
|
||||
#include <PR/os_message.h>
|
||||
|
||||
/* Types */
|
||||
|
||||
|
|
@ -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_ */
|
||||
|
|
@ -72,6 +72,7 @@ typedef struct
|
|||
|
||||
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);
|
||||
|
|
@ -107,36 +108,6 @@ void osViSwapBuffer(void *vaddr);
|
|||
#define OS_VI_PAL_HPN2 26
|
||||
#define OS_VI_PAL_HPF2 27
|
||||
|
||||
#define OS_VI_MPAL_LPN1 28 /* MPAL - mainly Brazil */
|
||||
#define OS_VI_MPAL_LPF1 29
|
||||
#define OS_VI_MPAL_LAN1 30
|
||||
#define OS_VI_MPAL_LAF1 31
|
||||
#define OS_VI_MPAL_LPN2 32
|
||||
#define OS_VI_MPAL_LPF2 33
|
||||
#define OS_VI_MPAL_LAN2 34
|
||||
#define OS_VI_MPAL_LAF2 35
|
||||
#define OS_VI_MPAL_HPN1 36
|
||||
#define OS_VI_MPAL_HPF1 37
|
||||
#define OS_VI_MPAL_HAN1 38
|
||||
#define OS_VI_MPAL_HAF1 39
|
||||
#define OS_VI_MPAL_HPN2 40
|
||||
#define OS_VI_MPAL_HPF2 41
|
||||
|
||||
#define OS_VI_FPAL_LPN1 42 /* FPAL - Full screen PAL */
|
||||
#define OS_VI_FPAL_LPF1 43
|
||||
#define OS_VI_FPAL_LAN1 44
|
||||
#define OS_VI_FPAL_LAF1 45
|
||||
#define OS_VI_FPAL_LPN2 46
|
||||
#define OS_VI_FPAL_LPF2 47
|
||||
#define OS_VI_FPAL_LAN2 48
|
||||
#define OS_VI_FPAL_LAF2 49
|
||||
#define OS_VI_FPAL_HPN1 50
|
||||
#define OS_VI_FPAL_HPF1 51
|
||||
#define OS_VI_FPAL_HAN1 52
|
||||
#define OS_VI_FPAL_HAF1 53
|
||||
#define OS_VI_FPAL_HPN2 54
|
||||
#define OS_VI_FPAL_HPF2 55
|
||||
|
||||
extern OSViMode osViModeTable[]; /* Global VI mode table */
|
||||
|
||||
|
||||
|
|
@ -8,7 +8,6 @@
|
|||
#define M_HVQTASK 6
|
||||
#define M_HVQMTASK 7
|
||||
|
||||
//gGfxSPTaskYieldBuffer has to be changed for this too
|
||||
#if (defined(F3DEX_GBI) || defined(F3DLP_GBI) || defined(F3DEX_GBI_2))
|
||||
#define OS_YIELD_DATA_SIZE 0xc00
|
||||
#else
|
||||
|
|
@ -11,13 +11,13 @@ extern u64 rspF3DBootStart[], rspF3DBootEnd[];
|
|||
// F3D ucode
|
||||
extern u64 rspF3DStart[], rspF3DEnd[];
|
||||
|
||||
// F3D data ucode
|
||||
// F3D ucode data
|
||||
extern u64 rspF3DDataStart[], rspF3DDataEnd[];
|
||||
|
||||
// F3D audio ucode
|
||||
extern u64 rspF3DAudioStart[], rspF3DAudioEnd[];
|
||||
// aspMain (audio) ucode
|
||||
extern u64 rspAspMainStart[], rspAspMainEnd[];
|
||||
|
||||
// F3D audio data ucode
|
||||
extern u64 rspF3DAudioDataStart[], rspF3DAudioDataEnd[];
|
||||
// aspMain ucode data
|
||||
extern u64 rspAspMainDataStart[], rspAspMainDataEnd[];
|
||||
|
||||
#endif
|
||||
|
|
@ -29,13 +29,6 @@ typedef volatile s64 vs64;
|
|||
typedef float f32;
|
||||
typedef double f64;
|
||||
|
||||
typedef long int Mtx_t[4][4];
|
||||
typedef union
|
||||
{
|
||||
Mtx_t m;
|
||||
long long int forc_structure_alignment;
|
||||
} Mtx;
|
||||
|
||||
typedef unsigned long size_t;
|
||||
|
||||
#endif
|
||||
|
|
@ -3,27 +3,27 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
#include <ultra64/types.h>
|
||||
#include <ultra64/interrupt.h>
|
||||
#include <ultra64/os_misc.h>
|
||||
#include <ultra64/rdp.h>
|
||||
#include <ultra64/thread.h>
|
||||
#include <ultra64/time.h>
|
||||
#include <ultra64/message.h>
|
||||
#include <ultra64/os_cont.h>
|
||||
#include <ultra64/tlb.h>
|
||||
#include <ultra64/sptask.h>
|
||||
#include <ultra64/ucode.h>
|
||||
#include <ultra64/cache.h>
|
||||
#include <ultra64/vi.h>
|
||||
#include <ultra64/pi.h>
|
||||
#include <ultra64/os_internal.h>
|
||||
#include <ultra64/gbi.h>
|
||||
#include <ultra64/eeprom.h>
|
||||
#include <ultra64/libc.h>
|
||||
#include <ultra64/gu.h>
|
||||
#include <ultra64/os_ai.h>
|
||||
#include <ultra64/libaudio.h>
|
||||
#include <ultra64/libultra.h>
|
||||
#include <PR/ultratypes.h>
|
||||
#include <PR/os_exception.h>
|
||||
#include <PR/os_misc.h>
|
||||
#include <PR/os_rdp.h>
|
||||
#include <PR/os_thread.h>
|
||||
#include <PR/os_time.h>
|
||||
#include <PR/os_message.h>
|
||||
#include <PR/os_cont.h>
|
||||
#include <PR/os_tlb.h>
|
||||
#include <PR/sptask.h>
|
||||
#include <PR/ucode.h>
|
||||
#include <PR/os_cache.h>
|
||||
#include <PR/os_vi.h>
|
||||
#include <PR/os_pi.h>
|
||||
#include <PR/os_internal.h>
|
||||
#include <PR/mbi.h>
|
||||
#include <PR/os_eeprom.h>
|
||||
#include <PR/os_libc.h>
|
||||
#include <PR/gu.h>
|
||||
#include <PR/os_ai.h>
|
||||
#include <PR/libaudio.h>
|
||||
#include <PR/libultra.h>
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
#ifndef _ULTRA64_CACHE_H_
|
||||
#define _ULTRA64_CACHE_H_
|
||||
|
||||
/* Functions */
|
||||
|
||||
void osInvalICache(void *vaddr, s32 nbytes);
|
||||
void osInvalDCache(void *vaddr, s32 nbytes);
|
||||
void osWritebackDCache(void *vaddr, s32 nbytes);
|
||||
void osWritebackDCacheAll(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
#ifndef _ULTRA64_EEPROM_H_
|
||||
#define _ULTRA64_EEPROM_H_
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u16 unk00;
|
||||
u16 unk01;
|
||||
} OSEepromUnknownStruct0;
|
||||
|
||||
/* Functions */
|
||||
|
||||
s32 osEepromLongRead(OSMesgQueue *mq, u8 address, u8 *buffer, int nbytes);
|
||||
s32 osEepromLongWrite(OSMesgQueue *mq, u8 address, u8 *buffer, int nbytes);
|
||||
s32 osEepromWrite(OSMesgQueue *mq, u8 address, u8 *buffer);
|
||||
s32 osEepromRead(OSMesgQueue *mq, u8 address, u8 *buffer);
|
||||
s32 osEepromProbe(OSMesgQueue *mq);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,733 +0,0 @@
|
|||
#ifndef _ULTRA64_GBI_H_
|
||||
#define _ULTRA64_GBI_H_
|
||||
|
||||
/* Types */
|
||||
|
||||
/* Vertex (set up for use with colors) */
|
||||
typedef struct
|
||||
{
|
||||
short ob[3]; /* x, y, z */
|
||||
unsigned short flag;
|
||||
short tc[2]; /* texture pos */
|
||||
unsigned char cn[4]; /* color & alpha */
|
||||
} Vtx_t;
|
||||
|
||||
/* Vertex (set up for use with normals) */
|
||||
typedef struct
|
||||
{
|
||||
short ob[3]; /* x, y, z */
|
||||
unsigned short flag;
|
||||
short tc[2]; /* texture pos */
|
||||
signed char n[3]; /* normal */
|
||||
unsigned char a; /* alpha */
|
||||
} Vtx_tn;
|
||||
|
||||
typedef union
|
||||
{
|
||||
Vtx_t v; /* Use this one for colors */
|
||||
Vtx_tn n; /* Use this one for normals */
|
||||
long long int force_structure_alignment;
|
||||
} Vtx;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short vscale[4]; /* scale, 2 bits fraction */
|
||||
short vtrans[4]; /* translate, 2 bits fraction */
|
||||
} Vp_t;
|
||||
|
||||
typedef union
|
||||
{
|
||||
Vp_t vp;
|
||||
long long int force_structure_alignment;
|
||||
} Vp;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int w0;
|
||||
unsigned int w1;
|
||||
} Gwords;
|
||||
|
||||
/* TODO: fill in the rest of the members */
|
||||
typedef union
|
||||
{
|
||||
Gwords words;
|
||||
long long int force_structure_alignment;
|
||||
} Gfx;
|
||||
|
||||
|
||||
#define _SHIFTL(value, shift, size) \
|
||||
((unsigned int) (((unsigned int) (value) & ((1 << size) - 1)) << shift))
|
||||
|
||||
#define G_ON 1
|
||||
#define G_OFF 0
|
||||
|
||||
#define GPACK_RGBA5551(r, g, b, a) \
|
||||
((((r) << 8) & 0xF800) | \
|
||||
(((g) << 3) & 0x07C0) | \
|
||||
(((b) >> 2) & 0x003E) | \
|
||||
((a) & 0x0001))
|
||||
#define GPACK_ZDZ(z, dz) ((z) << 2 | (dz))
|
||||
|
||||
|
||||
#define G_ZBUFFER 0x00000001
|
||||
#define G_TEXTURE_ENABLE 0x00000002
|
||||
#define G_SHADE 0x00000004
|
||||
#define G_SHADING_SMOOTH 0x00000200
|
||||
#define G_CULL_FRONT 0x00001000
|
||||
#define G_CULL_BACK 0x00002000
|
||||
#define G_CULL_BOTH 0x00003000
|
||||
#define G_FOG 0x00010000
|
||||
#define G_LIGHTING 0x00020000
|
||||
#define G_TEXTURE_GEN 0x00040000
|
||||
#define G_TEXTURE_GEN_LINEAR 0x00080000
|
||||
#define G_LOD 0x00100000
|
||||
#define G_CLIPPING 0x00800000
|
||||
|
||||
#define G_IM_FMT_RGBA 0
|
||||
#define G_IM_FMT_YUV 1
|
||||
#define G_IM_FMT_CI 2
|
||||
#define G_IM_FMT_IA 3
|
||||
#define G_IM_FMT_I 4
|
||||
|
||||
#define G_IM_SIZ_4b 0
|
||||
#define G_IM_SIZ_8b 1
|
||||
#define G_IM_SIZ_16b 2
|
||||
#define G_IM_SIZ_32b 3
|
||||
#define G_IM_SIZ_DD 5
|
||||
|
||||
#define G_AC_NONE (0 << 0)
|
||||
#define G_AC_THRESHOLD (1 << 0)
|
||||
#define G_AC_DITHER (3 << 0)
|
||||
|
||||
#define G_ZS_PIXEL (0 << 2)
|
||||
#define G_ZS_PRIM (1 << 2)
|
||||
|
||||
#define G_CD_MAGICSQ (0 << 6)
|
||||
#define G_CD_BAYER (1 << 6)
|
||||
#define G_CD_NOISE (2 << 6)
|
||||
|
||||
#define G_CK_NONE (0 << 8)
|
||||
#define G_CK_KEY (1 << 8)
|
||||
|
||||
#define G_TC_CONV (0 << 9)
|
||||
#define G_TC_FILTCONV (5 << 9)
|
||||
#define G_TC_FILT (6 << 9)
|
||||
|
||||
#define G_TF_POINT (0 << 12)
|
||||
#define G_TF_BILERP (2 << 12)
|
||||
#define G_TF_AVERAGE (3 << 12)
|
||||
|
||||
#define G_TT_NONE (0 << 14)
|
||||
#define G_TT_RGBA16 (2 << 14)
|
||||
#define G_TT_IA16 (3 << 14)
|
||||
|
||||
#define G_TL_TILE (0 << 16)
|
||||
#define G_TL_LOD (1 << 16)
|
||||
|
||||
#define G_TD_CLAMP (0 << 17)
|
||||
#define G_TD_SHARPEN (1 << 17)
|
||||
#define G_TD_DETAIL (2 << 17)
|
||||
|
||||
#define G_TP_NONE (0 << 19)
|
||||
#define G_TP_PERSP (1 << 19)
|
||||
|
||||
#define G_CYC_1CYCLE (0 << 20)
|
||||
#define G_CYC_2CYCLE (1 << 20)
|
||||
#define G_CYC_COPY (2 << 20)
|
||||
#define G_CYC_FILL (3 << 20)
|
||||
|
||||
#define G_PM_NPRIMITIVE (0 << 23)
|
||||
#define G_PM_1PRIMITIVE (1 << 23)
|
||||
|
||||
#define G_SC_NON_INTERLACE 0
|
||||
#define G_SC_ODD_INTERLACE 3
|
||||
#define G_SC_EVEN_INTERLACE 2
|
||||
|
||||
#define G_TX_LOADTILE 7
|
||||
#define G_TX_RENDERTILE 0
|
||||
|
||||
#define G_TX_NOMIRROR 0
|
||||
#define G_TX_WRAP 0
|
||||
#define G_TX_MIRROR 1
|
||||
#define G_TX_CLAMP 2
|
||||
#define G_TX_NOMASK 0
|
||||
#define G_TX_NOLOD 0
|
||||
|
||||
#define G_TX_LDBLK_MAX_TXL 2047
|
||||
|
||||
#define G_MV_VIEWPORT 0x80
|
||||
#define G_MV_LOOKATY 0x82
|
||||
#define G_MV_LOOKATX 0x84
|
||||
#define G_MV_L0 0x86
|
||||
#define G_MV_L1 0x88
|
||||
#define G_MV_L2 0x8A
|
||||
#define G_MV_L3 0x8C
|
||||
#define G_MV_L4 0x8E
|
||||
#define G_MV_L5 0x90
|
||||
#define G_MV_L6 0x92
|
||||
#define G_MV_L7 0x94
|
||||
#define G_MV_TXTATT 0x96
|
||||
#define G_MV_MATRIX_1 0x9E
|
||||
#define G_MV_MATRIX_2 0x98
|
||||
#define G_MV_MATRIX_3 0x9A
|
||||
#define G_MV_MATRIX_4 0x9C
|
||||
|
||||
#define G_SETOTHERMODE_L 0xB9
|
||||
#define G_SETOTHERMODE_H 0xBA
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define gSPMatrix(pkt, m, p) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0x01, 24, 8) \
|
||||
| _SHIFTL((p), 16, 8) \
|
||||
| _SHIFTL(sizeof(Mtx), 0, 16); \
|
||||
_g->words.w1 = (u32)(m); \
|
||||
}
|
||||
|
||||
#define gSPVertex(pkt, v, n, v0) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0x04, 24, 8) \
|
||||
| _SHIFTL(((n)-1) << 4 | (v0), 16, 8) \
|
||||
| _SHIFTL(sizeof(Vtx)*(n), 0, 16); \
|
||||
_g->words.w1 = (u32)(v); \
|
||||
}
|
||||
|
||||
#define gDPLoadSync(pkt) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xE6000000; \
|
||||
_g->words.w1 = 0x00000000; \
|
||||
}
|
||||
|
||||
#define gDPPipeSync(pkt) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xE7000000; \
|
||||
_g->words.w1 = 0x00000000; \
|
||||
}
|
||||
|
||||
#define gDPTileSync(pkt) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xE8000000; \
|
||||
_g->words.w1 = 0x00000000; \
|
||||
}
|
||||
|
||||
#define gDPFullSync(pkt) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xE9000000; \
|
||||
_g->words.w1 = 0x00000000; \
|
||||
}
|
||||
|
||||
#define gSPDisplayList(pkt, dl) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0x06000000; \
|
||||
_g->words.w1 = (u32)(dl); \
|
||||
}
|
||||
|
||||
#define gSPBranchList(pkt, dl) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = 0x06010000; \
|
||||
_g->words.w1 = (u32)(dl); \
|
||||
}
|
||||
|
||||
#define gSPEndDisplayList(pkt) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xB8000000; \
|
||||
_g->words.w1 = 0x00000000; \
|
||||
}
|
||||
|
||||
#define gDPSetCycleType(pkt, type) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xBA001402; \
|
||||
_g->words.w1 = type; \
|
||||
}
|
||||
|
||||
#define gDPPipelineMode(pkt, mode) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xBA001701; \
|
||||
_g->words.w1 = mode; \
|
||||
}
|
||||
|
||||
#define gDPSetScissor(pkt, mode, ulx, uly, lrx, lry) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xED, 24, 8) \
|
||||
| _SHIFTL((int)((float)(ulx)*4.0f), 12, 12) \
|
||||
| _SHIFTL((int)((float)(uly)*4.0f), 0, 12); \
|
||||
_g->words.w1 = _SHIFTL((mode), 24, 8) \
|
||||
| _SHIFTL((int)((float)(lrx)*4.0f), 12, 12) \
|
||||
| _SHIFTL((int)((float)(lry)*4.0f), 0, 12); \
|
||||
}
|
||||
|
||||
#define gDPSetCombine(pkt, muxs0, muxs1) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xFC, 24, 8) \
|
||||
| _SHIFTL((muxs0), 0, 24); \
|
||||
_g->words.w1 = (muxs1); \
|
||||
}
|
||||
|
||||
#define gDPSetTextureLOD(pkt, type) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xBA001001; \
|
||||
_g->words.w1 = type; \
|
||||
}
|
||||
|
||||
#define gDPSetTextureLUT(pkt, type) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xBA000E02; \
|
||||
_g->words.w1 = type; \
|
||||
}
|
||||
|
||||
#define gDPSetTextureDetail(pkt, type) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xBA001102; \
|
||||
_g->words.w1 = type; \
|
||||
}
|
||||
|
||||
#define gDPSetTexturePersp(pkt, type) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xBA001301; \
|
||||
_g->words.w1 = type; \
|
||||
}
|
||||
|
||||
#define gDPSetTextureFilter(pkt, type) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xBA000C02; \
|
||||
_g->words.w1 = type; \
|
||||
}
|
||||
|
||||
#define gDPSetTextureConvert(pkt, type) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xBA000903; \
|
||||
_g->words.w1 = type; \
|
||||
}
|
||||
|
||||
#define gDPSetCombineKey(pkt, type) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xBA000801; \
|
||||
_g->words.w1 = type; \
|
||||
}
|
||||
|
||||
#define gDPSetColorDither(pkt, type) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xBA000602; \
|
||||
_g->words.w1 = type; \
|
||||
}
|
||||
|
||||
#define gDPSetFillColor(pkt, color) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xF7000000; \
|
||||
_g->words.w1 = color; \
|
||||
}
|
||||
|
||||
#define gDPFillRectangle(pkt, ulx, uly, lrx, lry) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xF6, 24, 8) \
|
||||
| _SHIFTL((lrx), 14, 10) \
|
||||
| _SHIFTL((lry), 2, 10); \
|
||||
_g->words.w1 = _SHIFTL(0, 24, 8) \
|
||||
| _SHIFTL((ulx), 14, 10) \
|
||||
| _SHIFTL((uly), 2, 10); \
|
||||
}
|
||||
|
||||
#define gDPSetAlphaCompare(pkt, type) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xB9000002; \
|
||||
_g->words.w1 = type; \
|
||||
}
|
||||
|
||||
#define gDPSetDepthSource(pkt, type) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xB9000201; \
|
||||
_g->words.w1 = type; \
|
||||
}
|
||||
|
||||
#define gSPSetOtherMode(pkt, cmd, shift, length, data) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = _SHIFTL((cmd), 24, 8) \
|
||||
| _SHIFTL((shift), 8, 8) \
|
||||
| _SHIFTL(((length)-1), 0, 8); \
|
||||
_g->words.w1 = (data); \
|
||||
}
|
||||
|
||||
#define gDPSetRenderMode(pkt, mode1, mode2) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xB900031D; \
|
||||
_g->words.w1 = (mode1) | (mode2); \
|
||||
}
|
||||
|
||||
#define gSPClearGeometryMode(pkt, mode) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xB6000000; \
|
||||
_g->words.w1 = mode; \
|
||||
}
|
||||
|
||||
#define gSPSetGeometryMode(pkt, word) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xB7000000; \
|
||||
_g->words.w1 = word; \
|
||||
}
|
||||
|
||||
#define gSPNumLights(pkt, n) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xBC000002; \
|
||||
_g->words.w1 = (0x80000000 + ((n) + 1) * 0x20); \
|
||||
}
|
||||
|
||||
#define gSPTexture(pkt, sc, tc, level, tile, on) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xBB, 24, 8) \
|
||||
| _SHIFTL(0, 16, 8) \
|
||||
| _SHIFTL((level), 11, 3) \
|
||||
| _SHIFTL((tile), 8, 3) \
|
||||
| _SHIFTL((on), 0, 8); \
|
||||
_g->words.w1 = _SHIFTL((sc), 16, 16) \
|
||||
| _SHIFTL((tc), 0, 16); \
|
||||
}
|
||||
|
||||
#define gDPSetColorImage(pkt, fmt, size, width, image) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xFF, 24, 8) \
|
||||
| _SHIFTL((fmt), 21, 3) \
|
||||
| _SHIFTL((size), 19, 2) \
|
||||
| _SHIFTL((width)-1, 0, 12); \
|
||||
_g->words.w1 = (image); \
|
||||
}
|
||||
|
||||
#define gDPSetTileSize(pkt, tile, uls, ult, lrs, lrt) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xF2, 24, 8) \
|
||||
| _SHIFTL(uls, 12, 12) \
|
||||
| _SHIFTL(ult, 0, 12); \
|
||||
_g->words.w1 = _SHIFTL(tile, 24, 3) \
|
||||
| _SHIFTL(lrs, 12, 12) \
|
||||
| _SHIFTL(lrt, 0, 12); \
|
||||
}
|
||||
|
||||
#define gDPLoadBlock(pkt, tile, uls, ult, lrs, dxt) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xF3, 24, 8) \
|
||||
| _SHIFTL((uls), 12, 12) \
|
||||
| _SHIFTL((ult), 0, 12); \
|
||||
_g->words.w1 = _SHIFTL((tile), 24, 3) \
|
||||
| _SHIFTL((MIN((lrs),G_TX_LDBLK_MAX_TXL)), 12, 12) \
|
||||
| _SHIFTL((dxt), 0, 12); \
|
||||
}
|
||||
|
||||
#define gDPSetTile(pkt, fmt, siz, line, tmem, tile, \
|
||||
palette, cmt, maskt, shiftt, cms, masks, shifts) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xF5, 24, 8) \
|
||||
| _SHIFTL((fmt), 21, 3) \
|
||||
| _SHIFTL((siz), 19, 2) \
|
||||
| _SHIFTL((line), 9, 9) \
|
||||
| _SHIFTL((tmem), 0, 9); \
|
||||
_g->words.w1 = _SHIFTL((tile), 24, 3) \
|
||||
| _SHIFTL((palette), 20, 4) \
|
||||
| _SHIFTL((cmt), 18, 2) \
|
||||
| _SHIFTL((maskt), 14, 4) \
|
||||
| _SHIFTL((shiftt), 10, 4) \
|
||||
| _SHIFTL((cms), 8, 2) \
|
||||
| _SHIFTL((masks), 4, 4) \
|
||||
| _SHIFTL((shifts), 0, 4); \
|
||||
}
|
||||
|
||||
#define gDPSetDepthImage(pkt, image) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xFE, 24, 8); \
|
||||
_g->words.w1 = (image); \
|
||||
}
|
||||
|
||||
#define G_SETPRIMCOLOR 0xFA
|
||||
|
||||
#define gDPSetPrimColor(pkt, m, l, rgba) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(G_SETPRIMCOLOR, 24, 8) \
|
||||
| _SHIFTL(m, 8, 8) \
|
||||
| _SHIFTL(l, 0, 8); \
|
||||
_g->words.w1 = (rgba); \
|
||||
}
|
||||
|
||||
#define gDPSetEnvColor(pkt, r, g, b, a) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xFB, 24, 8); \
|
||||
_g->words.w1 = _SHIFTL((r), 24, 8) \
|
||||
| _SHIFTL((g), 16, 8) \
|
||||
| _SHIFTL((b), 8, 8) \
|
||||
| _SHIFTL((a), 0, 8); \
|
||||
}
|
||||
|
||||
#define gDPSetTextureImage(pkt, fmt, size, width, img) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xFD, 24, 8) \
|
||||
| _SHIFTL((fmt), 21, 3) \
|
||||
| _SHIFTL((size), 19, 2) \
|
||||
| _SHIFTL((width)-1, 0, 12); \
|
||||
_g->words.w1 = (u32)(img); \
|
||||
}
|
||||
|
||||
#define gMoveWd(pkt, index, offset, data) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xBC, 24, 8) \
|
||||
| _SHIFTL((offset), 8, 16) \
|
||||
| _SHIFTL((index), 0, 8); \
|
||||
_g->words.w1 = (u32)(data); \
|
||||
}
|
||||
|
||||
/* Matrix Operations */
|
||||
|
||||
#define G_MTX_MODELVIEW 0x00
|
||||
#define G_MTX_PROJECTION 0x01
|
||||
#define G_MTX_MUL 0x00
|
||||
#define G_MTX_LOAD 0x02
|
||||
#define G_MTX_NOPUSH 0x00
|
||||
#define G_MTX_PUSH 0x04
|
||||
|
||||
#define gSPPopMatrix(pkt, n) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *) (pkt); \
|
||||
_g->words.w0 = 0xBD000000; \
|
||||
_g->words.w1 = (n); \
|
||||
}
|
||||
|
||||
#define gSPViewport(pkt, v) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0x03, 24, 8) \
|
||||
| _SHIFTL(G_MV_VIEWPORT, 16, 8) \
|
||||
| _SHIFTL(sizeof(Vp), 0, 16); \
|
||||
_g->words.w1 = (u32)(v); \
|
||||
}
|
||||
|
||||
#define gSP1Triangle(pkt, v0, v1, v2, flag) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xBF, 24, 8); \
|
||||
_g->words.w1 = _SHIFTL((flag), 24, 8) \
|
||||
| _SHIFTL((v0)*10, 16, 8) \
|
||||
| _SHIFTL((v1)*10, 8, 8) \
|
||||
| _SHIFTL((v2)*10, 0, 8); \
|
||||
}
|
||||
|
||||
#if (defined(F3DLP_GBI)||defined(F3DEX_GBI))
|
||||
/***
|
||||
*** 2 Triangles
|
||||
***/
|
||||
#define gSP2Triangles(pkt, v00, v01, v02, flag0, v10, v11, v12, flag1) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = (_SHIFTL(G_TRI2, 24, 8)| \
|
||||
__gsSP1Triangle_w1f(v00, v01, v02, flag0)); \
|
||||
_g->words.w1 = __gsSP1Triangle_w1f(v10, v11, v12, flag1); \
|
||||
}
|
||||
|
||||
#define gsSP2Triangles(v00, v01, v02, flag0, v10, v11, v12, flag1) \
|
||||
{ \
|
||||
(_SHIFTL(G_TRI2, 24, 8)| \
|
||||
__gsSP1Triangle_w1f(v00, v01, v02, flag0)), \
|
||||
__gsSP1Triangle_w1f(v10, v11, v12, flag1) \
|
||||
}
|
||||
|
||||
#endif /* F3DEX_GBI/F3DLP_GBI */
|
||||
|
||||
#if (defined(TRI4_Ext))
|
||||
/***
|
||||
*** 4 Triangles - 2Tri Extension
|
||||
*** Draws up to four triangles at a time.
|
||||
*** Expects values from 0-F, corresponding with # points declared by vertex command.
|
||||
*** Triangles with all points set to 0 are not drawn.
|
||||
*** Vertex Buffer reduced to 16 due to only being able to address 0-F
|
||||
***/
|
||||
#define gSP4Triangles(pkt, v00, v01, v02, v10, v11, v12, \
|
||||
v20, v21, v22, v30, v31, v32 ) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = (_SHIFTL(G_TRI2, 24, 8)| \
|
||||
_SHIFTL((v32),12,4)|_SHIFTL((v22),8,4)|_SHIFTL((v12),4,4)|_SHIFTL((v02),0,4); \
|
||||
_g->words.w1 = _SHIFTL((v31),28,4)|_SHIFTL((v30),24,4)|_SHIFTL((v21),20,4)|_SHIFTL((v20),16,4) \
|
||||
_SHIFTL((v11),12,4)|_SHIFTL((v10),8,4)|_SHIFTL((v02),4,4)|_SHIFTL((v00),0,4); \
|
||||
}
|
||||
|
||||
#define gsSP4Triangles(v00, v01, v02, flag0, v10, v11, v12, flag1) \
|
||||
{ \
|
||||
(_SHIFTL(G_TRI2, 24, 8)| \
|
||||
_SHIFTL((v32),12,4)|_SHIFTL((v22),8,4)|_SHIFTL((v12),4,4)|_SHIFTL((v02),0,4)), \
|
||||
(_SHIFTL((v31),28,4)|_SHIFTL((v30),24,4)|_SHIFTL((v21),20,4)|_SHIFTL((v20),16,4) \
|
||||
_SHIFTL((v11),12,4)|_SHIFTL((v10),8,4)|_SHIFTL((v02),4,4)|_SHIFTL((v00),0,4)); \
|
||||
}
|
||||
|
||||
#endif /* TRI4_Ext*/
|
||||
|
||||
#define gSPTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xE4, 24, 8) \
|
||||
| _SHIFTL((xh), 12, 12) \
|
||||
| _SHIFTL((yh), 0, 12); \
|
||||
_g->words.w1 = _SHIFTL((tile), 24, 3) \
|
||||
| _SHIFTL((xl), 12, 12) \
|
||||
| _SHIFTL((yl), 0, 12); \
|
||||
} \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xB3, 24, 8); \
|
||||
_g->words.w1 = _SHIFTL((s), 16, 16) \
|
||||
| _SHIFTL((t), 0, 16); \
|
||||
} \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(0xB2, 24, 8); \
|
||||
_g->words.w1 = _SHIFTL((dsdx), 16, 16) \
|
||||
| _SHIFTL((dtdy), 0, 16); \
|
||||
}
|
||||
|
||||
/* Lights and Light Operations */
|
||||
|
||||
typedef struct {
|
||||
unsigned char col[3];
|
||||
char pad1;
|
||||
unsigned char colc[3];
|
||||
char pad2;
|
||||
signed char dir[3];
|
||||
char pad3;
|
||||
} Light_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char col[3];
|
||||
char pad1;
|
||||
unsigned char colc[3];
|
||||
char pad2;
|
||||
} Ambient_t;
|
||||
|
||||
typedef union {
|
||||
Ambient_t l;
|
||||
long long int force_structure_alignment[1];
|
||||
} Ambient;
|
||||
|
||||
typedef union {
|
||||
Light_t l;
|
||||
long long int force_structure_alignment[2];
|
||||
} Light;
|
||||
|
||||
typedef struct {
|
||||
Ambient a;
|
||||
Light l[4];
|
||||
} Lights4;
|
||||
|
||||
typedef struct {
|
||||
Light l[2];
|
||||
} LookAt;
|
||||
|
||||
typedef struct {
|
||||
int x1, y1, x2, y2;
|
||||
} Hilite_t;
|
||||
|
||||
typedef union {
|
||||
Hilite_t h;
|
||||
long int force_alignmnet[4];
|
||||
} Hilite;
|
||||
|
||||
#define G_MOVEMEM 0x03
|
||||
/* for gSPNumLights */
|
||||
// is NUMLIGHTS_0 accurate?
|
||||
#define NUMLIGHTS_0 1
|
||||
#define NUMLIGHTS_1 1
|
||||
#define NUMLIGHTS_2 2
|
||||
#define NUMLIGHTS_3 3
|
||||
#define NUMLIGHTS_4 4
|
||||
#define NUMLIGHTS_5 5
|
||||
#define NUMLIGHTS_6 6
|
||||
#define NUMLIGHTS_7 7
|
||||
|
||||
/* for gSPLight */
|
||||
#define LIGHT_1 1
|
||||
#define LIGHT_2 2
|
||||
#define LIGHT_3 3
|
||||
#define LIGHT_4 4
|
||||
#define LIGHT_5 5
|
||||
#define LIGHT_6 6
|
||||
#define LIGHT_7 7
|
||||
#define LIGHT_8 8
|
||||
|
||||
#define gSPLight(pkt, l, n) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(G_MOVEMEM, 24, 8) \
|
||||
| _SHIFTL(((n)-1)*2+G_MV_L0, 16, 8) \
|
||||
| _SHIFTL(sizeof(Light), 0, 16); \
|
||||
_g->words.w1 = (u32)(l); \
|
||||
}
|
||||
|
||||
#define gSPLookAtX(pkt, la) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(G_MOVEMEM, 24, 8) \
|
||||
| _SHIFTL(G_MV_LOOKATX, 16, 8) \
|
||||
| _SHIFTL(sizeof(Light), 0, 16); \
|
||||
_g->words.w1 = (u32)(la); \
|
||||
}
|
||||
|
||||
#define gSPLookAtY(pkt, la) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = _SHIFTL(G_MOVEMEM, 24, 8) \
|
||||
| _SHIFTL(G_MV_LOOKATY, 16, 8) \
|
||||
| _SHIFTL(sizeof(Light), 0, 16); \
|
||||
_g->words.w1 = (u32)(la); \
|
||||
}
|
||||
|
||||
#define gSPLookAt(pkt, la) \
|
||||
{ \
|
||||
gSPLookAtX((pkt), (la)) \
|
||||
gSPLookAtY((pkt), (char *)(la)+16) \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,332 +0,0 @@
|
|||
/* GNU as assembler macros for F3D GBI */
|
||||
|
||||
/* 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
|
||||
.byte \cmd, \params
|
||||
.hword \length
|
||||
.word \segAddr
|
||||
.endm
|
||||
|
||||
/* 01: G_MTX */
|
||||
/* params */
|
||||
.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
|
||||
|
||||
.set G_MTX, 0x01
|
||||
.macro gsSPMatrix matrix, params
|
||||
gsDma1p G_MTX, \matrix, 64, \params
|
||||
.endm
|
||||
|
||||
/* 02: reserved */
|
||||
|
||||
/* 03: G_MOVEMEM */
|
||||
.set G_MOVEMEM, 0x03
|
||||
.set G_MV_L0, 0x86
|
||||
.macro gsSPLight light, num
|
||||
gsDma1p G_MOVEMEM, \light, 16, ((\num)-1)*2+G_MV_L0
|
||||
.endm
|
||||
|
||||
/* 04: G_VTX */
|
||||
.set G_VTX, 0x04
|
||||
.macro gsSPVertex verts, num, index
|
||||
gsDma1p G_VTX, \verts, 16*\num, ((\num)-1)<<4|(\index)
|
||||
.endm
|
||||
|
||||
/* 05: reserved */
|
||||
|
||||
/* 06: G_DL */
|
||||
.set G_DL, 0x06
|
||||
.set G_DL_PUSH, 0x00
|
||||
.set G_DL_NOPUSH, 0x01
|
||||
.macro gsSPDisplayList dl
|
||||
gsDma1p G_DL, \dl, 0, G_DL_PUSH
|
||||
.endm
|
||||
.macro gsSPBranchList dl
|
||||
gsDma1p G_DL, \dl, 0, G_DL_NOPUSH
|
||||
.endm
|
||||
|
||||
/* geometry mode flags */
|
||||
.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
|
||||
|
||||
/* B3: G_RDPHALF_2 */
|
||||
.set G_RDPHALF_2, 0xB3
|
||||
|
||||
/* B4: G_RDPHALF_1 */
|
||||
.set G_RDPHALF_1, 0xB4
|
||||
|
||||
/* B6: G_CLEARGEOMETRYMODE */
|
||||
.set G_CLEARGEOMETRYMODE, 0xB6
|
||||
.macro gsSPClearGeometryMode flags
|
||||
.word G_CLEARGEOMETRYMODE << 24
|
||||
.word \flags
|
||||
.endm
|
||||
|
||||
/* B7: G_SETGEOMETRYMODE */
|
||||
.set G_SETGEOMETRYMODE, 0xB7
|
||||
.macro gsSPSetGeometryMode flags
|
||||
.word G_SETGEOMETRYMODE << 24
|
||||
.word \flags
|
||||
.endm
|
||||
|
||||
/* B8: G_ENDDL */
|
||||
.set G_ENDDL, 0xB8
|
||||
.macro gsSPEndDisplayList
|
||||
f3d_noparam G_ENDDL
|
||||
.endm
|
||||
|
||||
/* B9: G_SETOTHERMODE_L */
|
||||
.set G_SETOTHERMODE_L, 0xB9
|
||||
/* G_SETOTHERMODE_L sft: shift count */
|
||||
.set G_MDSFT_ALPHACOMPARE, 0
|
||||
.set G_MDSFT_ZSRCSEL, 2
|
||||
.set G_MDSFT_RENDERMODE, 3
|
||||
.set G_MDSFT_BLENDER, 16
|
||||
|
||||
/* BA: G_SETOTHERMODE_H */
|
||||
.set G_SETOTHERMODE_H, 0xBA
|
||||
/* G_SETOTHERMODE_H sft: shift count */
|
||||
.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
|
||||
|
||||
.macro gsSPSetOtherMode cmd, sft, len, data
|
||||
.word ((\cmd & 0xFF) << 24) | ((\sft & 0xFF) << 8) | (\len & 0xFF)
|
||||
.word \data
|
||||
.endm
|
||||
|
||||
/* BB: G_TEXTURE */
|
||||
.set G_TEXTURE, 0xBB
|
||||
.macro gsSPTexture scaleS, scaleT, level, tile, enable
|
||||
.word (G_TEXTURE << 24) | ((\level & 0x7) << 11) | ((\tile & 0x7) << 8) | \enable
|
||||
.word ((\scaleS & 0xFFFF) << 16) | (\scaleT & 0xFFFF)
|
||||
.endm
|
||||
|
||||
/* BC: G_MOVEWORD */
|
||||
.set G_MOVEWORD, 0xBC
|
||||
.macro gsMoveWd index, offset, data
|
||||
.word G_MOVEWORD << 24 | ((\index & 0xFFFF) << 8) | (\offset & 0xFF)
|
||||
.word \data
|
||||
.endm
|
||||
|
||||
/* BF: G_TRI1 */
|
||||
.set G_TRI1, 0xBF
|
||||
.macro gsSP1Triangle v0, v1, v2, flag
|
||||
.word G_TRI1 << 24
|
||||
.byte \flag, \v0*10, \v1*10, \v2*10
|
||||
.endm
|
||||
|
||||
/* C0: G_NOOP */
|
||||
.set G_NOOP, 0xC0
|
||||
.macro gsDPNoOp
|
||||
f3d_noparam G_NOOP
|
||||
.endm
|
||||
|
||||
/* E6: G_RDPLOADSYNC */
|
||||
.set G_RDPLOADSYNC, 0xE6
|
||||
.macro gsDPLoadSync
|
||||
f3d_noparam G_RDPLOADSYNC
|
||||
.endm
|
||||
|
||||
/* E7: G_RDPPIPESYNC */
|
||||
.set G_RDPPIPESYNC, 0xE7
|
||||
.macro gsDPPipeSync
|
||||
f3d_noparam G_RDPPIPESYNC
|
||||
.endm
|
||||
|
||||
/* E8: G_RDPTILESYNC */
|
||||
.set G_RDPTILESYNC, 0xE8
|
||||
.macro gsDPTileSync
|
||||
f3d_noparam G_RDPTILESYNC
|
||||
.endm
|
||||
|
||||
/* E9: G_RDPFULLSYNC */
|
||||
.set G_RDPFULLSYNC, 0xE9
|
||||
.macro gsDPFullSync
|
||||
f3d_noparam G_RDPFULLSYNC
|
||||
.endm
|
||||
|
||||
/* F0: G_LOADTLUT */
|
||||
.set G_LOADTLUT, 0xF0
|
||||
.macro gsDPLoadTLUTCmd tile, count
|
||||
.word G_LOADTLUT << 24
|
||||
.word ((\tile & 0x7) << 24) | (\count & 0x3FFF) << 10
|
||||
.endm
|
||||
|
||||
/* F1: unused */
|
||||
|
||||
/* F2: G_SETTILESIZE */
|
||||
.set G_SETTILESIZE, 0xF2
|
||||
.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
|
||||
|
||||
/* F3: G_LOADBLOCK */
|
||||
.set G_LOADBLOCK, 0xF3
|
||||
.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
|
||||
|
||||
/* F5: G_SETTILE */
|
||||
.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
|
||||
|
||||
.set G_SETTILE, 0xF5
|
||||
.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
|
||||
|
||||
/* F6: G_FILLRECT */
|
||||
.set G_FILLRECT, 0xF6
|
||||
.macro gsDPFillRectangle ulx, uly, lrx, lry
|
||||
.word (G_FILLRECT << 24) | ((\lrx & 0x3FF) << 14) | ((\lry & 0x3FF) << 2)
|
||||
.word ((\ulx & 0x3FF) << 14) | ((\uly & 0x3FF) << 2)
|
||||
.endm
|
||||
|
||||
/* F7: G_SETFILLCOLOR */
|
||||
.set G_SETFILLCOLOR, 0xF7
|
||||
.macro gsDPSetFillColor fillValue
|
||||
.word G_SETFILLCOLOR << 24
|
||||
.word \fillValue
|
||||
.endm
|
||||
|
||||
/* helper for RGBA colors */
|
||||
.macro sDPRGBColor cmd r, g, b, a
|
||||
.word \cmd << 24
|
||||
.byte \r, \g, \b, \a
|
||||
.endm
|
||||
|
||||
/* F8: G_SETFOGCOLOR */
|
||||
.set G_SETFOGCOLOR, 0xF8
|
||||
.macro gsDPSetFogColor r, g, b, a
|
||||
sDPRGBColor G_SETFOGCOLOR, \r, \g, \b, \a
|
||||
.endm
|
||||
|
||||
/* F9: G_SETBLENDCOLOR */
|
||||
.set G_SETBLENDCOLOR, 0xF9
|
||||
.macro gsDPSetBlendColor r, g, b, a
|
||||
sDPRGBColor G_SETBLENDCOLOR, \r, \g, \b, \a
|
||||
.endm
|
||||
|
||||
/* FA: G_SETPRIMCOLOR */
|
||||
.set G_SETPRIMCOLOR, 0xFA
|
||||
.macro gsDPSetPrimColor m, l, r, g, b, a
|
||||
.word (G_SETPRIMCOLOR << 24) | ((\m & 0xFF) << 8) | (\l & 0xFF)
|
||||
.byte \r, \g, \b, \a
|
||||
.endm
|
||||
|
||||
/* FB: G_SETENVCOLOR */
|
||||
.set G_SETENVCOLOR, 0xFB
|
||||
.macro gsDPSetEnvColor r, g, b, a
|
||||
sDPRGBColor G_SETENVCOLOR, \r, \g, \b, \a
|
||||
.endm
|
||||
|
||||
/* FC: G_SETCOMBINE */
|
||||
/* color combiner */
|
||||
.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
|
||||
|
||||
.set G_SETCOMBINE, 0xFC
|
||||
.macro gsDPSetCombine muxs0, muxs1
|
||||
.word (G_SETCOMBINE << 24) | (\muxs0 & 0x00FFFFFF)
|
||||
.word \muxs1
|
||||
.endm
|
||||
.macro gsDPSetCombineMode 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
|
||||
|
||||
/* FD: G_SETTIMG */
|
||||
/* 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_SETTIMG, 0xFD
|
||||
.macro gsDPSetTextureImage fmt, size, width, segAddr
|
||||
.word (G_SETTIMG << 24) | ((\fmt & 0x7) << 21) | ((\size & 0x3) << 19) | ((\width-1) & 0x0FFF)
|
||||
.word \segAddr
|
||||
.endm
|
||||
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#ifndef _ULTRA64_INTERRUPT_H_
|
||||
#define _ULTRA64_INTERRUPT_H_
|
||||
|
||||
/* Types */
|
||||
|
||||
typedef u32 OSIntMask;
|
||||
|
||||
|
||||
/* Functions */
|
||||
|
||||
OSIntMask osGetIntMask(void);
|
||||
OSIntMask osSetIntMask(OSIntMask);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef _ULTRA64_LIBC_H_
|
||||
#define _ULTRA64_LIBC_H_
|
||||
|
||||
int sprintf(char *, const char *, ... );
|
||||
void bcopy(const void *src, void *dest, size_t size);
|
||||
void bzero(void *s, size_t size);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
#ifndef _ULTRA64_MESSAGE_H_
|
||||
#define _ULTRA64_MESSAGE_H_
|
||||
|
||||
/* Events */
|
||||
#define OS_EVENT_SW1 0
|
||||
#define OS_EVENT_SW2 1
|
||||
#define OS_EVENT_CART 2
|
||||
#define OS_EVENT_COUNTER 3
|
||||
#define OS_EVENT_SP 4
|
||||
#define OS_EVENT_SI 5
|
||||
#define OS_EVENT_AI 6
|
||||
#define OS_EVENT_VI 7
|
||||
#define OS_EVENT_PI 8
|
||||
#define OS_EVENT_DP 9
|
||||
#define OS_EVENT_CPU_BREAK 10
|
||||
#define OS_EVENT_SP_BREAK 11
|
||||
#define OS_EVENT_FAULT 12
|
||||
#define OS_EVENT_THREADSTATUS 13
|
||||
#define OS_EVENT_PRENMI 14
|
||||
|
||||
#define OS_MESG_NOBLOCK 0
|
||||
#define OS_MESG_BLOCK 1
|
||||
|
||||
/* Types */
|
||||
|
||||
typedef u32 OSEvent;
|
||||
|
||||
typedef void *OSMesg;
|
||||
|
||||
typedef struct OSMesgQueue_s
|
||||
{
|
||||
OSThread *mtqueue;
|
||||
OSThread *fullqueue;
|
||||
s32 validCount;
|
||||
s32 first;
|
||||
s32 msgCount;
|
||||
OSMesg *msg;
|
||||
} OSMesgQueue;
|
||||
|
||||
/* Functions */
|
||||
|
||||
void osCreateMesgQueue(OSMesgQueue *mq, OSMesg *msgBuf, s32 count);
|
||||
s32 osSendMesg(OSMesgQueue *mq, OSMesg msg, s32 flag);
|
||||
s32 osJamMesg(OSMesgQueue *mq, OSMesg msg, s32 flag);
|
||||
s32 osRecvMesg(OSMesgQueue *mq, OSMesg *msg, s32 flag);
|
||||
void osSetEventMesg(OSEvent e, OSMesgQueue *mq, OSMesg msg);
|
||||
void osViSetEvent(OSMesgQueue *mq, OSMesg msg, u32 retraceCount);
|
||||
s32 osContStartReadData(OSMesgQueue *mq);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef _ULTRA64_AI_H_
|
||||
#define _ULTRA64_AI_H_
|
||||
|
||||
u32 osAiGetLength(void);
|
||||
s32 osAiSetNextBuffer(void *, u32);
|
||||
s32 osAiSetFrequency(u32);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
#ifndef _ULTRA64_CONTROLLER_H_
|
||||
#define _ULTRA64_CONTROLLER_H_
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/*0x00*/ u16 type; /* Controller Type */
|
||||
/*0x02*/ u8 status; /* Controller status */
|
||||
/*0x03*/ u8 errno;
|
||||
} OSContStatus;
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ u16 button;
|
||||
/*0x02*/ s8 stick_x; /* -80 <= stick_x <= 80 */
|
||||
/*0x03*/ s8 stick_y; /* -80 <= stick_y <= 80 */
|
||||
/*0x04*/ u8 errno;
|
||||
} OSContPad;
|
||||
|
||||
#define A_BUTTON (1 << 15) // 0x8000
|
||||
#define B_BUTTON (1 << 14) // 0x4000
|
||||
#define Z_TRIG (1 << 13) // 0x2000
|
||||
#define START_BUTTON (1 << 12) // 0x1000
|
||||
#define U_JPAD (1 << 11) // 0x0800
|
||||
#define D_JPAD (1 << 10) // 0x0400
|
||||
#define L_JPAD (1 << 9) // 0x0200
|
||||
#define R_JPAD (1 << 8) // 0x0100
|
||||
#define DUMMY_1 (1 << 7) // 0x0080 (unused)
|
||||
#define DUMMY_2 (1 << 6) // 0x0040 (unused)
|
||||
#define L_TRIG (1 << 5) // 0x0020
|
||||
#define R_TRIG (1 << 4) // 0x0010
|
||||
#define U_CBUTTONS (1 << 3) // 0x0008
|
||||
#define D_CBUTTONS (1 << 2) // 0x0004
|
||||
#define L_CBUTTONS (1 << 1) // 0x0002
|
||||
#define R_CBUTTONS (1 << 0) // 0x0001
|
||||
|
||||
|
||||
s32 osContInit(OSMesgQueue *, u8 *, OSContStatus *);
|
||||
void osContGetReadData(OSContPad *);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#ifndef _ULTRA64_RDP_H_
|
||||
#define _ULTRA64_RDP_H_
|
||||
|
||||
/* DP Command Registers */
|
||||
|
||||
#define DPC_REG_BASE 0xA4100000
|
||||
|
||||
#define DPC_START_REG (*(vu32 *)(DPC_REG_BASE + 0x00))
|
||||
#define DPC_END_REG (*(vu32 *)(DPC_REG_BASE + 0x04))
|
||||
#define DPC_CURRENT_REG (*(vu32 *)(DPC_REG_BASE + 0x08))
|
||||
#define DPC_STATUS_REG (*(vu32 *)(DPC_REG_BASE + 0x0C))
|
||||
#define DPC_CLOCK_REG (*(vu32 *)(DPC_REG_BASE + 0x10))
|
||||
#define DPC_BUFBUSY_REG (*(vu32 *)(DPC_REG_BASE + 0x14))
|
||||
#define DPC_PIPEBUSY_REG (*(vu32 *)(DPC_REG_BASE + 0x18))
|
||||
#define DPC_TMEM_REG (*(vu32 *)(DPC_REG_BASE + 0x1C))
|
||||
|
||||
|
||||
/* DP Span Registers */
|
||||
|
||||
#define DPS_REG_BASE 0xA4200000
|
||||
|
||||
#define DPS_TBIST_REG (*(vu32 *)(DPS_REG_BASE + 0x00))
|
||||
#define DPS_TEST_MODE_REG (*(vu32 *)(DPS_REG_BASE + 0x04))
|
||||
#define DPS_BUFTEST_ADDR_REG (*(vu32 *)(DPS_REG_BASE + 0x08))
|
||||
#define DPS_BUFTEST_DATA_REG (*(vu32 *)(DPS_REG_BASE + 0x0C))
|
||||
|
||||
|
||||
/* Functions */
|
||||
|
||||
u32 osDpGetStatus(void);
|
||||
void osDpSetStatus(u32 status);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#ifndef _ULTRA64_TLB_H_
|
||||
#define _ULTRA64_TLB_H_
|
||||
|
||||
/* Types */
|
||||
|
||||
typedef u32 OSPageMask;
|
||||
/* OSPageMask Valid Values */
|
||||
#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
|
||||
|
||||
/* Functions */
|
||||
|
||||
void osMapTLB(s32 index, OSPageMask pm, void *vaddr, u32 evenpaddr,
|
||||
u32 oddpaddr, s32 asid);
|
||||
void osMapTLBRdb(void);
|
||||
void osUnmapTLB(s32 index);
|
||||
void osUnmapTLBAll(void);
|
||||
void osSetTLBASID(s32 asid);
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue