diff --git a/chapter 2.tex b/chapter 2.tex index 0a06063..0aa65e3 100644 --- a/chapter 2.tex +++ b/chapter 2.tex @@ -90,17 +90,22 @@ The logical ordering of the arguments follows the AT\&T syntax, meaning the left \begin{verbatim} mov 40, r1 \end{verbatim} -This is in contrast with how the data is laid out physically in memory, following the conventions described in section \ref{sec:conventions}~\nameref{sec:conventions}. Figure \ref{fig:encodingphysicallayout} shows how an instruction would be laid out. The operands can be of varying sizes based on the low nibble of the Options byte and, depending on the instruction, all but the Opcode byte may be present. +This is in contrast with how the data is laid out physically in memory, following the conventions described in section \ref{sec:conventions}~\nameref{sec:conventions}. Figure \ref{fig:encodingphysicallayout} shows how an instruction would be laid out. The operands can be of varying sizes based on the low nibble of the Options byte or, depending on the instruction, may only consist of an Opcode byte. The Source and Destination may have any one of the following three widths, in any combination: +\begin{verbatim} +byte, short, or word +\end{verbatim} +For the exact definition of these data types please refer to section \ref{sec:conventions} as mentioned above. %Because this machine is little endian, the opcode byte is physically located on the right hand-side of a word. % Placement info here: https://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Figures % Paths: https://tikz.dev/tikz-paths \begin{figure}[h] \begin{tikzpicture} %\draw[help lines] (-8,-5) grid (8,5); - \node [draw, fit={( -7.5, 0.0) ( -13.0, 1.0)}, inner sep=0, label=center:Destination] (argtwo) {}; - \node [draw, fit={( -2.5, 0.0) ( - 7.0, 1.0)}, inner sep=0, label=center:Source] (argone) {}; - \node [draw, fit={( 0.0, 0.0) ( - 2.0, 1.0)}, inner sep=0, label=center:Options] (options) {}; - \node [draw, fit={( 0.0, 0.0) ( 2.0, 1.0)}, inner sep=0, label=center:Opcode] (opcode) {}; + \node [draw, fit={(- 8.00, 0.00) (-12.00, 0.75)}, inner sep=0, label=center:Destination] (argtwo) {}; + \node [draw, fit={(- 4.00, 0.00) (- 8.00, 0.75)}, inner sep=0, label=center:Source] (argone) {}; + \node [draw, fit={(- 2.00, 0.00) (- 4.00, 0.75)}, inner sep=0, label=center:Options] (options) {}; + \node [draw, fit={( 0.00, 0.00) (- 2.00, 0.75)}, inner sep=0, label=center:Opcode] (opcode) {}; + \node [draw, fit={( 0.00, 1.50) (- 4.00, 2.25)}, inner sep=0, label=center:Offset] (offset) {}; \node at (argtwo.north)[above] {(if required)}; \node at (argtwo.north west)[above] {31}; @@ -110,6 +115,10 @@ This is in contrast with how the data is laid out physically in memory, followin \node at (opcode.north west)[above] {8 7}; \node at (options.south)[below] {(if required)}; \node at (opcode.north east)[above] {0}; + + \node at (offset.north east)[above] {32}; + \node at (offset.north west)[above] {39}; + \node at (offset.north)[above] {(if required)}; % Use the calc library to calculate the center of two points. % Reference: https://tex.stackexchange.com/a/71479 %\node at ($(highestbit.north)!0.5!(lowestbit.north)$)[above] {Physical Layout}; @@ -119,7 +128,9 @@ This is in contrast with how the data is laid out physically in memory, followin \end{figure} \section{Instructions} -The /r represents a byte that specifies a register. /immX is for the immediate data type, where \textit{X} defines the width, which are 8, 16, or 32 bits. An address is defined as /addrX with the \textit{X} denoting the size of the data that will be written which can be 8, 16 or 32 bits, with the address itself always being 32-bits wide. +Following is a complete listing of all supported instructions where the first two hexadecimal digits (starting from the left most digit in the Opcode column) represents the actual opcode byte that would be expected in object code. If the instruction expects an options byte then the next hexdecimal digit denotes the operand mode for the instruction. An underscore (\_) denotes that the low nibble of the options byte is to be set based on the instruction. + +The Instruction column shows the assembly syntax that represents the opcode, with the letter \textit{r} representing any register such as \textit{r32} and \textit{imm} for any numeric literal. This numeric literal could be a memory address or a number to start a counter, the semantics don't matter in this instance. The last two columns simply provide at a glance the operands, in the order they appear in the assembly sample, Source and Destination respectively. \subsection{Add} \createoptabletwoparam{01}{add}{0, 8}{ OF and ZF. } {