Abstract:
One-page reference for Win32 assembly language programming.

Created 2 years ago by Peter Kankowski
Last changed 2 years ago
Filed under Assembly language and machine code

Reddit Digg Delicious Buzz Facebook Twitter

Win32 Assembly Cheat Sheet

The cheat sheet is intended for 32-bit Windows programming with FASM. One A4 page contains almost all general-purpose x86 instructions (except FPU, MMX and SSE instructions).

What is included

You will find various kinds of moves (MOV, CMOV, XCHG), arithmetical (ADD, SUB, MUL, DIV) and logical (AND, OR, XOR, NOT) instructions here. Several charts illustrate shifts (SHL/SHR, ROL/ROR, RCL/RCR) and stack frames. Code samples for typical high-level language constructs (if conditions, while and for loops, switches, function calls) are shown. Also included are quick references for RDTSC and CPUID instructions, description of string operations such as REP MOVSB, some code patterns for branchless conditions, a list of registers that should be saved in functions, and a lot of other useful stuff.

The idea is to put all reference information about x86 assembly language on the one page. Some rarely-used instructions such as LDS, BOUNDS or AAA are skipped.

Notation

The cheat sheet use common notation for operands: reg means register, [mem] means memory location, and imm is an immediate operand. Also, x, y, and z denote the first, the second, and the third operand. Instruction mnemonics are written in capital letters to make them easier to find when you are skipping through the cheat sheet.

Example

A chunk of cheat sheet showing multiplication and division reference

For example, let's look at multiplication and division section. There are instructions for signed (IMUL) and unsigned (MUL) multiplication. Both instructions take one operand, which may be register (reg) or memory ([mem]). There are three possible cases:

There are also two-operand and three-operand forms of IMUL shown on the figure above.

Other features of assembly language are described in a similar way.

Download

The cheat sheet is designed for A4 page size; if you print it on US Letter paper, you will get large margins. You can print the cheat sheet and put it on your table to look for some instructions when you forget them.

Download Win32 Assembly Cheat Sheet (PNG picture, 713 Kb)

17 comments

Ten recent comments are shown below. Show all comments

okasvi, 4 years ago
Hi,

Link is to Cheat Sheet is not working, I was going to download and print it to my friend, but no matter what I tried, it always redirected me to that the very same post.
Peter Kankowski, 4 years ago
Oh, yes, sorry. It should work now.
Peter Kankowski, 4 years ago
I found two similar papers:
* Intel Assembler x86 CodeTable lists popular x86 instructions on two pages. It also includes a diagram of the registers and a simple 16-bit program.
* New complete x86 and x87 reference consists of a large table with opcode, description, and modified flags for each instruction. It is intended for both on-screen viewing and printing.
victor, 4 years ago
I've just entered this new world and I found everything fantastic!
Peter Kankowski, 4 years ago
Thank you for kind words, Victor, and - welcome to SmallCode. If you will have any questions, comments, or suggestions, please don't hesitate to post them.
Bbar, 3 years ago
A OOP VB programmer? Wow, I wouldn't tell anyone that!
static_cast(double_var); « blog, 3 years ago
[...] A subtração de valores 64 bits eu tirei daqui: http://smallcode.weblogs.us/2006/05/09/win32-assembly-cheat-sheet/ */ sub eax, dword ptr [ebp-8]; sbb edx, dword ptr [...]
ken, 2 years ago
excellent cheat sheet. thank you very much!
nairam, 2 years ago
Hello. All is A4 format:

x86 registers:
http://www.nairam.sk/pc01.pdf

x86 instructions:
http://www.nairam.sk/pc03.pdf

http://www.nairam.sk/pc05.pdf
Peter Kankowski, 2 years ago
Thank you! I cannot read Slovak, but your charts seem to be good for learning assembly language.
Your name:
Comment: