\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{Artem Katrusha (Don Pengu1no)} \pdfinfo{ /Title (tasm.pdf) /Creator (Cheatography) /Author (Artem Katrusha (Don Pengu1no)) /Subject (TASM 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}{2492A3} \definecolor{LightBackground}{HTML}{F1F8F9} \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{TASM Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Artem Katrusha (Don Pengu1no)} via \textcolor{DarkBackground}{\uline{cheatography.com/43841/cs/13014/}}} \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}Artem Katrusha (Don Pengu1no) \\ \uline{cheatography.com/don-pengu1no} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 3rd October, 2017.\\ Updated 3rd October, 2017.\\ 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}{p{0.74655 cm} x{4.23045 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Эквивал. и присваивание}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{EQU}} & `\textless{}имя\textgreater{} EQU \textless{}операнд\textgreater{}` \{\{nl\}\} Возможны три основных способа задания операнда: \{\{nl\}\} 1) Операнд - константное выражение; \{\{nl\}\} 2) Операнд - имя. В данном случае эти имена являются {\emph{синонимами}}; \{\{nl\}\} 3) Операнд - произвольный текст, не являющийся именем или константным выражением. \tn % Row Count 14 (+ 14) % Row 1 \SetRowColor{white} {\bf{=}} & `\textless{}имя\textgreater{} = \textless{}константное выражение\textgreater{}` \{\{nl\}\} В отличие от констант, определенных в {\bf{EQU}}, данная константа может изменять значение. Также с помощью {\bf{=}} можно определить только числовую константу. \tn % Row Count 24 (+ 10) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{\{\{noshy\}\}Если переменные описываются директивами {\bf{DB}}, {\bf{DW}}, {\bf{DD}}, то константы - с помощью директивы {\bf{EQU}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Задание массива}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{\{\{noshy\}\}`a DB 0, 0, 0, 0, 0, 0, 0, 0, 0, 0` \newline % Row Count 1 (+ 1) Может \seqsplit{использоваться} при создании массивов. В данном случае {\emph{a}} хранит адрес первого из 10-ти байт. \newline % Row Count 5 (+ 4) Эту директиву можно записать иначе: \newline % Row Count 7 (+ 2) `a DB 10 DUP (0)` \newline % Row Count 8 (+ 1) Данная конструкция в общем случае имеет вид: \newline % Row Count 10 (+ 2) `n DUP (P1, P2, .., Pk)`, например \newline % Row Count 11 (+ 1) `a DB 4 DUP (1, 2)` создаст \seqsplit{последовательность} `1, 2, 1, 2, 1, 2, 1, 2`% Row Count 13 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Метки}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Существует несколько способов задания метки. На данный момент рассмотрим один из них: `\textless{}имя метки\textgreater{}:` \newline % Row Count 4 (+ 4) Например, для создания метки {\emph{my\_label}} нужно прописать `my\_label:` и команды, выполняемые после перехода по данной метке.% Row Count 9 (+ 5) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.74655 cm} x{4.23045 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{\seqsplit{Арифметические} команды}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{ADD}} & `ADD a, b` \{\{nl\}\} Прибавляет к значению {\emph{a}} значение {\emph{b}}. Результат хранится в {\emph{a}}. \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} {\bf{SUB}} & `SUB a, b` \{\{nl\}\} Вычитает из значения {\emph{a}} значение {\emph{b}}. Результат хранится в {\emph{a}}. \tn % Row Count 8 (+ 4) % Row 2 \SetRowColor{LightBackground} {\bf{MUL}} & `MUL a` \{\{nl\}\} Данная команда умножает содержимое регистра {\emph{ax}} на {\emph{a}}. \tn % Row Count 12 (+ 4) % Row 3 \SetRowColor{white} {\bf{DIV}} & `DIV a` \{\{nl\}\} Аналогично {\bf{MUL}}, использует один операнд. После выполнения деления, {\emph{частное}} хранится в {\emph{ax}}, а остаток - в {\emph{dx}}. \tn % Row Count 19 (+ 7) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\emph{ {\bf{Примечание}} }} \newline Для {\bf{ADD}} и {\bf{SUB}} доступны следующие формы: \newline Регистр - Регистр; Регистр - Память; Регистр - Значение; Память - Значение; Память - Регистр. \newline \newline Для {\bf{MUL}} и {\bf{DIV}} операнд должен находиться в регистре или в памяти.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.74655 cm} x{4.23045 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Условный переход}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{CMP}} & `CMP a, b` \{\{nl\}\} Сравнивает {\emph{a}} и {\emph{b}}, но не записывает результат. Вместо этого изменяются значения флагов. \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} {\bf{JG}} & `JG lbl` \{\{nl\}\} {\bf{J}}ump {\bf{G}}reater \{\{nl\}\} Флаговые условия: {\emph{ZF}}=0 и {\emph{SF}}=OF \{\{nl\}\} \tn % Row Count 9 (+ 3) % Row 2 \SetRowColor{LightBackground} {\bf{JGE}} & `JGE lbl` \{\{nl\}\} {\bf{J}}ump {\bf{G}}reater or {\bf{E}}qual \{\{nl\}\} Флаговые условия: {\emph{SF}}=OF \tn % Row Count 12 (+ 3) % Row 3 \SetRowColor{white} {\bf{JL}} & `JL lbl` \{\{nl\}\} {\bf{J}}ump {\bf{L}}ess \{\{nl\}\} Флаговые условия: {\emph{SF}}≠OF \tn % Row Count 15 (+ 3) % Row 4 \SetRowColor{LightBackground} {\bf{JLE}} & `JLE lbl` \{\{nl\}\} {\bf{J}}ump {\bf{L}}ess or {\bf{E}}qual \{\{nl\}\} Флаговые условия: {\emph{ZF}}=1 или {\emph{SF}}≠OF \tn % Row Count 19 (+ 4) % Row 5 \SetRowColor{white} {\bf{JE}} & `JE lbl` \{\{nl\}\} {\bf{J}}ump {\bf{E}}qual \{\{nl\}\} Флаговые условия: {\emph{ZF}}=1 \tn % Row Count 22 (+ 3) % Row 6 \SetRowColor{LightBackground} {\bf{JNE}} & `JNE lbl` \{\{nl\}\} {\bf{J}}ump {\bf{N}}ot {\bf{E}}qual \{\{nl\}\} Флаговые условия: {\emph{ZF}}=0 \tn % Row Count 25 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{{\emph{ {\bf{Примечание}} }} \newline {\bf{CMP}} расставляет указанные флаги \seqsplit{автоматически}.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.64701 cm} x{4.32999 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Определение данных}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{DB}} & {\bf{D}}efine {\bf{B}}yte \{\{nl\}\} `\textless{}имя\textgreater{} DB \textless{}операнд\textgreater{} \{, \textless{}операнд\textgreater{}\}` \{\{nl\}\} В памяти выделяется {\emph{один}} байт (для {\emph{каждого}} операнда). \{\{nl\}\} Константное выражение может иметь значение в диапазоне -128..255 \tn % Row Count 9 (+ 9) % Row 1 \SetRowColor{white} {\bf{DW}} & {\bf{D}}efine {\bf{W}}ord \{\{nl\}\} `\textless{}имя\textgreater{} DW \textless{}операнд\textgreater{} \{, \textless{}операнд\textgreater{}\}` \{\{nl\}\} В памяти выделяется {\emph{два}} байта (для {\emph{каждого}} операнда). \{\{nl\}\} Константное выражение может иметь значение в диапазоне -32768..65535 \tn % Row Count 19 (+ 10) % Row 2 \SetRowColor{LightBackground} {\bf{DD}} & {\bf{D}}efine {\bf{D}}ouble \{\{nl\}\} `\textless{}имя\textgreater{} DB \textless{}операнд\textgreater{} \{, \textless{}операнд\textgreater{}\}` \{\{nl\}\} В памяти выделяется {\emph{четыре}} байта (для {\emph{каждого}} операнда) \tn % Row Count 25 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{5.377cm}}{Первому из операндов \seqsplit{присваивается} {\emph{имя}}, по которому можно ссылаться на этот({\emph{-и}}) байт({\emph{ы}}). Существует два основных способа задания операндов: \newline 1) Константное выражение \newline 2) ? - \seqsplit{неопределенное} значение} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Безусловный переход}} \tn \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{Безусловный переход — это переход, который выполняется всегда. Безусловный переход \seqsplit{осуществляется} с помощью команды {\bf{JMP}}. У этой команды один операнд, который может быть \seqsplit{непосредственным} адресом (меткой), регистром или ячейкой памяти, содержащей адрес. \newline % Row Count 10 (+ 10) `JMP label`- осуществлеие безусловного перехода к метке {\emph{label}}% Row Count 13 (+ 3) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}