汇编语言检测点14.2详细解析
建议先自己思考问题的答案,不懂则返回看书
编程,用加法和移位指令计算(ax) = (ax) * 10
提示:(ax)* 10 = (ax)* 2 + (ax)* 8
乘以2即左移一位,乘以8即左移三位
assume cs:code
code segment
start:
mov ax,10
mov bx,ax
shl ax,1
mov cl,3
shl bx,cl
add ax,bx
mov ax,4c00h
int 21h
code ends
end start
此代码在DOSBox下的运行结果截图:(ax复制为0AH,结果ax=0064H=100)