资源描述:
《云南大学软件学院汇编语言实验报告六》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、一、汇编语言程序上机过程1、掌握常用工具软件PE,MASM和LINK的使用。2、伪指令:SEGMENT,ENDS,ASSUME,END,OFFSET,DUPo3、利用的1号功能实现键盘输入的方法。4、了解.EXE文件和.COM文件的区别及用INT21H、INT4CH号功能返回系统的方法。程序:datasegmentmessagedb'Thisisasampleprogramofkeyboardanddisply*db0dh,0ah,'Pleasestrikethekey!',0dh,0ah,$dataendsstacksegmentpara
2、stack'stack*db50dup(?)stackendscodesegmentassumecs:code,ds:data,ss:stackstart:movax,datamovds,axmovdx,offsetmessagemovah,9int21hagain:movah,1int21hcmpal,1bhjeexitcmpal,61hjcndcmpal,7ahjandandal,11011111bnd:movdl,almovah,2int21hjmpagainexit:movah,4chint21hcodeendsendstart实验
3、步骤:1、用用文字编辑工具(记事本或EDITPLUS)将源程序输入,其扩展名为.ASM。2、用MASM对源文件进行汇编,产生.OBJ文件和丄ST文件。若汇编时提示冇错,用文字编辑工具修改源程序后重新汇编,直至通过。3、用LINK将.OBJ文件连接成可执行的.EXE文件。4、在DOS状态下运行LINK产心的.EXE文件。即在屏幕上显示标题并提示你按键。每按一键在屏幕上显示二个相同的字符,但小写字母被改成大写。按ESC键可返冋DOSo若未出现预期结果,用DEBUG检查程序。」ReadmeASM-记事本文件(F)编辑(E)格式(O)直看(V)帮助
4、(H)datamessagedbdatastackdbstackcodeassumestart:movmovITIOVintagain:intcinpjecmpjccmpjad:movintjmpexit:intcodeendsegmentdb'Thisisasanpleprogramofkeyboardanddisply^Odh,Oah,9Pleasestrikethekey!',Odh,Oah,'endssegmentparastack'stack'50dup(?)endssegmentcs:code,ds:data,ss:stackm
5、ovax,datads,axdx,offsetmessageah,921hmovah,121hal,lbhexital,61hndalj7ahndal,11011111bmovdl,alah,221hagainmovah,4ch21hendsstart►计算机►本地磁盘(E:)►360Wifi£奶夹名称,停改日期大小■麺.屢近访问的位1运際口ReadmeaASN2015/5/2619:53ASM文件1KB文件(F)編眉(E)查看(V)IMCD帮助(H)包含至憔中▼共享▼刻录nWin-Md5mv2.2・
6、E^360WiFiRcddme^SM
7、
8、n小工具CD4;1datasegment2messagedb'Thisis&sampleprogramo£keyboardanddlsply'3dbOdh/Oahf•Pleasestrikethekey'•tOdhrOah,•$'4dataends5stacksegmentparastack•stack16Idb50dup(?)7stackends8codesegment9assumecs:coderds:data,ss:stack10start:»ov&X/data11movds,ax.12movd>cfoffsetmessage13m
9、ovshf914int21h15again:movah,116int21h17cmpal,lbh18joexit19cmpal,61h20jond21cmp7ah22jand23andalf11011111b24nd:movdl,25movah,226int21h27jmpagain28exit:movaht4ch29int21h30codeends▲名称ni修改日期类型大小怦Readme^ASM2015/5/2619:53ASM文件1KB勺Readme.obj2015/5/2619:58ObjectFile1KB客C:Windowss
10、ystem32command.comThisisasampleppogranofkeyboardanddisplyPleasestrikethekey?aAgGhHdDhHsS