I am very new to MASM and assembly, and I am writing my first program. I am having trouble figuring out how to add two variables together and output the result. Here is part of my program so far:
INCLUDE Irvine32.inc
.data
firstNum DWORD ?
secondNum DWORD ?
sum DWORD ?
.code
main PROC
;Get Data
call ReadInt
mov firstNum, eax
call ReadInt
mov secondNum, ebx
;Calculate Sum
mov eax, firstNum
mov ebx, secondNum
add eax, ebx
mov sum, eax
;Display Results
mov eax, sum
call WriteDec
When I run this code, it outputs some long number "333420163" instead of what the sum should be, which is 7. I am still very new to this so if it's a simple answer I'm sorry haha. What am I doing wrong?