An ISA definition for Kingdom Hearts 2 AI https://govanify.com/post/kh2ai/
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 

80 rindas
1.6 KiB

  1. OPCodes are 8 bits, 0x0-0xB, lowest bits. Arguments come BEFORE(!!!!)
  2. def value():
  3. if(Y==1): return state_r1+cmd
  4. if(Y==2): return state_r2+cmd
  5. if(Y==3): return cmd_0x10+(cmd<<1) #drops the opcode
  6. else: return cmd
  7. -0x0, PUSH, 48 bit operand, encoded 0xX000ZZZZZZZZ:
  8. Y=X>>2
  9. if(X & 3 == 2): r1 = mem[value(Y)]
  10. if(X & 3 != 2): r1 = value(Y)
  11. state_reg3=*addr
  12. -0x1, 16 bit operand, encoded 0xZYZ1:
  13. r1 = value(Y)
  14. r1 = state_reg3...???????
  15. -0x2, 16 bit operand, encoded 0xZYZ1:
  16. -0x3, 32 bit operand, encoded 0x3:
  17. r1 = state_reg3 + *addr
  18. XX001000
  19. ^
  20. -0x8, JMP, 32 bit operand, encoded bXX001000:
  21. state_reg2=X*4
  22. *(state_reg2)=pc
  23. entrypoint=X
  24. -0xA, JMP, 32 bit operand, encoded bXAXXYYYY:
  25. -0x5:
  26. --&3==0 aka integer:
  27. -0: to_int
  28. -2: minus
  29. -3: invert
  30. -4,8: compare w/ zero
  31. -5: absolute
  32. -6: ??
  33. -7: inferior to one
  34. -9: not equal to zero
  35. -0xa
  36. -0xb: is_positive
  37. --&3==1 aka float:
  38. -1: convert to word fixed point
  39. -2: minus
  40. -5: ABS
  41. -6: inferior to 0
  42. -7: inferior or equal to 0
  43. -8: equal to zero
  44. -9: not equal to zero
  45. -0xA: inferior or equal to zero
  46. -0xB: inferior to zero
  47. 1da3f8
  48. ======
  49. tmp=reg3
  50. reg3-=0x4
  51. t3[left]=tmp-1
  52. t3[right]=tmp-4
  53. =============================================================================================================
  54. TODO:
  55. 0x0: reverse unknowns + fix push label vs val
  56. 0x1: pop, reverse unknowns(get_arg)
  57. 0x2: to reverse(FUN_002fdd68)
  58. 0x4: to reverse(FUN_002fdd68)
  59. 0xB: to reverse
  60. -----
  61. 0x8: figure out first arg of jmp, offset?
  62. 0x7: figure out args and diff between 3 jmp