Why Does the lea dx, bp+variable Instruction Cause an A2049 Error in MASM?

  • Thread starter Thread starter beginnermoj
  • Start date Start date
  • Tags Tags
    Assembly Error
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 6K views
beginnermoj
Messages
1
Reaction score
0
when I use the instruction "lea dx,bp+variable" in my program, when compiling I get the following 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
 
Physics news on Phys.org
Just a guess, but try and switch them around.

dx,variable+bp

or brackets
dx,[variable+bp] ;or try
dx,[bp+variable]just a guess
 
What is that? Assembly language? Do people still program in Assembly??
 
DaveC426913 said:
What is that? Assembly language? Do people still program in Assembly??

I have a friend who uses code warrior to write assembly for the motorola family of micros, and swears by it. In the forum devoted to code warrior there are unending posts, so I'm told, about problems inherent in wedging the C language into a role for an application that is really about bit and register manipulation.
 
jmaat7 got it right, you just need brackets to indicate it's an address as opposed to an immediate value.

lea dx,[offset+bp]