Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. May 29, 2010 #1
    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
  2. jcsd
  3. May 29, 2010 #2
    Just a guess, but try and switch them around.


    or brackets
    dx,[variable+bp] ;or try

    just a guess
  4. May 29, 2010 #3


    User Avatar
    Gold Member

    What is that? Assembly language? Do people still program in Assembly??
  5. May 30, 2010 #4
    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.
  6. May 30, 2010 #5


    User Avatar
    Homework Helper

    jmaat7 got it right, you just need brackets to indicate it's an address as opposed to an immediate value.

    lea dx,[offset+bp]
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook