Added a section about the Option byte.

This commit is contained in:
Garritt McCune
2025-02-27 16:37:22 -06:00
parent dac37cb167
commit 043311b2e0
2 changed files with 25 additions and 1 deletions
+24 -1
View File
@@ -127,8 +127,31 @@ For the exact definition of these data types please refer to section \ref{sec:co
\label{fig:encodingphysicallayout} % https://www.overleaf.com/learn/latex/Referencing_Figures
\end{figure}
\subsection{Options Bit}
The Options byte makes use of all 8 bits to encode something about the instruction that precedes it. Reading the byte from left to right, we have the following properties:
\begin{verbatim}
Operand Type, Operand as Pointer, Destination Offset, Source Width
\end{verbatim}
Starting with the high nibble we have two \quotes{columns}, \textit{Operand Type} and \textit{Operand as Pointer}, both spanning 2 bits for a total of 4 bits. The first two bits describe the type of operand we're expecting, zero (0) for \textit{register} and one (1) for an \textit{immediate} value. Bit 7 is for the source operand and bit 6 for the destination operand. Following this same layout (source then destination) we have two bits that say whether or not the operand should be treated as a pointer, zero (0) for no and one (1) for yes. For register type arguments this means to read the contents of whatever register is specified and treat that value as a full width pointer. If the argument is an immediate value, then we simply read one word and treat that word as a pointer.
The lower nibble consists of two \quotes{columns}, the same width as the previous two, that describe what kind of offset, if any, to apply to the destination operand and how many bytes are to be read from the source operand. Starting with bit 3 and ending on bit 2 we have the number of bytes to read for an offset. Bits 1 and 0 say how many bytes should be read from the source, which could be a register, an immediate value, or a pointer.
\begin{figure}[h]
\begin{tabular}{cccccccc}
\toprule
%\multicolumn{8}{c}{Bit Position} \\
\multicolumn{2}{c}{Type} & \multicolumn{2}{c}{Pointer} & \multicolumn{2}{c}{ } & \multicolumn{2}{c}{ } \\
7 & 6 & 5 & 4 & 3 & 2 & 1 & 0 \\
\midrule
Source & Destination & Source & Destination & \multicolumn{2}{c}{Destination Offset} & \multicolumn{2}{c}{Source Width} \\
\bottomrule
\end{tabular}
\caption{Options Bit Physical Layout}
\label{fig:optionsbitlayout}
\end{figure}
\section{Instructions}
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.
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 hexadecimal 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}
+1
View File
@@ -6,6 +6,7 @@
\usetikzlibrary{fit}
\usetikzlibrary{calc}
\usepackage{booktabs}
%\usepackage{showframe} % Good for debugging, uncomment to see the bounding boxes for the various sections of a page.
\NewDocumentCommand{\quotes}{m}{``#1''}