home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FreeWare Collection 3
/
FreeSoftwareCollection3pd199x-jp.img
/
oh_fm
/
teuchi
/
synth.asm
next >
Wrap
Assembly Source File
|
1980-01-02
|
2KB
|
171 lines
.386p
CODE segment dword public ER use32 'CODE'
assume cs:CODE
; CALLM CALC&,VARPTR(PARAM&(0)),VARPTR(PCM_SND%(0)),VARPTR(PCM%(0)),VARPTR(ENV%(0)),VARPTR(SI%(0))
CALC proc near
mov edi,ss:[esp+4]
mov ds:[PARAM],edi
mov eax,ds:[edi+0]
mov ds:[MAIN_P],eax
mov eax,ds:[edi+4]
mov ds:[VIB_P],eax
mov eax,ds:[edi+8]
mov ds:[VIB_V],eax
mov eax,ds:[edi+12]
mov ds:[TRE_P],eax
mov eax,ds:[edi+16]
mov ds:[TRE_V],eax
mov edi,ss:[esp+8]
add edi,32
mov esi,ss:[esp+12]
mov ds:[PCM],esi
mov esi,ss:[esp+16]
mov ds:[ENV],esi
mov esi,ss:[esp+20]
mov ds:[SIN],esi
mov ecx,64*1024
#loop1:
mov ebx,ds:[TRE_AD]
xor eax,eax
shld eax,ebx,8
mov ebx,ds:[SIN]
mov ax,ds:[ebx+eax*2]
movzx eax,ax
mov ebx,ds:[TRE_V]
mul ebx
shl eax,2
mov edx,eax
mov ebx,ds:[PCM_AD]
add ebx,edx
xor eax,eax
shld eax,ebx,8
mov ebx,ds:[PCM]
mov ax,ds:[ebx+eax*2]
movsx eax,ax
push eax
mov edx,64*1024
sub edx,ecx
shr edx,8
mov ebx,ds:[ENV]
mov dx,ds:[ebx+edx*2]
movsx edx,dx
push edx
mov ebx,ds:[VIB_AD]
xor eax,eax
shld eax,ebx,8
mov ebx,ds:[SIN]
mov ax,ds:[ebx+eax*2]
movzx eax,ax
mul edx
shrd eax,edx,14
mov ebx,ds:[VIB_V]
mul ebx
shrd eax,edx,16
mov esi,eax
mov eax,10000h
sub eax,ebx
pop edx
mul edx
shrd eax,edx,16
add eax,esi
pop edx
imul edx
sar eax,7
call PUTPCM
inc edi
mov eax,ds:[MAIN_P]
add eax,ds:[PCM_AD]
mov ds:[PCM_AD],eax
mov eax,ds:[VIB_P]
add eax,ds:[VIB_AD]
mov ds:[VIB_AD],eax
mov eax,ds:[TRE_P]
add eax,ds:[TRE_AD]
mov ds:[TRE_AD],eax
dec ecx
jne #loop1
#exit:
ret
CALC endp
PUTPCM proc near ;input edi,eax
cmp eax,0
jge #plus
#minus:
cmp eax,-128
jg #minus1
mov eax,-127
#minus1:
neg eax
mov ds:[edi],al
ret
#plus:
cmp eax,127
jb #plus1
mov eax,126
#plus1:
or al,80h
mov ds:[edi],al
ret
PUTPCM endp
CODE ends
DATA segment dword public ER use32 'DATA'
assume ds:DATA
PARAM dd 0
MAIN_P dd 0
TRE_P dd 0
TRE_V dd 0
VIB_P dd 0
VIB_V dd 0
PCM dd 0
ENV dd 0
SIN dd 0
PCM_AD dd 0
TRE_AD dd 0
VIB_AD dd 0
DATA ends
STACK segment STACK
assume ss:STACK
db 64 dup(?)
STACK ends
end