Use shift instructions to achieve al multiplied by 10 (without carry)

;用移位指令实现al乘10(不带进位)
;思路:乘法本质其实是加法,先利用二进制的位移指令进行一次乘8再加两次自己。
assume cs:code
code segment
start:	mov bl,al
        mov cl,3
        shl al,cl             ;左移三位,相当于*8
        add al,bl             ;已经乘过8了,再加一次自己相当于乘9 
        add al,bl			  ;再加一次自己就相当于乘10
		
		mov ax, 4c00H
		int 21H
code ends
end start
78 original articles published · Like 3 · Visits 5596

Guess you like

Origin blog.csdn.net/qq_43071318/article/details/105170067