码迷,mamicode.com
首页 > 其他好文 > 详细

汇编实验四

时间:2018-11-18 21:07:43      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:.com   nbsp   bsp   反汇编   bubuko   end   http   链接   编译   

1. 综合使用 loop,[bx],编写完整汇编程序,实现向内存 b800:07b8 开始的连续 16 个 字单元重复填充字数据0403H。 

源代码为

assume cs:code
code segment
mov dx, 0b800h
mov ds, dx
mov bx, 07b8h

mov cx, 16
s: mov [bx], 0403h
loop s

mov ax, 4c00h
int 21h
code ends
end

技术分享图片

技术分享图片

接着同样的操作。查看内存单元

技术分享图片

为什么不是0403。。自己查不出来。

(2)写入代码

assume cs:code
code segment
mov ax, 0020h
mov ds, ax
mov bx, 0

mov cx, 64
s: mov [bx], bx
inc bx
loop s

mov ax, 4c00h
int 21h
code ends
end

编译,链接

技术分享图片

debug调试,反汇编,单步执行

技术分享图片

技术分享图片

 技术分享图片

查看程序运行后的内存单元

技术分享图片

 

(3)代码

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

编译,链接,debug

技术分享图片

由题要 将mov ax, 4c00h之前的指令复制到内存中 所以第二空填17h

第一空是因为复制指令

总结:loop和[bx]的组合可以实现很多复杂的操作,loop的循环槽操作也是非常的方便滴。

汇编实验四

标签:.com   nbsp   bsp   反汇编   bubuko   end   http   链接   编译   

原文地址:https://www.cnblogs.com/LANBABA/p/9979253.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!