Skip to content

Instantly share code, notes, and snippets.

@boloutaredoubeni
Last active September 23, 2015 23:36
Show Gist options
  • Select an option

  • Save boloutaredoubeni/b904062f11756a868ed9 to your computer and use it in GitHub Desktop.

Select an option

Save boloutaredoubeni/b904062f11756a868ed9 to your computer and use it in GitHub Desktop.
Instruction operands and the equivalents in C
int main() {
/*
* Immediate
*/
// mov eax,42
int eax = 42;
// imul ebx,11h
int ebx *= 0x11;
// xor d1, 55h
int d1 ^= 0x55;
// add esi,8
int esi += 8;
/*
* Register
*/
// mov eax,ebx
eax = ebx;
int ecx(0);
// inc ecx
ecx += 1;
// add ebx, esi
ebx += esi
// mul ebx
int edx_eax = eax * ebx;
/*
* Memory
*/
// mov eax,[ebx]
eax = *ebx;
// add eax,[val1]
int val(0);
eax += *val1;
// or ecx,[ebx+esi]
ecx |= *(ebx+esi);
// sub word ptr [edi],12
*(short*)edi -= 12;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment