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
AI Thread Summary
The discussion centers on an error encountered when using the instruction "lea dx,bp+variable" in assembly language, specifically an "error A2049: Illegal use of register." The user seeks help to resolve this issue. Suggestions for fixing the error include using brackets to indicate an address rather than an immediate value, such as "lea dx,[bp+variable]" or "lea dx,[offset+bp]." The conversation also touches on the relevance of assembly language today, with mentions of tools like CodeWarrior for programming in assembly for specific microcontrollers. Overall, the key takeaway is the importance of proper syntax in assembly language to avoid compilation errors.
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
 
Technology 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]
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Replies
4
Views
2K
Replies
1
Views
2K
Replies
9
Views
4K
Replies
6
Views
6K
Replies
13
Views
6K
Replies
4
Views
5K
Back
Top