Last active
September 23, 2015 23:36
-
-
Save boloutaredoubeni/b904062f11756a868ed9 to your computer and use it in GitHub Desktop.
Instruction operands and the equivalents in C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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