Super Mario 64s source code (from a leak on 4chan so be careful)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

233 lines
4.3 KiB

6 years ago
  1. .set noat # allow manual use of $at
  2. .set noreorder # don't insert nops after branches
  3. .set gp=64
  4. .include "macros.inc"
  5. .section .text, "ax"
  6. glabel bcopy
  7. beqz $a2, .L80323A4C
  8. move $a3, $a1
  9. beq $a0, $a1, .L80323A4C
  10. slt $at, $a1, $a0
  11. bnezl $at, .L80323A14
  12. slti $at, $a2, 0x10
  13. add $v0, $a0, $a2
  14. slt $at, $a1, $v0
  15. beql $at, $zero, .L80323A14
  16. slti $at, $a2, 0x10
  17. b .L80323B78
  18. slti $at, $a2, 0x10
  19. slti $at, $a2, 0x10
  20. .L80323A14:
  21. bnez $at, .L80323A2C
  22. nop
  23. andi $v0, $a0, 3
  24. andi $v1, $a1, 3
  25. beq $v0, $v1, .L80323A54
  26. nop
  27. .L80323A2C:
  28. beqz $a2, .L80323A4C
  29. nop
  30. addu $v1, $a0, $a2
  31. .L80323A38:
  32. lb $v0, ($a0)
  33. addiu $a0, $a0, 1
  34. addiu $a1, $a1, 1
  35. bne $a0, $v1, .L80323A38
  36. sb $v0, -1($a1)
  37. .L80323A4C:
  38. jr $ra
  39. move $v0, $a3
  40. .L80323A54:
  41. beqz $v0, .L80323AB8
  42. li $at, 1
  43. beq $v0, $at, .L80323A9C
  44. li $at, 2
  45. beql $v0, $at, .L80323A88
  46. lh $v0, ($a0)
  47. lb $v0, ($a0)
  48. addiu $a0, $a0, 1
  49. addiu $a1, $a1, 1
  50. addiu $a2, $a2, -1
  51. b .L80323AB8
  52. sb $v0, -1($a1)
  53. lh $v0, ($a0)
  54. .L80323A88:
  55. addiu $a0, $a0, 2
  56. addiu $a1, $a1, 2
  57. addiu $a2, $a2, -2
  58. b .L80323AB8
  59. sh $v0, -2($a1)
  60. .L80323A9C:
  61. lb $v0, ($a0)
  62. lh $v1, 1($a0)
  63. addiu $a0, $a0, 3
  64. addiu $a1, $a1, 3
  65. addiu $a2, $a2, -3
  66. sb $v0, -3($a1)
  67. sh $v1, -2($a1)
  68. .L80323AB8:
  69. slti $at, $a2, 0x20
  70. bnezl $at, .L80323B18
  71. slti $at, $a2, 0x10
  72. lw $v0, ($a0)
  73. lw $v1, 4($a0)
  74. lw $t0, 8($a0)
  75. lw $t1, 0xc($a0)
  76. lw $t2, 0x10($a0)
  77. lw $t3, 0x14($a0)
  78. lw $t4, 0x18($a0)
  79. lw $t5, 0x1c($a0)
  80. addiu $a0, $a0, 0x20
  81. addiu $a1, $a1, 0x20
  82. addiu $a2, $a2, -0x20
  83. sw $v0, -0x20($a1)
  84. sw $v1, -0x1c($a1)
  85. sw $t0, -0x18($a1)
  86. sw $t1, -0x14($a1)
  87. sw $t2, -0x10($a1)
  88. sw $t3, -0xc($a1)
  89. sw $t4, -8($a1)
  90. b .L80323AB8
  91. sw $t5, -4($a1)
  92. .L80323B14:
  93. slti $at, $a2, 0x10
  94. .L80323B18:
  95. bnezl $at, .L80323B54
  96. slti $at, $a2, 4
  97. lw $v0, ($a0)
  98. lw $v1, 4($a0)
  99. lw $t0, 8($a0)
  100. lw $t1, 0xc($a0)
  101. addiu $a0, $a0, 0x10
  102. addiu $a1, $a1, 0x10
  103. addiu $a2, $a2, -0x10
  104. sw $v0, -0x10($a1)
  105. sw $v1, -0xc($a1)
  106. sw $t0, -8($a1)
  107. b .L80323B14
  108. sw $t1, -4($a1)
  109. .L80323B50:
  110. slti $at, $a2, 4
  111. .L80323B54:
  112. bnez $at, .L80323A2C
  113. nop
  114. lw $v0, ($a0)
  115. addiu $a0, $a0, 4
  116. addiu $a1, $a1, 4
  117. addiu $a2, $a2, -4
  118. b .L80323B50
  119. sw $v0, -4($a1)
  120. slti $at, $a2, 0x10
  121. .L80323B78:
  122. add $a0, $a0, $a2
  123. bnez $at, .L80323B94
  124. add $a1, $a1, $a2
  125. andi $v0, $a0, 3
  126. andi $v1, $a1, 3
  127. beq $v0, $v1, .L80323BC4
  128. nop
  129. .L80323B94:
  130. beqz $a2, .L80323A4C
  131. nop
  132. addiu $a0, $a0, -1
  133. addiu $a1, $a1, -1
  134. subu $v1, $a0, $a2
  135. .L80323BA8:
  136. lb $v0, ($a0)
  137. addiu $a0, $a0, -1
  138. addiu $a1, $a1, -1
  139. bne $a0, $v1, .L80323BA8
  140. sb $v0, 1($a1)
  141. jr $ra
  142. move $v0, $a3
  143. .L80323BC4:
  144. beqz $v0, .L80323C28
  145. li $at, 3
  146. beq $v0, $at, .L80323C0C
  147. li $at, 2
  148. beql $v0, $at, .L80323BF8
  149. lh $v0, -2($a0)
  150. lb $v0, -1($a0)
  151. addiu $a0, $a0, -1
  152. addiu $a1, $a1, -1
  153. addiu $a2, $a2, -1
  154. b .L80323C28
  155. sb $v0, ($a1)
  156. lh $v0, -2($a0)
  157. .L80323BF8:
  158. addiu $a0, $a0, -2
  159. addiu $a1, $a1, -2
  160. addiu $a2, $a2, -2
  161. b .L80323C28
  162. sh $v0, ($a1)
  163. .L80323C0C:
  164. lb $v0, -1($a0)
  165. lh $v1, -3($a0)
  166. addiu $a0, $a0, -3
  167. addiu $a1, $a1, -3
  168. addiu $a2, $a2, -3
  169. sb $v0, 2($a1)
  170. sh $v1, ($a1)
  171. .L80323C28:
  172. slti $at, $a2, 0x20
  173. bnezl $at, .L80323C88
  174. slti $at, $a2, 0x10
  175. lw $v0, -4($a0)
  176. lw $v1, -8($a0)
  177. lw $t0, -0xc($a0)
  178. lw $t1, -0x10($a0)
  179. lw $t2, -0x14($a0)
  180. lw $t3, -0x18($a0)
  181. lw $t4, -0x1c($a0)
  182. lw $t5, -0x20($a0)
  183. addiu $a0, $a0, -0x20
  184. addiu $a1, $a1, -0x20
  185. addiu $a2, $a2, -0x20
  186. sw $v0, 0x1c($a1)
  187. sw $v1, 0x18($a1)
  188. sw $t0, 0x14($a1)
  189. sw $t1, 0x10($a1)
  190. sw $t2, 0xc($a1)
  191. sw $t3, 8($a1)
  192. sw $t4, 4($a1)
  193. b .L80323C28
  194. sw $t5, ($a1)
  195. .L80323C84:
  196. slti $at, $a2, 0x10
  197. .L80323C88:
  198. bnezl $at, .L80323CC4
  199. slti $at, $a2, 4
  200. lw $v0, -4($a0)
  201. lw $v1, -8($a0)
  202. lw $t0, -0xc($a0)
  203. lw $t1, -0x10($a0)
  204. addiu $a0, $a0, -0x10
  205. addiu $a1, $a1, -0x10
  206. addiu $a2, $a2, -0x10
  207. sw $v0, 0xc($a1)
  208. sw $v1, 8($a1)
  209. sw $t0, 4($a1)
  210. b .L80323C84
  211. sw $t1, ($a1)
  212. .L80323CC0:
  213. slti $at, $a2, 4
  214. .L80323CC4:
  215. bnez $at, .L80323B94
  216. nop
  217. lw $v0, -4($a0)
  218. addiu $a0, $a0, -4
  219. addiu $a1, $a1, -4
  220. addiu $a2, $a2, -4
  221. b .L80323CC0
  222. sw $v0, ($a1)
  223. nop
  224. nop
  225. nop