Overview
Every Instruction on this Page is for Linux.
The Play Station 1 port is currently under development in Git "main" branch.
If I use the word PSX it is equivalent to the Play Station 1
Requirements
GNU BinUtils
The compiler needs gnu binutils. Download a recent version from https://ftp.gnu.org/gnu/binutils/
$./tar -xf <binutils.tar.gz>
$./cd <binutils>
$./mkdir build
$./cd build
$../configure --prefix=/usr/local/mipsel-unknown-elf --target=mipsel-unknown-elf --with-float=soft
$make -j$(nproc)
$sudo make install
$export PATH="/usr/local/mipsel-unknown-elf/bin:$PATH"
Now You can go two ways:
1) let the binaries as they are and always use the compiler option
-XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf-
2) create symlinks
$sudo ln -s /usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf-as /usr/bin/mipsel-ps1-as
$sudo ln -s /usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf-ld /usr/bin/mipsel-ps1-ld
$sudo ln -s /usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf-objcopy /usr/bin/mipsel-ps1-objcopy
PSY-Q-SDK
To compile something You need the converted PSY-Q-SDK to the ELF format
You can go two ways:
1) Download it directly
https://github.com/PSY-Q-SDK-ELF/PSY-Q-SDK-ELF
2) Use the original and convert it by your self
- Download the official SDK:
https://www.psxdev.net/downloads.html
- Download the converter:
https://gitlab.com/jype/psyq2elf
from now on I assume the SDK is in following Folder:
/home/ps1/psy-q-sdk
Real Hardware
Well You need a PlayStation 1 with the MOD CHIP
Emulator
I recommend to use PCSX-REDUX
https://github.com/grumpycoders/pcsx-redux
(I use Arch Linux and it is in my AUR Repo)
PSX BIOS
You can use
a) the original Sony BIOS
https://gist.github.com/juanbrujo/cf55d223ad01927a48f9ebac9f50bdee
b) OpenBIOS from the pcsx-redux Project
https://github.com/grumpycoders/pcsx-redux/tree/main/src/mips/openbios
Building
1) Get the newest version of FPC trunk
git clone https://gitlab.com/freepascal.org/fpc/source.git fpc
2) Compile and install the the compiler
$make clean
If You created the symlinks to the mipsel binutils just do:
$sudo make crossinstall OS_TARGET=ps1 CPU_TARGET=mipsel CROSSOPT="-O-"
If not do:
$sudo make crossinstall OS_TARGET=ps1 CPU_TARGET=mipsel CROSSOPT="-XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf- -O-"
Compiling Programs
When compiling programs, you should always enable smartlinking by adding these two options to the compiler:
-CX -XX
and You have to specify the path to the PSY-Q-SDK:
-Fl/home/ps1/psy-q-sdk
so Your compile command should look like this:
$ppcrossmipsel test.pas -Tps1 -CX -XX -Fl/home/ps1/psy-q-sdk -O-
or if You have no symlinks to binutils:
$ppcrossmipsel test.pas -Tps1 -CX -XX -Fl/home/ps1/psy-q-sdk -XP/usr/local/mipsel-unknown-elf/bin/mipsel-unknown-elf- -O-
test.pas
{$MODE OBJFPC}
uses libstd;
begin
printf('HELLO from FPC'#10);
end.
Here's what this program produces in the PCSX-Redux emulator when You switch MainMenu->Debug->Show Logs:
HELLO from FPC
cube.pas