2) Create a text file and paste in the code below.
Code: Select all
// hello world
#include <sys/types.h>
#include <libetc.h>
#include <libgte.h>
#include <libgpu.h>
#include <libgs.h>
#include <stdio.h>
#define OT_LENGTH (10)
#define PACKETMAX (2048)
#define PACKETMAX2 (PACKETMAX*24)
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
GsOT myOT[2];
GsOT_TAG myOT_TAG[2][1<<OT_LENGTH];
PACKET GPUPacketArea[2][PACKETMAX2];
void InitGraphics(void);
void DisplayAll(int);
int main(void);
int main(void) {
int activeBuffer=0;
InitGraphics();
ResetGraph(0);
SetVideoMode(MODE_PAL);
SetGraphDebug(0);
FntLoad(960, 256);
FntOpen(64,64, 256, 200, 0, 512);
while (1) {
activeBuffer = GsGetActiveBuff();
GsSetWorkBase((PACKET*)GPUPacketArea[activeBuffer]);
GsClearOt(0, 0, &myOT[activeBuffer]);
FntPrint("hello world\n\n");
DisplayAll(activeBuffer);
}
return 0;
}
void InitGraphics(void) {
GsInitGraph(SCREEN_WIDTH, SCREEN_HEIGHT, GsNONINTER|GsOFSGPU, 1, 0);
GsDefDispBuff(0, 0 , 0, SCREEN_HEIGHT);
myOT[0].length = OT_LENGTH;
myOT[1].length = OT_LENGTH;
myOT[0].org = myOT_TAG[0];
myOT[1].org = myOT_TAG[1];
GsClearOt(0,0,&myOT[0]);
GsClearOt(0,0,&myOT[1]);
}
void DisplayAll(int activeBuffer) {
FntFlush(-1);
DrawSync(0);
VSync(0);
GsSwapDispBuff();
GsSortClear(0,100,0,&myOT[activeBuffer]);
GsDrawOt(&myOT[activeBuffer]);
}
4) Make another text file and put in this code
Code: Select all
all:
ccpsx -O -Xo$80010000 main.c -omain.cpe,main.sym
for_menu:
ccpsx -O -Xo$80010000 main.c \psx\lib\none2.obj -oarot.cpe
6) Compile with 'psymake' (again, run in a command prompt. EG: c:\psyq\projects\hello> psymake
7) Run the command, 'cpe2x main.cpe' to get an executable (main.exe).
8) Run with the compiled main.exe in an emulator, or upload it over a commslink to from your PC to your PS1 with CAETLA or XKILLER.