home *** CD-ROM | disk | FTP | other *** search
/ FreeWare Collection 3 / FreeSoftwareCollection3pd199x-jp.img / oh_fm / teuchi / synth.asm next >
Assembly Source File  |  1980-01-02  |  2KB  |  171 lines

  1.     .386p
  2.  
  3. CODE    segment dword public ER use32 'CODE'
  4.     assume cs:CODE
  5.  
  6. ;    CALLM CALC&,VARPTR(PARAM&(0)),VARPTR(PCM_SND%(0)),VARPTR(PCM%(0)),VARPTR(ENV%(0)),VARPTR(SI%(0))
  7.  
  8. CALC    proc    near
  9.     mov    edi,ss:[esp+4]
  10.     mov    ds:[PARAM],edi
  11.     
  12.     mov    eax,ds:[edi+0]
  13.     mov    ds:[MAIN_P],eax
  14.     mov    eax,ds:[edi+4]
  15.     mov    ds:[VIB_P],eax
  16.     mov    eax,ds:[edi+8]
  17.     mov    ds:[VIB_V],eax
  18.     mov    eax,ds:[edi+12]
  19.     mov    ds:[TRE_P],eax
  20.     mov    eax,ds:[edi+16]
  21.     mov    ds:[TRE_V],eax
  22.     
  23.     mov    edi,ss:[esp+8]
  24.     add    edi,32
  25.     
  26.     mov    esi,ss:[esp+12]
  27.     mov    ds:[PCM],esi
  28.     
  29.     mov    esi,ss:[esp+16]
  30.     mov    ds:[ENV],esi
  31.     
  32.     mov    esi,ss:[esp+20]
  33.     mov    ds:[SIN],esi
  34.     
  35.     mov    ecx,64*1024
  36.  
  37.  
  38. #loop1:
  39.     mov    ebx,ds:[TRE_AD]
  40.     xor    eax,eax
  41.     shld    eax,ebx,8
  42.     mov    ebx,ds:[SIN]
  43.     mov    ax,ds:[ebx+eax*2]
  44.     movzx    eax,ax
  45.     mov    ebx,ds:[TRE_V]
  46.     mul    ebx
  47.     shl    eax,2
  48.     mov    edx,eax
  49.     
  50.     mov    ebx,ds:[PCM_AD]
  51.     add    ebx,edx
  52.     xor    eax,eax
  53.     shld    eax,ebx,8
  54.     mov    ebx,ds:[PCM]
  55.     mov    ax,ds:[ebx+eax*2]
  56.     movsx    eax,ax
  57.     push    eax
  58.     
  59.     mov    edx,64*1024
  60.     sub    edx,ecx
  61.     shr    edx,8
  62.     mov    ebx,ds:[ENV]
  63.     mov    dx,ds:[ebx+edx*2]
  64.     movsx    edx,dx
  65.     push    edx
  66.     
  67.     mov    ebx,ds:[VIB_AD]
  68.     xor    eax,eax
  69.     shld    eax,ebx,8
  70.     mov    ebx,ds:[SIN]
  71.     mov    ax,ds:[ebx+eax*2]
  72.     movzx    eax,ax
  73.     mul    edx
  74.     shrd    eax,edx,14
  75.     mov    ebx,ds:[VIB_V]
  76.     mul    ebx
  77.     shrd    eax,edx,16
  78.     mov    esi,eax
  79.     mov    eax,10000h
  80.     sub    eax,ebx
  81.     pop    edx
  82.     mul    edx
  83.     shrd    eax,edx,16
  84.     add    eax,esi
  85.     
  86.     pop    edx
  87.     
  88.     imul    edx
  89.     sar    eax,7
  90.     
  91.     call    PUTPCM
  92.     
  93.     inc    edi
  94.     
  95.     mov    eax,ds:[MAIN_P]
  96.     add    eax,ds:[PCM_AD]
  97.     mov    ds:[PCM_AD],eax
  98.     
  99.     mov    eax,ds:[VIB_P]
  100.     add    eax,ds:[VIB_AD]
  101.     mov    ds:[VIB_AD],eax
  102.     
  103.     mov    eax,ds:[TRE_P]
  104.     add    eax,ds:[TRE_AD]
  105.     mov    ds:[TRE_AD],eax
  106.     
  107.     dec    ecx
  108.     jne    #loop1
  109.  
  110.  
  111.  
  112. #exit:
  113.     ret
  114.  
  115. CALC    endp
  116.  
  117.  
  118. PUTPCM    proc    near    ;input    edi,eax
  119.     cmp    eax,0
  120.     jge    #plus
  121. #minus:
  122.     cmp    eax,-128
  123.     jg    #minus1
  124.     mov    eax,-127
  125. #minus1:
  126.     neg    eax
  127.     mov    ds:[edi],al
  128.     ret
  129.     
  130. #plus:
  131.     cmp    eax,127
  132.     jb    #plus1
  133.     mov    eax,126
  134. #plus1:
  135.     or    al,80h
  136.     mov    ds:[edi],al
  137.     ret
  138. PUTPCM    endp
  139.  
  140. CODE    ends
  141.  
  142. DATA    segment dword public ER use32 'DATA'
  143.     assume ds:DATA
  144.  
  145. PARAM    dd    0
  146. MAIN_P    dd    0
  147. TRE_P    dd    0
  148. TRE_V    dd    0
  149. VIB_P    dd    0
  150. VIB_V    dd    0
  151.  
  152. PCM    dd    0
  153. ENV    dd    0
  154. SIN    dd    0
  155.  
  156. PCM_AD    dd    0
  157. TRE_AD    dd    0
  158. VIB_AD    dd    0
  159.  
  160. DATA    ends
  161.  
  162. STACK    segment STACK
  163.     assume ss:STACK
  164.  
  165.     db    64 dup(?)
  166.  
  167. STACK    ends
  168.  
  169.     end
  170.  
  171.