Restyle tables using booktabs

This commit is contained in:
Camden Dixie O'Brien 2024-11-09 11:29:37 +00:00
parent 08f7aa05c2
commit 22d14797eb

195
main.tex
View File

@ -1,9 +1,9 @@
\documentclass[a4paper,twocolumn]{article} \documentclass[a4paper,twocolumn]{article}
\usepackage{booktabs}
\usepackage{baskervald} \usepackage{baskervald}
\usepackage{courierten} \usepackage{courierten}
\usepackage{cuted} \usepackage{cuted}
\usepackage[margin=2cm]{geometry}
\usepackage{helvet} \usepackage{helvet}
\usepackage{mathtools} \usepackage{mathtools}
\usepackage{sectsty} \usepackage{sectsty}
@ -27,96 +27,125 @@
\section{Instructions} \section{Instructions}
\begin{tabularx}{\colwidth}{|>{\ttfamily}l|>{$}X<{$}|} \noindent\begin{tabularx}{\colwidth}{>{\ttfamily}l>{\ttfamily}l>{$}X<{$}}
\hline \toprule
add \ S,D & D \leftarrow S + D \\ \hline \multicolumn{3}{>{\sffamily\bfseries}c}{Arithmetic \& Logic} \\
sub \ S,D & D \leftarrow D - S \\ \hline \midrule
neg \ D & D \leftarrow -D \\ \hline add & S,D & D \leftarrow S + D \\
inc \ D & D \leftarrow D + 1 \\ \hline sub & S,D & D \leftarrow D - S \\
dec \ D & D \leftarrow D - 1 \\ \hline neg & D & D \leftarrow -D \\
imul S,D & D \leftarrow S \times D \\ \hline inc & D & D \leftarrow D + 1 \\
idiv S & \mathtt{rax} \leftarrow \lfloor\mathtt{rdx}:\mathtt{rax} \div S\rfloor \\ dec & D & D \leftarrow D - 1 \\
& \mathtt{rdx} \leftarrow (\mathtt{rdx}:\mathtt{rax})\mod{S} \\ \hline imul & S,D & D \leftarrow S \times D \\
\hline idiv & S & \mathtt{rax} \leftarrow \lfloor\mathtt{rdx}:\mathtt{rax} \div S\rfloor \\
and S,D & D \leftarrow S \mathbin{\&} D \\ \hline & & \mathtt{rdx} \leftarrow (\mathtt{rdx}:\mathtt{rax})\mod{S} \\
or \ S,D & D \leftarrow S \mathbin{|} D \\ \hline and & S,D & D \leftarrow S \mathbin{\&} D \\
xor S,D & D \leftarrow S \wedge D \\ \hline or & S,D & D \leftarrow S \mathbin{|} D \\
not D & D \leftarrow \mathord{\sim} D \\ \hline xor & S,D & D \leftarrow S \wedge D \\
sal n,D & D \leftarrow D \ll n \\ \hline not & D & D \leftarrow \mathord{\sim} D \\
shr n,D & D \leftarrow D \gg n \hspace{1em} \textrm{(logical)} \\ \hline sal & n,D & D \leftarrow D \ll n \\
sar n,D & D \leftarrow D \gg n \hspace{1em} \textrm{(arithmetic)} \\ \hline shr & n,D & D \leftarrow D \gg n \hspace{1em} \textrm{(logical)} \\
\hline sar & n,D & D \leftarrow D \gg n \hspace{1em} \textrm{(arithmetic)} \\
lea S,D & D \leftarrow \mathrm{addressof}(S) \\ \hline \midrule
mov S,D & D \leftarrow S \\ \hline \multicolumn{3}{>{\sffamily\bfseries}c}{Data transfer} \\
\hline \midrule
cmp \ A,B & B - A \hspace{1em} \textrm{(setting cond. flags)} \\ \hline lea & S,D & D \leftarrow \mathrm{addressof}(S) \\
test A,B & A \mathbin{\&} B \hspace{1em} \textrm{(setting cond. flags)} \\ \hline mov & S,D & D \leftarrow S \\
\hline \midrule
jmp l & \textrm{jump unconditionally} \\ \hline \multicolumn{3}{>{\sffamily\bfseries}c}{Conditionals \& Branches} \\
je \ l & \textrm{jump if equal} \\ \hline \midrule
jne l & \textrm{jump if not equal} \\ \hline cmp & A,B & B - A \hspace{1em} \textrm{(setting cond. flags)} \\
js \ l & \textrm{jump if negative} \\ \hline test & A,B & A \mathbin{\&} B \hspace{1em} \textrm{(setting cond. flags)} \\
jns l & \textrm{jump if non-negative} \\ \hline jmp & l & \textrm{jump to \texttt{l} unconditionally} \\
jg \ l & \textrm{jump if greater} \\ \hline je & l & \textrm{jump to \texttt{l} if equal} \\
jge l & \textrm{jump if greater or equal} \\ \hline jne & l & \textrm{jump to \texttt{l} if not equal} \\
jl \ l & \textrm{jump if lesser} \\ \hline js & l & \textrm{jump to \texttt{l} if negative} \\
jle l & \textrm{jump if lesser or equal} \\ \hline jns & l & \textrm{jump to \texttt{l} if non-negative} \\
ja \ l & \textrm{jump if above} \\ \hline jg & l & \textrm{jump to \texttt{l} if greater} \\
jae l & \textrm{jump if above or equal} \\ \hline jge & l & \textrm{jump to \texttt{l} if greater or equal} \\
jb \ l & \textrm{jump if below} \\ \hline jl & l & \textrm{jump to \texttt{l} if lesser} \\
jbe l & \textrm{jump if below or equal} \\ \hline jle & l & \textrm{jump to \texttt{l} if lesser or equal} \\
\hline ja & l & \textrm{jump to \texttt{l} if above} \\
push S & \mathtt{rsp} \leftarrow \mathtt{rsp} - \mathrm{sizeof}(S) \\ jae & l & \textrm{jump to \texttt{l} if above or equal} \\
& \mathrm{at}(\mathtt{rsp}) \leftarrow S \\ \hline jb & l & \textrm{jump to \texttt{l} if below} \\
pop \ D & D \leftarrow \mathrm{at}(\mathtt{rsp}) \\ jbe & l & \textrm{jump to \texttt{l} if below or equal} \\
& \mathtt{rsp} \leftarrow \mathtt{rsp} + \mathrm{sizeof}(S) \\ \hline \midrule
callq l & \textrm{push instruction pointer then jump} \\ \hline \multicolumn{3}{>{\sffamily\bfseries}c}{Stack operations} \\
retq & \textrm{pop to instruction pointer} \\ \hline \midrule
push & S & \mathtt{rsp} \leftarrow \mathtt{rsp} - \mathrm{sizeof}(S) \\
& & \mathrm{at}(\mathtt{rsp}) \leftarrow S \\
pop & D & D \leftarrow \mathrm{at}(\mathtt{rsp}) \\
& & \mathtt{rsp} \leftarrow \mathtt{rsp} + \mathrm{sizeof}(S) \\
callq & l & \textrm{push \texttt{rip} then jump to \texttt{l}} \\
retq & & \textrm{pop to \texttt{rip}} \\
\bottomrule
\end{tabularx} \end{tabularx}
\vspace{0.5em} \noindent\begin{tabularx}{\colwidth}{lX}
\toprule
\noindent\begin{tabularx}{\colwidth}{|c|l|c|c|X|} \multicolumn{2}{>{\sffamily\bfseries}c}{Addressing Modes} \\
\multicolumn{2}{c}{\textbf{Suffixes}} & \multicolumn{1}{c}{} & \multicolumn{2}{c}{\textbf{Condition flags}} \\ \cline{1-2} \cline{4-5} \midrule
b & 8 bits & & ZF & Zero \\ \cline{1-2} \cline{4-5} Immediate & \texttt{\$C} \\
w & 16 bits & & SF & Sign (set on negative) \\ \cline{1-2} \cline{4-5} Register & \texttt{\%R} \\
l & 32 bits & & CF & Carry (unsigned overflow) \\ \cline{1-2} \cline{4-5} Memory & \texttt{[C\textsubscript{d}](\%R\textsubscript{b}[,\%R\textsubscript{i}[,C\textsubscript{s}])} \\
q & 64 bits & & OF & Overflow (signed overflow) \\ \cline{1-2} \cline{4-5} \bottomrule
\end{tabularx} \end{tabularx}
\section{Addressing Modes} \[\textrm{Memory Address} = C_d + R_b + C_sR_i\]
\begin{tabularx}{\colwidth}{|l|X|} \noindent\begin{center}
\hline \begin{tabular}{cl}
Immediate & \texttt{\$C} \\ \hline \toprule
Register & \texttt{\%R} \\ \hline \multicolumn{2}{>{\sffamily\bfseries}c}{Suffixes} \\
Memory & \texttt{[C\textsubscript{d}](\%R\textsubscript{b}[,\%R\textsubscript{i}[,C\textsubscript{s}])} \\ \hline \midrule
\end{tabularx} b & 8 bits \\
w & 16 bits \\
\vspace{0.5em} l & 32 bits \\
q & 64 bits \\
\[\mathrm{address} = C_d + R_b + C_sR_i\] \bottomrule
\end{tabular}
\hspace{1em}
\begin{tabular}{cl}
\toprule
\multicolumn{2}{>{\sffamily\bfseries}c}{Condition Flags} \\
\midrule
ZF & Zero \\
SF & Sign (set on negative) \\
CF & Carry \\
OF & Overflow \\
\bottomrule
\end{tabular}
\end{center}
\section{Registers} \section{Registers}
\begin{tabularx}{\colwidth}{|>{\ttfamily}l|>{\ttfamily}l|>{\ttfamily}l|>{\ttfamily}l|X|} \begin{tabularx}{\colwidth}{>{\ttfamily}c>{\ttfamily}c>{\ttfamily}c>{\ttfamily}cX}
\hline \toprule
rax & eax & ax & al & accumulator \\ \hline \multicolumn{5}{>{\sffamily\bfseries}c}{Standard} \\
rbx & ebx & bx & bl & data pointer \\ \hline \midrule
rcx & ecx & cx & cl & counter \\ \hline rax & eax & ax & al & Accumulator \\
rdx & edx & dx & dl & I/O pointer \\ \hline rbx & ebx & bx & bl & DS data pointer \\
rsi & esi & si & sil & source pointer \\ \hline rcx & ecx & cx & cl & Counter \\
rdi & edi & di & dil & destination pointer \\ \hline rdx & edx & dx & dl & I/O pointer \\
rsp & esp & sp & spl & stack pointer \\ \hline rsi & esi & si & sil & Source pointer \\
rbp & ebp & bp & bpl & base pointer \\ \hline rdi & edi & di & dil & Dest. pointer \\
r8 & r8d & r8w & r8b & general purpose \\ \hline \midrule
r9 & r9d & r9w & r9b & general purpose \\ \hline \multicolumn{5}{>{\sffamily\bfseries}c}{Stack} \\
r10 & r10d & r10w & r10b & general purpose \\ \hline \midrule
r11 & r11d & r11w & r11b & general purpose \\ \hline rsp & esp & sp & spl & Stack pointer \\
r12 & r12d & r12w & r12b & general purpose \\ \hline rbp & ebp & bp & bpl & Base pointer \\
r13 & r13d & r13w & r13b & general purpose \\ \hline \midrule
r14 & r14d & r14w & r14b & general purpose \\ \hline \multicolumn{5}{>{\sffamily\bfseries}c}{64-bit Mode Only} \\
r15 & r15d & r15w & r15b & general purpose \\ \hline \midrule
r8 & r8d & r8w & r8b & No special use \\
r9 & r9d & r9w & r9b & \\
r10 & r10d & r10w & r10b & \\
r11 & r11d & r11w & r11b & \\
r12 & r12d & r12w & r12b & \\
r13 & r13d & r13w & r13b & \\
r14 & r14d & r14w & r14b & \\
r15 & r15d & r15w & r15b & \\
\bottomrule
\end{tabularx} \end{tabularx}
\end{document} \end{document}