91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 3KB
    文件類型: .py
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-16
  • 語言: Python
  • 標簽: mips??反匯編??

資源簡介

根據網上資料做了個mips指令的反匯編腳本,python寫的,簡單明了,可以作為機器碼查表用

資源截圖

代碼片段和文件信息

from?binascii?import*

pro=open(“x““rb“)

def?hexbit(x):
?x=int(x16)
?y=““
?while?x!=0:
??y=str(x%2)+y
??x=x/2
?if?len(y)<4:
??y=“0“*(4-len(y))+y
?return?y

def?hex32bit():
?x=hexlify(pro.read(4))
?y=““
?for?i?in?xrange(8):
??y+=hexbit(x[i])
?return?y
#-----------------------------
z=““
asm=open(“y.asm““a“)
def?main():
?global?z
?z=hex32bit()
?op=z[:6]
?if?op==“000000“:r_type()
?if?op==“000010“?or?op==“000011“:j_type()
?else:i_type()
def?bt(x):return?str(int(x2))
#-------------------------
def?r_type():
?rs=bt(z[6:11])
?rt=bt(z[11:16])
?rd=bt(z[16:21])
?shamt=bt(z[21:26])
?func=z[26:]
?if?func==“100000“:asm.write(“add?$“+rd+“$“+rs+“$“+rt+“\n“)
?if?func==“100001“:asm.write(“addu?$“+rd+“$“+rs+“$“+rt+“\n“)
?if?func==“100010“:asm.write(“sub?$“+rd+“$“+rs+“$“+rt+“\n“)
?if?func==“100011“:asm.write(“subu?$“+rd+“$“+rs+“$“+rt+“\n“)
?if?func==“100100“:asm.write(“and?$“+rd+“$“+rs+“$“+rt+“\n“)
?if?func==“100101“:asm.write(“or?$“+rd+“$“+rs+“$“+rt+“\n“)
?if?func==“100110“:asm.write(“xor?$“+rd+“$“+rs+“$“+rt+“\n“)
?if?func==“100111“:asm.write(“nor?$“+rd+“$“+rs+“$“+rt+“\n“)
?if?func==“101010“:asm.write(“slt?$“+rd+“$“+rs+“$“+rt+“\n“)
?if?func==“101011“:asm.write(“sltu?$“+rd+“$“+rs+“$“+rt+“\n“)

?if?func==“000000“:asm.write(“sll?$“+rd+“$“+rt+““+shamt+“\n“)
?if?func==“000010“:asm.write(“srl?$“+rd+“$“+rt+““+shamt+“\n“)
?if?func==“000011“:asm.write(“sra?$“+rd+“$“+

評論

共有 條評論

相關資源