// Filename : YAROZE.H // Coded by : Scott Evans // Created/Modified : 16/9/97 // Description : Header file for Yaroze.c #ifndef _YAROZE_H_ #define _YAROZE_H_ #include #include "gtypes.h" // 2D vector typedef struct { u_word vx; u_word vy; }DVECTOR; // PSX standard controller values #define PADLleft (1<<15) #define PADLdown (1<<14) #define PADLright (1<<13) #define PADLup (1<<12) #define PADstart (1<<11) #define PADselect (1<<8) #define PADRleft (1<<7) #define PADRdown (1<<6) #define PADRright (1<<5) #define PADRup (1<<4) #define PADR1 (1<<3) #define PADL1 (1<<2) #define PADR2 (1<<1) #define PADL2 (1<<0) #define VRAM_MODE_16BIT 0 #define GPU_OFFSET 2 // Macro : mSCRATCHADDR() // Coded by : Scotte // History : Created 06/12/99 21:55:01 // // Description : Start of scratch pad RAM // // Parameters : n - offset // // Returns : None // // Notes : None #define mSCRATCHADDR(n)\ (0x1f800000+(n)) // Macro : setRGB0() // Coded by : Scott Evans // Created/Modified : 16/9/97 // Description : sets the r0,g0,b0 members of an object // Parameters : p - pointer to object // r,g,b - colour of object // Returns : Nothing // Notes : Replicates professional development kit version #define setRGB0(p,r,g,b)\ (p)->r0=(r),\ (p)->g0=(g),\ (p)->b0=(b) // Macro : setRGB1() // Coded by : Scott Evans // Created/Modified : 23/10/97 // Description : sets the r1,g1,b1 members of an object // Parameters : p - pointer to object // r,g,b - colour of object // Returns : Nothing // Notes : Replicates professional development kit version #define setRGB1(p,r,g,b)\ (p)->r1=(r),\ (p)->g1=(g),\ (p)->b1=(b) // Macro : setRGB2() // Coded by : Scott Evans // Created/Modified : 23/10/97 // Description : sets the r2,g2,b2 members of an object // Parameters : p - pointer to object // r,g,b - colour of object // Returns : Nothing // Notes : Replicates professional development kit version #define setRGB2(p,r,g,b)\ (p)->r2=(r),\ (p)->g2=(g),\ (p)->b2=(b) // Macro : setRGB3() // Coded by : Scott Evans // Created/Modified : 23/10/97 // Description : sets the r3,g3,b3 members of an object // Parameters : p - pointer to object // r,g,b - colour of object // Returns : Nothing // Notes : Replicates professional development kit version #define setRGB3(p,r,g,b)\ (p)->r3=(r),\ (p)->g3=(g),\ (p)->b3=(b) // Macro : setRGB4() // Coded by : Scott Evans // Created/Modified : 23/10/97 // Description : sets the r3,g3,b3 members of an object // Parameters : p - pointer to object // rn,gn,bn - colour of object // Returns : Nothing // Notes : None #define setRGB4(p,r0,g0,b0,r1,g1,b1,r2,g2,b2,r3,g3,b3)\ setRGB0(p,r0,g0,b0),\ setRGB1(p,r1,g1,b1),\ setRGB2(p,r2,g2,b2),\ setRGB3(p,r3,g3,b3) // Macro : setXY1() // Coded by : Scott Evans // Created/Modified : 23/10/97 // Description : sets the x0,y0 members of an object // Parameters : p - pointer to object // xn,yn - x and y values to set // Returns : Nothing // Notes : None #define setXY0(p,x,y)\ (p)->x0=(x),\ (p)->y0=(y) // Macro : setXY2() // Coded by : Scott Evans // Created/Modified : 23/10/97 // Description : sets the xn,yn members of an object // Parameters : p - pointer to object // xn,yn - x and y values to set // Returns : Nothing // Notes : None #define setXY2(p,X0,Y0,X1,Y1)\ (p)->x0=(X0),\ (p)->y0=(Y0),\ (p)->x1=(X1),\ (p)->y1=(Y1) // Macro : setXY3() // Coded by : Scott Evans // Created/Modified : 23/10/97 // Description : sets the xn,yn members of an object // Parameters : p - pointer to object // xn,yn - x and y values to set // Returns : Nothing // Notes : None #define setXY3(p,X0,Y0,X1,Y1,X2,Y2)\ (p)->x0=(X0),\ (p)->y0=(Y0),\ (p)->x1=(X1),\ (p)->y1=(Y1),\ (p)->x2=(X2),\ (p)->y2=(Y2) // Macro : setXY4() // Coded by : Scott Evans // Created/Modified : 23/10/97 // Description : sets the xn,yn members of an object // Parameters : p - pointer to object // xn,yn - x and y values to set // Returns : Nothing // Notes : None #define setXY4(p,X0,Y0,X1,Y1,X2,Y2,X3,Y3)\ (p)->x0=(X0),\ (p)->y0=(Y0),\ (p)->x1=(X1),\ (p)->y1=(Y1),\ (p)->x2=(X2),\ (p)->y2=(Y2),\ (p)->x3=(X3),\ (p)->y3=(Y3) // Macro : setWH // Coded by : Scott Evans // Created/Modified : 23/10/97 // Description : sets the w,h members of an object // Parameters : p - pointer to object // w,h - width and height values to set // Returns : Nothing // Notes : None #define setWH(p,W,H)\ (p)->w=(W),(p)->h=(H) // Macro : copyVector() // Coded by : Scott Evans // Created/Modified : 21/3/98 // Description : Copies a vector // Parameters : v1 - pointer to vector destination // v2 - pointer to vector source // Returns : None // Notes : None #define copyVector(v1,v2)\ (v1)->vx=(v2)->vx,\ (v1)->vy=(v2)->vy,\ (v1)->vz=(v2)->vz // Macro : GetSp() // Coded by : Scott Evans // Created/Modified : 27/8/98 // Description : Get and set the stack pointer // Parameters : addr - new stack pointer // Returns : Old stack pointer // Notes : None #define GetSp()\ ({register u_word p; __asm__ volatile ("move %0,$29" :"=r" (p) :: "$29"); p;}) // Macro : SetSp() // Coded by : Scott Evans // Created/Modified : 27/8/98 // Description : Get and set the stack pointer // Parameters : addr - new stack pointer // Returns : None // Notes : SetSp() does not return the old stack pointer #define SetSp(addr)\ {register u_word a=addr; __asm__ volatile ("move $29,%0" :: "r" (a) : "$29");} // Function prototypes DISPENV *SetDefDispEnv(DISPENV *,const u_word,const u_word,const u_word,const u_word); DRAWENV *SetDefDrawEnv(DRAWENV *,const u_word,const u_word,const u_word,const u_word); void PadInit(const u_word); u_long PadRead(const u_word); void Initialise(const u_word); #endif