title: Assembly Language 8086 add using 32 bit reg & give value in 64bit?
body: <p>I want to <strong>add</strong> value1 to value2 by using 32bit register and give the value under 64bit(equals to 16 digits). Is it possible to use the space of 2 registers (32+32 = 64bit)? I think it can be done by using <strong>PTR</strong>  <strong>OPERATOR</strong> but I don't know how to use PTR Instruction.</p>
  
  <p>I have made the program for addition. It takes two values in console and gives us the result. It can only take a value under <strong>32 bits(8 digits)</strong>. If we give a higher value then it will give an error of integer overflow in console.</p>
  
  <p>I am using KIP.R.IRVINE Link Libraries in Assembly Language</p>
  
  <p>How we will give a 64bit value by using 32bit registers? How do we enable 32bit registers to take a 64bit value?</p>
  
  <p>Here is the code for the 32-bit addition</p>
  
  <pre><code>INCLUDE Irvine32.inc
  
  .data
  
  Addition BYTE "A: Add two Integer Numbers", 0
  
  inputValue1st BYTE "Input the 1st integer = ",0
  inputValue2nd BYTE "Input the 2nd integer = ",0
  
   outputSumMsg BYTE "The sum of the two integers is = ",0
  
   num1 DD ?
   num2 DD ?
   sum  DD ?
  
   .code
  
   main PROC
  
  ;----Displays addition Text-----
  
  mov edx, OFFSET Addition
  call WriteString
  call Crlf
  ;-------------------------------
  
  ; calling procedures here
  
  call InputValues
  call addValue
  call outputValue
  
  call Crlf
  
  jmp exitLabel
  
  
  main ENDP
  
  
  ; the PROCEDURES which i have made is here
  
  
  InputValues PROC
  ;----------- For 1st Value--------
  
  
  call Crlf
  mov edx,OFFSET inputValue1st ; input text1
  call WriteString
  
  ; here it is taking 1st value
  call ReadInt    ; read integer
  mov num1, eax   ; store the value
  
  
  
  
  ;-----------For 2nd Value----------
  
  
  
  mov edx,OFFSET inputValue2nd ; input text2
  call WriteString
  
  
  ; here it is taking 2nd value
  call ReadInt    ; read integer
  mov num2, eax   ; store the value
  
  ret
  InputValues ENDP
  
  
  
  
  ;---------Adding Sum----------------
  
  addValue PROC
  ; compute the sum
  
  mov eax, num2  ; moves num2 to eax
  add eax, num1  ; adds num2 to num1
  mov sum, eax   ; the val is stored in eax
  
  ret
  addValue ENDP
  
  ;--------For Sum Output Result----------
  
  outputValue PROC
  
  ; output result
  
  mov edx, OFFSET outputSumMsg ; Output text
  call WriteString
  
  
  mov eax, sum
  call WriteInt ; prints the value in eax
  
  
  ret
  outputValue ENDP
  
  
  exitLabel:
  exit
  
  
  END main
  </code></pre>