Advertisement
Rainchus

Control Warping with ASM Code (JP PM64)

Mar 13th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. %Exp points holds your group address, coins hold your room address. You can edit the exp points by holding L, then pressing dpad up or down to add/subtract. Holding R, then pressing dpad up or down will subtract from your coin count. Hold L + R while walking through a loading zone for the code to warp you to group (exp points value) and room (last byte of coins value) that has been specified. A + B + dpad up with 0 out the star points and coins, so you can always reset it back to 0 easily. Probably lots of optimizations to be made, may get around to it some time later.
  2.  
  3. For Group Values and Valid Room Values: https://pastebin.com/Fp4C3c1u
  4.  
  5. 00: LUI t1, 0x8007
  6. 04: LHU t1, 0x4006 (t1) //Buttons Held
  7. 08: ori t2, r0, 0x0820 //load dpad up + L value into t2
  8. 0C: ori t3, r0, 0x0420 //load dpad down + L value into t3
  9. 10: ori t7, r0, 0x0810 //load dpad up + r value into t7
  10. 14: ori v1, r0, 0x0410 //load dpad down + r value into v1
  11. 18: BEQ t7, t1, 0x804000E4 //branch to setting up stuff for R button
  12. 1C: nop
  13. 20: BEQ v1, t1, 0x804000E4 //branch to setting up stuff for R button
  14. 24: LUI t4, 0x8010
  15. 28: ORI t4, t4, 0xF460 //load exp address into t4
  16. 2C: LB t5, 0x0000 (t4) //load exp value into t5
  17. 30: LUI t6, 0x8007
  18. 34: ORI t6, t6, 0x408B //load group value into t6
  19. 38: BEQ t2, t1, 0x804000B4 //(branch to if L + Dpad up is pressed)
  20. 3C: nop
  21. 40: BEQ t3, t1, 0x804000CC //(branch to L + dpad down is pressed)
  22. 44: ORI t2, r0, 0xC800
  23. 48: BEQ t1, t2, 0x80400120
  24. %4C: nop
  25.  
  26. %if L + R is held, load exp value and coin value into group address and room address
  27. 50: LUI t1, 0x8007 //take execution here after exp code
  28. 54: LHU t1, 0x4006 (t1) //load button value
  29. 58: ORI t2, r0, 0x0030 //load R + L button value into t2
  30. 5C: BNE t2, t1, 0x80400118 //if t2 =/= t1, (branch to ra)
  31. 60: NOP
  32. 64: LUI t1, 0x8007
  33. 68: ORI t1, t1, 0x408B //group address
  34. 6C: LUI t2, 0x8007
  35. 70: ORI t2, t2, 0x4091 //room address
  36. 74: LUI t3, 0x8010
  37. 78: ORI t3, t3, 0xF460 //exp address
  38. 7C: LUI t4, 0x8010
  39. 80: ORI t4, t4, 0xF45D //coin address second byte
  40. 84: LB t5, 0x0000 (t3)
  41. 88: SB t5, 0x0000 (t1)
  42. 8C: LB t5, 0x0000 (t4)
  43. 90: SB t5, 0x0000 (t2)
  44. 94: J 0x80400118
  45. 98: nop
  46.  
  47. %add 1 to exp/coin
  48. 9C: ADDI t7, t5, 0x0001 //add one to exp count
  49. A0: J 0x80400118
  50. A4: SB t7, 0x0000 (t4) //store new exp count into exp address
  51.  
  52.  
  53. %subtract 1 from exp/coin
  54. A8: ADDI t5, t5, 0xFFFF //subtract 1 from exp value
  55. AC: J 0x80400118
  56. B0: SB t5, 0x0000 (t4) //store subtracted value into exp address
  57.  
  58. %if L then dpad up is pressed
  59. B4: LUI t1, 0x8007
  60. B8: LHU t1, 0x4016 (t1)
  61. BC: ori t2, r0, 0x0800 //load dpad up value into t2
  62. C0: BEQ t1, t2, 0x8040009C //go to add 1 if dpad up + L is pressed
  63. C4: nop
  64. C8: J 0x80400118
  65.  
  66. %if L then dpad down is pressed
  67. CC: LUI t1, 0x8007
  68. D0: LHU t1, 0x4016 (t1)
  69. D4: ori t2, r0, 0x0400 //load dpad down value into t2
  70. D8: BEQ t1, t2, 0x804000A8 //go to subtract 1
  71. DC: nop
  72. E0: J 0x80400118
  73.  
  74. %if R + dpad up is pressed or R + dpad down (setting up registers)
  75. E4: LUI t4, 0x8010 //both R instances come here, then split to add/subtract at BEQ
  76. E8: ORI t4, t4, 0xF45D //load coin address into t4
  77. EC: LB t5, 0x0000 (t4) //load coin value into t5
  78. F0: LUI t6, 0x8007
  79. F4: ORI t6, t6, 0x4091 //load room address into t6
  80. F8: LUI t1, 0x8007
  81. FC: LHU t1, 0x4016 (t1) //load button 1 frame into t1
  82. 100: ORI t2, r0, 0x0800 //dpad up value
  83. 104: ORI t3, r0, 0x0400 //dpad down value
  84. 108: BEQ t2, t1 0x8040009C
  85. 10C: nop
  86. 110: BEQ t3, t1 0x804000A8
  87. 114: nop
  88. 118: jr ra
  89. 11C: nop
  90.  
  91. %0 out star points and coins (A + B + Dpad Up)
  92. 120: LUI t1, 0x8010
  93. 124: ORI t1, t1, 0xF460 //exp address
  94. 128: LUI t2, 0x8010
  95. 12C: ORI t2, t2, 0xF45C //coin address second byte
  96. 130: SB r0, 0x0000 (t1)
  97. 134: SH r0, 0x0000 (t2)
  98. 138: J 0x80400118
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement