彙編語言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
這是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