Page 1 of 1
Multi-threading in PSX
Posted: October 5th, 2016, 5:47 am
by Xavi92
Hello there,
I was looking at Nocash PSX documentation and I noticed about the use of multi-threading in PSX games. I certainly know what multi-threading is and what advantages and disadvantages it brings, but... are there any known PSX commercial/homebrew game or app out there which actually made use of this?
Also, I was feeling curious about implementing some kind of multi-threading support on PSXSDK libs for some interesting purposes.
Re: Multi-threading in PSX
Posted: September 5th, 2017, 5:29 pm
by Infrid
for example you can run the game in a thread while you pay the audio track in another thread. Load assets while you playing a level for the next one, etc etc.
Re: Multi-threading in PSX
Posted: September 6th, 2017, 1:09 pm
by LameGuy64
If I remember correctly, multi-threading on the PSX works kinda similar to how multi-threading works on modern platforms. You basically create a thread but you must switch to the thread you created with ChangeTh() in your main loop or a mini loop that switches between all the threads you've created.
I haven't tried multi-threading on the PSX much myself so I'm not sure what advantages it would bring as most of the stuff to perform things like playing streaming music in the background or executing a musical sequence is all done by the hardware or can be done with interrupts. It might be useful for doing things like animated loading screens or routines that need to be run in the background but are too complex to be run on interrupts.
If you want to see how multi-threading is done with the PsyQ or Programmer's Tool SDKs, look at the THREAD example included with the development kits.
Re: Multi-threading in PSX
Posted: January 21st, 2018, 12:45 pm
by Xavi92
Sorry for reviving this, but I didn't realize this topic actually got responses.
In the case of animated loading screens, that's pretty much what my video game "Airport" is actually doing. Despite not creating a thread on its own, I'm abusing VBlank ISR so that, during loading screens, sprites are being sent to the GPU while the main loop is handling file data.
Not the most polite solution, but pretty quick to set up and works. However, it looks like fopen() doesn't like being interrupted, so the ISR must take this into account. Same thing when GPU is busy or a DMA transfer is being made.
Re: Multi-threading in PSX
Posted: March 17th, 2018, 7:48 am
by Misteek
I believe Glain et al. documented some stuff on multithreading at the
FFHacktics wiki.