我们如何使用两个32位寄存器(32 + 32 = 64)来使其能够读取64位值?汇编语言8086
问题描述:
汇编语言8086:我们如何使用两个32位寄存器(32 + 32 = 64)来使其能够读取64位值?汇编语言8086
我必须做一个计划,除了需要在控制台的两个值,给我们造成..如果我们给予较高的就只能采取下32位(8位数字)值价值然后它会给控制台winbdow整数溢出错误..
如果我想给更多,然后在输入1和输入2的32位值我会怎么做呢?它可通过使DWORD(32位)的阵列来实现,并把半(16位)的一半(16位)值
例如:(?)
ARRAY1 DWORD 2 DUP
数组2 DWORD 2 DUP(?)
我希望通过使用32位寄存器将value1添加到value2,并给出64位(等于16位)以下的值..可以使用2 reg(32 + 32 = 64位) ?...
我们如何使32位的2寄存器,使其64位我知道这是可能的,但我不知道该怎么做...因为我是新的汇编语言
我正在使用KIP.R.IRVINE链接汇编程序库语言
我们将如何使用2 32位寄存器给予64位值?或者我们如何让2位32位寄存器取得64位的值? 我不知道如何为it..need帮助编码
这里代码是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(我已经使用和所有其他处理器)保留一组“条件代码”,其中包括“携带位”(这些引用的条款适用于您的Google搜索快感)。
当您添加两个无符号的32位数量时,如果总数超过32位,则进位位将被置位。您可以随意添加多达32位(或64位)数量,只要您将前一个添加的进位位合并即可。
这是ADC指令 – James 2013-04-22 19:44:12
Parsifal.if我想给第一个值和第二个值超过32位..然后它是一个问题.. – 2013-04-22 20:16:45
如果你需要在32位处理器上使用64位数字,而不是只允许64bit结果来自32bit数学,那么你必须编写所有你自己的数学函数,在两个32位寄存器中吃64bit。在不汇编的世界里有各种各样的“BigNum”库。 – 2013-04-22 21:31:34