diff options
| author | Pokechu22 <Pokechu022@gmail.com> | 2021-08-21 17:05:53 -0700 |
|---|---|---|
| committer | Pokechu22 <Pokechu022@gmail.com> | 2021-08-21 17:07:13 -0700 |
| commit | 9249454f332f6706a8fdae8756248cf9af0f8ccd (patch) | |
| tree | daee978bcdf86e2dca487842e2da9f1ba7a5db16 /docs | |
| parent | a8ec0ad27f69fe81b3a59255ab319f1666310e87 (diff) | |
docs/DSP: Document overflow and carry behavior
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/DSP/GameCube_DSP_Users_Manual/GameCube_DSP_Users_Manual.tex | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/DSP/GameCube_DSP_Users_Manual/GameCube_DSP_Users_Manual.tex b/docs/DSP/GameCube_DSP_Users_Manual/GameCube_DSP_Users_Manual.tex index 7b875a0e79..b8e536c389 100644 --- a/docs/DSP/GameCube_DSP_Users_Manual/GameCube_DSP_Users_Manual.tex +++ b/docs/DSP/GameCube_DSP_Users_Manual/GameCube_DSP_Users_Manual.tex @@ -1038,6 +1038,16 @@ There are two pairs of conditions that work similarly: \texttt{EQ}/\texttt{NE} a \pagebreak{} +\section{Flags} + +Most opcodes update flags in the status register (\Register{\$sr}) based on their result. (Extended opcodes do not update flags.) + +Overflow (\texttt{O}) occurs when the result has wrapped around. The expression $C = A + B$ has overflown if $A > 0$ and $B > 0$ but $C \le 0$ or if $A < 0$ and $B < 0$ but $C \ge 0$. Any instruction that sets the \texttt{O} flag will also set the \texttt{OS} flag; when the \texttt{O} flag is set, \texttt{OS} is also set, but \texttt{OS} is not cleared when \texttt{O} is cleared. + +Carry (\texttt{C}) occurs when an arithmetic carry occurs and should be added to the next most significant word. The expression $C = A + B$ generates a carry if $A > C$. The DSP uses different logic for subtraction: the expression $C = A - B$ generates a carry if $A \ge C$ (so if $B = 0$, a carry is generated for all $A$). This is because the DSP uses a carry flag, not a borrow flag. + +\pagebreak{} + \section{Alphabetical list of opcodes} \pagebreak{} |
