I try to do (a+b)/2 mathematic formula.. i try to modify dis addition code.. how??
include \masm32\include\masm32rt.inc
.data?
var1 dd ?
var2 dd ?
.code
start:
mov var1,sval(input("First Number: "))
mov var2,sval(input("Second Number: "))
mov eax,var1
add eax,var2
print ustr$(eax),13,10
inkey
exit
end start
mov eax,var1
add eax,var2
shr eax,1
well - the next problem in the book will be to show the remainder or divide by 3 or something - lol
mov eax,var1
add eax,var2
mov ecx,2
mov edx,0
div ecx
;EAX = quotient, EDX = remainder
Quote from: dedndave on May 14, 2012, 05:05:58 PM
well - the next problem in the book will be to show the remainder or divide by 3 or something - lol
mov eax,var1
add eax,var2
mov ecx,2
mov edx,0
div ecx
;EAX = quotient, EDX = remainder
should the edx always be initial to 0 , i test
movzx eax,[ebx].xorigin
mul lPixel ;word
mov edx,eax
push edx
movzx eax,[ebx].yorigin
mul spw ;dword
pop edx
add edx,eax
if i didn't push/pop edx ,it will be flushed to 0
so if no initialization was made on edx in div,
i think the edx will also be flushed to 0 if the reminder is happen to 0
EDX does not need to be initialized for MUL
it does need to be initialized when using DIV with a 32-bit operand
Quote from: dedndave on May 20, 2012, 11:33:25 PM
EDX does not need to be initialized for MUL
it does need to be initialized when using DIV with a 32-bit operand
got it