The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: alex on May 29, 2010, 10:30:50 PM

Title: please help me with assembly error A2049: Illegal use of register
Post by: alex on May 29, 2010, 10:30:50 PM
when I use "lea dx,bp+variable" in my program, when compiling I get this error: " error A2049: Illegal use of register"
this is a section of my program:
pop bp
sub bp,107h
mov ah,4eh
lea dx,bp+file_inf    ;this is the line that I have error
mov cx,0000h
int 21h

what can I do to solve this error? please some one help me!
I used masm 5.1 and also masm 611
Title: Re: please help me with assembly error A2049: Illegal use of register
Post by: jj2007 on May 29, 2010, 10:34:03 PM
You need brackets...
lea dx, [bp+file_inf]

Welcome to the forum :thumbu
Title: Re: please help me with assembly error A2049: Illegal use of register
Post by: dedndave on May 29, 2010, 11:19:52 PM
yes - welcome to the forum, Alex   :U

matter of personal taste - i think it looks nicer like ths
        lea     dx,file_inf[bp]

the assembler will generate the same code, either way