24個匯編實例小程序_第1頁
24個匯編實例小程序_第2頁
24個匯編實例小程序_第3頁
24個匯編實例小程序_第4頁
24個匯編實例小程序_第5頁
已閱讀5頁,還剩53頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

1、24個匯編小程序題目列表:逆序輸出字符串“ BASED ADDRESSING ”從鍵盤上輸入兩個數(shù),分別放到x, y單元,求出它們的和是編寫一段程序,要求在長度為10h的數(shù)組中,找出大于42h的無符號數(shù)的個數(shù)并存入地址為up開始區(qū)域,找出小于 42h的無符號數(shù)的個數(shù)并存入地址為down的開始區(qū)域鍵盤輸入一段字符串,其中小寫字母以大寫字母輸出,其他字符不變輸出從鍵盤上就收一個小寫字母,找出它的前導字符和后續(xù)字符,在順序顯示這三個字符把一個包含20個數(shù)據(jù)的數(shù)組 M分成兩組:正整數(shù)組P和負整數(shù)組N,分別把這兩個數(shù)組中 的數(shù)據(jù)的個數(shù)顯示出來求出首地址為data的100個字數(shù)組中的最小偶數(shù),并把它放在a

2、x中輸入兩船字符串string1和string2,并比較兩個字符串是否相等,相等就顯示"match”,否貝U顯示"no match”從鍵盤接收一個四位的十六進制數(shù),并在終端顯示與它等值的二進制數(shù)從鍵盤輸入一系列以$為結束符的字符串,然后對其中的非數(shù)字字符計數(shù),并顯示計數(shù)結果有一個首地址為 mem的100個字的數(shù)組,試編程序刪除數(shù)組中所有為零的項,并將后續(xù)項向前壓縮,最后將數(shù)組的剩余部分補上零從鍵盤上輸入一串字符(用回車鍵結束,使用10號功能調(diào)用)放在 string中,是編制一個程序測試字符串中是否存在數(shù)字。如有,則把cl的第五位置1,否則將該位置置 0在首地址為data的字

3、數(shù)組中,存放了 100h的16位字數(shù)據(jù),試編寫一個程序,求出平均值放在ax寄存器中,并求出數(shù)組中有多少個數(shù)小于此平均值,將結果放在bx寄存器中(f分別考慮有符號數(shù)、無符號數(shù)情況 )一直數(shù)組A包含15個互不相等的整數(shù),數(shù)組 B包含20個互不相等的整數(shù)。試編制一個程序,把既在 A中又在B中出現(xiàn)的整數(shù)存放于數(shù)組C中設在A、B和D單元中分別存放著三個數(shù)。若三個數(shù)都不是0,則求出三個數(shù)的和并存放在S單元,若其中有一個數(shù)為0,則把其它兩個單元也清零。請編寫此程序從鍵盤輸入一系列字符(以回車鍵結束),并按字母、數(shù)字和其他字符分類計數(shù),最后顯示這三類的計數(shù)結果已定義兩個整數(shù)變量 A和B,試編寫程序完成以下功能

4、(1) 若兩個樹種有一個是奇數(shù),則將奇數(shù)存入A中,偶數(shù)存入B中(2)若兩個數(shù)均為奇數(shù),則將兩個數(shù)加 1后存回原變量(3)若兩個數(shù)均為偶數(shù),則兩個變量均不變寫一段子程序skiplines,完成輸出空行的功能。空行的行數(shù)由用戶在主程序中通過鍵盤輸入, 并將行數(shù)放在ax寄存器中設有10個學生成績分別是 76, 69,84, 73, 88, 99, 63,100和80。試編寫一個子程序統(tǒng) 計60-69分,70-79分,80-89分,90-99分和100分的人數(shù),并分別放到S6,S7,S8,S9,S10單元中編寫子程序嵌套結構的程序,把整數(shù)分別用二進制和八進制顯示出來在D盤根目錄建立一個文件abc.tx

5、t,第一次向文件寫入“ 123456”六個字符,第二次增加“ abcdefg ”幾個字符從鍵盤上輸入文本文件:“d:temp.txt ”的內(nèi)容后,然后新建一個文件“d:temp2.txt ”,把前一個文件的所有內(nèi)容復制到后一個文件中從鍵盤上輸入一個十進制數(shù),以十六進制數(shù)顯示出來。要求子程序用寄存器參數(shù)傳送方法試編制一個程序,把bx寄存器中的二進制數(shù)用十六進制數(shù)的形式在屏幕上顯示出來代碼:1逆序輸出字符串“ BASED ADDRESSINGs1tops1segme nt stack dw100label word;定義棧段s1dup;定義棧空間為100;top指向棧頂s2S2s3en dsseg

6、me ntdben ds;定義數(shù)據(jù)段s2'BASED ADDRESSING',*;定義字符串 ssegment;定義代碼段 s3assume cs:s3,ds:s2,ss:s1mai nproc mov mov leafarax,s1ss,axsp,top;棧初始化棧初始化movax,s2;數(shù)據(jù)段初始化一一movds,ax;數(shù)據(jù)段初始化movsi,151:movdl,ssi;dl獲取字符串s的最后一個(從零開始的第十movah,2;調(diào)用int 21h 2號功能輸出dl上的值int21hdecsi;寄存器減一,準備獲取卜一個字符cmpsi,0jalmovah,4ch;終止int2

7、1hmai nen dps3en dsendmai n2從鍵盤上輸入兩個數(shù),分別放到x,y單元,求出它們的和sisegme nt stackdw100hduptoplabel wordsien dss2segme nthidb'Please in put x:','$'提示輸入h2db'Please in put y:','$'提示輸入h3db'z=x+y:','$'提示輸出crlfdb0dh,0ah,24h;定義回車換行xdw?ydw?s2en dss3segme ntassumecs:s3,ds

8、:s2,ss:s3mai nprocfar;初始化ax,s1mov卜五個字符)mov leamovss,axsp,topax,s2movds,ax;初始化leadx,h1;int 21h 9號功能輸出“提示輸入x”的字符串movah,9int21hxorbx,bx;bx清零,即把bx置零ah,1;輸入一個字符int21hcmpal,0dh;判斷時候為“回車”字符jzexit1;如果是回車字符就跳轉到exit1cmpal,30h和30h (即字符0的asii值)比較jlexit1;如果輸入字符小于'0',跳轉到exit1cmpal,39h和39h(即字符9的ascii值)比較jg

9、exit1;如果輸入字符大于 9,跳轉到exit1subal,30h;al減去30h,輸入字符轉化成數(shù)字(從這一行開始到后面的為輸入字符轉化為數(shù)字的處理方法)cbw;al擴充為axxchgax,bxmovcx,10mulcxxchgax,bxaddbx,ax;sub al,30h開始到這一行為輸入字符轉化為數(shù)字的處理方jmpIn putX;把輸入的存于bx的放到x中add bx,axIn putX:movx,bxmovexitl:leadx,crlfmovah,9int21hleadx,h2movah,9int21hIn putY:movah,1int21hcmpal,0dhjzexit2cm

10、pal,30hjlexit2;和InputX類似,輸入yxorbx,bxcmpal,39hjgexit2subal,30hcbwxchgax,bxmovcx,10mulcxxchgax,bxaddbx,axjmpIn putYexit2: movy,bx;把輸入的存于bx的放到y(tǒng)中mov bx,xaddbx,y;此時bx為兩數(shù)加和leadx,crlfmovah,9int21Hleadx,h3movah,9int21hxor si,si mov ax,bxl4:movcl,10;把和連續(xù)除以divclmovdl,ahmovdh,0pushdxincsimov ah,0連要,不能漏寫;si清零,用

11、作計數(shù);把和放到ax上10知道和變?yōu)榱悖鄶?shù)依次進棧cmp al,0jnz 1415:pop dxadd dl,30h movah,2int21hdec si cmpsi,0jnzl5;余數(shù)依次出棧;余數(shù)轉換為顯示的余數(shù)字符;輸入余數(shù)字符mov ah,4chmai ns3inten dp en ds end21Hmai n3是編寫一段程序,要求在長度為10的數(shù)組中,找出大于42h的無符號數(shù)的個數(shù)并存入地址為up開始區(qū)域,找出小于 42h的無符號數(shù)的個數(shù)并存入地址為down的開始區(qū)域,并分別顯示up、down數(shù)組的個數(shù)和數(shù)組內(nèi)的數(shù)字sisegme nt stackdw100hduptoplabe

12、l wordsien dss2segme nthi db'the numof up array and the up array are(pri nts in decimalism) :','$'h2 db'the numof dow n array and the dow n array are(pri nts in decimalism) :','$'crlfdbi0dh,0ah,24harraydb0,50h,11h,61h,22h,72h,33h,73h,41h,74h,'$'定義數(shù)組 arrayupdb1

13、0 dup(?);定義up數(shù)組dow ndb10 dup(?);定義 down 數(shù)組s2en dss3segme ntassumecs:s3,ds:s2,ss:s3mai nprocfarmovax,s1movss,axleasp,topmovax,s2movds,axmovsi,0movdi,1movbp,1repeat: cmp arraysi,42h;把array數(shù)組中小于 42h的值放到down數(shù)組里,大于42h的值放到up數(shù)組里面jbdow narraymovdl,arraysimovupbp,dlincsicmpsi,10jzexit1incbpjmprepeatdow narra

14、y:movmovincdl,arraysidow n di,dlsiinccmp jzdisi,10exit2jmprepeatexit1:jmpexit2:subexitdi,1subbp,1dx,bpexit:mov便于后面的輸出結束;把分配好的up數(shù)組和down數(shù)組在其有效數(shù)字后面添加'$',movinc bpupO,dlmovmovmovupbp,'$'dx,didow n 0,dlinc dimovdow ndi,'$'movmovcl,10si,0lea dx,h1mov ah,9 int 21hPrin tUparray:cmp j

15、zmov al,upsicallupsi,'$' n extn ext:incjmpprintsiPrin tUparraylea dx,crlf mov ah,9 int 21hlea dx,h2int 21hxor si,siPrin tDow nArray:cmpdow nsi,'$'jz ate ndmov al,dow nsicall inc jmpprintsiPrin tDow nArrayprintprocnear;print為輸出十進制輸出某個數(shù)的子程序movdi,0rediv:movah,0divclmovdl,ahmovdh,0pushdx

16、incdicmpal,0jnzredivbreak:popdxadddl,30hmovah,2int21hdecdicmpdi,0jnzbreakmovdl,''movah,2int21Hretprinten dpaten d:movah,4chint21Hmai nen dps3en dsend4鍵盤輸入一段字符串,其中小寫字母以大寫字母輸出,其他字符不變輸出sisegme nt stackdw100hduptoplabel words1en dss2segme nth1db'Please in put a stri ng:'h2db'The cha

17、nged stri ng iscrlfdb0dh,0ah,24htempdb?s2en dss3segme ntassumecs:s3,ds:s2,ss:s3mai nprocfarmovax,s1movss,axleasp,topmovax,s2movds,axleadx,h1movah,9int21hmov si,0I:mov ah,1int 21hcmp al,0dh jz exit cmp al,'a' jlput in;把小寫字符變?yōu)榇髮懽址鹀mp al,'z' jgput insub al,20hputi n:mov tempsi,al;把字符放到t

18、emp數(shù)組里incsijmp lexit:leadx,crlf;輸出tmp數(shù)組mov int lea mov intah,9 21h dx,h2ah,9 21hincsimovtempsi,'$'leadx,tempmovah,9int21hmovah,4chint21Hmai nen dps3en dsendmai n5從鍵盤上就收一個小寫字母,找出它的前導字符和后續(xù)字符,在順序顯示這三個字符s1tops1segme nt stackdwlabel 、 en ds100hdupwords2segme nth1db'Please in put a lowercaseh2

19、db'The the three chars are:'crlfdb0dh,0ah,24hs2en dss3segme ntassumecs:s3,ds:s2,ss:s3mai nprocfarmovax,s1movss,axleasp,topmovax,s2movds,axl:leadx,h1movah,9int21h I:,$,'$'mov ah,1int 21h cmp al,'a' jl lcmp al,'z' jg lmovcl,alleadx,crlfmovah,9int21Hlea dx,h2 mov ah,9 in

20、t 21hdecclmovdl,clmovah,2int21h;輸出前導字符movdl,''movah,2int21hincclmovdl,clmov ah,2int 21hmovdl,''movah,2int21hincclmovdl,clmovah,2int 21h;輸出該字符;輸出后導字符mov ah,4chint21Hmainendps3endsendmai n6把一個包含20個數(shù)據(jù)的數(shù)組M分成兩組:正整數(shù)組 P和負整數(shù)組N,分別把這兩個數(shù)組 中的數(shù)據(jù)的個數(shù)顯示出來dw100hduptoplabel wordsien dss2segme nthidb&#

21、39;the positive nu mber is: ','$'h2db'the n egative nu mber is: ','$'crlfdb0dh,0ah,24harray50h,-11h,61h,-22h,72h,-33h,73h,-41h,74h,21h,67h,-90h,73h,77h,-1h,-89h,-11h,61h,-22h,20h,'$s2en dss3segme ntassumecs:s3,ds:s2,ss:s3mainprocfarmovax,s1movss,axleasp,topmovax,s2mov

22、ds,axmovbx,0movsi,0l:movdx,arraysicmpdx,0jladdlow;有符號數(shù)比較用jladdsi,2cmpsi,40jzexitjmpladdlow: inc1bxaddsi,2cmpsi,40jzexitjmplexit:leadx,h2movah,9sisegme nt stackdwint21hmov callax,bx printleadx,crlfmovah,9int21hleadx,h1movah,9int21hmov ax,20subax,bxcallprintjmpate ndprintprocn earmovcl,10movsi,0repeat

23、: divclmovdl,ahadd dl,30hmovdh,0pushdxincsimov ah,0cmpal,0jnzrepeat12:popdxmovah,2int21hdecsicmpsi,0jnzl2retprinten dpate nd: movah,4chint21H;打印數(shù)字字符的子程序main endpen dsS3endmain 7打印輸出首地址為 data的20個字數(shù)組中的最小偶數(shù)sisegme nt stackdw100hdup14:cmp jnl negdivmovax,0l4axclal,ah;如果是負數(shù),則求補s1en dss2segme nth1db't

24、he min even nu mber is: ','$'crlfdb0dh,0ah,24hdatadw50,-11,61,-22,72,-33,73,-41,74,21,67,-90,73,77,-1s2en dss3segme ntassumecs:s3,ds:s2,ss:s1mai nprocfarmovax,s1movss,axleasp,topmovax,s2movds,axmovbx,65534;bx存最小數(shù),初始令最小值置為movmov cl,100mov dl,2si,012:movax,datasitop65534,-89,-11,61,-22,20,

25、'$'label wordmov ah,0div dlcmp ah,0jnz 11cmp bx,datasijl 11mov bx,datasi;比較最小值和數(shù)組中的每個數(shù);如果數(shù)組中的數(shù)大于最小值跳轉到11;如果數(shù)組中的數(shù)小于最小值則將其賦給最小值11:add si,2 cmp si,40 jz exit jmp 12exit:leadx,h1movah,9int21hcmpbx,0jnll5negbxmovdl,'-'movah,2int21h15:movax,bxcallprintjmpate ndprintprocn earmovcl,10movsi,0

26、repeat: divclmovadd dl,30hdl,ahmovdh,0pushdxincmov ah,0sicmpal,0jnzrepeat13:popdxmovah,2;調(diào)用子程序輸出最小值int dec cmp jnz21hsisi,013printret en dpate nd:movah,4chint21Hmai nen dps3en dsendmai n8輸入兩船字符串stringl和string2,并比較兩個字符串是否相等,相等就顯示“match”貝U顯示"no match”s1segme nt stackdw100hdup(?)toplabel words1en

27、dss2 segme nthldb'Please input the first stri ng: ','$'h2db'Please in put the sec ond stri ng: ','$'h3 db 'MATCH','$'h4 db 'NO MATCH','$'crlfdb0dh,0ah,24hstr1db50,?,50 dup('$')str2db50,?,50 dup('$')s2en dss3segme ntassum

28、ecs:s3,ds:s2,ss:s3mai nprocfarmovax,s1movss,axleasp,topmovax,s2movds,axlea dx,h1mov ah,9int 21hleadx,str1mov ah,0ahint21hleadx,crlfmov ah,9int21hleadx,h2int21hleadx,str2mov ah,0ahint21hleadx,crlfmov ah,9int21h12:I:I3:movcmp jnzmovmovcmp jnz inccmp jz jmpleamovintleamovintmovintdl,str1+1dl,str2+1si,2

29、dl,str1sidl,str2silsisi,50l3l2dx,h4ah,921hdx,h3ah,921hah,4ch21H;str1+1為strl實際的字符個數(shù);str2+1為str2實際的字符個數(shù);輸出不匹配信息;輸出匹配信息main endpen dsS3endmaindx,h19從鍵盤接收一個四位的十六進制數(shù),并在終端顯示與它等值的二進制數(shù)dw100hduptoplabel words1en dss2segme nth1db'Please in put a hexadecimal nu mber: ','$h2db'The nu mber is pri

30、n ted in binary nu mber:tempdb17 dup('$')crlfdb0dh,0ah,24hs2en dss3segme ntassumecs:s3,ds:s2,ss:s3mai nprocfarmovax,s1movss,axleasp,topmovax,s2movds,axsisegme nt stack','$'repeat: lea mov ah,9 int 21hmovmovbx,0cx,4n ewchar:;接收新字符movah,1int21hcmpal,30hjbrepeatcmpal,46hjgrepeatcmpa

31、l,39hjnbl1;如果輸入字符大于9跳到1111:12:subjmpal,30hl2cmpal,41hjbrepeat;如果輸入字符小于A,則輸入錯誤,跳到subal,37h;輸入字符為AZ,故相應地要減37hjmpl2cbw;l2為把輸入字符轉化為數(shù)值xchgax,bxmovdx,10hmuldxxchgax,bxaddbx,ax;loopn ewcharrepeatdec exemp ex,0 jnz15:13:14:n ewcharleadx,crlfmovah,9int21hleadx,h2int21hmovsi,0movcx,10hrolbx,1jcl3movtempsi,

32、9;O'jmpl4movtempsi,'1'incsiloopl5leadx,tempmovah,9int21hmovah,4chint21H;cx作計數(shù)器,即待會要循環(huán)16次;bx循環(huán)左移以為,最高位進標志位 ;若標志位為1則跳轉到13mainen dpS3en dsendmain10從鍵盤輸入一系列以$為結束符的字符串,然后對其中的非數(shù)字字符計數(shù),并顯示計數(shù)結 果sisegme nt stackdw100h duptoplabel wordsiendss2segme nthidb'Please input a stri ng: ','$

33、9;h2db'The nu mber of the chars that is not digit:','$'crlf db 0dh,0ah,24hs2endss3segme ntassume cs:s3,ds:s2,ss:s3mai nproc farmovax,s1movss,axleasp,topmovax,s2movds,axleadx,himov ah,9int 21hmovcx,0l2:mov ah,1int21hcmpal,'$'jzexitcmpal,30hjblcmpal,39hjnbljmpl2l:inc cxjmpl2exi

34、t:leadx,crlfmovah,9int21hleadx,h2int21hmovsi,0movbl,10movax,cx14:divblmovdl,ahmovdh,0pushdxincsimovah,0cmpal,0jnzl415:popdxadddl,30hmovah,2int21hdecsicmpsi,0jnzl5movah,4chint21Hmai ns3en dpen dsendmai n11.有一個首地址為 mem的10個字的數(shù)組,試編程序刪除數(shù)組中所有為零的項,并將后續(xù) 項向前壓縮,最后將數(shù)組的剩余部分補上零s1segme nt stackdw100hduptops1label

35、 worden dss2segme ntmemdw0,1,030,0,4,5,6,0,'$'crlfdb0dh,0ah,24hs2en dss3segme ntassumecs:s3,ds:s2,ss:s3mai nprocfarmovax,s1movss,axleasp,topmovax,s2movds,axmov si,0mov di,2repeat: cmp di,20jz exitmov bx,memsimov dx,memdicmp bx,0jnz n extxchg bx,dxmov memsi,bxmov memdi,dxn ext:cmp memsi,0jz l

36、add si,2I:add di,2jmp repeatexit:mov ah,4chint21Hmainendps3endsendmai n;以下是該算法描述淀義兩個指針,當前指針si和檢查指針di,先把si指針指向第一個字得到的值bx,;di指向第二個字得到的值dx。若bx為0,di自加2,否則,則交換這兩字,;若此時si指向字為0,則di,否則,di,si都自己加2。如此循環(huán)直到 di指向最后一個字。 ;這樣就把所有非零字至于前面了。12.從鍵盤上輸入一串字符(用回車鍵結束,使用 10號功能調(diào)用)放在 string中,是編制一個程序測試字符串中是否存在數(shù)字。如有,則把cl的第五位置1,否

37、則將該位置置 0dw100hduptoplabel words1en dss2segme nth1db'Please in put a stri ngh2db'cx: ','$'crlfdb0dh,0ah,24hstri ngdb50,?,50 dup('$')s2en dss3segme ntassumecs:s3,ds:s2,ss:s3mai nprocfarmovax,s1movss,axleasp,topmovax,s2movds,axsisegme nt stack I:,$and cl,0dfh;先假設無數(shù)字,置 0lea d

38、x,h1mov ah,9int 21hlea dx,stri ngmov ah,10dint 21hmov si,212: cmp stri ngsi,'$'jz exitmov dl,stri ngsicmp dl,30hjb lcmp dl,39hjnb lor cl,20h ;有數(shù)字,置1jmp exit1:inc sijmp 12exit:leadx,crlfmovah,9int21hleadx,h2int21hmovax,cxcallprintjmpate ndprintprocn earmovcl,10movsi,0repeat: divclmovdl,ahadd

39、dl,30hmovdh,0pushdxincsimov ah,0cmpal,0jnzrepeat13:popdxmovah,2int21hdecsicmpsi,0jnzl3retprinten dpate nd: movah,4chint21Hmainen dps3en dsendmai n13.在首地址為data的字數(shù)組中,存放了 10個16位字數(shù)據(jù),試編寫一個程序,求出平均值 放在ax寄存器中,并求出數(shù)組中有多少個數(shù)小于此平均值,將結果放在bx寄存器中(f分別考慮有符號數(shù)、無符號數(shù)情況)sisegme nt stackdw100hduptoplabel words1en dss2segme

40、 ntdatadw-1,0,1,-2,2,3,-3,-4,4,15,'$crlfdb0dh,0ah,24hs2en dss3segme ntassumecs:s3,ds:s2,ss:s3mai nprocfarmovax,s1movss,axleasp,topmovax,s2movds,axmov si,0mov ax,013: cmp datasi,'$' jz exit mov dx,datasi cmp dx,0 jnl 11 neg dx sub ax,dx jmp l2l1: add ax,dxl2:add si,2jmp l3exit:mov cl,10;平

41、均值放到ax中div clmov ah,0mov si,0movbx,015:cmpdatasi,'$'小于平均值的數(shù)的個數(shù)放到bx中jzexit2cmpax,datasijzl6jll6incbx16:addsi,2jmpl5exit2:movah,4chint21Hmai nen dps3en dsendmai n14. 一直數(shù)組A包含15個互不相等的整數(shù),數(shù)組B包含20個互不相等的整數(shù)。試編制一個程序,把既在 A中又在B中出現(xiàn)的整數(shù)存放于數(shù)組C中并顯示C中的數(shù)值;兩層循環(huán)比較得出兩個數(shù)組中相同的數(shù)值sisegme nt stackdw100hduptoplabel wor

42、ds1endss2segme ntdwadw1h,2h,3h,4h,5h,6h,7h,8h,9h,10h,11h,12h,13h,14h,15h,'$'b21h,22h,23h,24h,25h,6h,18h,19h,10h,11h,12h,34h,14h,53h,31h,32h,33h,36h,7h,67h,'$' c dw 16 dup('$')crlfs2dben ds0dh,0ah,24hs3segme ntassumecs:s3,ds:s2,ss:s3mai nprocfarmovax,s1movss,axleasp,topmovax,s

43、2movds,axmov si,0mov di,0 mov bp,014: cmp di,40jz 12 jmp 1312: add si,2cmp si,30 jz exit mov di,0l3: mov ax,asimov bx,bdi cmp ax,bx jnz l mov cbp,ax add bp,2l:add di,2jmp l4exit:mov bp,016: cmp cbp,'$' jzate ndmov ax,cbp call print add bp,2 mov dl,'' mov ah,2 int 21h jmp l6print proc

44、n earmovcl,10movsi,0repeat: div clmovdl,ahadd dl,30h mov dh,0 push dx inc simov ah,0cmpal,0jnzrepeat15:pop dxmovah,2int21hdecsicmpsi,0jnzl5retprint endpate nd:movah,4chint21Hmainendps3endsend mai n15.設在A、B和D單元中分別存放著三個數(shù)。若三個數(shù)都不是0,則求出三個數(shù)的和并存放在S單元,若其中有一個數(shù)為0,則把其它兩個單元也清零。請編寫此程序s1segme nt stackdw100h dup(?

45、)toplabel words1en dss2segme ntadw1h,'$'bdw-11h,'$'d dw0h,'$'s dw2 dup('$')crlfdb0dh,0ah,24hs2en dss3segme ntassumecs:s3,ds:s2,ss:s3mai nprocfarmovax,s1movss,axleasp,topmovax,s2movds,axmov ax,a0mov bx,bOmov dx,dOcmp ax,0jz lcmp bx,0jz lcmp dx,0jz lmov cx,0cmp ax,0jnl add_axneg ax ;

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論