Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

assembly lea: invalid effective address

Tags:

x86

assembly

nasm

I'm getting this kind of error:

beroset-p-637-invalid effective address

Here's a sample code block that contains the error line:

mov eax, 3
mov ebx, 0
lea ecx, [record + count*patient + firstName]          ;this one
int 80h

Here are my variables from the code block above:

patient equ 37
firstName equ 0

count resb 1
record resb patient*5

can't the count variable be used in multiplying with the patient?


I'm using NASM in x86 Ubuntu 13

like image 492
Kevin Lloyd Bernal Avatar asked Dec 11 '25 21:12

Kevin Lloyd Bernal


1 Answers

You can't multiply by a variable when computing an address. So you would have to multiply count * patient separately and add that in later.

like image 160
Eric Brown Avatar answered Dec 14 '25 00:12

Eric Brown



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!