Advertisement
owa-owa

3月頃の活動録

Sep 25th, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. /**
  2. * SuperC I/O port process
  3. *
  4. *
  5. */
  6.  
  7. .incdir "./include/"
  8. .include "./spc.inc"
  9. .include "./var.inc"
  10.  
  11. .macro waitSnes
  12. mov SPC_PORT0,a
  13. - cmp a,SPC_PORT0
  14. bne -
  15. .endm
  16.  
  17.  
  18. .section "__io__" free
  19. ;--------------------------------------------------
  20. ; IOProc - SPC I/O PORT PROCESS
  21. ; Level : 0 (Clock Level)
  22. ; Input : none
  23. ; Output : none
  24. ; Description : SPCポートの内容を読み取り、
  25. ; 各種処理を起動する
  26. ;--------------------------------------------------
  27. _resetSpc:
  28. mov SPC_CONTROL,#(CNT_IPL|CNT_PC32|CNT_PC10)
  29. jmp $ffc0
  30. _return:
  31. ret
  32. ; ***** Entry point *****
  33. IOProc:
  34. mov a,SPC_PORT0 ; Port0読み出し
  35. beq _return ; Port0が空なのでNOP
  36. + cmp a,#$ff ; > is port0 = 255 ?
  37. beq _resetSpc ; Port0が255なのでSPCシステムリセット起動
  38. cmp a,9 ; コマンド範囲チェック
  39. bcs _return ; 範囲外コマンドはNOP
  40.  
  41. call _cmdJump ; コマンドジャンプルーチン起動
  42.  
  43. ; ***** コマンド実行後の共通処理 *****
  44. mov SPC_CONTROL, #( CNT_PC10 | CNT_PC32 ) ; SPCポートリセット
  45. ret
  46.  
  47. _cmdJump:
  48. asl a
  49. mov x,a ; Xレジスタにテーブルインデクス格納
  50. ; ***** I/Oコマンド *****
  51. jmp [!_jmpTable-2+x] ; I/O コマンド ジャンプ
  52.  
  53. _jmpTable:
  54. .dw transMusic ; 01h ... 音楽転送
  55. .dw SE ; 02h ... 効果音処理
  56. .dw setMasterVolume ; 03h ... マスター音量調整
  57. .dw setMusicVolume ; 04h ... 音楽音量調整
  58. .dw setSoundVolume ; 05h ... 効果音音量調整
  59. .dw NULL ; 06h ...
  60. .dw NULL ; 07h ...
  61. .dw NULL ; 08h ...
  62. .ends
  63.  
  64.  
  65. .section "trans" free
  66. .define syncCounter $00
  67. .define distAddr $01
  68. .define brrIndex $03
  69.  
  70. transMusic:
  71. waitSnes
  72. ret
  73.  
  74.  
  75. .undef syncCounter, distAddr, brrIndex
  76. .ends
  77.  
  78.  
  79.  
  80. .section "stub" free
  81. SE:
  82. setMasterVolume:
  83. setMusicVolume:
  84. setSoundVolume:
  85. ret
  86. .ends
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement