home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Aktief 1995 #3 / CDA3.iso / sound / tnypl211.zip / MODPL16.ASM < prev    next >
Assembly Source File  |  1994-06-21  |  63KB  |  2,116 lines

  1. ;▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  2. ;           16-bit Tiny MOD Player for Borland C++ 3.1 C compiler
  3. ;                      Version 2.11a  June 15th, 1994
  4. ;
  5. ;                      Copyright 1993,94 Carlos Hasan
  6. ;▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  7.  
  8. ideal
  9. model   large,c
  10. p386
  11. smart
  12.  
  13. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  14. ; EQUATES AND PUBLICS
  15. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  16.  
  17. MAXVOICES = 8                           ; number of voices
  18. DMABUFLEN = 1024                        ; DMA buffer length (multiple of 64)
  19. VOLBUFLEN = 66*256                      ; volume table length
  20. MIXBUFLEN = DMABUFLEN+2048              ; mixing/boosting buffer length
  21. TIMERRATE = 17000                       ; timer interrupt rate in ticks
  22.  
  23. global  MODPlayModule:proc
  24. global  MODStopModule:proc
  25. global  MODPlaySample:proc
  26. global  MODStopSample:proc
  27. global  MODSetPeriod:proc
  28. global  MODSetVolume:proc
  29. global  MODSetMusicVolume:proc
  30. global  MODSetSampleVolume:proc
  31. global  MODDetectCard:proc
  32. global  MODPoll:proc
  33.  
  34. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  35. ; STRUCTURES
  36. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  37.  
  38. struc   module                          ; module structure
  39.   numtracks     dw      ?               ; number of tracks
  40.   orderlen      dw      ?               ; order length
  41.   orders        db      128 dup (?)     ; order list
  42.   patterns      dd      128 dup (?)     ; pattern addresses
  43.   sampptr       dd      32 dup (?)      ; sample start addresses
  44.   sampend       dd      32 dup (?)      ; sample end addresses
  45.   samploop      dd      32 dup (?)      ; sample loop point addresses
  46.   sampvolume    db      32 dup (?)      ; sample default volumes
  47. ends    module
  48.  
  49. struc   sample                          ; sample structure
  50.   period        dw      ?               ; default period
  51.   volume        dw      ?               ; default volume
  52.   datalen       dd      ?               ; sample data length
  53.   dataptr       dd      ?               ; sample data address
  54. ends    sample
  55.  
  56. struc   track                           ; track structure
  57.   note          dw      ?               ; note index
  58.   period        dw      ?               ; period value
  59.   inst          db      ?               ; instrument
  60.   volume        db      ?               ; volume
  61.   effect        dw      ?               ; effect
  62.   destperiod    dw      ?               ; toneporta wanted period
  63.   tonespeed     db      ?               ; toneporta speed
  64.   vibparm       db      ?               ; vibrato depth/rate
  65.   vibpos        db      ?               ; vibrato wave position
  66.   tremparm      db      ?               ; tremolo depth/rate
  67.   trempos       db      ?               ; tremolo wave position
  68.                 db      ?               ; alignment
  69.   arptable      dw      3 dup (?)       ; arpeggio periods
  70. ends    track
  71.  
  72. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  73. ; DATA
  74. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  75.  
  76. ;░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
  77. ; Module Player data
  78. ;░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
  79. udataseg
  80.  
  81. moduleptr       dd      ?               ; current module address
  82. pattptr         dd      ?               ; current playing pattern address
  83. orderpos        db      ?               ; order position
  84. orderlen        db      ?               ; order length
  85. pattrow         db      ?               ; pattern row
  86. tempo           db      ?               ; tempo
  87. tempocount      db      ?               ; tempo counter
  88. bpm             db      ?               ; beats per minute
  89. musicvolume     db      ?               ; music channels volume
  90. samplevolume    db      ?               ; sample channels volume
  91. numtracks       dw      ?               ; number of tracks
  92. tracks          track   MAXVOICES dup (?)
  93.  
  94. pitchtable      dd      3425 dup (?)    ; period to pitch table
  95.  
  96. ; Amiga period table
  97. dataseg
  98.  
  99. periodtable     dw      0
  100.                 dw      3424,3232,3048,2880,2712,2560,2416,2280,2152,2032,1920,1812
  101.                 dw      1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,906
  102.                 dw      856,808,762,720,678,640,604,570,538,508,480,453
  103.                 dw      428,404,381,360,339,320,302,285,269,254,240,226
  104.                 dw      214,202,190,180,170,160,151,143,135,127,120,113
  105.                 dw      107,101,95,90,85,80,75,71,67,63,60,56
  106.                 dw      53,50,47,45,42,40,37,35,33,31,30,28
  107.  
  108. ; Sinus wave table
  109.  
  110. sintable        db      0,25,50,74,98,120,142,162,180,197,212,225
  111.                 db      236,244,250,254,255,254,250,244,236,225
  112.                 db      212,197,180,162,142,120,98,74,50,25
  113.  
  114. ;░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
  115. ; Sound Blaster driver data
  116. ;░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
  117. udataseg
  118.  
  119. ; Voices programmable parameters
  120.  
  121. voicepos        dd      MAXVOICES dup (?)
  122. voiceend        dd      MAXVOICES dup (?)
  123. voiceloop       dd      MAXVOICES dup (?)
  124. voicefrac       dd      MAXVOICES dup (?)
  125. voicepitch      dd      MAXVOICES dup (?)
  126. voicevolume     dd      MAXVOICES dup (?)
  127.  
  128. ; Internal driver data
  129. dataseg
  130.  
  131. mixbuffer       dw      ?               ; mixing buffer address
  132. boosttable      dw      ?               ; boosting table address
  133. voltable        dw      ?               ; volume table address
  134. numvoices       dw      ?               ; number of active voices
  135. mixfreq         dw      ?               ; playback frequency
  136. ioaddr          dw      ?               ; card I/O port address
  137. irqnum          db      ?               ; card IRQ level
  138. drqnum          db      ?               ; card DMA channel
  139. timerproc       dw      ?               ; timer callback address
  140. timeracc        dw      ?               ; timer callback accumulator
  141. timerspeed      dw      ?               ; timer callback speed
  142. bufsel          dw      ?               ; DOS memory block selector
  143. bufptr          dw      ?               ; DMA buffer address
  144. bufoff          dw      ?               ; double buffer offset
  145. oldirqoff       dw      ?               ; old IRQ vector address
  146. oldirqsel       dw      ?
  147. oldtimeroff     dw      ?               ; old timer IRQ0 vector address
  148. oldtimersel     dw      ?
  149. oldtimeracc     dw      ?               ; old timer accumulator
  150. manualmode      db      ?               ; timer/manual polling mode
  151. playing         db      0               ; playing/stopped status
  152.  
  153. ufardata fardataseg
  154.         db      DMABUFLEN+VOLBUFLEN+MIXBUFLEN+15 dup (?)
  155.  
  156. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  157. ; CODE
  158. ;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  159. codeseg
  160.  
  161. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  162. ; Copyright Strings
  163. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  164.  
  165. db      '16-bit Tiny MOD Player V2.11 Copyright 1993,94 Carlos Hasan',0
  166. db      'Compiled on: ',??date,' ',??time,0
  167.  
  168. ;░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
  169. ; Module Player stuff
  170. ;░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒
  171.  
  172. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  173. ; MODPlayModule - start playing a music module
  174. ; In:
  175. ;  Song  = module address
  176. ;  Chans = number of channels
  177. ;  Rate  = playback rate
  178. ;  Port  = port address
  179. ;  irq   = irq number
  180. ;  dma   = dma channel
  181. ;  mode  = polling mode
  182. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  183. proc    MODPlayModule Song:dword,Chans:byte,Rate:word,Port:word,IRQ:byte,DRQ:byte,Mode:byte
  184.         pushad
  185.         push    es
  186.  
  187. ; setup the music module address