计算 c = ((22-7)/5)*113 的汇编 8086 程序
嗨,我真的不知道这是如何工作的,
data segment
db 22
db 7
db 5
db 113
data ends
code segment
assume cs:code,ds:data
start:mov si,500H
mov di,1500H
mov ah,0
mov al,22
cbw
sub ax,7
mov cx,5
idiv cx
mov bx,113
imul bx
mov dl,ax
mov [di],al
code ends
end start
我真的不知道这个程序发生了什么,所以任何帮助将不胜感激
hi i really have no idea how this is working
data segment
db 22
db 7
db 5
db 113
data ends
code segment
assume cs:code,ds:data
start:mov si,500H
mov di,1500H
mov ah,0
mov al,22
cbw
sub ax,7
mov cx,5
idiv cx
mov bx,113
imul bx
mov dl,ax
mov [di],al
code ends
end start
i really don't know what's going on in this program so any help would be appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一般来说,代码看起来不正确。但无论如何,让我们回顾一下主要部分:
数据段
- 声明将用于计算的 3 个字节的数据(但不幸的是根本没有使用)。db
- 是字节声明(与 dw - d eclare w ord 相比,...)代码段
- 声明程序代码完全从那里开始执行计算,您只需要执行以下操作:
In general code not looks correct. But anyway let's review main parts:
data segment
- declares 3 bytes of data that would be used for calc (but unfortunately doesn't used at all).db
- is declaration of byte (compare with dw - d eclare w ord, ...)code segment
- declares that program code starts theretotally for perform calculation you need only following:
以下是一些有用的提示:
mov dst, src
将 src 复制到 dest操作数 *dst *, src
对 src 和 dest 执行操作数,并将结果复制到 dest。例如,sub ax, 7
计算ax - 7
并将结果放入ax
中。idiv src
将 src 乘以 ax,并将结果放入 ax。imul
对乘法执行相同的操作。这应该足以让您开始。
Here are some useful tips:
mov dst, src
copies the src into the destoperand *dst*, src
performs the operand on the src and the dest and copies the result into the dest. For instance,sub ax, 7
calculatesax - 7
and puts the result inax
.idiv src
multiplies the src by ax, and puts the result in ax.imul
does the same with multiplication.This should be enough to get you started.
简单的:
Simple: