Advertisement
Guest User

Untitled

a guest
Jul 8th, 2017
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.74 KB | None | 0 0
  1. ;$$inject.asm:
  2. ;@0609F154
  3. mov.l @(core_address, PC), R3
  4. JMP R3
  5.  
  6. NOP
  7. NOP
  8.  
  9. core_address:
  10. dc.l {{ core_address }}
  11.  
  12. ;$$ choose_address.asm:
  13. ;:6118634
  14. ;:60A4B38, 60AA308, 60AA448, 60ACBCC, 60AD0F4, 60AD8D4, 60ADC1C, 60ADD58
  15. start:
  16. MOV.L R14,@-R15
  17. MOV #$00,R14
  18. MOV.L R13,@-R15
  19. MOV.L R12,@-R15
  20. MOV.L R11,@-R15
  21. MOV R14,R12
  22. MOV.W @(groupSize,PC),R13 ; 0930
  23. MOV.L R10,@-R15
  24. MOV.L R9,@-R15
  25. STS.L PR,@-R15
  26. STS.L MACL,@-R15
  27. specPallet:
  28. MOV #$07, R2
  29. CMP/GT R6,R2
  30. BT normalPallet
  31. ADD #$F9, R6
  32. BRA procPallet
  33. MOV.L @(newPalLoc,PC),R2 ; 061A7DE8
  34.  
  35. normalPallet:
  36. MOV.L @(palletAddr,PC),R2 ; 061A7DE8
  37. procPallet:
  38. MULU.W R13,R4 ; 930 * unit index
  39. MOV.W @(sideSize,PC),R3 ; 498 (unit half)
  40. STS MACL,R13
  41. EXTU.W R13,R13 ; A8 = size of color index
  42. MULS.W R3,R5 ; 498*?
  43. MOV.W @(selectionSize,PC),R1 ; A8
  44. MOV.L @(addr2,PC),R10 ; 06137DF0
  45. ADD R2,R13
  46. MOV.L @(addr3,PC),R11 ; 0202839C
  47. STS MACL,R5
  48. MULS.W R1,R6 ; multiply color index by A8
  49. EXTS.W R5,R5
  50. ADD R5,R13
  51. STS MACL,R6
  52. EXTS.W R6,R6
  53. ADD R6,R13 ; add base value
  54. ;MOV.L @(testAddr,PC),R3
  55. ;MOV R3,R13
  56. ;MOV R3,R2
  57. MOV.L @(exitLoc,PC),R3
  58. NOP
  59. JMP R3
  60. MOV #$0A,R9
  61.  
  62. newPalLoc:
  63. dc.l {{ new_pallets_address }};
  64. groupSize:
  65. dc.w $0930
  66. align.l
  67. sideSize:
  68. dc.w $0498
  69. align.l
  70. palletAddr:
  71. dc.l $061A7DE8
  72. testAddr:
  73. dc.l $061A7DE8
  74. selectionSize:
  75. dc.w $A8
  76. align.l
  77. addr2:
  78. dc.l $06137DF0
  79. addr3:
  80. dc.l $0202839C
  81. exitLoc:
  82. dc.l $060D5084
  83.  
  84. ;$$core.asm
  85. start:
  86. MOV.W R0,@R15 ;<-- possible break/entry point
  87. EXTS.W R13,R12
  88. MOV.W @(anyButton,PC),R3 ;<-- 03F0, set to 13F0
  89. EXTS.W R13,R6
  90. MOV.W @(btnSet7,PC),R11 ;<-- 0150
  91. AND R3,R14
  92. MOV.L @(someAddrx,PC),R5 ;<-- 02017032
  93. SHLL R6
  94. MOV.L @(someAddr2,PC),R0 ;<-- 02016B36
  95. MOV.W @R15,R4
  96. MOV.B @(R0,R12),R0
  97. EXTU.W R4,R4
  98. MOV R4,R7
  99. OR R11,R7
  100. CMP/EQ #$00,R0
  101. BT/S procBtnSel
  102. ADD R5,R6
  103. CMP/EQ #$01,R0
  104. BT resumeMultiPress
  105. BRA beforeComplete
  106. NOP
  107. align.l
  108.  
  109. anyButton:
  110. dc.w $13F0
  111. align.l
  112. btnSet7:
  113. dc.w $0150
  114. align.l
  115. someAddrx:
  116. dc.l $02017032
  117. someAddr2:
  118. dc.l $02016B36
  119.  
  120. procBtnSel:
  121.  
  122. EXTU.W R14,R2
  123. MOV.W @(btnOnly,PC),R3 ;<-- 03F0, set to 13F0
  124. TST R3,R2 ;-- Test against 13F0 ( Normal button, with start included )
  125. BT beforeComplete ;-- complete since no normal button is pressed
  126. EXTU.W R14,R1
  127. CMP/EQ R11,R1 ;-- check if lp+mk+hp is pressed
  128. BF procNormalBtn ;-- if not, proc individual buttons
  129. BRA unknownProc ;-- button is 7, move it to r0
  130. MOV R7,R0
  131.  
  132. btnOnly:
  133. dc.w $03F0
  134. align.l
  135.  
  136. procNormalBtn:
  137. EXTU.W R14,R3
  138. MOV.W @(btnPressed,PC),R2
  139. TST R2,R3
  140. BF btnSpecStart
  141. MOV.L @(zeroValue, PC),R0 ; just put the normal button in the queue and call it a day
  142. BRA unknownProc
  143. OR R4,R0 ; don't know if this is necessary
  144.  
  145. btnPressed:
  146. dc.w $03F0; allow even with start
  147. ; here is where it starts
  148. btnSpecStart:
  149. MOV.W R14,@R6
  150. MOV #$01,R3
  151. MOV.L @(btnNormal_1,PC),R0
  152. MOV #$03,R2
  153. MOV.B R3,@(R0,R12)
  154. MOV.L @(btnNormal_2,PC),R0
  155. BRA beforeComplete
  156. MOV.B R2,@(R0,R12)
  157.  
  158. resumeMultiPress:
  159. MOV.W @R6,R1
  160. OR R14,R1
  161. MOV.W R1,@R6
  162. MOV.L @(btnNormal_2,PC),R0
  163. MOV.B @(R0,R12),R2
  164. ADD #$FF,R2
  165. MOV.B R2,@(R0,R12)
  166. EXTS.B R2,R2
  167. TST R2,R2
  168. BF chkSpecComplete
  169. EXTS.W R13,R0 ; after multiple attemps, we never get the value we wanted
  170. SHLL R0
  171. MOV.W @(R0,R5),R0 ; load the final value here
  172. EXTU.W R0,R0
  173. BRA unknownProc
  174. OR R4,R0
  175.  
  176. btnNormal_1:
  177. dc.l $02016B36
  178.  
  179. btnNormal_2:
  180. dc.l $02016B38
  181.  
  182.  
  183. chkSpecComplete:
  184. EXTS.W R13,R0
  185. SHLL R0
  186. MOV.W @(R0,R5),R3
  187. EXTU.W R3,R3
  188. CMP/EQ R11,R3
  189. BF beforeComplete
  190. BRA unknownProc ; release regardless
  191. MOV R7,R0
  192. beforeComplete:
  193. MOV R4,R0
  194. ; I believe at this point, r0 is checked to see if it contains a value, and pulls when it does?
  195. unknownProc:
  196. ADD #$04,R15
  197. LDS.L @R15+,PR
  198. MOV.L @R15+,R11
  199. MOV.L @R15+,R12
  200. MOV.L @R15+,R13
  201. RTS
  202. MOV.L @R15+,R14
  203.  
  204. zeroValue:
  205. dc.l $0
  206.  
  207. ;$$ exclude_hold_inject.asm
  208. ;@0609F0BC
  209. MOV.L @(chkFunc,PC), R3
  210. JMP R3
  211. NOP
  212. NOP
  213. chkFunc:
  214. dc.l {{ exclude_hold_address }}
  215.  
  216. ;$$ exclude_hold.asm
  217. BF p2btnset
  218. p1btnset:
  219. MOV.L @(d0609F0BE,PC),R2
  220. MOV.L @(d0609F0BC,PC),R1
  221. MOV.W @R2,R14
  222. BRA complete
  223. NOP
  224.  
  225. p2btnset:
  226. MOV.L @(d0609F144,PC),R2
  227. MOV.W @R2,R14
  228. MOV.L @(d0609F148,PC),R1
  229. complete:
  230.  
  231. MOV.W @R1,R3
  232. MOV #$18,R5
  233. NOT R14,R14
  234. SHLL8 R5
  235. OR R5,R14
  236. AND R3,R14
  237. MOV.L @(jExit,PC), R3
  238. JSR R3
  239. EXTU.W R14,R4
  240. MOV.L @(end,PC), R3
  241. JMP R3
  242. NOP
  243. NOP
  244. d0609F0BE:
  245. dc.l $206AA8E
  246. d0609F0BC:
  247. dc.l $206AA8C
  248.  
  249. d0609F144:
  250. dc.l $206AA92
  251. d0609F148:
  252. dc.l $206AA90
  253.  
  254. d0609EF98:
  255. dc.l $020154F9
  256. jExit:
  257. dc.l $0609F32E
  258. end:
  259. dc.l $0609F154
  260.  
  261. ;$$color_select.asm
  262. ;:609F588,60962D8
  263.  
  264. beginSelColor:
  265. MOV.L R14,@-R15
  266. MOV.L R13,@-R15
  267. MOV.L R12,@-R15
  268. MOV.L R11,@-R15
  269. MOV #$01,R12
  270. MOV.W @(d060A2908,PC),R2
  271. MOV R12,R3
  272. MOV.L @(d060A290C,PC),R0
  273. XOR R4,R3 ; r4 = player num, r3 = opposite player
  274. MOV.L R10,@-R15
  275. MOV.L R9,@-R15
  276. STS.L MACL,@-R15
  277. MULS.W R2,R3
  278. STS MACL,R3
  279. EXTS.W R3,R3
  280. MOV.B @(R0,R3),R0 ; always 1?
  281. TST R1,R1
  282. BF/S unknown01
  283. EXTS.W R4,R10 ; offset?
  284. MOV #$FF,R7
  285. BRA unknown02
  286. MOV R12,R14
  287.  
  288. unknown01:
  289. MOV.L @(d060A292A,PC),R6 ; 2011387
  290. MOV R6,R0
  291. MOV.B @(R0,R10),R7 ; R10 = who, R7 = unit
  292. EXTS.W R4,R0
  293. XOR R12,R0
  294. MOV.B @(R0,R6),R14 ; R14 = oppsite player?
  295.  
  296. unknown02:
  297. EXTS.W R4,R3
  298. MOV.L @(d060A2938,PC),R0
  299. XOR R12,R3
  300. SHLL R3
  301. MOV.W @(R0,R3),R2
  302. TST R2,R2
  303. BF/S unknown03
  304. MOV #$03,R9
  305. MOV #$7F,R7
  306.  
  307. unknown03:
  308. MOV.L @(d060A2948,PC),R2 ; investigate further
  309. EXTS.W R4,R13
  310. MOV #$00,R11
  311. XOR R12,R13 ; investigate further
  312. ADD R2,R13
  313. MOV R10,R6
  314. MOV.W @(btnOnly,PC),R1
  315. EXTU.W R5,R0
  316. AND R1,R0
  317. ; set the R0 value now
  318. ADD R2, R6
  319. CMP/EQ #$10,R0
  320. BT jmpBtn1
  321. CMP/EQ #$20,R0
  322. BT jmpBtn2
  323. CMP/EQ #$40,R0
  324. BT jmpBtn3
  325. MOV.W @(d060A2964,PC),R1
  326. CMP/EQ R1,R0
  327. BT jmpBtn4
  328. MOV.W @(d060A296A,PC),R1
  329. CMP/EQ R1,R0
  330. BT jmpBtn5
  331. MOV.W @(d060A2970,PC),R1
  332. CMP/EQ R1,R0
  333. BT jmpBtn7
  334. BRA jmpBtn6
  335. NOP
  336. jmpBtn1:
  337. BRA checkStart
  338. MOV #$00, R0
  339. jmpBtn2:
  340. BRA checkStart
  341. MOV #$01, R0
  342. jmpBtn3:
  343. BRA checkStart
  344. MOV #$02, R0
  345. jmpBtn4:
  346. BRA checkStart
  347. MOV #$03, R0
  348. jmpBtn5:
  349. BRA checkStart
  350. MOV #$04, R0
  351. jmpBtn6:
  352. BRA checkStart
  353. MOV #$05, R0
  354. jmpBtn7:
  355. MOV #$06, R0
  356.  
  357. checkStart:
  358. ; just go through with any button, then complete
  359. MOV #$10, R1
  360. SHLL8 R1
  361. AND R5,R1
  362. TST R1,R1
  363. BF startPressed
  364. BRA jmpBtnComplete
  365. NOP
  366. startPressed:
  367. ADD #$07, R0
  368. jmpBtnComplete:
  369. MOV.B R0,@R6
  370. BRA complete
  371. NOP
  372. ; start checking for individual buttons
  373. ;end
  374.  
  375.  
  376. button7pressed:
  377. MOV.L @(d060A297A,PC),R3
  378. MOV.B @R3,R0
  379. EXTU.B R0,R0
  380. CMP/EQ #$03,R0
  381. BF btn7Chosen
  382. MOV.B @R13,R1
  383. TST R1,R1
  384. BF button7select
  385. EXTS.B R7,R7
  386. EXTS.B R14,R14
  387. CMP/EQ R14,R7
  388. BT button1complete
  389.  
  390. button7select:
  391. BRA complete
  392. MOV.B R11,@R6
  393.  
  394. btn7Chosen:
  395. MOV.B @R13,R0
  396. CMP/EQ #$06,R0
  397. BF btn7NotChosen
  398. EXTS.B R7,R7
  399. EXTS.B R14,R14
  400. CMP/EQ R14,R7
  401. BT button4complete
  402.  
  403. btn7NotChosen:
  404. MOV #$06,R2
  405. BRA complete
  406. MOV.B R2,@R6
  407.  
  408. button1pressed:
  409. MOV.B @R13,R1 ; get the other color chosen from player
  410. TST R1,R1 ; check to see if it's 0
  411. BF btn1completeAlt ; if the other color is 0 then
  412. EXTS.B R7,R7 ; selecting char, 7F if not selected
  413. EXTS.B R14,R14 ; other char
  414. CMP/EQ R14,R7 ; if same
  415. BF btn1completeAlt ; jump here if same
  416. button1complete:
  417. BRA complete
  418. MOV.B R9,@R6 ; loading 3 if the same button is pressed
  419. btn1completeAlt: ; jump here if color is already picked
  420. BRA complete
  421. MOV.B R11,@R6
  422.  
  423. button2pressed:
  424. MOV.B @R13,R0
  425. CMP/EQ #$01,R0
  426. BF button2complete
  427. EXTS.B R7,R7
  428. EXTS.B R14,R14
  429. CMP/EQ R14,R7
  430. BF button2complete
  431. BRA btnMultiComplete
  432. MOV #$04,R3
  433. button2complete:
  434. BRA complete
  435. MOV.B R12,@R6
  436.  
  437. button3pressed:
  438. MOV.B @R13,R0
  439. CMP/EQ #$02,R0
  440. BF button3complete
  441. EXTS.B R7,R7
  442. EXTS.B R14,R14
  443. CMP/EQ R14,R7
  444. BF button3complete
  445. BRA btnMultiComplete
  446. MOV #$05,R3
  447. button3complete:
  448. MOV #$02,R1
  449. BRA complete
  450. MOV.B R1,@R6
  451.  
  452. button4pressed:
  453. MOV.B @R13,R0
  454. CMP/EQ #$03,R0
  455. BF btn4completeAlt
  456. EXTS.B R7,R7
  457. EXTS.B R14,R14
  458. CMP/EQ R14,R7
  459. BF btn4completeAlt
  460.  
  461. button4complete:
  462. BRA complete
  463. MOV.B R11,@R6
  464. btn4completeAlt:
  465. BRA complete
  466. MOV.B R9,@R6
  467.  
  468. button5pressed:
  469. MOV.B @R13,R0
  470. CMP/EQ #$04,R0
  471. BF button5complete
  472. EXTS.B R7,R7
  473. EXTS.B R14,R14
  474. CMP/EQ R14,R7
  475. BF button5complete
  476. BRA complete
  477. MOV.B R12,@R6
  478. button5complete:
  479. MOV #$04,R2
  480. BRA complete
  481. MOV.B R2,@R6
  482.  
  483. button6Multi:
  484. MOV.B @R13,R0
  485. CMP/EQ #$05,R0
  486. BF btnMCompleteAlt
  487. EXTS.B R7,R7
  488. EXTS.B R14,R14
  489. CMP/EQ R14,R7
  490. BF btnMCompleteAlt
  491. MOV #$02,R3
  492.  
  493. btnMultiComplete:
  494. BRA complete
  495. MOV.B R3,@R6
  496. btnMCompleteAlt:
  497. MOV #$05,R1
  498. MOV.B R1,@R6
  499.  
  500. complete:
  501. LDS.L @R15+,MACL
  502. MOV.L @R15+,R9
  503. MOV.L @R15+,R10
  504. MOV.L @R15+,R11
  505. MOV.L @R15+,R12
  506. MOV.L @R15+,R13
  507. RTS
  508. MOV.L @R15+,R14
  509. d060A2908:
  510. dc.w $0498
  511. align.l
  512. d060A290C:
  513. dc.l $02068C6F
  514. d060A292A:
  515. dc.l $02011387
  516. d060A2938:
  517. dc.l $020154C2
  518. d060A2948:
  519. dc.l $02015683
  520. d060A2964:
  521. dc.w $0080
  522. d060A296A:
  523. dc.w $0100
  524. d060A2970:
  525. dc.w $0150
  526. align.l
  527. d060A297A:
  528. dc.l $020156B2
  529. btnOnly:
  530. dc.w $03F0
  531. align.l
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement