Decompollaborate / spimdisasm

MIPS disassembler
https://pypi.org/project/spimdisasm/
MIT License
45 stars 13 forks source link

-mips1 double literals misdetected as two floats #57

Closed simonlindholm closed 1 year ago

simonlindholm commented 2 years ago

From IDO 5.3 as1:

/* 041804 00441804 8F818070 */  lw          $at, %got(FLT_10018C00)($gp)
/* 041808 00441808 00000000 */  nop
/* 04180C 0044180C C4278C00 */  lwc1        $f7, %lo(FLT_10018C00)($at)
/* 041810 00441810 C4268C04 */  lwc1        $f6, %lo(FLT_10018C04)($at)
...
glabel FLT_10018C00
/* 0B0C00 10018C00 47EFFFFF */ .float 122879.9921875

glabel FLT_10018C04
/* 0B0C04 10018C04 E091FF3D */ .float -8.41615545981605e+19
AngheloAlf commented 2 years ago

Do you happen to know how this would look like on a little endian machine? I'm wondering mainly about the register usage Would it look like something like this? (notice the swapped registers)

lwc1        $f6, %lo(FLT_10018C00)($at)
lwc1        $f7, %lo(FLT_10018C04)($at)
simonlindholm commented 2 years ago

I don't. Testing on PS1/PS2 on decomp.me just shows that those platforms don't support doubles at all.

AngheloAlf commented 2 years ago

I managed to test this on decomp.me and it seems like it flips the registers on little endian

Big endian (https://decomp.me/scratch/3O9WL):

lwc1    $f9,%lo(.rodata+0x28)(at)
lwc1    $f8,%lo(.rodata+0x2c)(at)

Little endian (https://decomp.me/scratch/Fzbf9):

lwc1    $f8,%lo(.rodata+0x28)(at)
lwc1    $f9,%lo(.rodata+0x2c)(at)
AngheloAlf commented 1 year ago

Fixed in release 1.12.2