我正在组装8086工作,我得错了答案;谁能猜出我的问题是什么?我想将一个单词乘以字节....这是我的代码:
STSEG SEGMENT
DB 64 DUP(?)
STSEG ENDS
;--------
DTSEG SEGMENT
D1 DW 6454H
D2 DB 44H
REPLY DW 2 DUP(?)
DTSEG ENDS
;--------
CDSEG SEGMENT
MAIN PROC FAR
ASSUME DS:DTSEG, SS:STSEG, CS:CDSEG
MOV AX,DTSEG
MOV DS,AX
MOV AX,0
MOV AL,D2
MOV BX,D1
MUL BL
MOV REPLY,AX
MOV REPLY+2,DX
MAIN ENDP
CDSEG ENDS
答案 0 :(得分:1)
您必须乘以BX
:
MOV AX,0
MOV AL,D2
MOV BX,D1
MUL BX ;◄■■ BX*AX = DX:AX.
MOV REPLY,AX
MOV REPLY+2,DX
答案 1 :(得分:1)
作为Jose的答案的替代方案并显示
xor reg, reg
这样:
xor ax, ax
mov al, D2
mul D1 <-- DX:AX = AX * D1
mov REPLY, ax
mov REPLY+2, dx