What's this document? (ver 1 rev 11; Last updated: )It was originally made by Simon Barratt ( Barog / napalm ^ nothing ^ tesko ), but as of now, I'm maintaining it (and I've written it almost completely from scratch, if I may say so myself). However, you can still harass Barog about this FAQ and the mailing list (which he moderates) at: [email protected]. Who am I? That's mr. Loop for you! (Adriaan Moors aka antiloop-, [email protected])
History of Playstation Development.(by Barog) Thanks to the Hitmen for this part, it is an altered version of their webpage. Requirements
A quick introduction to the PSXThe CPU for this console is a modified r3000 (see www.sgi.com and www.idt.com for more details) which runs at 33Mhz, it has a stripped down MMU which (among other things) means that the memory addresses are hard wired: the logical addresses 0x00xxxxxx, 0xA0xxxxxx, 0x80xxxxxx all point to the same physical memory (the difference lies in caching etc.). The RAM, which is quite slow, is 2 megs big. The ROM (512K) is located at 0xBFC00000. Have a look at the memory layout I made for the DTLH-3000. The 2D graphics engine is called the GPU, it can do sprites, 2D polies etc. There is one meg of VRAM (which can't be accessed directly like on the pc). So a quick calc tells us that in 16-bit mode, you have a maximum 'surface' of 1024x512 (so that should be enough for storing your textures too). For transforming your 3D points into 2D points, shading, matrix calcs + a lot more, you have the GTE at your disposition. See the hacking (Low Level) section of Napalm for a link to a site with detailed low level GTE info. Finally, there's the SPU for sound, and of course the CD, pads, memory
cards, parallel port and serial port. Some abbreviations (more or less) related to the psx
Action Replay & Comms Link
where to get themthere are lots of places: Anthrox, The Rage, Gameit, Buyrite, etc what is it?The Action Replay (from hereon
'ar') is a piece of electronics that plugs into the back of your PSX to make
psx<->pc communication possible. There that about covers it, read on for more 'low
level' info. It contains an EEPROM that holds a PIO shell (parallel input output), like Caetla, ez-o-ray or the cheat roms from datel and co. EEPROM, that's
right, so you can flash it using software. If you haven't caught on by now, the ar is
parallel. However, you can't hook it up directly to your parallel port as it has some
extra logic which your par port can't handle... There are some hacks which are supported
by caetla: Freewing and
another one, which is mentioned in the Caetla docs. alternativesOkay, so maybe you don't have a spare ISA card, not to fret, just buy an X-Plorer it's a new kind of ar with loads of features, but you can't flash it with Caetla (or with any other replacement ROM). There is no reason to reflash it though, as it has everything you need, and we hear full dev support is coming soon... You connect this little marvel to your parallel port. Do NOT try to do this with a normal ar, as it will basically fry your peecee.. (see above) The last option is to make Skywalker's
serial cable (or see Hitmen).
You can then upload your stuff to the psx with the yaroze kit, or with
Jihad's uploader utility. See below for more info on this. Mod Chips
Dev KitpsyqThis is the official kit, for professional developers. It comes with all sorts of equipment (among others 'the Blue PSX'). The compiler is made by SN Systems, the libraries and documentation are by Sony (I don't need to tell you their URL, do I?). Basically, this is the kit, it allows you to use the psx to the full extent (contrary to the yaroze). It makes things a lot easier (coding wise), but a crappy coder with a (fairly) good compiler is still a crappy coder. yarozeA rip-off, you get a grey psx that's painted black for the occasion, a serial cable, a cd, a dongle memory card, documentation and a compiler (that produces ecoffs) with all the libraries compiled into one, nice, big, clumsy libps.exe. (which eats a lot of memory). The only thing you get for your money is legality. If (when) you use it, you have to convert the ecoff the yaroze compiler generates to 'real' psx-exe's using eco2exe. And combine comes in handy for combining your exe with libps.exe. gcc cross compile/not yaroze(site)First let me remind you that the psx's cpu is not in Intel's ball park (in fact, not even gameday ;-) ), it's a mips cpu (like I said, a modified r3000). Therefore you cannot just use any compiler, you need one that outputs r3000 ecoffs (or some compilers even include the psx as a target). If you have a compiler that produces ecoffs, you need eco2exe to convert the ecoff to a regular psx-exe. So your best bet is cross compiling a gnu compiler so that it outputs (once again) r3 ecoffs. Now this is (I think) the only 'easy' legal way, you can still use c (although some weirdo's prefer asm.. ;-) ) and you're in the clear on the legal area: Check the Not Yaroze site (which has a link to the compiler kit targeted win32). And if we're lucky, there will be libraries -- developed independently from Sony -- that offer the same functionallity, only better ;-). But for now, just start cracking ;-) Note: because psyq uses a proprietary format (not ecoff, it's similar, but not entirely) which hasn't been hacked yet (afaik), you can't use the official libraries with a cross compiled gnu kit. about r3 asm, reverse engineering the bios and other executablesAs you already know..
the cpu in the psx is a modified r3000 (see www.idt.com)
and mips asm is simple as fook. You can download a nice reference from
ftp.idt.com/docs/3467.pdf. For
now, I'm not including a tutorial on programming in asm, as it's easy(see
hitmen and napalm sites) and there are lots of examples.. erm I mean exe's
to disassemble. I know, it's the hard way, but by doing it a couple of
times on simple examples (maybe a c source you compiled yourself with,
for example psyq), you learn a lot about C, the psx and how compilers
'optimize'. And as an added bonus, you can use the symbol tables generated
by psyq with my disassembler. This makes things quite a bit easier. How to make a PSX cdYou can burn a mode 2/CD-ROMXA CD, put a system.cnf file on it (just have a look at one on any psx cd) which specifies the name of the exe (if you call your proggy psx.exe, and you don't feel special, you can leave out the system.cnf file). You then make an iso with all your data and license it (see hitmen, hitlice should do the trick). Then you've got to make sure the exe is a multiple of 2048 bytes (exefixup works nicely) because of the reading mechanism of the psx cd, which reads a full sector at the time. Oh, one more thing, the last 3 minutes of a cd are unreliable.. Note: You must use EZ CD PRO 95 or another cd writer proggy that's
able to do "ISO 9660 Level 1 filenames WITH VERSION NUMBER". (See the file names
tab in ez cd pro) The following code should work for loading an psx proggy from disc, now go and make those menu's. StopCallback(); printf("Stopped callback\n"); _96_init(); printf("_96_Init\n"); printf("Loading Exec file\n"); LoadExec("cdrom:\\SLES_012.28;1",0x801ffff0,0); Or you could also use buildcd, if you happen to find it.. hint: it hates
dogs and eats little birdies. Ugh.. I know it's lame.. hehe ;-) Caetlawhat?This is what you flash into your
ar to download your code (and data) into the psx. It has loads of nice features: PS: there is a little problem though: because a lame company pirated the Caetla ROM, which was spread for free and for coders only, K-Comms has decided to protect their software. They are supposed to have par port support (through a hack that you can make yourself), but I can't get through to the leech department ;-) So we have to respect K-Comms's wish, but on the other hand, how are coders that are new to the psx scene gonna upload their stuff to the psx? Right, well no comment.
There is, or better was, one other ar replacement rom: ez-o-ray (mmh.. read this backwards). It had some cool features like support for the psyq dos debugger (using a TSR to emulate the psx plugin ISA boards). But as per wish of the authors, it's no longer spreaded. A lot of l33t coderz :) still use ez, for old time's sake I guess. (that reminds me.. once upon a time.. a looong time ago, when the #psxdev scene was being born, they didn't even have a replacement ROM, so the cool d00ds of Hitmen and co. had to do all sorts of tricky things, which required good timing, to simply upload their code byte by byte.. my point is, we're lucky to have Caetla or Ez-o-ray, so don't whine about it being too difficult or summit) setting it upWell, Madman has made a nice faq on this already, so no point in reinventing the wheel, here's the Caetla FAQ (with additions by Danzig) using da fileserverAgain, I found an example on the mailing list (and I'll save you the trouble from browsing it..) This is very easy, just use code like the following: void main() { char c[80]; struct DIRENTRY res; strcpy(c, "pcdrv:*.*"); printf("\n** Loading files...\n"); // Generate list from dir entrys... if (firstfile(c,&res)==0) { printf("Failed to read directory entry, does directory pcdata exist?\n"); exit(1); } processFile(rec.name) while (nextfile(&res)!=0) { processFile(rec.name) } } void processfile(char *name) { int fd; char fullName[80]; strcat(fullName, name); fd = open(fullName, O_RDONLY); if (fd==-1) { printf("Failed to open file %s\n",rec->filename); exit(1); } // Load file here... numRead = read(fd, (char *)rec->ptr, rec->length); if (numRead != rec->length) { close(fd); printf("Failed to read from file %s\n",rec->filename); exit(1); } printf("ok.\n"); close(fd); rec = rec->next; } This will read the directory from the PC and load all files into PSX ram, hope that helps FuSIONMan
Alternatives to CaetlaBesides Ez-o-ray (which is of course a complete replacement with rom and tools), there are several pc-side tools which offer the same or better functionality as psexe. Have a look in the links section. IMHO, the coolest replacement, which offers some additional goodies (such as compatibility with Windows NT), is CatFlap. You can find it in Napalm's Utilities section. Also, for the linux addicts among us, there's piocons (originally made by DBalster and Nagra, and improved by AndrewK --> see the links section).
Programming with the serial cable(Contributed by Gadget, thank you!) Additional requirements(besides PSX etc.)
Configuring SioconsBy default, siocons is set at 9600baud. This is
usually too slow to get any sort of programming accomplished. The speed
of the serial connection will have to be increased to 115kbps. These are
the steps required to do so.
|
4-bit | 64x64 pixels |
8-bit | 64x32 pixels |
16-bit | 32x32 pixels |
Alignment is not necessary, if it is not aligned, it rolls over to the other side of the cache.
The GPU has a command port. It's a 64 byte (16-longs) FIFO, it can store up to 3 commands. Normally it only contains one command. It also has 3 data ports:
1 DMA channel for Slice and Source Chain DMA types |
1 special DMA channel for Ordering Table Clear |
and 1 32 bit data port for CPU copy |
Sliced mode DMA is used for LoadImage/StoreImage. It moves data from a contigous address with fixed sized chunks. It uses 64 byte blocks, the rest is i/o copied (via the i/o data port), so make sure that LoadImage sizes are a multiple of 64 bytes, 'cos i/o copy is much more slower!
The Source Channel DMA is used for transferring the OT to the GPU command FIFO.Since the two types of DMA share the same chanel, they can't be used at the same time! When the DMA processes a null packet (the code member of the tag is zero), it just sets up the next address, and finish DMA without transferring anything.
The Ordering Table Clear DMA links the OT, without data transfer, and sets the codes to zero. In the Sony libraries it can be initated with the ClearOTagR() function. The GsClearOT() function probably calls ClearOTagR(), but I'm not sure.
Here are the some "theoretical" GPU draw timings:
POLY_F3, POLY_F4, SPRTx, TILE primitives: 2 pixel/cycle - 66 Megapixels/second.
POLY_G3, POLY_GT3 (texture is on cache!) 1 pixel/cycle - 33 Megapixel/second.
When semitransparency is used, the raw speed is halved, for example a POLY_G3 abr id 0.5 pixel/cycle - 16 Megapixels/second.
LoadImage transfers with 33 Mhz*4 bytes per sec, so it can attain speeds up to 132 MBytes/sec. However, when the CPU accesses the main bus, it stops the LoadImage!. (So stay on I and D cache!).
OK now I have to go, so I have to finish this "article". I don't know is the libps functions work in the same way, but the libgpu and libgs functions from the oficial sony libraries work like this. (DrawOTag(),ClearOTagR(), GsDrawOt(), GsClearOt())... if I have some free time I gonna contribute some other infos.
LOOP
There are several coders who have reversed (parts of) the bios, the first one to do this was of course Nagra (check blackbag). I did some reversing too.. maybe I'll release it someday.. it's no big deal anyway.
If someone is interested in reversing the bios, libs or whatever, or if you have
written a great reversing tool, or even if you have completely converted the Bios to c
(hehe.. right :-) ), LET ME KNOW! please? ;-)
It's better to bundle our forces than to reinvent the wheel over and over again I think...
This section covers what I'm
planning to release sometime soon (not a promise, just what I'm thinking
about).
Also, I want to use this to ask you to contribute something to the faq, no matter how
small it is, it may help lots of others.. don't hesitate to mail me! (don't mail me
tutorials on how to tie your shoes in 21 steps though :-) )
something lowlevelly on the interrupts |
the rootcounters are also screaming for attention |
maybe a little bit on the psx2 *drool* |
as
you can see, it's kind of a wishlist (well.. it's really just a dump of
my todo list ;-))...
There are basically two free emulators:
PSEmu Pro: a GREAT emulator which runs on win32.. it kicks ass :-) (if you have a pII 350 and 3D card ;-) ) |
Sope: I haven't checked this one out, it's the only (promising) emulator which runs on Linux! |
And third (yes and I said there were only two): Psyke, I just wanted to name it because it is (was) such a cool emu.. a real competitor for PSEmu Pro, but last thing I heard they joined up with the PSemu Pro team, which is - of course - a great thing! |
And then there was Bleem, a commercial emu. Connectix has also made a (controversial) psx emu for the mac, they're also working on a windows version... Virtualgamestation |
Check out www.egroups.com (the mailing list's name is psxdev, you can subscribe to, browse and search the list on that site)
Like I said, Barog moderates the list, so don't waste your time nor his and think about what you write. Lame stuff won't get past him anyways ;-)
This list's name is
psxdev-unix
Well, there's one EXTREMELY IMPORTANT rule, use your FUCKING brain before asking. To you it may be just one question, but to them who have been doing this for quite some time, these questions have been answered (a little too) frequently.. why do you think I bother to make this FAQ? (besides of my good character ;-) ).
Oh and, do you see this section below? Links.. yeah that's right.. so check them out if something's not here!
Now, if you've tried everything (btw, readme.txt is not the same as whocares.txt), even browsing through the mailing list, just come to #psxdev and ask nicely (and clearly). This also applies to the mailing list: there's no use in a subject like this: 'I NEED HELP' (sure you do... but not the kind we can offer you..), this also makes it a lot easier when you are browsing the mailing list for reference. I did this while making the faq, and you can't believe how much crap I had to read because of an unclear subject. No offence, because the mailing list is very useful, but there are a bunch of whinig lamers in there.. (and I don't mean anyone particular).
So, if you haven't read the FAQ and browsed all the links and you come to #psxdev asking a question that's answered in here or on those sites, be prepared to be booted.
And one more thing, we don't discuss warez in #psxdev, of course this may
sound a bit hypocrite, because (imho), without pirating, there is no real
scene.. hrm.. I know a lot of you guys are going to disagree on this,
but that's how I feel. So just don't barge in and go asking (some even
think they're in a position to demand) for PsyQ when you don't even have
the slightest idea how to code. First prove you're worth it! But I (and
I'm sure I'm not the only one) would very much like to see this scene
alive and kicking some bunghole!
Napalm | A cool site of a cool psx group |
Hitmen | They're basically the godfathers of psx development. Most likely, there wouldn't have been a psx coding scene without them. |
AndrewK's linux psx site | Nice utils here for on linux, also has a source for his replacement for psexe and exefixup. His improved version of piocons can be found here too. |
PSX dev with BSD | Well.. hum.. check it out.. you might want to learn Japanese first, though. Has source for a psexe replacement, with more features than AndrewK's. |
Not Yaroze | Great page on coding for the psx without using 'the libraries' |
Blackbag | Also a great, albeit slightly outdated, site with low level info.. Must read if you're really into psx hacking. |
K-Comms | The makers of caetla |
Trickmeister | Promising page with all the tools you need to start coding on your linux box, although don't hold your breath for a release.. |
PSEmu Pro | The best psx emulator (also check out #psemu on EFNet) |
Sope's homepage | A linux PSX emulator. |
Ganga | Cracktion Replay and other utilities. |
www.palevich.com/, www.neocor.com/, translingo.com/tldl.htm ^^^ (25 fkn megs evaluation copy!) |
Japanese translators |
BitMaster |
Cool psx hacking site |
Creature | Another cool psx hacking site |
Dudley Soft | This guy has cool plans, check them out. |
irc://EFNet/#psxdev |
The hangout for all the sad bastards who don't have anything else to do with their time besides wasting it on IRC ;-) |
www.argonet.co.uk/users/sps/psxfaq/ | Another psx faq, aimed at the general public, but nonetheless interesting. |
Cat House | Cool site, with lots of interesting tools! |
Codeworks | Mobius Codeworks, very cool dudes.. with a cool site and cool intro. |
Psx Heaven | Segmond's site, quite interesting |
Psyke | An excellent PSX emulator by Moonshadow and Rasky. |
Freewing | Par port hack |
Nonstd | Another par port hack |
Loser's page | Great source for info, example source etc. |
Blackthunder | Check it out! |
GNU Psx | Another nice GNU site! |
Mark Heath's PSX page | Has lots of linux based stuff such as gnu for psx, exefixup etc. |
GNU Psx | GNU for psx, nice explanations too |
Barog's PSX site | Must visit! ( When it's up ;-) ) |
Nice graphics site | Not for PSX though |
Van Helsing's PSX page | Well, what more to say, check it out. |
K-Comms password page | It seems it works, not sure. Try if you're looking for the latest version of Caetla (0.33). |
A psxdev site | I didn't say 'yet another blabla..' I haven't checked it out, but you (and I) really should! ;-) |
A psxdev site | Has info on burning your STR files to cd, LOOK HERE FOR BURNING YER OWN CEEDEEZ! If I ever get another question on this, I can't be held responsible for my actions |
Bambam... | ...bam - check it out |
PSX-Vision | Danish |
Surfsmurf's | Smurfsmurf's cool site.. need I tell you to check it out? =o) |
1999-03-21 | 1rev11 | I started this revision history,
cause.. well.. it might be useful as I frequently update the faq *cough* I added Smurfsmurf's trick on cpebin, added the link to BamBam, PSX-Vision and SmurfSmurf's, and I started the lowlevel section... Lots more to come there thanks to LOOP Oh and, rejoyce all thou who hast failed to install PSYQ, Gabriel_K comes to the rescue! One last thing, I also started the What's next section, where you can see what might come next, or where I ask *you* to contribute sth I'd like to see here... |
tomorrow | 1rev12 | where do you wanna go next? tell me.. I'll be happy to add it when I have time |
I'd like to thank: Twin (whoop!), Jihad, Silpheed, Nagra and Danz! (and everyone else who's helped me).
And greetz fly out to: Xerox, FoxFire, Nik, Amerrykan, Brainwalker, Skywalker, Madman, Irka (thx!), AshH, Gadget, Knight, Barog (great job with the ml+site), Bufferman, FusionMan, F0rier, Barubary, Cat, N3xus, Test64, Scorpion, Matt, Tratax, Duddie, Groepaz, Tranziie (monkey!), Burny, Crash0r, SmartAzz, Phazey, Dach (cool site), Wuselfuzz, Fony :o) and everyone else I'd like to greet in #psxdev and #psemu.
So sorry if your name isn't in here.. it's just that me ol' brain isn't very good with names...
If you disagree, if I made a mistake, if I forgot you in the thanks/greetings, or better yet, if you'd like to contribute (oh goody! =o) ), you can always mail me at [email protected].