SOUND.SRC 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. ************************************************************************
  2. * *
  3. * [[[ NOP ]]] SOUND INTERFACE *
  4. * *
  5. ************************************************************************
  6. XDEF INIT_SOUND,SOUND_SEND,SET_SOUND
  7. XDEF SET_BGM,SET_SPHERO
  8. XDEF SOUND_CODE_TBL
  9. XDEF SET_SOUND_DIRECT
  10. SECT.S SYS,,C
  11. INCLUDE NEO_GEO.INC
  12. INCLUDE LABEL.INC
  13. INCLUDE MACRO.INC
  14. INIT_SOUND:
  15. ; sound work initialize
  16. MOVEQ.L #0,D0
  17. MOVE.B D0,SD_IN_POINT(A5)
  18. MOVE.B D0,SD_OUT_POINT(A5)
  19. MOVE.W D0,BGM_CODE(A5) no keep BGM
  20. SOUND #2
  21. SOUND #2 send wait
  22. SOUND #2
  23. RTS
  24. SOUND_SEND:
  25. ; outer sound code send from sound buffer to sound I/O
  26. ; 0 = skip code
  27. ; 1 = 1 time wait
  28. ; 2-FF send sound
  29. MOVEQ.L #0,D0
  30. LEA.L SOUND_BUFFER(A5),A0
  31. SOUND_SEND_1:
  32. MOVE.B SD_OUT_POINT(A5),D0
  33. CMP.B SD_IN_POINT(A5),D0
  34. BEQ.S SOUND_SEND_2
  35. ADDQ.B #1,SD_OUT_POINT(A5)
  36. MOVE.B 0(A0,D0.W),D0
  37. BEQ.S SOUND_SEND_1 skip code
  38. CMP.B #1,D0 wait code
  39. BEQ.S SOUND_SEND_2 no send
  40. MOVE.B D0,SOUND
  41. SOUND_SEND_2:
  42. RTS
  43. SET_BGM:
  44. ; BGM code set with ignore send same code
  45. ; in) D0(.W) BGM inner code
  46. ; all register keep
  47. CMP.W BGM_CODE(A5),D0
  48. BEQ.S SET_BGM_1 ignore same code
  49. MOVE.W D0,BGM_CODE(A5)
  50. JSR SET_SOUND(PC)
  51. SET_BGM_1:
  52. RTS
  53. SET_SPHERO:
  54. ; sphero code set.(judgement by REL_X of master work)
  55. ; in) D0(.W) sphero left inner sound code
  56. ; A0 master work
  57. ; broked) D0
  58. CMP.W #320/3,REL_X(A0)
  59. BCS.S SET_SOUND right area
  60. ADDQ.W #2,D0
  61. CMP.W #(320*2)/3,REL_X(A0)
  62. BCS.S SET_SOUND centor area
  63. ADDQ.W #2,D0 left area
  64. SET_SOUND:
  65. ; sound code set to sound buffer
  66. ; in) D0(.W) inner sound code (*2)
  67. ; all register keep
  68. MOVE.W SOUND_CODE_TBL(PC,D0.W),SOUND_CODE_W(A5)
  69. SET_SOUND_DIRECT:
  70. MOVE.L A0,-(SP)
  71. LEA.L SOUND_BUFFER(A5),A0
  72. MOVEQ.L #0,D0
  73. MOVE.B SD_IN_POINT(A5),D0
  74. MOVE.W SOUND_CODE_W(A5),0(A0,D0.W)
  75. ADDQ.B #2,SD_IN_POINT(A5)
  76. MOVE.L (SP)+,A0
  77. RTS
  78. SCN SET 0
  79. SCODE MACRO CODE,NAME
  80. S_\2 SET SCN
  81. DC.W CODE
  82. SCN SET SCN+2
  83. ENDM
  84. SOUND_CODE_TBL:
  85. INCLUDE SCODE.INC
  86. INCLUDE WORK.INC
  87.