Added a section to the memory map for the video memory.

This commit is contained in:
Garritt McCune
2025-02-04 16:23:50 -06:00
parent eba9778993
commit 7baadf96fa
+7 -4
View File
@@ -1,7 +1,7 @@
\chapter{Introduction} \chapter{Introduction}
This is an attempt to distill what I know about how computers work into some kind of emulator / simulator. I'm curious to see if what I know at the moment is enough to allow me to emulate a general purpose computer. It turns out that it take quite a different skillset compared to writing web applications or desktop applications. But I realize that, while I understand the concepts that underpin what I do day to day, I don't have an intuitive understanding of the hardware. This has become painfully evident pretty much immediately after I started this project. An ISA should be simple, add, subtract, copy, etc., but the you have to consider the state the processor will be in after each instruction. This is an attempt to distill what I know about how computers work into some kind of emulator / simulator. I'm curious to see if what I know at the moment is enough to allow me too emulate a general purpose computer. It turns out that it take quite a different skill set compared to writing web or desktop applications. But I realize that, while I understand the concepts that underpin what I do day to day, I don't have an intuitive understanding of the hardware. This has become painfully evident pretty much immediately after I started this project. An ISA should be simple, add, subtract, copy, etc., but then you have to consider the state that the processor will be in after each instruction.
\section{Registers} \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. 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{r8}. 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 arithmetic 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}.
@@ -51,7 +51,7 @@ In addition to the general purpose registers there is also a base pointer (bp),
\end{description} \end{description}
\section{Memory} \section{Memory}
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. 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. By default the memory is mapped as shown in Figure \ref{fig:memorylayout}.
\begin{figure} \begin{figure}
\begin{tikzpicture} \begin{tikzpicture}
@@ -61,6 +61,9 @@ The memory layout is quite simple, much like many modern machines it is a linear
\node (top) at (memory.north east)[right] {0x00000000}; \node (top) at (memory.north east)[right] {0x00000000};
\node at (memory.south east)[right] {0xFFFFFFFF}; \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}; \draw[dashed] ($(memory.north west)-(0,0.5)$) node[left] {0x200000} -- ($(memory.north east)-(0,0.5)$) node[midway, above] {Firmware};
\draw[dashed] ($(memory.north west)-(0,1.25)$) -- ($(memory.north east)-(0,1.25)$) node[right] {0x275300 (800x600)} node[midway, above] {VRAM};
\end{tikzpicture} \end{tikzpicture}
\caption{Memory Map \& Layout}
\label{fig:memorylayout} % https://www.overleaf.com/learn/latex/Referencing_Figures
\end{figure} \end{figure}