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
164
165
166
167
168
169
|
% Common memoir-based style for LibMCPU reference manuals.
% Shared XeLaTeX style for LibMCPU reference manuals.
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\setmainfont{Roboto}
\setsansfont{Roboto}
\setmonofont{DejaVu Sans Mono}[Scale=0.86]
\usepackage{polyglossia}
\setdefaultlanguage{russian}
\setotherlanguage{english}
\usepackage{microtype}
\usepackage[strings]{underscore}
\usepackage{xcolor}
\definecolor{McpuBlue}{HTML}{1F3556}
\definecolor{McpuBlue2}{HTML}{526A89}
\definecolor{McpuGreen}{HTML}{2F8A57}
\definecolor{McpuGreenBg}{HTML}{EDF6F0}
\definecolor{McpuGrayBg}{HTML}{F4F6F8}
\definecolor{McpuBlueBg}{HTML}{EEF3F8}
\definecolor{McpuGray}{HTML}{5C6673}
\definecolor{McpuRule}{HTML}{B9C6D8}
\definecolor{McpuCode}{HTML}{F6F7F8}
\definecolor{McpuUrl}{HTML}{B40B22}
% A4 layout shared with the restyled LibMCPU book: generous text block,
% but enough outer whitespace for technical figures and annotations.
\setstocksize{297mm}{210mm}
\settrimmedsize{297mm}{210mm}{*}
\setlrmarginsandblock{18mm}{15mm}{*}
\setulmarginsandblock{17mm}{19mm}{*}
\setheadfoot{9mm}{8mm}
\setheaderspaces{4mm}{*}{*}
\checkandfixthelayout
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning,fit,calc,shapes.geometric,decorations.pathreplacing}
\usepackage{array}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{enumitem}
\setlist{nosep,leftmargin=2em}
\setlist[itemize]{label=\textcolor{McpuBlue}{\small\textbullet}}
\usepackage[most]{tcolorbox}
\usepackage{listings}
\usepackage{fvextra}
\usepackage{hyperref}
\usepackage{bookmark}
\usepackage{needspace}
\usepackage{ragged2e}
\hypersetup{
unicode=true,
colorlinks=true,
linkcolor=McpuBlue,
urlcolor=McpuUrl,
citecolor=McpuBlue,
pdfauthor={Andrew V. Kosteltsev},
pdflang={ru-RU}
}
\bookmarksetup{open,numbered}
% memoir section and page styles.
\setsecheadstyle{\Large\sffamily\bfseries\color{McpuBlue}}
\setsubsecheadstyle{\large\sffamily\bfseries\color{McpuBlue}}
\setsubsubsecheadstyle{\normalsize\sffamily\bfseries\color{McpuBlue2}}
\setbeforesecskip{1.45\onelineskip}
\setaftersecskip{0.55\onelineskip}
\setbeforesubsecskip{1.05\onelineskip}
\setaftersubsecskip{0.35\onelineskip}
\setbeforesubsubsecskip{0.8\onelineskip}
\setaftersubsubsecskip{0.25\onelineskip}
\makepagestyle{libmcpu}
\makeoddhead{libmcpu}{\small\sffamily\color{McpuGray}\DocShortTitle}{}{\small\sffamily\color{McpuGray}LibMCPU}
\makeoddfoot{libmcpu}{}{\small\sffamily\thepage}{}
\makeheadrule{libmcpu}{\textwidth}{0.3pt}
\pagestyle{libmcpu}
\setlength{\parindent}{1.25em}
\setlength{\parskip}{0.20em}
\setlength{\cftsectionnumwidth}{3.2em}
\setlength{\cftsubsectionnumwidth}{4.2em}
\setlength{\cftsubsubsectionnumwidth}{5.0em}
\newtcolorbox{principle}{enhanced,breakable,colback=McpuGreenBg,colframe=McpuGreen,boxrule=0pt,leftrule=3pt,arc=0pt,left=10pt,right=10pt,top=8pt,bottom=8pt,before skip=8pt,after skip=8pt}
\newtcolorbox{normative}{enhanced,breakable,colback=McpuBlueBg,colframe=McpuBlue,boxrule=0pt,leftrule=3pt,arc=0pt,left=10pt,right=10pt,top=8pt,bottom=8pt,before skip=8pt,after skip=8pt}
\newtcolorbox{warningbox}{enhanced,breakable,colback=yellow!8,colframe=orange!75!black,boxrule=0pt,leftrule=3pt,arc=0pt,left=10pt,right=10pt,top=8pt,bottom=8pt,before skip=8pt,after skip=8pt}
\newtcolorbox{codebox}{enhanced,breakable,colback=McpuCode,colframe=McpuRule,boxrule=0.4pt,arc=1pt,left=7pt,right=7pt,top=5pt,bottom=5pt,before skip=7pt,after skip=7pt}
\lstdefinelanguage{MCPUAsm}{
morekeywords={LDI,LDR,LDC,MOV,IADD,ISUB,IAND,IOR,IXOR,INOT,ICMP,ITEST,ISHL,ISHR,ISAL,ISAR,IROL,IROR,IRCL,IRCR,ISHLN,ISHRN,ISALN,ISARN,IROLN,IRORN,IRCLN,IRCRN,IINC,IDEC,IXCHG,ICPY,ICVT,IMUL,ISMUL,IDIV,ISDIV,IBITSLEN,RADD,RSUB,RMUL,RDIV,RSQRT,RSIN,RCOS,RTAN,RASIN,RACOS,RATAN,RLOG,RLOG10,RLOG2,REXP,RSINH,RCOSH,RTANH,RPOW,RHYPOT,RATAN2,RNEG,RABS,RCMP,RCPY,RCVT,RFLOOR,RCEIL,RROUND,RFREXP,RLDEXP,RLOGB,RMODF,RREMAIN,RLOG1P,REXPM1,RASINH,RACOSH,RATANH,ITOR,UITOR,RTOI,RTOUI,RISNEG,RSIGN,RISIND,RISNAN,RISNANMAX,RISNANMIN,RISINF,RISSIGNULL,RCONST,CADD,CSUB,CMUL,CDIV,CEXP,CSIN,CCOS,CSINH,CCOSH,CLOG,CSQRT,CPOW,CREAL,CIMAG,CRTOC,CGEN,CPOLAR,CCONJ,CABS,CNORM,CARG,CISEQ,CISNE,CCPY,CCVT,JMP,JSET,JCLR,JMPP,CALL,CALLP,RET,PUSH,POP,LDSP,STSP,ADJSP,PUSHFP,SETFP,RESTSP,POPFP,LDFP,STFP,LEAFP,SETSP,LOAD,STORE,LEA,LEASP,LOADP,STOREP,PTRADD,PTRSUB,PTRDIFF,BMOV,BMOVI,BSWAP,END,EXIT,HALT,SYSCALL},
sensitive=false,
morecomment=[l]{;},
morecomment=[l]{\#},
morestring=[b]"
}
\lstset{
language=MCPUAsm,
basicstyle=\ttfamily\small,
columns=fullflexible,
keepspaces=true,
showstringspaces=false,
breaklines=true,
breakatwhitespace=false,
postbreak=\mbox{\textcolor{McpuGray}{$\hookrightarrow$}\space},
frame=single,
rulecolor=\color{McpuRule},
backgroundcolor=\color{McpuCode},
aboveskip=7pt,
belowskip=7pt,
framerule=0.4pt
}
% Long shell commands and verbatim data must never run outside the page.
\DefineVerbatimEnvironment{McpuCommand}{Verbatim}{fontsize=\small,frame=single,framesep=3mm,rulecolor=\color{McpuBlue!35},breaklines=true,breakanywhere=true,breaksymbolleft={},breaksymbolright={},breakindent=1.5em}
\DefineVerbatimEnvironment{McpuCode}{Verbatim}{fontsize=\small,frame=single,framesep=3mm,rulecolor=\color{McpuGray!35},breaklines=true,breakanywhere=true,breaksymbolleft={},breaksymbolright={}}
\newcolumntype{Y}{>{\raggedright\arraybackslash}X}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\urlstyle{tt}\newcommand{\code}[1]{\nolinkurl{#1}}
\newcommand{\field}[1]{\texttt{#1}}
\newcommand{\MCPU}{LibMCPU}
\newcommand{\MELF}{MELF}
\newcommand{\PTR}{PTR64}
\newcommand{\REG}{REG24}
\newcommand{\term}[2]{\textbf{#1} (\textit{#2})}
\newcommand{\figlabel}[1]{\sffamily\small\color{McpuGray}#1}
\newcommand{\tabhead}[1]{\sffamily\bfseries #1}
\newcommand{\DocTitlePage}[3]{%
\begin{titlingpage}
\thispagestyle{empty}
\vspace*{30mm}
{\sffamily\fontsize{29}{34}\selectfont\bfseries\color{McpuBlue} #1\par}
\vspace{8mm}
{\sffamily\fontsize{16}{21}\selectfont\color{McpuBlue2} #2\par}
\vspace{4mm}
{\sffamily\large\color{McpuGray} #3\par}
\vfill
\begin{tcolorbox}[width=0.86\textwidth,colback=McpuGreenBg,colframe=McpuGreen,boxrule=0pt,leftrule=4pt,arc=0pt]
\textbf{Нормативное техническое руководство LibMCPU.} Документ описывает текущий архитектурный контракт и намеренно не привязан к номеру выпуска пакета.
\end{tcolorbox}
\vfill
{\small\sffamily\color{McpuGray}Техническая редакция, октябрь 2026\par}
\end{titlingpage}
}
\setcounter{tocdepth}{2}
\setcounter{secnumdepth}{3}
% Reference manuals have no chapter level; memoir otherwise prefixes sections
% with the implicit chapter number 0.
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
\renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}
\renewcommand{\thefigure}{\arabic{figure}}
\renewcommand{\thetable}{\arabic{table}}
\renewcommand{\contentsname}{Содержание}
\newcommand{\ManualIntro}[1]{\begin{principle}\textbf{Статус документа.} #1\end{principle}}
\newcommand{\smallcapslabel}[1]{\textcolor{McpuBlue}{\textbf{#1}}}
\newenvironment{compactdesc}{\begin{description}[style=multiline,leftmargin=48mm,labelwidth=44mm,labelsep=4mm,labelindent=0pt,font=\normalfont\bfseries\color{McpuBlue}]}{\end{description}}
\emergencystretch=4em\tolerance=1800
\raggedbottom
|