好文档就是一把金锄头!
欢迎来到金锄头文库![会员中心]
电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

汇编语言实验报告1~7.doc

9页
  • 卖家[上传人]:飞***
  • 文档编号:43549043
  • 上传时间:2018-06-06
  • 文档格式:DOC
  • 文档大小:44.50KB
  • / 9 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • 实验一 汇编运行环境及方法、简单程序设计dseg segment string1 db 'Move the cursor backward' string2 db 'Move the cursor backward' mess1 db 'Match.',13,10,'$' mess2 db 'No Match',13,10,'$' dseg ends cseg segment main proc farassume cs:cseg,ds:dseg,es:dsegstart:push dssub ax,axpush axmov ax,dsegmov ds,axmov es,axlea si,string1lea di,string2cldmov cx,24repz cmpsbjz matchlea dx,mess2jmp short dispmatch:lea dx,mess1disp:mov ah,9int 21hretmain endpcseg endsend start 实验二 用 DEBUG 编程:使用堆栈段将AX 和 BX 的内容进行交换等DATA SEGMENTDATA1 DW 3000H,5000HXX DW 2000H DATA ENDS PROGNAM SEGMENTASSUME CS:PROGNAM,DS:DATASTART: MOV AX,DATAMOV DS,AXMOV SP,XXMOV BP,SPMOV SI,0MOV AX,DATA1[SI]MOV BX,DATA1[SI+2]PUSH AXPUSH BXPOP AXPOP BXMOV AH,4CHINT 21H PROGNAM ENDSEND START 实验三、存储器块清零和内存块移动data segment da db 0ah,0bh,0ch,0dh,0eh data ends code segment assume cs:code,ds:data start: mov ax,data mov ds,ax mov bx,300h mov cx,5 l: lea si,da mov dl,[si] mov [bx],dl add si,1 add bx,1 loop l mov ah,4ch int 21h code ends end start 4.DATAS SEGMENT string1 db ' ERROR',0ah,0dh,'$'string2 db ' $' DATAS ENDSCODES SEGMENTASSUME CS:CODES,DS:DATAS START:MOV AX,DATASMOV DS,AX L0:mov ah,1int 21h cmp al,0dhjz exit cmp al,'a'jae L1jb L3L1: cmp al,'z'jna L2ja L3L2:sub al,20h mov cl,allea dx,string2mov ah,9int 21hmov dl,0mov dl,clmov ah,2int 21hmov dl,0ahmov ah,2int 21hmov dl,0dhmov ah,2int 21hjmp L0L3: lea dx,string1mov ah,9int 21hjmp L0 exit: MOV AH,4CHINT 21H CODES ENDS END START 5.;显示 AL 中两位十六进制数程序 code segmentassume cs:code start:mov al,3Ehpush axmov dl,almov cl,4shr dl,clcmp dl,9jbe next1add dl,7 next1:add dl,30hmov ah,2int 21hpop axmov dl,aland dl,0fhcmp dl,9jbe next2add dl,7 next2:add dl,30hmov ah,2int 21hmov ah,4chint 21h code endsend start 6.;显示键入字符程序: code segmentassume cs:code start:mov ah,1int 21hcmp al,0dhjz donecmp al,'0'jb nextcmp al,'9'ja charupmov dl,almov ah,2int 21hjmp start charup:cmp al,41hjb nextcmp al,5ahja chrdn dispc:mov dl,'c'mov ah,2int 21h next:jmp start chrdn:cmp al,61hjb nextcmp al,7ahja nextjmp dispc done:mov ah,4chint 21h code endsend start 7.DATAS SEGMENTarray db 50,69,84,94,73,89,99,100,100,80,100,23,68,74,54,12string1 db 'The number of 100:$' string2 db 'The number of 90-99:$' string3 db 'The number of 80-89:$'string4 db 'The number of 70-79:$' string5 db 'The number of 60-69:$'string6 db 'the number of low 60:$' DATAS ENDS STACKS SEGMENT STACKS ENDS CODES SEGMENTASSUME CS:CODES,DS:DATAS,SS:STACKS START:MOV AX,DATASMOV DS,AXmov al,0mov bx,0mov cx,0mov dh,0mov dl,16call count call output MOV AH,4CH INT 21Hcount proc near ;子程序一,用来统计各分数段的人数 mov si,0next:cmp array[si],100 jz L1 jl next1 next1:cmp array[si],90jae L2jl next2 next2: cmp array[si],80jae L3 jl next3 next3: cmp array[si],70jae L4 jl next4 next4: cmp array[si],60 jae L5 inc dhinc sidec dljnz nextjmp exitL1:inc alinc sidec dljnz nextjmp exitL2:inc bhinc sidec dljnz nextjmp exit L3:inc blinc sidec dljnz nextjmp exitL4:inc chinc sidec dljnz nextjmp exit L5:inc clinc si dec dl jnz next exit:retcount endp output proc near ;子程序二,用来输出相关内容mov ah,0push ush cxpush bxpush axlea dx,string1 ;输出 100 分的人数mov ah,9int 21Hpop bxmov dl,bladd dl,30hmov ah,2int 21Hcall enter lea dx,string2 ;输出 90 至 99 分的人数mov ah,9int 21Hpop bxmov dl,bhadd dl,30hmov ah,2int 21Hcall enterlea dx,string3 ;输出 80 至 89 分的人数mov ah,9 int 21Hmov dl,bladd dl,30hmov ah,2int 21Hcall enterlea dx,string4 ;输出 70 至 79 分的人数mov ah,9int 21Hpop bxmov dl,bhadd dl,30hmov ah,2int 21Hcall enterlea dx,string5 ;输出 60 至 69 分的人数mov ah,9int 21Hmov dl,bladd dl,30hmov ah,2int 21Hcall enterlea dx,string6 ;输出低于 60 分的人数mov ah,9int 21Hpop bxmov dl,bhadd dl,30hmov ah,2 int 21H call enterretoutput endpenter proc near ;子程序三,用来在每行输出后回车换行mov dl,0ahmov ah,02hint 21hmov dl,0dhmov ah,02hint 21hretenter endp CODES ENDSEND START。

      点击阅读更多内容
      关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
      手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
      ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.