1

So, I am looking for disassembler code for MIPS commands, for example: if the program gets word of command like 3c1d8010, I want to get the name of the command and the registers, which it uses: lui sp,0x8010

examples: 25080268 addiu t0,t0,616 40806800 mtc0 zero,$13

I know, that it is possible to write by myself, but maybe somebody has done it already.

Many thanks in advance!

2
  • 1
    I typed your title into Google, and while the first hit was a commercial product, the second one has the description "mips-dasm is a mips disassembler written in C. It accepts lines of 32-bit numbers that it decodes into their MIPS32 instruction equivalent, through stdin or input file.". On github, so free & with source.
    – Jongware
    Oct 7, 2016 at 14:46
  • There's also an option of using objdump, see linux - How do I disassemble raw MIPS code? - Stack Overflow
    – user202729
    Sep 7, 2021 at 2:55

3 Answers 3

3

Try capstone. They have a good documentation with samples like the following:

 # test1.py
 from capstone import *

 CODE = b"\x55\x48\x8b\x05\xb8\x13\x00\x00"

 md = Cs(CS_ARCH_X86, CS_MODE_64)
 for i in md.disasm(CODE, 0x1000):
     print("0x%x:\t%s\t%s" %(i.address, i.mnemonic, i.op_str))

Output sample:

$ python test1.py

0x1000: push    rbp
0x1001: mov rax, qword ptr [rip + 0x13b8]

According to the docs they support MIPS and of course they have code on GitHub.

3

If you want to have quick access without installing anything, try The online disassembler.

2

you can try radare2

E:\R2>rasm2.exe -a mips -e -d -
25080268
addiu t0, t0, 0x268
40806800
mtc0 zero, t5, 0

use mips.gnu to get the output you queried

E:\R2>rasm2.exe -a mips.gnu -e -d -
25080268
addiu t0, t0, 616
40806800
mtc0 zero, $13

rasm2 -h should show the switches

-a = arch (use -L to list the numerous architectures it supports)
-e = to tell that the input is Big-Endian
-d = Disassemble 
-  = to provide input from Stdin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.