Please help me with assembly error A2049: Illegal use of register

In summary: This should workIn summary, when using the instruction "lea dx,bp+variable" in a program, there may be an error that occurs during compilation, specifically the "error A2049: Illegal use of register." This can potentially be solved by switching the order of the operands or using brackets to indicate an address. It is worth noting that programming in Assembly language can still be relevant and useful, as seen in the example of using Code Warrior for microcontroller applications.
  • #1
beginnermoj
1
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
 
Technology news on Phys.org
  • #2
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
 
  • #3
What is that? Assembly language? Do people still program in Assembly??
 
  • #4
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.
 
  • #5
jmaat7 got it right, you just need brackets to indicate it's an address as opposed to an immediate value.

lea dx,[offset+bp]
 

What is "Please help me with assembly error A2049: Illegal use of register"?

"Please help me with assembly error A2049: Illegal use of register" is an error that occurs when attempting to use a register in an assembly language program in a way that is not allowed by the syntax or rules of the language.

What causes assembly error A2049?

Assembly error A2049 is caused by attempting to use a register in a way that is not allowed by the assembly language syntax. This could include trying to use a reserved register or using the register in an incorrect format.

How do I fix assembly error A2049?

To fix assembly error A2049, you will need to review the assembly code and identify where the illegal use of the register is occurring. Then, you will need to correct the way the register is being used according to the syntax rules of the assembly language. This may involve using a different register or changing the format of the code.

Can assembly error A2049 be prevented?

Yes, assembly error A2049 can be prevented by carefully following the syntax rules of the assembly language and avoiding any illegal use of registers. It is also important to thoroughly test the code before running it to ensure there are no errors.

Is there any additional support available for fixing assembly error A2049?

If you are having trouble fixing assembly error A2049, you can seek help from online forums, forums specific to the assembly language you are using, or consult with a more experienced programmer. It may also be helpful to refer to the documentation or tutorial for the assembly language to better understand the syntax rules and proper use of registers.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
20
Views
3K
  • Programming and Computer Science
Replies
12
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
7
Views
6K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
2
Replies
39
Views
3K
  • Programming and Computer Science
Replies
32
Views
2K
Replies
6
Views
1K
  • Programming and Computer Science
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
Back
Top