Reputation: 2881
Here is my code fragment:
.data
Num1 equ 40h
Num2 equ 41h
Var1 dword 0
Var2 dword 0
;----------------------------------------------------------------------
align 4
.code ;insert executable instructions below
main PROC ;program execution begins here
mov Var1, Num1
mov Var2, Num2
add Var1, Var2
I am trying to use the ADD instruction but I get the following error:
error A2070: invalid instruction operands
This error is related to the ADD line. If I omit that line the program runs fine.
Upvotes: 2
Views: 5921
Reputation: 231
You can't add two memory location to each other, you should use one of the registers as a second operand
.data
Num1 equ 40h
Num2 equ 41h
;----------------------------------------------------------------------
align 4
.code ;insert executable instructions below
main PROC ;program execution begins here
mov ax, Num2
add ax, Num1
Upvotes: 2