1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
| codes = [0xF0, 0xE0, 0x02, 0x00, 0xF0, 0xE0, 0x00, 0xE0, 0x02, 0xF0, 0xE1, 0xE0, 0x02, 0xE0, 0x02, 0xF0, 0xE0, 0x01, 0x10, 0xF2, 0xE0, 0x00, 0xE0, 0x01, 0xF1, 0xE0, 0x00, 0x20, 0x02, 0xF0, 0xE0, 0x00, 0xE1, 0xE0, 0x00, 0xF0, 0xE0, 0x01, 0xE0, 0x02, 0xF1, 0xE0, 0x01, 0x00, 0x01, 0xF0, 0xE1, 0xE0, 0x01, 0xE0, 0x00, 0xF3, 0xE0, 0x02, 0xF6, 0xE0, 0x02, 0x00, 0x01, 0xF7, 0x04, 0xF0, 0xE0, 0x02, 0x00, 0xF0, 0xE0, 0x03, 0x00, 0xF0, 0xE0, 0x00, 0xE1, 0xE0, 0x02, 0xF1, 0xE0, 0x03, 0xE0, 0x00, 0xF0, 0xE0, 0x00, 0xE1, 0x02, 0xF1, 0xE0, 0x00, 0x00, 0x01, 0xF0, 0xE0, 0x00, 0xE1, 0xE0, 0x00, 0xF1, 0xE0, 0x03, 0xE0, 0x00, 0xF2, 0xE0, 0x03, 0x00, 0x01, 0xF0, 0xE0, 0x00, 0xE1, 0xE0, 0x02, 0xF0, 0xE0, 0x01, 0xE1, 0xE0, 0x03, 0xF0, 0xE1, 0xE0, 0x03, 0xE0, 0x00, 0xF0, 0xE1, 0xE0, 0x02, 0xE0, 0x01, 0xF3, 0xE0, 0x02, 0xF6, 0xE0, 0x02, 0x00, 0x01, 0xF7, 0x45, 0xF0, 0xE0, 0x02, 0x00, 0xF0, 0xE0, 0x03, 0x00, 0xF3, 0xE0, 0x02, 0xF2, 0xE0, 0x02, 0x00, 0x01, 0xF0, 0xE0, 0x00, 0xE1, 0xE0, 0x02, 0xF1, 0xE0, 0x03, 0xE0, 0x00, 0xF2, 0xE0, 0x03, 0x00, 0x01, 0xF0, 0xE0, 0x00, 0xE1, 0xE0, 0x02, 0xF0, 0xE0, 0x01, 0xE1, 0xE0, 0x03, 0xF0, 0xE1, 0xE0, 0x03, 0xE0, 0x00, 0xF0, 0xE1, 0xE0, 0x02, 0xE0, 0x01, 0xF1, 0xE0, 0x00, 0xE0, 0x01, 0xF2, 0xE0, 0x00, 0x00, 0x01, 0xF0, 0xE0, 0x00, 0xE1, 0xE0, 0x00, 0xF0, 0xE0, 0x01, 0xE0, 0x02, 0xF4, 0xE0, 0x01, 0xF1, 0xE0, 0x01, 0x00, 0x02, 0xF0, 0xE0, 0x01, 0xE1, 0xE0, 0x01, 0xF5, 0xE0, 0x00, 0xE0, 0x01, 0xF1, 0xE0, 0x00, 0xE0, 0x02, 0xF0, 0xE0, 0x01, 0xE0, 0x02, 0xF4, 0xE0, 0x01, 0xF1, 0xE0, 0x01, 0x00, 0x02, 0xF0, 0xE1, 0xE0, 0x01, 0xE0, 0x00, 0xF0, 0xE0, 0x01, 0xE0, 0x02, 0xF4, 0xE0, 0x01, 0xF6, 0xE0, 0x01, 0x20, 0x00, 0xF7, 0x94, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
op=0 flag=0 while op < len(codes): optemp = (codes[op]+0x10) & 0xff if(optemp >=8): break print("0x%04x:" % (op),end=' ') if optemp == 0: step=1 while(codes[op+step]<0xf0): step+=1 if(step==4): print('a%d = 0x%x' % (codes[op+2],codes[op+3])) elif(step==5): print("a%d = a%d" % (codes[op+2],codes[op+4])) else: assert step == 6 if(codes[op+1]==0xE0): if(codes[op+4]==0xE0): print("a%d = [a%d]" % (codes[op+2],codes[op+5])) else: print("a%d = [0x%x]" % (codes[op+2],(codes[op+5] << 8) + codes[op+4])) else: assert codes[op+1] == 0xE1 print("[a%d] = a%d" % (codes[op+3],codes[op+5])) op+=step elif(optemp== 1): if(codes[op+3]==0xE0): print("a%d += a%d" % (codes[op+2],codes[op+4])) else: print("a%d += 0x%x" % (codes[op+2],(codes[op+4]<<8) + codes[op+3])) op+=5 elif(optemp == 2): if(codes[op+3]==0xE0): print("a%d %%= a%d" % (codes[op+2],codes[op+4])) else: print("a%d %%= 0x%x" % (codes[op+2],(codes[op+4]<<8) + codes[op+3])) op+=5 elif(optemp == 3): print("a%d++" % codes[op+2]) op+=3 elif(optemp == 4): print("a%d--"% codes[op+2]) op+=3 elif(optemp == 5): print("a%d ^= a%d" % (codes[op+2],codes[op+4])) op+=5 elif(optemp == 6): if(codes[op+2] < ((codes[op+4]<<8) + codes[op+3])): flag=1 print("flag = %d" % flag) op+=5 elif(optemp == 7): if(flag==1): print("goto 0x%04x" % codes[op+1]) flag=0 op+=2 else: print(666)
|