Download - Bai Tap VXL

Transcript

PHONGKYTHUATVIXLYThS.KS.NGUYENNHLUYEN1KHOAKT&CNBTLT.ASSEMBLER

BAITAPLAPTRNHASSEMBLY;BAITAP1;TLINKBT1+BTlib;-----------------Dosseg;phan dau tien.modelsmall;khai bao bo nho co kich thuong nho.stack200h;dang ki voi he thong 1 bo nho 200h.data

aboutdb'ChuongtrinhInchuoinguoc','$';db khai bao pham vi 8 bit 256 ki tupromptdb13,10,'Nhap1chuoi:','$';13,16 xuong dau dongmessdb13,10,'Ketqua:$'errormessdb13,10,'Chuoikhonghople!$'MAXequ100chuoidbMAXdup(?)lendb?.code

extrnwrite_char:near,disp_string:nearextrnfinish:near,getnumber:nearstart:movbx,@data;la phan bat buocmovds,bx;chuyen dx->dsmoves,bx;

movdx,offsetabout;chuyen chuoi vao dxcalldisp_string;goi xuat chuoicallgetstring;callprocess;callfinish.;--------------------------------;Nhap1chuoitubanfim;trave:AX=chitoichuoinhap;--------------------------------getstringproc;dinh nghia getstringpushbx;nap bx vao ngan xep stackpushcxpushdxmovdx,offsetpromptcalldisp_stringmovah,3Fh;nhapchuoimovbx,0movcx,MAXmovdx,offsetchuoi;chuavaoDXint21hsubax,2;dodaithuccuachuoicmpax,0jgvalidstringmovdx,offseterrormesscalldisp_stringcallfinishretvalidstring:movwordptrlen,axmovax,dxpopdxpopcxpopbxretgetstringendp;-----------------------;-----------------------processprocmovdx,offsetmesscalldisp_string

PHONGKYTHUATVIXLYThS.KS.NGUYENNHLUYEN2KHOAKT&CNBTLT.ASSEMBLER

movbx,offsetchuoimovcx,0movcl,lenmainloop:movsi,cxdecsimovdl,[bx+si]callwrite_charloopmainloopretprocessendp;---------------------endstart

;BAITAP2;TLINKBT2+BTlib;-----------------dosseg.modelsmall.stack200h.data

aboutdb'ChuongtrinhhienuocsocuaN','$'promptdb13,10,'NhapsoN(La3canhtamgiac','$'mess2db13,10,'-->Khongphaicanhtamgiac','$'errormessdb'Khonghople!','$'MAXequ10chuoisodbMAXdup(?)

.code

extrnstring_to_number:near,disp_string:nearextrnfinish:near,getnumber:nearstart:movbx,@datamovds,bx

movdx,offsetaboutcalldisp_stringcallgetdatacallprocesscallfinish;---------------------getdataprocmovdx,offsetprompt1calldisp_stringcallgetnumbermova,al

movdx,offsetprompt2calldisp_stringcallgetnumbermovb,al

PHONGKYTHUATVIXLYThS.KS.NGUYENNHLUYEN15KHOAKT&CNBTLT.ASSEMBLER

movdx,offsetprompt3calldisp_stringcallgetnumbermovc,alretgetdataendp;-------------------------------processproccompare:moval,0addal,aaddal,bcmpal,cjlenotvalidmoval,0addal,baddal,ccmpal,ajlenotvalidmoval,0addal,caddal,acmpal,bjlenotvalidmovdx,offsetmess1calldisp_stringretnotvalid:movdx,offsetmess2calldisp_stringretprocessendp;--------------------------------endstart

;BAITAP13;TLINKBT13+BTlib;-----------------dosseg.modelsmall.stack200h.data

aboutdb'Chuongtrinhxettansoxuathiennguyenam','$'promptdb13,10,'Nhapchuoihoten(


Top Related