⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsp.asm

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 ASM
📖 第 1 页 / 共 5 页
字号:
      mov al,[DSPMem+0E6h]
      ret

NEWSYM RDSPRegE7       ;
      mov al,[DSPMem+0E7h]
      ret

NEWSYM RDSPRegE8       ;
      mov al,[DSPMem+0E8h]
      ret

NEWSYM RDSPRegE9       ;
      mov al,[DSPMem+0E9h]
      ret

NEWSYM RDSPRegEA       ;
      mov al,[DSPMem+0EAh]
      ret

NEWSYM RDSPRegEB       ;
      mov al,[DSPMem+0EBh]
      ret

NEWSYM RDSPRegEC       ;
      mov al,[DSPMem+0ECh]
      ret

NEWSYM RDSPRegED       ;
      mov al,[DSPMem+0EDh]
      ret

NEWSYM RDSPRegEE       ;
      mov al,[DSPMem+0EEh]
      ret

NEWSYM RDSPRegEF       ;
      mov al,[DSPMem+0EFh]
      ret

NEWSYM RDSPRegF0       ;
      mov al,[DSPMem+0F0h]
      ret

NEWSYM RDSPRegF1       ;
      mov al,[DSPMem+0F1h]
      ret

NEWSYM RDSPRegF2       ;
      mov al,[DSPMem+0F2h]
      ret

NEWSYM RDSPRegF3       ;
      mov al,[DSPMem+0F3h]
      ret

NEWSYM RDSPRegF4       ;
      mov al,[DSPMem+0F4h]
      ret

NEWSYM RDSPRegF5       ;
      mov al,[DSPMem+0F5h]
      ret

NEWSYM RDSPRegF6       ;
      mov al,[DSPMem+0F6h]
      ret

NEWSYM RDSPRegF7      ;
      mov al,[DSPMem+0F7h]
      ret

NEWSYM RDSPRegF8      ;
      mov al,[DSPMem+0F8h]
      ret

NEWSYM RDSPRegF9      ;
      mov al,[DSPMem+0F9h]
      ret

NEWSYM RDSPRegFA      ;
      mov al,[DSPMem+0FAh]
      ret

NEWSYM RDSPRegFB      ;
      mov al,[DSPMem+0FBh]
      ret

NEWSYM RDSPRegFC      ;
      mov al,[DSPMem+0FCh]
      ret

NEWSYM RDSPRegFD      ;
      mov al,[DSPMem+0FDh]
      ret

NEWSYM RDSPRegFE      ;
      mov al,[DSPMem+0FEh]
      ret

NEWSYM RDSPRegFF      ;
      mov al,[DSPMem+0FFh]
      ret

%macro ProcessGain 1
      push eax
      push ebx
      push edx
      test byte [DSPMem+07h+%1*10h],80h
      jz near %%Direct
      test byte [DSPMem+07h+%1*10h],40h
      jnz near %%Increase
      test byte [DSPMem+07h+%1*10h],20h
      jz near %%LinearDec
      xor eax,eax
      mov al,[DSPMem+07h+%1*10h]
      and al,1Fh
      mov ebx,[DecreaseRateExp+eax*4]
      mov dword[Voice0EnvInc+%1*4],007FFFFFh
      shr ebx,5
      mov dword[Voice0Time+%1*4],ebx
      mov [GainDecBendDataTime+%1*4],ebx
      xor edx,edx
      mov eax,127*65536
      sub eax,118*65536
      mov byte[GainDecBendDataPos+%1],0
      mov byte[GainDecBendDataDat+%1],127
      div ebx
      neg eax
      mov dword [Voice0IncNumber+%1*4],eax
      pop edx
      pop ebx
      pop eax
      mov byte [Voice0State+%1],7
      ret
%%LinearDec
      xor eax,eax
      mov al,[DSPMem+07h+%1*10h]
      and al,1Fh
      mov ebx,[Decrease+eax*4]
      mov dword[Voice0EnvInc+%1*4],007FFFFFh
      mov dword[Voice0Time+%1*4],ebx
      xor edx,edx
      mov eax,127*65536
      div ebx
      neg eax
      mov dword [Voice0IncNumber+%1*4],eax
      pop edx
      pop ebx
      pop eax
      mov byte [Voice0State+%1],5
      ret
%%Increase
      test byte [DSPMem+07h+%1*10h],20h
      jz %%LinearInc
      xor eax,eax
      mov al,[DSPMem+07h+%1*10h]
      and al,1Fh
      mov ebx,[Increase+eax*4]
      mov dword[Voice0EnvInc+%1*4],0
      mov dword[Voice0Time+%1*4],ebx
      xor edx,edx
      mov eax,127*65536
      div ebx
      mov dword [Voice0IncNumber+%1*4],eax
      mov ebx,[Voice0Time+%1*4]
      mov eax,ebx
      shr eax,2
      sub ebx,eax
      dec ebx
      mov [Voice0Time+%1*4],ebx
      pop edx
      pop ebx
      pop eax
      mov byte [Voice0State+%1],6
      ret
%%LinearInc
      xor eax,eax
      mov al,[DSPMem+07h+%1*10h]
      and al,1Fh
      mov ebx,[Increase+eax*4]
      mov dword[Voice0EnvInc+%1*4],0
      mov dword[Voice0Time+%1*4],ebx
      xor edx,edx
      mov eax,127*65536
      div ebx
      mov dword [Voice0IncNumber+%1*4],eax
      pop edx
      pop ebx
      pop eax
      mov byte [Voice0State+%1],3
      ret
%%Direct
      mov al,[DSPMem+07h+%1*10h]
      and al,7Fh
      mov dword[Voice0EnvInc+%1*4],0
      mov byte [Voice0EnvInc+%1*4+2],al
      mov dword [Voice0Time+%1*4],0FFFFFFFFh
      mov dword [Voice0IncNumber+%1*4],0
      pop edx
      pop ebx
      pop eax
      mov byte [Voice0State+%1],4
      ret
%endmacro

%macro ProcessGain2 1
      push eax
      push ebx
      push edx
      test byte [DSPMem+07h+%1*10h],80h
      jz near %%Direct
      test byte [DSPMem+07h+%1*10h],40h
      jnz near %%Increase
      test byte [DSPMem+07h+%1*10h],20h
      jz near %%LinearDec
      xor eax,eax
      mov al,[DSPMem+07h+%1*10h]
      and al,1Fh
      mov ebx,[DecreaseRateExp+eax*4]
      shr ebx,5
      mov dword[Voice0Time+%1*4],ebx
      mov [GainDecBendDataTime+%1*4],ebx
      xor edx,edx
      mov dh,118
      mov dl,[Voice0EnvInc+%1*4+2]
      xor eax,eax
      mov al,[VolumeConvTable+edx*2]
      xor edx,edx
      shl eax,16
      mov dl,[Voice0EnvInc+%1*4+2]
      neg eax
      shl edx,16
      add eax,edx
      xor edx,edx
      mov byte[GainDecBendDataPos+%1],0
      div ebx
      neg eax
      mov [Voice0IncNumber+%1*4],eax
      mov al,[Voice0EnvInc+%1*4+2]
      mov [GainDecBendDataDat+%1],al
      pop edx
      pop ebx
      pop eax
      mov byte [Voice0State+%1],7
      ret
%%LinearDec
      xor eax,eax
      mov al,[DSPMem+07h+%1*10h]
      and al,1Fh
      mov ebx,[Decrease+eax*4]
      mov dword[Voice0Time+%1*4],ebx
      xor edx,edx
      xor eax,eax
      mov al,[Voice0EnvInc+%1*4+2]
      shl eax,16
      div ebx
      neg eax
      mov dword [Voice0IncNumber+%1*4],eax
      pop edx
      pop ebx
      pop eax
      mov byte [Voice0State+%1],5
      ret
%%Increase
      test byte [DSPMem+07h+%1*10h],20h
      jz %%LinearInc
      xor eax,eax
      mov al,[DSPMem+07h+%1*10h]
      and al,1Fh
      mov ebx,[Increase+eax*4]
      mov dword[Voice0Time+%1*4],ebx
      xor edx,edx
      xor eax,eax
      mov al,[Voice0EnvInc+%1*4+2]
      inc al
      test al,80h
      jz %%noof
      mov al,127
%%noof
      xor al,127
      shl eax,16
      div ebx
      mov dword [Voice0IncNumber+%1*4],eax
      mov ebx,[Voice0Time+%1*4]
      mov eax,ebx
      shr eax,2
      sub ebx,eax
      dec ebx
      mov [Voice0Time+%1*4],ebx
      pop edx
      pop ebx
      pop eax
      mov byte [Voice0State+%1],6
      ret
%%LinearInc
      xor eax,eax
      mov al,[DSPMem+07h+%1*10h]
      and al,1Fh
      mov ebx,[Increase+eax*4]
      mov dword[Voice0Time+%1*4],ebx
      xor edx,edx
      xor eax,eax
      mov al,[Voice0EnvInc+%1*4+2]
      inc al
      test al,80h
      jz %%noof2
      mov al,127
%%noof2
      xor al,127
      shl eax,16
      div ebx
      mov dword [Voice0IncNumber+%1*4],eax
      pop edx
      pop ebx
      pop eax
      mov byte [Voice0State+%1],3
      ret
%%Direct
      mov al,[DSPMem+07h+%1*10h]
      and al,7Fh
      mov dword[Voice0EnvInc+%1*4],0
      mov byte [Voice0EnvInc+%1*4+2],al
      mov dword [Voice0Time+%1*4],0FFFFFFFFh
      mov dword [Voice0IncNumber+%1*4],0
      pop edx
      pop ebx
      pop eax
      mov byte [Voice0State+%1],4
      ret
%%end
      pop edx
      pop ebx
      pop eax
      ret
%endmacro


%macro SwitchSustain 1
      push eax
      push ebx
      push edx
      mov al,[Voice0EnvInc+%1*4+2]
      mov [GainDecBendDataDat+%1],al
      cmp byte[Voice0State+%1],8
      je %%full
      cmp byte[Voice0State+%1],2
      jae %%nofull
%%full
      mov byte[GainDecBendDataDat+%1],7Fh
%%nofull
      mov al,[DSPMem+05h+%1*10h]
      shr al,4
      and eax,07h
      mov edx,[DecayRate+eax*4]
      xor eax,eax
      mov al,[DSPMem+06h+%1*10h]
      and al,1Fh
      mov ebx,[SustainRate+eax*4]
      cmp edx,ebx
      jae near %%decayover
      ; ebx = total sustain time
      xor eax,eax
      mov al,[DSPMem+06h+%1*10h]
      shr al,5
      mov al,[AdsrSustLevLoc+eax]
      ; traverse through al entries in edx time
      ; then through 64-al entries in ebx-edx time

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -