x86 - Multiply 2 Values in Assembly Language 8086? -
i multiplying 2 values input console window. using 32 bit registers eax, ebx, not multiplying values. program running, not multiplying. can detect problem? wrong in code? using kip.r.irvine link libraries in assembly language.
here code:
include irvine32.inc .data inputvalue1st byte "input 1st integer = ",0 inputvalue2nd byte "input 2nd integer = ",0 outputsummsg byte "the sum of 2 integers = ",0 num1 dd ? num2 dd ? sum dd ? .code main proc ; here calling our procedures call inputvalues call multiplyvalue call outputvalue call crlf exit main endp inputvalues proc ;----------- 1st value-------- ; input message call crlf mov edx,offset inputvalue1st call writestring call readint ; read integer mov num1, eax ; store value ;-----------for 2nd value---------- ; output prompt message mov edx,offset inputvalue2nd call writestring call readint ; read integer mov num2, ebx ; store value ret inputvalues endp ;---------multiply---------------- multiplyvalue proc ; compute sum mov eax, num1 ; moves num1 eax mov ebx, num2 ; moves num2 ebx mul ebx ; num1 * num2 = 6 * 2 mov sum, eax ; val stored in ebx ret multiplyvalue endp ;--------for sum output result---------- outputvalue proc ; output result mov edx, offset outputsummsg call writestring mov eax, sum call writeint ; prints value in eax ret outputvalue endp end main
one more question: need use carry flag in it? if so, code like?
;mov eax, num1 ; moves num1 eax ;mov ebx, num2 ; moves num2 ebx
might little if load values registers rather comment should doing,
Comments
Post a Comment