• Good day, Guest!
    Flowers in Chania

    OG is raising money to form a non profit community interest company enabling us to preserve more history than ever before!

    Unfortunately, like most things in life this is going to cost money and we're asking for some help from the community. All users will be given donator status, along with early updates and depending on how much you help us with we'll try to chuck in some free merch!

    This will cost us roughly $850 for two years including business address/phone number etc which is needed to register a business bank account within the UK.

    You can help us by making a custom pledge, or by making a general pledge as it all helps us greatly. We're happy for a one time donators via Ko-Fi, Patreon asks monthly so please be aware. To prevent charge backs we're unable to accept Paypal at this time. Although once live this will be sorted too!

    One time donations can be sent via our Ko-Fi,



    Or for monthly please visit our Patreon, Ko-Fi is preferred as they charge us less fee's. Become a Patron of Obscure Gamers!
  • The Obscure Gamers 2020 Light and Dark themes are now live! Please report any bugs and make any suggestions you may have to a member of staff.

PS1 PS1 Programming in C with mipsgcc

ejack

Registered
Registered
Joined
Aug 25, 2019
Messages
14
Reaction score
0
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

AG Refugee
Refugee
Joined
Jun 7, 2019
Messages
144
Reaction score
70
- 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

Registered
Registered
Joined
Aug 25, 2019
Messages
14
Reaction score
0
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
 

ejack

Registered
Registered
Joined
Aug 25, 2019
Messages
14
Reaction score
0
I missed these, thanks a lot!
 
Top