This repository has been archived on 2022-08-01. You can view files and clone it, but cannot push or open issues or pull requests.
150ASM-Emulator/doc/html/emulator_8h_source.html
2020-06-23 22:56:38 +01:00

154 lines
18 KiB
HTML
Executable file

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>SCC.150 Assembler Emulator: /home/rumperuu/Documents/University/University Work/SCC.150 Digital Systems/Coursework/unr-C/SCC.150 Assembler Emulator/source/emulator.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SCC.150 Assembler Emulator
</div>
<div id="projectbrief">A compiler for a simple assembler language</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_b2f33c71d4aa5e7af42a1ca61ff5af1b.html">source</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">emulator.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="emulator_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="preprocessor">#ifndef EMULATOR_H_</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define EMULATOR_H_</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="preprocessor">#include &lt;stdio.h&gt;</span> <span class="comment">// used for printf()</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;<span class="preprocessor">#include &lt;stdlib.h&gt;</span> <span class="comment">// used for atoi()</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;<span class="preprocessor">#include &lt;stdbool.h&gt;</span> <span class="comment">// used for bool data type</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="preprocessor">#define MAX_PROG_LEN 99 // The maximum length (in lines) a program can have</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define MAX_LINE_LEN 80 // The maximum length of a program line (in characters)</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define MAX_OPCODE 10 // The maximum number of opcodes that are supported</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define MAX_REGISTER 4 // The maximum number of registers (minus INSP)</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define OPCODE_LENGTH 3 // The maximum length of an opcode</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ARG_LENGTH 4 // The maximum length of an arg</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define OPCODE 0 // Used for parsing instruction segments</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ARG1 1</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define ARG2 2</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;<span class="comment">// Opcode handling functions</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160;<span class="keywordtype">int</span> <a class="code" href="emulator_8h.html#a00e5e1b7c08d6368342756805800133b">opcodeNOP</a>(<span class="keywordtype">char</span>* opcode, <span class="keywordtype">char</span>* arg1, <span class="keywordtype">char</span>* arg2);</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;<span class="keywordtype">int</span> <a class="code" href="emulator_8h.html#a5d6aac425624196dcd0d278760270d00">opcodeSET</a>(<span class="keywordtype">char</span>* opcode, <span class="keywordtype">char</span>* arg1, <span class="keywordtype">char</span>* arg2);</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;<span class="keywordtype">int</span> <a class="code" href="emulator_8h.html#a434bd1e8b4e45503586891e565138b84">opcodeAND</a>(<span class="keywordtype">char</span>* opcode, <span class="keywordtype">char</span>* arg1, <span class="keywordtype">char</span>* arg2);</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;<span class="keywordtype">int</span> <a class="code" href="emulator_8h.html#a54c12a24203abe192fe4f727ea9ffe60">opcodeOR</a>(<span class="keywordtype">char</span>* opcode, <span class="keywordtype">char</span>* arg1, <span class="keywordtype">char</span>* arg2);</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;<span class="keywordtype">int</span> <a class="code" href="emulator_8h.html#a501fe22548fd568d37522ba76ff2c1e7">opcodeADD</a>(<span class="keywordtype">char</span>* opcode, <span class="keywordtype">char</span>* arg1, <span class="keywordtype">char</span>* arg2);</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;<span class="keywordtype">int</span> <a class="code" href="emulator_8h.html#a3ead6beddb4488ab700a81968e30e11c">opcodeSUB</a>(<span class="keywordtype">char</span>* opcode, <span class="keywordtype">char</span>* arg1, <span class="keywordtype">char</span>* arg2);</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="keywordtype">int</span> <a class="code" href="emulator_8h.html#a3cdb2ee632bc1b19d885c26b044d76ae">opcodeSHL</a>(<span class="keywordtype">char</span>* opcode, <span class="keywordtype">char</span>* arg1, <span class="keywordtype">char</span>* arg2);</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="keywordtype">int</span> <a class="code" href="emulator_8h.html#a6f1fa1ff65a606afddb458fcd64449cf">opcodeSHR</a>(<span class="keywordtype">char</span>* opcode, <span class="keywordtype">char</span>* arg1, <span class="keywordtype">char</span>* arg2);</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="keywordtype">int</span> <a class="code" href="emulator_8h.html#a734105640ec0f0c1e6dc8c5384b2d1d0">opcodeJMP</a>(<span class="keywordtype">char</span>* opcode, <span class="keywordtype">char</span>* arg1, <span class="keywordtype">char</span>* arg2);</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<span class="keywordtype">int</span> <a class="code" href="emulator_8h.html#aeb406b3428b5429249ab2c7e3d7bcc3c">opcodePRT</a>(<span class="keywordtype">char</span>* opcode, <span class="keywordtype">char</span>* arg1, <span class="keywordtype">char</span>* arg2);</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="comment">// Argument extraction function</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="keywordtype">int</span> <a class="code" href="emulator_8h.html#ae7178313a4254c62afc060814ebca038">getArg2</a>(<span class="keywordtype">char</span>* arg2);</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160;</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;<span class="comment">// Command validator function</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;<span class="keywordtype">bool</span> <a class="code" href="emulator_8h.html#a40c9c476ef53a0c955d3e633b54d2bd2">isValid</a>(<span class="keywordtype">char</span>* opcode, <span class="keywordtype">char</span>* arg1, <span class="keywordtype">char</span>* arg2);</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;<span class="comment">// Emulator run functions</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;<span class="keywordtype">int</span> <a class="code" href="emulator_8h.html#a6b5c26779c71916073e7b8f9debea56d">execInstruction</a>(<span class="keywordtype">char</span>* instruction);</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;<span class="keywordtype">int</span> <a class="code" href="emulator_8h.html#a2bbc98d3653ad65ad12757dfa7bdfdd4">execProgram</a>();</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;<span class="keywordtype">int</span> <a class="code" href="emulator_8h.html#a3d30edda62d5695ffaa3b62121d4bf98">loadProgram</a>();</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* EMULATOR_H_ */</span><span class="preprocessor"></span></div>
<div class="ttc" id="emulator_8h_html_a54c12a24203abe192fe4f727ea9ffe60"><div class="ttname"><a href="emulator_8h.html#a54c12a24203abe192fe4f727ea9ffe60">opcodeOR</a></div><div class="ttdeci">int opcodeOR(char *opcode, char *arg1, char *arg2)</div><div class="ttdef"><b>Definition:</b> emulator.c:172</div></div>
<div class="ttc" id="emulator_8h_html_a3d30edda62d5695ffaa3b62121d4bf98"><div class="ttname"><a href="emulator_8h.html#a3d30edda62d5695ffaa3b62121d4bf98">loadProgram</a></div><div class="ttdeci">int loadProgram()</div><div class="ttdef"><b>Definition:</b> emulator.c:466</div></div>
<div class="ttc" id="emulator_8h_html_a5d6aac425624196dcd0d278760270d00"><div class="ttname"><a href="emulator_8h.html#a5d6aac425624196dcd0d278760270d00">opcodeSET</a></div><div class="ttdeci">int opcodeSET(char *opcode, char *arg1, char *arg2)</div><div class="ttdef"><b>Definition:</b> emulator.c:124</div></div>
<div class="ttc" id="emulator_8h_html_a6f1fa1ff65a606afddb458fcd64449cf"><div class="ttname"><a href="emulator_8h.html#a6f1fa1ff65a606afddb458fcd64449cf">opcodeSHR</a></div><div class="ttdeci">int opcodeSHR(char *opcode, char *arg1, char *arg2)</div><div class="ttdef"><b>Definition:</b> emulator.c:268</div></div>
<div class="ttc" id="emulator_8h_html_a00e5e1b7c08d6368342756805800133b"><div class="ttname"><a href="emulator_8h.html#a00e5e1b7c08d6368342756805800133b">opcodeNOP</a></div><div class="ttdeci">int opcodeNOP(char *opcode, char *arg1, char *arg2)</div><div class="ttdef"><b>Definition:</b> emulator.c:107</div></div>
<div class="ttc" id="emulator_8h_html_a6b5c26779c71916073e7b8f9debea56d"><div class="ttname"><a href="emulator_8h.html#a6b5c26779c71916073e7b8f9debea56d">execInstruction</a></div><div class="ttdeci">int execInstruction(char *instruction)</div><div class="ttdef"><b>Definition:</b> emulator.c:388</div></div>
<div class="ttc" id="emulator_8h_html_a2bbc98d3653ad65ad12757dfa7bdfdd4"><div class="ttname"><a href="emulator_8h.html#a2bbc98d3653ad65ad12757dfa7bdfdd4">execProgram</a></div><div class="ttdeci">int execProgram()</div><div class="ttdef"><b>Definition:</b> emulator.c:444</div></div>
<div class="ttc" id="emulator_8h_html_a3ead6beddb4488ab700a81968e30e11c"><div class="ttname"><a href="emulator_8h.html#a3ead6beddb4488ab700a81968e30e11c">opcodeSUB</a></div><div class="ttdeci">int opcodeSUB(char *opcode, char *arg1, char *arg2)</div><div class="ttdef"><b>Definition:</b> emulator.c:220</div></div>
<div class="ttc" id="emulator_8h_html_a501fe22548fd568d37522ba76ff2c1e7"><div class="ttname"><a href="emulator_8h.html#a501fe22548fd568d37522ba76ff2c1e7">opcodeADD</a></div><div class="ttdeci">int opcodeADD(char *opcode, char *arg1, char *arg2)</div><div class="ttdef"><b>Definition:</b> emulator.c:196</div></div>
<div class="ttc" id="emulator_8h_html_a434bd1e8b4e45503586891e565138b84"><div class="ttname"><a href="emulator_8h.html#a434bd1e8b4e45503586891e565138b84">opcodeAND</a></div><div class="ttdeci">int opcodeAND(char *opcode, char *arg1, char *arg2)</div><div class="ttdef"><b>Definition:</b> emulator.c:148</div></div>
<div class="ttc" id="emulator_8h_html_aeb406b3428b5429249ab2c7e3d7bcc3c"><div class="ttname"><a href="emulator_8h.html#aeb406b3428b5429249ab2c7e3d7bcc3c">opcodePRT</a></div><div class="ttdeci">int opcodePRT(char *opcode, char *arg1, char *arg2)</div><div class="ttdef"><b>Definition:</b> emulator.c:311</div></div>
<div class="ttc" id="emulator_8h_html_ae7178313a4254c62afc060814ebca038"><div class="ttname"><a href="emulator_8h.html#ae7178313a4254c62afc060814ebca038">getArg2</a></div><div class="ttdeci">int getArg2(char *arg2)</div><div class="ttdef"><b>Definition:</b> emulator.c:334</div></div>
<div class="ttc" id="emulator_8h_html_a3cdb2ee632bc1b19d885c26b044d76ae"><div class="ttname"><a href="emulator_8h.html#a3cdb2ee632bc1b19d885c26b044d76ae">opcodeSHL</a></div><div class="ttdeci">int opcodeSHL(char *opcode, char *arg1, char *arg2)</div><div class="ttdef"><b>Definition:</b> emulator.c:244</div></div>
<div class="ttc" id="emulator_8h_html_a40c9c476ef53a0c955d3e633b54d2bd2"><div class="ttname"><a href="emulator_8h.html#a40c9c476ef53a0c955d3e633b54d2bd2">isValid</a></div><div class="ttdeci">bool isValid(char *opcode, char *arg1, char *arg2)</div><div class="ttdef"><b>Definition:</b> emulator.c:352</div></div>
<div class="ttc" id="emulator_8h_html_a734105640ec0f0c1e6dc8c5384b2d1d0"><div class="ttname"><a href="emulator_8h.html#a734105640ec0f0c1e6dc8c5384b2d1d0">opcodeJMP</a></div><div class="ttdeci">int opcodeJMP(char *opcode, char *arg1, char *arg2)</div><div class="ttdef"><b>Definition:</b> emulator.c:291</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue May 19 2015 20:34:54 for SCC.150 Assembler Emulator by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>