Guest User

pkms.asm

a guest
Aug 13th, 2016
147
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; EQUs
  2.  
  3. MUSIC EQU 0
  4. SFX EQU 4
  5.  
  6. CH1 EQU 0
  7. CH2 EQU 1
  8. CH3 EQU 2
  9. CH4 EQU 3
  10.  
  11. ; notes
  12. ntRst EQU $00
  13. ntC EQU $10
  14. ntC# EQU $20
  15. ntD EQU $30
  16. ntD# EQU $40
  17. ntE EQU $50
  18. ntF EQU $60
  19. ntF# EQU $70
  20. ntG EQU $80
  21. ntG# EQU $90
  22. ntA EQU $a0
  23. ntA# EQU $b0
  24. ntB EQU $c0
  25.  
  26. ; special drum EQUs
  27. dNote EQU $b0
  28. dRst EQU $c0
  29. d2Spd EQU $d0
  30. d5d3Spd EQU $d4
  31. d4d3Spd EQU $d8
  32. dNormSpd EQU $dc
  33.  
  34. ; octaves
  35. oct0 EQU $d7
  36. oct1 EQU $d6
  37. oct2 EQU $d5
  38. oct3 EQU $d4
  39. oct4 EQU $d3
  40. oct5 EQU $d2
  41. oct6 EQU $d1
  42. oct7 EQU $d0
  43.  
  44. ; header stuff
  45. pkmsHeader: macro
  46. db ((\1 - 1) * $40) | (\2 + \3)
  47. endm
  48.  
  49. pkmsChannel: macro
  50. dw \1
  51. if \2 != 0
  52. db \2
  53. endc
  54. endm
  55.  
  56. ; coordination flags
  57.  
  58. ; set velocity/note fade (\1 is velocity, \2 is note length, both 0-15)
  59. ; format: pkmsSetVel vel, length
  60. pkmsSetVel: macro
  61. db $dc
  62. db ((\1 << 4) | \2)
  63. endm
  64. ; set velocity/note rate (\1 is velocity, \2 is note length, both 0-15)
  65. ; format: pkmsSetNtr speed, vel, length
  66. pkmsSetNtr: macro
  67. db $d8
  68. db \1
  69. db ((\2 << 4) | \3)
  70. endm
  71. ; set drum speed(\1 is velocity)
  72. ; format: pkmsSetDSpeed speed
  73. pkmsSetDSpeed: macro
  74. db $d8
  75. db \1
  76. endm
  77. ; stop sound
  78. ; format: pkmsEndSound
  79. pkmsEndSound: macro
  80. db $ff
  81. endm
  82.  
  83. ; set modulation (\1 is delay, \2 is depth, \3 is rate)
  84. ; format: pkmsSetMod delay, depth, rate
  85. pkmsSetMod: macro
  86. db $e1
  87. db \1
  88. db ((\2 << 4) | \3)
  89. endm
  90.  
  91. ; set duty cycle (\1: 0 = 12.5%, 1 = 25%, 2 = 50%, 3 = 75%)
  92. ; format: pkmsSetDuty duty
  93. pkmsSetDuty: macro
  94. db $db
  95. db \1
  96. endm
  97.  
  98. ; set Drumset
  99. ; format: pkmsSetDrums drums
  100. pkmsSetDrums: macro
  101. db $e3
  102. db \1
  103. endm
  104.  
  105. pkmsSetArp: macro
  106. db $de
  107. db \1
  108. ;((\1 << 6) | (\2 << 4) | (\3 << 2) | \4)
  109. endm
  110.  
  111. ; set music tempo (\1 is divider, \2 is modifier)
  112. ; format: pkmsSetTempo divider, modifier
  113. pkmsSetTempo: macro
  114. db $da
  115. db \1
  116. db \2
  117. endm
  118.  
  119. ; set volume (\1 is volume)
  120. ; format: pkmsSetVolume volume
  121. ; (may actually be panning?)
  122. pkmsSetVolume: macro
  123. db $e5
  124. db \1
  125. endm
  126.  
  127. ; call offset \1
  128. ; format: pkmsCall offset
  129. pkmsCall: macro
  130. db $fe
  131. dw ((\1 % $4000) + ((\1 >= $4000) * $4000))
  132. endm
  133.  
  134. ; jump to offset \1
  135. ; format: pkmsJump offset
  136. pkmsJump: macro
  137. db $fd
  138. db $00
  139. dw ((\1 % $4000) + ((\1 >= $4000) * $4000))
  140. endm
RAW Paste Data