文档详情

《微机原理》实验报告3.doc

发布:2017-10-12约2.45千字共7页下载文档
文本预览下载声明
《微机原理》 实 验 报 告 班级: 学号: 姓名: 指导教师: 实验日期: 实验三 实验题目 分支结构程序设计 完成日期 实验目的与要求: 熟悉运算类指令对标志位的状态影响以及标志位状态的表示方法。 掌握条件转移,无条件转移指令的使用方法。 掌握分支结构设计,编写,调试和运行的方法。 实验内容: 1.编写程序实现将大写字母转换为小写字母 2.在内存中定义三个16位的数,判断这三个数是否相等。若三个数相等,则显示“all equall”若只有两个数相等,则显示“only two equall”否则,显示“all three different from each other”. 3.从键盘中输入一个字符,判断该字符事小写字母,大写字母,数字或其他字符,并给出相应的提示。 实验步骤与源程序(若是硬件,需有硬件连线图;若是软件,需有流程图): 源程序 data segment string db I am a student len equ $-string data ends code segment assume ds:data,cs:code start: mov ax,data mov ds,ax lea si,string mov cx,len one: mov bx,[si] cmp bx,A jb next cmp bx,Z jnb next add bx,32 next:inc si loop one lea dx,string mov ah,9h int 21h mov ah,4ch int 21h code ends end start 源程序 DATA SEGMENT string DB all equall$ str db only two equall$ srti db all the three different from each other$ data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov ax,a cmp ax,b je one cmp ax,c je two mov dx,b cmp dx,c je two lea dx,srti mov ah,9h int 21h jmp four one: cmp ax,c je three jmp two two: lea dx,str mov ah,9h int 21h jmp four three:lea dx,string mov ah,9h int 21h jmp four four:mov ah,4ch int 21h code ends end start 源程序 DATA SEGMENT str1 DB it is number$ str2 db it is 大写字母$ str3 db it is 小写字母$ str4 db it is others$ data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov ah,1h int 21h cmp al,0 jb one cmp al,9 jnae two cmp al,A jb one cmp al,Z jnae three cmp al,a jb one cmp al,z jnae four
显示全部
相似文档