1、熟悉并掌握[BX] 和LOOP的使用;
2、掌握有多个段的程序编程、调试。
Dos编译器
1、 编程,向内存0:200~0:23F依次传送数据0~63(3FH)。
运行结果:
2、下面的程序的功能时将“mov ax,4c00h”之前的指令复制到内存0:200处,补全程序,上机调试,跟踪运行结果。
assume cs:code
code segment
mov ax, cs
mov ds,ax
mov ax,0020h
mov es,ax
mov bx,0
mov cx, 17h
s: mov al,[bx] ;
mov es:[bx],al
inc bx
loop s
mov ax,4c00h
int 21h
code ends
end
运行结果:
3、程序如下,编写code段中的代码,将a段和b段中的数据依次相加,将结果存到c段中。
assume cs:code
a segment
db 1,2,3,4,5,6,7,8
a ends
b segment
db 1,2,3,4,5,6,7,8
b ends
c segment
db 0,0,0,0,0,0,0,0
c segment
code segment
start: mov ax,a
mov ds,ax
mov ax,b
mov es,ax
mov bx,0
mov cx,8
s: mov al,es:[bx]
add [bx],al
inc bx
loop s
mov ax,c
mov es,ax
mov bx,0
mov cx,8
s0: mov ax,[bx]
mov es:[bx],ax
add bx,2
loop s0
mov ax,4c00h
int 21h
code ends
end start
运行结果:
4、程序如下,编写code段中的代码,用push 指令将a段中的钱8个字符型数据,逆序存储到b段中。
assume cs:code
a
dw 1,2,3,4,5,6,7,8,9,0ah,0bh,0ch,0dh,0eh,0fh,0ffh
a ends
b segment
dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
b ends
code segment
start: mov ax,a
mov ds,ax
mov ax,b
mov ss,ax
mov sp,10h
mov bx,0
mov cx,8
s: push [bx]
add bx,2
loop s
mov ax,4c00h
int 21h
code ends
end start
运行结果:
总是在sp的位置出错。害
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有