大学汇编实验代码详解(绝对给力)

上传人:大米 文档编号:486504687 上传时间:2023-02-16 格式:DOC 页数:12 大小:34.50KB
返回 下载 相关 举报
大学汇编实验代码详解(绝对给力)_第1页
第1页 / 共12页
大学汇编实验代码详解(绝对给力)_第2页
第2页 / 共12页
大学汇编实验代码详解(绝对给力)_第3页
第3页 / 共12页
大学汇编实验代码详解(绝对给力)_第4页
第4页 / 共12页
大学汇编实验代码详解(绝对给力)_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《大学汇编实验代码详解(绝对给力)》由会员分享,可在线阅读,更多相关《大学汇编实验代码详解(绝对给力)(12页珍藏版)》请在金锄头文库上搜索。

1、文档供参考,可复制、编制,期待您的好评与关注! 实验一:data segment errmess db 错误!,$data endsstack segment stack db 100 dup(?)stack endscode segment assume cs:code, ds:data, ss:stackstart: mov ax, data mov ds, ax lll: mov ah, 1 int 21h cmp al,# jz done cmp al,A jb err cmp al,Z ja err add al,20h mov dl,al mov ah,2 int 21h jmp

2、lllerr: mov dx, offset errmess mov ah,9 int 21h jmp llldone:mov ah, 4ch int 21hcode ends end start实验二:data segment string db Beijing,China,2008!,$data endsstack segment stack db 100 dup(?)stack endscode segment assume cs:code,ss:stack,ds:datastart: mov ax,data mov ds,ax mov dx,offset string mov ah,9

3、 int 21h mov ah,1 int 21h mov ah,4ch int 21hcode endsend startdata segment string db Add 12h,34h is:,$data endsstack segment stack db 100 dup(?)stack endscode segment assume cs:code,ss:stack,ds:datastart: mov ax,data mov ds,ax mov dx,offset string mov ah,9 int 21h mov al,12h mov dl,34h add al,dl pus

4、h ax mov cl,4 rol al,cl and al,0fh add al,30h mov dl,al mov ah,2 int 21h pop ax and al,0fh add al,30h mov dl,al mov ah,2 int 21h mov dl,h mov ah,2 int 21h mov ah,1 int 21h mov ah,4ch int 21hcode ends end start实验3:data segment string db abc#d len dw $-string addr dw ?data endsstack segment stack db 1

5、00 dup(?)stack endscode segment assume cs:code,ss:stack,ds:datastart: mov ax,data mov ds,ax mov cx,len lea si,stringcompare: cmp byte ptrsi,# jz exit inc si loop compare mov addr,0 mov ah,4ch int 21h exit: mov addr,si mov ah,4ch int 21hcode ends end startdata segment string db 12ab len dw $-string c

6、ount db ?data ends stack segment stack db 100 dup(?)stack endscode segment assume cs:code,ss:stack,ds:datastart: mov ax,data mov ds,ax lea si,string mov count,0 mov cx,lenL1: mov al,8L2: rol byte ptrsi,1 jnc addL4: sub al,1 jz L3 jnz L2L3: inc si loop L1 mov ax,count mov ah,4ch int 21hadd: inc count

7、 jmp L4code ends end start实验四:data segment X db 11 Y db 15 Z db 10 MAX db ?data endsstack segment stack db 100 dup(?)stack endscode segment assume cs:code,ss:stack,ds:datastart: mov ax,data mov ds,ax mov al,X mov MAX,al mov al,Y cmp MAX,al ja L1 mov MAX,alL1: mov al,Z cmp MAX,al ja L2 mov MAX,alL2:

8、mov dl,MAX mov ah,4ch int 21hcode ends end startdata segment score db 56,78,83,67,39,48,95,76,86,62,100,57,85,82,71,92 len dw $-score s5 db 0 s6 db 0 s7 db 0 s8 db 0 s9 db 0 s10 db 0data endsstack segment stack db 100 dup(?)stack endscode segment assume cs:code,ss:stack,ds:datastart: mov ax,data mov

9、 ds,ax mov cx,len inc cx lea si,scoreS: dec cx jz done cmp byte ptrsi,60 jb L1 cmp byte ptrsi,70 jb L2 cmp byte ptrsi,80 jb L3 cmp byte ptrsi,90 jb L4 cmp byte ptrsi,100 jb L5 jmp L6L1: inc s5 inc si jmp SL2: inc s6 inc si jmp SL3: inc s7 inc si jmp SL4: inc s8 inc si jmp SL5: inc s9 inc si jmp SL6:

10、 inc s10 inc si jmp Sdone: mov bh,s5 mov bl,s6 mov ch,s7 mov cl,s8 mov dh,s9 mov dl,s10 mov ah,4ch int 21hcode ends end start实验5decihex segment assume cs: decihexmain proc farrepeat: call decibin call crlf call binihex call crlf jmp repeat main endpdecibin proc near mov bx,0newchar: mov ah,1 int 21h cmp al,71h jz out sub al,30h jl exit cmp al,9d jg exit cbw xchg ax,bx mov cx,10d mul cx xchg ax,bx add bx,ax jmp newcharexit: retdecibin endpbinihex proc near mov ch,4rotate: mov cl,4 rol bx,cl mov al,bl and al,0fh add al,30h cmp al,3ah jl printit add al,7hprinti

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 国内外标准规范

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号