-\section{calling convention}
+\section{Calling Convention}
+
+Programs and functions implementing this instruction set, should implement the following calling conventions. The register usage should be done as stated in table~\ref{tab:callcon}. If the callee should be given more than five parameters, other parameters should be passed over by the stack.
\begin{table}[ht]
\centering
\begin{tabular}{|c|c|c|} \hline
- Register & saved by & usage \\ \hline
+ \textbf{register} & \textbf{saved by} & \textbf{usage} \\ \hline
r0 & caller & return \\ \hline
r1 & caller & first parameter \\ \hline
r2 & caller & second parameter \\ \hline
r14 & callee & \\ \hline
r15 & callee & \\ \hline
\end{tabular}
- \caption{Register save \ldots}
-% \label{tab:<+label+>}
+ \caption{Calling Convention}
+ \label{tab:callcon}
+\end{table}
+
+\subsection{Assembler Syntax}
+\begin{itemize}
+\item \textbf{Immediate s}: decimal \texttt{12345}, hex \texttt{0xabcde123},
+binary \texttt{0b10101110}\\
+If an immediate is to large for the given instruction the assembler terminates
+with an error
+
+\item \textbf{High and Low Half Word}: you can use the suffix \texttt{@hi} to
+access the upper 16 bit of an immediate, or \texttt{@lo} to access the lower 16
+bit.
+
+\item \textbf{Memory access}: to access data on an address which is located in a
+register, you have to write \texttt{0(rS)}. Alternatively you can specify
+a signed displacement.
+
+\item \textbf{Expressions}: Usual expressions like \texttt{+}, \texttt{-},
+\texttt{*} or \texttt{<<} will be evaluated by the assembler, e.g. \texttt{ldw
+r1, 0x20-8(r3)} is a valid instruction
+\end{itemize}
+
+\subsection{Directives}
+In order to gain extra comfort, several directives are interpreted by the
+assembler, a list is given in table~\ref{tab:asmdirs}.
+\begin{table}[ht]
+ \centering
+ \begin{tabular}{|l|p{10cm}|} \hline
+ \textbf{Name} & \textbf{Description} \\ \hline
+ \texttt{.data} & subsequent data is desired for the data memory\\ \hline
+ \texttt{.text} & subsequent code is desired for the instruction memory\\ \hline
+ \verb+.include "file.s"+ & include a further file \\ \hline
+ \texttt{.org \textit{addr}} & move \textit{forward} to a specific
+ address in data or instruction memory, depending on the current
+ section \\ \hline
+
+ \texttt{.fill \textit{repeat}, \textit{value}} & place a
+ 32 bit value \texttt{\textit{repeat}}-times, while
+ \texttt{\textit{repeat}} is optional.
+
+ When one parameter is given, the value is placed at the current address.
+ Note that a given value will be rounded up to a full byte, e.g.
+ \texttt{0x123} occupy two bytes.
+
+ When two parameters are given, the first equals \texttt{\textit{repeat}}
+ and the second corresponds to \texttt{\textit{value}} \\ \hline
+
+ \texttt{.define \textit{name}, \textit{value}} & define a constant. Note
+ that a define isn't equal to a label\\ \hline
+
+ \texttt{label: <instr/data>} & label an instruction or data. The label
+ can be used as an alias for the address of this instruction in the
+ instruction memory or as a reference in the data memory, depending on
+ the current section\\ \hline
+ \end{tabular}
+ \caption{supported directives by the assembler}
+ \label{tab:asmdirs}
\end{table}
+