• Hey, Guest!

    XenForo 2.2 is coming soon, it's bringing many new features such as a PWA app for OG etc. It also comes with the drawback of more costs to update themes/some addons. It'll also remove access to some older browsers which'll suck but these shouldn't be used as their security sucks.

    With the costs already looming we decided to improve OG's look with a new fancy theme that gives OG a more gamer feel. This has cost us only slightly more than it would have cost to renew the current theme and runs alot nicer.

    You can beta test it here: Linky. (Please note only dark is live, light will come once issues are ironed out.)

    If the current theme breaks on update we will end of life it, but we'll make something looking similar based on the default free theme so don't fret!

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
Registered
Joined
Jun 7, 2019
Messages
183
Reaction score
85
- 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
 

danhans42

Love PSX :-D
Refugee
Registered
Joined
May 31, 2019
Messages
42
Reaction score
46
AG User Name
dh115
AG Join Date
15th September, 2007

ejack

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