\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Mikael Peigney (Mika56)} \pdfinfo{ /Title (asm-8086.pdf) /Creator (Cheatography) /Author (Mikael Peigney (Mika56)) /Subject (ASM 8086 Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{74A839} \definecolor{LightBackground}{HTML}{F6F9F2} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{ASM 8086 Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Mikael Peigney (Mika56)} via \textcolor{DarkBackground}{\uline{cheatography.com/3808/cs/839/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Mikael Peigney (Mika56) \\ \uline{cheatography.com/mika56} \\ \uline{\seqsplit{gamersflag}.com/} \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 13th February, 2013.\\ Updated 11th May, 2016.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Registers}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{AX} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Accumulator; used to store some calculation results} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{BX} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Base; index register for MOVE} \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{CX} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Counter; count for string operations \& shifts} \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{DX} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Datas; port address for IN and OUT} \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{SP} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Points to top of stack} \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{BP} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Points to base of stack frame} \tn % Row Count 13 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{SI} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Points to a source in stream operations} \tn % Row Count 15 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{DI} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Points to a destination in stream operations} \tn % Row Count 17 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{CS} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Points to base of segment containing code} \tn % Row Count 19 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{DS} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Points to base of segment containing datas} \tn % Row Count 21 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{SS} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Points to base of segment containing the stack} \tn % Row Count 23 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{ES} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Points to base of an additionnal segment} \tn % Row Count 25 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{IP} \tn \mymulticolumn{1}{x{5.377cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Points to the next instruction to be run} \tn % Row Count 27 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \columnbreak \begin{tabularx}{5.377cm}{x{1.34379 cm} x{3.63321 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Loops}} \tn % Row 0 \SetRowColor{LightBackground} LOOP & Decrements CX and jumps to label if CX \textless{}\textgreater{} 0 \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} LOOPE LOOPZ & Decrements CX and jumps to label if CX \textless{}\textgreater{} 0 and ZF = 1 \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} LOOPNE LOOPNZ & Decrements CX and jumps to label if CX \textless{}\textgreater{} 0 and ZF = 0 \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} JCXZ & Jumps to label if CX = 0 \tn % Row Count 7 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\bf{Remember}}: Loops uses CX and ZF registers} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \columnbreak \begin{tabularx}{5.377cm}{x{1.19002 cm} x{2.10542 cm} x{1.28156 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Instructions}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Instruction}} & {\bf{Usage}} & {\bf{Example}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} MOV & Assigns value to register & MOV AX, 15h \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} ADD & Adds value to register & ADD AX, BX \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} SUB & Substracts value to register & SUB AX, 1 \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} AND & Executes binary AND operation & AND AL, 1101111b \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} OR & Executes binary OR operation & OR AL, BX \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} NOT & Executes binary NOT operation & NOT AL \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} XOR & Executes binary XOR operation & XOR AL, 01010101b \tn % Row Count 16 (+ 2) % Row 8 \SetRowColor{LightBackground} \seqsplit{SHL/SAL/SHR/SAR} & Shifts to the left or to the right. When arithmetic, the sign bit doesn't shift. Explused bit is stocked in CF & SHL AL, 1 / SAL AL, 2 \tn % Row Count 23 (+ 7) % Row 9 \SetRowColor{white} \seqsplit{ROL/RCL/ROR/RCR} & Rotates to the left or to the right, using or not CF & ROL AL, 1 / RCR AL, 2 \tn % Row Count 26 (+ 3) % Row 10 \SetRowColor{LightBackground} INC / DEC & Increments or decrements a value & INC AX / DEC BX \tn % Row Count 28 (+ 2) % Row 11 \SetRowColor{white} ADC / SBB & Does an addition or substraction of \textgreater{}16bits numbers, by storing restraint in CF & ADC AX, CX \tn % Row Count 33 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.19002 cm} x{2.10542 cm} x{1.28156 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Instructions (cont)}} \tn % Row 12 \SetRowColor{LightBackground} STC / CLS / CMC & Sets CF to 1, 0 or inverts it & STC \tn % Row Count 2 (+ 2) % Row 13 \SetRowColor{white} STD / CLD & Sets DF to 1 or 0 & STD \tn % Row Count 3 (+ 1) % Row 14 \SetRowColor{LightBackground} STI / CLI & Sets IF to 1 or 0 & CLI \tn % Row Count 4 (+ 1) % Row 15 \SetRowColor{white} MUL / IMUL / DIV / IDIV & Multiplies or divides two numbers and stores it to AX (+DX for most significant bit) & MOV AL, 0001Ah MUL 00002h \tn % Row Count 9 (+ 5) % Row 16 \SetRowColor{LightBackground} JMP & Jumps to a label & JMP calc \tn % Row Count 10 (+ 1) % Row 17 \SetRowColor{white} CMP & Performs a comparison & CMP AL, 01234b \tn % Row Count 12 (+ 2) % Row 18 \SetRowColor{LightBackground} PUSH / PUSHA / PUSHF & Pushes a data to SS:{[}SP{]} / all registers / FLAGS & PUSH 10h \tn % Row Count 15 (+ 3) % Row 19 \SetRowColor{white} POP / POPA / POPF & Restores fatas form SS:{[}SP{]} / all registers (except SP) / FLAGS & POP AX \tn % Row Count 19 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.19002 cm} x{1.92234 cm} x{1.46464 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Conditional jumps}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Instruction}} & {\bf{Description}} & {\bf{Condition}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} JA & Jump if Above & CF = 0 and ZF = 0 \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} JAE & Jump if Above or Equal & CF = 0 \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} JB & Jump if Below & CF = 1 \tn % Row Count 7 (+ 1) % Row 4 \SetRowColor{LightBackground} JBE & Jump if Below or Equal & CF = 1 or ZF = 1 \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} JC & Jump if Carry & CF = 1 \tn % Row Count 10 (+ 1) % Row 6 \SetRowColor{LightBackground} JE & Jump if Equal & ZF = 1 \tn % Row Count 11 (+ 1) % Row 7 \SetRowColor{white} JG & Jump if Greater & ZF = 0 and SF = OF \tn % Row Count 13 (+ 2) % Row 8 \SetRowColor{LightBackground} JGE & Jump if Greater of Equal & SF = OF \tn % Row Count 15 (+ 2) % Row 9 \SetRowColor{white} JL & Jump if Less & SF \textless{}\textgreater{} OF \tn % Row Count 16 (+ 1) % Row 10 \SetRowColor{LightBackground} JLE & Jump if Less or Equal & ZF = 1 or SF \textless{}\textgreater{} OF \tn % Row Count 18 (+ 2) % Row 11 \SetRowColor{white} JO & Jump if Overflow & OF = 1 \tn % Row Count 19 (+ 1) % Row 12 \SetRowColor{LightBackground} JP & Jump if Parity & PF = 1 \tn % Row Count 20 (+ 1) % Row 13 \SetRowColor{white} JPE & Jump if Parity Even & PF = 1 \tn % Row Count 22 (+ 2) % Row 14 \SetRowColor{LightBackground} JS & Jump if Sign & SF = 1 \tn % Row Count 23 (+ 1) % Row 15 \SetRowColor{white} JZ & Jump if Zero & ZF = 1 \tn % Row Count 24 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \columnbreak \begin{tabularx}{5.377cm}{x{1.12779 cm} x{0.8354 cm} x{1.00248 cm} x{1.21133 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Colors}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Decimal}} & {\bf{Hexa}} & {\bf{Binary}} & {\bf{Color}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} 0 & 00h & 0000b & Black \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} 1 & 01h & 0001b & Blue \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} 2 & 02h & 0010b & Green \tn % Row Count 5 (+ 1) % Row 4 \SetRowColor{LightBackground} 3 & 03h & 0011b & Colbalt blue \tn % Row Count 7 (+ 2) % Row 5 \SetRowColor{white} 4 & 04h & 0100b & Red \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} 5 & 05h & 0101b & Violet \tn % Row Count 9 (+ 1) % Row 7 \SetRowColor{white} 6 & 06h & 0110b & Brown \tn % Row Count 10 (+ 1) % Row 8 \SetRowColor{LightBackground} 7 & 07h & 0111b & Light grey \tn % Row Count 11 (+ 1) % Row 9 \SetRowColor{white} 8 & 08h & 1000b & Dark grey \tn % Row Count 12 (+ 1) % Row 10 \SetRowColor{LightBackground} 9 & 09h & 1001b & Light blue \tn % Row Count 13 (+ 1) % Row 11 \SetRowColor{white} 10 & 0Ah & 1010b & Light green \tn % Row Count 14 (+ 1) % Row 12 \SetRowColor{LightBackground} 11 & 0Bh & 1011b & Light cobalt \tn % Row Count 16 (+ 2) % Row 13 \SetRowColor{white} 12 & 0Ch & 1100b & Light red \tn % Row Count 17 (+ 1) % Row 14 \SetRowColor{LightBackground} 13 & 0Dh & 1101b & Light violet \tn % Row Count 19 (+ 2) % Row 15 \SetRowColor{white} 14 & 0Eh & 1110b & Yellow \tn % Row Count 20 (+ 1) % Row 16 \SetRowColor{LightBackground} 15 & 0Fh & 1111b & White \tn % Row Count 21 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}