Welcome, Guest!

Here are some links you may find helpful

PS1 Programming in C with mipsgcc

ejack

Member
Original poster
Registered
Aug 25, 2019
12
0
1
Hi all
I'm trying to compile C programs for the PS1 and I can't manage to do it
Looks like there are 3 methods: PsyQ SDK, Yaroze and mipsgcc

mipsgcc seems to be the only legal (and best) way to create programs
The problem is that whatever I try I keep getting "abnormal program termination" with it
I find only one result on Google for this problem but there isn't any answer
$ md5sum mipsgcc.* #downloaded from psxdev
ab52289b76e3c2cca553c2024bd41b59 mipsgcc.zip
ded69e0e876e2ba9a71c417d09628a19 mipsgcc.exe
An example with "blitz" from http://www.candu.co.uk/psx/ :
#random line from build.bat: "mipsgcc -Wall -c introscreen.c"
$ md5sum introscreen.c
d93c1c5fa61a6ce2f11c98c1ba09fc3e introscreen.c
$ mipsgcc -Wall -c introscreen.c
abnormal program termination

I tried both on Linux Mint with Wine and on Windows 10

I don't know what more to test...
Does anyone have any info or any idea about what to test next?

In the mean time I'm still trying and will report back any progress
 
Last edited:

cta

Well-known member
Registered
Jun 7, 2019
174
83
28
- Does the gcc binary all by itself work (e.g. with "--help")?
- Add a "-v" to get more insight into where in the toolchain the error occurs.
- Make sure the line endings in the c file are correct, with all the WINEing and whatnot that sometimes is an issue.
- If all else fails, you can always compile your own mips-targeting gcc.
 

ejack

Member
Original poster
Registered
Aug 25, 2019
12
0
1
Thank you for your answer
Yes the binary worked and the endings were correct (as I tested with \n and \r\n)
Finally I managed to find a config that works before reading your answer but I don't remember what was the bad one
I think I failed to set the correct environment variables

To give some insight into what happens I ran the compilation again with bad env variables and I got the "abnormal program termination" again
And your suggestion explains nicely what the problem is
Code:
#bad env variables
  mipscpp                                  -lang-c -v -I/home/user/blade_full_12/INCLUDE -undef -D__GNUC__=2 -D__GNUC_MINOR__=7 -Dmips -DMIPSEL -DR3000 -D_mips -D_MIPSEL -D_R3000 -D__mips__ -D__MIPSEL__ -D__R3000__ -D___mips__ -D_MIPSEL -D_R3000 -D__mips -D__MIPSEL -D__R3000 -D___mips -D__OPTIMIZE__ -Wall -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int introscreen.c C:\users\user\Temp\cca00008.i
#good env variables
  /home/user/blade_full_12/BIN\mipscpp.exe -lang-c -v -I/home/user/blade_full_12/INCLUDE -undef -D__GNUC__=2 -D__GNUC_MINOR__=7 -Dmips -DMIPSEL -DR3000 -D_mips -D_MIPSEL -D_R3000 -D__mips__ -D__MIPSEL__ -D__R3000__ -D___mips__ -D_MIPSEL -D_R3000 -D__mips -D__MIPSEL -D__R3000 -D___mips -D__OPTIMIZE__ -Wall -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int introscreen.c /tmp\cca00008.i

Here is a working config, hoping it would help someone later
It's not pretty or anything, it's just something that works (using Blade Lib 1.2)
Code:
export MIPS_DIR="/home/user/blade_full_12"
export MIPS_TEMP="/tmp"
export MIPS_COMPILER_PATH="$MIPS_DIR/BIN"
export MIPS_LIBRARY_PATH="$MIPS_DIR/LIB"
export MIPS_C_INCLUDE_PATH="$MIPS_DIR/INCLUDE"
export MIPS_CPLUS_INCLUDE_PATH="$MIPS_DIR/INCLUDE"
export CC="wine $MIPS_COMPILER_PATH/mipsgcc.exe"
export PATH="$PATH;$MIPS_COMPILER_PATH"

$CC -Wall -I$MIPS_C_INCLUDE_PATH -O2 -c introscreen.c
$CC -Wall -I$MIPS_C_INCLUDE_PATH -O2 -c level.c
$CC -Wall -I$MIPS_C_INCLUDE_PATH -O2 -c game.c
$CC -Wall -I$MIPS_C_INCLUDE_PATH -O2 -c player.c
$CC -Wall -I$MIPS_C_INCLUDE_PATH -O2 -c blitz.c

$CC -I$MIPS_C_INCLUDE_PATH -O2 -Xlinker -mpsx -o demo1.psx level.o game.o player.o blitz.o introscreen.o $MIPS_LIBRARY_PATH/bladeps.a
 

Make a donation