Replace ultra headers with version J

This commit is contained in:
Ryan Dwyer 2021-10-14 17:52:32 +10:00
parent 735acc6025
commit d3ef0a34ad
299 changed files with 10766 additions and 6225 deletions

View File

@ -44,7 +44,7 @@ ifeq ($(ROMID),jpn-final)
VERSION=5
endif
DEFINES := VERSION=$(VERSION) NTSC=$(NTSC) PAL=$(PAL) JPN=$(JPN) PIRACYCHECKS=$(PIRACYCHECKS)
DEFINES := VERSION=$(VERSION) NTSC=$(NTSC) PAL=$(PAL) JPN=$(JPN) PIRACYCHECKS=$(PIRACYCHECKS) _FINALROM=1
C_DEFINES := $(foreach d,$(DEFINES),-D$(d))
AS_DEFINES := $(foreach d,$(DEFINES),--defsym $(d)) --defsym _LANGUAGE_ASSEMBLY=1
@ -90,12 +90,10 @@ MIPS3_C_FILES := \
G_C_FILES := \
$(shell find src/lib/ultra/audio -name '*.c') \
$(shell find src/lib/naudio -name '*.c') \
src/lib/lib_2fba0.c \
src/lib/lib_30ce0.c \
src/lib/lib_3a100.c \
src/lib/lib_3d280.c \
src/lib/lib_3e730.c \
src/lib/lib_3e8c0.c \
src/lib/mp3.c \
src/lib/speaker.c
@ -178,12 +176,15 @@ CFLAGS = $(C_DEFINES) \
-Xcpluscomm \
-woff 581,649,819,820,821,838,852 \
-w2 \
-I include \
-I include/PR \
-I src/include \
-I src/generated/$(ROMID) \
-I src/lib/ultra/audio \
$(OPT_LVL) \
$(MIPSISET)
ASFLAGS = -march=vr4300 -mabi=32 -Isrc/include $(AS_DEFINES)
ASFLAGS = -march=vr4300 -mabi=32 -Iinclude -Iinclude/PR -Isrc/include -Isrc/lib/ultra/audio $(AS_DEFINES)
C_FILES := $(shell find src/lib src/game src/inflate -name '*.c')
S_FILES := $(shell find src/lib src/game src/preamble -name '*.s')
@ -506,7 +507,7 @@ $(B_DIR)/%.o: src/%.c $(ASSETMGR_O_FILES)
$(B_DIR)/%.o: src/%.s
@mkdir -p $(dir $@)
cpp -P -Wno-trigraphs -I src/include $(C_DEFINES) -D_LANGUAGE_ASSEMBLY -D_MIPSEB $< | $(AS) $(ASFLAGS) -o $@
cpp -P -Wno-trigraphs -I include -I include/PR -I src/include $(C_DEFINES) -D_LANGUAGE_ASSEMBLY -D_MIPSEB $< | $(AS) $(ASFLAGS) -o $@
$(B_DIR)/assets/%.o: $(A_DIR)/%.c
@mkdir -p $(dir $@)

126
include/PR/PRimage.h Normal file
View File

@ -0,0 +1,126 @@
/**************************************************************************
*
* $Revision: 1.4 $
* $Date: 1997/11/26 00:30:50 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/PRimage.h,v $
*
**************************************************************************/
#ifndef __GL_IMAGE_H__
#define __GL_IMAGE_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
* Defines for image files . . . .
*
* Paul Haeberli - 1984
* Look in /usr/people/4Dgifts/iristools/imgtools for example code!
*
*/
#include <stdio.h>
#define IMAGIC 0732
/* colormap of images */
#define CM_NORMAL 0 /* file contains rows of values which
* are either RGB values (zsize == 3)
* or greyramp values (zsize == 1) */
#define CM_DITHERED 1
#define CM_SCREEN 2 /* file contains data which is a screen
* image; getrow returns buffer which
* can be displayed directly with
* writepixels */
#define CM_COLORMAP 3 /* a colormap file */
#define TYPEMASK 0xff00
#define BPPMASK 0x00ff
#define ITYPE_VERBATIM 0x0000
#define ITYPE_RLE 0x0100
#define ISRLE(type) (((type) & 0xff00) == ITYPE_RLE)
#define ISVERBATIM(type) (((type) & 0xff00) == ITYPE_VERBATIM)
#define BPP(type) ((type) & BPPMASK)
#define RLE(bpp) (ITYPE_RLE | (bpp))
#define VERBATIM(bpp) (ITYPE_VERBATIM | (bpp))
#define IBUFSIZE(pixels) (((pixels)+((pixels)>>6))<<2)
#define RLE_NOP 0x00
#define ierror(p) (((p)->flags&_IOERR)!=0)
#define ifileno(p) ((p)->file)
#define getpix(p) (--(p)->cnt>=0 ? *(p)->ptr++ : ifilbuf(p))
#define putpix(p,x) (--(p)->cnt>=0 \
? ((int)(*(p)->ptr++=(unsigned)(x))) \
: iflsbuf(p,(unsigned)(x)))
typedef struct {
unsigned short imagic; /* stuff saved on disk . . */
unsigned short type;
unsigned short dim;
unsigned short xsize;
unsigned short ysize;
unsigned short zsize;
unsigned long min;
unsigned long max;
unsigned long wastebytes;
char name[80];
unsigned long colormap;
long file; /* stuff used in core only */
unsigned short flags;
short dorev;
short x;
short y;
short z;
short cnt;
unsigned short *ptr;
unsigned short *base;
unsigned short *tmpbuf;
unsigned long offset;
unsigned long rleend; /* for rle images */
unsigned long *rowstart; /* for rle images */
long *rowsize; /* for rle images */
} IMAGE;
IMAGE *icreate();
/*
* IMAGE *iopen(char *file, char *mode, unsigned int type, unsigned int dim,
* unsigned int xsize, unsigned int ysize, unsigned int zsize);
* IMAGE *fiopen(int f, char *mode, unsigned int type, unsigned int dim,
* unsigned int xsize, unsigned int ysize, unsigned int zsize);
*
* ...while iopen and fiopen can take an extended set of parameters, the
* last five are optional, so a more correct prototype would be:
*
*/
IMAGE *iopen(char *file, char *mode, ...);
IMAGE *fiopen(int f, char *mode, ...);
/*
*
* unsigned short *ibufalloc(IMAGE *image);
* int ifilbuf(IMAGE *image);
* int iflush(IMAGE *image);
* unsigned int iflsbuf(IMAGE *image, unsigned int c);
* void isetname(IMAGE *image, char *name);
* void isetcolormap(IMAGE *image, int colormap);
*/
int iclose(IMAGE *image);
int putrow(IMAGE *image, unsigned short *buffer, unsigned int y, unsigned int z);
int getrow(IMAGE *image, unsigned short *buffer, unsigned int y, unsigned int z);
/*
IMAGE *iopen();
IMAGE *icreate();
*/
unsigned short *ibufalloc();
#define IMAGEDEF /* for backwards compatibility */
#ifdef __cplusplus
}
#endif
#endif /* !__GL_IMAGE_H__ */

2
src/include/PR/R4300.h → include/PR/R4300.h Executable file → Normal file
View File

@ -14,7 +14,7 @@
*
* $Revision: 1.13 $
* $Date: 1997/02/11 08:15:34 $
* $Source: /disk6/Master/cvsmdev2/PR/include/R4300.h,v $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/R4300.h,v $
*
**************************************************************************/

View File

@ -17,7 +17,7 @@
*
* $Revision: 1.32 $
* $Date: 1997/02/11 08:16:37 $
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/abi.h,v $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/abi.h,v $
*
**************************************************************************/
@ -240,7 +240,9 @@ typedef union {
/*
* ADPCM State
*/
typedef short ADPCM_STATE[16];
#define ADPCMVSIZE 8
#define ADPCMFSIZE 16
typedef short ADPCM_STATE[ADPCMFSIZE];
/*
* Pole filter state
@ -400,26 +402,6 @@ typedef short ENVMIX_STATE[40];
_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

View File

@ -1,392 +1,393 @@
/*---------------------------------------------------------------------
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 ========*/
/*---------------------------------------------------------------------
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 座標 (u10.5) */
u16 imageW; /* テクスチャの幅 (u10.2) */
s16 frameX; /* 転送されるフレームの左上位置(s10.2) */
u16 frameW; /* 転送されるフレームの幅 (u10.2) */
u16 imageY; /* テクスチャの左上位置 Y 座標 (u10.5) */
u16 imageH; /* テクスチャの高さ (u10.2) */
s16 frameY; /* 転送されるフレームの左上位置(s10.2) */
u16 frameH; /* 転送されるフレームの高さ (u10.2) */
u64 *imagePtr; /* DRAM 上のテクスチャソースアドレス */
u16 imageLoad; /* LoadBlock, LoadTile のどちらを使用するか */
u8 imageFmt; /* テクセルのフォーマット G_IM_FMT_* */
u8 imageSiz; /* テクセルのサイズ G_IM_SIZ_* */
u16 imagePal; /* パレット番号 */
u16 imageFlip; /* イメージの左右反転 G_BG_FLAG_FLIPS で反転 */
/* 以下は初期化ルーチン guS2DInitBg() 内で設定されるのでユーザが設
*/
u16 tmemW; /* frame 1 ラインの TMEM 幅 Word サイズ
LoadBlock GS_PIX2TMEM(imageW/4,imageSiz)
LoadTile GS_PIX2TMEM(frameW/4,imageSiz)+1 */
u16 tmemH; /* 一度にロードできる TMEM 高さ (s13.2) 4倍値
512/tmemW*4
CI 256/tmemW*4 */
u16 tmemLoadSH; /* SH 値
LoadBlock tmemSize/2-1
LoadTile tmemW*16-1 */
u16 tmemLoadTH; /* TH 値 or Stride 値
LoadBlock GS_CALC_DXT(tmemW)
LoadTile tmemH-1 */
u16 tmemSizeW; /* image 1 ライン分の imagePtr のスキップ値
LoadBlock tmemW*2
LoadTile GS_PIX2TMEM(imageW/4,imageSiz)*2 */
u16 tmemSize; /* ロード一回分の imagePtr のスキップ値
= tmemSizeW*tmemH */
} uObjBg_t; /* 40 bytes */
/* Scalable background plane */
typedef struct {
u16 imageX; /* テクスチャの左上位置 X 座標 (u10.5) */
u16 imageW; /* テクスチャの幅 (u10.2) */
s16 frameX; /* 転送されるフレームの左上位置(s10.2) */
u16 frameW; /* 転送されるフレームの幅 (u10.2) */
u16 imageY; /* テクスチャの左上位置 Y 座標 (u10.5) */
u16 imageH; /* テクスチャの高さ (u10.2) */
s16 frameY; /* 転送されるフレームの左上位置(s10.2) */
u16 frameH; /* 転送されるフレームの高さ (u10.2) */
u64 *imagePtr; /* DRAM 上のテクスチャソースアドレス */
u16 imageLoad; /* LoadBlock, LoadTile のどちらを使用するか */
u8 imageFmt; /* テクセルのフォーマット G_IM_FMT_* */
u8 imageSiz; /* テクセルのサイズ G_IM_SIZ_* */
u16 imagePal; /* パレット番号 */
u16 imageFlip; /* イメージの左右反転 G_BG_FLAG_FLIPS で反転 */
u16 scaleW; /* X 方向スケール値 (u5.10) */
u16 scaleH; /* Y 方向スケール値 (u5.10) */
s32 imageYorig; /* 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 /* S 方向反転 */
#define G_OBJ_FLAG_FLIPT 1<<4 /* T 方向反転 */
typedef struct {
s16 objX; /* s10.2 OBJ 左上端 X 座標 */
u16 scaleW; /* u5.10 幅方向スケーリング */
u16 imageW; /* u10.5 テクスチャの幅 (S 方向の長さ) */
u16 paddingX; /* 未使用 常に 0 */
s16 objY; /* s10.2 OBJ 左上端 Y 座標 */
u16 scaleH; /* u5.10 高さ方向スケーリング */
u16 imageH; /* u10.5 テクスチャの高さ (T 方向の長さ) */
u16 paddingY; /* 未使用 常に 0 */
u16 imageStride; /* テクセルの折り返し幅 (64bit word 単位) */
u16 imageAdrs; /* TMEM 内のテクスチャ先頭位置 (64bit word 単位) */
u8 imageFmt; /* テクセルのフォーマット G_IM_FMT_* */
u8 imageSiz; /* テクセルのサイズ G_IM_SIZ_* */
u8 imagePal; /* パレット番号 0-7 */
u8 imageFlags; /* 表示フラグ 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; /* Type 種別 G_OBJLT_TXTRBLOCK */
u64 *image; /* DRAM 上のテクスチャソースアドレス */
u16 tmem; /* ロード先の TMEM ワードアドレス (8byteWORD) */
u16 tsize; /* Texture サイズ マクロ GS_TB_TSIZE() で指定 */
u16 tline; /* Texture 1 ライン幅 マクロ GS_TB_TLINE() で指定 */
u16 sid; /* STATE ID 4 の倍数で 0,4,8,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; /* Type 種別 G_OBJLT_TXTRTILE */
u64 *image; /* DRAM 上のテクスチャソースアドレス */
u16 tmem; /* ロード先の TMEM ワードアドレス (8byteWORD) */
u16 twidth; /* Texture 幅 マクロ GS_TT_TWIDTH() で指定 */
u16 theight; /* Texture 高さ マクロ GS_TT_THEIGHT() で指定 */
u16 sid; /* STATE ID 4 の倍数で 0,4,8,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; /* Type 種別 G_OBJLT_TLUT */
u64 *image; /* DRAM 上のテクスチャソースアドレス */
u16 phead; /* ロード先頭のパレット番号 256 以上 511 以下 */
u16 pnum; /* ロードするパレット数 - 1 */
u16 zero; /* 常に 0 を代入する */
u16 sid; /* STATE ID 4 の倍数で 0,4,8,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 /* 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 ========*/

365
include/PR/gt.h Normal file
View File

@ -0,0 +1,365 @@
/*
* Copyright 1995, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
*
* UNPUBLISHED -- Rights reserved under the copyright laws of the United
* States. Use of a copyright notice is precautionary only and does not
* imply publication or disclosure.
*
* U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in FAR 52.227.19(c)(2) or subparagraph (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, or the DOD or NASA FAR
* Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
* 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
*
* THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
* INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
* DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
* PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
* GRAPHICS, INC.
*
*/
/*
* File: gt.h
* Creator: hsa@sgi.com
* Create Date: Thu Oct 12 15:48:14 PDT 1995
*
* This file defines the GBI for the TURBO 3D graphics microcode.
* The turbo microcode is a special FEATURE-LIMITED microcode designed
* for specific applications. It is not for general use.
*
* (see XXX for more information)
*
*/
/**************************************************************************
*
* $Revision: 1.16 $
* $Date: 1998/05/28 00:14:50 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/gt.h,v $
*
**************************************************************************/
#ifndef _GT_H_
#define _GT_H_
/* this file should be #included AFTER gbi.h */
#include "sptask.h"
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif /* _LANGUAGE_C_PLUS_PLUS */
#include <PR/ultratypes.h>
/* the following #defines seem out of order, but we need them
* for the microcode.
*/
/*
* object state field: rendState
*
* This flag word is built up out of the bits from a
* subset of the G_SETGEOMETRYMODE flags from gbi.h.
*
* When each of these bits is '1', the comments below explain
* the effect on the triangles.
*/
#define GT_ZBUFFER G_ZBUFFER
#define GT_TEXTURE G_TEXTURE_ENABLE /* texture ON */
#define GT_CULL_BACK G_CULL_BACK /* reject backfaces */
#define GT_SHADING_SMOOTH G_SHADING_SMOOTH /* smooth shade ON */
/*
* object state field: textureState
*
* The lower 3 bits of this flag word contain the texture tile number
* to be used. All triangles of an object are rendered with the same
* texture tile.
*/
/*
* object state field: flag
*
* This is a group of what would be pad bits. We use them for some
* flag bits.
*/
#define GT_FLAG_NOMTX 0x01 /* don't load the matrix */
#define GT_FLAG_NO_XFM 0x02 /* load vtx, use verbatim */
#define GT_FLAG_XFM_ONLY 0x04 /* xform vtx, write to *TriN */
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* turbo 3D ucode: */
extern long long int gspTurbo3DTextStart[], gspTurbo3DTextEnd[];
extern long long int gspTurbo3DDataStart[], gspTurbo3DDataEnd[];
extern long long int gspTurbo3D_dramTextStart[], gspTurbo3D_dramTextEnd[];
extern long long int gspTurbo3D_dramDataStart[], gspTurbo3D_dramDataEnd[];
extern long long int gspTurbo3D_fifoTextStart[], gspTurbo3D_fifoTextEnd[];
extern long long int gspTurbo3D_fifoDataStart[], gspTurbo3D_fifoDataEnd[];
/*
* This is the global state structure. It's definition carefully
* matches the ucode, so if this structure changes, you must also change
* the ucode.
*/
typedef struct {
u16 perspNorm; /* persp normalization */
u16 pad0;
u32 flag;
Gfx rdpOthermode;
u32 segBases[16]; /* table of segment base addrs (SEE NOTE!) */
Vp viewport; /* the viewport to use */
Gfx *rdpCmds; /* block of RDP data, process if !NULL
* block terminated by gDPEndDisplayList()
* (This is a segment address)
*/
} gtGlobState_t;
/* NOTE:
* Although there are 16 segment table entries, the first one (segment 0)
* is reserved for physical memory mapping. You should not segment 0
* to anything other than 0x0.
*/
typedef union {
gtGlobState_t sp;
long long int force_structure_alignment;
} gtGlobState;
/*
* This is the 'state' structure associated with each object
* to be rendered. It's definition carefully matches the
* ucode, so if this structure changes, you must also change
* the gtoff.c tool and the ucode.
*/
typedef struct {
u32 renderState; /* render state */
u32 textureState; /* texture state */
u8 vtxCount; /* how many verts? */
u8 vtxV0; /* where to load verts? */
u8 triCount; /* how many tris? */
u8 flag;
Gfx *rdpCmds; /* ptr (segment address) to RDP DL */
Gfx rdpOthermode;
Mtx transform; /* the transform matrix to use */
} gtState_t;
typedef union {
gtState_t sp;
long long int force_structure_alignment;
} gtState;
/* gtStateLite : same as gtState, but no matrix (see flags below) */
/* this structure must be identical to gtState! (bad) */
typedef struct {
u32 renderState; /* render state */
u32 textureState; /* texture state */
u8 vtxCount; /* how many verts? */
u8 vtxV0; /* where to load verts? */
u8 triCount; /* how many tris? */
u8 flag;
Gfx *rdpCmds; /* ptr (segment address) to RDP DL */
Gfx rdpOthermode;
} gtStateL_t;
typedef union {
gtStateL_t sp;
long long int force_structure_alignment;
} gtStateL;
/*
* The vertex list for the turbo display list uses the
* Vtx struct in gbi.h
*
*/
/*
* This structure represents a single triangle, part of the
* triangle list of the object to be rendered.
*
* NOTE: The triangle list MUST be aligned to an 8-byte boundary.
* Since this structure is only 4 bytes, we are REQUIRING that
* this structure only be used as an array of triangles, and we
* depend on the MIPS C compiler (which always aligns arrays to
* 8-byte boundaries). THIS IS DANGEROUS!!!!
*
*/
typedef struct {
u8 v0, v1, v2, flag; /* flag is which one for flat shade */
} gtTriN;
/*
* This structure represents the transformed points. It is the format
* of the points written out when GT_FLAG_XFM_ONLY is set, as well as
* the format expected when GT_FLAG_NO_XFM is used.
*
* NOTE: The size and layout of these points is very similar to Vtx,
* except the screen coordinates overwrite the x,y,z,pad fields.
* (we could consider adding to the Vtx union, but we want to keep
* turbo stuff out of gbi.h)
*
* NOTE: The z is a special format. It can be used to compare vertices
* for sorting, but it should not be used for other purposes. If modified,
* the z-buffer hardware might not understand the data.
*
*/
typedef struct {
short int xscrn; /* x,y screen coordinates are SSSS10.2 */
short int yscrn;
int zscrn; /* z screen is S15.16 */
short int s; /* transformed texture coord, S10.5 */
short int t;
u8 r; /* color (or normal) */
u8 g;
u8 b;
u8 a;
} gtVtxOut_t;
/* see "Data Structure" comment in gbi.h for information about why
* we use this union.
*/
typedef union {
gtVtxOut_t v;
long long int force_structure_alignment;
} gtVtxOut;
/*
* state field: rdpOthermode
*
* This is one of the trickier state fields. The turbo interface
* requires the RDP othermode command to be cached by the host,
* therefore we provide a different interface in libultra to help cache
* this in the gt state (this word is just bits, you could pack them
* on your own).
*
* gtStateSetOthermode() accomplishs this, taking as arguments
* the state, one of the following mode enums, and a piece of data
* (othermode parameters from gbi.h).
*
* By definition, the othermode word from the gt state structure is sent
* to the RDP *before* any RDP commands from the rdpCmds[] field. The
* othermode is *always* sent.
*
* Stated another way, NONE of the gbi RDP othermode commands equivalent
* to those listed here are allowed in the rdpCmd[] field of the
* gt state structure.
*
* Notice also that many of these commands do not make sense for
* the turbo ucode (they control features not supported, like mip-mapping).
* They are only included here for completeness.
*
*/
typedef enum {
GT_CLEAR, /* special gt mode, clears othermode state */
GT_ALPHACOMPARE,
GT_ZSRCSEL,
GT_RENDERMODE,
GT_ALPHADITHER,
GT_RGBDITHER,
GT_COMBKEY,
GT_TEXTCONV,
GT_TEXTFILT,
GT_TEXTLUT,
GT_TEXTLOD,
GT_TEXTDETAIL,
GT_TEXTPERSP,
GT_CYCLETYPE,
GT_PIPELINE
} gtStateOthermode_t;
/*
* This call builds up an othermode command word. The 'mode' is one of
* the above modes, the 'data' field comes from gbi.h, it is the data
* field for the equivalent gbi setothermode macro.
*/
extern void gtStateSetOthermode(Gfx *om, gtStateOthermode_t mode, int data);
/*
* This call dumps a turbo display list for use with gbi2mem and RSPSIM
*/
#define GT_DUMPTURBO_HANGAFTER 64
#define GT_DUMPTURBO_NOTEXTURES 128
extern void gtDumpTurbo(OSTask *tp,u8 flags);
/*
* Special macros to init othermode words to all 0's, a good default
* value.
*/
#define gDPClearOtherMode(pkt) \
{ \
Gfx *_g = (Gfx *)(pkt); \
\
_g->words.w0 = _SHIFTL(G_RDPSETOTHERMODE, 24, 8); \
_g->words.w1 = 0x0; \
}
#define gsDPClearOtherMode() \
{ \
_SHIFTL(G_RDPSETOTHERMODE, 24, 8), 0x0 \
}
/*
* Special macros to end DP blocks (see above). These commands
* generate all 0's, which the turbo ucode looks for. They *aren't*
* real DP commands!
*/
#define gDPEndDisplayList(pkt) gSPNoOp(pkt)
#define gsDPEndDisplayList() gsSPNoOp()
/*
* This structure is a turbo 'object', the turbo display list is
* simply a list of these.
*
* NOTE: All pointers are segment addresses
*
* NOTE: If (statep->flag & GT_FLAG_XFM_ONLY), the trip field is
* interpreted as a pointer to gtVtxOut[] that can be used to store
* the transformed points. (statep->triCount should be 0, else bad
* things could happen...)
*
* NOTE: If (statep->flag & GT_FLAG_NO_XFM), the vtxp field is
* interpreted as a pointer to gtVtxOut[] that can be used to load
* pre-transformed points.
*
*/
typedef struct {
gtGlobState *gstatep; /* global state, usually NULL */
gtState *statep; /* if this is NULL, end object processing */
Vtx *vtxp; /* if this is NULL, use points in buffer */
gtTriN *trip; /* if this is NULL, use tris in buffer */
} gtGfx_t;
typedef union {
gtGfx_t obj;
long long int force_structure_alignment;
} gtGfx;
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_ASSEMBLY
#include <PR/gtoff.h>
#endif /* _LANGUAGE_ASSEMBLY */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif /* _LANGUAGE_C_PLUS_PLUS */
#ifdef _LANGUAGE_MAKEROM
#endif /* _LANGUAGE_MAKEROM */
#endif /* _GT_H_ */

266
include/PR/gu.h Normal file
View File

@ -0,0 +1,266 @@
#ifndef _GU_H_
#define _GU_H_
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/**************************************************************************
*
* $Revision: 1.46 $
* $Date: 1997/11/26 00:30:53 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/gu.h,v $
*
**************************************************************************/
#include <PR/mbi.h>
#include <PR/ultratypes.h>
#include <PR/sptask.h>
#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
#endif
#define M_PI 3.14159265358979323846
#define M_DTOR (3.14159265358979323846/180.0)
#define FTOFIX32(x) (long)((x) * (float)0x00010000)
#define FIX32TOF(x) ((float)(x) * (1.0f / (float)0x00010000))
#define FTOFRAC8(x) ((int) MIN(((x) * (128.0f)), 127.0f) & 0xff)
#define FILTER_WRAP 0
#define FILTER_CLAMP 1
#define RAND(x) (guRandom()%x) /* random number between 0 to x */
/*
* Data Structures
*/
typedef struct {
unsigned char *base;
int fmt, siz;
int xsize, ysize;
int lsize;
/* current tile info */
int addr;
int w, h;
int s, t;
} Image;
typedef struct {
float col[3];
float pos[3];
float a1, a2; /* actual color = col/(a1*dist + a2) */
} PositionalLight;
/*
* Function Prototypes
*/
extern int guLoadTextureBlockMipMap(Gfx **glist, unsigned char *tbuf, Image *im,
unsigned char startTile, unsigned char pal, unsigned char cms,
unsigned char cmt, unsigned char masks, unsigned char maskt,
unsigned char shifts, unsigned char shiftt, unsigned char cfs,
unsigned char cft);
extern int guGetDPLoadTextureTileSz (int ult, int lrt);
extern void guDPLoadTextureTile (Gfx *glistp, void *timg,
int texl_fmt, int texl_size,
int img_width, int img_height,
int uls, int ult, int lrs, int lrt,
int palette,
int cms, int cmt,
int masks, int maskt,
int shifts, int shiftt);
/*
* matrix operations:
*
* The 'F' version is floating point, in case the application wants
* to do matrix manipulations and convert to fixed-point at the last
* minute.
*/
extern void guMtxIdent(Mtx *m);
extern void guMtxIdentF(float mf[4][4]);
extern void guOrtho(Mtx *m, float l, float r, float b, float t,
float n, float f, float scale);
extern void guOrthoF(float mf[4][4], float l, float r, float b, float t,
float n, float f, float scale);
extern void guFrustum(Mtx *m, float l, float r, float b, float t,
float n, float f, float scale);
extern void guFrustumF(float mf[4][4], float l, float r, float b, float t,
float n, float f, float scale);
extern void guPerspective(Mtx *m, u16 *perspNorm, float fovy,
float aspect, float near, float far, float scale);
extern void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy,
float aspect, float near, float far, float scale);
extern void guLookAt(Mtx *m,
float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp);
extern void guLookAtF(float mf[4][4], float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp);
extern void guLookAtReflect(Mtx *m, LookAt *l,
float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp);
extern void guLookAtReflectF(float mf[4][4], LookAt *l,
float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp);
extern void guLookAtHilite(Mtx *m, LookAt *l, Hilite *h,
float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp,
float xl1, float yl1, float zl1,
float xl2, float yl2, float zl2,
int twidth, int theight);
extern void guLookAtHiliteF(float mf[4][4], LookAt *l, Hilite *h,
float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp,
float xl1, float yl1, float zl1,
float xl2, float yl2, float zl2,
int twidth, int theight);
extern void guLookAtStereo(Mtx *m,
float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp,
float eyedist);
extern void guLookAtStereoF(float mf[4][4],
float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp,
float eyedist);
extern void guRotate(Mtx *m, float a, float x, float y, float z);
extern void guRotateF(float mf[4][4], float a, float x, float y, float z);
extern void guRotateRPY(Mtx *m, float r, float p, float y);
extern void guRotateRPYF(float mf[4][4], float r, float p, float h);
extern void guAlign(Mtx *m, float a, float x, float y, float z);
extern void guAlignF(float mf[4][4], float a, float x, float y, float z);
extern void guScale(Mtx *m, float x, float y, float z);
extern void guScaleF(float mf[4][4], float x, float y, float z);
extern void guTranslate(Mtx *m, float x, float y, float z);
extern void guTranslateF(float mf[4][4], float x, float y, float z);
extern void guPosition(Mtx *m, float r, float p, float h, float s,
float x, float y, float z);
extern void guPositionF(float mf[4][4], float r, float p, float h, float s,
float x, float y, float z);
extern void guMtxF2L(float mf[4][4], Mtx *m);
extern void guMtxL2F(float mf[4][4], Mtx *m);
extern void guMtxCatF(float m[4][4], float n[4][4], float r[4][4]);
extern void guMtxCatL(Mtx *m, Mtx *n, Mtx *res);
extern void guMtxXFMF(float mf[4][4], float x, float y, float z,
float *ox, float *oy, float *oz);
extern void guMtxXFML(Mtx *m, float x, float y, float z,
float *ox, float *oy, float *oz);
/* vector utility: */
extern void guNormalize(float *x, float *y, float *z);
/* light utilities: */
void guPosLight(PositionalLight *pl, Light *l,
float xOb, float yOb, float zOb);
void guPosLightHilite(PositionalLight *pl1, PositionalLight *pl2,
Light *l1, Light *l2,
LookAt *l, Hilite *h,
float xEye, float yEye, float zEye,
float xOb, float yOb, float zOb,
float xUp, float yUp, float zUp,
int twidth, int theight);
extern int guRandom(void);
/*
* Math functions
*/
extern float sinf(float angle);
extern float cosf(float angle);
extern signed short sins (unsigned short angle);
extern signed short coss (unsigned short angle);
extern float sqrtf(float value);
/*
* Dump routines for low-level display lists
*/
/* flag values for guParseRdpDL() */
#define GU_PARSERDP_VERBOSE 1
#define GU_PARSERDP_PRAREA 2
#define GU_PARSERDP_PRHISTO 4
#define GU_PARSERDP_DUMPONLY 32 /* doesn't need to be same as */
/* GU_PARSEGBI_DUMPOLNY, but this */
/* allows app to use interchangeably */
extern void guParseRdpDL(u64 *rdp_dl, u64 nbytes, u8 flags);
extern void guParseString(char *StringPointer, u64 nbytes);
/*
* NO LONGER SUPPORTED,
* use guParseRdpDL with GU_PARSERDP_DUMPONLY flags
*/
/* extern void guDumpRawRdpDL(u64 *rdp_dl, u64 nbytes); */
/* flag values for guBlinkRdpDL() */
#define GU_BLINKRDP_HILITE 1
#define GU_BLINKRDP_EXTRACT 2
extern void
guBlinkRdpDL(u64 *rdp_dl_in, u64 nbytes_in,
u64 *rdp_dl_out, u64 *nbytes_out,
u32 x, u32 y, u32 radius,
u8 red, u8 green, u8 blue,
u8 flags);
/* flag values for guParseGbiDL() */
#define GU_PARSEGBI_ROWMAJOR 1
#define GU_PARSEGBI_NONEST 2
#define GU_PARSEGBI_FLTMTX 4
#define GU_PARSEGBI_SHOWDMA 8
#define GU_PARSEGBI_ALLMTX 16
#define GU_PARSEGBI_DUMPONLY 32
/*
#define GU_PARSEGBI_HANGAFTER 64
#define GU_PARSEGBI_NOTEXTURES 128
*/
extern void guParseGbiDL(u64 *gbi_dl, u32 nbytes, u8 flags);
extern void guDumpGbiDL(OSTask *tp,u8 flags);
#define GU_PARSE_GBI_TYPE 1
#define GU_PARSE_RDP_TYPE 2
#define GU_PARSE_READY 3
#define GU_PARSE_MEM_BLOCK 4
#define GU_PARSE_ABI_TYPE 5
#define GU_PARSE_STRING_TYPE 6
typedef struct {
int dataSize;
int dlType;
int flags;
u32 paddr;
} guDLPrintCB;
void guSprite2DInit(uSprite *SpritePointer,
void *SourceImagePointer,
void *TlutPointer,
int Stride,
int SubImageWidth,
int SubImageHeight,
int SourceImageType,
int SourceImageBitSize,
int SourceImageOffsetS,
int SourceImageOffsetT);
#endif /* !_GU_H_ */

280
include/PR/leo.h Normal file
View File

@ -0,0 +1,280 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo.
$RCSfile: leo.h,v $
$Revision: 1.29 $
$Date: 1998/12/21 07:30:15 $
*---------------------------------------------------------------------*/
#ifndef _LEO_H_
#define _LEO_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#include <PR/leoappli.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
typedef u32 LEOError;
typedef u8 LEOSpdlMode;
typedef u8 LEOStatus;
typedef struct
{
u8 drive; /* version of hw */
u8 driver; /* version of sw */
u8 deviceType; /* dev type, always 00 */
u8 ndevices; /* # of devices, always 01 */
} LEOVersion;
typedef struct
{
u32 startLBA;
u32 endLBA;
u32 nbytes;
} LEOCapacity;
typedef struct
{
u8 pad;
u8 yearhi;
u8 yearlo;
u8 month;
u8 day;
u8 hour;
u8 minute;
u8 second;
} LEODiskTime;
typedef struct
{
u64 lineNumber;
LEODiskTime time;
} LEOSerialNum;
typedef struct
{
u8 gameName[4];
u8 gameVersion;
u8 diskNumber;
u8 ramUsage;
u8 diskUsage;
LEOSerialNum serialNumber;
u8 company[2];
u8 freeArea[6];
} LEODiskID;
typedef struct
{
LEOCmdHeader header;
union
{
struct
{
u32 lba;
u32 xfer_blks;
void *buff_ptr;
u32 rw_bytes;
#ifdef _LONGCMD
u32 size;
#endif
} readwrite;
struct
{
u32 lba;
} seek;
struct
{
void *buffer_pointer;
} readdiskid;
LEODiskTime time;
struct
{
u8 reserve1;
u8 reserve2;
u8 standby_time;
u8 sleep_time;
u32 reserve3;
} modeselect;
} data;
} LEOCmd;
#define _nbytes readwrite.rw_bytes
#define _result header.status
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
#define LEO_SW_VERSION 6 /* This will be returned by */
/* LeoInquiry command */
#define OS_PRIORITY_LEOMGR OS_PRIORITY_PIMGR
/*
* Drive Rom offset address
*/
#define DDROM_FONT_START 0x000a0000
#define DDROM_WAVEDATA_START 0x00140000
/*
* Definition for osLeoSpdlMotor()
*/
#define ACTIVE 0
#define STANDBY 1
#define SLEEP 2
#define BRAKE 4
#define LEO_MOTOR_ACTIVE 0
#define LEO_MOTOR_STANDBY 1
#define LEO_MOTOR_SLEEP 2
#define LEO_MOTOR_BRAKE 4
#define NUM_LBAS 4292 /* total number of LBAs */
#define BLK_SIZE_ZONE0 19720
#define BLK_SIZE_ZONE1 18360
#define BLK_SIZE_ZONE2 17680
#define BLK_SIZE_ZONE3 16320
#define BLK_SIZE_ZONE4 14960
#define BLK_SIZE_ZONE5 13600
#define BLK_SIZE_ZONE6 12240
#define BLK_SIZE_ZONE7 10880
#define BLK_SIZE_ZONE8 9520
#define MAX_BLK_SIZE BLK_SIZE_ZONE0
#define MIN_BLK_SIZE BLK_SIZE_ZONE8
/*
* Error codes
*/
#define LEO_ERROR_GOOD 0
#define LEO_ERROR_DRIVE_NOT_READY 1
#define LEO_ERROR_DIAGNOSTIC_FAILURE 2
#define LEO_ERROR_COMMAND_PHASE_ERROR 3
#define LEO_ERROR_DATA_PHASE_ERROR 4
#define LEO_ERROR_REAL_TIME_CLOCK_FAILURE 5
#define LEO_ERROR_BUSY 8
#define LEO_ERROR_INCOMPATIBLE_MEDIUM_INSTALLED 11
#define LEO_ERROR_UNKNOWN_FORMAT 11
#define LEO_ERROR_NO_SEEK_COMPLETE 21
#define LEO_ERROR_WRITE_FAULT 22
#define LEO_ERROR_UNRECOVERED_READ_ERROR 23
#define LEO_ERROR_NO_REFERENCE_POSITION_FOUND 24
#define LEO_ERROR_TRACK_FOLLOWING_ERROR 25
#define LEO_ERROR_TRACKING_OR_SPDL_SERVO_FAILURE 25
#define LEO_ERROR_INVALID_COMMAND_OPERATION_CODE 31
#define LEO_ERROR_LBA_OUT_OF_RANGE 32
#define LEO_ERROR_WRITE_PROTECT_ERROR 33
#define LEO_ERROR_COMMAND_CLEARED_BY_HOST 34
#define LEO_ERROR_COMMAND_TERMINATED 34
#define LEO_ERROR_QUEUE_FULL 35
#define LEO_ERROR_ILLEGAL_TIMER_VALUE 36
#define LEO_ERROR_WAITING_NMI 37
#define LEO_ERROR_DEVICE_COMMUNICATION_FAILURE 41
#define LEO_ERROR_MEDIUM_NOT_PRESENT 42
#define LEO_ERROR_POWERONRESET_DEVICERESET_OCCURED 43
#define LEO_ERROR_RAMPACK_NOT_CONNECTED 44
#define LEO_ERROR_MEDIUM_MAY_HAVE_CHANGED 47
#define LEO_ERROR_EJECTED_ILLEGALLY_RESUME 49
/*
* Reserved
*/
#define LEO_ERROR_NOT_BOOTED_DISK 45
#define LEO_ERROR_DIDNOT_CHANGED_DISK_AS_EXPECTED 46
/*
* Error codes only used in IPL
*/
#define LEO_ERROR_RTC_NOT_SET_CORRECTLY 48
#define LEO_ERROR_DIAGNOSTIC_FAILURE_RESET 50
#define LEO_ERROR_EJECTED_ILLEGALLY_RESET 51
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
#define GET_ERROR(x) ((x).header.sense)
/**************************************************************************
*
* Extern variables
*
*/
extern LEODiskID leoBootID;
extern OSPiHandle *__osDiskHandle; /* For exceptasm to get disk info*/
/**************************************************************************
*
* Function prototypes
*
*/
/* Initialize routine */
extern s32 LeoCreateLeoManager(OSPri comPri, OSPri intPri,
OSMesg *cmdBuf, s32 cmdMsgCnt);
extern s32 LeoCJCreateLeoManager(OSPri comPri, OSPri intPri,
OSMesg *cmdBuf, s32 cmdMsgCnt);
extern s32 LeoCACreateLeoManager(OSPri comPri, OSPri intPri,
OSMesg *cmdBuf, s32 cmdMsgCnt);
extern u32 LeoDriveExist(void);
/* Synchronous functions */
extern s32 LeoClearQueue(void);
extern s32 LeoByteToLBA(s32 startLBA, u32 nbytes, s32 *lbas);
extern s32 LeoLBAToByte(s32 startLBA, u32 nLBAs, s32 *bytes);
extern s32 LeoReadCapacity(LEOCapacity *cap, s32 dir);
extern s32 LeoInquiry(LEOVersion *ver);
extern s32 LeoTestUnitReady(LEOStatus *status);
/* Asynchronous functions */
extern s32 LeoSpdlMotor(LEOCmd *cmdBlock, LEOSpdlMode mode, OSMesgQueue *mq);
extern s32 LeoSeek(LEOCmd *cmdBlock, u32 lba, OSMesgQueue *mq);
extern s32 LeoRezero(LEOCmd *cmdBlock, OSMesgQueue *mq);
extern s32 LeoReadWrite(LEOCmd *cmdBlock, s32 direction,
u32 LBA, void *vAddr, u32 nLBAs, OSMesgQueue *mq);
extern s32 LeoReadDiskID(LEOCmd *cmdBlock, LEODiskID *vaddr, OSMesgQueue *mq);
extern s32 LeoSetRTC(LEOCmd *cmdBlock, LEODiskTime *RTCdata, OSMesgQueue *mq);
extern s32 LeoReadRTC(LEOCmd *cmdBlock, OSMesgQueue *mq);
extern s32 LeoModeSelectAsync(LEOCmd *cmdBlock, u32 standby,
u32 sleep, OSMesgQueue *mq);
/* Font routines */
extern int LeoGetKAdr(int sjis);
extern int LeoGetAAdr(int code,int *dx,int *dy, int *cy);
extern int LeoGetAAdr2(u32 ccode,int *dx,int *dy, int *cy);
/* Boot function */
extern void LeoBootGame(void *entry);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_LEO_H */

274
include/PR/leoappli.h Normal file
View File

@ -0,0 +1,274 @@
/*
* F i l e N a m e : l e o a p p l i . h
*
****************************************************************************
* (C) Copyright ALPS Electric Co., Ltd. 1995-1997
****************************************************************************
* Version
*
* ver Date
* ---- --------
* 1.01 '97-11-18 Add MOTOR BRAKE definition for control bit.
****************************************************************************
*/
/*-----------------------------------*/
/* DRIVE PARAMETER */
/*-----------------------------------*/
#define LEO_DISK_TYPE_MIN 0
#define LEO_DISK_TYPE_MAX 6
#define LEO_LBA_MIN 0
#define LEO_LBA_MAX 4291
#define LEO_LBA_ROM_TOP LEO_LBA_MIN
#define LEO_LBA_ROM_END0 1417
#define LEO_LBA_ROM_END1 1965
#define LEO_LBA_ROM_END2 2513
#define LEO_LBA_ROM_END3 3061
#define LEO_LBA_ROM_END4 3609
#define LEO_LBA_ROM_END5 4087
#define LEO_LBA_ROM_END6 LEO_LBA_MAX
#define LEO_LBA_RAM_TOP0 (LEO_LBA_ROM_END0+1)
#define LEO_LBA_RAM_TOP1 (LEO_LBA_ROM_END1+1)
#define LEO_LBA_RAM_TOP2 (LEO_LBA_ROM_END2+1)
#define LEO_LBA_RAM_TOP3 (LEO_LBA_ROM_END3+1)
#define LEO_LBA_RAM_TOP4 (LEO_LBA_ROM_END4+1)
#define LEO_LBA_RAM_TOP5 (LEO_LBA_ROM_END5+1)
#define LEO_LBA_RAM_TOP6 (LEO_LBA_ROM_END6+1)
#define LEO_LBA_RAM_END6 LEO_LBA_MAX
/*-----------------------------------*/
/* LEO FUNCTION DEFINITIONS */
/*-----------------------------------*/
extern void leoInitialize(OSPri PRI_WRK, OSPri PRI_INT, OSMesg *command_que_buf, u32 cmd_buff_size);
extern void leoCommand(void *CDB);
extern void LeoReset(void);
extern s32 LeoResetClear(void);
/*-----------------------------------*/
/* THREAD PRIORITY */
/*-----------------------------------*/
#define LEO_PRIORITY_WRK (OS_PRIORITY_PIMGR-1)
#define LEO_PRIORITY_INT OS_PRIORITY_PIMGR
/*-----------------------------------*/
/* COMMAND CODE */
/*-----------------------------------*/
#define LEO_COMMAND_CLEAR_QUE 0x01
#define LEO_COMMAND_INQUIRY 0x02
#define LEO_COMMAND_TEST_UNIT_READY 0x03
#define LEO_COMMAND_REZERO 0x04
#define LEO_COMMAND_READ 0x05
#define LEO_COMMAND_WRITE 0x06
#define LEO_COMMAND_SEEK 0x07
#define LEO_COMMAND_START_STOP 0x08
#define LEO_COMMAND_READ_CAPACITY 0x09
#define LEO_COMMAND_TRANSLATE 0x0a
#define LEO_COMMAND_MODE_SELECT 0x0b
#define LEO_COMMAND_READ_DISK_ID 0x0c
#define LEO_COMMAND_READ_TIMER 0x0d
#define LEO_COMMAND_SET_TIMER 0x0e
/*-----------------------------------*/
/* CONTROL BIT */
/*-----------------------------------*/
#define LEO_CONTROL_POST 0x80 /* ENABLE POST QUEUE */
#define LEO_CONTROL_START 0x01 /* START COMMAND */
#define LEO_CONTROL_STBY 0x02 /* STAND-BY MODE(NOT SLEEP MODE) */
#define LEO_CONTROL_WRT 0x01 /* READ RE-WRITE-ABLE CAPACITY */
#define LEO_CONTROL_TBL 0x01 /* TRANSLATE BYTE TO LBA */
#define LEO_CONTROL_BRAKE 0x04 /* SLEEP MODE(BRAKE ON) */
/*-----------------------------------*/
/* BIT FIELD PARAMETER */
/*-----------------------------------*/
#define LEO_TEST_UNIT_MR 0x01 /* MEDIUM REMOVED */
#define LEO_TEST_UNIT_RE 0x02 /* HEAD RETRACTED */
#define LEO_TEST_UNIT_SS 0x04 /* SPINDLE STOPPED */
/*-----------------------------------*/
/* STATUS */
/*-----------------------------------*/
#define LEO_STATUS_GOOD 0x00
#define LEO_STATUS_CHECK_CONDITION 0x02
#define LEO_STATUS_BUSY 0x08
/*-----------------------------------*/
/* SENSE CODE */
/*-----------------------------------*/
#define LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION 00
#define LEO_SENSE_DRIVE_NOT_READY 01
#define LEO_SENSE_DIAGNOSTIC_FAILURE 02
#define LEO_SENSE_COMMAND_PHASE_ERROR 03
#define LEO_SENSE_DATA_PHASE_ERROR 04
#define LEO_SENSE_REAL_TIME_CLOCK_FAILURE 05
#define LEO_SENSE_INCOMPATIBLE_MEDIUM_INSTALLED 11
#define LEO_SENSE_UNKNOWN_FORMAT 11
#define LEO_SENSE_NO_SEEK_COMPLETE 21
#define LEO_SENSE_WRITE_FAULT 22
#define LEO_SENSE_UNRECOVERED_READ_ERROR 23
#define LEO_SENSE_NO_REFERENCE_POSITION_FOUND 24
#define LEO_SENSE_TRACK_FOLLOWING_ERROR 25
#define LEO_SENSE_TRACKING_OR_SPDL_SERVO_FAILURE 25
#define LEO_SENSE_INVALID_COMMAND_OPERATION_CODE 31
#define LEO_SENSE_LBA_OUT_OF_RANGE 32
#define LEO_SENSE_WRITE_PROTECT_ERROR 33
#define LEO_SENSE_COMMAND_TERMINATED 34
#define LEO_SENSE_QUEUE_FULL 35
#define LEO_SENSE_ILLEGAL_TIMER_VALUE 36
#define LEO_SENSE_WAITING_NMI 37
#define LEO_SENSE_DEVICE_COMMUNICATION_FAILURE 41
#define LEO_SENSE_MEDIUM_NOT_PRESENT 42
#define LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED 43
#define LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED 47
#define LEO_SENSE_EJECTED_ILLEGALLY_RESUME 49
/*-----------------------------------*/
/* Command Block Header */
/*-----------------------------------*/
typedef struct{
u8 command;
u8 reserve1;
u8 control;
u8 reserve3;
u8 status;
u8 sense;
u8 reserve6;
u8 reserve7;
OSMesgQueue *post;
} LEOCmdHeader;
/*-----------------------------------*/
/* CLEAR QUEUE(01H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
} LEOCmdClearQue;
/*-----------------------------------*/
/* INQUIRY(02H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u8 dev_type;
u8 version;
u8 dev_num;
u8 leo_bios_ver;
u32 reserve5;
} LEOCmdInquiry;
/*-----------------------------------*/
/* TEST UNIT READY(03H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u8 test;
u8 reserve2;
u8 reserve3;
u8 reserve4;
} LEOCmdTestUnitReady;
/*-----------------------------------*/
/* REZERO(04H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
} LEOCmdRezero;
/*-----------------------------------*/
/* READ(05H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u32 lba;
u32 xfer_blks;
void *buff_ptr;
u32 rw_bytes;
} LEOCmdRead;
/*-----------------------------------*/
/* WRITE(06H) command */
/*-----------------------------------*/
typedef LEOCmdRead LEOCmdWrite;
/*-----------------------------------*/
/* SEEK(07H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u32 lba;
} LEOCmdSeek;
/*-----------------------------------*/
/* START/STOP(08H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
} LEOCmdStartStop;
/*-----------------------------------*/
/* READ CAPACITY(09H) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u32 start_lba;
u32 end_lba;
u32 capa_bytes;
} LEOCmdReadCapacity;
/*-----------------------------------*/
/* TRANSLATE(0AH) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u32 start_lba;
u32 in_param;
u32 out_param;
} LEOCmdTranslate;
/*-----------------------------------*/
/* MODE SELECT(0BH) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u8 page_code;
u8 reserve1;
u8 standby_time;
u8 sleep_time;
u8 led_on_time;
u8 led_off_time;
u8 reserve18;
u8 reserve19;
} LEOCmdModeSelect;
/*-----------------------------------*/
/* READ DISK ID(0CH) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
void *buffer_pointer;
} LEOCmdReadDiskId;
/*-----------------------------------*/
/* READ TIMER(0DH) command */
/*-----------------------------------*/
typedef struct {
LEOCmdHeader header;
u8 reserve12;
u8 reserve13;
u8 year;
u8 month;
u8 day;
u8 hour;
u8 minute;
u8 second;
} LEOCmdReadTimer;
/*-----------------------------------*/
/* SET TIMER(0EH) command */
/*-----------------------------------*/
typedef LEOCmdReadTimer LEOCmdSetTimer;
/*-------end of leoappli.h--------------------------*/

View File

@ -1,3 +1,31 @@
/*====================================================================
* libaudio.h
*
* Copyright 1993, 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.
*====================================================================*/
/**************************************************************************
*
* $Revision: 1.173 $
* $Date: 1997/12/01 12:42:21 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/libaudio.h,v $
*
**************************************************************************/
#ifndef __LIB_AUDIO__
#define __LIB_AUDIO__
@ -35,11 +63,7 @@ extern "C" {
#define AL_FX_BUFFER_SIZE 8192
#define AL_FRAME_INIT -1
#if PAL
#define AL_USEC_PER_FRAME 20000
#else
#define AL_USEC_PER_FRAME 16000
#endif
#define AL_USEC_PER_FRAME (PAL ? 20000 : 16000)
#define AL_MAX_PRIORITY 127
#define AL_GAIN_CHANGE_TIME 1000
@ -304,27 +328,26 @@ typedef struct ALVoiceConfig_s {
u8 unityPitch; /* unity pitch flag */
} ALVoiceConfig;
/**
* This struct needs some modifications but I'm not sure how yet.
* outputRate should be at 0x40
*/
typedef struct {
/*0x00*/ ALPlayer *head; /* client list head */
/*0x04*/ ALLink pFreeList; /* list of free physical voices */
/*0x0c*/ ALLink pAllocList; /* list of allocated physical voices */
/*0x14*/ ALLink pLameList; /* list of voices ready to be freed */
/*0x1c*/ s32 paramSamples;
/*0x20*/ s32 curSamples; /* samples from start of game */
/*0x24*/ ALDMANew dma;
/*0x28*/ ALHeap *heap;
/*0x2c*/ struct ALParam_s *paramList;
/*0x30*/ struct ALMainBus_s *mainBus;
/*0x34*/ struct ALAuxBus_s *auxBus; /* ptr to array of aux bus structs */
/*0x38*/ struct ALFilter_s *outputFilter; /* last filter in the filter chain */
/*0x3c*/ s32 numPVoices;
/*0x40*/ s32 maxAuxBusses;
/*0x44*/ s32 outputRate; /* output sample rate */
/*0x48*/ s32 maxOutSamples; /* Maximum samples rsp can generate
ALPlayer *head; /* client list head */
ALLink pFreeList; /* list of free physical voices */
ALLink pAllocList; /* list of allocated physical voices */
ALLink pLameList; /* list of voices ready to be freed */
s32 paramSamples;
s32 curSamples; /* samples from start of game */
ALDMANew dma;
ALHeap *heap;
struct ALParam_s *paramList;
struct ALMainBus_s *mainBus;
struct ALAuxBus_s *auxBus; /* ptr to array of aux bus structs */
struct ALFilter_s *outputFilter; /* last filter in the filter chain */
s32 numPVoices;
s32 maxAuxBusses;
s32 outputRate; /* output sample rate */
s32 maxOutSamples; /* Maximum samples rsp can generate
at one time at output rate */
} ALSynth;
@ -343,11 +366,11 @@ void alSynStartVoiceParams(ALSynth *s, ALVoice *voice, ALWaveTable *w,
ALMicroTime t);
void alSynStopVoice(ALSynth *s, ALVoice *voice);
void alSynSetVol(ALVoice *v, s16 vol, ALMicroTime delta);
void alSynSetVol(ALSynth *s, ALVoice *v, s16 vol, ALMicroTime delta);
void alSynSetPitch(ALSynth *s, ALVoice *voice, f32 ratio);
void alSynSetPan(ALSynth *s, ALVoice *voice, ALPan pan);
void alSynSetFXMix(ALSynth *s, ALVoice *voice, u8 fxmix);
void n_alSynSetPriority(ALVoice *voice, s16 priority);
void alSynSetPriority(ALSynth *s, ALVoice *voice, s16 priority);
s16 alSynGetPriority(ALSynth *s, ALVoice *voice);
ALFxRef *alSynAllocFX(ALSynth *s, s16 bus, ALSynConfig *c, ALHeap *hp);
@ -362,7 +385,7 @@ typedef struct {
ALSynth drvr;
} ALGlobals;
extern ALGlobals *n_syn;
extern ALGlobals *alGlobals;
void alInit(ALGlobals *glob, ALSynConfig *c);
void alClose(ALGlobals *glob);
@ -594,13 +617,13 @@ typedef struct {
s32 eventCount;
} ALEventQueue;
void n_alEvtqNew(ALEventQueue *evtq, ALEventListItem *items,
void alEvtqNew(ALEventQueue *evtq, ALEventListItem *items,
s32 itemCount);
ALMicroTime n_alEvtqNextEvent(ALEventQueue *evtq, ALEvent *evt);
ALMicroTime alEvtqNextEvent(ALEventQueue *evtq, ALEvent *evt);
void alEvtqPostEvent(ALEventQueue *evtq, ALEvent *evt,
ALMicroTime delta, s32 arg3);
ALMicroTime delta);
void alEvtqFlush(ALEventQueue *evtq);
void n_alEvtqFlushType(ALEventQueue *evtq, s16 type);
void alEvtqFlushType(ALEventQueue *evtq, s16 type);
#define AL_PHASE_ATTACK 0
@ -626,20 +649,18 @@ typedef struct ALVoiceState_s {
u8 tremelo; /* current value of the tremelo */
u8 flags; /* bit 0 tremelo flag
bit 1 vibrato flag */
u32 unk38;
u32 unk3c;
} ALVoiceState;
typedef struct {
/*0x00*/ ALInstrument *instrument; /* instrument assigned to this chan */
/*0x04*/ s16 bendRange; /* pitch bend range in cents */
/*0x06*/ ALFxId fxId; /* type of fx assigned to this chan */
/*0x07*/ ALPan pan; /* overall pan for this chan */
/*0x08*/ u8 priority; /* priority for this chan */
/*0x09*/ u8 vol; /* current volume for this chan */
/*0x0a*/ u8 fxmix; /* current fx mix for this chan */
/*0x0b*/ u8 unk0b;
/*0x0c*/ u8 sustain; /* current sustain pedal state */
ALInstrument *instrument; /* instrument assigned to this chan */
s16 bendRange; /* pitch bend range in cents */
ALFxId fxId; /* type of fx assigned to this chan */
ALPan pan; /* overall pan for this chan */
u8 priority; /* priority for this chan */
u8 vol; /* current volume for this chan */
u8 fxmix; /* current fx mix for this chan */
u8 unk0b;
u8 sustain; /* current sustain pedal state */
u8 unk0d;
u8 unk0e;
u8 unk0f;
@ -773,11 +794,6 @@ typedef struct {
ALOscInit initOsc;
ALOscUpdate updateOsc;
ALOscStop stopOsc;
f32 unk7c;
f32 unk80;
s32 unk84;
u8 unk88;
u8 unk89;
} ALCSPlayer;
/*
@ -795,7 +811,7 @@ void alSeqGetLoc(ALSeq *seq, ALSeqMarker *marker);
* Compact Sequence data representation routines
*/
void alCSeqNew(ALCSeq *seq, u8 *ptr);
void alCSeqNextEvent(ALCSeq *seq, ALEvent *evt, s32 arg2);
void alCSeqNextEvent(ALCSeq *seq,ALEvent *evt);
s32 alCSeqGetTicks(ALCSeq *seq);
f32 alCSeqTicksToSec(ALCSeq *seq, s32 ticks, u32 tempo);
u32 alCSeqSecToTicks(ALCSeq *seq, f32 sec, u32 tempo);
@ -943,3 +959,6 @@ void alParseAbiCL(Acmd *cmdList, u32 nbytes);
#endif
#endif /* !__LIB_AUDIO__ */

View File

@ -60,11 +60,7 @@
*
**************************************************************************/
#ifdef F3D_OLD
#include <PR/gbi_old.h>
#else
#include <PR/gbi.h>
#endif
/**************************************************************************
*

354
include/PR/n_libaudio.h Normal file
View File

@ -0,0 +1,354 @@
/*====================================================================
*
* Copyright 1993, 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.
*====================================================================*/
#ifndef __N_LIBAUDIO__
#define __N_LIBAUDIO__
#include <PR/libaudio.h>
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#include <PR/mbi.h>
/*
* Synthesis driver stuff
*/
typedef struct N_ALVoice_s {
ALLink node;
struct N_PVoice_s *pvoice;
ALWaveTable *table;
void *clientPrivate;
s16 state;
s16 priority;
s16 fxBus;
s16 unityPitch;
} N_ALVoice;
typedef struct {
ALPlayer *head; /* client list head */
ALLink pFreeList; /* list of free physical voices */
ALLink pAllocList; /* list of allocated physical voices */
ALLink pLameList; /* list of voices ready to be freed */
s32 paramSamples;
s32 curSamples; /* samples from start of game */
ALDMANew dma;
ALHeap *heap;
struct ALParam_s *paramList;
struct N_ALMainBus_s *mainBus;
struct N_ALAuxBus_s *auxBus;
struct N_ALFilter_s *outputFilter;
s32 numPVoices;
s32 maxAuxBusses;
s32 outputRate;
s32 maxOutSamples;
} N_ALSynth;
void n_alSynAddPlayer(ALPlayer *client);
void n_alSynAddSndPlayer(ALPlayer *client);
void n_alSynAddSeqPlayer(ALPlayer *client);
ALFxRef n_alSynAllocFX( s16 bus,ALSynConfig *c, ALHeap *hp);
s32 n_alSynAllocVoice( N_ALVoice *voice, ALVoiceConfig *vc);
void n_alSynFreeVoice(N_ALVoice *voice);
ALFxRef n_alSynGetFXRef( s16 bus, s16 index);
s16 n_alSynGetPriority( N_ALVoice *voice);
void n_alSynRemovePlayer( ALPlayer *client);
void n_alSynSetFXMix(N_ALVoice *v, u8 fxmix);
void n_alSynSetFXParam(ALFxRef fx, s16 paramID, void *param);
void n_alSynFreeFX(ALFxRef *fx);
void n_alSynSetPan(N_ALVoice *v, u8 pan);
void n_alSynSetPitch( N_ALVoice *v, f32 pitch);
void n_alSynSetPriority( N_ALVoice *voice, s16 priority);
void n_alSynSetVol( N_ALVoice *v, s16 volume, ALMicroTime t);
void n_alSynStartVoice(N_ALVoice *v, ALWaveTable *table);
void n_alSynStartVoiceParams(N_ALVoice *v, ALWaveTable *w,f32 pitch, s16 vol,
ALPan pan, u8 fxmix, ALMicroTime t);
void n_alSynStopVoice( N_ALVoice *v);
void n_alSynNew(ALSynConfig *c);
void n_alSynDelete(void);
/*
* Audio Library (AL) stuff
*/
typedef struct {
N_ALSynth drvr;
} N_ALGlobals;
extern N_ALGlobals *n_alGlobals;
extern N_ALSynth *n_syn;
void n_alInit(N_ALGlobals *g, ALSynConfig *c);
void n_alClose(N_ALGlobals *glob);
Acmd *n_alAudioFrame(Acmd *cmdList, s32 *cmdLen,
s16 *outBuf, s32 outLen);
/*
* Sequence Player stuff
*/
typedef struct {
struct N_ALVoice_s *voice;
} N_ALNoteEvent;
typedef struct {
struct N_ALVoice_s *voice;
ALMicroTime delta;
u8 vol;
} N_ALVolumeEvent;
typedef struct {
struct N_ALVoiceState_s *vs;
void *oscState;
u8 chan;
} N_ALOscEvent;
typedef struct {
s16 type;
union {
ALMIDIEvent midi;
ALTempoEvent tempo;
ALEndEvent end;
N_ALNoteEvent note;
N_ALVolumeEvent vol;
ALSeqpLoopEvent loop;
ALSeqpVolEvent spvol;
ALSeqpPriorityEvent sppriority;
ALSeqpSeqEvent spseq;
ALSeqpBankEvent spbank;
N_ALOscEvent osc;
} msg;
} N_ALEvent;
typedef struct {
ALLink node;
ALMicroTime delta;
N_ALEvent evt;
} N_ALEventListItem;
void n_alEvtqNew(ALEventQueue *evtq, N_ALEventListItem *items, s32 itemCount);
ALMicroTime n_alEvtqNextEvent(ALEventQueue *evtq, N_ALEvent *evt);
void n_alEvtqPostEvent(ALEventQueue *evtq, N_ALEvent *evt, ALMicroTime delta, s32 arg3);
void n_alEvtqFlushType(ALEventQueue *evtq, s16 type);
typedef struct N_ALVoiceState_s {
struct N_ALVoiceState_s *next;/* MUST be first */
N_ALVoice voice;
ALSound *sound;
ALMicroTime envEndTime; /* time of envelope segment end */
f32 pitch; /* currect pitch ratio */
f32 vibrato; /* current value of the vibrato */
u8 envGain; /* current envelope gain */
u8 channel; /* channel assignment */
u8 key; /* note on key number */
u8 velocity; /* note on velocity */
u8 envPhase; /* what envelope phase */
u8 phase;
u8 tremelo; /* current value of the tremelo */
u8 flags; /* bit 0 tremelo flag
bit 1 vibrato flag */
u32 unk38;
u32 unk3c;
} N_ALVoiceState;
typedef struct {
ALPlayer node; /* note: must be first in structure */
N_ALSynth *drvr; /* reference to the client driver */
ALSeq *target; /* current sequence */
ALMicroTime curTime;
ALBank *bank; /* current ALBank */
s32 uspt; /* microseconds per tick */
s32 nextDelta; /* microseconds to next callback */
s32 state;
u16 chanMask; /* active channels */
s16 vol; /* overall sequence volume */
u8 maxChannels; /* number of MIDI channels */
u8 debugFlags; /* control which error get reported */
N_ALEvent nextEvent;
ALEventQueue evtq;
ALMicroTime frameTime;
ALChanState *chanState; /* 16 channels for MIDI */
N_ALVoiceState *vAllocHead; /* list head for allocated voices */
N_ALVoiceState *vAllocTail; /* list tail for allocated voices */
N_ALVoiceState *vFreeList; /* list of free voice state structs */
ALOscInit initOsc;
ALOscUpdate updateOsc;
ALOscStop stopOsc;
ALSeqMarker *loopStart;
ALSeqMarker *loopEnd;
s32 loopCount; /* -1 = loop forever, 0 = no loop */
} N_ALSeqPlayer;
typedef struct {
ALPlayer node; /* note: must be first in structure */
N_ALSynth *drvr; /* reference to the client driver */
ALCSeq *target; /* current sequence */
ALMicroTime curTime;
ALBank *bank; /* current ALBank */
s32 uspt; /* microseconds per tick */
s32 nextDelta; /* microseconds to next callback */
s32 state;
u16 chanMask; /* active channels */
s16 vol; /* overall sequence volume */
u8 maxChannels; /* number of MIDI channels */
u8 debugFlags; /* control which error get reported */
N_ALEvent nextEvent;
ALEventQueue evtq;
ALMicroTime frameTime;
ALChanState *chanState; /* 16 channels for MIDI */
N_ALVoiceState *vAllocHead; /* list head for allocated voices */
N_ALVoiceState *vAllocTail; /* list tail for allocated voices */
N_ALVoiceState *vFreeList; /* list of free voice state structs */
ALOscInit initOsc;
ALOscUpdate updateOsc;
ALOscStop stopOsc;
f32 unk7c;
f32 unk80;
s32 unk84;
u8 unk88;
u8 unk89;
} N_ALCSPlayer;
/*
* Sequence data representation routines
*/
void n_alSeqNextEvent(ALSeq *seq, N_ALEvent *event);
void n_alSeqNewMarker(ALSeq *seq, ALSeqMarker *m, u32 ticks);
void n_alCSeqNew(ALCSeq *seq, u8 *ptr);
void n_alCSeqNextEvent(ALCSeq *seq, N_ALEvent *evt, s32 arg2);
void n_alCSeqNewMarker(ALCSeq *seq, ALCSeqMarker *m, u32 ticks);
/*
* Sequence Player routines
*/
void n_alSeqpNew(N_ALSeqPlayer *seqp, ALSeqpConfig *config);
void n_alSeqpDelete(N_ALSeqPlayer *seqp);
u8 n_alSeqpGetChlVol(N_ALSeqPlayer *seqp, u8 chan);
u8 n_alSeqpGetChlFXMix(N_ALSeqPlayer *seqp, u8 chan);
ALPan n_alSeqpGetChlPan(N_ALSeqPlayer *seqp, u8 chan);
u8 n_alSeqpGetChlPriority(N_ALSeqPlayer *seqp, u8 chan);
s32 n_alSeqpGetChlProgram(N_ALSeqPlayer *seqp, u8 chan);
ALSeq *n_alSeqpGetSeq(N_ALSeqPlayer *seqp);
s32 n_alSeqpGetState(N_ALSeqPlayer *seqp);
s32 n_alSeqpGetTempo(N_ALSeqPlayer *seqp);
s16 n_alSeqpGetVol(N_ALSeqPlayer *seqp); /* Master volume control */
void n_alSeqpPlay(N_ALSeqPlayer *seqp);
void n_alSeqpSendMidi(N_ALSeqPlayer *seqp, s32 ticks, u8 status, u8 byte1, u8 byte2);
void n_alSeqpSetBank(N_ALSeqPlayer *seqp, ALBank *b);
void n_alSeqpSetChlVol(N_ALSeqPlayer *seqp, u8 chan, u8 vol);
void n_alSeqpSetChlFXMix(N_ALSeqPlayer *seqp, u8 chan, u8 fxmix);
void n_alSeqpSetChlPan(N_ALSeqPlayer *seqp, u8 chan, ALPan pan);
void n_alSeqpSetChlPriority(N_ALSeqPlayer *seqp, u8 chan, u8 priority);
void n_alSeqpSetChlProgram(N_ALSeqPlayer *seqp, u8 chan, u8 prog);
void n_alSeqpSetSeq(N_ALSeqPlayer *seqp, ALSeq *seq);
void n_alSeqpSetTempo(N_ALSeqPlayer *seqp, s32 tempo);
void n_alSeqpSetVol(N_ALSeqPlayer *seqp, s16 vol);
void n_alSeqpStop(N_ALSeqPlayer *seqp);
void n_alSeqpLoop(N_ALSeqPlayer *seqp, ALSeqMarker *start, ALSeqMarker *end, s32 count);
/*
* Compressed Sequence Player routines
*/
void n_alCSPNew(N_ALCSPlayer *seqp, ALSeqpConfig *config);
void n_alCSPDelete(N_ALCSPlayer *seqp);
u8 n_alCSPGetChlVol(N_ALCSPlayer *seqp, u8 chan);
u8 n_alCSPGetChlFXMix(N_ALCSPlayer *seqp, u8 chan);
ALPan n_alCSPGetChlPan(N_ALCSPlayer *seqp, u8 chan);
u8 n_alCSPGetChlPriority(N_ALCSPlayer *seqp, u8 chan);
s32 n_alCSPGetChlProgram(N_ALCSPlayer *seqp, u8 chan);
ALCSeq *n_alCSPGetSeq(N_ALCSPlayer *seqp);
s32 n_alCSPGetState(N_ALCSPlayer *seqp);
s32 n_alCSPGetTempo(N_ALCSPlayer *seqp);
s16 n_alCSPGetVol(N_ALCSPlayer *seqp);
void n_alCSPPlay(N_ALCSPlayer *seqp);
void n_alCSPSendMidi(N_ALCSPlayer *seqp, s32 ticks, u8 status, u8 byte1, u8 byte2);
void n_alCSPSetBank(N_ALCSPlayer *seqp, ALBank *b);
void n_alCSPSetChlVol(N_ALCSPlayer *seqp, u8 chan, u8 vol);
void n_alCSPSetChlFXMix(N_ALCSPlayer *seqp, u8 chan, u8 fxmix);
void n_alCSPSetChlPan(N_ALCSPlayer *seqp, u8 chan, ALPan pan);
void n_alCSPSetChlPriority(N_ALCSPlayer *seqp, u8 chan, u8 priority);
void n_alCSPSetChlProgram(N_ALCSPlayer *seqp, u8 chan, u8 prog);
void n_alCSPSetSeq(N_ALCSPlayer *seqp, ALCSeq *seq);
void n_alCSPSetTempo(N_ALCSPlayer *seqp, s32 tempo);
void n_alCSPSetVol(N_ALCSPlayer *seqp, s16 vol);
void n_alCSPStop(N_ALCSPlayer *seqp);
/*
* Sound Player stuff
*/
typedef struct {
ALPlayer node; /* note: must be first in structure */
ALEventQueue evtq;
N_ALEvent nextEvent;
N_ALSynth *drvr; /* reference to the client driver */
s32 target;
void *sndState;
s32 maxSounds;
ALMicroTime frameTime;
ALMicroTime nextDelta; /* microseconds to next callback */
ALMicroTime curTime;
} N_ALSndPlayer;
void n_alSndpNew(N_ALSndPlayer *sndp, ALSndpConfig *c);
void n_alSndpDelete(void);
ALSndId n_alSndpAllocate(ALSound *sound);
void n_alSndpDeallocate(ALSndId id);
s32 n_alSndpGetState(void);
void n_alSndpPlay(void);
void n_alSndpPlayAt(ALMicroTime delta);
void n_alSndpSetFXMix(u8 mix);
void n_alSndpSetPan(ALPan pan);
void n_alSndpSetPitch(f32 pitch);
void n_alSndpSetPriority(ALSndId id, u8 priority);
void n_alSndpSetVol(s16 vol);
void n_alSndpStop(void);
ALSndId n_alSndpGetSound(void);
void n_alSndpSetSound(ALSndId id);
/*
* for n_audio micro code
*/
extern long long int n_aspMainTextStart[], n_aspMainTextEnd[];
extern long long int n_aspMainDataStart[], n_aspMainDataEnd[];
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* __N_LIBAUDIO__ */

View File

@ -0,0 +1,120 @@
#define ALVoice N_ALVoice
#define ALSynth N_ALSynth
#define ALGlobals N_ALGlobals
#define alSynAddPlayer( a, b) n_alSynAddPlayer( b)
#define alSynAllocFX( a, b, c, d) n_alSynAllocFX( b, c, d)
#define alSynAllocVoice( a, b, c) n_alSynAllocVoice( b, c)
#define alSynDelete( a) n_alSynDelete()
#define alSynFreeVoice( a, b) n_alSynFreeVoice( b)
#define alSynGetFXRef( a, b, c) n_alSynGetFXRef( b, c)
#define alSynGetPriority( a, b) n_alSynGetPriority( b)
#define alSynRemovePlayer( a, b) n_alSynRemovePlayer( b)
#define alSynSetFXMix( a, b, c) n_alSynSetFXMix( b, c)
#define alSynSetFXParam( a, b, c, d) n_alSynSetFXParam( b, c, d)
#define alSynFreeFX( a, b) n_alSynFreeFX( b)
#define alSynSetPan( a, b, c) n_alSynSetPan( b, c)
#define alSynSetPitch( a, b, c) n_alSynSetPitch( b, c)
#define alSynSetPriority( a, b, c) n_alSynSetPriority( b, c)
#define alSynSetVol( a, b, c, d) n_alSynSetVol( b, c, d)
#define alSynStartVoice( a, b, c) n_alSynStartVoice( b, c)
#define alSynStartVoiceParams( a, b, c, d, e, f, g, h) \
n_alSynStartVoiceParams( b, c, d, e, f, g, h)
#define alSynStopVoice( a, b) n_alSynStopVoice( b)
#define alSynNew( a, b) n_alSynNew( b)
#define alInit n_alInit
#define alClose n_alClose
#define alAudioFrame n_alAudioFrame
#define ALVoiceState N_ALVoiceState
#define ALSeqPlayer N_ALSeqPlayer
#define ALCSPlayer N_ALCSPlayer
#define alSeqNextEvent n_alSeqNextEvent
#define alSeqNewMarker n_alSeqNewMarker
#define alCSeqNew n_alCSeqNew
#define alCSeqNextEvent n_alCSeqNextEvent
#define alCSeqNewMarker n_alCSeqNewMarker
#define alSeqpNew n_alSeqpNew
#define alSeqpDelete n_alSeqpDelete
#define alSeqpGetChlVol n_alSeqpGetChlVol
#define alSeqpGetChlFXMix n_alSeqpGetChlFXMix
#define alSeqpGetChlPan n_alSeqpGetChlPan
#define alSeqpGetChlPriority n_alSeqpGetChlPriority
#define alSeqpGetChlProgram n_alSeqpGetChlProgram
#define alSeqpGetSeq n_alSeqpGetSeq
#define alSeqpGetState n_alSeqpGetState
#define alSeqpGetTempo n_alSeqpGetTempo
#define alSeqpGetVol n_alSeqpGetVol
#define alSeqpPlay n_alSeqpPlay
#define alSeqpSendMidi n_alSeqpSendMidi
#define alSeqpSetBank n_alSeqpSetBank
#define alSeqpSetChlVol n_alSeqpSetChlVol
#define alSeqpSetChlFXMix n_alSeqpSetChlFXMix
#define alSeqpSetChlPan n_alSeqpSetChlPan
#define alSeqpSetChlPriority n_alSeqpSetChlPriority
#define alSeqpSetChlProgram n_alSeqpSetChlProgram
#define alSeqpSetSeq n_alSeqpSetSeq
#define alSeqpSetTempo n_alSeqpSetTempo
#define alSeqpSetVol n_alSeqpSetVol
#define alSeqpStop n_alSeqpStop
#define alSeqpLoop n_alSeqpLoop
#define alCSPNew n_alCSPNew
#define alCSPDelete n_alCSPDelete
#define alCSPGetChlVol n_alCSPGetChlVol
#define alCSPGetChlFXMix n_alCSPGetChlFXMix
#define alCSPGetChlPan n_alCSPGetChlPan
#define alCSPGetChlPriority n_alCSPGetChlPriority
#define alCSPGetChlProgram n_alCSPGetChlProgram
#define alCSPGetSeq n_alCSPGetSeq
#define alCSPGetState n_alCSPGetState
#define alCSPGetTempo n_alCSPGetTempo
#define alCSPGetVol n_alCSPGetVol
#define alCSPPlay n_alCSPPlay
#define alCSPSendMidi n_alCSPSendMidi
#define alCSPSetBank n_alCSPSetBank
#define alCSPSetChlVol n_alCSPSetChlVol
#define alCSPSetChlFXMix n_alCSPSetChlFXMix
#define alCSPSetChlPan n_alCSPSetChlPan
#define alCSPSetChlPriority n_alCSPSetChlPriority
#define alCSPSetChlProgram n_alCSPSetChlProgram
#define alCSPSetSeq n_alCSPSetSeq
#define alCSPSetTempo n_alCSPSetTempo
#define alCSPSetVol n_alCSPSetVol
#define alCSPStop n_alCSPStop
#define ALSoundState N_ALSoundState
#define ALSndpEvent N_ALSndpEvent
#define ALSndPlayer N_ALSndPlayer
#define alSndpNew( a, b) n_alSndpNew( a, b)
#define alSndpDelete( a) n_alSndpDelete()
#define alSndpAllocate( a, b) n_alSndpAllocate( b)
#define alSndpDeallocate( a, b) n_alSndpDeallocate( b)
#define alSndpGetState( a) n_alSndpGetState()
#define alSndpPlay( a) n_alSndpPlay()
#define alSndpPlayAt( a, b) n_alSndpPlayAt( b)
#define alSndpSetFXMix( a, b) n_alSndpSetFXMix( b)
#define alSndpSetPan( a, b) n_alSndpSetPan( b)
#define alSndpSetPitch( a, b) n_alSndpSetPitch( b)
#define alSndpSetPriority( a, b, c) n_alSndpSetPriority( b, c)
#define alSndpSetVol( a, b) n_alSndpSetVol( b)
#define alSndpStop( a) n_alSndpStop()
#define alSndpGetSound( a) n_alSndpGetSound()
#define alSndpSetSound( a, b) n_alSndpSetSound( b)
#define alEvtqNew n_alEvtqNew
#define alEvtqNextEvent n_alEvtqNextEvent
#define alEvtqPostEvent n_alEvtqPostEvent
#define alEvtqFlushType n_alEvtqFlushType
#define alEvtqPrintEvtQueue n_alEvtqPrintEvtQueue
#define alEvtqPrintAllocEvts n_alEvtqPrintAllocEvts

107
include/PR/os.h Normal file
View File

@ -0,0 +1,107 @@
/*====================================================================
* os.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.h,v $
$Revision: 1.167 $
$Date: 1999/01/18 13:17:43 $
*---------------------------------------------------------------------*/
#ifndef _OS_H_
#define _OS_H_
#include <PR/os_thread.h>
#include <PR/os_message.h>
#include <PR/os_exception.h>
#include <PR/os_tlb.h>
#include <PR/os_pi.h>
#include <PR/os_vi.h>
#include <PR/os_ai.h>
#include <PR/os_si.h>
#include <PR/os_time.h>
#include <PR/os_cont.h>
#include <PR/os_pfs.h>
#include <PR/os_gbpak.h>
#include <PR/os_voice.h>
#include <PR/os_cache.h>
#include <PR/os_debug.h>
#include <PR/os_error.h>
#include <PR/os_gio.h>
#include <PR/os_reg.h>
#include <PR/os_system.h>
#include <PR/os_eeprom.h>
#include <PR/os_host.h>
#include <PR/os_convert.h>
#include <PR/os_rdp.h>
#include <PR/os_rsp.h>
#include <PR/os_motor.h>
#include <PR/os_libc.h>
#include <PR/os_version.h>
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
/**************************************************************************
*
* Global definitions
*
*/
/*
* Stack size for I/O device managers: PIM (PI Manager), VIM (VI Manager),
* SIM (SI Manager)
*
*/
#define OS_PIM_STACKSIZE 4096
#define OS_VIM_STACKSIZE 4096
#define OS_SIM_STACKSIZE 4096
#define OS_MIN_STACKSIZE 72
/*
* Leo Disk
*/
/* transfer mode */
#define LEO_BLOCK_MODE 1
#define LEO_TRACK_MODE 2
#define LEO_SECTOR_MODE 3
/*
* Boot addresses
*/
#define BOOT_ADDRESS_ULTRA 0x80000400
#define BOOT_ADDRESS_COSIM 0x80002000
#define BOOT_ADDRESS_EMU 0x20010000
#define BOOT_ADDRESS_INDY 0x88100000
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_H */

View File

@ -21,7 +21,7 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_cont.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:05 $
@ -47,7 +47,7 @@ extern "C" {
*/
/*
* Structure for controllers
* Structure for controllers
*/
typedef struct {
@ -71,104 +71,6 @@ typedef struct {
u8 errno;
} OSContRamIo;
typedef struct
{
/* 0x0 */ u32 ramarray[15];
/* 0x3C */ u32 pifstatus;
} OSPifRam;
typedef struct
{
/* 0x0 */ u8 dummy;
/* 0x1 */ u8 txsize;
/* 0x2 */ u8 rxsize;
/* 0x3 */ u8 cmd;
/* 0x4 */ u16 button;
/* 0x6 */ s8 stick_x;
/* 0x7 */ s8 stick_y;
} __OSContReadFormat;
typedef struct
{
/* 0x0 */ u8 dummy;
/* 0x1 */ u8 txsize;
/* 0x2 */ u8 rxsize;
/* 0x3 */ u8 cmd;
/* 0x4 */ u8 typeh;
/* 0x5 */ u8 typel;
/* 0x6 */ u8 status;
/* 0x7 */ u8 dummy1;
} __OSContRequestFormat;
typedef struct
{
/* 0x0 */ u8 txsize;
/* 0x1 */ u8 rxsize;
/* 0x2 */ u8 cmd;
/* 0x3 */ u8 typeh;
/* 0x4 */ u8 typel;
/* 0x5 */ u8 status;
} __OSContRequestFormatShort;
typedef struct
{
/* 0x0 */ u8 dummy;
/* 0x1 */ u8 txsize;
/* 0x2 */ u8 rxsize;
/* 0x3 */ u8 cmd;
/* 0x4 */ u8 hi;
/* 0x4 */ u8 lo;
/* 0x6 */ u8 data[BLOCKSIZE];
/* 0x26 */ u8 datacrc;
} __OSContRamReadFormat;
typedef union {
/* 0x0 */ struct
{
/* 0x0 */ u8 bank;
/* 0x1 */ u8 page;
} inode_t;
/* 0x0 */ u16 ipage;
} __OSInodeUnit;
typedef struct
{
/* 0x0 */ u32 game_code;
/* 0x4 */ u16 company_code;
/* 0x6 */ __OSInodeUnit start_page;
/* 0x8 */ u8 status;
/* 0x9 */ s8 reserved;
/* 0xA */ u16 data_sum;
/* 0xC */ u8 ext_name[4];
/* 0x10 */ u8 game_name[16];
} __OSDir;
typedef struct
{
/* 0x0 */ __OSInodeUnit inode_page[128];
} __OSInode;
typedef struct
{
/* 0x0 */ u32 repaired;
/* 0x4 */ u32 random;
/* 0x8 */ u64 serial_mid;
/* 0x10 */ u64 serial_low;
/* 0x18 */ u16 deviceid;
/* 0x1A */ u8 banks;
/* 0x1B */ u8 version;
/* 0x1C */ u16 checksum;
/* 0x1E */ u16 inverted_checksum;
} __OSPackId;
typedef struct
{
/* 0x0 */ u8 txsize;
/* 0x1 */ u8 rxsize;
/* 0x2 */ u8 cmd;
/* 0x3 */ u8 address;
/* 0x4 */ u8 data[EEPROM_BLOCK_SIZE];
} __OSContEepromFormat;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
@ -194,7 +96,7 @@ typedef struct
#ifdef _HW_VERSION_1
#define CONT_FRAME_ERROR 0x2
#define CONT_COLLISION_ERROR 0x1
#endif
#endif
/* Controller type */
@ -260,39 +162,6 @@ typedef struct
#define CONT_ERR_VOICE_WORD 14
#define CONT_ERR_VOICE_NO_RESPONSE 15
#define CONT_CMD_REQUEST_STATUS 0
#define CONT_CMD_READ_BUTTON 1
#define CONT_CMD_READ_MEMPACK 2
#define CONT_CMD_WRITE_MEMPACK 3
#define CONT_CMD_READ_EEPROM 4
#define CONT_CMD_WRITE_EEPROM 5
#define CONT_CMD_RESET 0xff
#define CONT_CMD_REQUEST_STATUS_TX 1
#define CONT_CMD_READ_BUTTON_TX 1
#define CONT_CMD_READ_MEMPACK_TX 3
#define CONT_CMD_WRITE_MEMPACK_TX 35
#define CONT_CMD_READ_EEPROM_TX 2
#define CONT_CMD_WRITE_EEPROM_TX 10
#define CONT_CMD_RESET_TX 1
#define CONT_CMD_REQUEST_STATUS_RX 3
#define CONT_CMD_READ_BUTTON_RX 4
#define CONT_CMD_READ_MEMPACK_RX 33
#define CONT_CMD_WRITE_MEMPACK_RX 1
#define CONT_CMD_READ_EEPROM_RX 8
#define CONT_CMD_WRITE_EEPROM_RX 1
#define CONT_CMD_RESET_RX 3
#define CONT_CMD_NOP 0xff
#define CONT_CMD_END 0xfe //indicates end of a command
#define CONT_CMD_EXE 1 //set pif ram status byte to this to do a command
#define DIR_STATUS_EMPTY 0
#define DIR_STATUS_UNKNOWN 1
#define DIR_STATUS_OCCUPIED 2
#define CHNL_ERR(format) ((format.rxsize & CHNL_ERR_MASK) >> 4)
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)

105
include/PR/os_convert.h Normal file
View File

@ -0,0 +1,105 @@
/*====================================================================
* os_convert.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_convert.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:05 $
*---------------------------------------------------------------------*/
#ifndef _OS_CONVERT_H_
#define _OS_CONVERT_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
*
*/
#define OS_CLOCK_RATE 62500000LL
#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4)
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
#define OS_NSEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625000LL))/(1000000000LL/15625000LL))
#define OS_USEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625LL))/(1000000LL/15625LL))
#define OS_CYCLES_TO_NSEC(c) (((u64)(c)*(1000000000LL/15625000LL))/(OS_CPU_COUNTER/15625000LL))
#define OS_CYCLES_TO_USEC(c) (((u64)(c)*(1000000LL/15625LL))/(OS_CPU_COUNTER/15625LL))
#define OS_K0_TO_PHYSICAL(x) (u32)(((char *)(x)-0x80000000))
#define OS_K1_TO_PHYSICAL(x) (u32)(((char *)(x)-0xa0000000))
#define OS_PHYSICAL_TO_K0(x) (void *)(((u32)(x)+0x80000000))
#define OS_PHYSICAL_TO_K1(x) (void *)(((u32)(x)+0xa0000000))
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* Address translation routines and macros */
extern u32 osVirtualToPhysical(void *);
extern void * osPhysicalToVirtual(u32);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_CONVERT_H_ */

108
include/PR/os_debug.h Normal file
View File

@ -0,0 +1,108 @@
/*====================================================================
* os_debug.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_debug.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:06 $
*---------------------------------------------------------------------*/
#ifndef _OS_DEBUG_H_
#define _OS_DEBUG_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
/*
* Structure for Profiler
*/
typedef struct {
u16 *histo_base; /* histogram base */
u32 histo_size; /* histogram size */
u32 *text_start; /* start of text segment */
u32 *text_end; /* end of text segment */
} OSProf;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
/*
* Profiler constants
*/
#define PROF_MIN_INTERVAL 50 /* microseconds */
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* Profiler Interface */
extern void osProfileInit(OSProf *, u32 profcnt);
extern void osProfileStart(u32);
extern void osProfileFlush(void);
extern void osProfileStop(void);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_DEBUG_H_ */

86
include/PR/os_error.h Normal file
View File

@ -0,0 +1,86 @@
/*====================================================================
* os_error.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_error.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:06 $
*---------------------------------------------------------------------*/
#ifndef _OS_ERROR_H_
#define _OS_ERROR_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
*
*/
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_ERROR_H_ */

107
include/PR/os_gbpak.h Normal file
View File

@ -0,0 +1,107 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo.
$RCSfile: os_gbpak.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:07 $
*---------------------------------------------------------------------*/
#ifndef _OS_GBPAK_H_
#define _OS_GBPAK_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#include "os_message.h"
#include "os_pfs.h"
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
typedef struct {
u16 fixed1;
u16 start_address;
u8 nintendo_chr[0x30];
u8 game_title[16];
u16 company_code;
u8 body_code;
u8 cart_type;
u8 rom_size;
u8 ram_size;
u8 country_code;
u8 fixed2;
u8 version;
u8 isum;
u16 sum;
} OSGbpakId;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
/* definition for 64GB-PAK */
#define OS_GBPAK_POWER 0x01
#define OS_GBPAK_RSTB_DETECTION 0x04
#define OS_GBPAK_RSTB_STATUS 0x08
#define OS_GBPAK_GBCART_PULL 0x40
#define OS_GBPAK_GBCART_ON 0x80
#define OS_GBPAK_POWER_OFF 0x00 /* power of 64GB-PAK */
#define OS_GBPAK_POWER_ON 0x01
#define OS_GBPAK_ROM_ID_SIZE 0x50 /* ID size of GB cartridge */
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* 64GB-PAK */
extern s32 osGbpakInit(OSMesgQueue *, OSPfs *, int);
extern s32 osGbpakPower(OSPfs *, s32);
extern s32 osGbpakGetStatus(OSPfs *, u8 *);
extern s32 osGbpakReadWrite(OSPfs *, u16, u16, u8 *, u16);
extern s32 osGbpakReadId(OSPfs *, OSGbpakId *, u8 *);
extern s32 osGbpakCheckConnector(OSPfs *, u8 *);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_GBPAK_H_ */

86
include/PR/os_gio.h Normal file
View File

@ -0,0 +1,86 @@
/*====================================================================
* os_gio.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_gio.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:08 $
*---------------------------------------------------------------------*/
#ifndef _OS_GIO_H_
#define _OS_GIO_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
*
*/
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_GIO_H_ */

104
include/PR/os_host.h Normal file
View File

@ -0,0 +1,104 @@
/*====================================================================
* os_host.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_host.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:08 $
*---------------------------------------------------------------------*/
#ifndef _OS_HOST_H_
#define _OS_HOST_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
*
*/
/* PARTNER-N64 */
#ifdef PTN64
#define osReadHost osReadHost_pt
#define osWriteHost osWriteHost_pt
#endif
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* Game <> Host data transfer functions */
extern s32 osTestHost(void);
extern void osReadHost(void *, u32);
extern void osWriteHost(void *, u32);
extern void osAckRamromRead(void);
extern void osAckRamromWrite(void);
/* RDB port operations */
extern void osInitRdb(u8 *sendBuf, u32 sendSize);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_HOST_H_ */

49
include/PR/os_internal.h Normal file
View File

@ -0,0 +1,49 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_internal.h,v $
$Revision: 1.20 $
$Date: 1998/10/09 08:01:09 $
*---------------------------------------------------------------------*/
#ifndef _OS_INTERNAL_H_
#define _OS_INTERNAL_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
#include "os_internal_reg.h"
#include "os_internal_exception.h"
#include "os_internal_tlb.h"
#include "os_internal_si.h"
#include "os_internal_rsp.h"
#include "os_internal_error.h"
#include "os_internal_gio.h"
#include "os_internal_thread.h"
#include "os_internal_debug.h"
#include "os_internal_host.h"
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_INTERNAL_H */

View File

@ -0,0 +1,43 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_internal_debug.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:09 $
*---------------------------------------------------------------------*/
#ifndef _OS_INTERNAL_DEBUG_H_
#define _OS_INTERNAL_DEBUG_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* Debug port */
extern void __osSyncPutChars(int, int, const char *);
extern int __osAtomicDec(unsigned int *p);
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_INTERNAL_DEBUG_H */

View File

@ -0,0 +1,45 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_internal_error.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:10 $
*---------------------------------------------------------------------*/
#ifndef _OS_INTERNAL_ERROR_H_
#define _OS_INTERNAL_ERROR_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* Error handling */
extern void __osError(s16, s16, ...);
extern OSThread * __osGetCurrFaultedThread(void);
extern OSThread * __osGetNextFaultedThread(OSThread *);
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_INTERNAL_ERROR_H */

View File

@ -0,0 +1,49 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_internal_exception.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:10 $
*---------------------------------------------------------------------*/
#ifndef _OS_INTERNAL_EXCEPTION_H_
#define _OS_INTERNAL_EXCEPTION_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* Routine for HW interrupt "handler" */
extern void __osSetHWIntrRoutine(OSHWIntr interrupt,
s32 (*handler)(void), void *stackEnd);
extern void __osGetHWIntrRoutine(OSHWIntr interrupt,
s32 (**handler)(void), void **stackEnd);
/* Routine for global interrupt mask */
extern void __osSetGlobalIntMask(OSHWIntr);
extern void __osResetGlobalIntMask(OSHWIntr);
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_INTERNAL_EXCEPTION_H */

View File

@ -0,0 +1,45 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_internal_gio.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:11 $
*---------------------------------------------------------------------*/
#ifndef _OS_INTERNAL_GIO_H_
#define _OS_INTERNAL_GIO_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* Development board functions */
extern void __osGIOInit(s32);
extern void __osGIOInterrupt(s32);
extern void __osGIORawInterrupt(s32);
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_INTERNAL_GIO_H */

View File

@ -0,0 +1,42 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_internal_host.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:11 $
*---------------------------------------------------------------------*/
#ifndef _OS_INTERNAL_HOST_H_
#define _OS_INTERNAL_HOST_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* routine for rdb port */
extern u32 __osRdbSend(u8 *buf, u32 size, u32 type);
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_INTERNAL_HOST_H */

View File

@ -0,0 +1,57 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_internal_reg.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:12 $
*---------------------------------------------------------------------*/
#ifndef _OS_INTERNAL_REG_H_
#define _OS_INTERNAL_REG_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* Routines to get/fetch coprocessor 0 registers */
extern u32 __osGetCause(void);
extern void __osSetCause(u32);
extern u32 __osGetCompare(void);
extern void __osSetCompare(u32);
extern u32 __osGetConfig(void);
extern void __osSetConfig(u32);
extern void __osSetCount(u32);
extern u32 __osGetSR(void);
extern void __osSetSR(u32);
extern u32 __osDisableInt(void);
extern void __osRestoreInt(u32);
/* Routines to get/set floating-point control and status register */
extern u32 __osSetFpcCsr(u32);
extern u32 __osGetFpcCsr(void);
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_INTERNAL_REG_H */

View File

@ -0,0 +1,48 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_internal_rsp.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:12 $
*---------------------------------------------------------------------*/
#ifndef _OS_INTERNAL_RSP_H_
#define _OS_INTERNAL_RSP_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* Signal processor interface (Sp) */
extern u32 __osSpGetStatus(void);
extern void __osSpSetStatus(u32);
extern s32 __osSpSetPc(u32);
extern s32 __osSpRawWriteIo(u32, u32);
extern s32 __osSpRawReadIo(u32, u32 *);
extern s32 __osSpRawStartDma(s32, u32, void *, u32);
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_INTERNAL_RSP_H */

View File

@ -0,0 +1,46 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_internal_si.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:13 $
*---------------------------------------------------------------------*/
#ifndef _OS_INTERNAL_SI_H_
#define _OS_INTERNAL_SI_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* Serial interface (Si) */
extern u32 __osSiGetStatus(void);
extern s32 __osSiRawWriteIo(u32, u32);
extern s32 __osSiRawReadIo(u32, u32 *);
extern s32 __osSiRawStartDma(s32, void *);
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_INTERNAL_SI_H */

View File

@ -0,0 +1,43 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_internal_thread.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:13 $
*---------------------------------------------------------------------*/
#ifndef _OS_INTERNAL_THREAD_H_
#define _OS_INTERNAL_THREAD_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* For debugger use */
extern OSThread * __osGetActiveQueue(void);
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_INTERNAL_THREAD_H */

View File

@ -0,0 +1,47 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_internal_tlb.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:14 $
*---------------------------------------------------------------------*/
#ifndef _OS_INTERNAL_TLB_H_
#define _OS_INTERNAL_TLB_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/os.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* Routines for fetch TLB info */
extern u32 __osGetTLBASID(void);
extern u32 __osGetTLBPageMask(s32);
extern u32 __osGetTLBHi(s32);
extern u32 __osGetTLBLo0(s32);
extern u32 __osGetTLBLo1(s32);
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_INTERNAL_TLB_H */

View File

@ -21,15 +21,17 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_libc.h,v $
$Revision: 1.3 $
$Date: 1999/07/13 01:43:47 $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:14 $
*---------------------------------------------------------------------*/
#ifndef _OS_LIBC_H_
#define _OS_LIBC_H_
#include "os_pfs.h"
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
@ -78,7 +80,6 @@ extern "C" {
/* byte string operations */
extern void bcopy(const void *, void *, int);
extern int bcmp(const void *, const void *, int);
extern void bzero(void *, int);

View File

@ -21,7 +21,7 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo. (Originated by SGI)
$RCSfile: os_message.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:15 $
@ -65,10 +65,6 @@ typedef struct OSMesgQueue_s {
OSMesg *msg; /* Points to message buffer array */
} OSMesgQueue;
typedef struct __OSEventState {
OSMesgQueue *messageQueue;
OSMesg message;
} __OSEventState;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
@ -116,17 +112,6 @@ typedef struct __OSEventState {
#define OS_MESG_NOBLOCK 0
#define OS_MESG_BLOCK 1
/*
* I/O message types
*/
#define OS_MESG_TYPE_BASE (10)
#define OS_MESG_TYPE_LOOPBACK (OS_MESG_TYPE_BASE+0)
#define OS_MESG_TYPE_DMAREAD (OS_MESG_TYPE_BASE+1)
#define OS_MESG_TYPE_DMAWRITE (OS_MESG_TYPE_BASE+2)
#define OS_MESG_TYPE_VRETRACE (OS_MESG_TYPE_BASE+3)
#define OS_MESG_TYPE_COUNTER (OS_MESG_TYPE_BASE+4)
#define OS_MESG_TYPE_EDMAREAD (OS_MESG_TYPE_BASE+5)
#define OS_MESG_TYPE_EDMAWRITE (OS_MESG_TYPE_BASE+6)
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)

83
include/PR/os_motor.h Normal file
View File

@ -0,0 +1,83 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo.
$RCSfile: os_motor.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:15 $
*---------------------------------------------------------------------*/
#ifndef _OS_MOTOR_H_
#define _OS_MOTOR_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#include "os_message.h"
#include "os_pfs.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
*
*/
/* Rumble PAK interface */
extern s32 osMotorInit(OSMesgQueue *, OSPfs *, int);
#if 1
#define MOTOR_START 1
#define MOTOR_STOP 0
#define osMotorStart(x) __osMotorAccess((x), MOTOR_START)
#define osMotorStop(x) __osMotorAccess((x), MOTOR_STOP)
extern s32 __osMotorAccess(OSPfs *, s32);
#else
extern s32 osMotorStop(OSPfs *);
extern s32 osMotorStart(OSPfs *);
#endif
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_MOTOR_H_ */

178
include/PR/os_pfs.h Normal file
View File

@ -0,0 +1,178 @@
/*====================================================================
* os_pfs.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_pfs.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:16 $
*---------------------------------------------------------------------*/
#ifndef _OS_PFS_H_
#define _OS_PFS_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 file system
*/
typedef struct {
int status;
OSMesgQueue *queue;
int channel;
u8 id[32];
u8 label[32];
int version;
int dir_size;
int inode_table; /* block location */
int minode_table; /* mirrioring inode_table */
int dir_table; /* block location */
int inode_start_page; /* page # */
u8 banks;
u8 activebank;
} OSPfs;
typedef struct {
u32 file_size; /* bytes */
u32 game_code;
u16 company_code;
char ext_name[4];
char game_name[16];
} OSPfsState;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
/* File System size */
#define OS_PFS_VERSION 0x0200
#define OS_PFS_VERSION_HI (OS_PFS_VERSION >> 8)
#define OS_PFS_VERSION_LO (OS_PFS_VERSION & 255)
#define PFS_FILE_NAME_LEN 16
#define PFS_FILE_EXT_LEN 4
#define BLOCKSIZE 32 /* bytes */
#define PFS_ONE_PAGE 8 /* blocks */
#define PFS_MAX_BANKS 62
/* File System flag */
#define PFS_READ 0
#define PFS_WRITE 1
#define PFS_CREATE 2
/* File System status */
#define PFS_INITIALIZED 0x1
#define PFS_CORRUPTED 0x2 /* File system was corrupted */
#define PFS_ID_BROKEN 0x4
#define PFS_MOTOR_INITIALIZED 0x8
#define PFS_GBPAK_INITIALIZED 0x10
/* File System error number */
#define PFS_ERR_NOPACK 1 /* no memory card is plugged or */
#define PFS_ERR_NEW_PACK 2 /* ram pack has been changed to a */
/* different one */
#define PFS_ERR_INCONSISTENT 3 /* need to run Pfschecker */
#define PFS_ERR_CONTRFAIL CONT_OVERRUN_ERROR
#define PFS_ERR_INVALID 5 /* invalid parameter or file not exist*/
#define PFS_ERR_BAD_DATA 6 /* the data read from pack are bad*/
#define PFS_DATA_FULL 7 /* no free pages on ram pack */
#define PFS_DIR_FULL 8 /* no free directories on ram pack*/
#define PFS_ERR_EXIST 9 /* file exists */
#define PFS_ERR_ID_FATAL 10 /* dead ram pack */
#define PFS_ERR_DEVICE 11 /* wrong device type*/
#define PFS_ERR_NO_GBCART 12 /* no gb cartridge (64GB-PAK) */
#define PFS_ERR_NEW_GBCART 13 /* gb cartridge may be changed */
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* file system interface */
#if VERSION >= VERSION_NTSC_1_0
s32 osPfsInitPak(OSMesgQueue *queue, OSPfs *pfs, s32 channel, s32 *arg3);
#else
s32 osPfsInitPak(OSMesgQueue *queue, OSPfs *pfs, s32 channel);
#endif
extern s32 osPfsRepairId(OSPfs *);
extern s32 osPfsInit(OSMesgQueue *, OSPfs *, int);
extern s32 osPfsReFormat(OSPfs *, OSMesgQueue *, int);
extern s32 osPfsChecker(OSPfs *);
extern s32 osPfsAllocateFile(OSPfs *, u16, u32, u8 *, u8 *, int, s32 *);
extern s32 osPfsFindFile(OSPfs *, u16, u32, u8 *, u8 *, s32 *);
extern s32 osPfsDeleteFile(OSPfs *, u16, u32, u8 *, u8 *);
extern s32 osPfsReadWriteFile(OSPfs *, s32, u8, int, int, u8 *);
extern s32 osPfsFileState(OSPfs *, s32, OSPfsState *);
extern s32 osPfsGetLabel(OSPfs *, u8 *, int *);
extern s32 osPfsSetLabel(OSPfs *, u8 *);
extern s32 osPfsIsPlug(OSMesgQueue *, u8 *);
extern s32 osPfsFreeBlocks(OSPfs *, s32 *);
extern s32 osPfsNumFiles(OSPfs *, s32 *, s32 *);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_PFS_H_ */

224
include/PR/os_pi.h Normal file
View File

@ -0,0 +1,224 @@
/*====================================================================
* os_pi.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_pi.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:16 $
*---------------------------------------------------------------------*/
#ifndef _OS_PI_H_
#define _OS_PI_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#include "os_thread.h"
#include "os_message.h"
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
/*
* Structure for Enhanced PI interface
*/
/*
* OSTranxInfo is set up for Leo Disk DMA. This info will be maintained
* by exception handler. This is how the PIMGR and the ISR communicate.
*/
typedef struct {
u32 errStatus; /* error status */
void *dramAddr; /* RDRAM buffer address (DMA) */
void *C2Addr; /* C2 buffer address */
u32 sectorSize; /* size of transfering sector */
u32 C1ErrNum; /* total # of C1 errors */
u32 C1ErrSector[4]; /* error sectors */
} __OSBlockInfo;
typedef struct {
u32 cmdType; /* for disk only */
u16 transferMode; /* Block, Track, or sector? */
u16 blockNum; /* which block is transfering */
s32 sectorNum; /* which sector is transfering */
u32 devAddr; /* Device buffer address */
u32 bmCtlShadow; /* asic bm_ctl(510) register shadow ram */
u32 seqCtlShadow; /* asic seq_ctl(518) register shadow ram */
__OSBlockInfo block[2]; /* bolck transfer info */
} __OSTranxInfo;
typedef struct OSPiHandle_s {
struct OSPiHandle_s *next; /* point to next handle on the table */
u8 type; /* DEVICE_TYPE_BULK for disk */
u8 latency; /* domain latency */
u8 pageSize; /* domain page size */
u8 relDuration; /* domain release duration */
u8 pulse; /* domain pulse width */
u8 domain; /* which domain */
u32 baseAddress; /* Domain address */
u32 speed; /* for roms only */
/* The following are "private" elements" */
__OSTranxInfo transferInfo; /* for disk only */
} OSPiHandle;
typedef struct {
u8 type;
u32 address;
} OSPiInfo;
/*
* Structure for I/O message block
*/
typedef struct {
u16 type; /* Message type */
u8 pri; /* Message priority (High or Normal) */
u8 status; /* Return status */
OSMesgQueue *retQueue; /* Return message queue to notify I/O
* completion */
} OSIoMesgHdr;
typedef struct {
OSIoMesgHdr hdr; /* Message header */
void * dramAddr; /* RDRAM buffer address (DMA) */
u32 devAddr; /* Device buffer address (DMA) */
u32 size; /* DMA transfer size in bytes */
OSPiHandle *piHandle; /* PI device handle */
} OSIoMesg;
/*
* Structure for device manager block
*/
typedef struct {
s32 active; /* Status flag */
OSThread *thread; /* Calling thread */
OSMesgQueue *cmdQueue; /* Command queue */
OSMesgQueue *evtQueue; /* Event queue */
OSMesgQueue *acsQueue; /* Access queue */
/* Raw DMA routine */
s32 (*dma)(s32, u32, void *, u32);
s32 (*edma)(OSPiHandle *, s32, u32, void *, u32);
} OSDevMgr;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
/* Flags to indicate direction of data transfer */
#define OS_READ 0 /* device -> RDRAM */
#define OS_WRITE 1 /* device <- RDRAM */
#define OS_OTHERS 2 /* for Leo disk only */
/*
* I/O message types
*/
#define OS_MESG_TYPE_BASE (10)
#define OS_MESG_TYPE_LOOPBACK (OS_MESG_TYPE_BASE+0)
#define OS_MESG_TYPE_DMAREAD (OS_MESG_TYPE_BASE+1)
#define OS_MESG_TYPE_DMAWRITE (OS_MESG_TYPE_BASE+2)
#define OS_MESG_TYPE_VRETRACE (OS_MESG_TYPE_BASE+3)
#define OS_MESG_TYPE_COUNTER (OS_MESG_TYPE_BASE+4)
#define OS_MESG_TYPE_EDMAREAD (OS_MESG_TYPE_BASE+5)
#define OS_MESG_TYPE_EDMAWRITE (OS_MESG_TYPE_BASE+6)
/*
* I/O message priority
*/
#define OS_MESG_PRI_NORMAL 0
#define OS_MESG_PRI_HIGH 1
/*
* PI/EPI
*/
#define PI_DOMAIN1 0
#define PI_DOMAIN2 1
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
extern OSPiHandle *__osPiTable; /* The head of OSPiHandle link list */
/**************************************************************************
*
* Function prototypes
*
*/
/* Peripheral interface (Pi) */
extern u32 osPiGetStatus(void);
extern s32 osPiGetDeviceType(void);
extern s32 osPiWriteIo(u32, u32);
extern s32 osPiReadIo(u32, u32 *);
extern s32 osPiStartDma(OSIoMesg *, s32, s32, u32, void *, u32,
OSMesgQueue *);
extern void osCreatePiManager(OSPri, OSMesgQueue *, OSMesg *, s32);
/* Enhanced PI interface */
extern OSPiHandle *osCartRomInit(void);
extern OSPiHandle *osLeoDiskInit(void);
extern OSPiHandle *osDriveRomInit(void);
extern s32 osEPiDeviceType(OSPiHandle *, OSPiInfo *);
extern s32 osEPiWriteIo(OSPiHandle *, u32 , u32 );
extern s32 osEPiReadIo(OSPiHandle *, u32 , u32 *);
extern s32 osEPiStartDma(OSPiHandle *, OSIoMesg *, s32);
extern s32 osEPiLinkHandle(OSPiHandle *);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_PI_H_ */

90
include/PR/os_reg.h Normal file
View File

@ -0,0 +1,90 @@
/*====================================================================
* os_reg.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_reg.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:17 $
*---------------------------------------------------------------------*/
#ifndef _OS_REG_H_
#define _OS_REG_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
*
*/
/* Miscellaneous operations */
extern u32 osGetCount(void);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_REG_H_ */

86
include/PR/os_rsp.h Normal file
View File

@ -0,0 +1,86 @@
/*====================================================================
* os_rsp.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_rsp.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:17 $
*---------------------------------------------------------------------*/
#ifndef _OS_RSP_H_
#define _OS_RSP_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
*
*/
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_RSP_H_ */

86
include/PR/os_si.h Normal file
View File

@ -0,0 +1,86 @@
/*====================================================================
* os_si.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_si.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:18 $
*---------------------------------------------------------------------*/
#ifndef _OS_SI_H_
#define _OS_SI_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
*
*/
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_SI_H_ */

118
include/PR/os_system.h Normal file
View File

@ -0,0 +1,118 @@
/*====================================================================
* os_system.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_system.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:18 $
*---------------------------------------------------------------------*/
#ifndef _OS_SYSTEM_H_
#define _OS_SYSTEM_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
*
*/
/*
* Values for osTvType
*/
#define OS_TV_PAL 0
#define OS_TV_NTSC 1
#define OS_TV_MPAL 2
/*
* Size of buffer the retains contents after NMI
*/
#define OS_APP_NMI_BUFSIZE 64
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
extern s32 osRomType; /* Bulk or cartridge ROM. 0=cartridge 1=bulk */
extern void *osRomBase; /* Rom base address of the game image */
extern s32 osTvType; /* 0 = PAL, 1 = NTSC, 2 = MPAL */
extern s32 osResetType; /* 0 = cold reset, 1 = NMI */
extern s32 osCicId;
extern s32 osVersion;
extern u32 osMemSize; /* Memory Size */
extern s32 osAppNMIBuffer[];
extern u64 osClockRate;
extern OSIntMask __OSGlobalIntMask; /* global interrupt mask */
/**************************************************************************
*
* Function prototypes
*
*/
extern void osInitialize(void);
extern void osExit(void);
extern u32 osGetMemSize(void);
/* pre-NMI */
extern s32 osAfterPreNMI(void);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_SYSTEM_H_ */

152
include/PR/os_thread.h Normal file
View File

@ -0,0 +1,152 @@
/*====================================================================
* os_thread.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_thread.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:19 $
*---------------------------------------------------------------------*/
#ifndef _OS_THREAD_H_
#define _OS_THREAD_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 s32 OSPri;
typedef s32 OSId;
typedef union
{
struct {
f32 f_odd2;
f32 f_odd;
f32 f_even2;
f32 f_even;
} f;
} __OSfp;
typedef struct {
u64 at, v0, v1, a0, a1, a2, a3;
u64 t0, t1, t2, t3, t4, t5, t6, t7;
u64 s0, s1, s2, s3, s4, s5, s6, s7;
u64 t8, t9, gp, sp, s8, ra;
u64 lo, hi;
u32 sr, pc, cause, badvaddr, rcp;
u32 fpcsr;
__OSfp fp0, fp2, fp4, fp6, fp8, fp10, fp12, fp14;
__OSfp fp16, fp18, fp20, fp22, fp24, fp26, fp28, fp30;
} __OSThreadContext;
typedef struct OSThread_s {
struct OSThread_s *next; /* run/mesg queue link */
OSPri priority; /* run/mesg queue priority */
struct OSThread_s **queue; /* queue thread is on */
struct OSThread_s *tlnext; /* all threads queue link */
u16 state; /* OS_STATE_* */
u16 flags; /* flags for rmon */
OSId id; /* id for debugging */
int fp; /* thread has used fp unit */
__OSThreadContext context; /* register/interrupt mask */
} OSThread;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
/* Thread states */
#define OS_STATE_STOPPED 1
#define OS_STATE_RUNNABLE 2
#define OS_STATE_RUNNING 4
#define OS_STATE_WAITING 8
/* Recommended thread priorities for the system threads */
#define OS_PRIORITY_MAX 255
#define OS_PRIORITY_VIMGR 254
#define OS_PRIORITY_RMON 250
#define OS_PRIORITY_RMONSPIN 200
#define OS_PRIORITY_PIMGR 150
#define OS_PRIORITY_SIMGR 140
#define OS_PRIORITY_APPMAX 127
#define OS_PRIORITY_IDLE 0 /* Must be 0 */
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* Thread operations */
extern void osCreateThread(OSThread *, OSId, void (*)(void *),
void *, void *, OSPri);
extern void osDestroyThread(OSThread *);
extern void osYieldThread(void);
extern void osStartThread(OSThread *);
extern void osStopThread(OSThread *);
extern OSId osGetThreadId(OSThread *);
extern void osSetThreadPri(OSThread *, OSPri);
extern OSPri osGetThreadPri(OSThread *);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_THREAD_H_ */

114
include/PR/os_time.h Normal file
View File

@ -0,0 +1,114 @@
/*====================================================================
* os_time.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_time.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:19 $
*---------------------------------------------------------------------*/
#ifndef _OS_TIME_H_
#define _OS_TIME_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 time value
*/
typedef u64 OSTime;
/*
* Structure for interval timer
*/
typedef struct OSTimer_s {
struct OSTimer_s *next; /* point to next timer in list */
struct OSTimer_s *prev; /* point to previous timer in list */
OSTime interval; /* duration set by user */
OSTime value; /* time remaining before */
/* timer fires */
OSMesgQueue *mq; /* Message Queue */
OSMesg msg; /* Message to send */
} OSTimer;
#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
*
*/
/* Timer interface */
extern OSTime osGetTime(void);
extern void osSetTime(OSTime);
extern int osSetTimer(OSTimer *, OSTime, OSTime,
OSMesgQueue *, OSMesg);
extern int osStopTimer(OSTimer *);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_TIME_H_ */

16
include/PR/os_version.h Normal file
View File

@ -0,0 +1,16 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo.
$RCSfile: os_version.h,v $
$Revision: 1.1 $
$Date: 1999/01/18 13:17:45 $
*---------------------------------------------------------------------*/
#ifndef _OS_VERSION_H_
#define _OS_VERSION_H_
#define OS_MAJOR_VERSION "2.0J" /* major version */
#define OS_MINOR_VERSION 0 /* patch level */
#endif /* !_OS_VERSION_H_ */

298
include/PR/os_vi.h Normal file
View File

@ -0,0 +1,298 @@
/*====================================================================
* os_vi.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_vi.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:20 $
*---------------------------------------------------------------------*/
#ifndef _OS_VI_H_
#define _OS_VI_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#include "os_thread.h"
#include "os_message.h"
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
/*
* Structure to store VI register values that remain the same between 2 fields
*/
typedef struct {
u32 ctrl;
u32 width;
u32 burst;
u32 vSync;
u32 hSync;
u32 leap;
u32 hStart;
u32 xScale;
u32 vCurrent;
} OSViCommonRegs;
/*
* Structure to store VI register values that change between fields
*/
typedef struct {
u32 origin;
u32 yScale;
u32 vStart;
u32 vBurst;
u32 vIntr;
} OSViFieldRegs;
/*
* Structure for VI mode
*/
typedef struct {
u8 type; /* Mode type */
OSViCommonRegs comRegs; /* Common registers for both fields */
OSViFieldRegs fldRegs[2]; /* Registers for Field 1 & 2 */
} OSViMode;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
/*
* Video Interface (VI) mode type
*/
#define OS_VI_NTSC_LPN1 0 /* NTSC */
#define OS_VI_NTSC_LPF1 1
#define OS_VI_NTSC_LAN1 2
#define OS_VI_NTSC_LAF1 3
#define OS_VI_NTSC_LPN2 4
#define OS_VI_NTSC_LPF2 5
#define OS_VI_NTSC_LAN2 6
#define OS_VI_NTSC_LAF2 7
#define OS_VI_NTSC_HPN1 8
#define OS_VI_NTSC_HPF1 9
#define OS_VI_NTSC_HAN1 10
#define OS_VI_NTSC_HAF1 11
#define OS_VI_NTSC_HPN2 12
#define OS_VI_NTSC_HPF2 13
#define OS_VI_PAL_LPN1 14 /* PAL */
#define OS_VI_PAL_LPF1 15
#define OS_VI_PAL_LAN1 16
#define OS_VI_PAL_LAF1 17
#define OS_VI_PAL_LPN2 18
#define OS_VI_PAL_LPF2 19
#define OS_VI_PAL_LAN2 20
#define OS_VI_PAL_LAF2 21
#define OS_VI_PAL_HPN1 22
#define OS_VI_PAL_HPF1 23
#define OS_VI_PAL_HAN1 24
#define OS_VI_PAL_HAF1 25
#define OS_VI_PAL_HPN2 26
#define OS_VI_PAL_HPF2 27
#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
/*
* Video Interface (VI) special features
*/
#define OS_VI_GAMMA_ON 0x0001
#define OS_VI_GAMMA_OFF 0x0002
#define OS_VI_GAMMA_DITHER_ON 0x0004
#define OS_VI_GAMMA_DITHER_OFF 0x0008
#define OS_VI_DIVOT_ON 0x0010
#define OS_VI_DIVOT_OFF 0x0020
#define OS_VI_DITHER_FILTER_ON 0x0040
#define OS_VI_DITHER_FILTER_OFF 0x0080
/*
* Video Interface (VI) mode attribute bit
*/
#define OS_VI_BIT_NONINTERLACE 0x0001 /* lo-res */
#define OS_VI_BIT_INTERLACE 0x0002 /* lo-res */
#define OS_VI_BIT_NORMALINTERLACE 0x0004 /* hi-res */
#define OS_VI_BIT_DEFLICKINTERLACE 0x0008 /* hi-res */
#define OS_VI_BIT_ANTIALIAS 0x0010
#define OS_VI_BIT_POINTSAMPLE 0x0020
#define OS_VI_BIT_16PIXEL 0x0040
#define OS_VI_BIT_32PIXEL 0x0080
#define OS_VI_BIT_LORES 0x0100
#define OS_VI_BIT_HIRES 0x0200
#define OS_VI_BIT_NTSC 0x0400
#define OS_VI_BIT_PAL 0x0800
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
extern OSViMode osViModeTable[]; /* Global VI mode table */
extern OSViMode osViModeNtscLpn1; /* Individual VI NTSC modes */
extern OSViMode osViModeNtscLpf1;
extern OSViMode osViModeNtscLan1;
extern OSViMode osViModeNtscLaf1;
extern OSViMode osViModeNtscLpn2;
extern OSViMode osViModeNtscLpf2;
extern OSViMode osViModeNtscLan2;
extern OSViMode osViModeNtscLaf2;
extern OSViMode osViModeNtscHpn1;
extern OSViMode osViModeNtscHpf1;
extern OSViMode osViModeNtscHan1;
extern OSViMode osViModeNtscHaf1;
extern OSViMode osViModeNtscHpn2;
extern OSViMode osViModeNtscHpf2;
extern OSViMode osViModePalLpn1; /* Individual VI PAL modes */
extern OSViMode osViModePalLpf1;
extern OSViMode osViModePalLan1;
extern OSViMode osViModePalLaf1;
extern OSViMode osViModePalLpn2;
extern OSViMode osViModePalLpf2;
extern OSViMode osViModePalLan2;
extern OSViMode osViModePalLaf2;
extern OSViMode osViModePalHpn1;
extern OSViMode osViModePalHpf1;
extern OSViMode osViModePalHan1;
extern OSViMode osViModePalHaf1;
extern OSViMode osViModePalHpn2;
extern OSViMode osViModePalHpf2;
extern OSViMode osViModeMpalLpn1; /* Individual VI MPAL modes */
extern OSViMode osViModeMpalLpf1;
extern OSViMode osViModeMpalLan1;
extern OSViMode osViModeMpalLaf1;
extern OSViMode osViModeMpalLpn2;
extern OSViMode osViModeMpalLpf2;
extern OSViMode osViModeMpalLan2;
extern OSViMode osViModeMpalLaf2;
extern OSViMode osViModeMpalHpn1;
extern OSViMode osViModeMpalHpf1;
extern OSViMode osViModeMpalHan1;
extern OSViMode osViModeMpalHaf1;
extern OSViMode osViModeMpalHpn2;
extern OSViMode osViModeMpalHpf2;
extern OSViMode osViModeFpalLpn1; /* Individual VI FPAL modes */
extern OSViMode osViModeFpalLpf1;
extern OSViMode osViModeFpalLan1;
extern OSViMode osViModeFpalLaf1;
extern OSViMode osViModeFpalLpn2;
extern OSViMode osViModeFpalLpf2;
extern OSViMode osViModeFpalLan2;
extern OSViMode osViModeFpalLaf2;
extern OSViMode osViModeFpalHpn1;
extern OSViMode osViModeFpalHpf1;
extern OSViMode osViModeFpalHan1;
extern OSViMode osViModeFpalHaf1;
extern OSViMode osViModeFpalHpn2;
extern OSViMode osViModeFpalHpf2;
/**************************************************************************
*
* Function prototypes
*
*/
/* Video interface (Vi) */
extern u32 osViGetStatus(void);
extern u32 osViGetCurrentMode(void);
extern u32 osViGetCurrentLine(void);
extern u32 osViGetCurrentField(void);
extern void *osViGetCurrentFramebuffer(void);
extern void *osViGetNextFramebuffer(void);
extern void osViSetXScale(f32);
extern void osViSetYScale(f32);
extern void osViExtendVStart(u32);
extern void osViSetSpecialFeatures(u32);
extern void osViSetMode(OSViMode *);
extern void osViSetEvent(OSMesgQueue *, OSMesg, u32);
extern void osViSwapBuffer(void *);
extern void osViBlack(u8);
extern void osViFade(u8, u16);
extern void osViRepeatLine(u8);
extern void osCreateViManager(OSPri);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_VI_H_ */

108
include/PR/os_voice.h Normal file
View File

@ -0,0 +1,108 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998 Nintendo.
$RCSfile: os_voice.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:21 $
*---------------------------------------------------------------------*/
#ifndef _OS_VOICE_H_
#define _OS_VOICE_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 struct { /* Voice Recognition System */
OSMesgQueue *__mq; /* SI Message Queue */
int __channel; /* Controller Port # */
s32 __mode;
u8 cmd_status; /* Command Status */
} OSVoiceHandle;
typedef struct { /* Voice Recognition System */
u16 warning;
u16 answer_num; /* 0¡Á5 */
u16 voice_level;
u16 voice_sn;
u16 voice_time;
u16 answer[5];
u16 distance[5];
} OSVoiceData;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/**************************************************************************
*
* Global definitions
*
*/
/* definition for Voice Recognition System */
#define VOICE_WARN_TOO_SMALL 0x0400
#define VOICE_WARN_TOO_LARGE 0x0800
#define VOICE_WARN_NOT_FIT 0x4000
#define VOICE_WARN_TOO_NOISY 0x8000
#define VOICE_STATUS_READY 0
#define VOICE_STATUS_START 1
#define VOICE_STATUS_CANCEL 3
#define VOICE_STATUS_BUSY 5
#define VOICE_STATUS_END 7
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/* Voice Recognition System */
extern s32 osVoiceInit(OSMesgQueue *, OSVoiceHandle *, int);
extern s32 osVoiceCheckWord(u8 *data);
extern s32 osVoiceClearDictionary(OSVoiceHandle *, u8);
extern s32 osVoiceControlGain(OSVoiceHandle *, s32, s32);
extern s32 osVoiceSetWord(OSVoiceHandle *, u8 *);
extern s32 osVoiceStartReadData(OSVoiceHandle *);
extern s32 osVoiceStopReadData(OSVoiceHandle *);
extern s32 osVoiceGetReadData(OSVoiceHandle *, OSVoiceData *);
extern s32 osVoiceMaskDictionary(OSVoiceHandle *, u8 *, int);
extern void osVoiceCountSyllables(u8 *, u32 *);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_VOICE_H_ */

113
include/PR/ramrom.h Normal file
View File

@ -0,0 +1,113 @@
#ifndef _RAMROM_H
#define _RAMROM_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.20 $
* $Date: 1997/02/11 08:26:47 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ramrom.h,v $
*
**************************************************************************/
/*
* Defines for the GIO card in the Nintendo Development Station
*
* The RAM on the GIO card acts as ROM for the game
* Interrupts available between the game and the Indy host
*
* The last part of the ramrom is used for communication between
* game and host. There are 6 4K buffers defined:
* log, printf, rmon to indy, rmon from indy, app to indy, app from indy
* The last 8 bytes of the buffer are used in the emulator environment
*/
#define RAMROM_SIZE (0x1000000)
#define RAMROM_BUF_SIZE (4096)
#define RAMROM_MSG_SIZE (RAMROM_BUF_SIZE*6)
#define RAMROM_MSG_ADDR (RAMROM_SIZE - RAMROM_MSG_SIZE)
#define RAMROM_MSG_HDR_SIZE (3*sizeof(long))
#define RAMROM_USER_DATA_SIZE (RAMROM_MSG_SIZE-RAMROM_MSG_HDR_SIZE)
#define RAMROM_APP_READ_ADDR (RAMROM_MSG_ADDR + (0*RAMROM_BUF_SIZE))
#define RAMROM_APP_WRITE_ADDR (RAMROM_MSG_ADDR + (1*RAMROM_BUF_SIZE))
#define RAMROM_RMON_READ_ADDR (RAMROM_MSG_ADDR + (2*RAMROM_BUF_SIZE))
#define RAMROM_RMON_WRITE_ADDR (RAMROM_MSG_ADDR + (3*RAMROM_BUF_SIZE))
#define RAMROM_PRINTF_ADDR (RAMROM_MSG_ADDR + (4*RAMROM_BUF_SIZE))
#define RAMROM_LOG_ADDR (RAMROM_MSG_ADDR + (5*RAMROM_BUF_SIZE))
/*#define RAMROM_GIO_INTERRUPT (RAMROM_MSG_ADDR + RAMROM_MSG_SIZE - 4)*/
/*
* For the initial round of PIF bringup, we will load in a bootstrap loader
* 0x400 bytes into the ramrom, and the rom will be loaded at 0x2000
*/
#ifndef _HW_VERSION_1
#define RAMROM_BOOTSTRAP_OFFSET 0x40
#define RAMROM_GAME_OFFSET 0x1000
#define RAMROM_FONTDATA_OFFSET 0xb70
#define RAMROM_FONTDATA_SIZE 1152
#else
#define RAMROM_BOOTSTRAP_OFFSET 0x400
#define RAMROM_GAME_OFFSET 0x2000
#endif
#define RAMROM_CLOCKRATE_OFFSET 0x4
#define RAMROM_CLOCKRATE_MASK 0xfffffff0
#define RAMROM_BOOTADDR_OFFSET 0x8
#define RAMROM_RELEASE_OFFSET 0xc
/*
* Second version of the PIF jumps to location 0x1000, and we'll put a jump to
* location 0x400 into the ramrom (for backwards compatibility).
*/
#define RAMROM_PIF2BOOTSTRAP_OFFSET 0x1000
typedef struct {
long type;
long length; /* in bytes of userdata */
long magic;
char userdata[RAMROM_USER_DATA_SIZE];
} RamRomBuffer;
/*
* Interrupt values (must fit in 6 bits!)
* values are used for both request & response
* Transactions initiated by the host start with HOST
* and those initiated by the target start with GAME.
*/
#define HOST_PIACCESS_REQ 1
#define HOST_DBG_CMD_READY 2
#define GAME_DBG_DATA_SEND 3
#define HOST_DBG_DATA_ACK 4
#define GAME_PRINTF_SEND 5
#define HOST_PRINTF_ACK 6
#define GAME_LOG_SEND 7
#define HOST_LOG_ACK 8
#define HOST_APP_CMD_READY 9
#define GAME_APP_DATA_READY 10
#define HOST_PROF_REQ 11
#define GAME_PROF_SEND 12
#define HOST_PROF_ACK 13
#define GAME_FAULT_SEND 14
#define HOST_FAULT_ACK 15
#define GAME_EXIT 16
#define HOST_DATA_ACK 17
#ifdef _EMULATOR
void __RamRomInit(int key, void *romaddr);
void __RamRomDestroy(int key);
#endif /* _EMULATOR */
#endif /* !_RAMROM_H */

8
src/include/PR/rcp.h → include/PR/rcp.h Executable file → Normal file
View File

@ -18,9 +18,9 @@
* File: rcp.h
*
* This file contains register and bit definitions for RCP memory map.
* $Revision: 1.20 $
* $Date: 1997/07/23 08:35:21 $
* $Source: /disk6/Master/cvsmdev2/PR/include/rcp.h,v $
* $Revision: 1.21 $
* $Date: 1998/07/31 11:08:29 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/rcp.h,v $
*
**************************************************************************/
@ -161,6 +161,8 @@ The Indy development board use cartridge domain 1:
#define DEVICE_TYPE_BULK 1 /* ROM bulk */
#define DEVICE_TYPE_64DD 2 /* 64 Disk Drive */
#define DEVICE_TYPE_SRAM 3 /* SRAM */
/* 4-6 are reserved */
#define DEVICE_TYPE_INIT 7 /* initial value */
/*************************************************************************
* SP Memory

93
include/PR/rdb.h Normal file
View File

@ -0,0 +1,93 @@
/**************************************************************************
*
* $Revision: 1.6 $
* $Date: 1997/02/11 08:29:31 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/rdb.h,v $
*
**************************************************************************/
#ifndef _RDB_H
#define _RDB_H
/* U64 side address */
#define RDB_BASE_REG 0xc0000000
#define RDB_WRITE_INTR_REG (RDB_BASE_REG + 0x8)
#define RDB_READ_INTR_REG (RDB_BASE_REG + 0xc)
#define RDB_BASE_VIRTUAL_ADDR 0x80000000
/* packet type Have six bits, so can have up to 63 types */
#define RDB_TYPE_INVALID 0
#define RDB_TYPE_GtoH_PRINT 1
#define RDB_TYPE_GtoH_FAULT 2
#define RDB_TYPE_GtoH_LOG_CT 3
#define RDB_TYPE_GtoH_LOG 4
#define RDB_TYPE_GtoH_READY_FOR_DATA 5
#define RDB_TYPE_GtoH_DATA_CT 6
#define RDB_TYPE_GtoH_DATA 7
#define RDB_TYPE_GtoH_DEBUG 8
#define RDB_TYPE_GtoH_RAMROM 9
#define RDB_TYPE_GtoH_DEBUG_DONE 10
#define RDB_TYPE_GtoH_DEBUG_READY 11
#define RDB_TYPE_GtoH_KDEBUG 12
#define RDB_TYPE_GtoH_PROF_DATA 22
#define RDB_TYPE_HtoG_LOG_DONE 13
#define RDB_TYPE_HtoG_DEBUG 14
#define RDB_TYPE_HtoG_DEBUG_CT 15
#define RDB_TYPE_HtoG_DATA 16
#define RDB_TYPE_HtoG_DATA_DONE 17
#define RDB_TYPE_HtoG_REQ_RAMROM 18
#define RDB_TYPE_HtoG_FREE_RAMROM 19
#define RDB_TYPE_HtoG_KDEBUG 20
#define RDB_TYPE_HtoG_PROF_SIGNAL 21
#define RDB_PROF_ACK_SIG 1
#define RDB_PROF_FLUSH_SIG 2
#define PROF_BLOCK_SIZE 2048
#define RDB_LOG_MAX_BLOCK_SIZE 0x8000
#define RDB_DATA_MAX_BLOCK_SIZE 0x8000
/* GIO side address */
#define GIO_RDB_BASE_REG 0xbf480000
#define GIO_RDB_WRITE_INTR_REG (GIO_RDB_BASE_REG + 0x8)
#define GIO_RDB_READ_INTR_REG (GIO_RDB_BASE_REG + 0xc)
/* minor device number */
#define GIO_RDB_PRINT_MINOR 1
#define GIO_RDB_DEBUG_MINOR 2
/* interrupt bit */
#define GIO_RDB_WRITE_INTR_BIT 0x80000000
#define GIO_RDB_READ_INTR_BIT 0x40000000
/* debug command */
#define DEBUG_COMMAND_NULL 0
#define DEBUG_COMMAND_MEMORY 1
#define DEBUG_COMMAND_REGISTER 2
#define DEBUG_COMMAND_INVALID 255
/* debug state */
#define DEBUG_STATE_NULL 0
#define DEBUG_STATE_RECEIVE 1
#define DEBUG_STATE_INVALID 255
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* Structure for debug port */
typedef struct {
unsigned type : 6; /* 0: invalid, 1: print, 2: debug */
unsigned length : 2; /* 1, 2, or 3 */
char buf[3]; /* character buffer */
} rdbPacket;
extern unsigned int __osRdbWriteOK;
extern unsigned int __osRdbSendMessage;
#endif /* _LANGUAGE_C */
#endif /* !_RDB_H */

123
include/PR/region.h Normal file
View File

@ -0,0 +1,123 @@
/**************************************************************************
* *
* 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. *
* *
**************************************************************************/
/**************************************************************************
*
* Module: region.h
*
* $Revision: 1.8 $
* $Date: 1997/11/26 00:30:56 $
* $Author: mitu $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/region.h,v $
*
* Description:
* This file contains macros and structure definitions for the region
* library.
*
**************************************************************************/
#ifndef _REGION_H_
#define _REGION_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
/***************************************
*
* Global defines
*
*/
/* Alignment sizes */
#define ALIGNSZ (sizeof(long long)) /* 8 bytes */
#define ALIGNOFFST (ALIGNSZ-1)
/* size for storing index to free buffer */
#define BUF_CTRL_SIZE ALIGNSZ
/* Max bufcount = 32K */
#define MAX_BUFCOUNT 0x8000
/* code for last free buffer */
#define BUF_FREE_WO_NEXT 0x8000
/*
* Global defines for alignment size (default is 8-byte alignment)
*/
#define OS_RG_ALIGN_2B 2 /* 2 bytes = 16-bit alignment */
#define OS_RG_ALIGN_4B 4 /* 4 bytes = 32-bit alignment */
#define OS_RG_ALIGN_8B 8 /* 8 bytes = 64-bit alignment */
#define OS_RG_ALIGN_16B 16 /* 16 bytes = 128-bit alignment */
#define OS_RG_ALIGN_DEFAULT OS_RG_ALIGN_8B
/***************************************
*
* Macro definitions
*
*/
/* Perform alignment on input 's' */
#define ALIGN(s, align) (((u32)(s) + ((align)-1)) & ~((align)-1))
/***************************************
*
* Typedefs & structure definitions
*
*/
/*
* Structure for region header/control area
*/
typedef struct _Region_s {
u8 *r_startBufferAddress; /* start address to data buffer */
u8 *r_endAddress; /* end address of region */
s32 r_bufferSize; /* size of buffers for this region */
s32 r_bufferCount; /* up to 32K entries; MSB is used for
setting end-of-list/used */
u16 r_freeList; /* point to array index of first
available memory buffer */
u16 r_alignSize; /* alignment size (# of bytes) */
} OSRegion;
/*
* Macro to simplify accessing region header structure
*/
#define RP(x) rp->r_##x
/***************************************
*
* Function prototypes
*
*/
extern void *osCreateRegion(void *, u32, u32, u32);
extern void *osMalloc(void *);
extern void osFree(void *, void *);
extern s32 osGetRegionBufCount(void *);
extern s32 osGetRegionBufSize(void *);
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* _REGION_H_ */

39
include/PR/rmon.h Normal file
View File

@ -0,0 +1,39 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/**************************************************************************
*
* $Revision: 1.6 $
* $Date: 1997/02/11 08:30:08 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/rmon.h,v $
*
**************************************************************************/
#ifndef _RMON_H_
#define _RMON_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#define RMON_DBG_BUF_SIZE 2048
#define RMON_STACKSIZE 0x1000
extern void rmonMain( void * );
extern void rmonPrintf( const char *, ... );
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_H */

View File

@ -1,5 +1,36 @@
#ifndef _ULTRA64_SCHED_H_
#define _ULTRA64_SCHED_H_
/*====================================================================
* sched.h
*
* Synopsis:
*
* Copyright 1993, 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.
*====================================================================*/
/**************************************************************************
*
* $Revision: 1.7 $
* $Date: 1997/02/11 08:32:02 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/sched.h,v $
*
**************************************************************************/
#ifndef __sched__
#define __sched__
#include <ultra64.h>
#define OS_SC_STACKSIZE 0x2000
@ -39,30 +70,6 @@ typedef struct OSScTask_s {
#define OS_SC_RCP_MASK 0x0003 /* mask for needs bits */
#define OS_SC_TYPE_MASK 0x0007 /* complete type mask */
#define OS_SC_DP 0x0001 /* set if still needs dp */
#define OS_SC_SP 0x0002 /* set if still needs sp */
#define OS_SC_YIELD 0x0010 /* set if yield requested */
#define OS_SC_YIELDED 0x0020 /* set if yield completed */
/*
* OSScTask->flags type identifier
*/
#define OS_SC_XBUS (OS_SC_SP | OS_SC_DP)
#define OS_SC_DRAM (OS_SC_SP | OS_SC_DP | OS_SC_DRAM_DLIST)
#define OS_SC_DP_XBUS (OS_SC_SP)
#define OS_SC_DP_DRAM (OS_SC_SP | OS_SC_DRAM_DLIST)
#define OS_SC_SP_XBUS (OS_SC_DP)
#define OS_SC_SP_DRAM (OS_SC_DP | OS_SC_DRAM_DLIST)
/*
* private typedefs and defines
*/
#define VIDEO_MSG 666
#define RSP_DONE_MSG 667
#define RDP_DONE_MSG 668
#define PRE_NMI_MSG 669
/*
* OSScClient:
*
@ -73,6 +80,7 @@ typedef struct OSScTask_s {
typedef struct SCClient_s {
struct SCClient_s *next; /* next client in the list */
OSMesgQueue *msgQ; /* where to send the frame msg */
s32 is8mb;
} OSScClient;
typedef struct {
@ -94,8 +102,8 @@ typedef struct {
s32 doAudio;
} OSSched;
void osCreateScheduler(OSSched *s, void *stack, u8 mode, u32 numFields);
void osScAddClient(OSSched *sc, OSScClient *c, OSMesgQueue *msgQ, OSScClient *next);
void osCreateScheduler(OSSched *s, OSThread *thread, u8 mode, u32 numFields);
void osScAddClient(OSSched *s, OSScClient *c, OSMesgQueue *msgQ, int is8mb);
void osScRemoveClient(OSSched *s, OSScClient *c);
OSMesgQueue *osScGetCmdQ(OSSched *s);

196
include/PR/sp.h Normal file
View File

@ -0,0 +1,196 @@
/**************************************************************************
* *
* 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. *
* *
**************************************************************************/
/**************************************************************************
*
* Sprite library include file
*
* $Revision: 1.16 $
* $Date: 1998/04/17 05:03:46 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/sp.h,v $
*
**************************************************************************/
#ifndef _SP_H_
#define _SP_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/mbi.h>
#include <PR/ultratypes.h>
struct bitmap {
s16 width; /* Size across to draw in texels */
/* Done if width = 0 */
s16 width_img; /* Size across of bitmap in texels */
/* Done if width = 0 */
s16 s; /* Horizontal offset into bitmap */
/* if (s > width), then load only! */
s16 t; /* Vertical offset into base */
void *buf; /* Pointer to bitmap data */
/* Don't re-load if new buf */
/* is the same as the old one */
/* Skip if NULL */
s16 actualHeight; /* True Height of this bitmap piece */
s16 LUToffset; /* LUT base index */
};
typedef struct bitmap Bitmap;
struct sprite {
s16 x,y; /* Target position */
s16 width, height; /* Target size */
f32 scalex, scaley; /* Texel to Pixel scale factor */
s16 expx, expy; /* Explosion spacing */
u16 attr; /* Attribute Flags */
s16 zdepth; /* Z Depth */
u8 red; /* Red component */
u8 green; /* Green component */
u8 blue; /* Blue component */
u8 alpha; /* Alpha component */
s16 startTLUT; /* Lookup Table Entry Starting index */
s16 nTLUT; /* Total number of Lookup Table Entries */
int *LUT; /* Pointer to Lookup Table */
s16 istart; /* Starting bitmap index */
s16 istep; /* Bitmaps index step (see SP_INCY) */
/* if 0, then variable width bitmaps */
s16 nbitmaps; /* Total number of bitmaps */
s16 ndisplist; /* Total number of display-list words */
s16 bmheight; /* Bitmap Texel height (Used) */
s16 bmHreal; /* Bitmap Texel height (Real) */
u8 bmfmt; /* Bitmap Format */
u8 bmsiz; /* Bitmap Texel Size */
Bitmap *bitmap; /* Pointer to first bitmap */
Gfx *rsp_dl; /* Pointer to RSP display list */
Gfx *rsp_dl_next; /* Pointer to next RSP display entry */
s16 frac_s, /* Fractional Texture offsets */
frac_t; /* These have 5 fraction bits */
};
typedef struct sprite Sprite;
/*
* DANGER!
* This is bad programming. Where the *heck* do these numbers come
* from?
*
* They are obviously 'maximums' from the sprite library, but since
* the sprite library is built on top of gbi.h, which includes macros
* that decode into multiple macros, etc., it is nearly impossible to
* know what these maximums should be.
*
* Worse, there are some gbi macros (texture alignment mostly) that
* decode into *many* macros, so if we choose that as a maximum, we
* are wasting TONS of space...
*
* These numbers work for "reasonable" sprite library usage, and
* there is an assert() in the library to detect when they aren't
* enough. (use the debug version)
*/
#define DL_BM_OVERHEAD (12)
#define DL_SPRITE_OVERHEAD (24)
#define NUM_DL(nb) ((nb)*DL_BM_OVERHEAD +DL_SPRITE_OVERHEAD)
/*
* Misc constants
*/
#ifndef NULL
#define NULL 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
/*
* For sprite->attr
*/
#define SP_TRANSPARENT 0x00000001
#define SP_CUTOUT 0x00000002
#define SP_HIDDEN 0x00000004
#define SP_Z 0x00000008
#define SP_SCALE 0x00000010
#define SP_FASTCOPY 0x00000020
#define SP_OVERLAP 0x00000040
#define SP_TEXSHIFT 0x00000080
#define SP_FRACPOS 0x00000100
#define SP_TEXSHUF 0x00000200
#define SP_EXTERN 0x00000400
/*
* Function wrapper
*/
#if defined(F3DEX_GBI_2)
#define spMove spX2Move
#define spSetZ spX2SetZ
#define spScissor spX2Scissor
#define spDraw spX2Draw
#define spInit spX2Init
#define spFinish spX2Finish
#elif defined(F3DEX_GBI)
#define spMove spXMove
#define spSetZ spXSetZ
#define spScissor spXScissor
#define spDraw spXDraw
#define spInit spXInit
#define spFinish spXFinish
#endif
/*
* Function prototypes
*/
void spSetAttribute (Sprite *sp, s32 attr);
void spClearAttribute (Sprite *sp, s32 attr);
void spMove (Sprite *sp, s32 x, s32 y);
void spScale (Sprite *sp, f32 sx, f32 sy);
void spSetZ (Sprite *sp, s32 z );
void spColor (Sprite *sp, u8 red, u8 green, u8 blue, u8 alpha);
Gfx *spDraw (Sprite *sp);
void spInit( Gfx **glistp );
void spScissor( s32 xmin, s32 xmax, s32 ymin, s32 ymax );
void spFinish( Gfx **glistp );
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* _SP_H_ */

202
include/PR/sptask.h Normal file
View File

@ -0,0 +1,202 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/**************************************************************************
*
* $Revision: 1.9 $
* $Date: 1998/03/05 06:40:29 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/sptask.h,v $
*
**************************************************************************/
#ifndef _SPTASK_H_
#define _SPTASK_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Type definitions
*
*/
/*
* Task List Structure.
*
* Things an app might pass to the SP via the task list.
* Not every task ucode would need/use every field, but
*
* - type (audio, gfx, video, ...)
* - flags
* - wait for DP to drain before running new task
* - SEE BIT DEFINITIONS UNDER "Task Flags field"
* - pointer to boot ucode
* - size of boot ucode
* - pointer to ucode
* - size of ucode
* - pointer to initial DMEM data
* - size of initial DMEM data
* - pointer to DRAM stack
* - size of DRAM stack (max)
* - pointer to output buffer
* - pointer to store output buffer length
* - generic data pointer (for display list, etc.)
* - generic data length (for display list, etc.)
* - pointer to buffer where to store saved DMEM (in yield case)
* - size of buffer to store saved DMEM.
*
* IMPORTANT!!! Watch alignment issues.
*
* IMPORTANT!!! Watch data cache issues. The RCP may write data into the
* dram_stack, output_buff, output_buff_size, and the yield_data_ptr areas.
* These buffers should be cache aligned and use the entire line (16 bytes) to
* avoid corruption by writebacks by the CPU (cache tearing).
*
* IMPORTANT!!! all addresses are virtual addresses. Library does
* any necessary translation.
*
*/
typedef struct {
u32 type;
u32 flags;
u64 *ucode_boot;
u32 ucode_boot_size;
u64 *ucode;
u32 ucode_size;
u64 *ucode_data;
u32 ucode_data_size;
u64 *dram_stack;
u32 dram_stack_size;
u64 *output_buff;
u64 *output_buff_size;
u64 *data_ptr;
u32 data_size;
u64 *yield_data_ptr;
u32 yield_data_size;
} OSTask_t;
typedef union {
OSTask_t t;
long long int force_structure_alignment;
} OSTask;
typedef u32 OSYieldResult;
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_ASSEMBLY
/*
* For the RSP ucode:
* offsets into the task structure
*/
#include <PR/sptaskoff.h>
#endif
/*
* Task Flags field
*/
#define OS_TASK_YIELDED 0x0001
#define OS_TASK_DP_WAIT 0x0002
#define OS_TASK_LOADABLE 0x0004
#define OS_TASK_SP_ONLY 0x0008
#define OS_TASK_USR0 0x0010
#define OS_TASK_USR1 0x0020
#define OS_TASK_USR2 0x0040
#define OS_TASK_USR3 0x0080
/*
* Size of Yield buffer. The taskHdrPtr->t.yield_data_ptr must point to a
* buffer of this size. (The size is in bytes). ONLY If the task will NEVER
* yield it may be a null pointer. The buffer must be aligned to a 64 bit
* boundary. The taskHdrPtr->t.yield_data_ptr must be set to point to the
* buffer BEFORE the task is started.
*/
// @todo: Remove this || 1 hack
#if (defined(F3DEX_GBI)||defined(F3DLP_GBI)||defined(F3DEX_GBI_2) || 1)
#define OS_YIELD_DATA_SIZE 0xc00
#else
#define OS_YIELD_DATA_SIZE 0x900
#endif
#define OS_YIELD_AUDIO_SIZE 0x400
/**************************************************************************
*
* Global definitions
*
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/**************************************************************************
*
* Macro definitions
*
*/
/*
* this macro simulates atomic action.
*/
#define osSpTaskStart(tp) \
{ \
osSpTaskLoad((tp)); \
osSpTaskStartGo((tp)); \
}
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
/*
* break this up into two steps for debugging.
*/
extern void osSpTaskLoad(OSTask *tp);
extern void osSpTaskStartGo(OSTask *tp);
extern void osSpTaskYield(void);
extern OSYieldResult osSpTaskYielded(OSTask *tp);
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_SPTASK_H */

192
include/PR/ucode.h Normal file
View File

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

54
include/PR/ucode_debug.h Normal file
View File

@ -0,0 +1,54 @@
/*---------------------------------------------------------------------*
Copyright (C) 1998, Nintendo.
File ucode_debug.h
Coded by Yoshitaka Yasumoto. Nov 15, 1998.
$Id: ucode_debug.h,v 1.1 1998/12/25 01:06:21 has Exp $
*---------------------------------------------------------------------*/
#ifndef _UCODE_DEBUG_H_
#define _UCODE_DEBUG_H_
#define DEBUG_DL_PTR() IO_READ(SP_DMEM_START+0xfc0)
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/*========== F3DEX2/F3DLX2/L3DEX2/S2DEX2 ==========*/
/* FIFO version */
extern long long int gspF3DEX2d_fifoTextStart[], gspF3DEX2d_fifoTextEnd[];
extern long long int gspF3DEX2d_fifoDataStart[], gspF3DEX2d_fifoDataEnd[];
extern long long int gspF3DEX2d_NoN_fifoTextStart[],gspF3DEX2d_NoN_fifoTextEnd[];
extern long long int gspF3DEX2d_NoN_fifoDataStart[],gspF3DEX2d_NoN_fifoDataEnd[];
extern long long int gspF3DEX2d_Rej_fifoTextStart[],gspF3DEX2d_Rej_fifoTextEnd[];
extern long long int gspF3DEX2d_Rej_fifoDataStart[],gspF3DEX2d_Rej_fifoDataEnd[];
extern long long int gspF3DLX2d_Rej_fifoTextStart[],gspF3DLX2d_Rej_fifoTextEnd[];
extern long long int gspF3DLX2d_Rej_fifoDataStart[],gspF3DLX2d_Rej_fifoDataEnd[];
extern long long int gspL3DEX2d_fifoTextStart[], gspL3DEX2d_fifoTextEnd[];
extern long long int gspL3DEX2d_fifoDataStart[], gspL3DEX2d_fifoDataEnd[];
extern long long int gspS2DEX2d_fifoTextStart[], gspS2DEX2d_fifoTextEnd[];
extern long long int gspS2DEX2d_fifoDataStart[], gspS2DEX2d_fifoDataEnd[];
/* XBUS version */
extern long long int gspF3DEX2d_xbusTextStart[], gspF3DEX2d_xbusTextEnd[];
extern long long int gspF3DEX2d_xbusDataStart[], gspF3DEX2d_xbusDataEnd[];
extern long long int gspF3DEX2d_NoN_xbusTextStart[],gspF3DEX2d_NoN_xbusTextEnd[];
extern long long int gspF3DEX2d_NoN_xbusDataStart[],gspF3DEX2d_NoN_xbusDataEnd[];
extern long long int gspF3DEX2d_Rej_xbusTextStart[],gspF3DEX2d_Rej_xbusTextEnd[];
extern long long int gspF3DEX2d_Rej_xbusDataStart[],gspF3DEX2d_Rej_xbusDataEnd[];
extern long long int gspF3DLX2d_Rej_xbusTextStart[],gspF3DLX2d_Rej_xbusTextEnd[];
extern long long int gspF3DLX2d_Rej_xbusDataStart[],gspF3DLX2d_Rej_xbusDataEnd[];
extern long long int gspL3DEX2d_xbusTextStart[], gspL3DEX2d_xbusTextEnd[];
extern long long int gspL3DEX2d_xbusDataStart[], gspL3DEX2d_xbusDataEnd[];
extern long long int gspS2DEX2d_xbusTextStart[], gspS2DEX2d_xbusTextEnd[];
extern long long int gspS2DEX2d_xbusDataStart[], gspS2DEX2d_xbusDataEnd[];
#endif /* _LANGUAGE_C */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_UCODE_DEBUG_H */
/*======== End of ucode_debug.h ========*/

167
include/PR/ultraerror.h Normal file
View File

@ -0,0 +1,167 @@
/*====================================================================
* ultraerror.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.
*====================================================================*/
/**************************************************************************
*
* $Revision: 1.24 $
* $Date: 1998/01/27 23:52:11 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ultraerror.h,v $
*
**************************************************************************/
#ifndef __ULTRAERROR_H__
#define __ULTRAERROR_H__
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#define OS_ERROR_FMT "/usr/lib/PR/error.fmt"
#define OS_ERROR_MAGIC 0x6b617479
/* OS error codes */
#define ERR_OSCREATETHREAD_SP 1
#define ERR_OSCREATETHREAD_PRI 2
#define ERR_OSSTARTTHREAD 3
#define ERR_OSSETTHREADPRI 4
#define ERR_OSCREATEMESGQUEUE 5
#define ERR_OSSENDMESG 6
#define ERR_OSJAMMESG 7
#define ERR_OSRECVMESG 8
#define ERR_OSSETEVENTMESG 9
#define ERR_OSMAPTLB_INDEX 10
#define ERR_OSMAPTLB_ASID 11
#define ERR_OSUNMAPTLB 12
#define ERR_OSSETTLBASID 13
#define ERR_OSAISETFREQUENCY 14
#define ERR_OSAISETNEXTBUFFER_ADDR 15
#define ERR_OSAISETNEXTBUFFER_SIZE 16
#define ERR_OSDPSETNEXTBUFFER_ADDR 17
#define ERR_OSDPSETNEXTBUFFER_SIZE 18
#define ERR_OSPIRAWREADIO 19
#define ERR_OSPIRAWWRITEIO 20
#define ERR_OSPIRAWSTARTDMA_DIR 21
#define ERR_OSPIRAWSTARTDMA_DEVADDR 22
#define ERR_OSPIRAWSTARTDMA_ADDR 23
#define ERR_OSPIRAWSTARTDMA_SIZE 24
#define ERR_OSPIRAWSTARTDMA_RANGE 25
#define ERR_OSPIREADIO 26
#define ERR_OSPIWRITEIO 27
#define ERR_OSPISTARTDMA_PIMGR 28
#define ERR_OSPISTARTDMA_PRI 29
#define ERR_OSPISTARTDMA_DIR 30
#define ERR_OSPISTARTDMA_DEVADDR 31
#define ERR_OSPISTARTDMA_ADDR 32
#define ERR_OSPISTARTDMA_SIZE 33
#define ERR_OSPISTARTDMA_RANGE 34
#define ERR_OSCREATEPIMANAGER 35
#define ERR_OSVIGETCURRENTMODE 36
#define ERR_OSVIGETCURRENTFRAMEBUFFER 37
#define ERR_OSVIGETNEXTFRAMEBUFFER 38
#define ERR_OSVISETXSCALE_VALUE 39
#define ERR_OSVISETXSCALE_VIMGR 40
#define ERR_OSVISETYSCALE_VALUE 41
#define ERR_OSVISETYSCALE_VIMGR 42
#define ERR_OSVISETSPECIAL_VALUE 43
#define ERR_OSVISETSPECIAL_VIMGR 44
#define ERR_OSVISETMODE 45
#define ERR_OSVISETEVENT 46
#define ERR_OSVISWAPBUFFER_ADDR 47
#define ERR_OSVISWAPBUFFER_VIMGR 48
#define ERR_OSCREATEVIMANAGER 49
#define ERR_OSCREATEREGION_ALIGN 50
#define ERR_OSCREATEREGION_SIZE 51
#define ERR_OSMALLOC 52
#define ERR_OSFREE_REGION 53
#define ERR_OSFREE_ADDR 54
#define ERR_OSGETREGIONBUFCOUNT 55
#define ERR_OSGETREGIONBUFSIZE 56
#define ERR_OSSPTASKLOAD_DRAM 57
#define ERR_OSSPTASKLOAD_OUT 58
#define ERR_OSSPTASKLOAD_OUTSIZE 59
#define ERR_OSSPTASKLOAD_YIELD 60
#define ERR_OSPROFILEINIT_STR 61
#define ERR_OSPROFILEINIT_CNT 62
#define ERR_OSPROFILEINIT_ALN 63
#define ERR_OSPROFILEINIT_ORD 64
#define ERR_OSPROFILEINIT_SIZ 65
#define ERR_OSPROFILESTART_TIME 66
#define ERR_OSPROFILESTART_FLAG 67
#define ERR_OSPROFILESTOP_FLAG 68
#define ERR_OSPROFILESTOP_TIMER 69
#define ERR_OSREADHOST_ADDR 70
#define ERR_OSREADHOST_SIZE 71
#define ERR_OSWRITEHOST_ADDR 72
#define ERR_OSWRITEHOST_SIZE 73
#define ERR_OSGETTIME 74
#define ERR_OSSETTIME 75
#define ERR_OSSETTIMER 76
#define ERR_OSSTOPTIMER 77
#define ERR_ALSEQP_NO_SOUND 100
#define ERR_ALSEQP_NO_VOICE 101
#define ERR_ALSEQP_MAP_VOICE 102
#define ERR_ALSEQP_OFF_VOICE 103
#define ERR_ALSEQP_POLY_VOICE 104
#define ERR_ALSNDP_NO_VOICE 105
#define ERR_ALSYN_NO_UPDATE 106
#define ERR_ALSNDPDEALLOCATE 107
#define ERR_ALSNDPDELETE 108
#define ERR_ALSNDPPLAY 109
#define ERR_ALSNDPSETSOUND 110
#define ERR_ALSNDPSETPRIORITY 111
#define ERR_ALSNDPSETPAR 112
#define ERR_ALBNKFNEW 113
#define ERR_ALSEQNOTMIDI 114
#define ERR_ALSEQNOTMIDI0 115
#define ERR_ALSEQNUMTRACKS 116
#define ERR_ALSEQTIME 117
#define ERR_ALSEQTRACKHDR 118
#define ERR_ALSEQSYSEX 119
#define ERR_ALSEQMETA 120
#define ERR_ALSEQPINVALIDPROG 121
#define ERR_ALSEQPUNKNOWNMIDI 122
#define ERR_ALSEQPUNMAP 123
#define ERR_ALEVENTNOFREE 124
#define ERR_ALHEAPNOFREE 125
#define ERR_ALHEAPCORRUPT 126
#define ERR_ALHEAPFIRSTBLOCK 127
#define ERR_ALCSEQZEROSTATUS 128
#define ERR_ALCSEQZEROVEL 129
#define ERR_ALCSPVNOTFREE 130
#define ERR_ALSEQOVERRUN 131
#define ERR_OSAISETNEXTBUFFER_ENDADDR 132
#define ERR_ALMODDELAYOVERFLOW 133
#define ERR_OSVIEXTENDVSTART_VIMGR 134
#define ERR_OSVIEXTENDVSTART_VALUE 135
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
typedef void (*OSErrorHandler)(s16, s16, ...);
OSErrorHandler osSetErrorHandler(OSErrorHandler);
#endif
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* __ULTRAERROR_H__ */

74
include/PR/ultralog.h Normal file
View File

@ -0,0 +1,74 @@
/*====================================================================
* ultralog.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.
*====================================================================*/
/**************************************************************************
*
* $Revision: 1.6 $
* $Date: 1997/02/11 08:39:05 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ultralog.h,v $
*
**************************************************************************/
#ifndef __log__
#define __log__
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#define OS_LOG_MAX_ARGS 16
#define OS_LOG_MAGIC 0x20736a73
#define OS_LOG_FLOAT(x) (*(int *) &(x))
#define OS_LOG_VERSION 1
typedef struct {
u32 magic; /* log identifier */
u32 len; /* length of log data + log structure */
u32 *base; /* starting addr array */
s32 startCount; /* read offset from dataBase */
s32 writeOffset; /* write offset from dataBase */
} OSLog;
typedef struct {
u32 magic;
u32 timeStamp;
u16 argCount;
u16 eventID;
} OSLogItem;
typedef struct {
u32 magic; /* log identifier */
u32 version; /* 1 */
} OSLogFileHdr;
void osCreateLog(OSLog *log, u32 *base, s32 len);
void osLogEvent(OSLog *log, s16 code, s16 numArgs, ...);
void osFlushLog(OSLog *log);
u32 osLogFloat(f32);
extern void osDelay(int count);
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif

90
include/PR/ultratypes.h Normal file
View File

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

134
include/PR/uportals.h Normal file
View File

@ -0,0 +1,134 @@
/*====================================================================
* uportals.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.
*====================================================================*/
/**************************************************************************
*
* uportals.h - header file for the ultraportals library
*
* $Revision: 1.12 $
* $Date: 1997/02/11 08:40:49 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/uportals.h,v $
*
**************************************************************************/
#ifndef __ULTRAPORTALS_H__
#define __ULTRAPORTALS_H__
#include <ultra64.h>
#include "matrix.h"
#include "vector.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef ENABLEPORTALS
#define ENABLEPORTALS
#endif
#define UP_MAXPVERTS 16 /* max number of portal verts */
#define UP_MAXCELLS 50 /* max number of cells */
#define UP_CELLNL 32 /* max length of cell names */
#define UP_OBNL 32 /* max length of obejct names */
typedef struct
{
vec3 min, max; /* min and max pts of the box */
} upBox;
typedef struct _upPortalData * _portalptr;
typedef struct _upCellData * _cellptr;
typedef struct _upObjectData * _objectptr;
typedef struct _upPortalData
{
int numverts; /* number of verts in the portal*/
_cellptr attached_cell; /* cell on the 'other side' */
vec3 verts[UP_MAXPVERTS]; /* the actual vertices */
#ifdef MVTVIEW
int mvt_id; /* if has mvt, this is the id */
#endif
} upPortalData;
typedef struct _upCellData
{
int numportals; /* number of portals */
int numobjects; /* number of objects */
int rendered; /* last frame number rendered */
_portalptr *portals; /* array for the actual portals */
_objectptr *objects; /* array for 'detail' objects */
upBox bbox; /* bounding box of the cell */
Gfx *dlist; /* associated display list */
char name[UP_CELLNL]; /* name of the cell */
float eyeheight; /* height to constrain eyept to */
int zone; /* current zone number */
} upCellData;
typedef struct _upObjectData
{
int rendered; /* last frame number rendered */
upBox bbox; /* bounding box for the object */
Gfx *dlist; /* associated display list */
char name[UP_OBNL]; /* name of the object */
} upObjectData;
typedef struct
{
int numcells; /* how many cells are there? */
upCellData cells[UP_MAXCELLS]; /* the actual cells */
Gfx *rootdlist; /* display list for all cells */
vec2 portalmin, portalmax; /* XY bbox used by upCheckCells */
float near, far; /* near, far clipping planes */
FMatrix viewmat; /* viewing matrix (world->eye) */
FMatrix projmat; /* proj matrix (eye->screen) */
FMatrix compmat; /* view * proj (world->screen) */
int portaldepth; /* depth of the portal stack */
int framecount; /* current frame number */
} upLocateData;
/*
* Functions:
*/
extern void upInit(); /* generated automatically by flt2walk */
extern Gfx *upAddVisibleCells(Gfx * glistp, vec3 eyept);
extern void upTogglePortalBounds();
extern void upToggleScissorBox();
/*
* Globals:
*/
extern upLocateData upLocator; /* also extern by test_portals.h */
/*
* Macros:
*/
#define UP_HUGEVAL 3.40282347e+37
#define PT_IN_BOX(p,box) ((p)[0] > (box).min[0] && (p)[0] < (box).max[0] &&\
(p)[1] > (box).min[1] && (p)[1] < (box).max[1] &&\
(p)[2] > (box).min[2] && (p)[2] < (box).max[2])
#ifdef __Cplusplus
}
#endif
#endif

85
include/make/PRdefs Normal file
View File

@ -0,0 +1,85 @@
#
# Commondefs for Project Reality source tree
#
# Makefiles which include this should first define PRDEPTH to be the relative
# path from their parent directory.
include $(ROOT)/usr/include/make/commondefs
#
# Use $(MAKE) $(MAKEARGS) instead of $(MAKEF) so that make -n works
# This gets around the fact that $(MAKE) works and $(MAKEF) does not.
# MAKEARGS is based directly on $(MAKEF) in commondefs.
#
MAKEARGS = VCFLAGS="$(VCFLAGS)" VFFLAGS="$(VFFLAGS)" \
VPFLAGS="$(VPFLAGS)" VMKDEPFLAGS="$(VMKDEPFLAGS)"
# make sure 'default' does not hit these rules
defaultrule: default
#
# Compile tree for RCP 1.0 or RCP 2.0
#
#GCDEFS = $(HW_FLAGS)
#GCDEFS = $(HW_FLAGS) -B -Wab,-r4300_mul
#ifdef __GCC__
GCDEFS =
#else
GCDEFS = $(HW_FLAGS) -Wab,-r4300_mul
#endif
#
# VCS compiler options
#
VCSOPTS = $(GVCSOPTS) $(LVCSOPTS) $(VVCSOPTS)
GVCSOPTS = +acc -V -M -Mupdate -Mmakep=pmake \
-CC "-mips2 -Wab,-big_got -Wab,-dwalign" -lgl -limage \
-P $(PRDEPTH)/rdpsim/pli/pli.tab $(ROOT)/usr/lib/PR/libpli.a
SHELL = /bin/sh
FLT2C = $(ROOT)/usr/sbin/flt2c
IC = $(ROOT)/usr/sbin/ic
#ifdef __GCC__
MAKEROM = $(GCCDIR)/mipse/bin/mild
#else
MAKEROM = $(ROOT)/usr/sbin/makerom
#endif
MIDIPARSE = $(ROOT)/usr/sbin/midiparse
MIDICVT = $(ROOT)/usr/sbin/midicvt
MIDICOMP = $(ROOT)/usr/sbin/midicomp
SBC = $(ROOT)/usr/sbin/sbc
NLD = $(ROOT)/usr/sbin/nld
RGB2C = $(ROOT)/usr/sbin/rgb2c
MKSPRITE = $(ROOT)/usr/sbin/mksprite
MKISPRITE = $(ROOT)/usr/sbin/mkisprite
TABLEDESIGN = $(ROOT)/usr/sbin/tabledesign
VADPCM_ENC = $(ROOT)/usr/sbin/vadpcm_enc
RSPASM = $(ROOT)/usr/sbin/rspasm
BUILDTASK = $(ROOT)/usr/sbin/buildtask
RSP2ELF = $(ROOT)/usr/sbin/rsp2elf
DATA2RDRAM = $(PRDEPTH)/tools/data/data2rdram
RDRAM2DATA = $(PRDEPTH)/tools/data/rdram2data
TMEMFMT = $(PRDEPTH)/tools/tmemfmt/tmemfmt
ECS2VL = $(PRDEPTH)/rdpsim/tools/ecs2vl
ECSGEN = $(PRDEPTH)/rdpsim/tools/ecs_gen
MERRG = $(PRDEPTH)/rdpsim/tools/merrg
RMVCOM = $(PRDEPTH)/rdpsim/tools/remove_comments
TAB2VMEM= $(PRDEPTH)/rdpsim/tools/tab2vmem
TAB2WVS = $(PRDEPTH)/rdpsim/tools/tab2wvs
VSIG = $(PRDEPTH)/rdpsim/tools/vsig
XNET = $(PRDEPTH)/rdpsim/tools/xnet
ASYIN = /ecad/ecs/ecs_2.4/bin/asyin
MAKEINI = /ecad/ecs/ecs_2.4/bin/makeini
VCSDIR = /ecad/vcs/vcs_2.2/sgi
VCS = $(VCSDIR)/bin/vcs
LOG_RESULT = \
@echo -n "!!! $(*:T) of" `basename \`pwd\``": "; \
grep "number of errors" $*.out
LOG_ERROR = $(LOG_RESULT)

45
include/sys/regdef.h Executable file
View File

@ -0,0 +1,45 @@
#ifndef __REGDEF_H__
#define __REGDEF_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
*
* Copyright 1992, 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 Unpublished, MIPS Computer Systems, Inc. All Rights | */
/* | Reserved. This software contains proprietary and confidential | */
/* | information of MIPS and its suppliers. Use, disclosure or | */
/* | reproduction is prohibited without the prior express written | */
/* | consent of MIPS. | */
/* ------------------------------------------------------------------ */
#ident "$Revision: 1.9 $"
/* regdef.h 1.2 */
/*
* Mips register definitions.
*/
#ifdef mips
#include <sys/regdef.h>
/*#include <sys/fpregdef.h>*/
#endif /* mips */
#ifdef __cplusplus
}
#endif
#endif /* !__REGDEF_H__ */

131
include/sys/u64driver.h Normal file
View File

@ -0,0 +1,131 @@
#ifndef __SYS_U64DRIVER_H__
#define __SYS_U64DRIVER_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.
*
*/
#include <PR/rdb.h>
#include <PR/ramrom.h>
#include "u64gio.h"
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
#define U64_MINOR_PRINT 1
#define U64_MINOR_DEBUG 2
#define U64_MINOR_LOGGING 3
#define U64_MINOR_DATA 4
#define U64_MINOR_FAULT 5
#define U64_MINOR_KDEBUG 6
#define U64_MINOR_PROFILE 7
#define NUMBER_MINORS 8 /* don't use minor zero , but must count 0-7 */
#define U64_MINOR_PRINT_BUF_SIZE 0x80000 /* buffer used by incoming printf data */
#define U64_MINOR_DEBUG_BUF_SIZE 0x4000
#define U64_MINOR_LOGGING_BUF_SIZE RDB_LOG_MAX_BLOCK_SIZE /* buffer used by incoming logging data */
#define U64_MINOR_DATA_BUF_SIZE RDB_DATA_MAX_BLOCK_SIZE /* buffer used by incoming data */
#define U64_MINOR_FAULT_BUF_SIZE 1024 /* buffer used for incoming fault data */
#define U64_MINOR_KDEBUG_BUF_SIZE 1024 /* buffer used for incoming kdebug data */
#define U64_MINOR_PROFILE_BUF_SIZE 2048 /* buffer used for incoming profile data */
#define U64_MINOR_PROFILE_SEND_BUF_SIZE 16 /* only send one byte messages */
#define U64_INTERNAL_WRITE_BUF_SIZE 0x8000 /* buffer used to store packets waiting to go out */
#define u64_increment_Qptr(x) { ((x) = ((x) + 1) & 0xff) ; }
typedef struct {
sema_t minor_sema; /* used to allow only one app to open the minor */
sema_t read_sema; /* used to block while waiting for data */
sema_t write_sema; /* only allow one entry to write at a time */
int read_count; /* the number of bytes waiting to be read */
int write_count; /* the number of bytes waiting to be written */
int read_cur_write;
int write_cur_write;
int read_cur_read;
int write_cur_read;
unsigned char *read_buf;
unsigned char *write_buf;
int read_buf_size; /* measured in unsigned char's */
int write_buf_size; /* measured in unsigned char's */
int incoming_ct; /* used by minors that receive data from game */
/* indicates how many bytes left in block */
/* before signaling game that transfer is done */
/* used by logging and game to host data stuff */
int message; /* when not zero, send this message to game to */
/* indicate that data or log data has been read */
struct pollhead *phead;
} u64_minor;
/*
* Our private one-per-board data structure
* The user can't get at any of this
*/
struct u64_data {
volatile struct u64_board *board;
unsigned char *memaddr; /* 16/32 bit access R/W */
/*
* Only one client may be in the kernel at a time; this semaphore is used
* to prevent multiple clients from overrunning each other's interactions
* with the hardware.
*/
sema_t ioctl_sema;
/*
* The ramrom_sema is used by the driver so that it can arbitrate for the
* control of ramrom with the game, and sleep while waiting for the game
* to respond.
*/
sema_t ramrom_sema;
/*
* Allocate a megabyte buffer which we can use when reading/writing data
* to or from the board (we can't copyin/copyout directly from the user's
* buffer, because those routines use 64 bit transfers).
*/
unsigned int *oneMeg;
union {
u64_write_arg_t u64_write; /* WRITE, SAFE_WRITE */
u64_read_arg_t u64_read; /* READ, SAFE_READ */
} args;
/* rdb port */
unsigned int *write_buf;
unsigned int write_buf_cur_write;
unsigned int write_buf_cur_read;
unsigned int write_buf_ct; /* number of packets waiting for transmission */
unsigned int write_buf_size; /* measured in rdbPackets */
sema_t write_buf_sema;
u64_minor minors[NUMBER_MINORS];
};
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#endif /* __SYS_U64DRIVER_H__ */

110
include/sys/u64gio.h Normal file
View File

@ -0,0 +1,110 @@
#ifndef __SYS_U64GIO_H__
#define __SYS_U64GIO_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.
*
*/
#define DEV_U64 "/dev/u64"
#define DEV_U64_PRINT "/dev/u64_print"
#define DEV_U64_DEBUG "/dev/u64_debug"
#define DEV_U64_LOG "/dev/u64_logging"
#define DEV_U64_DATA "/dev/u64_data"
#define DEV_U64_FAULT "/dev/u64_fault"
#define DEV_U64_KDEBUG "/dev/u64_kdebug"
#define DEV_U64_PROFILE "/dev/u64_profile"
/*
* ioctls
*/
#define U64IOC ('u'<<24|'6'<<16)
#define U64IOCTL(x) (U64IOC|x)
#define U64_RESET U64IOCTL(1) /* arg: 0 - deassert, 1 - assert */
#define U64_WRITE U64IOCTL(2)
#define U64_READ U64IOCTL(3)
#define U64_SAFE_WRITE U64IOCTL(4)
#define U64_SAFE_READ U64IOCTL(5)
#define U64_LISTEN U64IOCTL(6) /* arg is register value for listen */
#define U64_SIGNAL U64IOCTL(7) /* arg is register value for signal */
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
/* structure for WRITE & SAFE_WRITE*/
typedef struct u64_write_arg {
void *buffer;
long ramrom_addr;
int nbytes;
} u64_write_arg_t;
/* structure for READ & SAFE_READ */
typedef struct u64_read_arg {
void *buffer;
long ramrom_addr;
int nbytes;
} u64_read_arg_t;
/* NOTE: if game is in reset, don't interrupt the game */
struct u64_board {
volatile unsigned int product_id_reg; /* bf400000, read only */
unsigned char fill_0[0x3fc];
volatile unsigned int reset_control; /* bf400400, write only */
unsigned char fill_1[0x3fc];
volatile unsigned int cart_interrupt; /* bf400800, read/write */
unsigned char fill_3[0x1fc];
volatile unsigned int dram_page_cntrl;/* bf400a00, read/write */
unsigned char fill_2[0x1fc];
volatile unsigned int gio_interrupt; /* bf400c00, read only */
unsigned char fill_4[0x1fc];
volatile unsigned int gio_sync; /* bf400e00, read only */
};
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
/*
* _U64_PRODUCT_ID_REG - GIO bus Product ID register
*/
#define _U64_PRODUCT_ID_MASK 0x0000007f
#define _U64_PRODUCT_ID_VALUE 0x00000015
/*
* reset control register has two bits defined
*/
#define _U64_RESET_CONTROL_NMI 0x4
#define _U64_RESET_CONTROL_RESET 0x2
/*
* Only look at the least significant 5 bits of the sync and interrupt
* registers. Future revs of the firmware may provide more.
*/
#define _U64_REGMASK 0x1f
/*
* 16MB available, one meg at a time, selected by the 4 bit
* dram_page_cntrl register setting.
*/
#define U64_MEM_SIZE 0x100000
/*
* Declare size of gio-addressable memory to mmap, and provide the base
* physical address so that clients who want to mmap() may do so.
*/
#define U64_GIOBUS_SIZE 0x200000 /* 2 MB */
#define U64_GIOBUS_BASE 0x1f400000
#endif /* __SYS_U64GIO_H__ */

68
include/tinymon.h Normal file
View File

@ -0,0 +1,68 @@
/*
* Copyright (c) 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.
*
* Module: tinymon.h: constants for use with the tinymon family of debug servers
*/
#define GIO_BASE_REG_UPPER 0x1800
#define GIO_BASE_REG_UPPER_K1 0xb800
#define GIO_INTR_REG_OFFSET 0x0
#define GIO_SYNC_REG_OFFSET 0x400
#define CART_INTR_REG_OFFSET 0x800
#define RAMROM_BASE_UPPER 0x1000
#define RAMROM_BASE_UPPER_K1 0xb000
/*
* jal will or in the upper four bits of 0xb0000000 whenever we invoke these
* routines.
*/
#define PIFMON_WRITE_ADDR 0xfc00030
#define PI_BASE_REG_UPPER 0x0460
#define PI_BASE_REG_UPPER_K1 0xa460
#define PI_STATUS_REG_OFFSET 0x10
/*
* PI status register has 3 bits active when read from (PI_STATUS_REG - read)
* Bit 0: DMA busy - set when DMA is in progress
* Bit 1: IO busy - set when IO is in progress
* Bit 2: Error - set when R4300 issues IO request while DMA is busy
*/
#define PI_STATUS_ERROR 0x04
#define PI_STATUS_IO_BUSY 0x02
#define PI_STATUS_DMA_BUSY 0x01
/*
* Host to R4300 protocol definitions.
*
* Host writes DG_RAMROM_REQUEST, DG_RAMROM_CMD_READY to the cartridge
* interrupt register (which the R4300 can poll),
*
* R4300 writes DG_RAMROM_GRANT, DG_RAMROM_CMD_DONE to the gio sync register
* (which the host can poll).
*/
#define DG_CARTREG_MASK 0x3f
#define DG_RAMROM_REQUEST 1
#define DG_RAMROM_GRANT 2
#define DG_RAMROM_CMD_READY 3
#define DG_RAMROM_CMD_DONE 4
#define DG_TINYMON_READ_OP 1
#define DG_TINYMON_WRITE_OP 2
#define DG_TINYMON_DMA_READ_OP 3
#define DG_TINYMON_DMA_WRITE_OP 4

40
include/ultra64.h Normal file
View File

@ -0,0 +1,40 @@
/**************************************************************************
* *
* 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.10 $
* $Date: 1997/02/11 08:37:33 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ultra64.h,v $
*
**************************************************************************/
#ifndef _ULTRA64_H_
#define _ULTRA64_H_
#include <PR/ultratypes.h>
#include <PR/rcp.h>
#include <PR/os.h>
#include <PR/region.h>
#include <PR/rmon.h>
#include <PR/sptask.h>
#include <PR/mbi.h>
#include <PR/libaudio.h>
#include <PR/gu.h>
#include <PR/ramrom.h>
#include <PR/sp.h>
#include <PR/ucode.h>
#include <PR/ultraerror.h>
#include <PR/ultralog.h>
#endif

58
include/ultrahost.h Normal file
View File

@ -0,0 +1,58 @@
/**************************************************************************
* *
* Copyright (C) 1995, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
*************************************************************************/
/**************************************************************************
*
* $Revision: 1.8 $
* $Date: 1997/07/02 02:35:06 $
* $Source: /hosts/gate3/exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/ultrahost.h,v $
*
**************************************************************************/
#ifndef _ULTRAHOST_H_
#define _ULTRAHOST_H_
#ifdef PTN64 /* { */
#define execl execl_pt
#define uhOpenGame uhOpenGame_pt
#define uhCloseGame uhCloseGame_pt
#define uhReadGame uhReadGame_pt
#define uhWriteGame uhWriteGame_pt
#define uhReadRamrom uhReadRamrom_pt
#define uhWriteRamrom uhWriteRamrom_pt
#define uhPartnerCmd uhPartnerCmd_pt
#define uhGload uhGload_pt
int uhPartnerCmd(int,char *);
int uhGload(int,char *);
#endif /* } */
#ifdef __cplusplus
extern "C" {
#endif
int uhOpenGame(const char *);
int uhCloseGame(int);
int uhReadGame(int, void *, int);
int uhWriteGame(int, void *, int);
int uhWriteRamrom(int, void *, void*, int);
int uhReadRamrom(int, void *, void*, int);
#ifdef __cplusplus
}
#endif
#endif /* ULTRAHOST */

View File

@ -68,36 +68,37 @@
build/ROMID/lib/ultra/audio/heap.o (section); \
build/ROMID/lib/lib_2fba0.o (section); \
build/ROMID/lib/lib_2fc60.o (section); \
build/ROMID/lib/lib_30ce0.o (section); \
build/ROMID/lib/naudio/n_synthesizer.o (section); \
build/ROMID/lib/ultra/audio/sl.o (section); \
build/ROMID/lib/lib_317f0.o (section); \
build/ROMID/lib/speaker.o (section); \
build/ROMID/lib/ultra/audio/csplayer.o (section); \
build/ROMID/lib/naudio/n_csplayer.o (section); \
build/ROMID/lib/lib_37650.o (section); \
build/ROMID/lib/ultra/audio/bnkf.o (section); \
build/ROMID/lib/mp3.o (section); \
build/ROMID/lib/lib_38d10.o (section); \
build/ROMID/lib/ultra/audio/cseq.o (section); \
build/ROMID/lib/naudio/n_csq.o (section); \
build/ROMID/lib/lib_39be0.o (section); \
build/ROMID/lib/lib_39c80.o (section); \
build/ROMID/lib/lib_39f70.o (section); \
build/ROMID/lib/ultra/audio/syndelete.o (section); \
build/ROMID/lib/naudio/n_syndelete.o (section); \
build/ROMID/lib/lib_39fe0.o (section); \
build/ROMID/lib/lib_3a100.o (section); \
build/ROMID/lib/lib_3c430.o (section); \
build/ROMID/lib/ultra/audio/event.o (section); \
build/ROMID/lib/naudio/n_event.o (section); \
build/ROMID/lib/lib_3c890.o (section); \
build/ROMID/lib/lib_3ccf0.o (section); \
build/ROMID/lib/lib_3cdc0.o (section); \
build/ROMID/lib/lib_3cef0.o (section); \
build/ROMID/lib/lib_3d280.o (section); \
build/ROMID/lib/naudio/n_seqplayer.o (section); \
build/ROMID/lib/lib_3e3e0.o (section); \
build/ROMID/lib/lib_3e730.o (section); \
build/ROMID/lib/lib_3e8c0.o (section); \
build/ROMID/lib/naudio/n_env.o (section); \
build/ROMID/lib/lib_3f8a0.o (section); \
build/ROMID/lib/lib_43dd0.o (section); \
build/ROMID/lib/lib_446d0.o (section); \
build/ROMID/lib/lib_44bc0.o (section); \
build/ROMID/lib/ultra/audio/synsetpriority.o (section); \
build/ROMID/lib/naudio/n_synsetpriority.o (section); \
build/ROMID/lib/lib_44f60.o (section); \
build/ROMID/lib/lib_45ed0.o (section); \
build/ROMID/lib/lib_461c0.o (section); \

View File

@ -65,36 +65,37 @@
build/ROMID/lib/ultra/audio/heap.o (section); \
build/ROMID/lib/lib_2fba0.o (section); \
build/ROMID/lib/lib_2fc60.o (section); \
build/ROMID/lib/lib_30ce0.o (section); \
build/ROMID/lib/naudio/n_synthesizer.o (section); \
build/ROMID/lib/ultra/audio/sl.o (section); \
build/ROMID/lib/lib_317f0.o (section); \
build/ROMID/lib/speaker.o (section); \
build/ROMID/lib/ultra/audio/csplayer.o (section); \
build/ROMID/lib/naudio/n_csplayer.o (section); \
build/ROMID/lib/lib_37650.o (section); \
build/ROMID/lib/ultra/audio/bnkf.o (section); \
build/ROMID/lib/mp3.o (section); \
build/ROMID/lib/lib_38d10.o (section); \
build/ROMID/lib/ultra/audio/cseq.o (section); \
build/ROMID/lib/naudio/n_csq.o (section); \
build/ROMID/lib/lib_39be0.o (section); \
build/ROMID/lib/lib_39c80.o (section); \
build/ROMID/lib/lib_39f70.o (section); \
build/ROMID/lib/ultra/audio/syndelete.o (section); \
build/ROMID/lib/naudio/n_syndelete.o (section); \
build/ROMID/lib/lib_39fe0.o (section); \
build/ROMID/lib/lib_3a100.o (section); \
build/ROMID/lib/lib_3c430.o (section); \
build/ROMID/lib/ultra/audio/event.o (section); \
build/ROMID/lib/naudio/n_event.o (section); \
build/ROMID/lib/lib_3c890.o (section); \
build/ROMID/lib/lib_3ccf0.o (section); \
build/ROMID/lib/lib_3cdc0.o (section); \
build/ROMID/lib/lib_3cef0.o (section); \
build/ROMID/lib/lib_3d280.o (section); \
build/ROMID/lib/naudio/n_seqplayer.o (section); \
build/ROMID/lib/lib_3e3e0.o (section); \
build/ROMID/lib/lib_3e730.o (section); \
build/ROMID/lib/lib_3e8c0.o (section); \
build/ROMID/lib/naudio/n_env.o (section); \
build/ROMID/lib/lib_3f8a0.o (section); \
build/ROMID/lib/lib_43dd0.o (section); \
build/ROMID/lib/lib_446d0.o (section); \
build/ROMID/lib/lib_44bc0.o (section); \
build/ROMID/lib/ultra/audio/synsetpriority.o (section); \
build/ROMID/lib/naudio/n_synsetpriority.o (section); \
build/ROMID/lib/lib_44f60.o (section); \
build/ROMID/lib/lib_45ed0.o (section); \
build/ROMID/lib/lib_461c0.o (section); \

View File

@ -65,36 +65,37 @@
build/ROMID/lib/ultra/audio/heap.o (section); \
build/ROMID/lib/lib_2fba0.o (section); \
build/ROMID/lib/lib_2fc60.o (section); \
build/ROMID/lib/lib_30ce0.o (section); \
build/ROMID/lib/naudio/n_synthesizer.o (section); \
build/ROMID/lib/ultra/audio/sl.o (section); \
build/ROMID/lib/lib_317f0.o (section); \
build/ROMID/lib/speaker.o (section); \
build/ROMID/lib/ultra/audio/csplayer.o (section); \
build/ROMID/lib/naudio/n_csplayer.o (section); \
build/ROMID/lib/lib_37650.o (section); \
build/ROMID/lib/ultra/audio/bnkf.o (section); \
build/ROMID/lib/mp3.o (section); \
build/ROMID/lib/lib_38d10.o (section); \
build/ROMID/lib/ultra/audio/cseq.o (section); \
build/ROMID/lib/naudio/n_csq.o (section); \
build/ROMID/lib/lib_39be0.o (section); \
build/ROMID/lib/lib_39c80.o (section); \
build/ROMID/lib/lib_39f70.o (section); \
build/ROMID/lib/ultra/audio/syndelete.o (section); \
build/ROMID/lib/naudio/n_syndelete.o (section); \
build/ROMID/lib/lib_39fe0.o (section); \
build/ROMID/lib/lib_3a100.o (section); \
build/ROMID/lib/lib_3c430.o (section); \
build/ROMID/lib/ultra/audio/event.o (section); \
build/ROMID/lib/naudio/n_event.o (section); \
build/ROMID/lib/lib_3c890.o (section); \
build/ROMID/lib/lib_3ccf0.o (section); \
build/ROMID/lib/lib_3cdc0.o (section); \
build/ROMID/lib/lib_3cef0.o (section); \
build/ROMID/lib/lib_3d280.o (section); \
build/ROMID/lib/naudio/n_seqplayer.o (section); \
build/ROMID/lib/lib_3e3e0.o (section); \
build/ROMID/lib/lib_3e730.o (section); \
build/ROMID/lib/lib_3e8c0.o (section); \
build/ROMID/lib/naudio/n_env.o (section); \
build/ROMID/lib/lib_3f8a0.o (section); \
build/ROMID/lib/lib_43dd0.o (section); \
build/ROMID/lib/lib_446d0.o (section); \
build/ROMID/lib/lib_44bc0.o (section); \
build/ROMID/lib/ultra/audio/synsetpriority.o (section); \
build/ROMID/lib/naudio/n_synsetpriority.o (section); \
build/ROMID/lib/lib_44f60.o (section); \
build/ROMID/lib/lib_45ed0.o (section); \
build/ROMID/lib/lib_461c0.o (section); \

View File

@ -122,22 +122,6 @@ SECTIONS
_val7f11c1d0 = 0x11c3;
#endif
#if VERSION >= VERSION_PAL_FINAL
rspbootTextStart = 0x80059fe0;
rspbootTextEnd = 0x8005a0b0;
aspMainTextStart = 0x8005b180;
aspMainTextEnd = 0x8005c180;
aspMainDataStart = 0x8008a2d0;
aspMainDataEnd = 0x8008aad0;
#else
rspbootTextStart = 0x80059fe0;
rspbootTextEnd = 0x8005a0b0;
aspMainTextStart = 0x8005b4d0;
aspMainTextEnd = 0x8005c4d0;
aspMainDataStart = 0x8008a2d0;
aspMainDataEnd = 0x8008aad0;
#endif
osTvType = 0x80000300;
osRomType = 0x80000304;
osRomBase = 0x80000308;
@ -271,8 +255,8 @@ SECTIONS
gspDataStart = _dataSegmentEnd - 0x800 - 0xb50;
gspDataEnd = gspDataStart + 0x800;
aspMainDataStart = gspDataEnd;
aspMainDataEnd = aspMainDataStart + 0xb50;
aspDataStart = gspDataEnd;
aspDataEnd = aspDataStart + 0xb50;
/***************************************************************************
* bss

View File

@ -67,7 +67,7 @@ void func0f095350(u32 arg0, u32 *arg1)
value = *ptr;
}
*arg1 = *(u32 *)(osRomBase | arg0 | 0xa0000000);
*arg1 = *(u32 *)((u32)osRomBase | arg0 | 0xa0000000);
__osPiRelAccess();
}

View File

@ -67060,7 +67060,7 @@ void func0f08e224(struct doorobj *door)
}
}
extern u32 osCicId;
extern s32 osCicId;
void func0f08e2ac(struct doorobj *door)
{

View File

@ -36,8 +36,8 @@ u32 var8009ccb8;
s16 var800624a0 = 480;
s32 var800624a4 = false;
u32 var800624a8 = 0x00000000;
u32 var800624ac = 0x00000000;
s32 var800624a8 = 0;
s32 var800624ac = 0;
u32 var800624b0 = 0x00000000;
s32 g_TitleMode = -1;
s32 g_TitleNextMode = -1;
@ -5396,7 +5396,7 @@ void titleTickNintendoLogo(void)
}
if (joyGetButtonsPressedThisFrame(0, 0xffff)) {
if (osResetType == RESET_TYPE_NMI) {
if (osResetType == 1 /*warm*/) {
var800624a8 = 1;
titleSetNextMode(TITLEMODE_PDLOGO);
} else if (var800624a8 == 0) {
@ -6095,7 +6095,7 @@ void titleTickRareLogo(void)
g_TitleTimer += g_Vars.lvupdate240_60;
if (joyGetButtonsPressedThisFrame(0, 0xffff)) {
if (osResetType == RESET_TYPE_NMI) {
if (osResetType == 1 /*warm*/) {
var800624a8 = 1;
titleSetNextMode(TITLEMODE_PDLOGO);
} else if (var800624a8 == 0) {

View File

@ -1,971 +0,0 @@
/*
* 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

View File

@ -1,41 +0,0 @@
#ifndef _ULTRA64_GU_H_
#define _ULTRA64_GU_H_
#define GU_PI 3.1415926
#define FTOFIX32(x) (long)((x) * (float)0x00010000)
#define FIX32TOF(x) ((float)(x) * (1.0f / (float)0x00010000))
#define FTOFRAC8(x) ((int) MIN(((x) * (128.0f)), 127.0f) & 0xff)
/* Functions */
void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, float aspect,
float near, float far, float scale);
void guPerspective(Mtx *m, u16 *perspNorm, float fovy, float aspect, float near,
float far, float scale);
void guOrtho(Mtx *m, float left, float right, float bottom, float top,
float near, float far, float scale);
void guTranslate(Mtx *m, float x, float y, float z);
void guRotate(Mtx *m, float a, float x, float y, float z);
void guScale(Mtx *m, float x, float y, float z);
void guMtxF2L(float mf[4][4], Mtx *m);
void guMtxIdent(Mtx *m);
void guMtxIdentF(float mf[4][4]);
void guMtxL2F(float mf[4][4], Mtx *m);
void guNormalize(float *, float *, float *);
void guAlignF(float mf[4][4], float a, float x, float y, float z);
void guRotateF(float mf[4][4], float a, float x, float y, float z);
void guFrustumF(float mf[4][4], float l, float r, float b, float t, float n, float f, float scale);
void guLookAt(Mtx *m, float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp);
signed short coss(unsigned short x);
signed short sins(unsigned short x);
/* Used only in Fast3DEX2 */
void guLookAtReflect (Mtx *m, LookAt *l, float xEye, float yEye, float zEye,
float xAt, float yAt, float zAt,
float xUp, float yUp, float zUp);
#endif

View File

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

View File

@ -1,18 +0,0 @@
#ifndef _ULTRA64_OS_INTERNAL_H_
#define _ULTRA64_OS_INTERNAL_H_
/* Internal functions used by the operating system */
/* Do not include this header in application code */
/* Variables */
//extern u64 osClockRate;
/* Functions */
/*u32 __osProbeTLB(void *);
u32 __osDisableInt(void);
void __osRestoreInt(u32);*/
OSThread *__osGetCurrFaultedThread(void);
#endif

View File

@ -1,132 +0,0 @@
#ifndef _ULTRA64_OS_MISC_H_
#define _ULTRA64_OS_MISC_H_
/* float properties */
#define _D0 0
#define _DBIAS 0x3ff
#define _DLONG 1
#define _DOFF 4
#define _FBIAS 0x7e
#define _FOFF 7
#define _FRND 1
#define _LBIAS 0x3ffe
#define _LOFF 15
/* integer properties */
#define _C2 1
#define _CSIGN 1
#define _ILONG 0
#define _MBMAX 8
#define NAN 2
#define INF 1
#define FINITE -1
#define _DFRAC ((1 << _DOFF) - 1)
#define _DMASK (0x7fff & ~_DFRAC)
#define _DMAX ((1 << (15 - _DOFF)) - 1)
#define _DNAN (0x8000 | _DMAX << _DOFF | 1 << (_DOFF - 1))
#define _DSIGN 0x8000
#define _D1 1 /* big-endian order */
#define _D2 2
#define _D3 3
#define FLAGS_SPACE 1
#define FLAGS_PLUS 2
#define FLAGS_MINUS 4
#define FLAGS_HASH 8
#define FLAGS_ZERO 16
#define BLOCKSIZE 32
#define ARRLEN(x) ((s32)(sizeof(x) / sizeof(x[0])))
#define ERRCK(fn) \
ret = fn; \
if (ret != 0) \
return ret;
typedef struct {
union {
/* 00 */ long long s64;
double f64;
} value;
/* 08 */ char *buff;
/* 0c */ int n0;
/* 10 */ int num_leading_zeros;
/* 14 */ int part2_len;
/* 18 */ int num_mid_zeros;
/* 1c */ int part3_len;
/* 20 */ int num_trailing_zeros;
/* 24 */ int precision;
/* 28 */ int width;
/* 2c */ unsigned int size;
/* 30 */ unsigned int flags;
/* 34 */ char length;
} printf_struct;
typedef char *va_list;
#define _FP 1
#define _INT 0
#define _STRUCT 2
#define _VA_FP_SAVE_AREA 0x10
#define _VA_ALIGN(p, a) (((unsigned int)(((char *)p) + ((a) > 4 ? (a) : 4) - 1)) & -((a) > 4 ? (a) : 4))
#define va_start(vp, parmN) (vp = ((va_list)&parmN + sizeof(parmN)))
#define __va_stack_arg(list, mode) \
( \
((list) = (char *)_VA_ALIGN(list, __builtin_alignof(mode)) + \
_VA_ALIGN(sizeof(mode), 4)), \
(((char *)list) - (_VA_ALIGN(sizeof(mode), 4) - sizeof(mode))))
#define __va_double_arg(list, mode) \
( \
(((long)list & 0x1) /* 1 byte aligned? */ \
? (list = (char *)((long)list + 7), (char *)((long)list - 6 - _VA_FP_SAVE_AREA)) \
: (((long)list & 0x2) /* 2 byte aligned? */ \
? (list = (char *)((long)list + 10), (char *)((long)list - 24 - _VA_FP_SAVE_AREA)) \
: __va_stack_arg(list, mode))))
#define va_arg(list, mode) ((mode *)(((__builtin_classof(mode) == _FP && \
__builtin_alignof(mode) == sizeof(double)) \
? __va_double_arg(list, mode) \
: __va_stack_arg(list, mode))))[-1]
#define va_end(__list)
#define EEPROM_MAXBLOCKS 64
#define EEP16K_MAXBLOCKS 256
#define EEPROM_BLOCK_SIZE 8
/*
* PI/EPI
*/
#define PI_DOMAIN1 0
#define PI_DOMAIN2 1
#define OS_CLOCK_RATE 62500000LL
#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4)
#define OS_NSEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625000LL))/(1000000000LL/15625000LL))
#define OS_USEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625LL))/(1000000LL/15625LL))
#define OS_CYCLES_TO_NSEC(c) (((u64)(c)*(1000000000LL/15625000LL))/(OS_CPU_COUNTER/15625000LL))
#define OS_CYCLES_TO_USEC(c) (((u64)(c)*(1000000LL/15625LL))/(OS_CPU_COUNTER/15625LL))
#define LEO_BLOCK_MODE 1
#define LEO_TRACK_MODE 2
#define LEO_SECTOR_MODE 3
/* Miscellaneous OS functions */
void osInitialize(void);
u32 osGetCount(void);
u32 osVirtualToPhysical(void *);
f32 cosf(f32 arg0);
f32 sinf(f32 arg0);
f32 sqrtf(f32 arg0);
void *memcpy(void *, const void *, size_t);
size_t strlen(const char *s);
char *strchr(const char *s, int c);
#endif

View File

@ -1,220 +0,0 @@
/*====================================================================
* os_pfs.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_pfs.h,v $
$Revision: 1.1 $
$Date: 1998/10/09 08:01:05 $
*---------------------------------------------------------------------*/
#ifndef _OS_PFS_H_
#define _OS_PFS_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
#endif
#include <PR/ultratypes.h>
#include "os_message.h"
/**************************************************************************
*
* Type definitions
*
*/
typedef struct {
int status;
OSMesgQueue *queue;
int channel;
u8 id[32];
u8 label[32];
int version;
int dir_size;
int inode_table; /* block location */
int minode_table; /* mirrioring inode_table */
int dir_table; /* block location */
int inode_start_page; /* page # */
u8 banks;
u8 activebank;
} OSPfs;
typedef struct {
u32 file_size; /* bytes */
u32 game_code;
u16 company_code;
char ext_name[4];
char game_name[16];
} OSPfsState;
typedef struct {
u16 fixed1; /* Fixed data (0x00, 0xc3) */
u16 start_address; /* Program start address */
u8 nintendo_chr[0x30]; /* "Nintendo" character data */
u8 game_title[16]; /* Game title */
u16 company_code; /* Company code */
u8 body_code; /* Body code */
u8 cart_type; /* Game pak type */
u8 rom_size; /* ROM size */
u8 ram_size; /* RAM size */
u8 country_code; /* country code */
u8 fixed_data; /* fixed data(0x33) */
u8 version; /* Mask ROM version number */
u8 isum; /* Complement check */
u16 sum; /* Sum check */
} OSGbpakId;
/**************************************************************************
*
* Global definitions
*
*/
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
#define PFS_ERR_NOPACK 1 /* no memory card is plugged */
#define PFS_ERR_NEW_PACK 2 /* ram pack has been changed to a different one */
#define PFS_ERR_INCONSISTENT 3 /* need to run Pfschecker */
#define PFS_ERR_CONTRFAIL 4
#define PFS_ERR_INVALID 5 /* invalid parameter or file not exist */
#define PFS_ERR_BAD_DATA 6 /* the data read from pack are bad */
#define PFS_DATA_FULL 7 /* no free pages on ram pack */
#define PFS_DIR_FULL 8 /* no free directories on ram pack */
#define PFS_ERR_EXIST 9 /* file exists */
#define PFS_ERR_ID_FATAL 10 /* dead ram pack */
#define PFS_ERR_DEVICE 11 /* wrong device type */
#define PFS_ERR_NO_GBCART 12 /* no gb cartridge (64GB-PAK) */
#define PFS_ERR_NEW_GBCART 13 /* gb cartridge may be changed */
#define OS_PFS_VERSION 0x0200
#define OS_PFS_VERSION_HI (OS_PFS_VERSION >> 8)
#define OS_PFS_VERSION_LO (OS_PFS_VERSION & 255)
#define OS_GBPAK_POWER 0x01
#define OS_GBPAK_RSTB_DETECTION 0x04
#define OS_GBPAK_RSTB_STATUS 0x08
#define OS_GBPAK_GBCART_PULL 0x40
#define OS_GBPAK_GBCART_ON 0x80
#define OS_GBPAK_POWER_OFF 0
#define OS_GBPAK_POWER_ON 1
#define PFS_FILE_NAME_LEN 16
#define PFS_FILE_EXT_LEN 4
#define BLOCKSIZE 32 /* bytes */
#define PFS_ONE_PAGE 8 /* blocks */
#define PFS_MAX_BANKS 62
#define PFS_LABEL_AREA 7
#define PFS_INODE_SIZE_PER_PAGE 128
#define PFS_PAGE_NOT_USED 3
#define PFS_WRITTEN 2
#define PFS_PAGE_SIZE (BLOCKSIZE * PFS_ONE_PAGE)
#define PFS_READ 0
#define PFS_WRITE 1
#define PFS_CREATE 2
#define PFS_INITIALIZED 0x01
#define PFS_CORRUPTED 0x02
#define PFS_ID_BROKEN 0x04
#define PFS_MOTOR_INITIALIZED 0x08
#define PFS_GBPAK_INITIALIZED 0x10
/**************************************************************************
*
* Macro definitions
*
*/
#define osMotorStop(pfs) osMotorAccess(pfs, 0)
#define osMotorStart(pfs) osMotorAccess(pfs, 1)
#define SET_ACTIVEBANK_TO_ZERO \
if (pfs->activebank != 0) \
{ \
pfs->activebank = 0; \
ERRCK(__osPfsSelectBank(pfs)) \
}
#define PFS_CHECK_ID \
if (__osCheckId(pfs) == PFS_ERR_NEW_PACK) \
return PFS_ERR_NEW_PACK;
#define PFS_CHECK_STATUS \
if ((pfs->status & PFS_INITIALIZED) == 0) \
return PFS_ERR_INVALID;
#define PFS_GET_STATUS \
__osSiGetAccess(); \
ret = __osPfsGetStatus(queue, channel); \
__osSiRelAccess(); \
if (ret != 0) \
return ret;
/**************************************************************************
*
* Extern variables
*
*/
/**************************************************************************
*
* Function prototypes
*
*/
s32 osPfsIsPlug(OSMesgQueue *, u8 *);
s32 osPfsAllocateFile(OSPfs *pfs, u16 company_code, u32 game_code, char *game_name, char *ext_name, s32 num_bytes, s32 *file_no);
s32 osPfsFindFile(OSPfs *pfs, u16 company_code, u32 game_code, char *game_name, char *ext_name, s32 *file_no);
s32 osPfsDeleteFile(OSPfs *pfs, u16 company_code, u32 game_code, char *game_name, char *ext_name);
s32 osPfsFileState(OSPfs *pfs, s32 file_no, OSPfsState *state);
s32 osPfsReadWriteFile(OSPfs* pfs, s32 fileNo, u8 flag, s32 offset, s32 size, u8* data);
s32 osPfsFreeBlocks(OSPfs* pfs, s32 *bytes_not_used);
s32 osPfsReSizeFile(OSPfs *pfs, u16 company_code, u32 game_code, u8 *game_name, u8 *ext_name, u32 numbytes);
#if VERSION >= VERSION_NTSC_1_0
s32 osPfsInitPak(OSMesgQueue *mq, OSPfs *pfs, s32 channel, s32 *arg3);
#else
s32 osPfsInitPak(OSMesgQueue *mq, OSPfs *pfs, s32 channel);
#endif
s32 osMotorAccess(OSPfs *pfs, u32 vibrate);
void osSetUpMempakWrite(s32 channel, OSPifRam* buf);
s32 osMotorProbe(OSMesgQueue *mq, OSPfs *pfs, s32 channel);
s32 osGbpakCheckConnector(OSPfs *pfs, u8 *status);
s32 osGbpakGetStatus(OSPfs *pfs, u8 *status);
s32 osGbpakInit(OSMesgQueue *siMessegeQ, OSPfs *pfs, s32 channel);
s32 osGbpakPower(OSPfs *pfs, s32 flag);
s32 osGbpakReadId(OSPfs *pfs, OSGbpakId *id, u8 *status);
s32 osGbpakReadWrite(OSPfs *pfs, u16 flag, u16 address, u8 *buffer, u16 size);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
#ifdef _LANGUAGE_C_PLUS_PLUS
}
#endif
#endif /* !_OS_PFS_H_ */

View File

@ -1,196 +0,0 @@
#ifndef _ULTRA64_PI_H_
#define _ULTRA64_PI_H_
/* Ultra64 Parallel Interface */
/* Types */
typedef struct
{
u32 errStatus;
void *dramAddr;
void *C2Addr;
u32 sectorSize;
u32 C1ErrNum;
u32 C1ErrSector[4];
} __OSBlockInfo;
typedef struct
{
u32 cmdType;
u16 transferMode;
u16 blockNum;
s32 sectorNum;
u32 devAddr;
u32 bmCtlShadow;
u32 seqCtlShadow;
__OSBlockInfo block[2];
} __OSTranxInfo;
typedef struct OSPiHandle_s
{
struct OSPiHandle_s *next;
u8 type;
u8 latency;
u8 pageSize;
u8 relDuration;
u8 pulse;
u8 domain;
u32 baseAddress;
u32 speed;
__OSTranxInfo transferInfo;
} OSPiHandle;
typedef struct
{
u8 type;
u32 address;
} OSPiInfo;
typedef struct
{
u16 type;
u8 pri;
u8 status;
OSMesgQueue *retQueue;
} OSIoMesgHdr;
typedef struct
{
/*0x00*/ OSIoMesgHdr hdr;
/*0x08*/ void *dramAddr;
/*0x0C*/ u32 devAddr;
/*0x10*/ u32 size;
OSPiHandle *piHandle; //from the official definition
} OSIoMesg;
typedef struct {
s32 active; /* Status flag */
OSThread *thread; /* Calling thread */
OSMesgQueue *cmdQueue; /* Command queue */
OSMesgQueue *evtQueue; /* Event queue */
OSMesgQueue *acsQueue; /* Access queue */
/* Raw DMA routine */
s32 (*dma)(s32, u32, void *, u32);
s32 (*edma)(OSPiHandle *, s32, u32, void *, u32);
} OSDevMgr;
/* Definitions */
#define OS_READ 0 // device -> RDRAM
#define OS_WRITE 1 // device <- RDRAM
#define OS_MESG_PRI_NORMAL 0
#define OS_MESG_PRI_HIGH 1
#define WAIT_ON_IOBUSY(stat) \
stat = IO_READ(PI_STATUS_REG); \
while (stat & (PI_STATUS_IO_BUSY | PI_STATUS_DMA_BUSY)) \
stat = IO_READ(PI_STATUS_REG);
#define UPDATE_REG(reg, var) \
if (cHandle->var != pihandle->var) \
IO_WRITE(reg, pihandle->var);
#define LEO_BASE_REG 0x05000000
#define LEO_CMD (LEO_BASE_REG + 0x508)
#define LEO_STATUS (LEO_BASE_REG + 0x508)
#define LEO_BM_CTL (LEO_BASE_REG + 0x510)
#define LEO_BM_STATUS (LEO_BASE_REG + 0x510)
#define LEO_SEQ_CTL (LEO_BASE_REG + 0x518)
#define LEO_SEQ_STATUS (LEO_BASE_REG + 0x518)
#define LEO_C2_BUFF (LEO_BASE_REG + 0x000) //C2 Sector Buffer
#define LEO_SECTOR_BUFF (LEO_BASE_REG + 0x400) //Data Sector Buffer
#define LEO_DATA (LEO_BASE_REG + 0x500) //Data
#define LEO_MISC_REG (LEO_BASE_REG + 0x504) //Misc Register
#define LEO_CUR_TK (LEO_BASE_REG + 0x50C) //Current Track
#define LEO_ERR_SECTOR (LEO_BASE_REG + 0x514) //Sector Error Status
#define LEO_CUR_SECTOR (LEO_BASE_REG + 0x51C) //Current Sector
#define LEO_HARD_RESET (LEO_BASE_REG + 0x520) //Hard Reset
#define LEO_C1_S0 (LEO_BASE_REG + 0x524) //C1
#define LEO_HOST_SECBYTE (LEO_BASE_REG + 0x528) //Sector Size (in bytes)
#define LEO_C1_S2 (LEO_BASE_REG + 0x52C) //C1
#define LEO_SEC_BYTE (LEO_BASE_REG + 0x530) //Sectors per Block, Full Size
#define LEO_C1_S4 (LEO_BASE_REG + 0x534) //C1
#define LEO_C1_S6 (LEO_BASE_REG + 0x538) //C1
#define LEO_CUR_ADDR (LEO_BASE_REG + 0x53C) //Current Address?
#define LEO_ID_REG (LEO_BASE_REG + 0x540) //ID
#define LEO_TEST_REG (LEO_BASE_REG + 0x544) //Test Read
#define LEO_TEST_PIN_SEL (LEO_BASE_REG + 0x548) //Test Write
#define LEO_RAM_ADDR (LEO_BASE_REG + 0x580) //Microsequencer RAM
#define LEO_STATUS_PRESENCE_MASK 0xFFFF
#define LEO_STATUS_DATA_REQUEST 0x40000000
#define LEO_STATUS_C2_TRANSFER 0x10000000
#define LEO_STATUS_BUFFER_MANAGER_ERROR 0x08000000
#define LEO_STATUS_BUFFER_MANAGER_INTERRUPT 0x04000000
#define LEO_STATUS_MECHANIC_INTERRUPT 0x02000000
#define LEO_STATUS_DISK_PRESENT 0x01000000
#define LEO_STATUS_BUSY_STATE 0x00800000
#define LEO_STATUS_RESET_STATE 0x00400000
#define LEO_STATUS_MOTOR_NOT_SPINNING 0x00100000
#define LEO_STATUS_HEAD_RETRACTED 0x00080000
#define LEO_STATUS_WRITE_PROTECT_ERROR 0x00040000
#define LEO_STATUS_MECHANIC_ERROR 0x00020000
#define LEO_STATUS_DISK_CHANGE 0x00010000
#define LEO_STATUS_MODE_MASK (LEO_STATUS_MOTOR_NOT_SPINNING | LEO_STATUS_HEAD_RETRACTED)
#define LEO_STATUS_MODE_SLEEP (LEO_STATUS_MOTOR_NOT_SPINNING | LEO_STATUS_HEAD_RETRACTED)
#define LEO_STATUS_MODE_STANDBY (LEO_STATUS_HEAD_RETRACTED)
#define LEO_STATUS_MODE_ACTIVE 0
#define LEO_CUR_TK_INDEX_LOCK 0x60000000
#define LEO_BM_STATUS_RUNNING 0x80000000
#define LEO_BM_STATUS_ERROR 0x04000000
#define LEO_BM_STATUS_MICRO 0x02000000
#define LEO_BM_STATUS_BLOCK 0x01000000
#define LEO_BM_STATUS_C1CORRECTION 0x00800000
#define LEO_BM_STATUS_C1DOUBLE 0x00400000
#define LEO_BM_STATUS_C1SINGLE 0x00200000
#define LEO_BM_STATUS_C1ERROR 0x00010000
#define LEO_BM_CTL_START 0x80000000
#define LEO_BM_CTL_MODE 0x40000000
#define LEO_BM_CTL_IMASK 0x20000000
#define LEO_BM_CTL_RESET 0x10000000
#define LEO_BM_CTL_DISABLE_OR 0x08000000
#define LEO_BM_CTL_DISABLE_C1 0x04000000
#define LEO_BM_CTL_BLOCK 0x02000000
#define LEO_BM_CTL_CLR_MECHANIC_INTR 0x01000000
#define LEO_BM_CTL_CONTROL_MASK 0xFF000000
#define LEO_BM_CTL_SECTOR_MASK 0x00FF0000
#define LEO_BM_CTL_SECTOR_SHIFT 16
#define LEO_CMD_TYPE_0 0
#define LEO_CMD_TYPE_1 1
#define LEO_CMD_TYPE_2 2
#define LEO_ERROR_GOOD 0
#define LEO_ERROR_4 4
#define LEO_ERROR_22 22
#define LEO_ERROR_23 23
#define LEO_ERROR_24 24
#define LEO_ERROR_29 29
/* Functions */
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction,
u32 devAddr, void *vAddr, u32 nbytes, OSMesgQueue *mq);
void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf,
s32 cmdMsgCnt);
OSMesgQueue *osPiGetCmdQueue(void);
s32 osPiWriteIo(u32 devAddr, u32 data);
s32 osPiReadIo(u32 devAddr, u32 *data);
s32 osPiRawStartDma(s32 direction, u32 devAddr, void *dramAddr, u32 size);
s32 osEPiRawStartDma(OSPiHandle *pihandle, s32 direction, u32 devAddr, void *dramAddr, u32 size);
void __osDevMgrMain(void *args);
#endif

View File

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

View File

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

View File

@ -1,235 +0,0 @@
#ifndef _ULTRA64_VI_H_
#define _ULTRA64_VI_H_
/* Ultra64 Video Interface */
/*
* Video Interface (VI) mode type
*/
#define OS_VI_NTSC_LPN1 0 /* NTSC */
#define OS_VI_NTSC_LPF1 1
#define OS_VI_NTSC_LAN1 2
#define OS_VI_NTSC_LAF1 3
#define OS_VI_NTSC_LPN2 4
#define OS_VI_NTSC_LPF2 5
#define OS_VI_NTSC_LAN2 6
#define OS_VI_NTSC_LAF2 7
#define OS_VI_NTSC_HPN1 8
#define OS_VI_NTSC_HPF1 9
#define OS_VI_NTSC_HAN1 10
#define OS_VI_NTSC_HAF1 11
#define OS_VI_NTSC_HPN2 12
#define OS_VI_NTSC_HPF2 13
#define OS_VI_PAL_LPN1 14 /* PAL */
#define OS_VI_PAL_LPF1 15
#define OS_VI_PAL_LAN1 16
#define OS_VI_PAL_LAF1 17
#define OS_VI_PAL_LPN2 18
#define OS_VI_PAL_LPF2 19
#define OS_VI_PAL_LAN2 20
#define OS_VI_PAL_LAF2 21
#define OS_VI_PAL_HPN1 22
#define OS_VI_PAL_HPF1 23
#define OS_VI_PAL_HAN1 24
#define OS_VI_PAL_HAF1 25
#define OS_VI_PAL_HPN2 26
#define OS_VI_PAL_HPF2 27
#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 - fullscreen 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
/* Special Features */
#define OS_VI_GAMMA_ON 0x0001
#define OS_VI_GAMMA_OFF 0x0002
#define OS_VI_GAMMA_DITHER_ON 0x0004
#define OS_VI_GAMMA_DITHER_OFF 0x0008
#define OS_VI_DIVOT_ON 0x0010
#define OS_VI_DIVOT_OFF 0x0020
#define OS_VI_DITHER_FILTER_ON 0x0040
#define OS_VI_DITHER_FILTER_OFF 0x0080
#define OS_VI_GAMMA 0x08
#define OS_VI_GAMMA_DITHER 0x04
#define OS_VI_DIVOT 0x10
#define OS_VI_DITHER_FILTER 0x10000
#define OS_VI_UNK200 0x200
#define OS_VI_UNK100 0x100
#define VI_STATE_01 0x01
#define VI_STATE_XSCALE_UPDATED 0x02
#define VI_STATE_YSCALE_UPDATED 0x04
#define VI_STATE_08 0x08
#define VI_STATE_10 0x10
#define VI_STATE_BLACK 0x20
#define VI_STATE_REPEATLINE 0x40
#define VI_STATE_FADE 0x80
#define VI_STATE_BLACK 0x20
#define VI_CTRL_ANTIALIAS_MODE_3 0x00300 /* Bit [9:8] anti-alias mode */
#define VI_CTRL_ANTIALIAS_MODE_2 0x00200 /* Bit [9:8] anti-alias mode */
#define VI_CTRL_ANTIALIAS_MODE_1 0x00100 /* Bit [9:8] anti-alias mode */
#define VI_SCALE_MASK 0xfff
#define VI_2_10_FPART_MASK 0x3ff
#define VI_SUBPIXEL_SH 0x10
#define BURST(hsync_width, color_width, vsync_width, color_start) \
(hsync_width | (color_width << 8) | (vsync_width << 16) | (color_start << 20))
#define WIDTH(v) v
#define VSYNC(v) v
#define HSYNC(duration, leap) (duration | (leap << 16))
#define LEAP(upper, lower) ((upper << 16) | lower)
#define START(start, end) ((start << 16) | end)
#define FTOFIX(val, i, f) ((u32)(val * (f32)(1 << f)) & ((1 << (i + f)) - 1))
#define F210(val) FTOFIX(val, 2, 10)
#define SCALE(scaleup, off) (F210((1.0f / (f32)scaleup)) | (F210((f32)off) << 16))
#define VCURRENT(v) v //seemingly unused
#define ORIGIN(v) v
#define VINTR(v) v
#define HSTART START
/* Types */
typedef struct
{
u32 ctrl;
u32 width;
u32 burst;
u32 vSync;
u32 hSync;
u32 leap;
u32 hStart;
u32 xScale;
u32 vCurrent;
} OSViCommonRegs;
typedef struct
{
u32 origin;
u32 yScale;
u32 vStart;
u32 vBurst;
u32 vIntr;
} OSViFieldRegs;
typedef struct
{
u8 type;
OSViCommonRegs comRegs;
OSViFieldRegs fldRegs[2];
} OSViMode;
typedef struct
{
/* 0x00 */ u16 unk00; //some kind of flags. swap buffer sets to 0x10
/* 0x02 */ u16 retraceCount;
/* 0x04 */ void* buffer;
/* 0x08 */ OSViMode *unk08;
/* 0x0c */ u32 features;
/* 0x10 */ OSMesgQueue *mq;
/* 0x14 */ OSMesg *msg;
/* 0x18 */ u32 unk18;
/* 0x1c */ u32 unk1c;
/* 0x20 */ u32 unk20;
/* 0x24 */ f32 unk24;
/* 0x28 */ u16 unk28;
/* 0x2c */ u32 unk2c;
} OSViContext;
typedef struct
{
/* 0x0 */ f32 factor;
/* 0x4 */ u16 offset;
/* 0x8 */ u32 scale;
} __OSViScale;
typedef struct
{
/* 0x0 */ u16 state;
/* 0x2 */ u16 retraceCount;
/* 0x4 */ void *framep;
/* 0x8 */ OSViMode *modep;
/* 0xC */ u32 control;
/* 0x10 */ OSMesgQueue *msgq;
/* 0x14 */ OSMesg msg;
/* 0x18 */ __OSViScale x;
/* 0x24 */ __OSViScale y;
} __OSViContext;
void osCreateViManager(OSPri pri);
void osViSetMode(OSViMode *mode);
void osViSetEvent(OSMesgQueue *mq, OSMesg msg, u32 retraceCount);
void osViBlack(u8 active);
void osViSetSpecialFeatures(u32 func);
void osViSwapBuffer(void *vaddr);
void osViSetXScale(f32 scale);
void osViSetYScale(f32 scale);
#define OS_VI_NTSC_LPN1 0 /* NTSC */
#define OS_VI_NTSC_LPF1 1
#define OS_VI_NTSC_LAN1 2
#define OS_VI_NTSC_LAF1 3
#define OS_VI_NTSC_LPN2 4
#define OS_VI_NTSC_LPF2 5
#define OS_VI_NTSC_LAN2 6
#define OS_VI_NTSC_LAF2 7
#define OS_VI_NTSC_HPN1 8
#define OS_VI_NTSC_HPF1 9
#define OS_VI_NTSC_HAN1 10
#define OS_VI_NTSC_HAF1 11
#define OS_VI_NTSC_HPN2 12
#define OS_VI_NTSC_HPF2 13
#define OS_VI_PAL_LPN1 14 /* PAL */
#define OS_VI_PAL_LPF1 15
#define OS_VI_PAL_LAN1 16
#define OS_VI_PAL_LAF1 17
#define OS_VI_PAL_LPN2 18
#define OS_VI_PAL_LPF2 19
#define OS_VI_PAL_LAN2 20
#define OS_VI_PAL_LAF2 21
#define OS_VI_PAL_HPN1 22
#define OS_VI_PAL_HPF1 23
#define OS_VI_PAL_HAN1 24
#define OS_VI_PAL_HAF1 25
#define OS_VI_PAL_HPN2 26
#define OS_VI_PAL_HPF2 27
extern OSViMode osViModeTable[]; /* Global VI mode table */
#endif

View File

@ -1,122 +0,0 @@
#ifndef _ULTRA64_SPTASK_H_
#define _ULTRA64_SPTASK_H_
/* Task Types */
#define M_GFXTASK 1
#define M_AUDTASK 2
#define M_VIDTASK 3
#define M_HVQTASK 6
#define M_HVQMTASK 7
#if (defined(F3DEX_GBI) || defined(F3DLP_GBI) || defined(F3DEX_GBI_2) || 1)
#define OS_YIELD_DATA_SIZE 0xc00
#else
#define OS_YIELD_DATA_SIZE 0x900
#endif
#define OS_YIELD_AUDIO_SIZE 0x400
/* Flags */
#define M_TASK_FLAG0 1
#define M_TASK_FLAG1 2
#define OS_TASK_YIELDED 0x0001
#define OS_TASK_DP_WAIT 0x0002
#define OS_TASK_LOADABLE 0x0004
#define OS_TASK_SP_ONLY 0x0008
#define OS_TASK_USR0 0x0010
#define OS_TASK_USR1 0x0020
#define OS_TASK_USR2 0x0040
#define OS_TASK_USR3 0x0080
/* SpStatus */
#define SPSTATUS_CLEAR_HALT 0x00000001
#define SPSTATUS_SET_HALT 0x00000002
#define SPSTATUS_CLEAR_BROKE 0x00000004
#define SPSTATUS_CLEAR_INTR 0x00000008
#define SPSTATUS_SET_INTR 0x00000010
#define SPSTATUS_CLEAR_SSTEP 0x00000020
#define SPSTATUS_SET_SSTEP 0x00000040
#define SPSTATUS_CLEAR_INTR_ON_BREAK 0x00000080
#define SPSTATUS_SET_INTR_ON_BREAK 0x00000100
#define SPSTATUS_CLEAR_SIGNAL0 0x00000200
#define SPSTATUS_SET_SIGNAL0 0x00000400
#define SPSTATUS_CLEAR_SIGNAL1 0x00000800
#define SPSTATUS_SET_SIGNAL1 0x00001000
#define SPSTATUS_CLEAR_SIGNAL2 0x00002000
#define SPSTATUS_SET_SIGNAL2 0x00004000
#define SPSTATUS_CLEAR_SIGNAL3 0x00008000
#define SPSTATUS_SET_SIGNAL3 0x00010000
#define SPSTATUS_CLEAR_SIGNAL4 0x00020000
#define SPSTATUS_SET_SIGNAL4 0x00040000
#define SPSTATUS_CLEAR_SIGNAL5 0x00080000
#define SPSTATUS_SET_SIGNAL5 0x00100000
#define SPSTATUS_CLEAR_SIGNAL6 0x00200000
#define SPSTATUS_SET_SIGNAL6 0x00800000
#define SPSTATUS_CLEAR_SIGNAL7 0x01000000
#define SPSTATUS_SET_SIGNAL7 0x02000000
#define SPSTATUS_HALT 0x0001
#define SPSTATUS_BROKE 0x0002
#define SPSTATUS_DMA_BUSY 0x0004
#define SPSTATUS_DMA_FULL 0x0008
#define SPSTATUS_IO_FULL 0x0010
#define SPSTATUS_SINGLE_STEP 0x0020
#define SPSTATUS_INTERRUPT_ON_BREAK 0x0040
#define SPSTATUS_SIGNAL0_SET 0x0080
#define SPSTATUS_SIGNAL1_SET 0x0100
#define SPSTATUS_SIGNAL2_SET 0x0200
#define SPSTATUS_SIGNAL3_SET 0x0400
#define SPSTATUS_SIGNAL4_SET 0x0800
#define SPSTATUS_SIGNAL5_SET 0x1000
#define SPSTATUS_SIGNAL6_SET 0x2000
#define SPSTATUS_SIGNAL7_SET 0x4000
/* Types */
/* Types */
typedef struct
{
/*0x00*/ u32 type;
/*0x04*/ u32 flags;
/*0x08*/ u64 *ucode_boot;
/*0x0C*/ u32 ucode_boot_size;
/*0x10*/ u64 *ucode;
/*0x14*/ u32 ucode_size;
/*0x18*/ u64 *ucode_data;
/*0x1C*/ u32 ucode_data_size;
/*0x20*/ u64 *dram_stack;
/*0x24*/ u32 dram_stack_size;
/*0x28*/ u64 *output_buff;
/*0x2C*/ u64 *output_buff_size;
/*0x30*/ u64 *data_ptr;
/*0x34*/ u32 data_size;
/*0x38*/ u64 *yield_data_ptr;
/*0x3C*/ u32 yield_data_size;
} OSTask_t; // size = 0x40
typedef union {
OSTask_t t;
long long int force_structure_alignment;
} OSTask;
typedef u32 OSYieldResult;
/* Functions */
#define osSpTaskStart(p) \
osSpTaskLoad(p); \
osSpTaskStartGo(p);
void osSpTaskLoad(OSTask *task);
void osSpTaskStartGo(OSTask *task);
void osSpTaskYield(void);
OSYieldResult osSpTaskYielded(OSTask *task);
#endif

View File

@ -1,337 +0,0 @@
/*====================================================================
* audioInternals.h
*
* Synopsis:
*
* Copyright 1993, 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.
*====================================================================*/
#ifndef __audioInternals__
#define __audioInternals__
#include <PR/libaudio.h>
/*
* filter message ids
*/
enum {
AL_FILTER_FREE_VOICE,
AL_FILTER_SET_SOURCE,
AL_FILTER_ADD_SOURCE,
AL_FILTER_ADD_UPDATE,
AL_FILTER_RESET,
AL_FILTER_SET_WAVETABLE,
/* AL_FILTER_SET_DMA_PROC,*/
/* AL_FILTER_SKIP_LOOP,*/
AL_FILTER_SET_DRAM,
AL_FILTER_SET_PITCH,
AL_FILTER_SET_UNITY_PITCH,
AL_FILTER_START,
/* AL_FILTER_SET_DECAY,*/
/* AL_FILTER_SET_FC,*/
AL_FILTER_SET_STATE,
AL_FILTER_SET_VOLUME,
AL_FILTER_SET_PAN,
AL_FILTER_START_VOICE_ALT,
AL_FILTER_START_VOICE,
AL_FILTER_STOP_VOICE,
AL_FILTER_SET_FXAMT
};
#define AL_MAX_RSP_SAMPLES 160
/*
* buffer locations based on AL_MAX_RSP_SAMPLES
*/
#define AL_DECODER_IN 0
#define AL_RESAMPLER_OUT 0
#define AL_TEMP_0 0
#define AL_DECODER_OUT 320
#define AL_TEMP_1 320
#define AL_TEMP_2 640
#define AL_MAIN_L_OUT 1088
#define AL_MAIN_R_OUT 1408
#define AL_AUX_L_OUT 1728
#define AL_AUX_R_OUT 2048
/*
* filter types
*/
enum {
AL_ADPCM,
AL_RESAMPLE,
AL_BUFFER,
AL_SAVE,
AL_ENVMIX,
AL_FX,
AL_AUXBUS,
AL_MAINBUS
};
typedef struct ALParam_s {
struct ALParam_s *next;
s32 delta;
s16 type;
union {
f32 f;
s32 i;
} data;
union {
f32 f;
s32 i;
} moredata;
union {
f32 f;
s32 i;
} stillmoredata;
union {
f32 f;
s32 i;
} yetstillmoredata;
} ALParam;
typedef struct {
struct ALParam_s *next;
s32 delta;
s16 type;
s16 unity; /* disable resampler */
f32 pitch;
s16 volume;
ALPan pan;
u8 fxMix;
s32 samples;
struct ALWaveTable_s *wave;
} ALStartParamAlt;
typedef struct {
struct ALParam_s *next;
s32 delta;
s16 type;
s16 unity; /* disable resampler */
struct ALWaveTable_s *wave;
} ALStartParam;
typedef struct {
struct ALParam_s *next;
s32 delta;
s16 type;
struct PVoice_s *pvoice;
} ALFreeParam;
typedef Acmd *(*ALCmdHandler)(void *, s16 *, s32, s32, Acmd *);
typedef s32 (*ALSetParam)(void *, s32, void *);
typedef struct ALFilter_s {
struct ALFilter_s *source;
ALCmdHandler handler;
ALSetParam setParam;
s16 inp;
s16 outp;
s32 type;
} ALFilter;
void alFilterNew(ALFilter *f, ALCmdHandler h, ALSetParam s, s32 type);
#define AL_MAX_ADPCM_STATES 3 /* Depends on number of subframes
* per frame and loop length
*/
typedef struct {
ALFilter filter;
ADPCM_STATE *state;
ADPCM_STATE *lstate;
ALRawLoop loop;
struct ALWaveTable_s *table;
s32 bookSize;
ALDMAproc dma;
void *dmaState;
s32 sample;
s32 lastsam;
s32 first;
s32 memin;
} ALLoadFilter;
void alLoadNew(ALLoadFilter *f, ALDMANew dma, ALHeap *hp);
Acmd *alAdpcmPull(void *f, s16 *outp, s32 byteCount, s32 sampleOffset, Acmd *p);
Acmd *alRaw16Pull(void *f, s16 *outp, s32 byteCount, s32 sampleOffset, Acmd *p);
s32 alLoadParam(void *filter, s32 paramID, void *param);
typedef struct ALResampler_s {
ALFilter filter;
RESAMPLE_STATE *state;
f32 ratio;
s32 upitch;
f32 delta;
s32 first;
ALParam *ctrlList;
ALParam *ctrlTail;
s32 motion;
} ALResampler;
typedef struct {
s16 fc;
s16 fgain;
union {
s16 fccoef[16];
s64 force_aligned;
} fcvec;
POLEF_STATE *fstate;
s32 first;
} ALLowPass;
typedef struct {
u32 input;
u32 output;
s16 ffcoef;
s16 fbcoef;
s16 gain;
f32 rsinc;
f32 rsval;
s32 rsdelta;
f32 rsgain;
ALLowPass *lp;
ALResampler *rs;
} ALDelay;
typedef s32 (*ALSetFXParam)(void *, s32, void *);
typedef struct {
struct ALFilter_s filter;
s16 *base;
s16 *input;
u32 length;
ALDelay *delay;
u8 section_count;
ALSetFXParam paramHdl;
} ALFx;
void alFxNew(ALFx *r, ALSynConfig *c, ALHeap *hp);
Acmd *alFxPull(void *f, s16 *outp, s32 out, s32 sampleOffset, Acmd *p);
s32 alFxParam(void *filter, s32 paramID, void *param);
s32 alFxParamHdl(void *filter, s32 paramID, void *param);
#define AL_MAX_MAIN_BUS_SOURCES 1
typedef struct ALMainBus_s {
ALFilter filter;
s32 sourceCount;
s32 maxSources;
ALFilter **sources;
} ALMainBus;
void alMainBusNew(ALMainBus *m, void *ptr, s32 len);
Acmd *alMainBusPull(void *f, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p);
s32 alMainBusParam(void *filter, s32 paramID, void *param);
#define AL_MAX_AUX_BUS_SOURCES 8
#define AL_MAX_AUX_BUS_FX 1
typedef struct ALAuxBus_s {
ALFilter filter;
s32 sourceCount;
s32 maxSources;
ALFilter **sources;
ALFx fx[AL_MAX_AUX_BUS_FX];
} ALAuxBus;
void alAuxBusNew(ALAuxBus *m, void *ptr, s32 len);
Acmd *alAuxBusPull(void *f, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p);
s32 alAuxBusParam(void *filter, s32 paramID, void *param);
void alResampleNew(ALResampler *r, ALHeap *hp);
Acmd *alResamplePull(void *f, s16 *outp, s32 out, s32 sampleOffset, Acmd *p);
s32 alResampleParam(void *f, s32 paramID, void *param);
typedef struct ALSave_s {
ALFilter filter;
s32 dramout;
s32 first;
} ALSave;
void alSaveNew(ALSave *r);
Acmd *alSavePull(void *f, s16 *outp, s32 outCount, s32 sampleOffset, Acmd *p);
s32 alSaveParam(void *f, s32 paramID, void *param);
typedef struct ALEnvMixer_s {
u8 unk00[0x40];
ALFilter filter;
ENVMIX_STATE *state;
s16 pan;
s16 volume;
s16 cvolL;
s16 cvolR;
s16 dryamt;
s16 wetamt;
u16 lratl;
s16 lratm;
s16 ltgt;
u16 rratl;
s16 rratm;
s16 rtgt;
s32 delta;
s32 segEnd;
s32 first;
ALParam *ctrlList;
ALParam *ctrlTail;
//ALFilter **sources;
s32 motion;
} ALEnvMixer;
void alEnvmixerNew(ALEnvMixer *e, ALHeap *hp);
Acmd *alEnvmixerPull(void *f, s16 *outp, s32 out, s32 sampleOffset, Acmd *p);
s32 alEnvmixerParam(void *filter, s32 paramID, void *param);
/*
* heap stuff
*/
typedef struct {
s32 magic; /* check structure integrety */
s32 size; /* size of this allocated block */
u8 *file; /* file that this alloc was called from */
s32 line; /* line that it was called from */
s32 count; /* heap call number */
s32 pad0;
s32 pad1;
s32 pad2; /* Make it 32 bytes */
} HeapInfo;
#define AL_CACHE_ALIGN 15
/*
* synth stuff
*/
typedef struct PVoice_s {
ALLink node;
struct ALVoice_s *vvoice;
ALFilter *channelKnob;
ALLoadFilter decoder;
ALResampler resampler;
ALEnvMixer envmixer;
s32 offset;
} PVoice;
/*
* prototypes for private driver functions
*/
ALParam *__allocParam(void);
void __freeParam(ALParam *param);
void _freePVoice(PVoice *pvoice);
void _collectPVoices(void);
s32 _timeToSamples(s32 micros);
ALMicroTime _samplesToTime(ALSynth *synth, s32 samples);
#endif

View File

@ -1,104 +0,0 @@
/**************************************************************************
* *
* Copyright (C) 1990-1992, 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. *
* *
**************************************************************************/
/*
* Copyright 1985 by MIPS Computer Systems, Inc.
*/
#ifndef __SYS_REGDEF_H__
#define __SYS_REGDEF_H__
#ident "$Revision: 3.7 $"
#include "sgidefs.h"
#if (_MIPS_SIM == _MIPS_SIM_ABI32)
#define zero $0 /* wired zero */
#define AT $at /* assembler temp */
#define v0 $2 /* return value */
#define v1 $3
#define a0 $4 /* argument registers */
#define a1 $5
#define a2 $6
#define a3 $7
#define t0 $8 /* caller saved */
#define t1 $9
#define t2 $10
#define t3 $11
#define t4 $12 /* caller saved - 32 bit env arg reg 64 bit */
#define ta0 $12 /* caller saved in 32 bit - arg regs in 64 bit */
#define t5 $13
#define ta1 $13
#define t6 $14
#define ta2 $14
#define t7 $15
#define ta3 $15
#define s0 $16 /* callee saved */
#define s1 $17
#define s2 $18
#define s3 $19
#define s4 $20
#define s5 $21
#define s6 $22
#define s7 $23
#define t8 $24 /* code generator */
#define t9 $25
#define jp $25 /* PIC jump register */
#define k0 $26 /* kernel temporary */
#define k1 $27
#define gp $28 /* global pointer */
#define sp $29 /* stack pointer */
#define fp $30 /* frame pointer */
#define s8 $30 /* calle saved */
#define ra $31 /* return address */
#endif
#if (_MIPS_SIM == _MIPS_SIM_ABI64)
#define zero $0 /* wired zero */
#define AT $at /* assembler temp */
#define v0 $2 /* return value - caller saved */
#define v1 $3
#define a0 $4 /* argument registers */
#define a1 $5
#define a2 $6
#define a3 $7
#define a4 $8 /* arg reg 64 bit; caller saved in 32 bit */
#define ta0 $8
#define a5 $9
#define ta1 $9
#define a6 $10
#define ta2 $10
#define a7 $11
#define ta3 $11
#define t0 $12 /* caller saved */
#define t1 $13
#define t2 $14
#define t3 $15
#define s0 $16 /* callee saved */
#define s1 $17
#define s2 $18
#define s3 $19
#define s4 $20
#define s5 $21
#define s6 $22
#define s7 $23
#define t8 $24 /* caller saved */
#define t9 $25 /* callee address for PIC/temp */
#define jp $25 /* PIC jump register */
#define k0 $26 /* kernel temporary */
#define k1 $27
#define gp $28 /* global pointer - caller saved for PIC */
#define sp $29 /* stack pointer */
#define fp $30 /* frame pointer */
#define s8 $30 /* callee saved */
#define ra $31 /* return address */
#endif
#endif /* __SYS_REGDEF_H__ */

View File

@ -1,23 +0,0 @@
#ifndef _ULTRA64_UCODE_H_
#define _ULTRA64_UCODE_H_
#define SP_DRAM_STACK_SIZE8 0x400
#define SP_UCODE_SIZE 0x1000
#define SP_UCODE_DATA_SIZE 0x800
// standard boot ucode
extern u64 rspF3DBootStart[], rspF3DBootEnd[];
// F3D ucode
extern u64 rspF3DStart[], rspF3DEnd[];
// F3D ucode data
extern u64 rspF3DDataStart[], rspF3DDataEnd[];
// aspMain (audio) ucode
extern u64 rspAspMainStart[], rspAspMainEnd[];
// aspMain ucode data
extern u64 rspAspMainDataStart[], rspAspMainDataEnd[];
#endif

View File

@ -1,42 +0,0 @@
#ifndef _ULTRA64_TYPES_H_
#define _ULTRA64_TYPES_H_
#ifndef NULL
#define NULL (void *)0
#endif
#define TRUE 1
#define FALSE 0
#define OS_TV_PAL 0
#define OS_TV_NTSC 1
#define OS_TV_MPAL 2
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
typedef signed char s8;
typedef unsigned char u8;
typedef signed short int s16;
typedef unsigned short int u16;
typedef signed int s32;
typedef unsigned int u32;
typedef signed long long int s64;
typedef unsigned long long int u64;
typedef volatile u8 vu8;
typedef volatile u16 vu16;
typedef volatile u32 vu32;
typedef volatile u64 vu64;
typedef volatile s8 vs8;
typedef volatile s16 vs16;
typedef volatile s32 vs32;
typedef volatile s64 vs64;
typedef float f32;
typedef double f64;
typedef unsigned long size_t;
#endif
#endif

View File

@ -1,9 +1,9 @@
#ifndef _ASM_HELPER_H
#define _ASM_HELPER_H
#include "PR/R4300.h"
#include "PR/sys/regdef.h"
#include "PR/sys/asm.h"
#include "PR/rcp.h"
#include <R4300.h>
#include <sys/regdef.h>
#include <sys/asm.h>
#include <rcp.h>
#define STAY1(stmnt) .set noreorder; stmnt; .set reorder;
#define STAY2(stmnt, arg1) .set noreorder; stmnt, arg1; .set reorder;

View File

@ -11,7 +11,7 @@ extern u32 var8008ae2c;
extern u32 var8008ae30;
extern OSThread g_MainThread;
extern OSMesgQueue var8008db30;
extern OSSched g_SchedThread;
extern OSSched g_Sched;
extern OSViMode var8008dcc0[2];
extern OSViMode *var8008dd60[2];
extern u32 var8008de08;
@ -21,7 +21,6 @@ extern u8 g_BootBufferDirtyIndexes[3];
extern s32 g_BootBufferIndex0;
extern OSPiHandle CartRomHandle;
extern OSPiHandle LeoDiskHandle;
extern OSPifRam __osPfsPifRam;
extern OSTimer var80090ab0;
extern OSMesgQueue var80090ad0;
extern OSMesg var80090ae8;
@ -59,19 +58,16 @@ extern u8 *var8009c644;
extern u8 var8009c650[];
extern u8 *var8009c6d8;
extern u8 *var8009c6dc;
extern __OSEventState __osEventStateTab[15];
extern OSTimer var8009c760;
extern OSTime __osCurrentTime;
extern u32 __osBaseCounter;
extern u32 __osViIntrCount;
extern OSMesgQueue __osPiAccessQueue;
extern OSPifRam __osContPifRam;
extern u8 __osContLastCmd;
extern u8 __osMaxControllers;
extern OSTimer __osEepromTimer;
extern OSMesgQueue __osEepromTimerQ;
extern OSMesg __osEepromTimerMsg;
extern OSPifRam __osEepPifRam;
extern u32 var8009ca84;
extern u8 *g_FrameBuffers[2];
extern u8 var8009caec[4];

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