forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MIPS R4000 disassembly cheatsheet

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
TerryMathews



Joined: 31 Mar 2005
Posts: 19

PostPosted: Sun Apr 03, 2005 4:23 pm    Post subject: MIPS R4000 disassembly cheatsheet Reply with quote

Dunno, I may be the only person that uses this, but it comes in handy for searching through binaries with hex editors like XVI32...

Conventions:
X means variable.
+ means or. (0+8) means 0 or 8, X000 in binary.
- means through. (0-3) means 0+1+2+3, 00XX in binary.

Code:
R4000 ASM OPCODES (hex)
ADD     = 0x0(0-3)(0-F)(0-F)(0-F)(0+8)20
ADDI    = 0x2(0-3)(0-F)(0-F)(0-F)(0-F)(0-F)(0-F)
ADDIU   = 0x2(4-7)(0-F)(0-F)(0-F)(0-F)(0-F)(0-F)
ADDU    = 0x0(0-3)(0-F)(0-F)(0-F)(0+8)21
AND     = 0x0(0-3)(0-F)(0-F)(0-F)(0+8)24
ANDI    = 0x3(0-3)(0-F)(0-F)(0-F)(0-F)(0-F)(0-F)
BREAK   = 0x0(0-3)(0-F)(0-F)(0-F)(0-F)(0+4+8+c)D
CACHE   = 0xB(c-F)(0-F)(0-F)(0-F)(0-F)(0-F)(0-F)
DIV     = 0x0(0-3)(0-F)(0-F)001A
DIVU    = 0x0(0-3)(0-F)(0-F)001B
JUMP    = 0x0(8-B)(0-F)(0-F)(0-F)(0-F)(0-F)(0-F)
JAL     = 0x0(C-F)(0-F)(0-F)(0-F)(0-F)(0-F)(0-F)
JALR    = 0x0(0-3)(0+2+4+6+8+A+C+E)0(0-F)(0+8)09
JR      = 0x0(0-3)(0+2+4+6+8+A+C+E)00008
LB      = 0x8(0-3)(0-F)(0-F)(0-F)(0-F)(0-F)(0-F)
LBU     = 0x9(0-3)(0-F)(0-F)(0-F)(0-F)(0-F)(0-F)
MULT    = 0x0(0-3)(0-F)(0-F)0018
MULTU   = 0x0(0-3)(0-F)(0-F)0019
NOR     = 0x0(0-3)(0-F)(0-F)(0-F)(0+8)27
OR      = 0x0(0-3)(0-F)(0-F)(0-F)(0+8)25
ORI     = 0x3(4-7)(0-F)(0-F)(0-F)(0-F)(0-F)(0-F)
SYNC    = 0x0000000F
SYSCALL = 0x0(0-3)(0-F)(0-F)(0-F)(0-F)(0+4+8+C)C
XOR     = 0x0(0-3)(0-F)(0-F)(0-F)(0+8)26
XORI    = 0x3(8-B)(0-F)(0-F)(0-F)(0-F)(0-F)(0-F)


ver.1
Does not address coprocessor, double, half, traps, etc. Just the basics.

R4000 manual


Last edited by TerryMathews on Sun Apr 03, 2005 4:47 pm; edited 5 times in total
Back to top
View user's profile Send private message
TerryMathews



Joined: 31 Mar 2005
Posts: 19

PostPosted: Sun Apr 03, 2005 4:23 pm    Post subject: Reply with quote

Code:
R4000 ASM OPCODES (bin)
ADD     = 000000XXXXXXXXXXXXXXX00000100000
ADDI    = 001000XXXXXXXXXXXXXXXXXXXXXXXXXX
ADDIU   = 001001XXXXXXXXXXXXXXXXXXXXXXXXXX
ADDU    = 000000XXXXXXXXXXXXXXX00000100001
AND     = 000000XXXXXXXXXXXXXXX00000100100
ANDI    = 001100XXXXXXXXXXXXXXXXXXXXXXXXXX
BREAK   = 000000XXXXXXXXXXXXXXXXXXXX001101
CACHE   = 101111XXXXXXXXXXXXXXXXXXXXXXXXXX
DIV     = 000000XXXXXXXXXX0000000000011010
DIVU    = 000000XXXXXXXXXX0000000000011011
JUMP    = 000010XXXXXXXXXXXXXXXXXXXXXXXXXX
JAL     = 000011XXXXXXXXXXXXXXXXXXXXXXXXXX
JALR    = 000000XXXXX00000XXXXX00000001001
JR      = 000000XXXXX000000000000000001000
LB      = 100000XXXXXXXXXXXXXXXXXXXXXXXXXX
LBU     = 100100XXXXXXXXXXXXXXXXXXXXXXXXXX
MULT    = 000000XXXXXXXXXX0000000000011000
MULTU   = 000000XXXXXXXXXX0000000000011001
NOR     = 000000XXXXXXXXXXXXXXX00000100111
OR      = 000000XXXXXXXXXXXXXXX00000100101
ORI     = 001101XXXXXXXXXXXXXXXXXXXXXXXXXX
SYNC    = 00000000000000000000000000001111
SYSCALL = 000000XXXXXXXXXXXXXXXXXXXX001100
XOR     = 000000XXXXXXXXXXXXXXX00000100110
XORI    = 001110XXXXXXXXXXXXXXXXXXXXXXXXXX


ver.1
Back to top
View user's profile Send private message
Saotome



Joined: 03 Apr 2004
Posts: 182

PostPosted: Sun Apr 03, 2005 9:19 pm    Post subject: Reply with quote

i already suspected it, but just had a look at the R4000 manual and it seems that most of the opcodes for the R5900 and R4000 are the same. so you could just use the PS2 disassembler ps2dis to disassemble R4000 code.
_________________
infj
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Mon Apr 04, 2005 3:56 am    Post subject: Reply with quote

or any other mips disassembler.. another useless thread.. locked.
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group