The goal of maspsx
is to facilitate the replacement of the combination of ASPSX.EXE
+ psyq-obj-parser when attempting to generate byte-perfect ELF objects.
maspsx
takes the assembly code output of gcc
and massages it such that it can be assembled via GNU as
to the equivalent object as what the original PSYQ SDK would create.
ASPSX
does not appear to do very much in terms of code optimisation, therefore the belief is that this will be a straightforward process.
There are a number of reasons why using maspsx
with GNU as
is preferable to the original toolchain:
- No need to run 16-bit DOS or 32-bit Windows applications
- Native, vanilla, gcc versions make
dosemu2
andwine
unnecessary.
- Native, vanilla, gcc versions make
- Decomp tooling expects ELF objects
- Support for line numbers in diff!
- Pass
-gcoff
to gcc to get line numbers in asm-differ
- Pass
maspsx
supports the following arguments:
EXPERIMENTAL There are slight nuances in behaviour across ASPSX
versions. In order to emulate the correct behaviour, pass the ASPSX
version to maspsx
, e.g. --aspsx-version=2.78
.
The default behaviour of maspsx
is to write the output to stdout, by passing --run-assembler
, maspsx
will run mips-linux-gnu-as
directly.
If mips-linux-gnu-as
isn't on your path, or you want to use a different assembler (e.g. mipsel-linux-gnu-as
), specify the full path here.
Current understanding is that -G0
needs to be passed to GNU as
in order to get correct behaviour. If you need to pass a non-zero value for -G
to the GNU assembler, use this flag.
If you need maspsx
to expand div/divu
and rem/remu
ops, pass --expand-div
to maspsx
. There is already handling for partial div expansion (i.e. where -0
was passed to ASPSX.EXE
).
Get maspsx
to add an include "macro.inc"
statement to the output.
EXPERIMENTAL If your project uses $gp
, maspsx needs to be explicitly passed a non-zero value for -G
.
Behavior / Version | 2.21 | 2.34 | 2.56 | 2.67 | 2.77 | 2.79 | 2.81 | 2.86 |
---|---|---|---|---|---|---|---|---|
add nop between $v0/$at | ⚫ | ⚪ | ⚪ | ⚪ | ⚪ | ⚪ | ⚪ | ⚪ |
li 1 expands to ori 1 | ⚫ | ⚫ | ⚪ | ⚪ | ⚪ | ⚪ | ⚪ | ⚪ |
use $at for sltu < 0 | ⚫ | ⚫ | ⚫ | ⚫ | ⚪ | ⚪ | ⚪ | ⚪ |
use $gp for symbol+offset | ⚪ | ⚪ | ⚪ | ⚪ | ⚫ | ⚫ | ⚫ | ⚫ |
use $gp for la | ⚪ | ⚪ | ⚪ | ⚪ | ⚪ | ⚪ | ⚫ | ⚫ |
Projects that use maspsx
include:
- Castlevania: Symphony of the Night Decompilation
- open-ribbon
- Evo's Space Adventures
- Croc: Legend of the Gobbos
This project is a work-in-progress. If you encounter scenarios where maspsx
output differs from the original PSYQ toolchain please create a GitHub Issue - ideally with a link to a decomp.me scratch that demonstrates the problem.