Advertisement
owa-owa

spc転送コードとなんか遊び(smw)

Jun 10th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1.  
  2. .include "snes.h"
  3.  
  4. ; *** vector settings
  5.  
  6. .name "SNES Test Rom"
  7.  
  8. .SNESNATIVEVECTOR
  9. COP NullHandler
  10. BRK NullHandler
  11. ABORT NullHandler
  12. NMI NullHandler
  13. UNUSED $0000
  14. IRQ NullHandler
  15. .ENDNATIVEVECTOR
  16.  
  17. .SNESEMUVECTOR
  18. COP NullHandler
  19. UNUSED $0000
  20. ABORT NullHandler
  21. NMI NullHandler
  22. RESET main
  23. IRQBRK NullHandler
  24. .ENDEMUVECTOR
  25.  
  26. .define apulock 5
  27.  
  28.  
  29. .macro loadData args p
  30. lda.b [p]
  31. ldy.b p
  32. iny
  33. bne +
  34. inc p+2
  35. ldy #$8000
  36. + sty p
  37. .endm
  38.  
  39. .section MAIN force
  40.  
  41. .define pointer 0
  42. main:
  43. sei
  44. stz.w $4200
  45. stz.w $2140
  46. stz.w $2141
  47. stz.w $2142
  48. stz.w $2143
  49. lda.b #$80
  50. sta.w $2100
  51. clc ;
  52. xce ; Emulation flag 解除
  53. lda.b #$01
  54. sta.b apulock
  55. rep #$38
  56. lda.w #0
  57. tcd
  58. lda.w #$1ff
  59. tcs
  60. lda.w #EngineData
  61. sta.b pointer
  62. lda.w #:EngineData
  63. sta.b pointer+2
  64. jsr uploadSpc ; SPC Engine Upload
  65. sep #$20
  66. lda.b #0 ;
  67. - cmp.w $2140 ; smw spc 初期化待ち合わせ
  68. bne - ;
  69. lda.b #$ff
  70. sta.w $2141
  71. rep #$20
  72. lda.w #BrrData
  73. sta.b pointer
  74. lda.w #:BrrData
  75. sta.b pointer+2
  76. jsr uploadSpc
  77. Upend:
  78. sep #$30
  79. rep #4
  80. cli
  81. lda.b #$80
  82. sta.w $4200
  83. stz.b apulock
  84. lda.b #2
  85. sta.w $2142
  86. - bra -
  87.  
  88.  
  89. .ends
  90.  
  91. .section SPCRoutine free
  92.  
  93. ;.define pointer 0
  94. .define counter 3
  95.  
  96. uploadSpc:
  97. php
  98. rep #$30
  99. lda.w #$BBAA
  100. - cmp.w $2140
  101. bne -
  102. sep #$20
  103. lda.b #$cc
  104. sta.b counter
  105.  
  106. _uploadLoop:
  107. loadData pointer
  108. xba
  109. loadData pointer
  110. pha
  111. loadData pointer
  112. sta.w $2142
  113. loadData pointer
  114. sta.w $2143
  115. pla
  116. xba
  117. rep #$20
  118. cmp.w #$0000
  119. beq _exit
  120. tax
  121. sep #$20
  122. lda.b #1
  123. sta.w $2141
  124. lda.b counter
  125. sta.w $2140
  126. - cmp.w $2140
  127. bne -
  128. stz.b counter
  129. _writeLoop:
  130. loadData pointer
  131. sta.w $2141
  132. lda counter
  133. sta.w $2140
  134. - cmp.w $2140
  135. bne -
  136. inc counter
  137. dex
  138. bne _writeLoop
  139. NextBlock:
  140. inc counter
  141. jmp _uploadLoop
  142.  
  143. _exit:
  144. sep #$20
  145. stz.w $2141
  146. lda.b counter
  147. sta.w $2140
  148. - cmp.w $2140
  149. bne -
  150. stz.w $2140
  151. stz.w $2141
  152. stz.w $2142
  153. stz.w $2143
  154. plp
  155. rts
  156.  
  157. .ends
  158.  
  159.  
  160. .macro frmac args file
  161. .fopen file fp
  162. .fsize fp sz
  163. .dw sz-2
  164. .rept sz
  165. .fread fp d
  166. .db d
  167. .endr
  168. .fclose fp
  169. .undef sz, d
  170. .endm
  171.  
  172. .section ENG superfree
  173. EngineData:
  174. frmac "bin/smw-spc_binary.bin"
  175. frmac "bin/snd.bin"
  176. OwSeq:
  177. frmac "bin/owseq.bin"
  178. .dw $0, $500
  179.  
  180. .ends
  181.  
  182. .section BRRDATA superfree
  183. BrrData:
  184. frmac "bin/brrtab.bin"
  185. frmac "bin/brrdata.bin"
  186. .dw $0
  187. .ends
  188.  
  189. .section NullHandler
  190.  
  191. NullHandler:
  192. sep #$20
  193. lda.b #1
  194. sta.w $2143
  195. lda.b apulock
  196. bne +++
  197. lda.b $10
  198. bne +
  199. lda.b #1
  200. bra ++
  201. + lda.b #0
  202. ++ sta.w $2143
  203. sta.b $10
  204. +++ rti
  205.  
  206. .ends
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement