还剩3页未读,继续阅读
文本内容:
分支程序结构设计一.实验目的和要求
1.熟悉运算类指令对标志位的状态影响以及标志位状态的表示方法;
2.掌握条件转移,无条件转移指令的使用方法;
3.掌握分支程序设计,编写,调试和运行的方法;二.实验设备(环境)及要求MASM.EXE LINK.EXE CMD.EXE三.实验内容及步]
1.编写程序,实现将大写字符串转换为小写字符串设字符串的首地址为STRING,字符串长度在LEN单元内数据段定义如下;DATASEGMENTSTRING DBI am a studentLEN equ$-STRINGDATA ENDS
2.从键盘输入一个字符,判断该字符是小写字母,大写字母,数字或其它字符,并给出相应提示四.实验结果与数据处理DATA SEGMENT
1.程序源码:STRINGLEN DBequDATAENDSCODE SEGMENTASSUMEDS DATA,CS CODE;START MOVAX,DATAMOV DS,AXMOV BX,LENMOV AL,OAHMOV[BX],ALMOV AL,$INC BXMOV[BX],ALMOV AH,09HI ama student1$-STRINGLEA DX,STRINGINT21HLEA BX,STRINGMOV CX,LENLOMOV DL,[BX]CMP DL,20HJZ DPADDDL,20HDPMOV AH,02HINT21HINC BXLOOPLOLIJMP LIMOVAH,4CHINT21HCODE ENDSENDSTART运行结果:Microsoft RMacro AssemblerVersion
5.00Copyright CMicrosoft Corp1981-1985,
1987.All rightsreserved.Object filename[TEXT.OBJ]Source listing[NUL.LSI]:Cross-reference[NUL.CRF]:49224+432344Bytes symbolspace free0Warning Errors0Severe ErrorsD:\asmLINK TEXTMicrosoftR OverlayLinker Version
3.60Copyright CMicrosoft Corp1983-
1987.All rightsreserved.Run File[TEXT.EXE]:List File[NUL.MAPI:Libraries[.LIB]:LINK:warning L4021:no stacksegmentD:\asmTEXTI AMfi STUDENTiamastudent
2.程序源码:mydata segmentstringdb1please input a data1,Odh,OAH,shuzi dbis shuzi,Odh,OAH,1$daxie dbis daxie1,0dh,0AH,xiaoxie dbis xiaoxie1,Odh,OAH,!$fqita dbis qita\0dh,0AH,r$fmydata endsmycodesegmentassume csmycode,ds mydatastartmov ax,seg string;mov ds,axmov dx,offset string;mov ah,09hint21h;mov ah,Olhint21h;cmp al,$‘jz exitcmp al,30h;jb qitalcmp al,39h;jb shuzil;cmp al,41hjb qital;cmpal,5ah;jb daxiel;cmpal,61h;jb qitalcmpal,7ah;jb xiaoxiel;shuzil jmp10;mov dx,mov offsetshuzi;ah,int21h;jmp10;09h;xiaoxiel mov dx,movah,int21h;jmp10;daxieloffset xiaoxie;movdx,mov09h;ah,int21h;jmp10;qital movdx,movah,int offsetdaxie;21h;09h;offset qita;09h;10jmp startexit movah,4ch;int21h;mycode endsendstart运行结果U severetrrorsD:\asmlink panduanMicrosoftR OverlayLinker Version
3.60Copyright CMicrosoft Corp1983-
1987.All rightsreserved.Run File[PANDUAN.EXE]List File[NUL.MAP1:Libraries[.LIB]:LINK:warning L4021:no stacksegmentD:\asmpanduanplease input a data:1is shuzipleaseinput a data:a isxiaoxieplease inputa data:A isdaxieplease inputadata:%is qitapleaseinputadata:!is qitapleaseinputadata:。