《滑动平均滤波程序》由会员分享,可在线阅读,更多相关《滑动平均滤波程序(5页珍藏版)》请在金锄头文库上搜索。
1、DATAS SEGMENTSEGMENTbuffer dbdb 20 dupdup(?)innum dbdb 20 dupdup(?)indata dbdb 20 dupdup(?)outdata dbdb 20 dupdup(?)outnum dbdb 20 dupdup(?)input_message dbdb Please input 20 numbers:,0dh,0ah,$screen_long dbdb please input screen_long:,0dh,0ah,$ DATAS ENDSENDSCODES SEGMENTSEGMENTASSUMEASSUME CS:CODE
2、S,DS:DATAS STARTSTART:MOV AX,DATASMOV DS,AXcall inputmov ah,2hmov dl,0dhint 21hmov dl,0ahint 21hjmp circlea0:mov ah,01hint 21hcmp al,qJZ OVERCMP AL,QJZ OVERcmp al,ajz STARTSTARTcall inout1 circle: call asc_to_decmov dx,offset screen_longmov ah,09hint 21hcall shift_averagecall dec_to_asccall outputjm
3、p a0 OVER: mov ah,4chint 21hinput procproc nearmov dx,offset input_messagemov ah,09hint 21hmov si,0mov cx,20 a1: mov ah,01hint 21h mov innum+si,al inc siloop a1retinput endpendpinout1 procproc nearmov cx,20mov si,0hmov di,0h a2:mov bl,innum+simov buffer+di,blinc siinc diloop a2mov cx,19mov si,00hmov
4、 di,01h a3:mov bl,buffer+simov innum+di,blinc siinc diloop a3mov innum,almov ah,02hmov dl,0dhint 21hmov dl,0ahint 21hmov si,0hmov cx,20 a4:mov dl,innum+simov ah,2h int 21hinc siloop a4mov dl,0dhint 21hmov dl,0ahint 21hret inout1 endpendpoutput procproc nearmov si,0hmov cx,20 a5:mov dl,outnum+simov a
5、h,2hint 21hinc siloop a5 mov dl,0dhint 21hmov dl,0ahint 21hret output endpendpasc_to_dec procproc nearmov si,0hmov di,0hxor ax,axmov cx,20 a6:mov al,innum+sisub al,30hmov indata+di,alinc siinc diloop a6ret asc_to_dec endpendpshift_average procproc nearmov ah,01hint 21hsub al,30hxor dx,dxmov dl,almov
6、 di,00hxor bx,bxmov cx,21sub cx,dxmov dh,dl a10: xor ax,axmov si,di a7: mov bl,indata+siadd ax,bxdec dlinc sicmp dl,0jnz a7div dhmov outdata+di,alinc dimov dl,dhloop a10sub dh,1xor cx,cxmov cl,dh a9:mov si,dimov bl,indata+simov outdata+di,blinc siinc diloop a9mov ah,02hmov dl,0dhint 21hmov dl,0ahint 21hret shift_average endpendpdec_to_asc procproc nearmov si,0hmov di,0hmov cx,20 a8:xor ax,axmov al,outdata+siadd al,30hmov outnum+di,alinc siinc diloop a8ret dec_to_asc endpendpCODES ENDSENDSENDEND STARTSTART