Register - Login
Views: 99796818
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - Stats - Latest Posts - Color Chart - Smilies
05-03-22 05:45:31 AM
Jul - SM64 Hacking (Archive) - Mario 64 'C' header files New poll - New thread - New reply
Pages: 1 2 3Next newer thread | Next older thread
Rena
I had one (1) message in Discord deleted and proceeded to make a huge, huge mess about how it was a violation of free speech and how moderators are supposed to be spam janitors and nobody should have the right to tell me not to talk about school shootings
Level: 135


Posts: 2613/5390
EXP: 29075409
For next: 259596

Since: 07-22-07

Pronouns: he/him/whatever
From: RSP Segment 6

Since last post: 342 days
Last activity: 342 days

Posted on 11-24-09 02:17:00 AM (last edited by HyperHacker at 11-23-09 11:22 PM) Link | Quote
Post #2613 - 11-23-09 09:17:00 PM
So apparently I have to ask again in here. I'm on Xubuntu and my MIPS 'as' is doing stupid optimizations and breaking my code.
For some reason I've had to compile it as "mips-unknown-linux-gnu-as" and similar. It doesn't support the -mno-gpopt flag, so I call it as such:
mips-unknown-linux-gnu-as -EB -mabi=32 -march=vr4300 -mtune=vr4300 -mno-shared -K --warn $1.asm -o $1.elf

Then I throw together some quick dummy code:
LUI $k1, 0x8034
LB $t0, 0xB21D($k1)

BNEL $t0, $zero, next
ADDIU $t0, $t0, 0x0001
BEQZ $a0, next
ADDIU $t0, $t0, 0xFFFF
LUI $t3, 0x5555

next: ADDIU $zero, $zero, 0x1234
and here's what it gets turned into: 0: 3c1b8034 lui k1,0x8034
4: 3c080001 lui t0,0x1
8: 011b4021 addu t0,t0,k1
c: 8108b21d lb t0,-19939(t0)
10: 55000006 bnezl t0,2c
14: 00000000 nop
18: 25080001 addiu t0,t0,1
1c: 10800003 beqz a0,2c
20: 00000000 nop
24: 2508ffff addiu t0,t0,-1
28: 3c0b5555 lui t3,0x5555

0000002c :
2c: 24001234 li zero,4660
For some reason it's decided to go changing how I use $k1, and rearranged my branches in a manner that is anywhere from inefficient to just broken depending on the code. Adding the -g or -g2 flags does not change this.

Additionally, objcopy isn't able to extract the code (though objdump disassembles it fine). It just outputs 24 bytes of zeros, or nothing at all.

____________________
why not?
messiaen
Catgirl
Level: 68


Posts: 698/1085
EXP: 2596322
For next: 132478

Since: 11-20-07


Since last post: 8.1 years
Last activity: 7.2 years

Posted on 11-24-09 01:38:14 PM Link | Quote
Someone told me there were some bugs with MIPS in newer versions of GCC. Try getting some older versions here. As for the delay slots, AFAIR 'as' automatically adds them, and I'm not sure how to change this behavior (have you tried different -o flags?)

Haven't looked much at assemblers, however I know hcs has one assembler he used to built the Neon64 emulator. Also, this one has been released recently.
Rena
I had one (1) message in Discord deleted and proceeded to make a huge, huge mess about how it was a violation of free speech and how moderators are supposed to be spam janitors and nobody should have the right to tell me not to talk about school shootings
Level: 135


Posts: 2625/5390
EXP: 29075409
For next: 259596

Since: 07-22-07

Pronouns: he/him/whatever
From: RSP Segment 6

Since last post: 342 days
Last activity: 342 days

Posted on 11-25-09 12:00:57 AM (last edited by HyperHacker at 11-24-09 09:11 PM) Link | Quote
Post #2625 - 11-24-09 07:00:57 PM
Well I downloaded the version of binutils linked there, and compiled it with the specified flags. That sure didn't work:a.asm: Assembler messages:
a.asm:1: Error: illegal operands `lui $k1,0x8034'
a.asm:2: Error: illegal operands `lb $t0,0xB21D($k1)'
a.asm:4: Error: illegal operands `bnel $t0,$zero,next'
a.asm:5: Error: illegal operands `addiu $t0,$t0,0x0001'
a.asm:6: Error: illegal operands `beqz $a0,next'
a.asm:7: Error: illegal operands `addiu $t0,$t0,0xFFFF'
a.asm:8: Error: illegal operands `lui $t3,0x5555'


Apparently this silly thing doesn't even support register names. And it still has the bugs I mentioned above.

____________________
why not?
Pages: 1 2 3Next newer thread | Next older thread
Jul - SM64 Hacking (Archive) - Mario 64 'C' header files New poll - New thread - New reply


Rusted Logic

Acmlmboard - commit 47be4dc [2021-08-23]
©2000-2022 Acmlm, Xkeeper, Kaito Sinclaire, et al.

28 database queries.
Query execution time: 0.094194 seconds
Script execution time: 0.009494 seconds
Total render time: 0.103688 seconds