I finished reading PC Assembly Language and I was working on an implementation of RC4 encryption in Assembly. What I can't comprehend is why
mov eax, [edx+ecx]
works but
mov eax, [edx-ecx]
doesn't. The inline assembler gives me this error message,
non-constant expression in 'second operand'
What does that mean? Thanks in advance.
The following gives a good summary of x86 addressing modes. Note that there is no "register minus register" form: Wikipedia.
As a workaround, you could negate the contents of ecx
then use [edx+ecx]
(you may have to negate it back if you need the original value afterwards).