Assembly 如何一次使用两个32位reg(32+;32=64)使其能够获取64位值?汇编语言8086

Assembly 如何一次使用两个32位reg(32+;32=64)使其能够获取64位值?汇编语言8086,assembly,x86,masm,irvine32,Assembly,X86,Masm,Irvine32,汇编语言8086: 我做了一个加法程序,它在控制台中取两个值,并给出结果。。它只能接受32位(8位)以下的值。如果我们给出更高的值,那么它将在控制台winbdow中给出整数溢出错误 如果我想在input1和input2中提供超过32位的值,我将如何做?可以通过制作DWORD(32位)数组并将一半(16位)值放入一半(16位)值来完成 例如: 阵列1 DWORD 2重复(?) 阵列2 DWORD 2重复(?) 我想使用32位寄存器将value1添加到value2,并给出64位以下的值(等于16位)

汇编语言8086:

我做了一个加法程序,它在控制台中取两个值,并给出结果。。它只能接受32位(8位)以下的值。如果我们给出更高的值,那么它将在控制台winbdow中给出整数溢出错误

如果我想在input1和input2中提供超过32位的值,我将如何做?可以通过制作DWORD(32位)数组并将一半(16位)值放入一半(16位)值来完成

例如:

阵列1 DWORD 2重复(?)

阵列2 DWORD 2重复(?)

我想使用32位寄存器将value1添加到value2,并给出64位以下的值(等于16位)。。可以使用2个reg的空格(32+32=64位)

我知道这是可能的,但我不知道怎么做…因为我是汇编语言新手

我正在使用汇编语言中的KIP.R.IRVINE链接库

我们将如何通过使用2 32位寄存器给出64位值?或者我们将如何使2 32位reg获得64位值? 我不知道如何为它编码..需要编码方面的帮助吗

以下是32位加法的代码:

INCLUDE Irvine32.inc
    ; In above i am calling KIP.R.IRVINE Link Library for assembly language

 .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
8086(以及我使用过的所有其他处理器)维护着一组“条件代码”,其中包括一个“进位”(这些引用的术语是为了让你在谷歌上搜索)


添加两个无符号32位量时,如果总数超过32位,则将设置进位。您可以添加任意数量的32位(或64位)数量,只要合并上一个加法的进位。

这是ADC指令PARSIFAL。如果我想给第一个值和第二个值的值超过32位,那么这是个问题。如果你需要在32位处理器上处理64位数字,而不是只允许32位数学的64位结果,那么你必须编写自己的数学函数在两个32位寄存器中使用64位。在非汇编世界中,有各种各样的“BigNum”库可以做到这一点。@MustafaHalai-这是一个怎样的问题?你读过条件代码吗?或者查看
ADC
操作的文档?(谢谢你,詹姆斯,我已经20多年没有编过8086了)任何人都可以投票:这是OP两天前提出的一个问题的翻版: