資源描述:
《云南大學(xué) 軟件學(xué)院 匯編實(shí)驗(yàn)5》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在應(yīng)用文檔-天天文庫。
1、計(jì)算機(jī)組成原理與匯編元程序設(shè)計(jì)實(shí)驗(yàn)報(bào)告實(shí)驗(yàn)五80x86分支,循環(huán),子程序,宏程序設(shè)計(jì)姓名:學(xué)號(hào):序號(hào):班級(jí):分?jǐn)?shù):1.編寫設(shè)計(jì)一個(gè)2,10,16進(jìn)制的碼制轉(zhuǎn)換程序,要求:①程序有友好的運(yùn)行界面;②輸入任意類型進(jìn)制的數(shù)據(jù),轉(zhuǎn)換為其余兩種進(jìn)制類型;③要求程序有方便的輸入輸出功能;④要求程序能夠處理基本的錯(cuò)誤信息;⑤程序的基本結(jié)構(gòu)采用子程序結(jié)構(gòu);源程序:.8086.modelsmall.datastrdb0ah,0dh,'pleaseinput1to8tochoisethefunction',0ah,0dhdb'1.btd',0ah,0dhdb'2.bth
2、',0ah,0dhdb'3.dth',0ah,0dhdb'4.dtb',0ah,0dhdb'5.htb',0ah,0dhdb'6.htd',0ah,0dhdb'7.again',0ah,0dhdb'8.end',0ah,0dh,'$'bdb'PleaseinputaBinarynumber',0ah,0dh,'$'ddb'Pleaseinputadecimalnumber',0ah,0dh,'$'hdb'PleaseinputaHexadecimalnumber',0ah,0dh,'$'agaidb'Pleaseinputagain',0ah,0dh
3、,'$'wrdb'Awrongnumber!',0ah,0dh,'$'numdb6,?,6dup(?)num1db16,?,16dup(?).codestart:movax,@datamovds,axchoice:leadx,strmovah,9int21hmovah,1int21hjmpC1-13-計(jì)算機(jī)組成原理與匯編元程序設(shè)計(jì)實(shí)驗(yàn)報(bào)告again:movdl,0ahmovah,2int21hmovdl,0dhmovah,2int21hjmpchoiceMo:movdx,offsetagaimovah,9int21hjmpchoiceC1:cmpal
4、,'1'jnzC2callbtdjmpagainC2:cmpal,'2'jnzC3callbthjmpagainC3:cmpal,'3'jnzC4calldthjmpagainC4:cmpal,'4'jnzC5calldtbjmpagainC5:cmpal,'5'jnzC6callhtbjmpagainC6:cmpal,'6'jnzC7callhtdjmpagainC7:cmpal,'7'-13-計(jì)算機(jī)組成原理與匯編元程序設(shè)計(jì)實(shí)驗(yàn)報(bào)告jnzC8jmpMoC8:cmpal,'8'jnzwrongen:movah,4chint21hwrong:leadx
5、,wrmovah,9int21hjmpMobtdprocmovdx,offsetbmovah,9int21hmovdx,offsetnum1movah,0ahint21hmovdl,0ahmovah,2int21hmovdl,0dhmovah,2int21hmovdi,offsetnum1movch,[di+1]zq2:movdl,[di+2]cmpdl,39hjgzqsubdl,30hjmpzq1zq:subdl,37hzq1:movdh,0orbx,dxcmpch,1jzzq3-13-計(jì)算機(jī)組成原理與匯編元程序設(shè)計(jì)實(shí)驗(yàn)報(bào)告rolbx,1zq3:i
6、ncdidecchjnzzq2xorsi,sijj1:cmpbx,10000jcjjsubbx,10000incsijmpjj1jj:movdx,sianddx,0fhadddl,30hmovah,2int21hxorsi,siL1:cmpbx,1000jcL2subbx,1000incsijmpL1L2:movdx,sianddx,0fhadddl,30hmovah,2int21hxorsi,siL3:cmpbx,100jcL4subbx,100incsijmpL3L4:movdx,sianddx,0fhadddl,30hmovah,2int21h
7、xorsi,siL5:cmpbx,10-13-計(jì)算機(jī)組成原理與匯編元程序設(shè)計(jì)實(shí)驗(yàn)報(bào)告jcL6subbx,10incsijmpL5L6:movdx,sianddx,0fhadddl,30hmovah,2int21hxordx,dxmovdx,bxanddx,0fhadddl,30hmovah,2int21hretbtdendpbthprocmovdx,offsetbmovah,9int21hmovdx,offsetnum1movah,0ahint21hmovdl,0ahmovah,2int21hmovdl,0dhmovah,2int21hmovdi,o
8、ffsetnum1movch,[di+1]K1:moval,[di+2]subal,30horbl,alro