(1) Z←W+(Z-X)
(2) Z←W-(X+8)-(R+9)
(3) Z←(W-X)/(5*Y)*2
(4) Z←(W*X)/(Y+7),R←余数
这道题我这样写对不对?
(1)MOV AX,X
SBB Z, AX
ADD Z, W
(2)MOV AX,X
ADD AX,8
SBB W, AX
MOV BX,R
ADD BX,9
SBB W,BX
MOV AX,Z
MOV AX,W
(3),(4)还没写出来.
我初学汇编,对指令不是很熟悉,我写的有错误的地方,还请帮忙指出来.谢谢!
2 个解决方案
#1
(1)
mov ax, Z
sub ax, X
add ax, W
mov Z, ax
(2)
mov ax, W
mov dx, X
add dx, 8
sub ax, dx
mov dx, R
add dx, 9
sub ax, dx
mov Z, ax
(3)
mov ax, 5
imul Y
mov cx, ax
mov ax, W
sub ax, X
cwd
idiv cx
shl ax, 1
mov Z, ax
(4)
mov ax, W
imul X
mov cx, Y
add cx, 7
idiv cx
mov Z, ax
mov R, dx
mov ax, Z
sub ax, X
add ax, W
mov Z, ax
(2)
mov ax, W
mov dx, X
add dx, 8
sub ax, dx
mov dx, R
add dx, 9
sub ax, dx
mov Z, ax
(3)
mov ax, 5
imul Y
mov cx, ax
mov ax, W
sub ax, X
cwd
idiv cx
shl ax, 1
mov Z, ax
(4)
mov ax, W
imul X
mov cx, Y
add cx, 7
idiv cx
mov Z, ax
mov R, dx
#2
同意LS的
#1
(1)
mov ax, Z
sub ax, X
add ax, W
mov Z, ax
(2)
mov ax, W
mov dx, X
add dx, 8
sub ax, dx
mov dx, R
add dx, 9
sub ax, dx
mov Z, ax
(3)
mov ax, 5
imul Y
mov cx, ax
mov ax, W
sub ax, X
cwd
idiv cx
shl ax, 1
mov Z, ax
(4)
mov ax, W
imul X
mov cx, Y
add cx, 7
idiv cx
mov Z, ax
mov R, dx
mov ax, Z
sub ax, X
add ax, W
mov Z, ax
(2)
mov ax, W
mov dx, X
add dx, 8
sub ax, dx
mov dx, R
add dx, 9
sub ax, dx
mov Z, ax
(3)
mov ax, 5
imul Y
mov cx, ax
mov ax, W
sub ax, X
cwd
idiv cx
shl ax, 1
mov Z, ax
(4)
mov ax, W
imul X
mov cx, Y
add cx, 7
idiv cx
mov Z, ax
mov R, dx
#2
同意LS的