
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Typology: Cheat Sheet
1 / 1
This page cannot be seen from the preview
Don't miss anything!
Instruction Effect Examples Copying Data mov dest,src Copy src to dest mov eax, mov eax,[2000] Arithmetic add dest , src dest = dest + src add esi, sub dest , src dest = dest – src sub eax, ebx mul reg edx:eax = eax * reg mul esi div reg edx = edx:eax mod reg eax = edx:eax reg div edi inc dest Increment destination inc eax dec dest Decrement destination dec word [0x1000] Function Calls call label Push eip, transfer control call format_disk ret Pop eip and return ret push item Push item (constant or register) to stack. I.e.: esp=esp-4; memory[esp] = item push dword 32 push eax pop [reg] Pop item from stack and store to register I.e.: reg=memory[esp]; esp=esp+ pop eax Bitwise Operations and dest, src dest = src & dest and ebx, eax or dest,src dest = src | dest or eax,[0x2000] xor dest, src dest = src ^ dest xor ebx, 0xfffffff shl dest,count dest = dest << count shl eax, 2 shr dest,count dest = dest >> count shr dword [eax], Conditionals and Jumps cmp b,a Compare b to a; must immediately precede any of the conditional jump instructions cmp eax, je label Jump to label if b == a je endloop jne label Jump to label if b != a jne loopstart jg label Jump to label if b > a jg exit jge label Jump to label if b > a jge format_disk jl label Jump to label if b < a jl error jle label Jump to label if b < a jle finish test reg,imm Bitwise compare of register and constant; should immediately precede the jz or jnz instructions test eax,0xffff jz label Jump to label if bits were not set (“zero”) jz looparound jnz label Jump to label if bits were set (“not zero”) jnz error jmp label Unconditional relative jump jmp exit jmp reg Unconditional absolute jump; arg is a register jmp eax Miscellaneous nop No-op (opcode 0x90) nop hlt Halt the CPU hlt Instructions with no memory references must include ‘byte’, ‘word’ or ‘dword’ size specifier. Arguments to instructions: Note that it is not possible for both src and dest to be memory addresses. Constant (decimal or hex): 10 or 0xff Fixed address: [200] or [0x1000+53] Register: eax bl Dynamic address: [eax] or [esp+16] 32-bit registers: eax, ebx, ecx, edx, esi, edi, ebp, esp (points to first used location on top of stack) 16-bit registers: ax, bx, cx, dx, si, di, sp, bp 8-bit registers: al, ah, bl, bh, cl, ch, dl, dh