资源描述:
《编写一个程序.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、;编写一个程序,打印出当前目录下的本文件XITI537.ASMERRFLAG=00101001BCSEGSEGMENTMESS1DB'正在打印,请等待!',13,10,24HMESS2DB'打印机不能联接!',13,10,24HMESS3DB'OK!',24HFNAMEDB'XITI434.ASM',0FNUMDW?BUFFDB512DUP(?)ASSUMECS:CSEG,DS:CSEGSTART:MOVAX,CSEGMOVDS,AXMOVCX,100LOP1:MOVAH,1MOVDX,0INT17HTESTAH,ERRFLAGJ
2、ZPOKLOOPLOP1MOVDX,OFFSETMESS2MOVAH,9INT21HJMPOVERPOK:MOVDX,OFFSETMESS1MOVAH,9INT21H MOVDX,OFFSETFNAMEMOVAX,3D00HINT21HJCOVERMOVFNUM,AXLOP2:CALLREADFILEJCOVERORAX,AXJZOVER1MOVCX,AXCALLPRINTJCOVER1JMPLOP2 OVER1:MOVBX,FNUMMOVAH,3EHINT21HOVER:MOVAX,4C00HINT21H;出口参数:CF=0示成
3、功,AX=实际读取的字节数;CF=1,示失败READFILEPROCPUSHBXPUSHCXPUSHDXMOVBX,FNUMMOVCX,512MOVDX,OFFSETBUFFMOVAH,3FHINT21HPOPDXPOPCXPOPBXRETREADFILEENDP;;入口参数:CX=打印的字符数;出口参数:CF=0示正确;CF=1示出错PRINTPROCPUSHAXPUSHSIPUSHDXMOVSI,OFFSETBUFFLOP3:MOVAL,[SI]INCSIMOVDX,0MOVAH,0INT17HTESTAH,ERRFLAGJN
4、ZERR1LOOPLOP3CLCJMPOVER2ERR1:STCJMPOVER2OVER2:POPDXPOPSIPOPAXRETPRINTENDPCSEGENDSENDSTART