aboutsummaryrefslogtreecommitdiffstats
path: root/doc/latex/src/nasm.tex
blob: 6ba1920bfc358d886f731a42e6cb89f516d3ca5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
%
% vim: ts=4 sw=4 et
%
\documentclass[oneside,openany]{book}

\usepackage[a4paper,margin=72pt]{geometry}

\usepackage{listings}           % nasm listings
\usepackage{imakeidx}           % indexing
\usepackage{hyperref}           % pdf bookmarks and such
\usepackage[Sonny]{fncychap}    % chapter style
\usepackage{parskip}            % no indent on first line
\usepackage{fontspec}           % selecting fonts
\usepackage{xunicode}           % unicode support
\usepackage{xcolor}             % coloring
\usepackage{xspace}             % spacing
\usepackage{appendix}           % appendix
%\usepackage{xstring}            % strings for code
\usepackage{sectsty}            % colors for sections
\usepackage{graphicx}           % images
\usepackage[titles]{tocloft}    % coloring TOC

\title{NASM -- The Netwide Assembler}
\author{The NASM Development Team}
\date{1996 -- 2018}
\input{src/version.tex}

%
% No rectangles
\makeatletter
\hypersetup{
    pdfauthor=\@author,
    pdftitle=\@title,
    pdfkeywords={NASM,Netwide Assembler},
    hidelinks,
}
\makeatother

%
% Up to 4 levels nesting in menu
\setcounter{tocdepth}{4}

%
% Highlight listings
\definecolor{light-gray}{gray}{0.96}

%
% Setup document fonts
\setmainfont{Source Sans Pro}
\setmonofont{FreeMono}

% Listings font and settings
\newfontfamily{\lstsansserif}{FreeMono}
\lstset{
    keepspaces=true,
    backgroundcolor=\color{light-gray},
    basicstyle=\lstsansserif,
    breaklines=true,
    breakatwhitespace=true,
    framesep=10pt,
    framexleftmargin=10pt,
    frame=tb,
    framerule=0pt,
    xleftmargin=10pt,
    xrightmargin=10pt,
    aboveskip=10pt,
    belowskip=5pt,
    literate={-}{{-}}1
}

%
% Heading colors
\definecolor{hcolor}{RGB}{8,96,168}
\chapterfont{\color{hcolor}}
\sectionfont{\color{hcolor}}
\subsectionfont{\color{hcolor}}

%
% Formatting macros
\newcommand{\textindex}[1]{#1\index{#1}\xspace}
\newcommand{\textindexlc}[1]{#1\index{\MakeLowercase{#1}}\xspace}
\newcommand{\code}[1]{{\texttt{#1}}\xspace}
\newcommand{\indexcode}[1]{\index{#1@\texttt{#1}}\xspace}
\newcommand{\codeindex}[1]{\texttt{#1}\index{#1@\texttt{#1}}\xspace}
\newcommand{\fullref}[1]{``\hyperref[{#1}]{\ref*{#1}\xspace\nameref*{#1}}''\xspace}
\newcommand{\nref}[1]{\textcolor{hcolor}{\hyperref[{#1}]{\ref*{#1}\xspace}}}

\newcommand{\xchapter}[2]{\chapter{#2}\label{#1}\xspace}
\newcommand{\xsection}[2]{\section{#2}\label{#1}\xspace}
\newcommand{\xsubsection}[2]{\subsection{#2}\label{#1}\xspace}
%
% Convertion table
%
% \C{name}              ->      \xchapter{label}{name}
% \H{name}              ->      \xsection{label}{name}
% \S{name}              ->      \xsubsection{label}{name}
% \c{name}              ->      \code{name}
% \c name               ->      \begin{lstlisting}
%                               name
%                               \end{lstlisting}
% \i{name}              ->      \textindexlc{name}
% \I{name}              ->      \index{name}
% \I\c{name}            ->      \indexcode{name}
% \i\c{name}            ->      \codeindex{name}
% \k{name}              ->      \nref{name}

%
% Index into TOC
\makeindex[title=Index,columns=2,intoc,options=-s src/idxconf.ist]

%
% TOC headers
\renewcommand{\cftchapfont}{\bfseries\color{hcolor}}
\renewcommand{\cfttoctitlefont}{\huge\bfseries\color{hcolor}}

\begin{document}
\raggedright

\makeatletter
\begin{titlepage}
    \color{hcolor}
    \begin{center} \vspace*{\fill}
        \begin{flushleft}
            {\huge \bfseries {\@title}}                         \\
        \end{flushleft}
        \noindent\makebox[\linewidth]{\rule{\textwidth}{2pt}}   \\
        \begin{flushright}
            {\large \bfseries \emph{version \version}}          \\[8ex]
        \end{flushright}
        \includegraphics[width=6cm]{src/nasmlogo.eps}
    \vspace*{\fill} \end{center}
\end{titlepage}
\makeatother
\thispagestyle{empty}

\tableofcontents
\addtocontents{toc}{~\hfill\textcolor{hcolor}{\textbf{Page}}\par}

%
% Document chapters
\input{src/intro.tex}
\input{src/running.tex}
\input{src/language.tex}
\input{src/preproc.tex}
\input{src/macropkg.tex}
\input{src/directive.tex}
\input{src/outfmt.tex}
\input{src/16bit.tex}
\input{src/32bit.tex}
\input{src/mixsize.tex}
\input{src/64bit.tex}
\input{src/trouble.tex}
\begin{appendices}
\input{src/ndisasm.tex}
\input{src/inslist.tex}
\input{src/changelog.tex}
\input{src/source.tex}
\input{src/contact.tex}
\end{appendices}

\printindex

\end{document}