Programming Your PSX
The purpose of this 101 work is to study how to program the Playstation (PSX).This is the first part.It'll teach you how to connect your playstation and u'r PC and will tell u a bit about programming.Next issues will cover programming in d3pht like programming u'r dual shock or using graphX etc.
PART 1 : CONNECTION & STARTING STUFF
1-Connecting the playstation to your PC-
00000000 (1-1) What u need ?.
00000000 (1-2) Go ON.
2-Getting into programming-
00000000 (2-1) The compiler.
00000000 (2-2) Source code example.
3-Download section-
00000000 (3-X) Different progs to download.
4-Conclusion of part 1-
=
------------------------------------------------------------------=
---
|1-Connecting the Playstation to your PC =
|
Here we're going to explain the Comms link method,the best of =
ever.Please=20
note that you can also connect your PC to your Playstation using the =
parallel=20
port or the serial cable method.
----------------------------------------1-1 WHAT U NEED =
?--------------------------------------
(A)CommsLink Communication Card.
(B)Parallel Cable.
(C)GameShark / Action Replay game cheat device.
(D)Caetla ROM image.
(E)PSY-Q (Playstation Libraries).
(A)The CommsLink Communication Card
This part is quite easy to purchase and cost about 45$.Just ask =
u'r game=20
shop and order them one.This card is an accelerated LPT port (about =
1.7m/s)
(B)The parallel cable
You need a db25 on both ends (male on one,
and female on the other). Verify that your cable is a 25 pin
straight-through ( pass-through) cable.
(C)The game cheat device
Ok so you've got to buy a cheat device (about 50$).I recommend =
u the=20
action replay or the gameshark.You will connect
the serial cable to the cheat device,this one is connected
into your playstation.It will act as a cheap version interface to your =
playstation.
(D) CAETLA
Caetla is the rom code for the GameShark, Action Replay =
cheat
device.With this ROM uploaded to your cheat device u'll be able to =
reset the=20
PSX and to upload compiled PSX code in
executable format.
(E) PSY-Q libs
PSY-Q is a set of libraries, and tools for compiling your =
psx
code.If you want to get this package u'll have to become an official =
Sony developer=20
($$$$)
But hopefully u can find it on the net.
----------------------------------------1-2 Go =
ON---------------------------------------------
So install u'r commslink card into the ISA slot of u'r =
PC.Connect the=20
cable to your card and to your cheat device.Turn the cheat device on =
by pushing=20
the switch into the up position and verify that it's plugged into the =
playstation=20
back.
Now upload the caetla bin using caetla documentation (something =
like=20
psupdate -p3 caetla.bin).U're ready to prog u'r (PSX)
| 2-Getting into programming |
----------------------------------------2-1 The =
compiler----------------------------------------
Get a compiler with proper PSX libs ,write code(C/C++ ASM), =
compile it=20
and send it to your PSX (using psexe or catflap) isn't it easy ??? ok =
so i'll=20
put u some code made by PSX scene killerz so that u can do some =
stuff.
----------------------------------------2-2 Source code =
example---------------------------------
FROM loser (http://www.consoledev.com/loser-console/psx/)
/**
a simple program for printing to the psx screen
*/
#include //these are the various =
include=20
files that need to be included
#include //note that the order they are included in =
does matter=20
in some cases!
#include
#include
#include
#include
/*
also note that while this example uses the Gs functions, these are =
high level=20
functions
and should not be used if it can be helped as they are quite slow and =
consume=20
lots of memory.
they will however do while you are learning as they simplify things =
and help=20
you to understand
the process that you go through to print to the screen.
*/
#define OT_LENGTH (10) //this is the 'length' of the =
OT (ordering=20
tabble)
//for more info on ordering tables, check out ot.txt on my 'info' =
page
#define PACKETMAX (2048) //these are the graphics =
area contants
#define PACKETMAX2 (PACKETMAX*24) //allows you to select how many gfx =
objects=20
the psx should handle
//in this particular example
#define SCREEN_WIDTH 320 //contants to determine the =
height=20
and width of the screen resolution
#define SCREEN_HEIGHT 240
GsOT myOT[2]; //an array of 2 OT's this is how your =
double buffering=20
is implemented
GsOT_TAG myOT_TAG[2][1
PACKET GPUPacketArea[2][PACKETMAX2]; //also 2 gfx packet areas for =
double buffering
/***************** prototypes =
*******************/
void InitGraphics(void); //this method sets up gfx for printing to =
screen
void DisplayAll(int); //this displays the contents of the OT
int main(void);
/***************** functions =
********************/
int main(void) {
int activeBuffer=3D0; //variable used to hold the buffer that is =
currently being=20
displayed
InitGraphics(); //this method sets up gfx for printing to screen
FntLoad(960, 256); //this loads the font gfx to the vram
FntOpen(32, 32, 256, 200, 0, 512); //this sets up the fonts printing =
attributes
//eg printing boundries and number of letters to hold in printing =
buffer etc
while (1) { //infinite loop
activeBuffer =3D GsGetActiveBuff(); //gets the buffer currently being =
displayed=20
and stores in activeBuffer
GsSetWorkBase((PACKET*)GPUPacketArea[activeBuffer]); //sets up the gfx =
workspace
GsClearOt(0, 0, &myOT[activeBuffer]); //clears the OT contents
//once the OT contents have been cleared you can add new objects to =
the OT
//so that they will be displayed next time DisplayAll is called
FntPrint("hello to younn - from losernn");
//this just adds the string to the screen printing buffer
//to actually print this to screen yu have to flush the contents of =
this buffer
//this is done in displayall method
DisplayAll(activeBuffer); //this dispalys the OT contents to =
screen
}
return 0; //when program is finished return from it
}
void InitGraphics(void) {
//this method sets up gfx for printing to screen
GsInitGraph(SCREEN_WIDTH, SCREEN_HEIGHT, GsNONINTER|GsOFSGPU, 1, 0); =
//initialises=20
the graphics system
//no Gs* * * functions will work unless GsInitGraph() has been =
called
GsDefDispBuff(0, 0 , 0, SCREEN_HEIGHT); //defines double buffer =
attributes
//buffer 0's top left coordinate becomes (0,0) & buffer 1's =
coordinate becomes=20
(0, y resolution)
myOT[0].length =3D OT_LENGTH; //sets OT length for =
each OT
myOT[1].length =3D OT_LENGTH;
myOT[0].org =3D myOT_TAG[0]; //gets top address of GsOT_TAG table
myOT[1].org =3D myOT_TAG[1];
GsClearOt(0,0,&myOT[0]); //initialises ordering table
GsClearOt(0,0,&myOT[1]);
}
void DisplayAll(int activeBuffer) {
//this method contains all the functions needed to display the =
contents of the=20
OT
FntFlush(-1); //flushes font buffers contents from buffer so that they =
can be=20
printed to screen
DrawSync(0);
//this waits till the GPU has finished drawing, as GsSwapDispBuff will =
not work=20
correctly if drawing is in progress
VSync(0); //gsswapdispbuff should be called after beginning a =
v-blank
GsSwapDispBuff(); //swap display buffer
GsSortClear(0,0,0,&myOT[activeBuffer]); //clears screen to color =
(0,0,0)=20
and sorts OT ready for drawing
GsDrawOt(&myOT[activeBuffer]); //draws the contents of OT to =
screen
}
| 3-Downloads |
Caetla037 =
(the caetla=20
rom)
catflap231 =
(a better=20
caetla)
Gnu (a =
compiler)
Hello2 =
(example complete=20
source code)
(due to a modification of our web server around 14 march if u can't =
download=20
the files please go to the main page for instructions =
http://www.101bytez.com/)
|4-Conclusion|
Ok so now u've connected u'r playstation to your PC u have uploaded =
successfully=20
some code on u'r TV screen,u enjoy programming u'r PSX...Well now =
browse the=20
web until next issue of 101BYTEZ's operation PSX ;)
1.) The Return of the Shadow Legacy - druid
2.) Rampant Piracy on the Sea of Information - xearthed
3.) Napster, MPAA, AOL, and how stupid people in power will kill the first amendment - unfrgvnme
4.) Copyright Law - Aleanor
5.) Hacking vs Sysadmining - madirish
6.) State of the Hack Awards #4 - madsaxon
7.) Somethings Never Change - UberGeek
8.) It's Not about Change - darlene
9.) http://www.hackinthebox.org/article.php?