game_sound.s 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. aud EQU $0A0
  2. aud0 EQU $0A0
  3. aud1 EQU $0B0
  4. aud2 EQU $0C0
  5. aud3 EQU $0D0
  6. ac_ptr EQU $00
  7. ac_len EQU $04
  8. ac_per EQU $06
  9. ac_vol EQU $08
  10. ac_dat EQU $0A
  11. ac_SIZEOF EQU $10
  12. Sound_HeadButt EQU 0
  13. Sound_Jump EQU 1
  14. Sound_Spangle EQU 2
  15. Sound_Coin EQU 3
  16. Sound_Effects
  17. moveq.l #0,d0
  18. move.l d0,a0
  19. move.l d0,a1
  20. move.l d0,a2
  21. move.l d0,a3
  22. btst.b #Sound_HeadButt,Sound_Flags
  23. beq.s no_head_sound
  24. move.l #HeadButt_Noise,a0
  25. no_head_sound
  26. btst.b #Sound_Jump,Sound_Flags
  27. beq.s no_jump_sound
  28. move.l #Jump_Noise,a0
  29. no_jump_sound
  30. btst.b #Sound_Spangle,Sound_Flags
  31. beq.s no_spangle_sound
  32. move.l #Spangle_Noise,a0
  33. no_spangle_sound
  34. btst.b #Sound_Coin,Sound_Flags
  35. beq.s no_coin_sound
  36. move.l #Coin_Noise,a0
  37. no_coin_sound
  38. bsr.s Play_Sounds
  39. clr.w Sound_Flags
  40. quit_sound_effects
  41. rts
  42. ********************************************
  43. * Custom Base in a6, Sound Structure in a0 *
  44. ********************************************
  45. Play_Sounds
  46. moveq.w #0,d0
  47. Channel0
  48. cmp.l #0,a0 ; channel 0
  49. beq.s Channel2
  50. bset.l #0,d0 ; set for turn off
  51. move.l Sound_Ptr(a0),aud0+ac_ptr(a6)
  52. move.w Sound_Length(a0),aud0+ac_len(a6)
  53. move.w Sound_Period(a0),aud0+ac_per(a6)
  54. move.w Sound_Volume(a0),aud0+ac_vol(a6)
  55. Channel2
  56. cmp.l #0,a2 ; channel 2
  57. beq.s Channel3
  58. bset.l #2,d0 ; set for turn off
  59. move.l Sound_Ptr(a2),aud2+ac_ptr(a6)
  60. move.w Sound_Length(a2),aud2+ac_len(a6)
  61. move.w Sound_Period(a2),aud2+ac_per(a6)
  62. move.w Sound_Volume(a2),aud2+ac_vol(a6)
  63. Channel3
  64. cmp.l #0,a3 ; channel 3
  65. beq.s Disable_Sound
  66. bset.l #3,d0 ; set for turn off
  67. move.l Sound_Ptr(a3),aud3+ac_ptr(a6)
  68. move.w Sound_Length(a3),aud3+ac_len(a6)
  69. move.w Sound_Period(a3),aud3+ac_per(a6)
  70. move.w Sound_Volume(a3),aud3+ac_vol(a6)
  71. Disable_Sound
  72. move.w d0,$96(a6) ; turn of channels
  73. move.w #1000,d7
  74. RestSND dbf d7,RestSND ; give DMA time to stop
  75. Enable_Sound
  76. bset.l #15,d0
  77. move.w d0,$96(a6) ; turn channels on
  78. move.w #1000,d7
  79. ClrSND dbf d7,ClrSND ; give DMA time to start
  80. move.l #blank,aud0+ac_ptr(a6) ; blank sound data
  81. move.l #blank,aud1+ac_ptr(a6) ; blank sound data
  82. move.l #blank,aud2+ac_ptr(a6) ; blank sound data
  83. move.l #blank,aud3+ac_ptr(a6) ; blank sound data
  84. move.w #1,aud0+ac_len(a6) ; 1 word
  85. move.w #1,aud1+ac_len(a6) ; 1 word
  86. move.w #1,aud2+ac_len(a6) ; 1 word
  87. move.w #1,aud3+ac_len(a6) ; 1 word
  88. rts
  89. Sound_Flags dc.w 0