From eba97789935490e9bedde895fae88380686c81d7 Mon Sep 17 00:00:00 2001 From: Garritt McCune Date: Tue, 4 Feb 2025 15:17:13 -0600 Subject: [PATCH] Created a basic setup for the figure for the memory layout / map. --- chapter 1.tex | 16 ++++++++++++++-- document.tex | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/chapter 1.tex b/chapter 1.tex index 3d805fd..69a51db 100644 --- a/chapter 1.tex +++ b/chapter 1.tex @@ -3,7 +3,7 @@ This is an attempt to distill what I know about how computers work into some kin \section{Registers} Thirty-two general purpose registers are available for program code to use however it wishes. The base name for the general purpose registers is \quotes{r} follows by an unpadded number, such as \quotes{r28}. These numbers do not follow a zero-based index scheme, \quotes{r29} is the twenty-ninth register. Using the base name implies full width, a \quotes{word}, when reading or writing from or to the register respectively. -In addition to the general purpose registers there is also a base pointer (bp), stack pointer (sp) and an instruction pointer (ip). The base pointer and the stack pointer may be set directly using the \hyperref[sec:mov]{mov} instruction, which allows the programmer to set up a stack frame. The instruction pointer can only be set with a branching operation like \hyperref[sec:jmp]{jmp} or a call to a subroutine with the \hyperref[sec:call]{call} instruction. One final register that can only be indirectly set is the \quotes{flags} register. This register, like the others, is one word wide meaning it can store thirty-two flags. Currently only three flags are present, the Zero, Underflow and Overflow flags. These flags are only affected by arthmetic operations and generally read by branching instructions like \hyperref[sec:jmp]{jmp}. +In addition to the general purpose registers there is also a base pointer (bp), stack pointer (sp) and an instruction pointer (ip). The base pointer and the stack pointer may be set directly using the \hyperref[sec:mov]{mov} instruction, which allows the programmer to set up a stack frame. The instruction pointer can only be set with a branching operation like \hyperref[sec:jmp]{jmp} or a call to a subroutine with the \hyperref[sec:call]{call} instruction. One final register that can only be indirectly set is the \quotes{flags} register. This register, like the others, is one word wide meaning it can store thirty-two flags. Currently only three flags are present, the Zero, Underflow and Overflow flags. These flags are only affected by arithmetic operations and generally read by branching instructions like \hyperref[sec:jmp]{jmp}. \begin{figure}[h] \begin{tikzpicture} @@ -51,4 +51,16 @@ In addition to the general purpose registers there is also a base pointer (bp), \end{description} \section{Memory} -The memory layout is quite simple, much like many modern machines it is a linear memory map. The address bus is thrity-two bits wide, the same width of the data bus, meaning at most there is 2\textsuperscript{32} of addressable memory. Like contemprary machines the top of memory starts at address 0x00000000 and grows downward toward 0xFFFFFFFF. \ No newline at end of file +The memory layout is quite simple, much like many modern machines it is a linear memory map. The address bus is thirty-two bits wide, the same width of the data bus, meaning at most there is 2\textsuperscript{32} of addressable memory. Like contemporary machines the top of memory starts at address 0x00000000 and grows downward toward 0xFFFFFFFF. + +\begin{figure} + \begin{tikzpicture} + \node [draw, fit={(0,0) (3, 6)}] (memory) {}; + + \draw (memory); + \node (top) at (memory.north east)[right] {0x00000000}; + \node at (memory.south east)[right] {0xFFFFFFFF}; + + \draw[dashed] ($(memory.north west)-(0,0.5)$) node[left] {0x20000} -- ($(memory.north east)-(0,0.5)$) node[midway, above] {Firmware}; + \end{tikzpicture} +\end{figure} \ No newline at end of file diff --git a/document.tex b/document.tex index 9f3cb73..b28012c 100644 --- a/document.tex +++ b/document.tex @@ -9,6 +9,7 @@ \usetikzlibrary{positioning} \usetikzlibrary{decorations.pathreplacing} \usetikzlibrary{fit} +\usetikzlibrary{calc} %\usepackage{showframe} % Good for debugging, uncomment to see the bounding boxes for the various sections of a page.