0

I'm using nasm in 64 bits and I get this error:

error: invalid combination of opcode and operands

For this code:

cmp     BYTE [rdi + rax], BYTE [rsi + rax]
  • rdi is my first argument (char*)
  • rsi is my second argument (char *)
  • rax is my cursor

What is wrong in this line? How should I do this?

Thanks in advance!

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
nsvir
  • 8,781
  • 10
  • 32
  • 47
  • 1
    You have two memory operands, you must move one to a register first. Also, this question has a hundred duplicates, but I can't find a good one. For example http://stackoverflow.com/q/14510280/555045 (but that's about `mov`) – harold Mar 26 '14 at 12:04
  • Thanks! Which register should I use for that ? the third and fourth parameter's registers ? Sorry about duplicate post. It is very hard to find good answers. – nsvir Mar 26 '14 at 12:17
  • 1
    Whichever register you want to use. Doesn't really matter. Obviously not a register whose value you want to keep. – harold Mar 26 '14 at 12:21

0 Answers0