我有我的代碼的一部分錯誤答案
mov di,3
mov cx,16
looop:
xor dx,dx
shl bx,1
adc dx,dx
cmp cx,16
je cx16 (it's will dec cx and jump loop)
push dx
dec cx
cmp cx,0
je cx0
mov ax,cx
div di
cmp dx,0
jne looop
當CX = 3
我會得到AX = 3
但div di
斧頭將成爲H = 55 L = 56
和dx = 1
請你能告訴我我在這裏做錯了什麼?
當我運行你的程序,'div di'後,我得到'al = 5,ah = 0,dx = 0'。我正在使用EMU8086。在'div di'之前,ax = 15(因爲cx是16,但是是'dec x'),'di = 3'和'dx = 0',所以,15/3 = 5. –
所以答案取決於機器? – BeGood
我忘了je cx16 will dec cx – BeGood