changeset 39:0f3bd942a7d4

docs docs docs
author james <jb302@eecs.qmul.ac.uk>
date Mon, 21 Apr 2014 19:37:21 +0100
parents 9ff51da22b9b
children 6b947f6d69d9
files bin/emu docs/img/asm/assembler.svg docs/img/asm/tokenize.svg docs/img/dbg/debugger_overview.svg docs/img/ede/aued.svg docs/img/ede/interpreter.svg docs/img/ede/state_of_ede.svg docs/img/emu/controller.svg docs/img/emu/memory.svg docs/lyx/#appendix.lyx# docs/lyx/#asm.lyx# docs/lyx/#dbg.lyx# docs/lyx/#ede.lyx# docs/lyx/#emu.lyx# docs/lyx/#review.lyx# docs/lyx/appendix.lyx docs/lyx/appendix.lyx~ docs/lyx/asm.lyx docs/lyx/asm.lyx~ docs/lyx/dbg.lyx docs/lyx/dbg.lyx~ docs/lyx/ede.lyx docs/lyx/ede.lyx~ docs/lyx/emu.lyx docs/lyx/emu.lyx~ docs/lyx/final_report.lyx docs/lyx/final_report.lyx~ docs/lyx/review.lyx docs/lyx/review.lyx~ emu/.mem.h.swp emu/main.c emu52/iset.c emu52/iset.h emu52/main.c emu52/mem.c emu52/mem.h emu52/src/iset.c emu52/src/iset.h emu52/src/main.c emu52/src/mem.c emu52/src/mem.h
diffstat 41 files changed, 17313 insertions(+), 1690 deletions(-) [+]
line wrap: on
line diff
Binary file bin/emu has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/img/asm/assembler.svg	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="400"
+   height="400"
+   id="svg7102"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="New document 14">
+  <defs
+     id="defs7104">
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow2Lend"
+       style="overflow:visible">
+      <path
+         id="path5528"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker7066"
+       style="overflow:visible">
+      <path
+         id="path7068"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker7070"
+       style="overflow:visible">
+      <path
+         id="path7072"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1.3275"
+     inkscape:cx="200"
+     inkscape:cy="200"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="829"
+     inkscape:window-height="728"
+     inkscape:window-x="0"
+     inkscape:window-y="19"
+     inkscape:window-maximized="0" />
+  <metadata
+     id="metadata7107">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-652.36218)">
+    <rect
+       style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:3.67115593;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+       id="rect4668"
+       width="107.39475"
+       height="107.39475"
+       x="138.29504"
+       y="806.15167" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1.28496873px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:none;marker-end:url(#Arrow2Lend)"
+       d="m 191.99244,748.80858 -10e-6,57.34309"
+       id="path5501"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-end="#rect4668"
+       inkscape:connection-end-point="d4" />
+    <g
+       id="g6433"
+       transform="translate(114.22963,12.229183)">
+      <g
+         id="g6425">
+        <rect
+           style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:3.67115593;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:11.01346743, 3.67115581;stroke-dashoffset:0"
+           id="rect5495"
+           width="63.362904"
+           height="63.362904"
+           x="46.08136"
+           y="673.21649"
+           ry="5.3697371" />
+        <flowRoot
+           xml:space="preserve"
+           id="flowRoot6361"
+           style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+           transform="translate(2.4434741,667.77911)"><flowRegion
+             id="flowRegion6363"><rect
+               id="rect6365"
+               width="51.400291"
+               height="48.892963"
+               x="49.728741"
+               y="24.655426"
+               style="font-size:10px" /></flowRegion><flowPara
+             id="flowPara6367">Assembly</flowPara><flowPara
+             id="flowPara6369">Code</flowPara></flowRoot>      </g>
+    </g>
+    <g
+       id="g6442"
+       transform="translate(118.9217,-58.013127)">
+      <rect
+         ry="5.3697371"
+         y="886.18073"
+         x="182.2775"
+         height="63.362904"
+         width="63.362904"
+         id="rect5495-0"
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:3.67115593;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:11.01346743, 3.67115581;stroke-dashoffset:0" />
+      <flowRoot
+         transform="translate(138.32711,868.21646)"
+         style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+         id="flowRoot6361-3"
+         xml:space="preserve"><flowRegion
+           id="flowRegion6363-9"><rect
+             style="font-size:10px"
+             y="24.655426"
+             x="49.728741"
+             height="48.892963"
+             width="51.400291"
+             id="rect6365-4" /></flowRegion><flowPara
+           id="flowPara6367-9" /><flowPara
+           id="flowPara6369-1">Machine Code</flowPara></flowRoot>    </g>
+    <g
+       id="g6450"
+       transform="translate(-21.966518,-7.1256571)">
+      <rect
+         ry="5.3697371"
+         y="963.04144"
+         x="182.2775"
+         height="63.362904"
+         width="63.362904"
+         id="rect5495-3"
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:3.67115593;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:11.01346743, 3.67115581;stroke-dashoffset:0" />
+      <flowRoot
+         transform="translate(138.63961,957.60404)"
+         style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+         id="flowRoot6361-6"
+         xml:space="preserve"><flowRegion
+           id="flowRegion6363-4"><rect
+             style="font-size:10px"
+             y="24.655426"
+             x="49.728741"
+             height="48.892963"
+             width="51.400291"
+             id="rect6365-3" /></flowRegion><flowPara
+           id="flowPara6369-7">Debug</flowPara><flowPara
+           id="flowPara6423">File</flowPara></flowRoot>    </g>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:none;marker-end:url(#Arrow2Lend)"
+       d="m 245.6898,859.84905 55.5094,0"
+       id="path6458"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#rect4668"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-end="#g6442"
+       inkscape:connection-end-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 191.99242,913.54642 1e-5,42.36937"
+       id="path6460"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#rect4668"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-end="#g6450"
+       inkscape:connection-end-point="d4" />
+    <text
+       xml:space="preserve"
+       style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       x="192.12915"
+       y="862.83185"
+       id="text7050"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan7052"
+         x="192.12915"
+         y="862.83185">Assembler</tspan></text>
+  </g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/img/asm/tokenize.svg	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,1199 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="744.09448"
+   height="1175"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="tokenize.svg">
+  <defs
+     id="defs4">
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Mend"
+       style="overflow:visible">
+      <path
+         id="path8787"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
+         transform="matrix(-0.4,0,0,-0.4,-4,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lstart"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow2Lstart"
+       style="overflow:visible">
+      <path
+         id="path4133"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(1.1,0,0,1.1,1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Lend"
+       style="overflow:visible">
+      <path
+         id="path4118"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
+         transform="matrix(-0.8,0,0,-0.8,-10,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow2Lend"
+       style="overflow:visible">
+      <path
+         id="path4136"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow2Lend-7"
+       style="overflow:visible">
+      <path
+         id="path4136-2"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.70710678"
+     inkscape:cx="237.64123"
+     inkscape:cy="703.61994"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1438"
+     inkscape:window-height="879"
+     inkscape:window-x="0"
+     inkscape:window-y="19"
+     inkscape:window-maximized="0"
+     showguides="true"
+     inkscape:guide-bbox="true" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,122.63786)">
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       x="295.35449"
+       y="542.02991"
+       id="text8341"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8343"
+         x="295.35449"
+         y="542.02991" /></text>
+    <rect
+       style="fill:#00ff00;fill-opacity:0.40865389;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="rect2993-3-1"
+       width="139.46968"
+       height="42.791836"
+       x="62.675171"
+       y="-116.2702"
+       ry="30" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="132.45392"
+       y="-89.394287"
+       id="text8250"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8252"
+         x="132.45392"
+         y="-89.394287">start</tspan></text>
+    <path
+       sodipodi:type="star"
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="path3042-3"
+       sodipodi:sides="4"
+       sodipodi:cx="196.52547"
+       sodipodi:cy="242.48708"
+       sodipodi:r1="61.647663"
+       sodipodi:r2="53.099487"
+       sodipodi:arg1="0.80357798"
+       sodipodi:arg2="1.5889762"
+       inkscape:flatsided="true"
+       inkscape:rounded="0"
+       inkscape:randomized="0"
+       d="m 239.3173,286.86379 -87.16855,-1.58488 1.58488,-87.16855 87.16856,1.58488 z"
+       transform="matrix(-1.974841,-0.02256612,-0.31551589,0.50371948,596.53827,-138.17184)" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="132.62114"
+       y="-16.741211"
+       id="text8250-1"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8252-6"
+         x="132.62114"
+         y="-16.741211"
+         style="font-size:16px">args[0...n] = input</tspan><tspan
+         sodipodi:role="line"
+         x="132.62114"
+         y="3.2587891"
+         id="tspan8275"
+         style="font-size:16px" /></text>
+    <rect
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="rect2993-3-8-1"
+       width="139.46968"
+       height="42.791836"
+       x="62.675171"
+       y="36.17038" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="132.17053"
+       y="63.065308"
+       id="text8250-1-3"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8252-6-2"
+         x="132.17053"
+         y="63.065308"
+         style="font-size:18px">i = 0</tspan><tspan
+         sodipodi:role="line"
+         x="132.17053"
+         y="85.565308"
+         id="tspan8275-0"
+         style="font-size:16px" /></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="83.060242"
+       y="515.01276"
+       id="text8301"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8303"
+         x="83.060242"
+         y="515.01276" /></text>
+    <path
+       sodipodi:type="star"
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="path3044-8-3"
+       sodipodi:sides="4"
+       sodipodi:cx="296.37308"
+       sodipodi:cy="236.14754"
+       sodipodi:r1="71.72361"
+       sodipodi:r2="50.716251"
+       sodipodi:arg1="0.78539816"
+       sodipodi:arg2="1.5707963"
+       inkscape:flatsided="true"
+       inkscape:rounded="0"
+       inkscape:randomized="0"
+       d="m 347.08933,286.86379 -101.4325,0 0,-101.4325 101.4325,0 z"
+       transform="matrix(0.75560471,-0.60002407,0.79627536,0.52447694,-279.56934,358.59397)" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="131.86401"
+       y="300.68292"
+       id="text8316"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         x="131.86401"
+         y="300.68292"
+         id="tspan8320"
+         style="font-size:14px">is args[i]</tspan><tspan
+         sodipodi:role="line"
+         x="131.86401"
+         y="318.18292"
+         style="font-size:14px"
+         id="tspan3302">immediate data?</tspan></text>
+    <rect
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="rect2993-3-8-1-2-7"
+       width="139.46968"
+       height="42.791836"
+       x="62.41877"
+       y="388.33795" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="132.00473"
+       y="412.79785"
+       id="text8389"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8391"
+         x="132.00473"
+         y="412.79785"
+         style="font-size:16px">sym[i] = data</tspan></text>
+    <rect
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="rect2993-3-8-1-2-78"
+       width="139.46968"
+       height="42.791836"
+       x="241.46999"
+       y="388.33795" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="311.31195"
+       y="412.74988"
+       id="text8393"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395"
+         x="311.31195"
+         y="412.74988"
+         style="font-size:16px">sym[i] = pointer</tspan></text>
+    <rect
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="rect2993-3-8-1-2"
+       width="139.46968"
+       height="42.791836"
+       x="421.9267"
+       y="387.22101" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="491.99268"
+       y="411.68091"
+       id="text8393-9"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4"
+         x="491.99268"
+         y="411.68091"
+         style="font-size:16px">sym[i] = address</tspan></text>
+    <g
+       id="g3283"
+       transform="translate(-21.09176,-38.45473)">
+      <g
+         transform="translate(1.7695545,22.011853)"
+         id="g3241">
+        <text
+           xml:space="preserve"
+           style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+           x="626.03564"
+           y="806.57513"
+           id="text8250-1-2"
+           sodipodi:linespacing="125%"><tspan
+             sodipodi:role="line"
+             id="tspan8252-6-5"
+             x="626.03564"
+             y="806.57513"
+             style="font-size:18px">does i = n?</tspan><tspan
+             sodipodi:role="line"
+             x="626.03564"
+             y="829.07513"
+             id="tspan8275-7"
+             style="font-size:16px" /></text>
+        <path
+           sodipodi:type="star"
+           style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+           id="path3044-8-3-4"
+           sodipodi:sides="4"
+           sodipodi:cx="296.37308"
+           sodipodi:cy="236.14754"
+           sodipodi:r1="71.72361"
+           sodipodi:r2="50.716251"
+           sodipodi:arg1="0.78539816"
+           sodipodi:arg2="1.5707963"
+           inkscape:flatsided="true"
+           inkscape:rounded="0"
+           inkscape:randomized="0"
+           d="m 347.08933,286.86379 -101.4325,0 0,-101.4325 101.4325,0 z"
+           transform="matrix(0.75560471,-0.60002407,0.79627536,0.52447694,213.80979,855.05318)" />
+      </g>
+    </g>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="315.88773"
+       y="299.17093"
+       id="text8316-9"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         x="319.56546"
+         y="299.17093"
+         id="tspan8320-3"
+         style="font-size:14px">is args[i] a </tspan><tspan
+         sodipodi:role="line"
+         x="315.88773"
+         y="316.67093"
+         style="font-size:14px"
+         id="tspan3306">data pointer?</tspan></text>
+    <path
+       sodipodi:type="star"
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="path3044-8-3-0"
+       sodipodi:sides="4"
+       sodipodi:cx="296.37308"
+       sodipodi:cy="236.14754"
+       sodipodi:r1="71.72361"
+       sodipodi:r2="50.716251"
+       sodipodi:arg1="0.78539816"
+       sodipodi:arg2="1.5707963"
+       inkscape:flatsided="true"
+       inkscape:rounded="0"
+       inkscape:randomized="0"
+       d="m 347.08933,286.86379 -101.4325,0 0,-101.4325 101.4325,0 z"
+       transform="matrix(0.75560471,-0.60002407,0.79627536,0.52447694,-97.54562,358.59397)" />
+    <path
+       sodipodi:type="star"
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="path3044-8-3-1"
+       sodipodi:sides="4"
+       sodipodi:cx="296.37308"
+       sodipodi:cy="236.14754"
+       sodipodi:r1="71.72361"
+       sodipodi:r2="50.716251"
+       sodipodi:arg1="0.78539816"
+       sodipodi:arg2="1.5707963"
+       inkscape:flatsided="true"
+       inkscape:rounded="0"
+       inkscape:randomized="0"
+       d="m 347.08933,286.86379 -101.4325,0 0,-101.4325 101.4325,0 z"
+       transform="matrix(0.75560471,-0.60002407,0.79627536,0.52447694,-279.56934,227.9244)" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="133.86401"
+       y="161.70236"
+       id="text8316-5"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         x="137.54175"
+         y="161.70236"
+         id="tspan8320-7"
+         style="font-size:14px">is args[i] a </tspan><tspan
+         id="tspan8559"
+         sodipodi:role="line"
+         x="133.86401"
+         y="179.20236"
+         style="font-size:14px">reserved</tspan><tspan
+         id="tspan8561"
+         sodipodi:role="line"
+         x="133.86401"
+         y="196.70236"
+         style="font-size:14px">arg?</tspan></text>
+    <g
+       id="g3253"
+       transform="translate(-45.67451,-56.45473)">
+      <rect
+         ry="30"
+         y="1000.5895"
+         x="584.40662"
+         height="42.791836"
+         width="139.46968"
+         id="rect2993-3"
+         style="fill:#ff0000;fill-opacity:0.57692309;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0" />
+      <text
+         sodipodi:linespacing="125%"
+         id="text8563"
+         y="1028.0354"
+         x="653.72534"
+         style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+         xml:space="preserve"><tspan
+           y="1028.0354"
+           x="653.72534"
+           id="tspan8565"
+           sodipodi:role="line">end</tspan></text>
+    </g>
+    <path
+       sodipodi:type="star"
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="path3044-8-3-1-3"
+       sodipodi:sides="4"
+       sodipodi:cx="296.37308"
+       sodipodi:cy="236.14754"
+       sodipodi:r1="71.72361"
+       sodipodi:r2="50.716251"
+       sodipodi:arg1="0.78539816"
+       sodipodi:arg2="1.5707963"
+       inkscape:flatsided="true"
+       inkscape:rounded="0"
+       inkscape:randomized="0"
+       d="m 347.08933,286.86379 -101.4325,0 0,-101.4325 101.4325,0 z"
+       transform="matrix(0.75560471,-0.60002407,0.79627536,0.52447694,-281.82575,732.03502)" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="132.42233"
+       y="657.37396"
+       id="text8316-5-9"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         x="132.42233"
+         y="657.37396"
+         style="font-size:14px"
+         id="tspan3314">is args[i]</tspan><tspan
+         id="tspan8679"
+         sodipodi:role="line"
+         x="132.42233"
+         y="674.87396"
+         style="font-size:14px">arithmetic</tspan><tspan
+         id="tspan8685"
+         sodipodi:role="line"
+         x="132.42233"
+         y="692.37396"
+         style="font-size:14px">to evaluate?</tspan></text>
+    <rect
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="rect2993-3-8-1-2-2"
+       width="139.46968"
+       height="42.791836"
+       x="261.80731"
+       y="147.95143" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="331.87329"
+       y="173.06735"
+       id="text8393-9-8"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3"
+         x="331.87329"
+         y="173.06735"
+         style="font-size:16px">sym[i] = args[i]</tspan></text>
+    <path
+       sodipodi:type="star"
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="path3042-3-1"
+       sodipodi:sides="4"
+       sodipodi:cx="196.52547"
+       sodipodi:cy="242.48708"
+       sodipodi:r1="61.647663"
+       sodipodi:r2="53.099487"
+       sodipodi:arg1="0.80357798"
+       sodipodi:arg2="1.5889762"
+       inkscape:flatsided="true"
+       inkscape:rounded="0"
+       inkscape:randomized="0"
+       d="m 239.3173,286.86379 -87.16855,-1.58488 1.58488,-87.16855 87.16856,1.58488 z"
+       transform="matrix(-2.2519332,-0.02253254,-0.35978629,0.50297001,1138.2728,766.54646)" />
+    <path
+       sodipodi:type="star"
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="path3044-8-3-1-3-6"
+       sodipodi:sides="4"
+       sodipodi:cx="296.37308"
+       sodipodi:cy="236.14754"
+       sodipodi:r1="71.72361"
+       sodipodi:r2="50.716251"
+       sodipodi:arg1="0.78539816"
+       sodipodi:arg2="1.5707963"
+       inkscape:flatsided="true"
+       inkscape:rounded="0"
+       inkscape:randomized="0"
+       d="m 347.08933,286.86379 -101.4325,0 0,-101.4325 101.4325,0 z"
+       transform="matrix(0.75560471,-0.60002407,0.79627536,0.52447694,-280.7804,598.25081)" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="132.21671"
+       y="530.77875"
+       id="text8316-5-9-4"
+       sodipodi:linespacing="125%"><tspan
+         id="tspan8685-8"
+         sodipodi:role="line"
+         x="132.21671"
+         y="530.77875"
+         style="font-size:14px">is args[i]</tspan><tspan
+         sodipodi:role="line"
+         x="132.21671"
+         y="548.27875"
+         style="font-size:14px"
+         id="tspan3312">represented as a</tspan><tspan
+         sodipodi:role="line"
+         x="132.21671"
+         y="565.77875"
+         style="font-size:14px"
+         id="tspan8743">a string?</tspan></text>
+    <rect
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="rect2993-3-8-1-2-7-1"
+       width="139.46968"
+       height="42.791836"
+       x="241.34789"
+       y="649.97302" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="311.37387"
+       y="675.08887"
+       id="text8389-5"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8391-5"
+         x="311.37387"
+         y="675.08887"
+         style="font-size:16px">args[i] = result</tspan></text>
+    <rect
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1.25857234;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1.25857228, 1.25857228;stroke-dashoffset:0"
+       id="rect2993-3-8-1-2-7-1-6"
+       width="222.2636"
+       height="42.533257"
+       x="360.81879"
+       y="521.13409" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="473.31332"
+       y="545.45667"
+       id="text8389-5-2"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8391-5-1"
+         x="473.31332"
+         y="545.45667"
+         style="font-size:16px">append string to constant</tspan></text>
+    <rect
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1.16464615;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1.16464611, 1.16464611;stroke-dashoffset:0"
+       id="rect2993-3-8-1-2-7-1-6-1"
+       width="189.90744"
+       height="42.62719"
+       x="36.301033"
+       y="772.53064" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="131.85547"
+       y="797.56433"
+       id="text8389-5-2-1"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8391-5-1-8"
+         x="131.85547"
+         y="797.56433"
+         style="font-size:16px">value = stoi(args[i])</tspan></text>
+    <g
+       id="g8456-7"
+       transform="translate(516.19326,268.51923)">
+      <rect
+         y="395.26941"
+         x="20.538843"
+         height="42.791836"
+         width="139.46968"
+         id="rect2993-3-8-1-4"
+         style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0" />
+      <text
+         sodipodi:linespacing="125%"
+         id="text8250-1-3-7"
+         y="422.16434"
+         x="90.034203"
+         style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+         xml:space="preserve"><tspan
+           style="font-size:18px"
+           y="422.16434"
+           x="90.034203"
+           id="tspan8252-6-2-1"
+           sodipodi:role="line">i = i + 1</tspan><tspan
+           style="font-size:16px"
+           id="tspan8275-0-4"
+           y="444.66434"
+           x="90.034203"
+           sodipodi:role="line" /></text>
+    </g>
+    <path
+       sodipodi:type="star"
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       id="path3044-8-3-1-3-6-0"
+       sodipodi:sides="4"
+       sodipodi:cx="296.37308"
+       sodipodi:cy="236.14754"
+       sodipodi:r1="71.72361"
+       sodipodi:r2="50.716251"
+       sodipodi:arg1="0.78539816"
+       sodipodi:arg2="1.5707963"
+       inkscape:flatsided="true"
+       inkscape:rounded="0"
+       inkscape:randomized="0"
+       d="m 347.08933,286.86379 -101.4325,0 0,-101.4325 101.4325,0 z"
+       transform="matrix(0.75560471,-0.60002407,0.79627536,0.52447694,-281.62865,947.24619)" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="134.96913"
+       y="895.25928"
+       id="text8316-5-9-4-5"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         x="134.96913"
+         y="895.25928"
+         style="font-size:16px"
+         id="tspan8743-8">is value 'NaN'</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1.05200005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Lend)"
+       d="m 132.19919,-73.52386 -0.0596,26.98314"
+       id="path8955"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="M 132.0608,1.5943673 132.27652,36.17038"
+       id="path8957"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#path3042-3"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-end="#rect2993-3-8-1"
+       inkscape:connection-end-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 132.41001,78.962215 1e-5,39.313265"
+       id="path8959"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#rect2993-3-8-1"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-end="#path3044-8-3-1"
+       inkscape:connection-end-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 132.41002,229.61923 0,19.32582"
+       id="path8963"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#path3044-8-3-1"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-end="#path3044-8-3"
+       inkscape:connection-end-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 206.29063,304.61693 34.2625,0"
+       id="path8965"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#path3044-8-3"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-end="#path3044-8-3-0"
+       inkscape:connection-end-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1.24654627px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 131.46693,359.81664 0.13468,28.39802"
+       id="path8967"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 312.75756,359.18477 -0.89551,29.15318"
+       id="path8969"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#path3044-8-3-0"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-end="#rect2993-3-8-1-2-78"
+       inkscape:connection-end-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 208.5042,172.18956 53.30311,-1.23132"
+       id="path3237"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#path3044-8-3-1"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-end="#rect2993-3-8-1-2-2"
+       inkscape:connection-end-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 606.46694,706.58047 0,21.43057"
+       id="path3258"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#g8456-7"
+       inkscape:connection-start-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 608.46702,906.10378 -5e-5,38.03097"
+       id="path3279"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-end="#g3253"
+       inkscape:connection-end-point="d4"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-start="#path3042-3-1" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.78829396px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 607.03129,840.04032 1.09861,22.12306"
+       id="path3290"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.85670489px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:none"
+       d="m 132.23786,457.31266 360.25857,1.26397"
+       id="path3264"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1.03381896px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 304.9482,431.14667 0.77759,26.78107"
+       id="path3266"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 130.68639,734.08078 0.36567,38.44986"
+       id="path3270"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#path3044-8-3-1-3"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-end="#rect2993-3-8-1-2-7-1-6-1"
+       inkscape:connection-end-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 207.6418,675.1932 33.70609,-1.24613"
+       id="path3229"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#path3044-8-3-1-3"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-end="#rect2993-3-8-1-2-7-1"
+       inkscape:connection-end-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.79428124px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 311.09296,692.66197 -0.69799,50.59138"
+       id="path3231"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.91451746px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 311.10092,744.11531 -179.3945,1.20615"
+       id="path3235"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 129.51596,815.15786 0.23558,22.04476"
+       id="path3246"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-end-point="d4"
+       inkscape:connection-end="#path3044-8-3-1-3-6-0" />
+    <rect
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1.1716733;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1.1716732, 1.1716732;stroke-dashoffset:0"
+       id="rect2993-3-8-1-2-7-1-6-6"
+       width="192.23773"
+       height="42.620155"
+       x="247.23563"
+       y="871.02332" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="343.77359"
+       y="895.3894"
+       id="text8389-5-2-19"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8391-5-1-0"
+         x="343.77359"
+         y="895.3894"
+         style="font-size:16px">sym[i] = label</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 204.64231,892.94277 42.59332,-0.18711"
+       id="path3272"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-end="#rect2993-3-8-1-2-7-1-6-6"
+       inkscape:connection-end-point="d4"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-start="#path3044-8-3-1-3-6-0" />
+    <rect
+       style="fill:#0040ff;fill-opacity:0.0745098;stroke:#000000;stroke-width:1.46699059;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1.46699043, 1.46699043;stroke-dashoffset:0"
+       id="rect2993-3-8-1-2-7-1-6-0"
+       width="209.37613"
+       height="61.343433"
+       x="28.555473"
+       y="982.75464" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="131.28531"
+       y="1008.558"
+       id="text8389-5-2-2"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8391-5-1-3"
+         x="131.28531"
+         y="1008.558"
+         style="font-size:16px">append values bit string</tspan><tspan
+         sodipodi:role="line"
+         x="131.28531"
+         y="1028.558"
+         style="font-size:16px"
+         id="tspan3298">to constant</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.88974255px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:none"
+       d="m 491.6318,387.27615 0.30329,-81.97259"
+       id="path3302"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.92523205px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 387.95691,304.8337 104.75288,0.56237"
+       id="path3304"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:none;marker-end:url(#Arrow2Lend)"
+       d="m 132.00179,431.12979 -0.40964,57.73108"
+       id="path3306"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#rect2993-3-8-1-2-7"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-end="#path3044-8-3-1-3-6"
+       inkscape:connection-end-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 130.76618,599.66059 -0.1798,23.01057"
+       id="path3308"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#path3044-8-3-1-3-6"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-end="#path3044-8-3-1-3"
+       inkscape:connection-end-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 205.59454,543.86483 155.22425,-0.85324"
+       id="path3310"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#path3044-8-3-1-3-6"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-end="#rect2993-3-8-1-2-7-1-6"
+       inkscape:connection-end-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 131.71263,949.83807 0.79247,32.91657"
+       id="path3318"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#path3044-8-3-1-3-6-0"
+       inkscape:connection-start-point="d4"
+       inkscape:connection-end="#rect2993-3-8-1-2-7-1-6-0"
+       inkscape:connection-end-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 439.47336,894.51121 27.04847,0.61285"
+       id="path3324"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#rect2993-3-8-1-2-7-1-6-6"
+       inkscape:connection-start-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.93900001;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Lend-7)"
+       d="m 609.75706,168.66814 -1.64627,496.48963"
+       id="path3330"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cc" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.82980251px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:none"
+       d="m 400.55004,168.66814 208.69634,0"
+       id="path3332"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cc" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 491.75691,430.01284 0.12305,27.60737"
+       id="path7842"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#rect2993-3-8-1-2"
+       inkscape:connection-start-point="d4" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="222.05446"
+       y="297.86923"
+       id="text8393-9-8-6"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3-9"
+         x="222.05446"
+         y="297.86923"
+         style="font-size:18px">no</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="408.81122"
+       y="297.86923"
+       id="text8393-9-8-6-8"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3-9-8"
+         x="408.81122"
+         y="297.86923"
+         style="font-size:18px">no</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="111.04599"
+       y="241.03494"
+       id="text8393-9-8-6-0"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3-9-4"
+         x="111.04599"
+         y="241.03494"
+         style="font-size:18px">no</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="111.04599"
+       y="615.17029"
+       id="text8393-9-8-6-6"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3-9-7"
+         x="111.04599"
+         y="615.17029"
+         style="font-size:18px">no</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="111.04599"
+       y="748.53137"
+       id="text8393-9-8-6-6-2"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3-9-7-4"
+         x="111.04599"
+         y="748.53137"
+         style="font-size:18px">no</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="111.04599"
+       y="962.58148"
+       id="text8393-9-8-6-6-21"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3-9-7-2"
+         x="111.04599"
+         y="962.58148"
+         style="font-size:18px">no</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="155.29587"
+       y="374.07806"
+       id="text8393-9-8-6-6-8"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3-9-7-04"
+         x="155.29587"
+         y="374.07806"
+         style="font-size:18px">yes</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="333.91293"
+       y="376.88074"
+       id="text8393-9-8-6-6-8-6"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3-9-7-04-7"
+         x="333.91293"
+         y="376.88074"
+         style="font-size:18px">yes</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="229.05162"
+       y="536.96594"
+       id="text8393-9-8-6-6-8-34"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3-9-7-04-4"
+         x="229.05162"
+         y="536.96594"
+         style="font-size:18px">yes</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="226.08617"
+       y="883.01514"
+       id="text8393-9-8-6-6-8-5"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3-9-7-04-6"
+         x="226.08617"
+         y="883.01514"
+         style="font-size:18px">yes</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="581.86676"
+       y="849.70691"
+       id="text8393-9-8-6-6-8-8"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3-9-7-04-8"
+         x="581.86676"
+         y="849.70691"
+         style="font-size:18px">yes</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.94057953px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:none"
+       d="m 133.68455,92.52714 593.55688,0"
+       id="path12980"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cc" />
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="697.27765"
+       y="777.02643"
+       id="text8393-9-8-6-6-21-5"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3-9-7-2-7"
+         x="697.27765"
+         y="777.02643"
+         style="font-size:18px">no</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="609.16821"
+       y="888.09198"
+       id="text8389-5-2-19-3"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8391-5-1-0-7"
+         x="609.16821"
+         y="888.09198"
+         style="font-size:16px">output = sym, constant</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="235.30411"
+       y="161.8342"
+       id="text8393-9-8-6-6-8-6-6"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3-9-7-04-7-1"
+         x="235.30411"
+         y="161.8342"
+         style="font-size:18px">yes</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Latin Modern Mono;-inkscape-font-specification:Latin Modern Mono"
+       x="221.90758"
+       y="663.37402"
+       id="text8393-9-8-6-6-8-34-5"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan8395-4-3-9-7-04-4-2"
+         x="221.90758"
+         y="663.37402"
+         style="font-size:18px">yes</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 583.08238,541.91248 23.92773,-0.10512"
+       id="path3467"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#rect2993-3-8-1-2-7-1-6"
+       inkscape:connection-start-point="d4" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1.07589662px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 466.241,952.89545 0,-326.99884"
+       id="path4637"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cc" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.96755284px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+       d="m 466.241,626.40279 140.06385,1.71346"
+       id="path4641"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cc" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.73932183px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 680.03365,784.50292 45.30004,0.71429"
+       id="path4831"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.97020918px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+       d="m 725.093,785.62912 0,-693.10198"
+       id="path4835"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cc" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.96885246px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 237.91603,1012.9579 30.80012,-0.2093"
+       id="path3493"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.93394142px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 269.37465,1013.5043 0.77317,-60.92016"
+       id="path3495"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.98644656;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Lend-7);display:inline"
+       d="m 269.94394,952.6495 196.0346,0.71257"
+       id="path3497"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+  </g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/img/dbg/debugger_overview.svg	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   version="1.1"
+   width="350"
+   height="250"
+   id="svg2"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="debug_abstraction.svg">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1438"
+     inkscape:window-height="879"
+     id="namedview7079"
+     showgrid="false"
+     inkscape:zoom="2.728"
+     inkscape:cx="154.83871"
+     inkscape:cy="125.60902"
+     inkscape:window-x="0"
+     inkscape:window-y="19"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg2" />
+  <defs
+     id="defs4">
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="Arrow2Lstart"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(1.1,0,0,1.1,1.1,0)"
+         id="path3875"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="Arrow2Lend"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         id="path3878"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="Arrow1Lend"
+       style="overflow:visible">
+      <path
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         transform="matrix(-0.8,0,0,-0.8,-10,0)"
+         id="path3860"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="Arrow1Lstart"
+       style="overflow:visible">
+      <path
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         transform="matrix(0.8,0,0,0.8,10,0)"
+         id="path3857"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
+         inkscape:connector-curvature="0" />
+    </marker>
+  </defs>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="g7233"
+     transform="translate(-20.064516,-0.3607038)">
+    <g
+       transform="translate(53.677419,-883.20089)"
+       id="g8247">
+      <image
+         xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABHNCSVQICAgIfAhkiAAADR9JREFU eJzt3W+MHVUZx/Hf0z/sdrdNWxAoEgOxgYQa/lRawEQriom8QeoLjIE0EUMiL1AREwRN/BsDGBMr IWLUKAmoiSZawgvlRRWJiVJARAwaDAGq0bRg2Er/bMu2jy/ubPfudu/uzM6ZPTN9vp/kJOVy55xn 9878dubM3BlzdwGIaUnuAgDkQwAAgREAQGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgREAQGAE ABAYAQAERgAAgREAQGAEABAYAQAERgAAgS3LXUAXmNkSSedL2tTX1kuynHXhOJf0oqSn+toL7n4s a1UdYNwTcG5m9j5JP5R0buZSUM3Lkj7u7r/NXUibcQgwgJmNmNm9knaKjb+LzpW008zuNbOR3MW0 FXsAszCzCyQ9LOm83LUgiX9Iutbd/5a7kLYhAGYws2WSdknamLsWJPWMpMvcfSJ3IW3CIcCJPi82 /pPRRvU+W/RhD6CPmV0s6UlJy3PXgka8KWmzuz+bu5C2YA9gum+Jjf9ktly9zxgF9gAKZrZU0huS VuSuBY06JGmVux/NXUgbsAcw5R1i449ghXqfNUQA9NuUuwAsGj7rAgEwhZUiDj7rAgEw5a25C8Ci 4bMuEABAYAQAEBhfB27OAUl/krRPvWPOdXnLAU7EHkB6D0u6RNJqd9/i7te4+1mS3ibpi+pdjQa0 AgGQzpikbe6+1d2fnXmhibv/y92/JmmzpOeyVAjMQACkc727PzTfm4rr0D8g6dXmSwLmRgCk8X13 /1XZN7v7Xkk3N1gPUAoBUN8RSZ+tupC7/0ISt6tCVgRAfX919zcWuOzvk1YCVEQA1Pd0jWV3JasC WAACoL5/1lh2d7IqgAUgAOq7sMayFyerAlgAAqC+S2ssuzlZFcACEAD1vd3MNlRdyMxOkXR1A/UA pREAaTxQ3FKsii+L5w4gMwIgjc2SvlD2zWb2Lkm3N1cOUA4BkM5XzOwhM1s76A1mtsTMPiPpN5Kq 7jEAyfF14LRukPT+4pmCT6r3deCD6p0peKekbZLena88YDoCIL2zJN3V998T4veMluIQoHls/Ggt AgAIjAAAAiMAgMAIACAwAgAIjAAAAiMAgMA6cY7azIYkDbzENpGhhvtHewyZWdMPannd3Q83PEZt 5u65a5iXmW2V9MvcdQAVfNjdd+QuYj4cAgCBEQBAYAQAEBgBAARGAACBZTsNaGZLJK2co432/Xvj gG5ek/SeBOXcJ+mqBP2gO3ZKuiVBP7skrZrl9evN7AJJ+4t2oO/fJzR3P5aglspKB4CZrZG0WnNv tIM24NnaigT1H3X3v9ftxMz2J6gF3bI/0bozaMO9rmhl+zmkOQJC8wTIjLbP3cfKjFtlD+Ax8SAL oCkrinZ6gr6elXRJmTcyBwAERgAAgREAQGBt/DLQYZWf7NibqUZg0u2STlO5ie/J1ppnQqQIgDFJ r6raLOXAWU53n0hQE7Ao3P17VZcxs2FVO2M26CzbOtWcNEwRAHe6+3cT9AOE4O7jksbVu45lwczs Zkn31+mDOQAgMAIACCzFIcA5ZrZBfXMAXbgTCtA1xZ2x+ucAzqnbZ4oAuKNox5nZhBY4CTjX//cu 3L4I4ZmZqdrEXtn3Jj9r19RpwGWS1hQtFTezg5oeCrvd/UMJxwAqMbNH1ZuN79+QRyRZzrrKauN1 AINMpuqopDOL15q+sSMwn8vV+5JcJzEJCARGAACBVTkEeELSIZ04MTHcQF0AyhnXiRPmfym7cOkA cPdPzPa6mS1VvZnNQcuyd4KTyTHVu1x+1mXd/WidompPAhYF7CtaMma2QlOBcI2kb6fsH2jYpyU9 oqkN9VDmembV2rMAxS/skKRXzWx37nqAina7+0u5i5hPawOgpJVmdneCfjYk6APdsiHRutPpObCu B8CopM/lLgKddJ5Yd5hoAyIjAIDACAAgMAIACKwrk4B7JD3a8BgbJZ3R8Bhoh72Snml4jD0N95+E 8RX7HjPbIena3HVgUTzs7ltzF9EGHAIAgREAQGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgREA QGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgXXijkBmdrWkBxoeZo2koYbHQDscljTW8Bgfc/df NzxGbV25J+CwpDNzF4GTxpCaX5868cQgDgGAwAgAIDACAAiMAAACa80koJmNSFrZ10b7/r1lwGJj km5MMPydki5L0A+6Y5ekuxL082NJI7O8/l4zM0n7i3ag79/73f1ggrFrq3wa0MyWavqGOqiNlnzf 5HsXsjeyx93XLWC5aXgoSEhJHg5iZmOSVi9g0WOaEQrztFLvdfejVYoovQdgZo9JulwdOb0BtNwS SauKloyZjUt6wt2vLFtEWWvExg+03bB622opTAICgREAQGCtOQswwFHNPenx73ylAZKkB9V7rPxc E99Ls1U3j5QBMK7yM5qlZjndfTxhfUBy7v7J+d5jZsNKd8ZssiWZj0sRALdKuq/q6QcgiuIP2bik 11L1WZyOv0XS9jr9pJgDOMzGDyyuYps7XLcfJgGBwFIEwFCxOwJgcdXeflPMAWyXtL24AolJQGCG 4jsBc030LWQScFTS8rq1pTwLMFy0t6Tq0MzmPQ3o7relGg+oysy+Kel0zb0hj0iyXDXOpe3XASxV 74sWg75ssUcSAYCcbtLCvgzUCkwCAoERAEBgVQJgTL2LGQC017gq3PK89BzA5PeLW3ZDEKCrunVD kEnFAPuKlkyJW4LdmnI8oGHbJT2ult8SrDVnAYpfyEFJe2f+PzNzEQDolt+5+47cRcynNQGwQMNm 9tEE/ZydoA90y9mJ1p3aF+Pk1PUAWC3pp7mLQCdtEusOE29AZAQAEBgBAARGAACBdWUS8KCkVxoe 4wxJKxoeA+1wSLOcbk6sFef551P50WAnKx4PFkqSx4KdDDgEAAIjAIDACAAgMAIACIwAAAIjAIDA CAAgMAIACIwAAAIjAIDACAAgMAIACIwAAAIjAIDACAAgMAIACIwAAAIjAIDACAAgsE7cE9DMtkj6 RsPDnC9pbcNjoB1el/RCw2Pc7u6PNzxGbV25K/Cpki7PXQROGmvV/Pp0asP9J8EhABAYAQAERgAA gREAQGCtnAQ0s1MkjUpaWbT1A966X9LXEwy5TdKGBP2gO56X9GCCfr4kaXiW19eb2QXqraP7JR1w 9yMJxkuq1mlAMzNJI5raUPvb6IDXy7TlJUvY4+7rFvwDTP0cPBYsniSPBzOzMUmrS779TU0FQtV2 YMDrB73GRlx6D8DMfiTpEp24kdtCBweCWa7eKciU15u4mc0Mhz+7+41lFq5yCLBR0sXV6wPQINPU H+T+10phEhAIjAAAAmvlWYABXNJBTT/W2Z21IkB6QtI6TZ/4HlFH5saaCoAJpZvl7D+N0v5vLiEU d//gzNeKs2NVzoKVfW/y7TVFh3erdz71+Abs7ocT9At0UvGHavIPVzJmNqTpobFN0h11+kwRAK+4 +/MJ+gEwh+IP62FJ/5UkM3ulbp9MAgKBEQBAYCkOAe4ys9s0/yReqUlAd59IUBPQSma2TGkumx+V dHrdelIEwJqiJWFmh1U+NPa6+3dSjQ1UZWafknSaym/IQ3kqnV0brwMYKtppJd67RxIBgJy+qvJf Bmod5gCAwAgAIDACAAisyhzAleod66S6vHFFih8AOEkcUr1L5fvbvrKDlg4Adx+TNFb2/fMxsyUq HyAbJV2XamxgEfxc0jMquQG7+7EcRWY7C1D8wP8r2pzMbKsIAHTLT9x9R+4i5tPG04BVLDezKxL0 wyPB4lmbaN1ZmqCPbLoeAKdK+kPuItBJW8S6w1kAIDICAAiMAAACIwCAwAgAILBajwZbLMVFQ6c0 PMzPJF3T8Bhoh0ckfaThMY7kurinik6cBix+keNNjmFmrf+wkMwxd290feoKDgGAwAgAIDACAAiM AAACIwCAwAgAIDACAAiMAAACIwCAwAgAIDACAAiMAAACIwCAwAgAIDACAAiMAAACIwCAwAgAIDAC AAiMAAACIwCAwAgAIDACAAiMAJjyn9wFYNHwWRcIgClP5S4Ai4bPukAATGGliIPPutCJZwMuBjNb JukNScO5a0GjxiWtcveJ3IW0AXsAhWKF2JW7DjRuFxv/FPYA+pjZpZL+qI48NBWVTUi6wt2fzl1I W7AH0KdYMe7JXQcacw8b/3TsAcxgZqeoN0l0Ye5akNRzkja5+5HchbQJewAzFCvIDZJeyl0LknlJ 0g1s/CciAGbh7s9JukjS/ZLYReouV+8zvKj4TDEDhwDzMLOrJP1A0rmZS0E1L0u6yd135i6kzQiA EsxsiaTzJW3qa+slWc66cJxLelG9uZvJ9oK7H8taVQcQAEBgzAEAgREAQGAEABAYAQAERgAAgREA QGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgREAQGD/B4kK3Kr1D6xp AAAAAElFTkSuQmCC "
+         x="197.47334"
+         y="887.37909"
+         width="66.739449"
+         height="66.739449"
+         id="image3047" />
+      <rect
+         width="67.741936"
+         height="67.741936"
+         x="195.77007"
+         y="886.3374"
+         id="rect3050-8"
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.99199998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+    </g>
+  </g>
+  <g
+     id="g7207"
+     transform="translate(-26.064516,27.639296)">
+    <g
+       transform="translate(-176.98098,-902.62852)"
+       id="g5953">
+      <rect
+         width="67.741936"
+         height="67.741936"
+         x="236.20287"
+         y="964.68536"
+         id="rect3050"
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.99199998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+    </g>
+    <flowRoot
+       transform="translate(-167.03226,-0.871711)"
+       style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       id="flowRoot7109"
+       xml:space="preserve"><flowRegion
+         id="flowRegion7111"><rect
+           y="84.164223"
+           x="228.44576"
+           height="59.824047"
+           width="63.343109"
+           id="rect7113" /></flowRegion><flowPara
+         style="font-size:10px"
+         id="flowPara7115">User</flowPara><flowPara
+         style="font-size:10px"
+         id="flowPara7117">Interface</flowPara></flowRoot>  </g>
+  <g
+     id="g7216"
+     transform="translate(-8.0645161,27.639296)">
+    <g
+       transform="translate(-86.13835,-902.62852)"
+       id="g5953-9">
+      <rect
+         width="67.741936"
+         height="67.741936"
+         x="236.20287"
+         y="964.68536"
+         id="rect3050-2"
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.99199998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+    </g>
+    <flowRoot
+       transform="translate(-76.32038,4.5286794)"
+       style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       id="flowRoot7109-5"
+       xml:space="preserve"><flowRegion
+         id="flowRegion7111-6"><rect
+           y="84.164223"
+           x="228.44576"
+           height="59.824047"
+           width="63.343109"
+           id="rect7113-4" /></flowRegion><flowPara
+         style="font-size:10px"
+         id="flowPara7117-5">Debugger</flowPara></flowRoot>  </g>
+  <g
+     id="g7224"
+     transform="translate(-20.064516,51.639296)">
+    <g
+       transform="translate(13.347014,-838.23375)"
+       id="g5953-9-2">
+      <rect
+         width="67.741936"
+         height="67.741936"
+         x="236.20287"
+         y="964.68536"
+         id="rect3050-2-1"
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.99199998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+    </g>
+    <flowRoot
+       transform="translate(23.018504,63.703725)"
+       style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       id="flowRoot7109-5-5"
+       xml:space="preserve"><flowRegion
+         id="flowRegion7111-6-3"><rect
+           y="84.164223"
+           x="228.44576"
+           height="59.824047"
+           width="63.343109"
+           id="rect7113-4-6" /></flowRegion><flowPara
+         style="font-size:10px"
+         id="flowPara7117-5-8">Emulator</flowPara><flowPara
+         id="flowPara7205"
+         style="font-size:10px">Process</flowPara></flowRoot>  </g>
+  <path
+     style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:url(#Arrow2Lend)"
+     d="m 100.89931,123.56711 41.10069,0"
+     id="path7238"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-start="#g7207"
+     inkscape:connection-start-point="d4"
+     inkscape:connection-end="#g7216"
+     inkscape:connection-end-point="d4" />
+  <path
+     style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:url(#Arrow2Lend)"
+     d="m 209.74194,89.914899 19.64103,-19.51418"
+     id="path7240"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-start="#g7216"
+     inkscape:connection-start-point="d4"
+     inkscape:connection-end="#g7233"
+     inkscape:connection-end-point="d4" />
+  <path
+     style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:url(#Arrow2Lend)"
+     d="m 209.39347,157.43808 20.44036,20.65283"
+     id="path7242"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-start="#g7216"
+     inkscape:connection-start-point="d4"
+     inkscape:connection-end="#g7224"
+     inkscape:connection-end-point="d4" />
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/img/ede/aued.svg	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,482 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   version="1.1"
+   width="500"
+   height="300"
+   id="svg2"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="aued.svg">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1438"
+     inkscape:window-height="879"
+     id="namedview7079"
+     showgrid="false"
+     inkscape:zoom="1.364"
+     inkscape:cx="278.04252"
+     inkscape:cy="157.58194"
+     inkscape:window-x="0"
+     inkscape:window-y="19"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg2" />
+  <defs
+     id="defs4">
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="Arrow2Lstart"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(1.1,0,0,1.1,1.1,0)"
+         id="path3875"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="Arrow2Lend"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         id="path3878"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="Arrow1Lend"
+       style="overflow:visible">
+      <path
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         transform="matrix(-0.8,0,0,-0.8,-10,0)"
+         id="path3860"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="Arrow1Lstart"
+       style="overflow:visible">
+      <path
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         transform="matrix(0.8,0,0,0.8,10,0)"
+         id="path3857"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow2Lend-2"
+       style="overflow:visible">
+      <path
+         id="path5528"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker4125"
+       style="overflow:visible">
+      <path
+         id="path4127"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker4129"
+       style="overflow:visible">
+      <path
+         id="path4131"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow2Lend-1"
+       style="overflow:visible">
+      <path
+         id="path5528-0"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker4657"
+       style="overflow:visible">
+      <path
+         id="path4659"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker4661"
+       style="overflow:visible">
+      <path
+         id="path4663"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+  </defs>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="g7233"
+     transform="translate(142.70967,24.26686)">
+    <g
+       transform="translate(53.677419,-883.20089)"
+       id="g8247">
+      <image
+         xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABHNCSVQICAgIfAhkiAAADR9JREFU eJzt3W+MHVUZx/Hf0z/sdrdNWxAoEgOxgYQa/lRawEQriom8QeoLjIE0EUMiL1AREwRN/BsDGBMr IWLUKAmoiSZawgvlRRWJiVJARAwaDAGq0bRg2Er/bMu2jy/ubPfudu/uzM6ZPTN9vp/kJOVy55xn 9878dubM3BlzdwGIaUnuAgDkQwAAgREAQGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgREAQGAE ABAYAQAERgAAgREAQGAEABAYAQAERgAAgS3LXUAXmNkSSedL2tTX1kuynHXhOJf0oqSn+toL7n4s a1UdYNwTcG5m9j5JP5R0buZSUM3Lkj7u7r/NXUibcQgwgJmNmNm9knaKjb+LzpW008zuNbOR3MW0 FXsAszCzCyQ9LOm83LUgiX9Iutbd/5a7kLYhAGYws2WSdknamLsWJPWMpMvcfSJ3IW3CIcCJPi82 /pPRRvU+W/RhD6CPmV0s6UlJy3PXgka8KWmzuz+bu5C2YA9gum+Jjf9ktly9zxgF9gAKZrZU0huS VuSuBY06JGmVux/NXUgbsAcw5R1i449ghXqfNUQA9NuUuwAsGj7rAgEwhZUiDj7rAgEw5a25C8Ci 4bMuEABAYAQAEBhfB27OAUl/krRPvWPOdXnLAU7EHkB6D0u6RNJqd9/i7te4+1mS3ibpi+pdjQa0 AgGQzpikbe6+1d2fnXmhibv/y92/JmmzpOeyVAjMQACkc727PzTfm4rr0D8g6dXmSwLmRgCk8X13 /1XZN7v7Xkk3N1gPUAoBUN8RSZ+tupC7/0ISt6tCVgRAfX919zcWuOzvk1YCVEQA1Pd0jWV3JasC WAACoL5/1lh2d7IqgAUgAOq7sMayFyerAlgAAqC+S2ssuzlZFcACEAD1vd3MNlRdyMxOkXR1A/UA pREAaTxQ3FKsii+L5w4gMwIgjc2SvlD2zWb2Lkm3N1cOUA4BkM5XzOwhM1s76A1mtsTMPiPpN5Kq 7jEAyfF14LRukPT+4pmCT6r3deCD6p0peKekbZLena88YDoCIL2zJN3V998T4veMluIQoHls/Ggt AgAIjAAAAiMAgMAIACAwAgAIjAAAAiMAgMA6cY7azIYkDbzENpGhhvtHewyZWdMPannd3Q83PEZt 5u65a5iXmW2V9MvcdQAVfNjdd+QuYj4cAgCBEQBAYAQAEBgBAARGAACBZTsNaGZLJK2co432/Xvj gG5ek/SeBOXcJ+mqBP2gO3ZKuiVBP7skrZrl9evN7AJJ+4t2oO/fJzR3P5aglspKB4CZrZG0WnNv tIM24NnaigT1H3X3v9ftxMz2J6gF3bI/0bozaMO9rmhl+zmkOQJC8wTIjLbP3cfKjFtlD+Ax8SAL oCkrinZ6gr6elXRJmTcyBwAERgAAgREAQGBt/DLQYZWf7NibqUZg0u2STlO5ie/J1ppnQqQIgDFJ r6raLOXAWU53n0hQE7Ao3P17VZcxs2FVO2M26CzbOtWcNEwRAHe6+3cT9AOE4O7jksbVu45lwczs Zkn31+mDOQAgMAIACCzFIcA5ZrZBfXMAXbgTCtA1xZ2x+ucAzqnbZ4oAuKNox5nZhBY4CTjX//cu 3L4I4ZmZqdrEXtn3Jj9r19RpwGWS1hQtFTezg5oeCrvd/UMJxwAqMbNH1ZuN79+QRyRZzrrKauN1 AINMpuqopDOL15q+sSMwn8vV+5JcJzEJCARGAACBVTkEeELSIZ04MTHcQF0AyhnXiRPmfym7cOkA cPdPzPa6mS1VvZnNQcuyd4KTyTHVu1x+1mXd/WidompPAhYF7CtaMma2QlOBcI2kb6fsH2jYpyU9 oqkN9VDmembV2rMAxS/skKRXzWx37nqAina7+0u5i5hPawOgpJVmdneCfjYk6APdsiHRutPpObCu B8CopM/lLgKddJ5Yd5hoAyIjAIDACAAgMAIACKwrk4B7JD3a8BgbJZ3R8Bhoh72Snml4jD0N95+E 8RX7HjPbIena3HVgUTzs7ltzF9EGHAIAgREAQGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgREA QGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgXXijkBmdrWkBxoeZo2koYbHQDscljTW8Bgfc/df NzxGbV25J+CwpDNzF4GTxpCaX5868cQgDgGAwAgAIDACAAiMAAACa80koJmNSFrZ10b7/r1lwGJj km5MMPydki5L0A+6Y5ekuxL082NJI7O8/l4zM0n7i3ag79/73f1ggrFrq3wa0MyWavqGOqiNlnzf 5HsXsjeyx93XLWC5aXgoSEhJHg5iZmOSVi9g0WOaEQrztFLvdfejVYoovQdgZo9JulwdOb0BtNwS SauKloyZjUt6wt2vLFtEWWvExg+03bB622opTAICgREAQGCtOQswwFHNPenx73ylAZKkB9V7rPxc E99Ls1U3j5QBMK7yM5qlZjndfTxhfUBy7v7J+d5jZsNKd8ZssiWZj0sRALdKuq/q6QcgiuIP2bik 11L1WZyOv0XS9jr9pJgDOMzGDyyuYps7XLcfJgGBwFIEwFCxOwJgcdXeflPMAWyXtL24AolJQGCG 4jsBc030LWQScFTS8rq1pTwLMFy0t6Tq0MzmPQ3o7relGg+oysy+Kel0zb0hj0iyXDXOpe3XASxV 74sWg75ssUcSAYCcbtLCvgzUCkwCAoERAEBgVQJgTL2LGQC017gq3PK89BzA5PeLW3ZDEKCrunVD kEnFAPuKlkyJW4LdmnI8oGHbJT2ult8SrDVnAYpfyEFJe2f+PzNzEQDolt+5+47cRcynNQGwQMNm 9tEE/ZydoA90y9mJ1p3aF+Pk1PUAWC3pp7mLQCdtEusOE29AZAQAEBgBAARGAACBdWUS8KCkVxoe 4wxJKxoeA+1wSLOcbk6sFef551P50WAnKx4PFkqSx4KdDDgEAAIjAIDACAAgMAIACIwAAAIjAIDA CAAgMAIACIwAAAIjAIDACAAgMAIACIwAAAIjAIDACAAgMAIACIwAAAIjAIDACAAgsE7cE9DMtkj6 RsPDnC9pbcNjoB1el/RCw2Pc7u6PNzxGbV25K/Cpki7PXQROGmvV/Pp0asP9J8EhABAYAQAERgAA gREAQGCtnAQ0s1MkjUpaWbT1A966X9LXEwy5TdKGBP2gO56X9GCCfr4kaXiW19eb2QXqraP7JR1w 9yMJxkuq1mlAMzNJI5raUPvb6IDXy7TlJUvY4+7rFvwDTP0cPBYsniSPBzOzMUmrS779TU0FQtV2 YMDrB73GRlx6D8DMfiTpEp24kdtCBweCWa7eKciU15u4mc0Mhz+7+41lFq5yCLBR0sXV6wPQINPU H+T+10phEhAIjAAAAmvlWYABXNJBTT/W2Z21IkB6QtI6TZ/4HlFH5saaCoAJpZvl7D+N0v5vLiEU d//gzNeKs2NVzoKVfW/y7TVFh3erdz71+Abs7ocT9At0UvGHavIPVzJmNqTpobFN0h11+kwRAK+4 +/MJ+gEwh+IP62FJ/5UkM3ulbp9MAgKBEQBAYCkOAe4ys9s0/yReqUlAd59IUBPQSma2TGkumx+V dHrdelIEwJqiJWFmh1U+NPa6+3dSjQ1UZWafknSaym/IQ3kqnV0brwMYKtppJd67RxIBgJy+qvJf Bmod5gCAwAgAIDACAAisyhzAleod66S6vHFFih8AOEkcUr1L5fvbvrKDlg4Adx+TNFb2/fMxsyUq HyAbJV2XamxgEfxc0jMquQG7+7EcRWY7C1D8wP8r2pzMbKsIAHTLT9x9R+4i5tPG04BVLDezKxL0 wyPB4lmbaN1ZmqCPbLoeAKdK+kPuItBJW8S6w1kAIDICAAiMAAACIwCAwAgAILBajwZbLMVFQ6c0 PMzPJF3T8Bhoh0ckfaThMY7kurinik6cBix+keNNjmFmrf+wkMwxd290feoKDgGAwAgAIDACAAiM AAACIwCAwAgAIDACAAiMAAACIwCAwAgAIDACAAiMAAACIwCAwAgAIDACAAiMAAACIwCAwAgAIDAC AAiMAAACIwCAwAgAIDACAAiMAJjyn9wFYNHwWRcIgClP5S4Ai4bPukAATGGliIPPutCJZwMuBjNb JukNScO5a0GjxiWtcveJ3IW0AXsAhWKF2JW7DjRuFxv/FPYA+pjZpZL+qI48NBWVTUi6wt2fzl1I W7AH0KdYMe7JXQcacw8b/3TsAcxgZqeoN0l0Ye5akNRzkja5+5HchbQJewAzFCvIDZJeyl0LknlJ 0g1s/CciAGbh7s9JukjS/ZLYReouV+8zvKj4TDEDhwDzMLOrJP1A0rmZS0E1L0u6yd135i6kzQiA EsxsiaTzJW3qa+slWc66cJxLelG9uZvJ9oK7H8taVQcQAEBgzAEAgREAQGAEABAYAQAERgAAgREA QGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgREAQGD/B4kK3Kr1D6xp AAAAAElFTkSuQmCC "
+         x="197.47334"
+         y="887.37909"
+         width="66.739449"
+         height="66.739449"
+         id="image3047" />
+      <rect
+         width="67.741936"
+         height="67.741936"
+         x="195.77007"
+         y="886.3374"
+         id="rect3050-8"
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.99199998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+    </g>
+  </g>
+  <g
+     id="g7207"
+     transform="translate(136.70967,52.26686)">
+    <g
+       transform="translate(-176.98098,-902.62852)"
+       id="g5953">
+      <rect
+         width="67.741936"
+         height="67.741936"
+         x="236.20287"
+         y="964.68536"
+         id="rect3050"
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.99199998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+    </g>
+    <flowRoot
+       transform="translate(-167.03226,-0.871711)"
+       style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       id="flowRoot7109"
+       xml:space="preserve"><flowRegion
+         id="flowRegion7111"><rect
+           y="84.164223"
+           x="228.44576"
+           height="59.824047"
+           width="63.343109"
+           id="rect7113" /></flowRegion><flowPara
+         style="font-size:10px"
+         id="flowPara7115">User</flowPara><flowPara
+         style="font-size:10px"
+         id="flowPara7117">Interface</flowPara></flowRoot>  </g>
+  <g
+     id="g7216"
+     transform="translate(154.70967,52.26686)">
+    <g
+       transform="translate(-86.13835,-902.62852)"
+       id="g5953-9">
+      <rect
+         width="67.741936"
+         height="67.741936"
+         x="236.20287"
+         y="964.68536"
+         id="rect3050-2"
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.99199998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+    </g>
+    <flowRoot
+       transform="translate(-76.32038,4.5286794)"
+       style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       id="flowRoot7109-5"
+       xml:space="preserve"><flowRegion
+         id="flowRegion7111-6"><rect
+           y="84.164223"
+           x="228.44576"
+           height="59.824047"
+           width="63.343109"
+           id="rect7113-4" /></flowRegion><flowPara
+         style="font-size:10px"
+         id="flowPara7117-5">Debugger</flowPara></flowRoot>  </g>
+  <g
+     id="g7224"
+     transform="translate(142.70967,76.26686)">
+    <g
+       transform="translate(13.347014,-838.23375)"
+       id="g5953-9-2">
+      <rect
+         width="67.741936"
+         height="67.741936"
+         x="236.20287"
+         y="964.68536"
+         id="rect3050-2-1"
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.99199998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+    </g>
+    <flowRoot
+       transform="translate(23.018504,63.703725)"
+       style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       id="flowRoot7109-5-5"
+       xml:space="preserve"><flowRegion
+         id="flowRegion7111-6-3"><rect
+           y="84.164223"
+           x="228.44576"
+           height="59.824047"
+           width="63.343109"
+           id="rect7113-4-6" /></flowRegion><flowPara
+         style="font-size:10px"
+         id="flowPara7117-5-8">Emulator</flowPara><flowPara
+         id="flowPara7205"
+         style="font-size:10px">Process</flowPara></flowRoot>  </g>
+  <path
+     style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:url(#Arrow2Lend)"
+     d="m 263.67349,148.19467 41.1007,0"
+     id="path7238"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-start="#g7207"
+     inkscape:connection-start-point="d4"
+     inkscape:connection-end="#g7216"
+     inkscape:connection-end-point="d4" />
+  <path
+     style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:url(#Arrow2Lend)"
+     d="M 372.51612,114.54246 392.15715,95.028283"
+     id="path7240"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-start="#g7216"
+     inkscape:connection-start-point="d4"
+     inkscape:connection-end="#g7233"
+     inkscape:connection-end-point="d4" />
+  <path
+     style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:url(#Arrow2Lend)"
+     d="m 372.16766,182.06564 20.44035,20.65283"
+     id="path7242"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-start="#g7216"
+     inkscape:connection-start-point="d4"
+     inkscape:connection-end="#g7224"
+     inkscape:connection-end-point="d4" />
+  <rect
+     style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:2.27824187;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+     id="rect4668"
+     width="66.646919"
+     height="66.646919"
+     x="26.193481"
+     y="113.64068" />
+  <path
+     style="fill:none;stroke:#000000;stroke-width:0.7974245px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:none;marker-end:url(#Arrow2Lend)"
+     d="m 59.516949,78.05476 -4e-6,35.58592"
+     id="path5501"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-end="#rect4668"
+     inkscape:connection-end-point="d4" />
+  <g
+     id="g6433"
+     transform="matrix(0.62057892,0,0,0.62057892,11.258989,-379.05089)">
+    <g
+       id="g6425">
+      <rect
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:3.67115593;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:11.01346743, 3.67115581;stroke-dashoffset:0"
+         id="rect5495"
+         width="63.362904"
+         height="63.362904"
+         x="46.08136"
+         y="673.21649"
+         ry="5.3697371" />
+      <flowRoot
+         xml:space="preserve"
+         id="flowRoot6361"
+         style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+         transform="translate(2.4434741,667.77911)"><flowRegion
+           id="flowRegion6363"><rect
+             id="rect6365"
+             width="51.400291"
+             height="48.892963"
+             x="49.728741"
+             y="24.655426"
+             style="font-size:10px" /></flowRegion><flowPara
+           id="flowPara6367">Assembly</flowPara><flowPara
+           id="flowPara6369">Code</flowPara></flowRoot>    </g>
+  </g>
+  <g
+     id="g6442"
+     transform="matrix(0.62057892,0,0,0.62057892,14.170789,-422.64179)">
+    <rect
+       ry="5.3697371"
+       y="886.18073"
+       x="182.2775"
+       height="63.362904"
+       width="63.362904"
+       id="rect5495-0"
+       style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:3.67115593;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:11.01346743, 3.67115581;stroke-dashoffset:0" />
+    <flowRoot
+       transform="translate(138.32711,868.21646)"
+       style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       id="flowRoot6361-3"
+       xml:space="preserve"><flowRegion
+         id="flowRegion6363-9"><rect
+           style="font-size:10px"
+           y="24.655426"
+           x="49.728741"
+           height="48.892963"
+           width="51.400291"
+           id="rect6365-4" /></flowRegion><flowPara
+         id="flowPara6367-9" /><flowPara
+         id="flowPara6369-1">Machine Code</flowPara></flowRoot>  </g>
+  <g
+     id="g6450"
+     transform="matrix(0.62057892,0,0,0.62057892,-73.261461,-391.06209)">
+    <rect
+       ry="5.3697371"
+       y="963.04144"
+       x="182.2775"
+       height="63.362904"
+       width="63.362904"
+       id="rect5495-3"
+       style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:3.67115593;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:11.01346743, 3.67115581;stroke-dashoffset:0" />
+    <flowRoot
+       transform="translate(138.63961,957.60404)"
+       style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       id="flowRoot6361-6"
+       xml:space="preserve"><flowRegion
+         id="flowRegion6363-4"><rect
+           style="font-size:10px"
+           y="24.655426"
+           x="49.728741"
+           height="48.892963"
+           width="51.400291"
+           id="rect6365-3" /></flowRegion><flowPara
+         id="flowPara6369-7">Debug</flowPara><flowPara
+         id="flowPara6423">File</flowPara></flowRoot>  </g>
+  <path
+     style="fill:none;stroke:#000000;stroke-width:0.62057894px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:none;marker-end:url(#Arrow2Lend)"
+     d="m 92.840401,146.96413 34.447959,0"
+     id="path6458"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-start="#rect4668"
+     inkscape:connection-start-point="d4"
+     inkscape:connection-end-point="d4"
+     inkscape:connection-end="#g6442" />
+  <path
+     style="fill:none;stroke:#000000;stroke-width:0.62057894px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+     d="m 59.516946,180.2876 3e-6,26.29353"
+     id="path6460"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-start="#rect4668"
+     inkscape:connection-start-point="d4"
+     inkscape:connection-end-point="d4"
+     inkscape:connection-end="#g6450" />
+  <text
+     xml:space="preserve"
+     style="font-size:8.68810463px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+     x="59.601791"
+     y="148.8152"
+     id="text7050"
+     sodipodi:linespacing="125%"><tspan
+       sodipodi:role="line"
+       id="tspan7052"
+       x="59.601791"
+       y="148.8152">Assembler</tspan></text>
+  <path
+     style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
+     d="m 166.61004,147.25613 29.32152,0.43549"
+     id="path5697"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-end="#g7207"
+     inkscape:connection-end-point="d4"
+     inkscape:connection-start-point="d4"
+     inkscape:connection-start="#g6442" />
+  <text
+     xml:space="preserve"
+     style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+     x="230.93842"
+     y="230.34015"
+     id="text5899"
+     sodipodi:linespacing="125%"><tspan
+       sodipodi:role="line"
+       id="tspan5901"
+       x="230.93842"
+       y="230.34015"
+       style="font-size:10px">Debug and Execute Commands</tspan></text>
+  <path
+     style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-mid:none;marker-end:url(#Arrow2Lend)"
+     d="m 230.20528,220.80938 -0.21489,-38.74374"
+     id="path5903"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-end="#g7207"
+     inkscape:connection-end-point="d4"
+     sodipodi:nodetypes="cc" />
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/img/ede/interpreter.svg	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,528 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   version="1.1"
+   width="500"
+   height="300"
+   id="svg2"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="aued.svg">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1438"
+     inkscape:window-height="879"
+     id="namedview7079"
+     showgrid="false"
+     inkscape:zoom="1.364"
+     inkscape:cx="278.04252"
+     inkscape:cy="157.58194"
+     inkscape:window-x="0"
+     inkscape:window-y="19"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg2" />
+  <defs
+     id="defs4">
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="Arrow2Lstart"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(1.1,0,0,1.1,1.1,0)"
+         id="path3875"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="Arrow2Lend"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         id="path3878"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="Arrow1Lend"
+       style="overflow:visible">
+      <path
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         transform="matrix(-0.8,0,0,-0.8,-10,0)"
+         id="path3860"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="Arrow1Lstart"
+       style="overflow:visible">
+      <path
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
+         transform="matrix(0.8,0,0,0.8,10,0)"
+         id="path3857"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow2Lend-2"
+       style="overflow:visible">
+      <path
+         id="path5528"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker4125"
+       style="overflow:visible">
+      <path
+         id="path4127"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker4129"
+       style="overflow:visible">
+      <path
+         id="path4131"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow2Lend-1"
+       style="overflow:visible">
+      <path
+         id="path5528-0"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker4657"
+       style="overflow:visible">
+      <path
+         id="path4659"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Lend"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker4661"
+       style="overflow:visible">
+      <path
+         id="path4663"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="Arrow2Lstart-5"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(1.1,0,0,1.1,1.1,0)"
+         id="path3875-8"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="Arrow2Lend-3"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         id="path3878-5"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="marker7483"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(1.1,0,0,1.1,1.1,0)"
+         id="path7485"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="marker7487"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         id="path7489"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="marker7491"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(1.1,0,0,1.1,1.1,0)"
+         id="path7493"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="marker7495"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         id="path7497"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="marker7499"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(1.1,0,0,1.1,1.1,0)"
+         id="path7501"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="marker7503"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         id="path7505"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="marker7507"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(1.1,0,0,1.1,1.1,0)"
+         id="path7509"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="marker7511"
+       style="overflow:visible">
+      <path
+         d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+         transform="matrix(-1.1,0,0,-1.1,-1.1,0)"
+         id="path7513"
+         style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+         inkscape:connector-curvature="0" />
+    </marker>
+  </defs>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="g7233"
+     transform="translate(110.75059,22.109159)">
+    <g
+       transform="translate(53.677419,-883.20089)"
+       id="g8247">
+      <image
+         xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABHNCSVQICAgIfAhkiAAADR9JREFU eJzt3W+MHVUZx/Hf0z/sdrdNWxAoEgOxgYQa/lRawEQriom8QeoLjIE0EUMiL1AREwRN/BsDGBMr IWLUKAmoiSZawgvlRRWJiVJARAwaDAGq0bRg2Er/bMu2jy/ubPfudu/uzM6ZPTN9vp/kJOVy55xn 9878dubM3BlzdwGIaUnuAgDkQwAAgREAQGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgREAQGAE ABAYAQAERgAAgREAQGAEABAYAQAERgAAgS3LXUAXmNkSSedL2tTX1kuynHXhOJf0oqSn+toL7n4s a1UdYNwTcG5m9j5JP5R0buZSUM3Lkj7u7r/NXUibcQgwgJmNmNm9knaKjb+LzpW008zuNbOR3MW0 FXsAszCzCyQ9LOm83LUgiX9Iutbd/5a7kLYhAGYws2WSdknamLsWJPWMpMvcfSJ3IW3CIcCJPi82 /pPRRvU+W/RhD6CPmV0s6UlJy3PXgka8KWmzuz+bu5C2YA9gum+Jjf9ktly9zxgF9gAKZrZU0huS VuSuBY06JGmVux/NXUgbsAcw5R1i449ghXqfNUQA9NuUuwAsGj7rAgEwhZUiDj7rAgEw5a25C8Ci 4bMuEABAYAQAEBhfB27OAUl/krRPvWPOdXnLAU7EHkB6D0u6RNJqd9/i7te4+1mS3ibpi+pdjQa0 AgGQzpikbe6+1d2fnXmhibv/y92/JmmzpOeyVAjMQACkc727PzTfm4rr0D8g6dXmSwLmRgCk8X13 /1XZN7v7Xkk3N1gPUAoBUN8RSZ+tupC7/0ISt6tCVgRAfX919zcWuOzvk1YCVEQA1Pd0jWV3JasC WAACoL5/1lh2d7IqgAUgAOq7sMayFyerAlgAAqC+S2ssuzlZFcACEAD1vd3MNlRdyMxOkXR1A/UA pREAaTxQ3FKsii+L5w4gMwIgjc2SvlD2zWb2Lkm3N1cOUA4BkM5XzOwhM1s76A1mtsTMPiPpN5Kq 7jEAyfF14LRukPT+4pmCT6r3deCD6p0peKekbZLena88YDoCIL2zJN3V998T4veMluIQoHls/Ggt AgAIjAAAAiMAgMAIACAwAgAIjAAAAiMAgMA6cY7azIYkDbzENpGhhvtHewyZWdMPannd3Q83PEZt 5u65a5iXmW2V9MvcdQAVfNjdd+QuYj4cAgCBEQBAYAQAEBgBAARGAACBZTsNaGZLJK2co432/Xvj gG5ek/SeBOXcJ+mqBP2gO3ZKuiVBP7skrZrl9evN7AJJ+4t2oO/fJzR3P5aglspKB4CZrZG0WnNv tIM24NnaigT1H3X3v9ftxMz2J6gF3bI/0bozaMO9rmhl+zmkOQJC8wTIjLbP3cfKjFtlD+Ax8SAL oCkrinZ6gr6elXRJmTcyBwAERgAAgREAQGBt/DLQYZWf7NibqUZg0u2STlO5ie/J1ppnQqQIgDFJ r6raLOXAWU53n0hQE7Ao3P17VZcxs2FVO2M26CzbOtWcNEwRAHe6+3cT9AOE4O7jksbVu45lwczs Zkn31+mDOQAgMAIACCzFIcA5ZrZBfXMAXbgTCtA1xZ2x+ucAzqnbZ4oAuKNox5nZhBY4CTjX//cu 3L4I4ZmZqdrEXtn3Jj9r19RpwGWS1hQtFTezg5oeCrvd/UMJxwAqMbNH1ZuN79+QRyRZzrrKauN1 AINMpuqopDOL15q+sSMwn8vV+5JcJzEJCARGAACBVTkEeELSIZ04MTHcQF0AyhnXiRPmfym7cOkA cPdPzPa6mS1VvZnNQcuyd4KTyTHVu1x+1mXd/WidompPAhYF7CtaMma2QlOBcI2kb6fsH2jYpyU9 oqkN9VDmembV2rMAxS/skKRXzWx37nqAina7+0u5i5hPawOgpJVmdneCfjYk6APdsiHRutPpObCu B8CopM/lLgKddJ5Yd5hoAyIjAIDACAAgMAIACKwrk4B7JD3a8BgbJZ3R8Bhoh72Snml4jD0N95+E 8RX7HjPbIena3HVgUTzs7ltzF9EGHAIAgREAQGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgREA QGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgXXijkBmdrWkBxoeZo2koYbHQDscljTW8Bgfc/df NzxGbV25J+CwpDNzF4GTxpCaX5868cQgDgGAwAgAIDACAAiMAAACa80koJmNSFrZ10b7/r1lwGJj km5MMPydki5L0A+6Y5ekuxL082NJI7O8/l4zM0n7i3ag79/73f1ggrFrq3wa0MyWavqGOqiNlnzf 5HsXsjeyx93XLWC5aXgoSEhJHg5iZmOSVi9g0WOaEQrztFLvdfejVYoovQdgZo9JulwdOb0BtNwS SauKloyZjUt6wt2vLFtEWWvExg+03bB622opTAICgREAQGCtOQswwFHNPenx73ylAZKkB9V7rPxc E99Ls1U3j5QBMK7yM5qlZjndfTxhfUBy7v7J+d5jZsNKd8ZssiWZj0sRALdKuq/q6QcgiuIP2bik 11L1WZyOv0XS9jr9pJgDOMzGDyyuYps7XLcfJgGBwFIEwFCxOwJgcdXeflPMAWyXtL24AolJQGCG 4jsBc030LWQScFTS8rq1pTwLMFy0t6Tq0MzmPQ3o7relGg+oysy+Kel0zb0hj0iyXDXOpe3XASxV 74sWg75ssUcSAYCcbtLCvgzUCkwCAoERAEBgVQJgTL2LGQC017gq3PK89BzA5PeLW3ZDEKCrunVD kEnFAPuKlkyJW4LdmnI8oGHbJT2ult8SrDVnAYpfyEFJe2f+PzNzEQDolt+5+47cRcynNQGwQMNm 9tEE/ZydoA90y9mJ1p3aF+Pk1PUAWC3pp7mLQCdtEusOE29AZAQAEBgBAARGAACBdWUS8KCkVxoe 4wxJKxoeA+1wSLOcbk6sFef551P50WAnKx4PFkqSx4KdDDgEAAIjAIDACAAgMAIACIwAAAIjAIDA CAAgMAIACIwAAAIjAIDACAAgMAIACIwAAAIjAIDACAAgMAIACIwAAAIjAIDACAAgsE7cE9DMtkj6 RsPDnC9pbcNjoB1el/RCw2Pc7u6PNzxGbV25K/Cpki7PXQROGmvV/Pp0asP9J8EhABAYAQAERgAA gREAQGCtnAQ0s1MkjUpaWbT1A966X9LXEwy5TdKGBP2gO56X9GCCfr4kaXiW19eb2QXqraP7JR1w 9yMJxkuq1mlAMzNJI5raUPvb6IDXy7TlJUvY4+7rFvwDTP0cPBYsniSPBzOzMUmrS779TU0FQtV2 YMDrB73GRlx6D8DMfiTpEp24kdtCBweCWa7eKciU15u4mc0Mhz+7+41lFq5yCLBR0sXV6wPQINPU H+T+10phEhAIjAAAAmvlWYABXNJBTT/W2Z21IkB6QtI6TZ/4HlFH5saaCoAJpZvl7D+N0v5vLiEU d//gzNeKs2NVzoKVfW/y7TVFh3erdz71+Abs7ocT9At0UvGHavIPVzJmNqTpobFN0h11+kwRAK+4 +/MJ+gEwh+IP62FJ/5UkM3ulbp9MAgKBEQBAYCkOAe4ys9s0/yReqUlAd59IUBPQSma2TGkumx+V dHrdelIEwJqiJWFmh1U+NPa6+3dSjQ1UZWafknSaym/IQ3kqnV0brwMYKtppJd67RxIBgJy+qvJf Bmod5gCAwAgAIDACAAisyhzAleod66S6vHFFih8AOEkcUr1L5fvbvrKDlg4Adx+TNFb2/fMxsyUq HyAbJV2XamxgEfxc0jMquQG7+7EcRWY7C1D8wP8r2pzMbKsIAHTLT9x9R+4i5tPG04BVLDezKxL0 wyPB4lmbaN1ZmqCPbLoeAKdK+kPuItBJW8S6w1kAIDICAAiMAAACIwCAwAgAILBajwZbLMVFQ6c0 PMzPJF3T8Bhoh0ckfaThMY7kurinik6cBix+keNNjmFmrf+wkMwxd290feoKDgGAwAgAIDACAAiM AAACIwCAwAgAIDACAAiMAAACIwCAwAgAIDACAAiMAAACIwCAwAgAIDACAAiMAAACIwCAwAgAIDAC AAiMAAACIwCAwAgAIDACAAiMAJjyn9wFYNHwWRcIgClP5S4Ai4bPukAATGGliIPPutCJZwMuBjNb JukNScO5a0GjxiWtcveJ3IW0AXsAhWKF2JW7DjRuFxv/FPYA+pjZpZL+qI48NBWVTUi6wt2fzl1I W7AH0KdYMe7JXQcacw8b/3TsAcxgZqeoN0l0Ye5akNRzkja5+5HchbQJewAzFCvIDZJeyl0LknlJ 0g1s/CciAGbh7s9JukjS/ZLYReouV+8zvKj4TDEDhwDzMLOrJP1A0rmZS0E1L0u6yd135i6kzQiA EsxsiaTzJW3qa+slWc66cJxLelG9uZvJ9oK7H8taVQcQAEBgzAEAgREAQGAEABAYAQAERgAAgREA QGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgREAQGAEABAYAQAERgAAgREAQGD/B4kK3Kr1D6xp AAAAAElFTkSuQmCC "
+         x="197.47334"
+         y="887.37909"
+         width="66.739449"
+         height="66.739449"
+         id="image3047" />
+      <rect
+         width="67.741936"
+         height="67.741936"
+         x="195.77007"
+         y="886.3374"
+         id="rect3050-8"
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.99199998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+    </g>
+  </g>
+  <g
+     id="g7207"
+     transform="translate(104.75059,50.109159)">
+    <g
+       transform="translate(-176.98098,-902.62852)"
+       id="g5953">
+      <rect
+         width="67.741936"
+         height="67.741936"
+         x="236.20287"
+         y="964.68536"
+         id="rect3050"
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.99199998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+    </g>
+    <flowRoot
+       transform="translate(-167.03226,-0.871711)"
+       style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       id="flowRoot7109"
+       xml:space="preserve"><flowRegion
+         id="flowRegion7111"><rect
+           y="84.164223"
+           x="228.44576"
+           height="59.824047"
+           width="63.343109"
+           id="rect7113" /></flowRegion><flowPara
+         style="font-size:10px"
+         id="flowPara7115">User</flowPara><flowPara
+         style="font-size:10px"
+         id="flowPara7117">Interface</flowPara></flowRoot>  </g>
+  <g
+     id="g7216"
+     transform="translate(122.75059,50.109159)">
+    <g
+       transform="translate(-86.13835,-902.62852)"
+       id="g5953-9">
+      <rect
+         width="67.741936"
+         height="67.741936"
+         x="236.20287"
+         y="964.68536"
+         id="rect3050-2"
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.99199998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+    </g>
+    <flowRoot
+       transform="translate(-76.32038,4.5286794)"
+       style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       id="flowRoot7109-5"
+       xml:space="preserve"><flowRegion
+         id="flowRegion7111-6"><rect
+           y="84.164223"
+           x="228.44576"
+           height="59.824047"
+           width="63.343109"
+           id="rect7113-4" /></flowRegion><flowPara
+         style="font-size:10px"
+         id="flowPara7117-5">Debugger</flowPara></flowRoot>  </g>
+  <g
+     id="g7224"
+     transform="translate(110.75059,74.109159)">
+    <g
+       transform="translate(13.347014,-838.23375)"
+       id="g5953-9-2">
+      <rect
+         width="67.741936"
+         height="67.741936"
+         x="236.20287"
+         y="964.68536"
+         id="rect3050-2-1"
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.99199998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+    </g>
+    <flowRoot
+       transform="translate(23.018504,63.703725)"
+       style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       id="flowRoot7109-5-5"
+       xml:space="preserve"><flowRegion
+         id="flowRegion7111-6-3"><rect
+           y="84.164223"
+           x="228.44576"
+           height="59.824047"
+           width="63.343109"
+           id="rect7113-4-6" /></flowRegion><flowPara
+         style="font-size:10px"
+         id="flowPara7117-5-8">Emulator</flowPara><flowPara
+         id="flowPara7205"
+         style="font-size:10px">Process</flowPara></flowRoot>  </g>
+  <path
+     style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:url(#Arrow2Lend)"
+     d="m 231.71441,146.03697 41.1007,0"
+     id="path7238"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-start="#g7207"
+     inkscape:connection-start-point="d4"
+     inkscape:connection-end="#g7216"
+     inkscape:connection-end-point="d4" />
+  <path
+     style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:url(#Arrow2Lend)"
+     d="M 340.55704,112.38476 360.19807,92.870582"
+     id="path7240"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-start="#g7216"
+     inkscape:connection-start-point="d4"
+     inkscape:connection-end="#g7233"
+     inkscape:connection-end-point="d4" />
+  <path
+     style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:url(#Arrow2Lend)"
+     d="m 340.20858,179.90794 20.44035,20.65283"
+     id="path7242"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-start="#g7216"
+     inkscape:connection-start-point="d4"
+     inkscape:connection-end="#g7224"
+     inkscape:connection-end-point="d4" />
+  <g
+     id="g7064"
+     transform="translate(36.040916,-0.92716059)">
+    <rect
+       y="113.64068"
+       x="26.193481"
+       height="66.646919"
+       width="66.646919"
+       id="rect4668"
+       style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:2.27824187;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
+  </g>
+  <text
+     xml:space="preserve"
+     style="font-size:8.68810463px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+     x="95.642715"
+     y="149.29926"
+     id="text7050"
+     sodipodi:linespacing="125%"><tspan
+       sodipodi:role="line"
+       id="tspan7052"
+       x="95.642715"
+       y="149.29926">Assembler</tspan></text>
+  <text
+     xml:space="preserve"
+     style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+     x="198.97932"
+     y="230.18243"
+     id="text5899"
+     sodipodi:linespacing="125%"><tspan
+       sodipodi:role="line"
+       id="tspan5901"
+       x="198.97932"
+       y="230.18243"
+       style="font-size:10px">Debug Commands</tspan></text>
+  <path
+     style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-mid:none;marker-end:url(#Arrow2Lend)"
+     d="m 198.2462,218.65169 -0.21489,-38.74375"
+     id="path5903"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-end="#g7207"
+     inkscape:connection-end-point="d4"
+     sodipodi:nodetypes="cc" />
+  <path
+     style="fill:none;stroke:#000000;stroke-width:0.85227233px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:none"
+     d="M 198.05334,112.52761 197.50456,73.428259"
+     id="path6629"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0" />
+  <text
+     xml:space="preserve"
+     style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+     x="198.67464"
+     y="69.300049"
+     id="text5899-5"
+     sodipodi:linespacing="125%"><tspan
+       sodipodi:role="line"
+       id="tspan5901-4"
+       x="198.67464"
+       y="69.300049"
+       style="font-size:10px">Assembly Statement</tspan></text>
+  <path
+     style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Lstart);marker-end:url(#Arrow2Lend)"
+     d="m 128.88132,146.03698 35.09116,-1e-5"
+     id="path7067"
+     inkscape:connector-type="polyline"
+     inkscape:connector-curvature="0"
+     inkscape:connection-start="#g7064"
+     inkscape:connection-start-point="d4"
+     inkscape:connection-end="#g7207"
+     inkscape:connection-end-point="d4" />
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/img/ede/state_of_ede.svg	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,376 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   version="1.2"
+   width="744.09448"
+   height="800"
+   id="svg2"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="state_of_ede.svg">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1438"
+     inkscape:window-height="879"
+     id="namedview83"
+     showgrid="false"
+     inkscape:zoom="0.64806586"
+     inkscape:cx="235.87281"
+     inkscape:cy="367.57169"
+     inkscape:window-x="0"
+     inkscape:window-y="19"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg2" />
+  <defs
+     id="defs4">
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="TriangleOutM"
+       style="overflow:visible">
+      <path
+         d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+         transform="scale(0.4,0.4)"
+         id="path3344"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="TriangleInM"
+       style="overflow:visible">
+      <path
+         d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+         transform="scale(-0.4,-0.4)"
+         id="path3335"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="TriangleInM-8"
+       style="overflow:visible">
+      <path
+         d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+         transform="scale(-0.4,-0.4)"
+         id="path3335-0"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       refX="0"
+       refY="0"
+       orient="auto"
+       id="TriangleOutM-9"
+       style="overflow:visible">
+      <path
+         d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+         transform="scale(0.4,0.4)"
+         id="path3344-6"
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
+         inkscape:connector-curvature="0" />
+    </marker>
+  </defs>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <rect
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;opacity:0.42060086000000002;fill:#00ff00;fill-opacity:1;stroke:#000000;stroke-width:1.877;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.77000007999999998;stroke-dasharray:none;stroke-dashoffset:0;font-family:Arial;-inkscape-font-specification:Arial"
+     id="rect2383"
+     y="51.318741"
+     x="88.647758"
+     height="49.126373"
+     width="351.98816" />
+  <flowRoot
+     style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial;-inkscape-font-specification:Arial"
+     xml:space="preserve"
+     id="flowRoot2385"
+     transform="matrix(0.4011573,0,0,0.4011573,195.28492,-90.861549)"><flowRegion
+       id="flowRegion2387"><rect
+         style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial"
+         id="rect2389"
+         y="388.79074"
+         x="122.14286"
+         height="103.57143"
+         width="167.14285" /></flowRegion><flowPara
+       style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial"
+       id="flowPara2391">UI</flowPara></flowRoot>  <rect
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;opacity:0.40999999999999998;fill:#00ff00;fill-opacity:1;stroke:#000000;stroke-width:1.87737500999999996;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.77000007999999998;stroke-dasharray:none;stroke-dashoffset:0;font-family:Arial;-inkscape-font-specification:Arial"
+     id="rect3173"
+     y="146.13231"
+     x="208.17178"
+     height="49.126404"
+     width="104.33029" />
+  <flowRoot
+     style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial;-inkscape-font-specification:Arial"
+     xml:space="preserve"
+     id="flowRoot3175"
+     transform="matrix(0.4011573,0,0,0.4011573,175.53306,2.939133)"><flowRegion
+       id="flowRegion3177"><rect
+         style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial"
+         id="rect3179"
+         y="388.79074"
+         x="122.14286"
+         height="99.783966"
+         width="251.72978" /></flowRegion><flowPara
+       style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial"
+       id="flowPara3181">Assembler</flowPara></flowRoot>  <rect
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;opacity:0.40999999999999998;fill:#00ff00;fill-opacity:1;stroke:#000000;stroke-width:1.87737500999999996;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.77000007999999998;stroke-dasharray:none;stroke-dashoffset:0;font-family:Arial;-inkscape-font-specification:Arial"
+     id="rect3183"
+     y="146.13231"
+     x="335.79916"
+     height="49.126404"
+     width="104.33029" />
+  <flowRoot
+     style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial;-inkscape-font-specification:Arial"
+     xml:space="preserve"
+     id="flowRoot3185"
+     transform="matrix(0.4011573,0,0,0.4011573,287.95542,1.9055)"><flowRegion
+       id="flowRegion3187"><rect
+         style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+         id="rect3189"
+         y="388.79074"
+         x="122.14286"
+         height="99.783966"
+         width="251.72978" /></flowRegion><flowPara
+       style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+       id="flowPara3191">Debugger</flowPara></flowRoot>  <path
+     inkscape:connector-curvature="0"
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:none;stroke:#00ff00;stroke-width:1.87737500999999996;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#TriangleInM);marker-end:url(#TriangleOutM);font-family:Arial;-inkscape-font-specification:Arial"
+     id="path4496"
+     d="m 261.97782,106.70219 0,33.42621" />
+  <path
+     inkscape:connector-curvature="0"
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:none;stroke:#00ff00;stroke-width:1.877;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#TriangleInM);marker-end:url(#TriangleOutM);font-family:Arial;-inkscape-font-specification:Arial"
+     id="path4498"
+     d="m 387.96432,106.70219 0,33.42621" />
+  <rect
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;opacity:0.98999999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.87737501;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.77000008;stroke-dasharray:none;stroke-dashoffset:0;font-family:Arial;-inkscape-font-specification:Arial"
+     id="rect4500"
+     y="364.91516"
+     x="335.79916"
+     height="49.126404"
+     width="104.33029" />
+  <flowRoot
+     style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial;-inkscape-font-specification:Arial"
+     xml:space="preserve"
+     id="flowRoot4502"
+     transform="matrix(0.4011573,0,0,0.4011573,287.81479,213.11225)"><flowRegion
+       id="flowRegion4504"><rect
+         style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+         id="rect4506"
+         y="388.79074"
+         x="122.14286"
+         height="99.783966"
+         width="251.72978" /></flowRegion><flowPara
+       style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+       id="flowPara4508">Host serial interface</flowPara></flowRoot>  <path
+     inkscape:connector-curvature="0"
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:none;stroke:#000000;stroke-width:1.87699997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker-start:url(#TriangleInM-8);marker-end:url(#TriangleOutM);font-family:Arial;-inkscape-font-specification:Arial"
+     id="path4510"
+     d="m 387.96432,199.17632 0,158.94215" />
+  <rect
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;opacity:0.41;fill:#00ff00;fill-opacity:1;stroke:#000000;stroke-width:1.87737500999999996;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.77000007999999998;stroke-dasharray:none;stroke-dashoffset:0;font-family:Arial;-inkscape-font-specification:Arial"
+     id="rect4512"
+     y="270.57541"
+     x="206.63577"
+     height="49.126404"
+     width="104.33029" />
+  <flowRoot
+     style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial;-inkscape-font-specification:Arial"
+     xml:space="preserve"
+     id="flowRoot4514"
+     transform="matrix(0.4011573,0,0,0.4011573,144.5814,117.93567)"><flowRegion
+       id="flowRegion4516"><rect
+         style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+         id="rect4518"
+         y="388.79074"
+         x="122.14286"
+         height="153.88872"
+         width="328.53171" /></flowRegion><flowPara
+       style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+       id="flowPara2481">software </flowPara><flowPara
+       style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+       id="flowPara2483">emulator</flowPara></flowRoot>  <rect
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;opacity:0.98999999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.87737501;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.77000008;stroke-dasharray:none;stroke-dashoffset:0;font-family:Arial;-inkscape-font-specification:Arial"
+     id="rect5566"
+     y="364.98059"
+     x="206.63577"
+     height="49.126404"
+     width="104.33029" />
+  <flowRoot
+     style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial;-inkscape-font-specification:Arial"
+     xml:space="preserve"
+     id="flowRoot5568"
+     transform="matrix(0.4011573,0,0,0.4011573,161.33558,213.17766)"><flowRegion
+       id="flowRegion5570"><rect
+         style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+         id="rect5572"
+         y="388.79074"
+         x="122.14286"
+         height="99.783966"
+         width="251.72978" /></flowRegion><flowPara
+       style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+       id="flowPara5574">emulated peripherals</flowPara></flowRoot>  <path
+     inkscape:connector-curvature="0"
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:none;stroke:#000000;stroke-width:1.87737501;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#TriangleInM);marker-end:url(#TriangleOutM);font-family:Arial;-inkscape-font-specification:Arial"
+     id="path5576"
+     d="m 258.11082,324.60079 0,33.42621" />
+  <path
+     inkscape:connector-curvature="0"
+     style="fill:none;stroke:#000000;stroke-width:1.50190008;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:12.01519987, 12.01519987;stroke-dashoffset:0"
+     id="path5580"
+     d="m 67.224533,447.51968 593.250487,0" />
+  <path
+     inkscape:connector-curvature="0"
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:none;stroke:#00ff00;stroke-width:1.87737500999999996;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#TriangleInM);marker-end:url(#TriangleOutM);font-family:Arial;-inkscape-font-specification:Arial"
+     id="path5582"
+     d="m 387.96432,420.0787 0,62.39143" />
+  <rect
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;opacity:0.41;fill:#00ff00;fill-opacity:1;stroke:#000000;stroke-width:1.87737500999999996;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.77000007999999998;stroke-dasharray:none;stroke-dashoffset:0;font-family:Arial;-inkscape-font-specification:Arial"
+     id="rect5594"
+     y="581.70605"
+     x="335.79916"
+     height="49.126404"
+     width="104.33029" />
+  <flowRoot
+     style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial;-inkscape-font-specification:Arial"
+     xml:space="preserve"
+     id="flowRoot5596"
+     transform="matrix(0.4011573,0,0,0.4011573,285.39032,430.28035)"><flowRegion
+       id="flowRegion5598"><rect
+         style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+         id="rect5600"
+         y="388.79074"
+         x="122.14286"
+         height="185.39923"
+         width="264.32028" /></flowRegion><flowPara
+       style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+       id="flowPara5602">hardware emulator</flowPara></flowRoot>  <rect
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;opacity:0.98999999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.87737501;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.77000008;stroke-dasharray:none;stroke-dashoffset:0;font-family:Arial;-inkscape-font-specification:Arial"
+     id="rect5606"
+     y="674.11121"
+     x="335.79916"
+     height="49.126404"
+     width="104.33029" />
+  <flowRoot
+     style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial;-inkscape-font-specification:Arial"
+     xml:space="preserve"
+     id="flowRoot5608"
+     transform="matrix(0.4011573,0,0,0.4011573,287.95542,522.30831)"><flowRegion
+       id="flowRegion5610"><rect
+         style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+         id="rect5612"
+         y="388.79074"
+         x="122.14286"
+         height="99.783966"
+         width="251.72978" /></flowRegion><flowPara
+       style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+       id="flowPara5614">peripheral drivers</flowPara></flowRoot>  <path
+     inkscape:connector-curvature="0"
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:none;stroke:#000000;stroke-width:1.87737501;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#TriangleInM);marker-end:url(#TriangleOutM);font-family:Arial;-inkscape-font-specification:Arial"
+     id="path5616"
+     d="m 387.96432,635.73145 0,33.42621" />
+  <rect
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;opacity:0.41;fill:#00ff00;fill-opacity:1;stroke:#000000;stroke-width:1.87737500999999996;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.77000007999999998;stroke-dasharray:none;stroke-dashoffset:0;font-family:Arial;-inkscape-font-specification:Arial"
+     id="rect5620"
+     y="488.07092"
+     x="335.79916"
+     height="49.126404"
+     width="104.33029" />
+  <flowRoot
+     style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial;-inkscape-font-specification:Arial"
+     xml:space="preserve"
+     id="flowRoot5622"
+     transform="matrix(0.4011573,0,0,0.4011573,287.81479,336.64522)"><flowRegion
+       id="flowRegion5624"><rect
+         style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+         id="rect5626"
+         y="388.79074"
+         x="122.14286"
+         height="99.783966"
+         width="251.72978" /></flowRegion><flowPara
+       style="font-size:39.88460541px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;font-family:Arial;-inkscape-font-specification:Arial"
+       id="flowPara5628">MCU serial interface</flowPara></flowRoot>  <flowRoot
+     style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:TradeGothic-BoldTwo;-inkscape-font-specification:TradeGothic-BoldTwo"
+     xml:space="preserve"
+     id="flowRoot5688"
+     transform="matrix(0.6948432,0,0,0.6948432,417.32949,-68.605424)"><flowRegion
+       id="flowRegion5690"><rect
+         id="rect5692"
+         y="388.79074"
+         x="122.14286"
+         height="99.783966"
+         width="251.72978" /></flowRegion><flowPara
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial"
+       id="flowPara5694">Host Software</flowPara></flowRoot>  <flowRoot
+     style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:TradeGothic-BoldTwo;-inkscape-font-specification:TradeGothic-BoldTwo"
+     xml:space="preserve"
+     id="flowRoot5704"
+     transform="matrix(0.6948432,0,0,0.6948432,411.26858,331.39457)"><flowRegion
+       id="flowRegion5706"><rect
+         id="rect5708"
+         y="388.79074"
+         x="122.14286"
+         height="99.783966"
+         width="286.62064" /></flowRegion><flowPara
+       style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial"
+       id="flowPara5710">MCU Software</flowPara></flowRoot>  <path
+     inkscape:connector-curvature="0"
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:none;stroke:#00ff00;stroke-width:1.87500000000000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker-start:url(#TriangleInM);marker-end:url(#TriangleOutM);font-family:Arial;-inkscape-font-specification:Arial"
+     id="path2479"
+     d="m 382.14665,234.73139 -123.24447,0 0,29.30028" />
+  <flowRoot
+     style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:TradeGothic-BoldTwo;-inkscape-font-specification:TradeGothic-BoldTwo"
+     xml:space="preserve"
+     id="flowRoot2485"
+     transform="translate(16.973583,-61.023606)"><flowRegion
+       id="flowRegion2487"><rect
+         id="rect2489"
+         y="661.43317"
+         x="199.00005"
+         height="55.558388"
+         width="82.832504" /></flowRegion><flowPara
+       id="flowPara2491" /></flowRoot>  <text
+     style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:TradeGothic-BoldTwo;-inkscape-font-specification:TradeGothic-BoldTwo"
+     xml:space="preserve"
+     id="text2517"
+     y="868.09998"
+     x="176.57768"><tspan
+       id="tspan2519"
+       y="868.09998"
+       x="176.57768" /></text>
+  <path
+     inkscape:connector-curvature="0"
+     style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:none;stroke:#00ff00;stroke-width:1.87737500999999996;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#TriangleInM);marker-end:url(#TriangleOutM);font-family:Arial;-inkscape-font-specification:Arial"
+     id="path5616-2"
+     d="m 387.96432,543.25827 0,33.4262" />
+</svg>
--- a/docs/img/emu/controller.svg	Fri Apr 18 20:07:19 2014 +0100
+++ b/docs/img/emu/controller.svg	Mon Apr 21 19:37:21 2014 +0100
@@ -208,7 +208,7 @@
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="1.625"
-     inkscape:cx="333.84615"
+     inkscape:cx="356.12544"
      inkscape:cy="200"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
@@ -226,7 +226,7 @@
         <dc:format>image/svg+xml</dc:format>
         <dc:type
            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-        <dc:title></dc:title>
+        <dc:title />
       </cc:Work>
     </rdf:RDF>
   </metadata>
@@ -246,7 +246,7 @@
        xml:space="preserve"
        id="flowRoot3095"
        style="text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;display:inline"
-       transform="translate(-118.58608,195.50695)"><flowRegion
+       transform="translate(-110.42538,195.50695)"><flowRegion
          id="flowRegion3097"><rect
            id="rect3099"
            width="163.69331"
@@ -259,7 +259,7 @@
        style="display:inline"
        xml:space="preserve"
        id="flowRoot3135"
-       transform="translate(99.61871,360.70062)"><flowRegion
+       transform="translate(97.61871,361.46985)"><flowRegion
          id="flowRegion3137"><rect
            id="rect3139"
            width="47.486629"
@@ -268,7 +268,7 @@
            y="522.77289" /></flowRegion><flowPara
          id="flowPara3141">Data</flowPara></flowRoot>    <flowRoot
        style="display:inline"
-       transform="translate(157.61871,360.70062)"
+       transform="translate(155.61871,361.46985)"
        id="flowRoot3143"
        xml:space="preserve"><flowRegion
          id="flowRegion3145"><rect
@@ -329,7 +329,7 @@
        style="display:inline"
        xml:space="preserve"
        id="flowRoot3077-8"
-       transform="translate(7.836022,186.16229)"
+       transform="translate(8.9129431,185.70075)"
        inkscape:export-filename="M:\teaching\elb3475\475lectures\week1\images\8080architecture.png"
        inkscape:export-xdpi="300"
        inkscape:export-ydpi="300"><flowRegion
@@ -869,7 +869,7 @@
        sodipodi:cy="171.38461"
        sodipodi:rx="4"
        sodipodi:ry="4"
-       d="m 414.76923,171.38461 a 4,4 0 1 1 -8,0 4,4 0 1 1 8,0 z"
+       d="m 414.76923,171.38461 c 0,2.20914 -1.79086,4 -4,4 -2.20914,0 -4,-1.79086 -4,-4 0,-2.20914 1.79086,-4 4,-4 2.20914,0 4,1.79086 4,4 z"
        transform="translate(72,652.36218)" />
     <path
        transform="translate(8.923082,653.28526)"
@@ -880,7 +880,7 @@
        sodipodi:cy="171.38461"
        sodipodi:rx="4"
        sodipodi:ry="4"
-       d="m 414.76923,171.38461 a 4,4 0 1 1 -8,0 4,4 0 1 1 8,0 z" />
+       d="m 414.76923,171.38461 c 0,2.20914 -1.79086,4 -4,4 -2.20914,0 -4,-1.79086 -4,-4 0,-2.20914 1.79086,-4 4,-4 2.20914,0 4,1.79086 4,4 z" />
     <path
        transform="translate(-146.15384,654.51602)"
        sodipodi:type="arc"
@@ -890,7 +890,7 @@
        sodipodi:cy="171.38461"
        sodipodi:rx="4"
        sodipodi:ry="4"
-       d="m 414.76923,171.38461 a 4,4 0 1 1 -8,0 4,4 0 1 1 8,0 z" />
+       d="m 414.76923,171.38461 c 0,2.20914 -1.79086,4 -4,4 -2.20914,0 -4,-1.79086 -4,-4 0,-2.20914 1.79086,-4 4,-4 2.20914,0 4,1.79086 4,4 z" />
     <path
        transform="translate(-277.85046,655.28526)"
        sodipodi:type="arc"
@@ -900,7 +900,7 @@
        sodipodi:cy="171.38461"
        sodipodi:rx="4"
        sodipodi:ry="4"
-       d="m 414.76923,171.38461 a 4,4 0 1 1 -8,0 4,4 0 1 1 8,0 z" />
+       d="m 414.76923,171.38461 c 0,2.20914 -1.79086,4 -4,4 -2.20914,0 -4,-1.79086 -4,-4 0,-2.20914 1.79086,-4 4,-4 2.20914,0 4,1.79086 4,4 z" />
     <path
        style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:none;marker-end:url(#Arrow2Lend)"
        d="m 43.692,729.43918 52.308,0"
--- a/docs/img/emu/memory.svg	Fri Apr 18 20:07:19 2014 +0100
+++ b/docs/img/emu/memory.svg	Mon Apr 21 19:37:21 2014 +0100
@@ -109,9 +109,9 @@
      borderopacity="1.0"
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
-     inkscape:zoom="0.81190476"
-     inkscape:cx="150.81328"
-     inkscape:cy="30.992195"
+     inkscape:zoom="1.705"
+     inkscape:cx="200"
+     inkscape:cy="200.97443"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
      showgrid="false"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/lyx/#appendix.lyx#	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,71 @@
+#LyX 2.0 created this file. For more info see http://www.lyx.org/
+\lyxformat 413
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_amsmath 1
+\use_esint 1
+\use_mhchem 1
+\use_mathdots 1
+\cite_engine basic
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Part
+External References
+\end_layout
+
+\begin_layout Part
+Supporting Material Index
+\end_layout
+
+\end_body
+\end_document
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/lyx/#asm.lyx#	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,1733 @@
+#LyX 2.0 created this file. For more info see http://www.lyx.org/
+\lyxformat 413
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_amsmath 1
+\use_esint 1
+\use_mhchem 1
+\use_mathdots 1
+\cite_engine basic
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Part
+The Assembler
+\end_layout
+
+\begin_layout Section
+Assembler Design
+\end_layout
+
+\begin_layout Standard
+The assembler will take assembly source code as input and produce two output
+ files: A binary executable and a debug file.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/asm/assembler.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The binary executable will be a simple raw binary file in big-endian format.
+ The debug file will be a tabulated text file with the following format:
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="1" columns="5">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+PC
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+OPCODE
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+DATA
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+MNEMONIC
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+ARGUMENTS
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This file will essentially be the plain text source side by side with the
+ binary machine code and address for each instruction (represented as hexadecima
+l for greater readability).
+ This file will provide the information needed for setting break pointers
+ with the debugger later, it will also be generally useful for debugging
+ programs written in the assembler, and the assembler it self.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Language design in BNF syntax
+\end_layout
+
+\begin_layout Standard
+The ELB816 specification defines an assembly language in Backus Naur form,
+ however the assembler designed for this project differs slightly (more
+ details in Assembler Implementation below).
+ Here is the language definition for this assembler:
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+<assembly_code> ::= <line> <assembly_code> | <line> <EOF> 
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<EOF> ::= <end of file>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<line> ::= [<statement> [";"<comment>]] <EOL>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<EOL> ::= <end of line character>
+\end_layout
+
+\begin_layout Plain Layout
+
+  
+\end_layout
+
+\begin_layout Plain Layout
+
+<statement> ::= [<label> ":"] <mnemonic> [<arguments>]
+\end_layout
+
+\begin_layout Plain Layout
+
+              | [<label>] <directive> [<arguments>]
+\end_layout
+
+\begin_layout Plain Layout
+
+              | <label> ":"
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<character> ::= <any ASCII character>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<mnemonic> ::= "MOV" | "NOP" | "XCSD" | "SFA" | "LAF" | "ANL" 
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "ORL" | "XRL" | "RL" | "RLC" | "RR" | "RRC"             
+                                                                       
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "INC" | "DEC" | "SET" | "CLR" | "CPL" | "ADD" 
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "ADD" | "ADDC" | "SUB" | "SUBB" | "PJUMP"
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "PCALL" | "LJMP" | "LCALL" | "DJNZ" | "CJNE"
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "RET" | "RETI" | "SJMP" | "JMP" | "JZ" | "JNZ"
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "JC" | "JNC" | "JPO" | "JPE" | "JS" | "JNS"
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "PUSH" | "POP" | "IN" | "OUT" | "HLT"
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<directive> ::= "ORG" | "EQU" | "DB" | "DS" 
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<arguments> ::= <argument> | <arguments> "," <argument>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<argument> ::= <register> | <reg_pair> | ["@"] <address>
+\end_layout
+
+\begin_layout Plain Layout
+
+             | <flag> | ["#"] <aggregate>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<register> ::=  "A" | "FLAGS" | "R0" | "R1" | "R2" | "R3"
+\end_layout
+
+\begin_layout Plain Layout
+
+              | "DPH" | "DPL" | "SPH" | "SPL"
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<reg_pair> ::= "DPTR" | "SP" | "PC"
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<flag> ::= "C" | "IE" | "BS" 
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<aggregate> ::= ["("] <python arithmetic> [")"] | <python integer>
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Assembler Implementation
+\end_layout
+
+\begin_layout Standard
+The assembler is written in pure Python 2 using only the standard library.
+ It assembles the assembly the language described in the ELB816 specification
+ with a few minor differences.
+ These differences are:
+\end_layout
+
+\begin_layout Itemize
+In-line arithmetic must be wrapped in curved brackets eg.
+ start with '(' and end with ')'.
+ This is a limitation of the design of the program and to change it would
+ require a large amount of code to be re-written.
+\end_layout
+
+\begin_layout Itemize
+The only directives that have been implemented are 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+ORG
+\end_layout
+
+\end_inset
+
+, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+EQU
+\end_layout
+
+\end_inset
+
+, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+DB
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+DS
+\end_layout
+
+\end_inset
+
+.
+ The other directives listed in the specification have not been implemented,
+ but there omission is only due to time constraints and they could easily
+ be implemented in a later version.
+\end_layout
+
+\begin_layout Itemize
+Macros have not been implemented also due to time constraints.
+\end_layout
+
+\begin_layout Standard
+The assembler consists of two files: 
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+language.py
+\end_layout
+
+\end_inset
+
+ which contains the language definition in an index and some functions to
+ help encode instructions.
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+assembler.py
+\end_layout
+
+\end_inset
+
+ which contains the first and second pass functions and handles opening
+ source files and writing binary files.
+\end_layout
+
+\begin_layout Standard
+The following sections details the design and behavior of the assembler.
+ However it must be noted that these are abstract and high level descriptions
+ that do not fully explain minor routines, but give an overview of the entire
+ process.
+ The full commented source code is attached provided with the supporting
+ and should be referenced for a deeper understanding of the program's operation.
+ 
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Data Structures
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+reserved arguments
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This structure contains a list of string representations of the reserved
+ word arguments for the instruction set.
+ These all equate to registers or register pointers.
+ The full list is as follows:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+a, c, bs, ie, flags, 
+\end_layout
+
+\begin_layout Plain Layout
+
+r0, r1, r2, r3, 
+\end_layout
+
+\begin_layout Plain Layout
+
+dptr, dpl, dph,  
+\end_layout
+
+\begin_layout Plain Layout
+
+sp, sph, spl,
+\end_layout
+
+\begin_layout Plain Layout
+
+@a+pc, @a+dptr, @dptr
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+relative instructions
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This structure contains a list of string representations of the mnemonics
+ of instructions that use relative addressing.
+ The full list is as follows:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},captionpos=b,frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+djnz, cjne, sjmp, jz,
+\end_layout
+
+\begin_layout Plain Layout
+
+jnz, jc, jnc, jpo, 
+\end_layout
+
+\begin_layout Plain Layout
+
+jpe, js, jns
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+instruction index
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This structure contains an index of all possible instructions in the instruction
+ set, along with the the corresponding opcode and instruction width.
+ This is implemented using a combination of Python's dictionary, tuple and
+ list objects.
+ Its structure is demonstrated below:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},captionpos=b,frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+mnemonic: (arg type, arg type, ...): [opcode, width]
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Each mnemonic has an entry in the parent index which returns another index
+ of possible argument formats for that mnemonic with their corresponding
+ opcode and length.
+ Argument types can be either be one of the reserved arguments or one of
+ the following values: 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+address
+\end_layout
+
+\end_inset
+
+, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+pointer
+\end_layout
+
+\end_inset
+
+, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+data
+\end_layout
+
+\end_inset
+
+ or 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+label
+\end_layout
+
+\end_inset
+
+ .
+ Width is represented in number of bytes, ie.
+ 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+width = 3
+\end_layout
+
+\end_inset
+
+ means 1 byte of opcode and 2 bytes of arguments.
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+label index
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This structure is used to store an index of label definitions.
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+equate index
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This structure is used to store an index of equated strings.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage newpage
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Functions
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+first_pass(source file)
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This function pre-processes a source file and stores it in a format containing
+ the necessary data for the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+second_pass()
+\end_layout
+
+\end_inset
+
+ function to assemble it.
+ It processes labels and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+EQU
+\end_layout
+
+\end_inset
+
+ directives by storing strings and their corresponding values in indexes
+ and replacing any subsequent appearances of the string with the value.
+ It prepares 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+ORG
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+DB
+\end_layout
+
+\end_inset
+
+ statements for the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+second_pass()
+\end_layout
+
+\end_inset
+
+.
+ It uses the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+tokenize()
+\end_layout
+
+\end_inset
+
+ function to determine the argument symbols and operand bit string.
+ Finally it uses the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+instruction index
+\end_layout
+
+\end_inset
+
+ to determine the instruction width.
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+second_pass(asm, label index)
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This function takes the pre-processed assembly code and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+label index
+\end_layout
+
+\end_inset
+
+ output by 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+first_pass()
+\end_layout
+
+\end_inset
+
+ as input.
+ First it checks for 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+ORG
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+DB
+\end_layout
+
+\end_inset
+
+ statements and handles them if necessary.
+ Then it replaces any labels that were used before they were defined and
+ therefore not replaced on by 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+first_pass()
+\end_layout
+
+\end_inset
+
+ .
+ It uses the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+instruction index 
+\end_layout
+
+\end_inset
+
+ to determine the opcode and the width of the instruction, then it writes
+ the opcode and operand to the file.
+ If the combined width of the opcode and operand is greater than the instruction
+ width the function raises an error.
+ 
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+tokenize(mnemonic, arguments)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This function processes an instruction in order to produce a hashable symbol
+ that represents the format of its arguments.
+ This symbol is used to look up opcodes in the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+instruction index
+\end_layout
+
+\end_inset
+
+.
+ It also detects string representations of numbers in the arguments and
+ stores a C type struct representation of the operands to be returned along
+ with the symbol.
+ It does this with the help of the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+stoi()
+\end_layout
+
+\end_inset
+
+ function and Python's 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+struct
+\end_layout
+
+\end_inset
+
+ module .
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+stoi(string)
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This function is a general purpose function that is actually used throughout
+ the code, although mainly in the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+tokenize()
+\end_layout
+
+\end_inset
+
+ function.
+ It takes a string as an input and tries to convert it to an integer using
+ Pythons integer representation syntax.
+ It can recognize decimal, octal, hexadecimal and binary numbers which are
+ denoted with different prefixes.
+ If it receives a string it can not represent as an integer it returns the
+ string 'NaN', (Not a Number)
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Below is an abstract representation major components of the assembler logical
+ process.
+ The 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+first_pass()
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+second_pass()
+\end_layout
+
+\end_inset
+
+ are represented in pseudo-code, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+tokenize()
+\end_layout
+
+\end_inset
+
+ is more easily understood when represented as flowcharts.
+ 
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage newpage
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsubsection
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+first_pass
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\small\ttfamily},captionpos=b,frame=tb,framexbottommargin=3em,framextopmargin=3em,keywordstyle={\color{blue}},language=Python,showstringspaces=false,tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+first_pass(source file):
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	address = 0
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	for statement in source file:
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+		remove comments
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		for word in statement:
+\end_layout
+
+\begin_layout Plain Layout
+
+		
+\end_layout
+
+\begin_layout Plain Layout
+
+			if word is in equate index:
+\end_layout
+
+\begin_layout Plain Layout
+
+				replace word with equated value
+\end_layout
+
+\begin_layout Plain Layout
+
+			else if word is in label index:
+\end_layout
+
+\begin_layout Plain Layout
+
+				replace word with address at label
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+			if first word == 'org'
+\end_layout
+
+\begin_layout Plain Layout
+
+				address = second word
+\end_layout
+
+\begin_layout Plain Layout
+
+			else if last character of first word == ':':
+\end_layout
+
+\begin_layout Plain Layout
+
+				remove ':'
+\end_layout
+
+\begin_layout Plain Layout
+
+				add word = address to label index
+\end_layout
+
+\begin_layout Plain Layout
+
+				next statement
+\end_layout
+
+\begin_layout Plain Layout
+
+			else if second word == 'equ'
+\end_layout
+
+\begin_layout Plain Layout
+
+				add first word = third word to equate index
+\end_layout
+
+\begin_layout Plain Layout
+
+				next statement
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		mnemonic = first word
+\end_layout
+
+\begin_layout Plain Layout
+
+		arguments = [second word ...
+ last word]
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		symbol, constant = tokenize(arguments)
+\end_layout
+
+\begin_layout Plain Layout
+
+		if mnemonic == 'db':
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address + width of constant
+\end_layout
+
+\begin_layout Plain Layout
+
+			next statement
+\end_layout
+
+\begin_layout Plain Layout
+
+		if mnemonic == 'ds':
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address + first argument
+\end_layout
+
+\begin_layout Plain Layout
+
+			next statement
+\end_layout
+
+\begin_layout Plain Layout
+
+		
+\end_layout
+
+\begin_layout Plain Layout
+
+        width = instruction index[mnemonic][symbol][width]
+\end_layout
+
+\begin_layout Plain Layout
+
+		address = address + width
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		append [mnemonic, argument, symbol, constant] to asm
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	return asm, label index
+\end_layout
+
+\end_inset
+
+
+\begin_inset Newpage newpage
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsubsection
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+second_pass
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\small\ttfamily},breaklines=true,captionpos=b,frame=tb,framexbottommargin=3em,framextopmargin=3em,keywordstyle={\color{blue}},language=Python,tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+second_pass(file, asm, label index):
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	address = 0
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	for line in asm:
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+		file offset = address
+\end_layout
+
+\begin_layout Plain Layout
+
+		
+\end_layout
+
+\begin_layout Plain Layout
+
+		mnemonic, arguments, symbol, constant = line
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		if mnemonic == 'org':
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = first argument
+\end_layout
+
+\begin_layout Plain Layout
+
+			next line
+\end_layout
+
+\begin_layout Plain Layout
+
+		else if mnemonic == 'db':
+\end_layout
+
+\begin_layout Plain Layout
+
+			write constant to file
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address + width of constant
+\end_layout
+
+\begin_layout Plain Layout
+
+			next line
+\end_layout
+
+\begin_layout Plain Layout
+
+		if mnemonic == 'ds':
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address + first argument
+\end_layout
+
+\begin_layout Plain Layout
+
+            next line
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		for argument in arguments:
+\end_layout
+
+\begin_layout Plain Layout
+
+			if argument is a label:
+\end_layout
+
+\begin_layout Plain Layout
+
+				replace argument with address at label
+\end_layout
+
+\begin_layout Plain Layout
+
+				symbol, data = tokenize(argument)
+\end_layout
+
+\begin_layout Plain Layout
+
+				append data to constant
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		op, width = instruction index[mnemonic][symbol]
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		write op to file
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+		if width of constant - width + 1 > 0:
+\end_layout
+
+\begin_layout Plain Layout
+
+			raise error
+\end_layout
+
+\begin_layout Plain Layout
+
+		else if:
+\end_layout
+
+\begin_layout Plain Layout
+
+			write constant to file
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address.+ width
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+	return file
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/asm/assembler.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Assembler Testing
+\end_layout
+
+\end_body
+\end_document
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/lyx/#dbg.lyx#	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,691 @@
+#LyX 2.0 created this file. For more info see http://www.lyx.org/
+\lyxformat 413
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_amsmath 1
+\use_esint 1
+\use_mhchem 1
+\use_mathdots 1
+\cite_engine basic
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Part
+The Debugger
+\end_layout
+
+\begin_layout Section
+Design
+\end_layout
+
+\begin_layout Standard
+The debugger is designed to issue commands to and receive data from an instant
+ of the emulator running either as a process or on a micro-controller.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/dbg/debugger_overview.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The debugger will implement the protocol described under the Emulator Design
+ section of this report.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Implementation
+\end_layout
+
+\begin_layout Subsection
+dbg.py
+\end_layout
+
+\begin_layout Standard
+The debugger has been implemented as a Python class with the following functions
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="17" columns="3">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="left" valignment="top" width="2cm">
+<column alignment="center" valignment="top" width="7cm">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Function
+\end_layout
+
+\end_inset
+</cell>
+<cell multicolumn="1" alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Arguments
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Description
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+snd
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+byte
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+send a byte to the emulator via a serial or file buffer
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+rcv
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+byte, length
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+receive length number of bytes from a serial or file buffer
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+step
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Execute instruction at PC
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+run
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Execute instructions from PC until a break point is reached
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_reg
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register address, value
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set a register (register address between 0 and 16 as described under Memory
+ Design in the Emulator Design section)
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_reg
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register address
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of a register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+flag bit, 0 or 1
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Turn a flag bit on or off.
+ LSB = 0, MSB =7
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+flag bit
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of a flag bit
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_block
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+address high, address low, length high, length low, [byte array]
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set a block of memory of arbitrary length with the bytes in the byte array
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_block
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+address high, address low, length high, length low
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Read a block of memory of arbitrary length 
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_a
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get value of A
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_flags
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get value of flags
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_ir
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get Value of IR
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+run_len
+\end_layout
+
+\end_inset
+</cell>
+<cell multirow="3" alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+length high, length low
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Run for length number of instruction
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+free_run
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Run forever - Bypass controller
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_bp
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+break point index, address high, address low
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set 1 of 8 possible break points
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The class also has the attribute 'Emu' which can be set to change between
+ serial and file mode for the snd and rcv functions.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The debuggers
+\end_layout
+
+\begin_layout Subsection
+cli.py
+\end_layout
+
+\begin_layout Section
+Debugger Testing
+\end_layout
+
+\end_body
+\end_document
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/lyx/#ede.lyx#	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,188 @@
+#LyX 2.0 created this file. For more info see http://www.lyx.org/
+\lyxformat 413
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_amsmath 1
+\use_esint 1
+\use_mhchem 1
+\use_mathdots 1
+\cite_engine basic
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Part
+The ELB816 Development Environment
+\end_layout
+
+\begin_layout Section
+EDE Overview
+\end_layout
+
+\begin_layout Standard
+EDE is a software implementation of the ELB816 micro-processor along with
+ a basic tool chain to develop and debug code for it.
+ The block diagram below depicts the system that this project aims to implement.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/ede/system_overview.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+EDE Use Cases
+\end_layout
+
+\begin_layout Standard
+EDE is highly modular.
+ Each it's components, with the exception of the UI, is written as a stand
+ alone programs and works independently.
+ Because of this design strategy EDE can be used in a number of different
+ ways.
+ This section details the use cases experimented with so far.
+\end_layout
+
+\begin_layout Subsection
+Assemble/Upload/Execute/Debug
+\end_layout
+
+\begin_layout Standard
+Using the tool chain in this manner is analogous to programming and run-time
+ debugging a real-world micro-controller.
+ Source code is assembled and written into the emulator's memory.
+ The user can then use the debug prompt to step through program and probe
+ the emulator internals.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/ede/aued.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+
+\end_layout
+
+\begin_layout Subsection
+Interpreter Mode
+\end_layout
+
+\begin_layout Standard
+Source code does not have to be pre-assembled.
+ Since the command-line interface, the assembler and the debugger are all
+ written in python, the assembler's functions can be imported into the interface
+ code.
+ This has been done to create a mode where the user enters assembly code
+ at a prompt, and then that code is immediately assembled and executed on
+ an instance of the emulator.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
--- a/docs/lyx/#emu.lyx#	Fri Apr 18 20:07:19 2014 +0100
+++ b/docs/lyx/#emu.lyx#	Mon Apr 21 19:37:21 2014 +0100
@@ -1852,7 +1852,12 @@
 
 \begin_layout Plain Layout
 
-	get instruction from IR
+	get PC
+\end_layout
+
+\begin_layout Plain Layout
+
+	IR = byte in memory at PC
 \end_layout
 
 \begin_layout Plain Layout
@@ -1862,6 +1867,11 @@
 
 \begin_layout Plain Layout
 
+	end
+\end_layout
+
+\begin_layout Plain Layout
+
 \end_layout
 
 \begin_layout Plain Layout
@@ -1910,12 +1920,7 @@
 
 \begin_layout Plain Layout
 
-	get PC
-\end_layout
-
-\begin_layout Plain Layout
-
-	while (counter + PC) != length:
+	while counter != length:
 \end_layout
 
 \begin_layout Plain Layout
@@ -1925,11 +1930,6 @@
 
 \begin_layout Plain Layout
 
-	end
-\end_layout
-
-\begin_layout Plain Layout
-
 \end_layout
 
 \begin_layout Plain Layout
@@ -1990,7 +1990,7 @@
 <lyxtabular version="3" rows="6" columns="2">
 <features tabularvalignment="middle">
 <column alignment="center" valignment="top" width="0">
-<column alignment="left" valignment="top" width="10cm">
+<column alignment="left" valignment="top" width="8cm">
 <row>
 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
 \begin_inset Text
@@ -2046,7 +2046,7 @@
 
 \begin_layout Plain Layout
 Declares a function for each mnemonic in the instruction set.
- Declares a 256 byte instruction table
+ Declares a 256 byte function pointer table
 \end_layout
 
 \end_inset
@@ -2141,7 +2141,1400 @@
 \end_layout
 
 \begin_layout Standard
-
+In this file the 256 byte instruction table is filled with pointers to the
+ functions in iset.c.
+ This file also contains the control interface function and execution control
+ functions.
+ None of these functions take any arguments or return any data.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Below is a list of the functions that appear in this file.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="7" columns="2">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="left" valignment="top" width="8cm">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Function
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Description
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+snd
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Puts a character into the serial or file output buffer
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+rcv
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get a character from the serial or file input buffer
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+step
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Execute the instruction pointed to by PC
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+run
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Execute instructions until a break point is reached
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+controller
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get character from input buffer and deal with accordingly
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+main
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Make sure free run isn't enabled at boot, call controller function forever
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Below is the format of the instruction pointer table initialized in this
+ file.
+ Each item in the table is a pointer to a function.
+\end_layout
+
+\begin_layout Standard
+According to the program Cdecl, in 
+\begin_inset Quotes eld
+\end_inset
+
+human language
+\begin_inset Quotes erd
+\end_inset
+
+, it's declaration is: 
+\begin_inset Quotes eld
+\end_inset
+
+declare ops as array 256 of pointer to function (void) returning void
+\begin_inset Quotes erd
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+The number of the pointers position in the table is the opcode for the instructi
+on that the function being pointed to deals with.
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+void (*ops[256])(void) = {
+\end_layout
+
+\begin_layout Plain Layout
+
+    NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP,
+\end_layout
+
+\begin_layout Plain Layout
+
+    SET, CLR, SET, CLR, SET, CLR, CPL, CPL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    XCSD, SFA, LAF, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    ANL, ANL, ANL, ANL, ANL, ANL, ANL, ANL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    XRL, XRL, XRL, XRL, XRL, XRL, XRL, XRL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    RL, RLC, RR, RRC, INC, DEC, INC, DEC,
+\end_layout
+
+\begin_layout Plain Layout
+
+    ADD, ADD, ADD, ADD, ADD, ADD, ADD, ADD,
+\end_layout
+
+\begin_layout Plain Layout
+
+    ADDC, ADDC, ADDC, ADDC, ADDC, ADDC, ADDC, ADDC,
+\end_layout
+
+\begin_layout Plain Layout
+
+    SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB,
+\end_layout
+
+\begin_layout Plain Layout
+
+    SUBB, SUBB, SUBB, SUBB, SUBB, SUBB, SUBB, SUBB,
+\end_layout
+
+\begin_layout Plain Layout
+
+    PJMP, PJMP, PJMP, PJMP, PJMP, PJMP, PJMP, PJMP,
+\end_layout
+
+\begin_layout Plain Layout
+
+    PCALL, PCALL, PCALL, PCALL, PCALL, PCALL, PCALL, PCALL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    DJNZ, DJNZ, DJNZ, DJNZ, CJNE, CJNE, CJNE, CJNE,
+\end_layout
+
+\begin_layout Plain Layout
+
+    LJMP, LCALL, RET, RETI, SJMP, JMP, JMP, CJNE,
+\end_layout
+
+\begin_layout Plain Layout
+
+    JZ, JNZ, JC, JNC, JPO, JPE, JS, JNS,
+\end_layout
+
+\begin_layout Plain Layout
+
+    PUSH, PUSH, PUSH, PUSH, PUSH, PUSH, PUSH, PUSH,
+\end_layout
+
+\begin_layout Plain Layout
+
+    POP, POP, POP, POP, POP, POP, POP, POP,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MUL, DIV, DA, NOP, IN, OUT, INT, HLT
+\end_layout
+
+\begin_layout Plain Layout
+
+};
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+iset.c/h
+\end_layout
+
+\begin_layout Standard
+For every mnemonic in the ELB816 instruction set there is a function in
+ these files.
+ These are the functions that are pointed to in the instruction table that
+ is filled in main.c.
+ The functions behave according to their description in the ELB816 specification.
+\end_layout
+
+\begin_layout Subsection
+mem.c/h
+\end_layout
+
+\begin_layout Standard
+In mem.h the memory structure of the emulator is defined in accordance with
+ how it was described in the previous section.
+ mem.c contains the following functions to facilitate access to this memory.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="11" columns="4">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="left" valignment="top" width="6cm">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Function
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Arguments
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Returns
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Description
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+1 byte
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of a flag (can be 0 or 1)
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+flag, on
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set a flag to 0 if on == 0, else set flag to 1
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_zp
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+value
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set zero and parity flags based on value
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_wide
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+2 bytes
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of a 16-bit register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_wide
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register, value
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set the value of a 16-bit register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+inc_pc
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+n
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Increment the PC by n
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+fetch
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+1 byte
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+return the byte in memory at PC, increment PC
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+fetch_wide
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+2 bytes
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+return the 2 bytes in memory at PC, increment PC by 2
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_reg
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+1 byte
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of an 8-bit register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_reg
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register, value
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set the value of an 8-bit register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The various register access functions use different register encoding schemes.
+ These are in the tables below.
+\end_layout
+
+\begin_layout Itemize
+get_wide/set_wide 
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="5" columns="2">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Register
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Encoding
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+DPTR
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+00
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+SP
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+01
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+PC
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+10
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+TMPA
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+11
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+get_reg/set_reg - These values correspond to the way registers are encoded
+ into the last 3-bits of many of the ELB816 instructions.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="9" columns="2">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Register
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Encoding
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+R0
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+000
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+R1
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+001
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+R2
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+010
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+R3
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+011
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+DPH
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+100
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+DPL
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+101
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+SPH
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+110
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+SPL
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+111
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Porting to Intel MCS-51
+\end_layout
+
+\begin_layout Standard
+In order make this code compile for an 8052 using Keil C51 a few changes
+ to were needed.
+ These are detailed below.
+\end_layout
+
+\begin_layout Subsection
+main.c
+\end_layout
+
+\begin_layout Standard
+In the PC version of the emulator, the function table is declared as:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+FUNCTION_TABLE const iset 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Since the instruction set is 256 bytes long and the 8052 only has 256 bytes
+ of internal RAM, this data structure must be redeclared to exist in code
+ memory space.
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+FUNCTION_TABLE const code iset
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The PC version of the emulator uses a file buffer to communicate with the
+ debugger.
+ On the 8052 communication uses a serial interface.
+ Because of this the snd() functions differ.
+\end_layout
+
+\begin_layout Standard
+On the PC
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+snd(BYTE c) {
+\end_layout
+
+\begin_layout Plain Layout
+
+    fp = fopen("out", "a");
+\end_layout
+
+\begin_layout Plain Layout
+
+    fputc(c, fp);
+\end_layout
+
+\begin_layout Plain Layout
+
+    fclose(fp);
+\end_layout
+
+\begin_layout Plain Layout
+
+}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Becomes on the 8052, simply:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+snd(BYTE c) { 
+\end_layout
+
+\begin_layout Plain Layout
+
+	putchar(c); 
+\end_layout
+
+\begin_layout Plain Layout
+
+} 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The 8052's serial point also needs to be configures at the start of main
+ execution like this:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+SCON  = 0x50;     * SCON - mode 1, 8-bit UART, enable rcvr 
+\end_layout
+
+\begin_layout Plain Layout
+
+TMOD |= 0x20;     * TMOD - timer 1, mode 2, 8-bit reload 
+\end_layout
+
+\begin_layout Plain Layout
+
+TH1   = 0xE8;     * TH1 - reload value for 1200 baud @ 12MHz 
+\end_layout
+
+\begin_layout Plain Layout
+
+TR1   = 1;        * TR1 - timer 1 run 
+\end_layout
+
+\begin_layout Plain Layout
+
+TI    = 1;        * TI - set TI to send first char of UART */ 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+mem.h
+\end_layout
+
+\begin_layout Standard
+The 8052 development board available during this project had 32K of external
+ RAM available.
+ This meant the size of the emulators Von Neumann memory space had to be
+ halved and declared to exist in external data memory.
 \end_layout
 
 \begin_layout Section
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/lyx/#review.lyx#	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,71 @@
+#LyX 2.0 created this file. For more info see http://www.lyx.org/
+\lyxformat 413
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_amsmath 1
+\use_esint 1
+\use_mhchem 1
+\use_mathdots 1
+\cite_engine basic
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Part
+Review and Improvements
+\end_layout
+
+\begin_layout Standard
+
+\end_layout
+
+\end_body
+\end_document
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/lyx/appendix.lyx	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,71 @@
+#LyX 2.0 created this file. For more info see http://www.lyx.org/
+\lyxformat 413
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_amsmath 1
+\use_esint 1
+\use_mhchem 1
+\use_mathdots 1
+\cite_engine basic
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Part
+External References
+\end_layout
+
+\begin_layout Part
+Supporting Material Index
+\end_layout
+
+\end_body
+\end_document
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/lyx/appendix.lyx~	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,71 @@
+#LyX 2.0 created this file. For more info see http://www.lyx.org/
+\lyxformat 413
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_amsmath 1
+\use_esint 1
+\use_mhchem 1
+\use_mathdots 1
+\cite_engine basic
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Part
+Supporting Material Index
+\end_layout
+
+\begin_layout Part
+References
+\end_layout
+
+\end_body
+\end_document
--- a/docs/lyx/asm.lyx	Fri Apr 18 20:07:19 2014 +0100
+++ b/docs/lyx/asm.lyx	Mon Apr 21 19:37:21 2014 +0100
@@ -67,10 +67,1643 @@
 Assembler Design
 \end_layout
 
+\begin_layout Standard
+The assembler will take assembly source code as input and produce two output
+ files: A binary executable and a debug file.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/asm/assembler.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The binary executable will be a simple raw binary file in big-endian format.
+ The debug file will be a tabulated text file with the following format:
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="1" columns="5">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+PC
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+OPCODE
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+DATA
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+MNEMONIC
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+ARGUMENTS
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This file will essentially be the plain text source side by side with the
+ binary machine code and address for each instruction (represented as hexadecima
+l for greater readability).
+ This file will provide the information needed for setting break pointers
+ with the debugger later, it will also be generally useful for debugging
+ programs written in the assembler, and the assembler it self.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Language design in BNF syntax
+\end_layout
+
+\begin_layout Standard
+The ELB816 specification defines an assembly language in Backus Naur form,
+ however the assembler designed for this project differs slightly (more
+ details in Assembler Implementation below).
+ Here is the language definition for this assembler:
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},captionpos=b,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+<assembly_code> ::= <line> <assembly_code> | <line> <EOF> 
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<EOF> ::= <end of file>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<line> ::= [<statement> [";"<comment>]] <EOL>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<EOL> ::= <end of line character>
+\end_layout
+
+\begin_layout Plain Layout
+
+  
+\end_layout
+
+\begin_layout Plain Layout
+
+<statement> ::= [<label> ":"] <mnemonic> [<arguments>]
+\end_layout
+
+\begin_layout Plain Layout
+
+              | [<label>] <directive> [<arguments>]
+\end_layout
+
+\begin_layout Plain Layout
+
+              | <label> ":"
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<character> ::= <any ASCII character>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<mnemonic> ::= "MOV" | "NOP" | "XCSD" | "SFA" | "LAF" | "ANL" 
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "ORL" | "XRL" | "RL" | "RLC" | "RR" | "RRC"             
+                                                                       
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "INC" | "DEC" | "SET" | "CLR" | "CPL" | "ADD" 
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "ADD" | "ADDC" | "SUB" | "SUBB" | "PJUMP"
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "PCALL" | "LJMP" | "LCALL" | "DJNZ" | "CJNE"
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "RET" | "RETI" | "SJMP" | "JMP" | "JZ" | "JNZ"
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "JC" | "JNC" | "JPO" | "JPE" | "JS" | "JNS"
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "PUSH" | "POP" | "IN" | "OUT" | "HLT"
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<directive> ::= "ORG" | "EQU" | "DB" | "DS" 
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<arguments> ::= <argument> | <arguments> "," <argument>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<argument> ::= <register> | <reg_pair> | ["@"] <address>
+\end_layout
+
+\begin_layout Plain Layout
+
+             | <flag> | ["#"] <aggregate>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<register> ::=  "A" | "FLAGS" | "R0" | "R1" | "R2" | "R3"
+\end_layout
+
+\begin_layout Plain Layout
+
+              | "DPH" | "DPL" | "SPH" | "SPL"
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<reg_pair> ::= "DPTR" | "SP" | "PC"
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<flag> ::= "C" | "IE" | "BS" 
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<aggregate> ::= ["("] <python arithmetic> [")"] | <python integer>
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
 \begin_layout Section
 Assembler Implementation
 \end_layout
 
+\begin_layout Standard
+The assembler is written in pure Python 2 using only the standard library.
+ It assembles the assembly the language described in the ELB816 specification
+ with a few minor differences.
+ These differences are:
+\end_layout
+
+\begin_layout Itemize
+In-line arithmetic must be wrapped in curved brackets eg.
+ start with '(' and end with ')'.
+ This is a limitation of the design of the program and to change it would
+ require a large amount of code to be re-written.
+\end_layout
+
+\begin_layout Itemize
+The only directives that have been implemented are 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+ORG
+\end_layout
+
+\end_inset
+
+, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+EQU
+\end_layout
+
+\end_inset
+
+, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+DB
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+DS
+\end_layout
+
+\end_inset
+
+.
+ The other directives listed in the specification have not been implemented,
+ but there omission is only due to time constraints and they could easily
+ be implemented in a later version.
+\end_layout
+
+\begin_layout Itemize
+Macros have not been implemented also due to time constraints.
+\end_layout
+
+\begin_layout Standard
+The assembler consists of two files: 
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+language.py
+\end_layout
+
+\end_inset
+
+ which contains the language definition in an index and some functions to
+ help encode instructions.
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+assembler.py
+\end_layout
+
+\end_inset
+
+ which contains the first and second pass functions and handles opening
+ source files and writing binary files.
+\end_layout
+
+\begin_layout Standard
+The following sections details the design and behavior of the assembler.
+ However it must be noted that these are abstract and high level descriptions
+ that do not fully explain minor routines, but give an overview of the entire
+ process.
+ The full commented source code is provided with the supporting and should
+ be referenced for a deeper understanding of the program's operation.
+ 
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Data Structures
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+reserved arguments
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This structure contains a list of string representations of the reserved
+ word arguments for the instruction set.
+ These all equate to registers or register pointers.
+ The full list is as follows:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+a, c, bs, ie, flags, 
+\end_layout
+
+\begin_layout Plain Layout
+
+r0, r1, r2, r3, 
+\end_layout
+
+\begin_layout Plain Layout
+
+dptr, dpl, dph,  
+\end_layout
+
+\begin_layout Plain Layout
+
+sp, sph, spl,
+\end_layout
+
+\begin_layout Plain Layout
+
+@a+pc, @a+dptr, @dptr
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+relative instructions
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This structure contains a list of string representations of the mnemonics
+ of instructions that use relative addressing.
+ The full list is as follows:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},captionpos=b,frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+djnz, cjne, sjmp, jz,
+\end_layout
+
+\begin_layout Plain Layout
+
+jnz, jc, jnc, jpo, 
+\end_layout
+
+\begin_layout Plain Layout
+
+jpe, js, jns
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+instruction index
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This structure contains an index of all possible instructions in the instruction
+ set, along with the the corresponding opcode and instruction width.
+ This is implemented using a combination of Python's dictionary, tuple and
+ list objects.
+ Its structure is demonstrated below:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},captionpos=b,frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+mnemonic: (arg type, arg type, ...): [opcode, width]
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Each mnemonic has an entry in the parent index which returns another index
+ of possible argument formats for that mnemonic with their corresponding
+ opcode and length.
+ Argument types can be either be one of the reserved arguments or one of
+ the following values: 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+address
+\end_layout
+
+\end_inset
+
+, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+pointer
+\end_layout
+
+\end_inset
+
+, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+data
+\end_layout
+
+\end_inset
+
+ or 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+label
+\end_layout
+
+\end_inset
+
+ .
+ Width is represented in number of bytes, ie.
+ 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+width = 3
+\end_layout
+
+\end_inset
+
+ means 1 byte of opcode and 2 bytes of arguments.
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+label index
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This structure is used to store an index of label definitions.
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+equate index
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This structure is used to store an index of equated strings.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage newpage
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Functions
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+first_pass(source file)
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This function pre-processes a source file and stores it in a format containing
+ the necessary data for the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+second_pass()
+\end_layout
+
+\end_inset
+
+ function to assemble it.
+ It processes labels and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+EQU
+\end_layout
+
+\end_inset
+
+ directives by storing strings and their corresponding values in indexes
+ and replacing any subsequent appearances of the string with the value.
+ It prepares 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+ORG
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+DB
+\end_layout
+
+\end_inset
+
+ statements for the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+second_pass()
+\end_layout
+
+\end_inset
+
+.
+ It uses the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+tokenize()
+\end_layout
+
+\end_inset
+
+ function to determine the argument symbols and operand bit string.
+ Finally it uses the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+instruction index
+\end_layout
+
+\end_inset
+
+ to determine the instruction width.
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+second_pass(asm, label index)
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This function takes the pre-processed assembly code and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+label index
+\end_layout
+
+\end_inset
+
+ output by 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+first_pass()
+\end_layout
+
+\end_inset
+
+ as input.
+ First it checks for 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+ORG
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+DB
+\end_layout
+
+\end_inset
+
+ statements and handles them if necessary.
+ Then it replaces any labels that were used before they were defined and
+ therefore not replaced on by 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+first_pass()
+\end_layout
+
+\end_inset
+
+ .
+ It uses the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+instruction index 
+\end_layout
+
+\end_inset
+
+ to determine the opcode and the width of the instruction, then it writes
+ the opcode and operand to the file.
+ If the combined width of the opcode and operand is greater than the instruction
+ width the function raises an error.
+ 
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+tokenize(mnemonic, arguments)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This function processes an instruction in order to produce a hashable symbol
+ that represents the format of its arguments.
+ This symbol is used to look up opcodes in the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+instruction index
+\end_layout
+
+\end_inset
+
+.
+ It also detects string representations of numbers in the arguments and
+ stores a C type struct representation of the operands to be returned along
+ with the symbol.
+ It does this with the help of the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+stoi()
+\end_layout
+
+\end_inset
+
+ function and Python's 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+struct
+\end_layout
+
+\end_inset
+
+ module .
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+stoi(string)
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This function is a general purpose function that is actually used throughout
+ the code, although mainly in the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+tokenize()
+\end_layout
+
+\end_inset
+
+ function.
+ It takes a string as an input and tries to convert it to an integer using
+ Pythons integer representation syntax.
+ It can recognize decimal, octal, hexadecimal and binary numbers which are
+ denoted with different prefixes.
+ If it receives a string it can not represent as an integer it returns the
+ string 'NaN', (Not a Number)
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Below is an abstract representation major components of the assembler.
+ The 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+first_pass()
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+second_pass()
+\end_layout
+
+\end_inset
+
+ are represented in pseudo-code, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+tokenize()
+\end_layout
+
+\end_inset
+
+ is more easily understood when represented as flowcharts.
+ 
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage newpage
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsubsection
+first_pass
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\small\ttfamily},captionpos=b,frame=tb,framexbottommargin=3em,framextopmargin=3em,keywordstyle={\color{blue}},showstringspaces=false,tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+first_pass(source file):
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	address = 0
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	for statement in source file:
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+		remove comments
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		for word in statement:
+\end_layout
+
+\begin_layout Plain Layout
+
+		
+\end_layout
+
+\begin_layout Plain Layout
+
+			if word is in equate index:
+\end_layout
+
+\begin_layout Plain Layout
+
+				replace word with equated value
+\end_layout
+
+\begin_layout Plain Layout
+
+			else if word is in label index:
+\end_layout
+
+\begin_layout Plain Layout
+
+				replace word with address at label
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+			if first word == 'org'
+\end_layout
+
+\begin_layout Plain Layout
+
+				address = second word
+\end_layout
+
+\begin_layout Plain Layout
+
+			else if last character of first word == ':':
+\end_layout
+
+\begin_layout Plain Layout
+
+				remove ':'
+\end_layout
+
+\begin_layout Plain Layout
+
+				add word = address to label index
+\end_layout
+
+\begin_layout Plain Layout
+
+				next statement
+\end_layout
+
+\begin_layout Plain Layout
+
+			else if second word == 'equ'
+\end_layout
+
+\begin_layout Plain Layout
+
+				add first word = third word to equate index
+\end_layout
+
+\begin_layout Plain Layout
+
+				next statement
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		mnemonic = first word
+\end_layout
+
+\begin_layout Plain Layout
+
+		arguments = [second word ...
+ last word]
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		symbol, constant = tokenize(arguments)
+\end_layout
+
+\begin_layout Plain Layout
+
+		if mnemonic == 'db':
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address + width of constant
+\end_layout
+
+\begin_layout Plain Layout
+
+			next statement
+\end_layout
+
+\begin_layout Plain Layout
+
+		if mnemonic == 'ds':
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address + first argument
+\end_layout
+
+\begin_layout Plain Layout
+
+			next statement
+\end_layout
+
+\begin_layout Plain Layout
+
+		
+\end_layout
+
+\begin_layout Plain Layout
+
+        width = instruction index[mnemonic][symbol][width]
+\end_layout
+
+\begin_layout Plain Layout
+
+		address = address + width
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		append [mnemonic, argument, symbol, constant] to asm
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	return asm, label index
+\end_layout
+
+\end_inset
+
+
+\begin_inset Newpage newpage
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsubsection
+second_pass
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\small\ttfamily},breaklines=true,captionpos=b,frame=tb,framexbottommargin=3em,framextopmargin=3em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+second_pass(file, asm, label index):
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	address = 0
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	for line in asm:
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+		file offset = address
+\end_layout
+
+\begin_layout Plain Layout
+
+		
+\end_layout
+
+\begin_layout Plain Layout
+
+		mnemonic, arguments, symbol, constant = line
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		if mnemonic == 'org':
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = first argument
+\end_layout
+
+\begin_layout Plain Layout
+
+			next line
+\end_layout
+
+\begin_layout Plain Layout
+
+		else if mnemonic == 'db':
+\end_layout
+
+\begin_layout Plain Layout
+
+			write constant to file
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address + width of constant
+\end_layout
+
+\begin_layout Plain Layout
+
+			next line
+\end_layout
+
+\begin_layout Plain Layout
+
+		if mnemonic == 'ds':
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address + first argument
+\end_layout
+
+\begin_layout Plain Layout
+
+            next line
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		for argument in arguments:
+\end_layout
+
+\begin_layout Plain Layout
+
+			if argument is a label:
+\end_layout
+
+\begin_layout Plain Layout
+
+				replace argument with address at label
+\end_layout
+
+\begin_layout Plain Layout
+
+				symbol, data = tokenize(argument)
+\end_layout
+
+\begin_layout Plain Layout
+
+				append data to constant
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		op, width = instruction index[mnemonic][symbol]
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		write op to file
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+		if width of constant - width + 1 > 0:
+\end_layout
+
+\begin_layout Plain Layout
+
+			raise error
+\end_layout
+
+\begin_layout Plain Layout
+
+		else if:
+\end_layout
+
+\begin_layout Plain Layout
+
+			write constant to file
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address.+ width
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+	return file
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsubsection
+tokenize
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/asm/tokenize.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
 \begin_layout Section
 Assembler Testing
 \end_layout
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/lyx/asm.lyx~	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,1700 @@
+#LyX 2.0 created this file. For more info see http://www.lyx.org/
+\lyxformat 413
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_amsmath 1
+\use_esint 1
+\use_mhchem 1
+\use_mathdots 1
+\cite_engine basic
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Part
+The Assembler
+\end_layout
+
+\begin_layout Section
+Assembler Design
+\end_layout
+
+\begin_layout Standard
+The assembler will take assembly source code as input and produce two output
+ files: A binary executable and a debug file.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/asm/assembler.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The binary executable will be a simple raw binary file in big-endian format.
+ The debug file will be a tabulated text file with the following format:
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="1" columns="5">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+PC
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+OPCODE
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+DATA
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+MNEMONIC
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+ARGUMENTS
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This file will essentially be the plain text source side by side with the
+ binary machine code and address for each instruction (represented as hexadecima
+l for greater readability).
+ This file will provide the information needed for setting break pointers
+ with the debugger later, it will also be generally useful for debugging
+ programs written in the assembler, and the assembler it self.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Language design in BNF syntax
+\end_layout
+
+\begin_layout Standard
+The ELB816 specification defines an assembly language in Backus Naur form,
+ however the assembler designed for this project differs slightly (more
+ details in Assembler Implementation below).
+ Here is the language definition for this assembler:
+\end_layout
+
+\begin_layout Standard
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},captionpos=b,frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+<assembly_code> ::= <line> <assembly_code> | <line> <EOF> 
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<EOF> ::= <end of file>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<line> ::= [<statement> [";"<comment>]] <EOL>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<EOL> ::= <end of line character>
+\end_layout
+
+\begin_layout Plain Layout
+
+  
+\end_layout
+
+\begin_layout Plain Layout
+
+<statement> ::= [<label> ":"] <mnemonic> [<arguments>]
+\end_layout
+
+\begin_layout Plain Layout
+
+              | [<label>] <directive> [<arguments>]
+\end_layout
+
+\begin_layout Plain Layout
+
+              | <label> ":"
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<character> ::= <any ASCII character>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<mnemonic> ::= "MOV" | "NOP" | "XCSD" | "SFA" | "LAF" | "ANL" 
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "ORL" | "XRL" | "RL" | "RLC" | "RR" | "RRC"             
+                                                                       
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "INC" | "DEC" | "SET" | "CLR" | "CPL" | "ADD" 
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "ADD" | "ADDC" | "SUB" | "SUBB" | "PJUMP"
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "PCALL" | "LJMP" | "LCALL" | "DJNZ" | "CJNE"
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "RET" | "RETI" | "SJMP" | "JMP" | "JZ" | "JNZ"
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "JC" | "JNC" | "JPO" | "JPE" | "JS" | "JNS"
+\end_layout
+
+\begin_layout Plain Layout
+
+             | "PUSH" | "POP" | "IN" | "OUT" | "HLT"
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<directive> ::= "ORG" | "EQU" | "DB" | "DS" 
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<arguments> ::= <argument> | <arguments> "," <argument>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<argument> ::= <register> | <reg_pair> | ["@"] <address>
+\end_layout
+
+\begin_layout Plain Layout
+
+             | <flag> | ["#"] <aggregate>
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<register> ::=  "A" | "FLAGS" | "R0" | "R1" | "R2" | "R3"
+\end_layout
+
+\begin_layout Plain Layout
+
+              | "DPH" | "DPL" | "SPH" | "SPL"
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<reg_pair> ::= "DPTR" | "SP" | "PC"
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<flag> ::= "C" | "IE" | "BS" 
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+<aggregate> ::= ["("] <python arithmetic> [")"] | <python integer>
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Assembler Implementation
+\end_layout
+
+\begin_layout Standard
+The assembler is written in pure Python 2 using only the standard library.
+ It assembles the assembly the language described in the ELB816 specification
+ with a few minor differences.
+ These differences are:
+\end_layout
+
+\begin_layout Itemize
+In-line arithmetic must be wrapped in curved brackets eg.
+ start with '(' and end with ')'.
+ This is a limitation of the design of the program and to change it would
+ require a large amount of code to be re-written.
+\end_layout
+
+\begin_layout Itemize
+The only directives that have been implemented are 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+ORG
+\end_layout
+
+\end_inset
+
+, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+EQU
+\end_layout
+
+\end_inset
+
+, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+DB
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+DS
+\end_layout
+
+\end_inset
+
+.
+ The other directives listed in the specification have not been implemented,
+ but there omission is only due to time constraints and they could easily
+ be implemented in a later version.
+\end_layout
+
+\begin_layout Itemize
+Macros have not been implemented also due to time constraints.
+\end_layout
+
+\begin_layout Standard
+The assembler consists of two files: 
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+language.py
+\end_layout
+
+\end_inset
+
+ which contains the language definition in an index and some functions to
+ help encode instructions.
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+assembler.py
+\end_layout
+
+\end_inset
+
+ which contains the first and second pass functions and handles opening
+ source files and writing binary files.
+\end_layout
+
+\begin_layout Standard
+The following sections details the design and behavior of the assembler.
+ However it must be noted that these are abstract and high level descriptions
+ that do not fully explain minor routines, but give an overview of the entire
+ process.
+ The full commented source code is provided with the supporting and should
+ be referenced for a deeper understanding of the program's operation.
+ 
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Data Structures
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+reserved arguments
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This structure contains a list of string representations of the reserved
+ word arguments for the instruction set.
+ These all equate to registers or register pointers.
+ The full list is as follows:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+a, c, bs, ie, flags, 
+\end_layout
+
+\begin_layout Plain Layout
+
+r0, r1, r2, r3, 
+\end_layout
+
+\begin_layout Plain Layout
+
+dptr, dpl, dph,  
+\end_layout
+
+\begin_layout Plain Layout
+
+sp, sph, spl,
+\end_layout
+
+\begin_layout Plain Layout
+
+@a+pc, @a+dptr, @dptr
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+relative instructions
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This structure contains a list of string representations of the mnemonics
+ of instructions that use relative addressing.
+ The full list is as follows:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},captionpos=b,frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+djnz, cjne, sjmp, jz,
+\end_layout
+
+\begin_layout Plain Layout
+
+jnz, jc, jnc, jpo, 
+\end_layout
+
+\begin_layout Plain Layout
+
+jpe, js, jns
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+instruction index
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This structure contains an index of all possible instructions in the instruction
+ set, along with the the corresponding opcode and instruction width.
+ This is implemented using a combination of Python's dictionary, tuple and
+ list objects.
+ Its structure is demonstrated below:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},captionpos=b,frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+mnemonic: (arg type, arg type, ...): [opcode, width]
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Each mnemonic has an entry in the parent index which returns another index
+ of possible argument formats for that mnemonic with their corresponding
+ opcode and length.
+ Argument types can be either be one of the reserved arguments or one of
+ the following values: 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+address
+\end_layout
+
+\end_inset
+
+, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+pointer
+\end_layout
+
+\end_inset
+
+, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+data
+\end_layout
+
+\end_inset
+
+ or 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+label
+\end_layout
+
+\end_inset
+
+ .
+ Width is represented in number of bytes, ie.
+ 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+width = 3
+\end_layout
+
+\end_inset
+
+ means 1 byte of opcode and 2 bytes of arguments.
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+label index
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This structure is used to store an index of label definitions.
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+equate index
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This structure is used to store an index of equated strings.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage newpage
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Functions
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+first_pass(source file)
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This function pre-processes a source file and stores it in a format containing
+ the necessary data for the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+second_pass()
+\end_layout
+
+\end_inset
+
+ function to assemble it.
+ It processes labels and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+EQU
+\end_layout
+
+\end_inset
+
+ directives by storing strings and their corresponding values in indexes
+ and replacing any subsequent appearances of the string with the value.
+ It prepares 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+ORG
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+DB
+\end_layout
+
+\end_inset
+
+ statements for the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+second_pass()
+\end_layout
+
+\end_inset
+
+.
+ It uses the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+tokenize()
+\end_layout
+
+\end_inset
+
+ function to determine the argument symbols and operand bit string.
+ Finally it uses the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+instruction index
+\end_layout
+
+\end_inset
+
+ to determine the instruction width.
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+second_pass(asm, label index)
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This function takes the pre-processed assembly code and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+label index
+\end_layout
+
+\end_inset
+
+ output by 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+first_pass()
+\end_layout
+
+\end_inset
+
+ as input.
+ First it checks for 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+ORG
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+DB
+\end_layout
+
+\end_inset
+
+ statements and handles them if necessary.
+ Then it replaces any labels that were used before they were defined and
+ therefore not replaced on by 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+first_pass()
+\end_layout
+
+\end_inset
+
+ .
+ It uses the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+instruction index 
+\end_layout
+
+\end_inset
+
+ to determine the opcode and the width of the instruction, then it writes
+ the opcode and operand to the file.
+ If the combined width of the opcode and operand is greater than the instruction
+ width the function raises an error.
+ 
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+tokenize(mnemonic, arguments)
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+This function processes an instruction in order to produce a hashable symbol
+ that represents the format of its arguments.
+ This symbol is used to look up opcodes in the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+instruction index
+\end_layout
+
+\end_inset
+
+.
+ It also detects string representations of numbers in the arguments and
+ stores a C type struct representation of the operands to be returned along
+ with the symbol.
+ It does this with the help of the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+stoi()
+\end_layout
+
+\end_inset
+
+ function and Python's 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+struct
+\end_layout
+
+\end_inset
+
+ module .
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+stoi(string)
+\end_layout
+
+\end_inset
+
+ 
+\end_layout
+
+\begin_layout Standard
+This function is a general purpose function that is actually used throughout
+ the code, although mainly in the 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+tokenize()
+\end_layout
+
+\end_inset
+
+ function.
+ It takes a string as an input and tries to convert it to an integer using
+ Pythons integer representation syntax.
+ It can recognize decimal, octal, hexadecimal and binary numbers which are
+ denoted with different prefixes.
+ If it receives a string it can not represent as an integer it returns the
+ string 'NaN', (Not a Number)
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Below is an abstract representation major components of the assembler.
+ The 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+first_pass()
+\end_layout
+
+\end_inset
+
+ and 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+second_pass()
+\end_layout
+
+\end_inset
+
+ are represented in pseudo-code, 
+\begin_inset listings
+lstparams "basicstyle={\ttfamily}"
+inline true
+status open
+
+\begin_layout Plain Layout
+
+tokenize()
+\end_layout
+
+\end_inset
+
+ is more easily understood when represented as flowcharts.
+ 
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage newpage
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsubsection
+first_pass
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\small\ttfamily},captionpos=b,frame=tb,framexbottommargin=3em,framextopmargin=3em,keywordstyle={\color{blue}},showstringspaces=false,tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+first_pass(source file):
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	address = 0
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	for statement in source file:
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+		remove comments
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		for word in statement:
+\end_layout
+
+\begin_layout Plain Layout
+
+		
+\end_layout
+
+\begin_layout Plain Layout
+
+			if word is in equate index:
+\end_layout
+
+\begin_layout Plain Layout
+
+				replace word with equated value
+\end_layout
+
+\begin_layout Plain Layout
+
+			else if word is in label index:
+\end_layout
+
+\begin_layout Plain Layout
+
+				replace word with address at label
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+			if first word == 'org'
+\end_layout
+
+\begin_layout Plain Layout
+
+				address = second word
+\end_layout
+
+\begin_layout Plain Layout
+
+			else if last character of first word == ':':
+\end_layout
+
+\begin_layout Plain Layout
+
+				remove ':'
+\end_layout
+
+\begin_layout Plain Layout
+
+				add word = address to label index
+\end_layout
+
+\begin_layout Plain Layout
+
+				next statement
+\end_layout
+
+\begin_layout Plain Layout
+
+			else if second word == 'equ'
+\end_layout
+
+\begin_layout Plain Layout
+
+				add first word = third word to equate index
+\end_layout
+
+\begin_layout Plain Layout
+
+				next statement
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		mnemonic = first word
+\end_layout
+
+\begin_layout Plain Layout
+
+		arguments = [second word ...
+ last word]
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		symbol, constant = tokenize(arguments)
+\end_layout
+
+\begin_layout Plain Layout
+
+		if mnemonic == 'db':
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address + width of constant
+\end_layout
+
+\begin_layout Plain Layout
+
+			next statement
+\end_layout
+
+\begin_layout Plain Layout
+
+		if mnemonic == 'ds':
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address + first argument
+\end_layout
+
+\begin_layout Plain Layout
+
+			next statement
+\end_layout
+
+\begin_layout Plain Layout
+
+		
+\end_layout
+
+\begin_layout Plain Layout
+
+        width = instruction index[mnemonic][symbol][width]
+\end_layout
+
+\begin_layout Plain Layout
+
+		address = address + width
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		append [mnemonic, argument, symbol, constant] to asm
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	return asm, label index
+\end_layout
+
+\end_inset
+
+
+\begin_inset Newpage newpage
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsubsection
+second_pass
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\small\ttfamily},breaklines=true,captionpos=b,frame=tb,framexbottommargin=3em,framextopmargin=3em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+second_pass(file, asm, label index):
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	address = 0
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+	for line in asm:
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+		file offset = address
+\end_layout
+
+\begin_layout Plain Layout
+
+		
+\end_layout
+
+\begin_layout Plain Layout
+
+		mnemonic, arguments, symbol, constant = line
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		if mnemonic == 'org':
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = first argument
+\end_layout
+
+\begin_layout Plain Layout
+
+			next line
+\end_layout
+
+\begin_layout Plain Layout
+
+		else if mnemonic == 'db':
+\end_layout
+
+\begin_layout Plain Layout
+
+			write constant to file
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address + width of constant
+\end_layout
+
+\begin_layout Plain Layout
+
+			next line
+\end_layout
+
+\begin_layout Plain Layout
+
+		if mnemonic == 'ds':
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address + first argument
+\end_layout
+
+\begin_layout Plain Layout
+
+            next line
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		for argument in arguments:
+\end_layout
+
+\begin_layout Plain Layout
+
+			if argument is a label:
+\end_layout
+
+\begin_layout Plain Layout
+
+				replace argument with address at label
+\end_layout
+
+\begin_layout Plain Layout
+
+				symbol, data = tokenize(argument)
+\end_layout
+
+\begin_layout Plain Layout
+
+				append data to constant
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		op, width = instruction index[mnemonic][symbol]
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+		write op to file
+\end_layout
+
+\begin_layout Plain Layout
+
+\end_layout
+
+\begin_layout Plain Layout
+
+		if width of constant - width + 1 > 0:
+\end_layout
+
+\begin_layout Plain Layout
+
+			raise error
+\end_layout
+
+\begin_layout Plain Layout
+
+		else if:
+\end_layout
+
+\begin_layout Plain Layout
+
+			write constant to file
+\end_layout
+
+\begin_layout Plain Layout
+
+			address = address.+ width
+\end_layout
+
+\begin_layout Plain Layout
+
+	
+\end_layout
+
+\begin_layout Plain Layout
+
+	return file
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsubsection
+tokenize
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/asm/tokenize.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Assembler Testing
+\end_layout
+
+\end_body
+\end_document
--- a/docs/lyx/dbg.lyx	Fri Apr 18 20:07:19 2014 +0100
+++ b/docs/lyx/dbg.lyx	Mon Apr 21 19:37:21 2014 +0100
@@ -67,12 +67,657 @@
 Design
 \end_layout
 
+\begin_layout Standard
+The debugger is designed to issue commands to and receive data from an instant
+ of the emulator running either as a process or on a micro-controller.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/dbg/debugger_overview.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The debugger will implement the protocol described under the Emulator Design
+ section of this report.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
 \begin_layout Section
 Implementation
 \end_layout
 
+\begin_layout Subsection
+dbg.py
+\end_layout
+
+\begin_layout Standard
+The debugger has been implemented as a Python class with the following functions
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="17" columns="3">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="left" valignment="top" width="2cm">
+<column alignment="center" valignment="top" width="7cm">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Function
+\end_layout
+
+\end_inset
+</cell>
+<cell multicolumn="1" alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Arguments
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Description
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+snd
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+byte
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+send a byte to the emulator via a serial or file buffer
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+rcv
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+length
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+receive length number of bytes from a serial or file buffer
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+step
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Execute instruction at PC
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+run
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Execute instructions from PC until a break point is reached
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_reg
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register address, value
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set a register (register address between 0 and 16 as described under Memory
+ Design in the Emulator Design section)
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_reg
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register address
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of a register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+flag bit, 0 or 1
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Turn a flag bit on or off.
+ LSB = 0, MSB =7
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+flag bit
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of a flag bit
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_block
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+address high, address low, length high, length low, [byte array]
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set a block of memory of arbitrary length with the bytes in the byte array
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_block
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+address high, address low, length high, length low
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Read a block of memory of arbitrary length 
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_a
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get value of A
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_flags
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get value of flags
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_ir
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get Value of IR
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+run_len
+\end_layout
+
+\end_inset
+</cell>
+<cell multirow="3" alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+length high, length low
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Run for length number of instruction
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+free_run
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Run forever - Bypass controller
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_bp
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+break point index, address high, address low
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set 1 of 8 possible break points
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The class also has the attribute 'Emu' which can be set to point the debugger
+ at either an emulator process or a serial port.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The rcv function needs to check that the emulator's output buffer is the
+ correct length before returning the data to the user.
+ Below is a pseudo-code representation of how this is achieved.
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},captionpos=b,frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+rcv ( length ):
+\end_layout
+
+\begin_layout Plain Layout
+
+	while output buffer size != length:
+\end_layout
+
+\begin_layout Plain Layout
+
+		wait
+\end_layout
+
+\begin_layout Plain Layout
+
+	return output buffer
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+cli.py
+\end_layout
+
 \begin_layout Section
-Testing
+Debugger Testing
 \end_layout
 
 \end_body
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/lyx/dbg.lyx~	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,724 @@
+#LyX 2.0 created this file. For more info see http://www.lyx.org/
+\lyxformat 413
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_amsmath 1
+\use_esint 1
+\use_mhchem 1
+\use_mathdots 1
+\cite_engine basic
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Part
+The Debugger
+\end_layout
+
+\begin_layout Section
+Design
+\end_layout
+
+\begin_layout Standard
+The debugger is designed to issue commands to and receive data from an instant
+ of the emulator running either as a process or on a micro-controller.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/dbg/debugger_overview.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The debugger will implement the protocol described under the Emulator Design
+ section of this report.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Implementation
+\end_layout
+
+\begin_layout Subsection
+dbg.py
+\end_layout
+
+\begin_layout Standard
+The debugger has been implemented as a Python class with the following functions
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="17" columns="3">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="left" valignment="top" width="2cm">
+<column alignment="center" valignment="top" width="7cm">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Function
+\end_layout
+
+\end_inset
+</cell>
+<cell multicolumn="1" alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Arguments
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Description
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+snd
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+byte
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+send a byte to the emulator via a serial or file buffer
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+rcv
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+length
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+receive length number of bytes from a serial or file buffer
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+step
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Execute instruction at PC
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+run
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Execute instructions from PC until a break point is reached
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_reg
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register address, value
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set a register (register address between 0 and 16 as described under Memory
+ Design in the Emulator Design section)
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_reg
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register address
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of a register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+flag bit, 0 or 1
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Turn a flag bit on or off.
+ LSB = 0, MSB =7
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+flag bit
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of a flag bit
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_block
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+address high, address low, length high, length low, [byte array]
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set a block of memory of arbitrary length with the bytes in the byte array
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_block
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+address high, address low, length high, length low
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Read a block of memory of arbitrary length 
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_a
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get value of A
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_flags
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get value of flags
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_ir
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get Value of IR
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+run_len
+\end_layout
+
+\end_inset
+</cell>
+<cell multirow="3" alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+length high, length low
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Run for length number of instruction
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+free_run
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Run forever - Bypass controller
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_bp
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+break point index, address high, address low
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set 1 of 8 possible break points
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The class also has the attribute 'Emu' which can be set to change between
+ serial and file mode for the snd and rcv functions.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The rcv function needs to check that the emulator's output buffer is the
+ correct length before returning the data to the user.
+ Below is a pseudo-code representation of how this is achieved.
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},captionpos=b,frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+rcv ( length ):
+\end_layout
+
+\begin_layout Plain Layout
+
+	while output buffer size != length:
+\end_layout
+
+\begin_layout Plain Layout
+
+		wait
+\end_layout
+
+\begin_layout Plain Layout
+
+	return output buffer
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+cli.py
+\end_layout
+
+\begin_layout Section
+Debugger Testing
+\end_layout
+
+\end_body
+\end_document
--- a/docs/lyx/ede.lyx	Fri Apr 18 20:07:19 2014 +0100
+++ b/docs/lyx/ede.lyx	Mon Apr 21 19:37:21 2014 +0100
@@ -67,12 +67,134 @@
 EDE Overview
 \end_layout
 
-\begin_layout Section
-EDE Interfaces
+\begin_layout Standard
+EDE is a software implementation of the ELB816 micro-processor along with
+ a basic tool chain to develop and debug code for it.
+ The block diagram below depicts the system that this project aims to implement.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/ede/system_overview.svg
+	display false
+
+\end_inset
+
+
 \end_layout
 
 \begin_layout Section
-EDE Improvements
+EDE Use Cases
+\end_layout
+
+\begin_layout Standard
+EDE is highly modular.
+ Each it's components, with the exception of the UI, is written as a stand
+ alone programs and works independently.
+ Because of this design strategy EDE can be used in a number of different
+ ways.
+ This section details the use cases experimented with so far.
+\end_layout
+
+\begin_layout Subsection
+Assemble/Upload/Execute/Debug
+\end_layout
+
+\begin_layout Standard
+Using the tool chain in this manner is analogous to programming and run-time
+ debugging a real-world micro-controller.
+ Source code is assembled and written into the emulator's memory.
+ The user can then use the debug prompt to step through program and probe
+ the emulator internals.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/ede/aued.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Interpreter Mode
+\end_layout
+
+\begin_layout Standard
+Source code does not have to be pre-assembled.
+ Since the command-line interface, the assembler and the debugger are all
+ written in python, the assembler's functions can be imported into the interface
+ code.
+ This has been done to create a mode where the user enters assembly code
+ at a prompt, and then that code is immediately assembled and executed on
+ an instance of the emulator.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/ede/interpreter.svg
+	display false
+
+\end_inset
+
+
 \end_layout
 
 \end_body
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/lyx/ede.lyx~	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,170 @@
+#LyX 2.0 created this file. For more info see http://www.lyx.org/
+\lyxformat 413
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_amsmath 1
+\use_esint 1
+\use_mhchem 1
+\use_mathdots 1
+\cite_engine basic
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Part
+The ELB816 Development Environment
+\end_layout
+
+\begin_layout Section
+EDE Overview
+\end_layout
+
+\begin_layout Standard
+EDE is a software implementation of the ELB816 micro-processor along with
+ a basic tool chain to develop and debug code for it.
+ The block diagram below depicts the system that this project aims to implement.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/ede/system_overview.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+EDE Use Cases
+\end_layout
+
+\begin_layout Standard
+EDE is highly modular.
+ Each it's components, with the exception of the UI, is written as a stand
+ alone programs and works independently.
+ Because of this design strategy EDE can be used in a number of different
+ ways.
+ This section details the use cases experimented with so far.
+\end_layout
+
+\begin_layout Subsection
+Assemble/Upload/Execute/Debug
+\end_layout
+
+\begin_layout Standard
+Using the tool chain in this manner is analogous to programming and run-time
+ debugging a real-world micro-controller.
+ Source code is assembled and the written into the emulator's memory, the
+ user can then use the debug prompt to step through program and probe the
+ emulator internals.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/ede/aued.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_body
+\end_document
--- a/docs/lyx/emu.lyx	Fri Apr 18 20:07:19 2014 +0100
+++ b/docs/lyx/emu.lyx	Mon Apr 21 19:37:21 2014 +0100
@@ -1852,7 +1852,12 @@
 
 \begin_layout Plain Layout
 
-	get instruction from IR
+	get PC
+\end_layout
+
+\begin_layout Plain Layout
+
+	IR = byte in memory at PC
 \end_layout
 
 \begin_layout Plain Layout
@@ -1862,6 +1867,11 @@
 
 \begin_layout Plain Layout
 
+	end
+\end_layout
+
+\begin_layout Plain Layout
+
 \end_layout
 
 \begin_layout Plain Layout
@@ -1871,22 +1881,7 @@
 
 \begin_layout Plain Layout
 
-	get PC
-\end_layout
-
-\begin_layout Plain Layout
-
-	if PC is a break point:
-\end_layout
-
-\begin_layout Plain Layout
-
-		end
-\end_layout
-
-\begin_layout Plain Layout
-
-	else:
+	while PC is not a break point:
 \end_layout
 
 \begin_layout Plain Layout
@@ -1896,6 +1891,11 @@
 
 \begin_layout Plain Layout
 
+	end
+\end_layout
+
+\begin_layout Plain Layout
+
 \end_layout
 
 \begin_layout Plain Layout
@@ -1910,12 +1910,7 @@
 
 \begin_layout Plain Layout
 
-	get PC
-\end_layout
-
-\begin_layout Plain Layout
-
-	while (counter + PC) != length:
+	while counter != length:
 \end_layout
 
 \begin_layout Plain Layout
@@ -1925,11 +1920,6 @@
 
 \begin_layout Plain Layout
 
-	end
-\end_layout
-
-\begin_layout Plain Layout
-
 \end_layout
 
 \begin_layout Plain Layout
@@ -1990,7 +1980,7 @@
 <lyxtabular version="3" rows="6" columns="2">
 <features tabularvalignment="middle">
 <column alignment="center" valignment="top" width="0">
-<column alignment="left" valignment="top" width="10cm">
+<column alignment="left" valignment="top" width="8cm">
 <row>
 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
 \begin_inset Text
@@ -2046,7 +2036,7 @@
 
 \begin_layout Plain Layout
 Declares a function for each mnemonic in the instruction set.
- Declares a 256 byte instruction table
+ Declares a 256 byte function pointer table
 \end_layout
 
 \end_inset
@@ -2141,6 +2131,1478 @@
 \end_layout
 
 \begin_layout Standard
+In this file the 256 byte instruction table is filled with pointers to the
+ functions in iset.c.
+ This file also contains the control interface function and execution control
+ functions.
+ None of these functions take any arguments or return any data.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Below is a list of the functions that appear in this file.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="7" columns="2">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="left" valignment="top" width="8cm">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Function
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Description
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+snd
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Puts a character into the serial or file output buffer
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+rcv
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get a character from the serial or file input buffer
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+step
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Execute the instruction pointed to by PC
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+run
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Execute instructions until a break point is reached
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+controller
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get character from input buffer and deal with accordingly
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+main
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Make sure free run isn't enabled at boot, call controller function forever
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Below is the format of the instruction pointer table initialized in this
+ file.
+ Each item in the table is a pointer to a function.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+According to the program Cdecl, in 
+\begin_inset Quotes eld
+\end_inset
+
+human language
+\begin_inset Quotes erd
+\end_inset
+
+, it's declaration is: 
+\begin_inset Quotes eld
+\end_inset
+
+declare ops as array 256 of pointer to function (void) returning void
+\begin_inset Quotes erd
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The number of the pointers position in the table is the opcode for the instructi
+on that the function being pointed to deals with.
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+void (*ops[256])(void) = {
+\end_layout
+
+\begin_layout Plain Layout
+
+    NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP,
+\end_layout
+
+\begin_layout Plain Layout
+
+    SET, CLR, SET, CLR, SET, CLR, CPL, CPL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    XCSD, SFA, LAF, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    ANL, ANL, ANL, ANL, ANL, ANL, ANL, ANL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    XRL, XRL, XRL, XRL, XRL, XRL, XRL, XRL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    RL, RLC, RR, RRC, INC, DEC, INC, DEC,
+\end_layout
+
+\begin_layout Plain Layout
+
+    ADD, ADD, ADD, ADD, ADD, ADD, ADD, ADD,
+\end_layout
+
+\begin_layout Plain Layout
+
+    ADDC, ADDC, ADDC, ADDC, ADDC, ADDC, ADDC, ADDC,
+\end_layout
+
+\begin_layout Plain Layout
+
+    SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB,
+\end_layout
+
+\begin_layout Plain Layout
+
+    SUBB, SUBB, SUBB, SUBB, SUBB, SUBB, SUBB, SUBB,
+\end_layout
+
+\begin_layout Plain Layout
+
+    PJMP, PJMP, PJMP, PJMP, PJMP, PJMP, PJMP, PJMP,
+\end_layout
+
+\begin_layout Plain Layout
+
+    PCALL, PCALL, PCALL, PCALL, PCALL, PCALL, PCALL, PCALL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    DJNZ, DJNZ, DJNZ, DJNZ, CJNE, CJNE, CJNE, CJNE,
+\end_layout
+
+\begin_layout Plain Layout
+
+    LJMP, LCALL, RET, RETI, SJMP, JMP, JMP, CJNE,
+\end_layout
+
+\begin_layout Plain Layout
+
+    JZ, JNZ, JC, JNC, JPO, JPE, JS, JNS,
+\end_layout
+
+\begin_layout Plain Layout
+
+    PUSH, PUSH, PUSH, PUSH, PUSH, PUSH, PUSH, PUSH,
+\end_layout
+
+\begin_layout Plain Layout
+
+    POP, POP, POP, POP, POP, POP, POP, POP,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MUL, DIV, DA, NOP, IN, OUT, INT, HLT
+\end_layout
+
+\begin_layout Plain Layout
+
+};
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+iset.c/h
+\end_layout
+
+\begin_layout Standard
+For every mnemonic in the ELB816 instruction set there is a function in
+ these files.
+ These are the functions that are pointed to in the instruction table that
+ is filled in main.c.
+ The functions behave according to their description in the ELB816 specification.
+\end_layout
+
+\begin_layout Subsection
+mem.c/h
+\end_layout
+
+\begin_layout Standard
+In mem.h the memory structure of the emulator is defined in accordance with
+ how it was described in the previous section.
+ mem.c contains the following functions to facilitate access to this memory.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="11" columns="4">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="left" valignment="top" width="6cm">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Function
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Arguments
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Returns
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Description
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+1 byte
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of a flag (can be 0 or 1)
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+flag, on
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set a flag to 0 if on == 0, else set flag to 1
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_zp
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+value
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set zero and parity flags based on value
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_wide
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+2 bytes
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of a 16-bit register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_wide
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register, value
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set the value of a 16-bit register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+inc_pc
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+n
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Increment the PC by n
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+fetch
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+1 byte
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+return the byte in memory at PC, increment PC
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+fetch_wide
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+2 bytes
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+return the 2 bytes in memory at PC, increment PC by 2
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_reg
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+1 byte
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of an 8-bit register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_reg
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register, value
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set the value of an 8-bit register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The various register access functions use different register encoding schemes.
+ These are in the tables below.
+\end_layout
+
+\begin_layout Itemize
+get_wide/set_wide 
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="5" columns="2">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Register
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Encoding
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+DPTR
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+00
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+SP
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+01
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+PC
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+10
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+TMPA
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+11
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+get_reg/set_reg - These values correspond to the way registers are encoded
+ into the last 3-bits of many of the ELB816 instructions.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="9" columns="2">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Register
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Encoding
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+R0
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+000
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+R1
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+001
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+R2
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+010
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+R3
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+011
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+DPH
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+100
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+DPL
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+101
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+SPH
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+110
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+SPL
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+111
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Porting to Intel MCS-51
+\end_layout
+
+\begin_layout Standard
+In order make this code compile for an 8052 using Keil C51 a few changes
+ to were needed.
+ These are detailed below.
+\end_layout
+
+\begin_layout Subsection
+main.c
+\end_layout
+
+\begin_layout Standard
+In the PC version of the emulator, the function table is declared as:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+FUNCTION_TABLE const iset 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Since the instruction set is 256 bytes long and the 8052 only has 256 bytes
+ of internal RAM, this data structure must be redeclared to exist in code
+ memory space.
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+FUNCTION_TABLE const code iset
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The PC version of the emulator uses a file buffer to communicate with the
+ debugger.
+ On the 8052 communication uses a serial interface.
+ Because of this the snd() functions differ.
+\end_layout
+
+\begin_layout Standard
+On the PC
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+snd(BYTE c) {
+\end_layout
+
+\begin_layout Plain Layout
+
+    fp = fopen("out", "a");
+\end_layout
+
+\begin_layout Plain Layout
+
+    fputc(c, fp);
+\end_layout
+
+\begin_layout Plain Layout
+
+    fclose(fp);
+\end_layout
+
+\begin_layout Plain Layout
+
+}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Becomes on the 8052, simply:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+snd(BYTE c) { 
+\end_layout
+
+\begin_layout Plain Layout
+
+    putchar(c); 
+\end_layout
+
+\begin_layout Plain Layout
+
+} 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The 8052's serial point also needs to be configures at the start of main
+ execution like this:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+SCON  = 0x50;     * SCON - mode 1, 8-bit UART, enable rcvr 
+\end_layout
+
+\begin_layout Plain Layout
+
+TMOD |= 0x20;     * TMOD - timer 1, mode 2, 8-bit reload 
+\end_layout
+
+\begin_layout Plain Layout
+
+TH1   = 0xE8;     * TH1 - reload value for 1200 baud @ 12MHz 
+\end_layout
+
+\begin_layout Plain Layout
+
+TR1   = 1;        * TR1 - timer 1 run 
+\end_layout
+
+\begin_layout Plain Layout
+
+TI    = 1;        * TI - set TI to send first char of UART */ 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+mem.h
+\end_layout
+
+\begin_layout Standard
+The 8052 development board available during this project had 32K of external
+ RAM available.
+ This meant the size of the emulators Von Neumann memory space had to be
+ halved and declared to exist in external data memory.
+\end_layout
+
+\begin_layout Standard
+On the PC:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+BYTE mem[0x10000]; 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+On the 8052
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+BYTE xdata mem[0x8000]; 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
 
 \end_layout
 
--- a/docs/lyx/emu.lyx~	Fri Apr 18 20:07:19 2014 +0100
+++ b/docs/lyx/emu.lyx~	Mon Apr 21 19:37:21 2014 +0100
@@ -1852,7 +1852,12 @@
 
 \begin_layout Plain Layout
 
-	get instruction from IR
+	get PC
+\end_layout
+
+\begin_layout Plain Layout
+
+	IR = byte in memory at PC
 \end_layout
 
 \begin_layout Plain Layout
@@ -1862,6 +1867,11 @@
 
 \begin_layout Plain Layout
 
+	end
+\end_layout
+
+\begin_layout Plain Layout
+
 \end_layout
 
 \begin_layout Plain Layout
@@ -1910,12 +1920,7 @@
 
 \begin_layout Plain Layout
 
-	get PC
-\end_layout
-
-\begin_layout Plain Layout
-
-	while (counter + PC) != length:
+	while counter != length:
 \end_layout
 
 \begin_layout Plain Layout
@@ -1925,11 +1930,6 @@
 
 \begin_layout Plain Layout
 
-	end
-\end_layout
-
-\begin_layout Plain Layout
-
 \end_layout
 
 \begin_layout Plain Layout
@@ -1990,7 +1990,7 @@
 <lyxtabular version="3" rows="6" columns="2">
 <features tabularvalignment="middle">
 <column alignment="center" valignment="top" width="0">
-<column alignment="left" valignment="top" width="10cm">
+<column alignment="left" valignment="top" width="8cm">
 <row>
 <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
 \begin_inset Text
@@ -2046,7 +2046,7 @@
 
 \begin_layout Plain Layout
 Declares a function for each mnemonic in the instruction set.
- Declares a 256 byte instruction table
+ Declares a 256 byte function pointer table
 \end_layout
 
 \end_inset
@@ -2120,6 +2120,1502 @@
 
 \end_layout
 
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+main.c
+\end_layout
+
+\begin_layout Standard
+In this file the 256 byte instruction table is filled with pointers to the
+ functions in iset.c.
+ This file also contains the control interface function and execution control
+ functions.
+ None of these functions take any arguments or return any data.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Below is a list of the functions that appear in this file.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="7" columns="2">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="left" valignment="top" width="8cm">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Function
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Description
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+snd
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Puts a character into the serial or file output buffer
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+rcv
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get a character from the serial or file input buffer
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+step
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Execute the instruction pointed to by PC
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+run
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Execute instructions until a break point is reached
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+controller
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get character from input buffer and deal with accordingly
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+main
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Make sure free run isn't enabled at boot, call controller function forever
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Below is the format of the instruction pointer table initialized in this
+ file.
+ Each item in the table is a pointer to a function.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+According to the program Cdecl, in 
+\begin_inset Quotes eld
+\end_inset
+
+human language
+\begin_inset Quotes erd
+\end_inset
+
+, it's declaration is: 
+\begin_inset Quotes eld
+\end_inset
+
+declare ops as array 256 of pointer to function (void) returning void
+\begin_inset Quotes erd
+\end_inset
+
+.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The number of the pointers position in the table is the opcode for the instructi
+on that the function being pointed to deals with.
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+void (*ops[256])(void) = {
+\end_layout
+
+\begin_layout Plain Layout
+
+    NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP,
+\end_layout
+
+\begin_layout Plain Layout
+
+    SET, CLR, SET, CLR, SET, CLR, CPL, CPL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    XCSD, SFA, LAF, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+\end_layout
+
+\begin_layout Plain Layout
+
+    ANL, ANL, ANL, ANL, ANL, ANL, ANL, ANL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    XRL, XRL, XRL, XRL, XRL, XRL, XRL, XRL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    RL, RLC, RR, RRC, INC, DEC, INC, DEC,
+\end_layout
+
+\begin_layout Plain Layout
+
+    ADD, ADD, ADD, ADD, ADD, ADD, ADD, ADD,
+\end_layout
+
+\begin_layout Plain Layout
+
+    ADDC, ADDC, ADDC, ADDC, ADDC, ADDC, ADDC, ADDC,
+\end_layout
+
+\begin_layout Plain Layout
+
+    SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB,
+\end_layout
+
+\begin_layout Plain Layout
+
+    SUBB, SUBB, SUBB, SUBB, SUBB, SUBB, SUBB, SUBB,
+\end_layout
+
+\begin_layout Plain Layout
+
+    PJMP, PJMP, PJMP, PJMP, PJMP, PJMP, PJMP, PJMP,
+\end_layout
+
+\begin_layout Plain Layout
+
+    PCALL, PCALL, PCALL, PCALL, PCALL, PCALL, PCALL, PCALL,
+\end_layout
+
+\begin_layout Plain Layout
+
+    DJNZ, DJNZ, DJNZ, DJNZ, CJNE, CJNE, CJNE, CJNE,
+\end_layout
+
+\begin_layout Plain Layout
+
+    LJMP, LCALL, RET, RETI, SJMP, JMP, JMP, CJNE,
+\end_layout
+
+\begin_layout Plain Layout
+
+    JZ, JNZ, JC, JNC, JPO, JPE, JS, JNS,
+\end_layout
+
+\begin_layout Plain Layout
+
+    PUSH, PUSH, PUSH, PUSH, PUSH, PUSH, PUSH, PUSH,
+\end_layout
+
+\begin_layout Plain Layout
+
+    POP, POP, POP, POP, POP, POP, POP, POP,
+\end_layout
+
+\begin_layout Plain Layout
+
+    MUL, DIV, DA, NOP, IN, OUT, INT, HLT
+\end_layout
+
+\begin_layout Plain Layout
+
+};
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+iset.c/h
+\end_layout
+
+\begin_layout Standard
+For every mnemonic in the ELB816 instruction set there is a function in
+ these files.
+ These are the functions that are pointed to in the instruction table that
+ is filled in main.c.
+ The functions behave according to their description in the ELB816 specification.
+\end_layout
+
+\begin_layout Subsection
+mem.c/h
+\end_layout
+
+\begin_layout Standard
+In mem.h the memory structure of the emulator is defined in accordance with
+ how it was described in the previous section.
+ mem.c contains the following functions to facilitate access to this memory.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="11" columns="4">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<column alignment="left" valignment="top" width="6cm">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Function
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Arguments
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Returns
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Description
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+1 byte
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of a flag (can be 0 or 1)
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_flag
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+flag, on
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set a flag to 0 if on == 0, else set flag to 1
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_zp
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+value
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set zero and parity flags based on value
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_wide
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+2 bytes
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of a 16-bit register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_wide
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register, value
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set the value of a 16-bit register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+inc_pc
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+n
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Increment the PC by n
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+fetch
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+1 byte
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+return the byte in memory at PC, increment PC
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+fetch_wide
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+2 bytes
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+return the 2 bytes in memory at PC, increment PC by 2
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+get_reg
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+1 byte
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Get the value of an 8-bit register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+set_reg
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+register, value
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+-
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="left" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Set the value of an 8-bit register
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The various register access functions use different register encoding schemes.
+ These are in the tables below.
+\end_layout
+
+\begin_layout Itemize
+get_wide/set_wide 
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="5" columns="2">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Register
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Encoding
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+DPTR
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+00
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+SP
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+01
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+PC
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+10
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+TMPA
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+11
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+get_reg/set_reg - These values correspond to the way registers are encoded
+ into the last 3-bits of many of the ELB816 instructions.
+\end_layout
+
+\begin_layout Standard
+\begin_inset Tabular
+<lyxtabular version="3" rows="9" columns="2">
+<features tabularvalignment="middle">
+<column alignment="center" valignment="top" width="0">
+<column alignment="center" valignment="top" width="0">
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Register
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+Encoding
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+R0
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+000
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+R1
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+001
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+R2
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+010
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+R3
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+011
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+DPH
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+100
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+DPL
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+101
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+SPH
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+110
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+SPL
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Plain Layout
+111
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Porting to Intel MCS-51
+\end_layout
+
+\begin_layout Standard
+In order make this code compile for an 8052 using Keil C51 a few changes
+ to were needed.
+ These are detailed below.
+\end_layout
+
+\begin_layout Subsection
+main.c
+\end_layout
+
+\begin_layout Standard
+In the PC version of the emulator, the function table is declared as:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+FUNCTION_TABLE const iset 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Since the instruction set is 256 bytes long and the 8052 only has 256 bytes
+ of internal RAM, this data structure must be redeclared to exist in code
+ memory space.
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+FUNCTION_TABLE const code iset
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The PC version of the emulator uses a file buffer to communicate with the
+ debugger.
+ On the 8052 communication uses a serial interface.
+ Because of this the snd() functions differ.
+\end_layout
+
+\begin_layout Standard
+On the PC
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+snd(BYTE c) {
+\end_layout
+
+\begin_layout Plain Layout
+
+    fp = fopen("out", "a");
+\end_layout
+
+\begin_layout Plain Layout
+
+    fputc(c, fp);
+\end_layout
+
+\begin_layout Plain Layout
+
+    fclose(fp);
+\end_layout
+
+\begin_layout Plain Layout
+
+}
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Becomes on the 8052, simply:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+snd(BYTE c) { 
+\end_layout
+
+\begin_layout Plain Layout
+
+    putchar(c); 
+\end_layout
+
+\begin_layout Plain Layout
+
+} 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+The 8052's serial point also needs to be configures at the start of main
+ execution like this:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+SCON  = 0x50;     * SCON - mode 1, 8-bit UART, enable rcvr 
+\end_layout
+
+\begin_layout Plain Layout
+
+TMOD |= 0x20;     * TMOD - timer 1, mode 2, 8-bit reload 
+\end_layout
+
+\begin_layout Plain Layout
+
+TH1   = 0xE8;     * TH1 - reload value for 1200 baud @ 12MHz 
+\end_layout
+
+\begin_layout Plain Layout
+
+TR1   = 1;        * TR1 - timer 1 run 
+\end_layout
+
+\begin_layout Plain Layout
+
+TI    = 1;        * TI - set TI to send first char of UART */ 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+mem.h
+\end_layout
+
+\begin_layout Standard
+The 8052 development board available during this project had 32K of external
+ RAM available.
+ This meant the size of the emulators Von Neumann memory space had to be
+ halved and declared to exist in external data memory.
+\end_layout
+
+\begin_layout Standard
+On the PC:
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+BYTE mem[0x10000]; 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+On the 8052
+\end_layout
+
+\begin_layout Standard
+\begin_inset listings
+lstparams "basicstyle={\ttfamily},language=C"
+inline false
+status open
+
+\begin_layout Plain Layout
+
+BYTE xdata mem[0x8000]; 
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
 \begin_layout Section
 Emulator Testing
 \end_layout
--- a/docs/lyx/final_report.lyx	Fri Apr 18 20:07:19 2014 +0100
+++ b/docs/lyx/final_report.lyx	Mon Apr 21 19:37:21 2014 +0100
@@ -77,6 +77,22 @@
 \end_layout
 
 \begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset CommandInset toc
+LatexCommand tableofcontents
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
 \begin_inset CommandInset include
 LatexCommand include
 filename "intro.lyx"
@@ -89,6 +105,16 @@
 \begin_layout Standard
 \begin_inset CommandInset include
 LatexCommand include
+filename "ede.lyx"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset CommandInset include
+LatexCommand include
 filename "asm.lyx"
 
 \end_inset
@@ -119,7 +145,17 @@
 \begin_layout Standard
 \begin_inset CommandInset include
 LatexCommand include
-filename "ede.lyx"
+filename "review.lyx"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset CommandInset include
+LatexCommand include
+filename "appendix.lyx"
 
 \end_inset
 
--- a/docs/lyx/final_report.lyx~	Fri Apr 18 20:07:19 2014 +0100
+++ b/docs/lyx/final_report.lyx~	Mon Apr 21 19:37:21 2014 +0100
@@ -3,6 +3,14 @@
 \begin_document
 \begin_header
 \textclass article
+\begin_preamble
+\usepackage[export]{adjustbox}% http://ctan.org/pkg/adjustbox
+% Resize figures that are too wide for the page.
+\let\oldincludegraphics\includegraphics
+\renewcommand\includegraphics[2][]{%
+  \oldincludegraphics[#1,max width=\linewidth,max height=\textheight]{#2}
+}
+\end_preamble
 \use_default_options true
 \maintain_unincluded_children false
 \language english
@@ -25,6 +33,7 @@
 \bibtex_command default
 \index_command default
 \paperfontsize default
+\spacing single
 \use_hyperref false
 \papersize default
 \use_geometry false
@@ -68,6 +77,22 @@
 \end_layout
 
 \begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset CommandInset toc
+LatexCommand tableofcontents
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
 \begin_inset CommandInset include
 LatexCommand include
 filename "intro.lyx"
@@ -117,5 +142,25 @@
 
 \end_layout
 
+\begin_layout Standard
+\begin_inset CommandInset include
+LatexCommand include
+filename "review.lyx"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset CommandInset include
+LatexCommand include
+filename "appendix.lyx"
+
+\end_inset
+
+
+\end_layout
+
 \end_body
 \end_document
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/lyx/review.lyx	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,139 @@
+#LyX 2.0 created this file. For more info see http://www.lyx.org/
+\lyxformat 413
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_amsmath 1
+\use_esint 1
+\use_mhchem 1
+\use_mathdots 1
+\cite_engine basic
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Part
+Review and Improvements
+\end_layout
+
+\begin_layout Standard
+The diagram below shows an overview of the goal of this project with the
+ completed components and interfaces highlighted in green.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/ede/state_of_ede.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Newpage pagebreak
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Strategy for the completion of EDE
+\end_layout
+
+\begin_layout Enumerate
+Complete debugger interface code.
+\end_layout
+
+\begin_deeper
+\begin_layout Enumerate
+Both the PC and 8052 versions have fully implemented control interface functions.
+ However the Python debug class can currently only interact with a file
+ buffer for I/O.
+ The debuggers send and receive functions need to be modified to deal with
+ 
+\end_layout
+
+\end_deeper
+\end_body
+\end_document
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/lyx/review.lyx~	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,118 @@
+#LyX 2.0 created this file. For more info see http://www.lyx.org/
+\lyxformat 413
+\begin_document
+\begin_header
+\textclass article
+\use_default_options true
+\maintain_unincluded_children false
+\language english
+\language_package default
+\inputencoding auto
+\fontencoding global
+\font_roman default
+\font_sans default
+\font_typewriter default
+\font_default_family default
+\use_non_tex_fonts false
+\font_sc false
+\font_osf false
+\font_sf_scale 100
+\font_tt_scale 100
+
+\graphics default
+\default_output_format default
+\output_sync 0
+\bibtex_command default
+\index_command default
+\paperfontsize default
+\use_hyperref false
+\papersize default
+\use_geometry false
+\use_amsmath 1
+\use_esint 1
+\use_mhchem 1
+\use_mathdots 1
+\cite_engine basic
+\use_bibtopic false
+\use_indices false
+\paperorientation portrait
+\suppress_date false
+\use_refstyle 1
+\index Index
+\shortcut idx
+\color #008000
+\end_index
+\secnumdepth 3
+\tocdepth 3
+\paragraph_separation indent
+\paragraph_indentation default
+\quotes_language english
+\papercolumns 1
+\papersides 1
+\paperpagestyle default
+\tracking_changes false
+\output_changes false
+\html_math_output 0
+\html_css_as_file 0
+\html_be_strict false
+\end_header
+
+\begin_body
+
+\begin_layout Part
+Review and Improvements
+\end_layout
+
+\begin_layout Standard
+The diagram below shows an overview of the goal of this project with the
+ completed components and interfaces highlighted in green.
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset Graphics
+	filename /home/jmz/qm/ede/docs/img/ede/state_of_ede.svg
+	display false
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+bigskip
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Section
+Strategy for the completion of EDE
+\end_layout
+
+\end_body
+\end_document
Binary file emu/.mem.h.swp has changed
--- a/emu/main.c	Fri Apr 18 20:07:19 2014 +0100
+++ b/emu/main.c	Mon Apr 21 19:37:21 2014 +0100
@@ -180,11 +180,7 @@
                 case 0x0B:
                     args[0] = rcv(); /* length high */
                     args[1] = rcv(); /* length low */
-                    tmpw = get_wide(PC);
-                    for (ac = tmpw ; ac < tmpw + MWIDE(args[0], args[1]) ; ac++) {
-                        if (ac == 0xFFFF) {
-                            break;
-                        }
+                    for (tmpw = 0 ; tmpw < MWIDE(args[0], args[1]) ; tmpw++) {
                         step();
                     }
                     break;
--- a/emu52/iset.c	Fri Apr 18 20:07:19 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,937 +0,0 @@
-/* iset.c
- * IR functions */
-#include "iset.h"
-#include "mem.h"
-
-/* useful macros */
-#define NNN (IR & 0x07)
-#define MMM ((IR & 0x38) >> 3)
-
-/* 0x00 - NOP */
-void
-NOP(void) {    
-}
-
-/* 0x08 - SET C
- * 0x0A - SET BS
- * 0x0C - SET IE */
-void
-SET(void) {
-    switch (IR) {
-        
-        case 0x08:
-            set_flag(C, 0x01);
-            break;
-        
-        case 0x0A:
-            set_flag(BS, 0x01);
-            break;
-        
-        case 0x0C:
-            set_flag(IE, 0x01);
-            break;
-        
-        default:
-            break;
-    }
-}
-
-/* 0x09 - CLR C
- * 0x0B - CLR BS
- * 0x0D - CLR IE */
-void
-CLR(void) {
-    switch (IR) {
-        
-        case 0x09:
-            set_flag(C, 0x00);
-            break;
-        
-        case 0x0B:
-            set_flag(BS, 0x00);
-            break;
-        
-        case 0x0D:
-            set_flag(IE, 0x00);
-            break;
-        
-        default:
-            break;
-    }    
-}
-
-/* 0x0E - CPL C
- * 0x0F - CPL A */
-void
-CPL(void) {
-    switch (IR) {
-        
-        case 0x0E:
-            if (get_flag(C) == 0) {
-                set_flag(C, 0x01);
-            }
-            else {
-                set_flag(C, 0x00);
-            }
-        
-        case 0x0F:
-            A = ~A;
-            break;
-        
-        default:
-            break;
-    }
-}
-
-/* 0x10 - XCSD */
-void
-XCSD(void) {
-    tmpw = get_wide(SP);
-    set_wide(SP, get_wide(DPTR));
-    set_wide(DPTR, tmpw);
-}
-
-/* 0x11 - SFA */
-void
-SFA(void) {
-    A = flags;
-}
-
-/* 0x12 - LAF */
-void
-LAF(void) {
-    flags = A;   
-}
-
-/* 0b00010XXX - special MOVs
- * 0b00011XXX - direct, indirect and indexed MOVs
- * 0b00100nnn - register-indirect MOVs - MOV @DPTR, Rn
- * 0b00101nnn - immediate movs - MOV Rn, #data8
- * 0b00110nnn - MOV Rn, A
- * 0b00111nnn - MOV A, Rn
- * 0b01mmmnnn - 64 register move instructions
- *
- * this is a mess */
-void
-MOV(void) {
-    switch (IR & 0x40) {
-       
-        case 0x00:
-            switch (IR & 0xF8) {
-                
-                /* 0b00010XXX - special MOVs*/
-                case 0x10:
-                    switch (NNN) {
-                        
-                        /* MOV DPTR, SP */
-                        case 3:
-                            set_wide(DPTR, get_wide(SP));
-                            break;
-                        
-                        /* MOV SP, DPTR */
-                        case 4:
-                            set_wide(SP, get_wide(DPTR));
-                            break;
-                        
-                        /* MOV A, #data8 */
-                        case 5:
-                            A = fetch();
-                            break;
-                        
-                        /* MOV SP, #data16 */
-                        case 6:
-                            set_wide(SP, fetch_wide());
-                            break;
-                        
-                        /* MOV DPTR, #data16 */
-                        case 7:
-                            set_wide(DPTR, fetch_wide());
-                            break;
-                        
-                        default:
-                            break;
-                    }
-                    break;
-                
-                /* 0b00011XXX - direct, indirect and indexed MOVs*/
-                case 0x18:
-                    switch (NNN) {
-                        
-                        /* MOV A, addr16 */
-                        case 0:
-                            set_wide(TMP, fetch_wide());
-                            A = mem[get_wide(TMP)];
-                            break;
-                        
-                        /* MOV addr16, A */
-                        case 1:
-                            set_wide(TMP, fetch_wide());
-                            mem[get_wide(TMP)] = A;
-                            break;
-                        
-                        /* MOV A, @A+DPTR */
-                        case 2:
-                            set_wide(TMP, A + get_wide(DPTR));
-                            A = mem[get_wide(TMP)];
-                            break;
-                        
-                        /* MOV A, @A+PC */
-                        case 3:
-                            set_wide(TMP, A + get_wide(PC));
-                            A = mem[TMP];
-                            break;
-                        
-                        /* MOV A, @addr16 */
-                        case 4:
-                            set_wide(TMP, fetch_wide());
-                            A = mem[mem[get_wide(TMP)]];
-                            break;
-                        
-                        /* MOV @addr16, A */ 
-                        case 5:
-                            set_wide(TMP, fetch_wide());
-                            mem[mem[get_wide(TMP)]] = A;
-                            break;
-                        
-                        /* MOV A, @DPTR */
-                        case 6:
-                            set_wide(TMP, get_wide(DPTR));
-                            A = mem[get_wide(TMP)];
-                            break;
-                        
-                        /* MOV @DPTR, A */
-                        case 7:
-                            set_wide(TMP, get_wide(DPTR));
-                            mem[get_wide(TMP)] = A;
-                            break;
-                        
-                        default:
-                            break;
-                    }
-                    break;
-                
-                /* 0b00100nnn - MOV @DPTR, Rn*/
-                case 0x20:
-                    set_wide(TMP, get_wide(DPTR));
-                    mem[get_wide(TMP)] = get_reg(NNN);
-                    break;
-                
-                /* 0b00101nnn - immediate movs - MOV Rn, #data8*/
-                case 0x28:
-                    set_reg(NNN, fetch());
-                    break;
-                
-                /* 0b00110nnn - MOV Rn, A */
-                case 0x30:
-                    set_reg(NNN, A);
-                    break;
-                
-                /* 0b00111nnn MOV A, Rn */
-                case 0x38:
-                    A = get_reg(NNN);
-                    break;
-                
-                default:
-                    break;
-                }
-            break;;
-        
-        /* 0b01mmmnnn MOV Rm Rn
-         *   if m == n: MOV Rm, @DPTR */
-        case 0x40:
-            if (NNN == MMM) {
-                set_wide(TMP, get_wide(DPTR));
-                set_reg(NNN, mem[get_wide(TMP)]);
-            }
-            else {
-                set_reg(MMM, get_reg(NNN));
-            }
-            break;
-        
-        default:
-            break;
-    }
-}
-
-
-/* 0x80 - ANL A, R0
- * 0x81 - ANL A, R1
- * 0x82 - ANL A, R2
- * 0x83 - ANL A, R3
- * 0x84 - ANL A, DPH
- * 0x85 - ANL A, DPL
- * 0x86 - ANL A, #data8
- * 0x87 - ANL A, @DPTR */
-void
-ANL(void) {
-    if (NNN < 6) {
-        A = A & get_reg(NNN);
-    }
-    else {
-        switch (NNN) {
-            
-            case 6:
-                A = A & fetch();
-                break;
-
-            case 7:
-                set_wide(TMP, get_wide(DPTR));
-                A = A & mem[TMP];
-                break;
-        }
-    }
-    set_zp(A);
-}
-
-/* 0x88 - ORL A, R0
- * 0x89 - ORL A, R1
- * 0x8A - ORL A, R2
- * 0x8B - ORL A, R3
- * 0x8C - ORL A, DPH
- * 0x8D - ORL A, DPL
- * 0x8E - ORL A, #data8
- * 0x8F - ORL A, @DPTR */
-void
-ORL(void) {
-    if (NNN < 6) {
-        A = A | get_reg(NNN);
-    }
-    else {
-        switch (NNN) {
-            
-            case 6:
-                A = A | fetch();
-                break;
-
-            case 7:
-                set_wide(TMP, get_wide(DPTR));
-                A = A | mem[TMP];
-                break;
-        }
-    }
-    set_zp(A);
-}
-
-/* 0x90 - XRL A, R0
- * 0x91 - XRL A, R1
- * 0x92 - XRL A, R2
- * 0x93 - XRL A, R3
- * 0x94 - XRL A, DPH
- * 0x95 - XRL A, DPL
- * 0x96 - XRL A, #data8
- * 0x97 - XRL A, @DPTR */
-void
-XRL(void) {
-    if (NNN < 6) {
-        A = A ^ get_reg(NNN);
-    }
-    else {
-        switch (NNN) {
-            
-            case 6:
-                A = A ^ fetch();
-                break;
-
-            case 7:
-                set_wide(TMP, get_wide(DPTR));
-                A = A ^ mem[TMP];
-                break;
-        }
-    }
-    set_zp(A);
-}
-
-/* 0x98 - RL A */
-void
-RL(void) {
-    A = (A << 1) | (A >> 7);
-}
-
-/* 0x99 - RLC A */
-void
-RLC(void) {
-     tmpb = A;
-     A = (A << 1) | get_flag(C);
-     set_flag(C, tmpb >> 7);
-}
-
-/* 0x9A - RR A */
-void
-RR(void) {
-    A = (A >> 1) | (A << 7);
-}
-
-/* 0x9B - RRC A */
-void
-RRC(void) { 
-    tmpb = A;
-    A = (A >> 1) | (get_flag(C) << 7);
-    set_flag(C, tmpb & 0x01);
-}
-
-/* 0x9C - INC DPTR
- * 0x9E - INC A */
-void
-INC(void) {
-    switch (IR) {
-
-        case 0x9C:
-            tmpw = get_wide(DPTR);
-            if ((tmpw + 1) > 0xFFFF) {
-                set_flag(OV, 1);
-            }
-            set_wide(DPTR, tmpw + 1);
-            set_zp(DPL);
-            set_zp(DPH);
-            break;
-
-        case 0x9E:
-            if ((A + 1) > 0xFF) {
-                set_flag(OV, 1);
-            }
-            A++;
-            set_zp(A);
-
-    }
-}
-
-/* 0x9D - DEC DPTR
- * 0x9F - DEC A */
-void
-DEC(void) {
-    switch (IR) {
-
-        case 0x9D:
-            tmpw = get_wide(DPTR);
-            if ((tmpw - 1) < 0) {
-                set_flag(OV, 1);
-            }
-            set_wide(DPTR, tmpw - 1);
-            set_zp(DPL);
-            set_zp(DPH);
-
-        case 0x9F:
-            if ((A - 1) < 0) {
-                set_flag(OV, 1);
-            }
-            A--;
-            set_zp(A);
-    }    
-}
-
-/* 0xA0 - ADD A, R0
- * 0xA1 - ADD A, R1
- * 0xA2 - ADD A, R2
- * 0xA3 - ADD A, R3
- * 0xA4 - ADD A, DPH
- * 0xA5 - ADD A, DPL
- * 0xA6 - ADD A, #data8
- * 0xA7 - ADD A, @DPTR */
-void
-ADD(void) {
-    if (NNN < 6) {
-        if ((A + get_reg(NNN)) > 0xFF) {
-            set_flag(OV, 1);
-        }
-        else {
-            set_flag(OV, 0);
-        }
-        A = A + get_reg(NNN);
-        set_zp(A);
-    }
-    else {
-        switch (NNN) {
-            
-            case 6:
-                tmpb = fetch();
-                if ((A + tmpb) > 0xFF) {
-                    set_flag(OV, 1);
-                }
-                else {
-                    set_flag(OV, 0);
-                }
-                A = A + tmpb;
-                set_zp(A);
-                break;
-
-            case 7:
-                set_wide(TMP, get_wide(DPTR));
-                if ((A + mem[TMP]) > 0xFF) {
-                    set_flag(OV, 1);
-                }
-                else {
-                    set_flag(OV, 0);
-                }
-                A = A + mem[TMP];
-                set_zp(A);
-                break;
-        }
-    }
-
-}
-
-/* 0xA8 - ADDC A, R0
- * 0xA9 - ADDC A, R1
- * 0xAA - ADDC A, R2
- * 0xAB - ADDC A, R3
- * 0xAC - ADDC A, DPH
- * 0xAD - ADDC A, DPL
- * 0xAE - ADDC A, #data8
- * 0xAF - ADDC A, @DPTR */
-void
-ADDC(void) {
-    if (NNN < 6) {
-        if ((A + get_reg(NNN) + get_flag(C)) > 0xFF) {
-            set_flag(C, 1);
-        }
-        else {
-            set_flag(C, 0);
-        }
-        A = A + get_reg(NNN) + get_flag(C);
-        set_zp(A);
-    }
-    else {
-        switch (NNN) {
-            
-            case 6:
-                tmpb = fetch();
-                if ((A + tmpb + get_flag(C)) > 0xFF) {
-                    set_flag(C, 1);
-                }
-                else {
-                    set_flag(C, 0);
-                }
-                A = A + tmpb + get_flag(C);
-                set_zp(A);
-                break;
-
-            case 7:
-                set_wide(TMP, get_wide(DPTR));
-                if ((A + mem[TMP] + get_flag(C)) > 0xFF) {
-                    set_flag(C, 1);
-                }
-                else {
-                    set_flag(C, 0);
-                }
-                A = A + mem[TMP] + get_flag(C);
-                set_zp(A);
-                break;
-        }
-    }
-
-
-}
-
-/* 0xB0 - SUB A, R0
- * 0xB1 - SUB A, R1
- * 0xB2 - SUB A, R2
- * 0xB3 - SUB A, R3
- * 0xB4 - SB A, DPH
- * 0xB5 - SUB A, DPL
- * 0xB6 - SUB A, #data8
- * 0xB7 - SUB A, @DPTR */
-void
-SUB(void) {
-    if (NNN < 6) {
-        if ((A - get_reg(NNN)) < 0){
-            set_flag(S, 1);
-        }
-        else {
-            set_flag(S, 0);
-        }
-        A = A - get_reg(NNN);
-        set_zp(A);
-    }
-    else {
-        switch (NNN) {
-            
-            case 6:
-                tmpb = fetch();
-                if ((A - tmpb) < 0) {
-                    set_flag(S, 1);
-                }
-                else {
-                    set_flag(S, 0);
-                }
-                A = A - tmpb;
-                set_zp(A);
-                break;
-
-            case 7:
-                set_wide(TMP, get_wide(DPTR));
-                if ((A - mem[TMP]) < 0) {
-                    set_flag(S, 1);
-                }
-                else {
-                    set_flag(S, 0);
-                }
-                A = A - mem[TMP];
-                set_zp(A);
-                break;
-        }
-    }
-}
-
-/* 0xB8 - SUBB A, R0
- * 0xB9 - SUBB A, R1
- * 0xBA - SUBB A, R2
- * 0xBB - SUBB A, R3
- * 0xBC - SUBB A, DPH
- * 0xBD - SUBB A, DPL
- * 0xBE - SUBB A, #data8
- * 0xBF - SUBB A, @DPTR */
-void
-SUBB(void) {
-    if (NNN < 6) {
-        if ((A - get_reg(NNN) - get_flag(C)) < 0){
-            set_flag(C, 1);
-        }
-        else {
-            set_flag(C, 0);
-        }
-        A = A - get_reg(NNN) -get_flag(C);
-        set_zp(A);
-    }
-    else {
-        switch (NNN) {
-            
-            case 6:
-                tmpb = fetch();
-                if ((A - tmpb - get_flag(C)) < 0) {
-                    set_flag(C, 1);
-                }
-                else {
-                    set_flag(C, 0);
-                }
-                A = A - tmpb - get_flag(C);
-                set_zp(A);
-                break;
-
-            case 7:
-                set_wide(TMP, get_wide(DPTR));
-                if ((A - mem[TMP] - get_flag(C)) < 0) {
-                    set_flag(C, 1);
-                }
-                else {
-                    set_flag(C, 0);
-                }
-                A = A - mem[TMP] - get_flag(C);
-                set_zp(A);
-                break;
-        }
-    }
-}
-
-void
-PJMP(void) {
-    /* implement me */
-}
-
-void
-PCALL(void) {
-    /* implement me */
-}
-
-/* 0xD0 - DJNZ R0, rel8
- * 0xD1 - DJNZ R1, rel8
- * 0xD2 - DJNZ R2, rel8
- * 0xD3 - DJNZ R3, rel8 */
-void
-DJNZ(void) {
-    set_reg(NNN, get_reg(NNN) - 1);
-    if (get_reg(NNN) == 0) {
-        set_wide(PC, get_wide(PC) + (signed char)fetch() - 1);
-    }
-    else {
-        inc_pc(1);
-    }
-}
-
-/* 0xD4 - CJNE R0, #data, rel8
- * 0xD5 - CJNE R1, #data, rel8
- * 0xD6 - CJNE R2, #data, rel8
- * 0xD7 - CJNE R3, #data, rel8 
- * 0xDF - CJNE A, #data8, rel8 */
-void
-CJNE(void) {
-    switch(IR) {
-        
-        case 0xDF:
-             tmpb = fetch();
-            if (tmpb != A) {
-                set_wide(PC, get_wide(PC) + (signed char)fetch() - 1);
-            }
-            else {
-                inc_pc(1);
-            }
-            break;
-
-
-        default:
-            tmpb = fetch();
-            if (tmpb != get_reg(NNN - 4)) {
-                set_wide(PC, get_wide(PC) + (signed char)fetch() - 1);
-            }
-            else {
-                inc_pc(1);
-            }
-            break;
-    }
-}
-
-/* 0xD8 - LJMP addr16 */
-void
-LJMP(void) {
-    set_wide(PC, fetch_wide());
-}
-
-/* 0xD9 - LCALL addr16 */
-void
-LCALL(void) {
-    /* push PC to stack */
-    mem[get_wide(SP)] = get_reg(PCL);
-    set_wide(SP, get_wide(SP) + 1);
-    mem[get_wide(SP)] = get_reg(PCH);
-    set_wide(SP, get_wide(SP) + 1);
-    /* jmp */
-    set_wide(PC, fetch_wide());
-}
-
-/* 0xDA - RET */
-void
-RET(void) {
-    /* get PC from stack */
-    set_wide(SP, get_wide(SP) - 1);
-    tmpb = mem[get_wide(SP)]; /* PCH */
-    set_wide(SP, get_wide(SP) - 1);
-    set_wide(PC, MWIDE(tmpb, mem[get_wide(SP)]));
-}
-
-void
-RETI(void) {
-    /* implement me */
-}
-
-/* 0xDC - SJMP rel8 */
-void
-SJMP(void) {
-    /* -1 because the fetch() increments the PC */
-    set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
-}
-
-/* 0xDD - JMP @A+DPTR
- * 0xDE - JMP @DPTR */
-void
-JMP(void) {
-    switch(IR) {
-        
-        case 0xDD:
-            set_wide(PC, A + get_wide(DPTR));
-            break;
-        
-        case 0xDE:
-            set_wide(PC, get_wide(DPTR));
-            break;
-    }
-}
-
-/* 0xE0 - JZ rel8 */
-void
-JZ(void) {
-    if (get_flag(Z) == 1) {
-        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
-    }
-    /* skip rel8 if jump not needed */
-    else {
-        inc_pc(1);
-    }
-}
-
-/* 0xE1 - JNZ rel8 */
-void
-JNZ(void) {
-    if (get_flag(Z) == 0) {
-        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
-    }
-    else {
-        inc_pc(1);
-    }
-}
-
-/* 0xE2 - JC rel8 */
-void
-JC(void) {
-    if (get_flag(C) == 1) {
-        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
-    }
-    else {
-        inc_pc(1);
-    }
-}
-
-/* 0xE3 - JNC rel8 */
-void
-JNC(void) {
-    if (get_flag(C) == 0) {
-        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
-    }
-    else {
-        inc_pc(1);
-    }
-}
-
-/* 0xE4 - JPO rel8 */
-void
-JPO(void) {
-    /* P = 1 when parity even */
-    if (get_flag(P) == 0) {
-        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
-    }
-    else {
-        inc_pc(1);
-    }
-
-}
-
-/* 0xE5 - JPE rel8 */
-void
-JPE(void) {
-    if (get_flag(P) == 1) {
-        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
-    }
-    else {
-        inc_pc(1);
-    }
-}
-
-/* 0xE6 - JS rel8 */
-void
-JS(void) {
-    if (get_flag(S) == 1) {
-        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
-    }
-    else {
-        inc_pc(1);
-    }
-}
-
-/* 0xE7 - JNS rel8 */
-void
-JNS(void) {
-    if (get_flag(S) == 0) {
-        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
-    }
-    else {
-        inc_pc(1);
-    }
-}
-
-/* 0xE8 - PUSH R0
- * 0xE9 - PUSH R1
- * 0xEA - PUSH R2
- * 0xEB - PUSH R3
- * 0xEC - PUSH DPH
- * 0xED - PUSH DPL
- * 0xEE - PUSH A
- * 0xEF - PUSH FLAGS */
-void
-PUSH(void) {
-    if (NNN < 6) {
-        mem[get_wide(SP)] = get_reg(NNN);
-        set_wide(SP, get_wide(SP) + 1);
-
-    }
-    else {
-        switch(IR) {
-            
-            case 0xEE:
-                mem[get_wide(SP)] = A;
-                set_wide(SP, get_wide(SP) + 1);
-                break;
-
-            case 0xEF:
-                mem[get_wide(SP)] = flags;
-                set_wide(SP, get_wide(SP) + 1);
-                break;
-
-            default:
-                break;
-        }
-    }
-}
-
-/* 0xF0 - POP R0
- * 0xF1 - POP R1
- * 0xF2 - POP R2
- * 0xF3 - POP R3
- * 0xF4 - POP DPH
- * 0xF5 - POP DPL
- * 0xF6 - POP A
- * 0xF7 - POP FLAGS */
-void
-POP(void) {
-    if (NNN < 6) {
-        set_wide(SP, get_wide(SP) - 1);
-        set_reg(NNN, mem[get_wide(SP)]);
-    }
-    else {
-        switch(IR) {
-            
-            case 0xF6:
-                set_wide(SP, get_wide(SP) - 1);
-                A = mem[get_wide(SP)];
-                break;
-
-            case 0xF7:
-                set_wide(SP, get_wide(SP) - 1);
-                flags = mem[get_wide(SP)];
-                break;
-
-            default:
-                break;
-        }
-    }
-}
-
-
-/* 0xF8 - MUL R0, R1 */
-void
-MUL(void) {
- /* implement me */    
-}
-
-/* 0xF9 - DIV R0, R1 */
-void
-DIV(void) {
- /* implement me */   
-}
-
-/* 0xFA - DA A */
-void
-DA(void) {
- /* implement me */
-}
-
-/* 0xFC - IN port_addr */
-void
-IN(void) {
- /* implement me */   
-}
-
-/* 0xFD - OUT port_addr */
-void
-OUT(void) {
- /* implement me */
-}
-
-/* 0xFE INT vect8 */
-void
-INT(void) {
- /* implement me */    
-}
-
-/* 0xFF - HLT */
-void
-HLT(void) {
- /* implement me */
-}
--- a/emu52/iset.h	Fri Apr 18 20:07:19 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +0,0 @@
-/* iset.h
- * op function definitions */
-#ifndef ISET_H
-#define ISET_H
-
-#if defined MAIN
-#define EXTERN
-#else
-#define EXTERN extern
-#endif
-
-
-/* instruction pointer table */
-typedef struct {
-    void (*ops[256])(void);
-} FUNCTION_TABLE;
-
-EXTERN void
-JNS(void);
-
-EXTERN void
-LJMP(void);
-
-EXTERN void
-SET(void);
-
-EXTERN void
-JPO(void);
-
-EXTERN void
-ANL(void);
-
-EXTERN void
-JNZ(void);
-
-EXTERN void
-HLT(void);
-
-EXTERN void
-RRC(void);
-
-EXTERN void
-POP(void);
-
-EXTERN void
-JNC(void);
-
-EXTERN void
-SUBB(void);
-
-EXTERN void
-PCALL(void);
-
-EXTERN void
-IN(void);
-
-EXTERN void
-INC(void);
-
-EXTERN void
-XRL(void);
-
-EXTERN void
-SUB(void);
-
-EXTERN void
-RR(void);
-
-EXTERN void
-SJMP(void);
-
-EXTERN void
-RETI(void);
-
-EXTERN void
-RET(void);
-
-EXTERN void
-INT(void);
-
-EXTERN void
-ADD(void);
-
-EXTERN void
-ADDC(void);
-
-EXTERN void
-RL(void);
-
-EXTERN void
-MUL(void);
-
-EXTERN void
-JC(void);
-
-EXTERN void
-JMP(void);
-
-EXTERN void
-DJNZ(void);
-
-EXTERN void
-CLR(void);
-
-EXTERN void
-JZ(void);
-
-EXTERN void
-JPE(void);
-
-EXTERN void
-LAF(void);
-
-EXTERN void
-MOV(void);
-
-EXTERN void
-RLC(void);
-
-EXTERN void
-JS(void);
-
-EXTERN void
-ORL(void);
-
-EXTERN void
-CJNE(void);
-
-EXTERN void
-XCSD(void);
-
-EXTERN void
-LCALL(void);
-
-EXTERN void
-DA(void);
-
-EXTERN void
-NOP(void);
-
-EXTERN void
-SFA(void);
-
-EXTERN void
-CPL(void);
-
-EXTERN void
-PUSH(void);
-
-EXTERN void
-DIV(void);
-
-EXTERN void
-DEC(void);
-
-EXTERN void
-OUT(void);
-
-EXTERN void
-PJMP(void);
-
-#endif
-
--- a/emu52/main.c	Fri Apr 18 20:07:19 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-#include <stdio.h>
-#include <reg52.h>
-
-#define MAIN
-#include "mem.h"
-#include "iset.h"
-
-/* fill instruction table 
- * MCS-51 - this needs to be stored in code memory */
-
-FUNCTION_TABLE const code iset = {
-    NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP,
-    SET, CLR, SET, CLR, SET, CLR, CPL, CPL,
-    XCSD, SFA, LAF, MOV, MOV, MOV, MOV, MOV,
-    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
-    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
-    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
-    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
-    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
-    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
-    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
-    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
-    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
-    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
-    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
-    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
-    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
-    ANL, ANL, ANL, ANL, ANL, ANL, ANL, ANL,
-    ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL,
-    XRL, XRL, XRL, XRL, XRL, XRL, XRL, XRL,
-    RL, RLC, RR, RRC, INC, DEC, INC, DEC,
-    ADD, ADD, ADD, ADD, ADD, ADD, ADD, ADD,
-    ADDC, ADDC, ADDC, ADDC, ADDC, ADDC, ADDC, ADDC,
-    SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB,
-    SUBB, SUBB, SUBB, SUBB, SUBB, SUBB, SUBB, SUBB,
-    PJMP, PJMP, PJMP, PJMP, PJMP, PJMP, PJMP, PJMP,
-    PCALL, PCALL, PCALL, PCALL, PCALL, PCALL, PCALL, PCALL,
-    DJNZ, DJNZ, DJNZ, DJNZ, CJNE, CJNE, CJNE, CJNE,
-    LJMP, LCALL, RET, RETI, SJMP, JMP, JMP, CJNE,
-    JZ, JNZ, JC, JNC, JPO, JPE, JS, JNS,
-    PUSH, PUSH, PUSH, PUSH, PUSH, PUSH, PUSH, PUSH,
-    POP, POP, POP, POP, POP, POP, POP, POP,
-    MUL, DIV, DA, NOP, IN, OUT, INT, HLT
-}; 
-
-BYTE pause;     /* becomes 1 when we hit a break point in run mode */
-BYTE free_run;  /* free run if not 0 */
-BYTE pause;     /* pause flag */
-WIDE addrc;        /* address counter */
-BYTE args[4];   /* dbg args */
-
-WIDE bp[8] = {  0xFFFF,
-                0xFFFF,
-                0xFFFF,
-                0xFFFF,
-                0xFFFF,
-                0xFFFF,
-                0xFFFF,
-                0xFFFF
-};
-
-
-void
-snd(BYTE c) {
-putchar(c);
-}
-
-BYTE
-rcv(void) {
-    return getchar();
-}
-
-void
-step(void) {
-    IR = fetch();
-    iset.ops[IR]();  
-}
-
-void
-run(void) {
-    while (pause != 1) {
-        step();
-        for (addrc = 0; addrc < 8; addrc++) {
-            if (bp[addrc] == get_wide(PC)) {
-                pause = 1;
-            }
-        }
-    }
-}
-
-void controller() {
-    if (free_run == 0) {
-            switch (rcv()) {
-
-                /* step */
-                case 0x00:
-                    step();
-                    break;
-
-                /* run for length steps*/
-                case 0x01:
-                    run();
-                    break;
-
-                /* set reg */
-                case 0x02:
-                    args[0] = rcv(); /* reg */
-                    args[1] = rcv(); /* val */
-                    regs[args[0]] = args[1];
-                    break;
-
-                /* get reg */
-                case 0x03:
-                    args[0] = rcv(); /* reg */
-                    snd(regs[args[0]]);
-                    break;
-
-                /* set flag */
-                case 0x04:
-                    args[0] = rcv(); /* flag */
-                    args[1] = rcv(); /* on? */
-                    set_flag(args[0], args[1]);
-                    break;
-        
-                /* get flag */
-                case 0x05:
-                    args[0] = rcv(); /* flag */
-                    snd(get_flag(args[0]));
-                    break;
-
-                /* write mem block */
-                case 0x06:
-                    args[0] = rcv(); /* addr high */
-                    args[1] = rcv(); /* addr low */
-                    args[2] = rcv(); /* length high */
-                    args[3] = rcv(); /* length low */
-                    tmpw = MWIDE(args[0], args[1]);         
-                    for (addrc = tmpw; addrc < tmpw + MWIDE(args[2], args[3]); addrc++) { 
-                        if (addrc >= 0xFFFF) {
-                            break;
-                        }
-                        mem[addrc] = rcv();
-                    }
-                    break;
-
-                /* read mem block */
-                case 0x07:
-                    args[0] = rcv(); /* addr high */
-                    args[1] = rcv(); /* addr low */
-                    args[2] = rcv(); /* length high */
-                    args[3] = rcv(); /* length low */
-                    tmpw = MWIDE(args[0], args[1]);         
-                    for (addrc = tmpw; addrc < tmpw + MWIDE(args[2], args[3]); addrc++) { 
-                        if (addrc >= 0xFFFF) {
-                            break;
-                        }
-                        snd(mem[addrc]);
-                    }
-                    break;
-
-                /* get A */
-                case 0x08:
-                    snd(A);
-                    break;
-                
-                /* get flags */
-                case 0x09:
-                    snd(flags);
-                    break;
-                
-                /* get instruction register */
-                case 0x0A:
-                    snd(IR);
-                    break;
-                
-                case 0x0B:
-                    args[0] = rcv(); /* length high */
-                    args[1] = rcv(); /* length low */
-                    tmpw = get_wide(PC);
-                    for (addrc = tmpw ; addrc < tmpw + MWIDE(args[0], args[1]) ; addrc++) {
-                        if (addrc == 0xFFFF) {
-                            break;
-                        }
-                        step();
-                    }
-                    break;
-
-                case 0x0C:
-                    free_run = 1;
-                    break;
-                
-                /* set break point */
-                case 0x0D:
-                    args[0] = rcv(); /* bp index */
-                    args[1] = rcv(); /* address high */
-                    args[2] = rcv(); /* address low */
-                    if (args[0] > 7) {
-                        break;
-                    }
-                    bp[args[0]] = MWIDE(args[1], args[2]);
-                    break;
-                
-                /* test cmd */
-                case 0x54:
-                    snd('A');
-                    break;
-           }
-        }
-    else {
-        step();
-    }
-}
-
-void 
-main(void) {
-     /* serial set up
-     * SCON - mode 1, 8-bit UART, enable rcvr
-     * TMOD - timer 1, mode 2, 8-bit reload
-     * TH1 - reload value for 1200 baud @ 12MHz
-     * TR1 - timer 1 run
-     * TI - set TI to send first char of UART */
-    /* dont go into free run on restart */
-    free_run = 0;
-    SCON  = 0x50;
-    TMOD |= 0x20;
-    TH1   = 0xE8;
-    TR1   = 1;
-    TI    = 1;
-    for (;;) {
-        controller();
-    }
-}
-
--- a/emu52/mem.c	Fri Apr 18 20:07:19 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/* mem.c
- * functions for accessing emulator memory */
-#include "mem.h"
-
-/* get flag value
- * if invalid flag is requested value is 0 */
-BYTE
-get_flag(BYTE flag) {
-    if (flag > 7) {
-        return 0;
-    }
-    else {
-        return GBIT(flags, flag);
-    }
-}
-
-/*  set flag to 0 if on == 0
- *  otherwise set flag to 1 */
-void
-set_flag(BYTE flag, BYTE on) {
-    if (flag <= 7) {
-        if (on == 0x00) {
-            flags = CBIT(flags, flag);
-        }
-        else {
-            flags = SBIT(flags, flag);
-        }
-    }
-}
-
-/* sets zero and parity flags based on content of byte */
-void
-set_zp(BYTE val){
-    if (val == 0) {
-        set_flag(Z, 1);
-        set_flag(P, 0);
-    }
-    else {
-        /* check parity
-         * think of this as folding */
-        val ^= val >> 4;
-        val ^= val >> 2;
-        val ^= val >> 1;
-        val &= 1;
-        if (val == 0) {
-            set_flag(P, 1);
-        }
-        else {
-            set_flag(P, 0);
-        }
-    }
-}
-
-WIDE
-get_wide(BYTE reg) {
-    /* high, low */
-    return MWIDE(regs[reg + 4], regs[reg + 12]);
-}
-
-void
-set_wide(BYTE reg, WIDE val) {
-    regs[reg + 4] = GHIGH(val); /* high */
-    regs[reg + 12] = GLOW(val); /* low */
-}
-
-void 
-inc_pc(BYTE n) {
-    if ((regs[PCL] + n) > 0xFF) {
-        regs[PCH]++;
-    }
-    regs[PCL] += n;
-}
-
-BYTE 
-fetch(void) {
-    BYTE val = mem[get_wide(PC)];
-    inc_pc(1);
-    return val;
-}
-
-WIDE
-fetch_wide(void) {
-    WIDE val = MWIDE(mem[get_wide(PC)], mem[get_wide(PC) + 1]);
-    inc_pc(2);
-    return val;
-}
-
-/* 0b000 = R0
- * 0b001 = R1
- * 0b010 = R2
- * 0b011 = R3
- * 0b100 = DPH
- * 0b101 = DPL
- * 0b110 = SPH
- * 0b111 = SPL */
-BYTE 
-get_reg(BYTE reg) {
-    if (reg < 4) {
-        return regs[reg | (get_flag(BS) << 3)];
-    }
-    else {
-        switch (reg) {
-            
-            case 4:
-                return regs[DPH];
-            case 5:
-                return regs[DPL];
-            case 6:
-                return regs[SPH];
-            case 7:
-                return regs[SPL];
-            default:
-                return 0;
-        }
-    }
-}
-
-void
-set_reg(BYTE reg, BYTE val) {
-    if (reg < 4) {
-        regs[reg | (get_flag(BS) << 3)] = val;
-    }
-    else {
-        switch (reg) {
-            
-            case 4:
-                regs[DPH] = val;
-                break;
-            case 5:
-                regs[DPL] = val;
-                break;
-            case 6:
-                regs[SPH] = val;
-                break;
-            case 7:
-                regs[SPL] = val;
-                break;
-            default:
-                break;
-        }
-    }
-}
--- a/emu52/mem.h	Fri Apr 18 20:07:19 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/* mem.h */
-#ifndef MEM_H
-#define MEM_H
-
-#if defined MAIN
-#define EXTERN
-#else
-#define EXTERN extern
-#endif
-
-/* 8 bit register encodings */
-#define R0   (0 | (get_flag(0) << 3))
-#define R1   (1 | (get_flag(0) << 3))
-#define R2   (2 | (get_flag(0) << 3))
-#define R3   (3 | (get_flag(0) << 3))
-#define DPH  4
-#define SPH  5
-#define PCH  6 
-#define TMPH 7
-#define DPL  12
-#define SPL  13
-#define PCL  14
-#define TMPL 15
-
-/* 16 bit register encodings */ 
-#define DPTR 0 
-#define SP   1 
-#define PC   2 
-#define TMP  3 
- 
-/* flag bits numbered from LSB -> MSB 
- *  7 6 5  4 3 2  1  0 
- *  C Z AC P S OV IE BS */
-#define BS 0
-#define IE 1
-#define OV 2
-#define S  3
-#define P  4
-#define AC 5
-#define Z  6
-#define C  7
-
-/* for getting and setting flags */ 
-#define GBIT(byte, n) (byte & (0x01 << n) ? 1 : 0)  
-#define SBIT(byte, n) (byte | (0x01 << n)) 
-#define CBIT(byte, n) (byte ^ (0x01 << n)) 
-
-/* for making and breaking 16 bit values */
-#define MWIDE(high, low) (low | (high << 8))
-#define GHIGH(wide) ((wide >> 8) & 0xFF)
-#define GLOW(wide) (wide & 0xFF) 
-
-typedef unsigned char BYTE;
-typedef unsigned short WIDE;
-
-/* these are needed for some operations */
-EXTERN BYTE tmpb;
-EXTERN WIDE tmpw;
-
-EXTERN BYTE IR;
-EXTERN BYTE A;
-EXTERN BYTE flags;
-
-/*  0x00 0b0000 r0 bank 0
-    0x01 0b0001 r1 bank 0
-    0x02 0b0010 r2 bank 0
-    0x03 0b0011 r3 bank 0
-    0x04 0b0100 dph
-    0x05 0b0101 sph
-    0x06 0b0110 pch
-    0x07 0b0111 tmph
-    0x08 0b1000 r0 bank 1
-    0x09 0b1001 r1 bank 1
-    0x0A 0b1010 r2 bank 1
-    0x0B 0b1011 r3 bank 1
-    0x0C 0b1100 dpl
-    0x0D 0b1101 spl
-    0x0E 0b1110 pcl
-    0x0F 0b1111 tmpl */
-EXTERN BYTE regs[0x10];
-
-/* 64K Von Neumann memory */
-EXTERN BYTE xdata mem[0x8000];
-
-/* functions to dealing with flags */
-EXTERN BYTE
-get_flag(BYTE flag);
-
-EXTERN void
-set_flag(BYTE flag, BYTE on);
-
-EXTERN void
-set_zp(BYTE val);
-
-/* this function a byte and returns a byte
- * with zero and parity flags set or unset.
- * result should be or'd with flags reg */
-EXTERN BYTE
-gen_flags(BYTE val);
-
-/* functions for dealing with 16-bit registers
- * access the 16 bit registers.
- * register map for these function:
- *   0b00 dptr
- *   0b01 sp
- *   0b10 pc
- *   0b11 tmp */
-EXTERN WIDE
-get_wide(BYTE reg);
-
-EXTERN void
-set_wide(BYTE reg, WIDE val);
-
-/* functions to fetch data at PC */
-EXTERN void
-inc_pc(BYTE n);
-
-EXTERN BYTE
-fetch();
-
-EXTERN WIDE
-fetch_wide();
-
-/* for mapping the register encoding in the instruction
- * set to the register address */
-EXTERN BYTE
-get_reg(BYTE reg);
-
-EXTERN void
-set_reg(BYTE reg, BYTE val);
-
-
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emu52/src/iset.c	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,937 @@
+/* iset.c
+ * IR functions */
+#include "iset.h"
+#include "mem.h"
+
+/* useful macros */
+#define NNN (IR & 0x07)
+#define MMM ((IR & 0x38) >> 3)
+
+/* 0x00 - NOP */
+void
+NOP(void) {    
+}
+
+/* 0x08 - SET C
+ * 0x0A - SET BS
+ * 0x0C - SET IE */
+void
+SET(void) {
+    switch (IR) {
+        
+        case 0x08:
+            set_flag(C, 0x01);
+            break;
+        
+        case 0x0A:
+            set_flag(BS, 0x01);
+            break;
+        
+        case 0x0C:
+            set_flag(IE, 0x01);
+            break;
+        
+        default:
+            break;
+    }
+}
+
+/* 0x09 - CLR C
+ * 0x0B - CLR BS
+ * 0x0D - CLR IE */
+void
+CLR(void) {
+    switch (IR) {
+        
+        case 0x09:
+            set_flag(C, 0x00);
+            break;
+        
+        case 0x0B:
+            set_flag(BS, 0x00);
+            break;
+        
+        case 0x0D:
+            set_flag(IE, 0x00);
+            break;
+        
+        default:
+            break;
+    }    
+}
+
+/* 0x0E - CPL C
+ * 0x0F - CPL A */
+void
+CPL(void) {
+    switch (IR) {
+        
+        case 0x0E:
+            if (get_flag(C) == 0) {
+                set_flag(C, 0x01);
+            }
+            else {
+                set_flag(C, 0x00);
+            }
+        
+        case 0x0F:
+            A = ~A;
+            break;
+        
+        default:
+            break;
+    }
+}
+
+/* 0x10 - XCSD */
+void
+XCSD(void) {
+    tmpw = get_wide(SP);
+    set_wide(SP, get_wide(DPTR));
+    set_wide(DPTR, tmpw);
+}
+
+/* 0x11 - SFA */
+void
+SFA(void) {
+    A = flags;
+}
+
+/* 0x12 - LAF */
+void
+LAF(void) {
+    flags = A;   
+}
+
+/* 0b00010XXX - special MOVs
+ * 0b00011XXX - direct, indirect and indexed MOVs
+ * 0b00100nnn - register-indirect MOVs - MOV @DPTR, Rn
+ * 0b00101nnn - immediate movs - MOV Rn, #data8
+ * 0b00110nnn - MOV Rn, A
+ * 0b00111nnn - MOV A, Rn
+ * 0b01mmmnnn - 64 register move instructions
+ *
+ * this is a mess */
+void
+MOV(void) {
+    switch (IR & 0x40) {
+       
+        case 0x00:
+            switch (IR & 0xF8) {
+                
+                /* 0b00010XXX - special MOVs*/
+                case 0x10:
+                    switch (NNN) {
+                        
+                        /* MOV DPTR, SP */
+                        case 3:
+                            set_wide(DPTR, get_wide(SP));
+                            break;
+                        
+                        /* MOV SP, DPTR */
+                        case 4:
+                            set_wide(SP, get_wide(DPTR));
+                            break;
+                        
+                        /* MOV A, #data8 */
+                        case 5:
+                            A = fetch();
+                            break;
+                        
+                        /* MOV SP, #data16 */
+                        case 6:
+                            set_wide(SP, fetch_wide());
+                            break;
+                        
+                        /* MOV DPTR, #data16 */
+                        case 7:
+                            set_wide(DPTR, fetch_wide());
+                            break;
+                        
+                        default:
+                            break;
+                    }
+                    break;
+                
+                /* 0b00011XXX - direct, indirect and indexed MOVs*/
+                case 0x18:
+                    switch (NNN) {
+                        
+                        /* MOV A, addr16 */
+                        case 0:
+                            set_wide(TMP, fetch_wide());
+                            A = mem[get_wide(TMP)];
+                            break;
+                        
+                        /* MOV addr16, A */
+                        case 1:
+                            set_wide(TMP, fetch_wide());
+                            mem[get_wide(TMP)] = A;
+                            break;
+                        
+                        /* MOV A, @A+DPTR */
+                        case 2:
+                            set_wide(TMP, A + get_wide(DPTR));
+                            A = mem[get_wide(TMP)];
+                            break;
+                        
+                        /* MOV A, @A+PC */
+                        case 3:
+                            set_wide(TMP, A + get_wide(PC));
+                            A = mem[TMP];
+                            break;
+                        
+                        /* MOV A, @addr16 */
+                        case 4:
+                            set_wide(TMP, fetch_wide());
+                            A = mem[mem[get_wide(TMP)]];
+                            break;
+                        
+                        /* MOV @addr16, A */ 
+                        case 5:
+                            set_wide(TMP, fetch_wide());
+                            mem[mem[get_wide(TMP)]] = A;
+                            break;
+                        
+                        /* MOV A, @DPTR */
+                        case 6:
+                            set_wide(TMP, get_wide(DPTR));
+                            A = mem[get_wide(TMP)];
+                            break;
+                        
+                        /* MOV @DPTR, A */
+                        case 7:
+                            set_wide(TMP, get_wide(DPTR));
+                            mem[get_wide(TMP)] = A;
+                            break;
+                        
+                        default:
+                            break;
+                    }
+                    break;
+                
+                /* 0b00100nnn - MOV @DPTR, Rn*/
+                case 0x20:
+                    set_wide(TMP, get_wide(DPTR));
+                    mem[get_wide(TMP)] = get_reg(NNN);
+                    break;
+                
+                /* 0b00101nnn - immediate movs - MOV Rn, #data8*/
+                case 0x28:
+                    set_reg(NNN, fetch());
+                    break;
+                
+                /* 0b00110nnn - MOV Rn, A */
+                case 0x30:
+                    set_reg(NNN, A);
+                    break;
+                
+                /* 0b00111nnn MOV A, Rn */
+                case 0x38:
+                    A = get_reg(NNN);
+                    break;
+                
+                default:
+                    break;
+                }
+            break;;
+        
+        /* 0b01mmmnnn MOV Rm Rn
+         *   if m == n: MOV Rm, @DPTR */
+        case 0x40:
+            if (NNN == MMM) {
+                set_wide(TMP, get_wide(DPTR));
+                set_reg(NNN, mem[get_wide(TMP)]);
+            }
+            else {
+                set_reg(MMM, get_reg(NNN));
+            }
+            break;
+        
+        default:
+            break;
+    }
+}
+
+
+/* 0x80 - ANL A, R0
+ * 0x81 - ANL A, R1
+ * 0x82 - ANL A, R2
+ * 0x83 - ANL A, R3
+ * 0x84 - ANL A, DPH
+ * 0x85 - ANL A, DPL
+ * 0x86 - ANL A, #data8
+ * 0x87 - ANL A, @DPTR */
+void
+ANL(void) {
+    if (NNN < 6) {
+        A = A & get_reg(NNN);
+    }
+    else {
+        switch (NNN) {
+            
+            case 6:
+                A = A & fetch();
+                break;
+
+            case 7:
+                set_wide(TMP, get_wide(DPTR));
+                A = A & mem[TMP];
+                break;
+        }
+    }
+    set_zp(A);
+}
+
+/* 0x88 - ORL A, R0
+ * 0x89 - ORL A, R1
+ * 0x8A - ORL A, R2
+ * 0x8B - ORL A, R3
+ * 0x8C - ORL A, DPH
+ * 0x8D - ORL A, DPL
+ * 0x8E - ORL A, #data8
+ * 0x8F - ORL A, @DPTR */
+void
+ORL(void) {
+    if (NNN < 6) {
+        A = A | get_reg(NNN);
+    }
+    else {
+        switch (NNN) {
+            
+            case 6:
+                A = A | fetch();
+                break;
+
+            case 7:
+                set_wide(TMP, get_wide(DPTR));
+                A = A | mem[TMP];
+                break;
+        }
+    }
+    set_zp(A);
+}
+
+/* 0x90 - XRL A, R0
+ * 0x91 - XRL A, R1
+ * 0x92 - XRL A, R2
+ * 0x93 - XRL A, R3
+ * 0x94 - XRL A, DPH
+ * 0x95 - XRL A, DPL
+ * 0x96 - XRL A, #data8
+ * 0x97 - XRL A, @DPTR */
+void
+XRL(void) {
+    if (NNN < 6) {
+        A = A ^ get_reg(NNN);
+    }
+    else {
+        switch (NNN) {
+            
+            case 6:
+                A = A ^ fetch();
+                break;
+
+            case 7:
+                set_wide(TMP, get_wide(DPTR));
+                A = A ^ mem[TMP];
+                break;
+        }
+    }
+    set_zp(A);
+}
+
+/* 0x98 - RL A */
+void
+RL(void) {
+    A = (A << 1) | (A >> 7);
+}
+
+/* 0x99 - RLC A */
+void
+RLC(void) {
+     tmpb = A;
+     A = (A << 1) | get_flag(C);
+     set_flag(C, tmpb >> 7);
+}
+
+/* 0x9A - RR A */
+void
+RR(void) {
+    A = (A >> 1) | (A << 7);
+}
+
+/* 0x9B - RRC A */
+void
+RRC(void) { 
+    tmpb = A;
+    A = (A >> 1) | (get_flag(C) << 7);
+    set_flag(C, tmpb & 0x01);
+}
+
+/* 0x9C - INC DPTR
+ * 0x9E - INC A */
+void
+INC(void) {
+    switch (IR) {
+
+        case 0x9C:
+            tmpw = get_wide(DPTR);
+            if ((tmpw + 1) > 0xFFFF) {
+                set_flag(OV, 1);
+            }
+            set_wide(DPTR, tmpw + 1);
+            set_zp(DPL);
+            set_zp(DPH);
+            break;
+
+        case 0x9E:
+            if ((A + 1) > 0xFF) {
+                set_flag(OV, 1);
+            }
+            A++;
+            set_zp(A);
+
+    }
+}
+
+/* 0x9D - DEC DPTR
+ * 0x9F - DEC A */
+void
+DEC(void) {
+    switch (IR) {
+
+        case 0x9D:
+            tmpw = get_wide(DPTR);
+            if ((tmpw - 1) < 0) {
+                set_flag(OV, 1);
+            }
+            set_wide(DPTR, tmpw - 1);
+            set_zp(DPL);
+            set_zp(DPH);
+
+        case 0x9F:
+            if ((A - 1) < 0) {
+                set_flag(OV, 1);
+            }
+            A--;
+            set_zp(A);
+    }    
+}
+
+/* 0xA0 - ADD A, R0
+ * 0xA1 - ADD A, R1
+ * 0xA2 - ADD A, R2
+ * 0xA3 - ADD A, R3
+ * 0xA4 - ADD A, DPH
+ * 0xA5 - ADD A, DPL
+ * 0xA6 - ADD A, #data8
+ * 0xA7 - ADD A, @DPTR */
+void
+ADD(void) {
+    if (NNN < 6) {
+        if ((A + get_reg(NNN)) > 0xFF) {
+            set_flag(OV, 1);
+        }
+        else {
+            set_flag(OV, 0);
+        }
+        A = A + get_reg(NNN);
+        set_zp(A);
+    }
+    else {
+        switch (NNN) {
+            
+            case 6:
+                tmpb = fetch();
+                if ((A + tmpb) > 0xFF) {
+                    set_flag(OV, 1);
+                }
+                else {
+                    set_flag(OV, 0);
+                }
+                A = A + tmpb;
+                set_zp(A);
+                break;
+
+            case 7:
+                set_wide(TMP, get_wide(DPTR));
+                if ((A + mem[TMP]) > 0xFF) {
+                    set_flag(OV, 1);
+                }
+                else {
+                    set_flag(OV, 0);
+                }
+                A = A + mem[TMP];
+                set_zp(A);
+                break;
+        }
+    }
+
+}
+
+/* 0xA8 - ADDC A, R0
+ * 0xA9 - ADDC A, R1
+ * 0xAA - ADDC A, R2
+ * 0xAB - ADDC A, R3
+ * 0xAC - ADDC A, DPH
+ * 0xAD - ADDC A, DPL
+ * 0xAE - ADDC A, #data8
+ * 0xAF - ADDC A, @DPTR */
+void
+ADDC(void) {
+    if (NNN < 6) {
+        if ((A + get_reg(NNN) + get_flag(C)) > 0xFF) {
+            set_flag(C, 1);
+        }
+        else {
+            set_flag(C, 0);
+        }
+        A = A + get_reg(NNN) + get_flag(C);
+        set_zp(A);
+    }
+    else {
+        switch (NNN) {
+            
+            case 6:
+                tmpb = fetch();
+                if ((A + tmpb + get_flag(C)) > 0xFF) {
+                    set_flag(C, 1);
+                }
+                else {
+                    set_flag(C, 0);
+                }
+                A = A + tmpb + get_flag(C);
+                set_zp(A);
+                break;
+
+            case 7:
+                set_wide(TMP, get_wide(DPTR));
+                if ((A + mem[TMP] + get_flag(C)) > 0xFF) {
+                    set_flag(C, 1);
+                }
+                else {
+                    set_flag(C, 0);
+                }
+                A = A + mem[TMP] + get_flag(C);
+                set_zp(A);
+                break;
+        }
+    }
+
+
+}
+
+/* 0xB0 - SUB A, R0
+ * 0xB1 - SUB A, R1
+ * 0xB2 - SUB A, R2
+ * 0xB3 - SUB A, R3
+ * 0xB4 - SB A, DPH
+ * 0xB5 - SUB A, DPL
+ * 0xB6 - SUB A, #data8
+ * 0xB7 - SUB A, @DPTR */
+void
+SUB(void) {
+    if (NNN < 6) {
+        if ((A - get_reg(NNN)) < 0){
+            set_flag(S, 1);
+        }
+        else {
+            set_flag(S, 0);
+        }
+        A = A - get_reg(NNN);
+        set_zp(A);
+    }
+    else {
+        switch (NNN) {
+            
+            case 6:
+                tmpb = fetch();
+                if ((A - tmpb) < 0) {
+                    set_flag(S, 1);
+                }
+                else {
+                    set_flag(S, 0);
+                }
+                A = A - tmpb;
+                set_zp(A);
+                break;
+
+            case 7:
+                set_wide(TMP, get_wide(DPTR));
+                if ((A - mem[TMP]) < 0) {
+                    set_flag(S, 1);
+                }
+                else {
+                    set_flag(S, 0);
+                }
+                A = A - mem[TMP];
+                set_zp(A);
+                break;
+        }
+    }
+}
+
+/* 0xB8 - SUBB A, R0
+ * 0xB9 - SUBB A, R1
+ * 0xBA - SUBB A, R2
+ * 0xBB - SUBB A, R3
+ * 0xBC - SUBB A, DPH
+ * 0xBD - SUBB A, DPL
+ * 0xBE - SUBB A, #data8
+ * 0xBF - SUBB A, @DPTR */
+void
+SUBB(void) {
+    if (NNN < 6) {
+        if ((A - get_reg(NNN) - get_flag(C)) < 0){
+            set_flag(C, 1);
+        }
+        else {
+            set_flag(C, 0);
+        }
+        A = A - get_reg(NNN) -get_flag(C);
+        set_zp(A);
+    }
+    else {
+        switch (NNN) {
+            
+            case 6:
+                tmpb = fetch();
+                if ((A - tmpb - get_flag(C)) < 0) {
+                    set_flag(C, 1);
+                }
+                else {
+                    set_flag(C, 0);
+                }
+                A = A - tmpb - get_flag(C);
+                set_zp(A);
+                break;
+
+            case 7:
+                set_wide(TMP, get_wide(DPTR));
+                if ((A - mem[TMP] - get_flag(C)) < 0) {
+                    set_flag(C, 1);
+                }
+                else {
+                    set_flag(C, 0);
+                }
+                A = A - mem[TMP] - get_flag(C);
+                set_zp(A);
+                break;
+        }
+    }
+}
+
+void
+PJMP(void) {
+    /* implement me */
+}
+
+void
+PCALL(void) {
+    /* implement me */
+}
+
+/* 0xD0 - DJNZ R0, rel8
+ * 0xD1 - DJNZ R1, rel8
+ * 0xD2 - DJNZ R2, rel8
+ * 0xD3 - DJNZ R3, rel8 */
+void
+DJNZ(void) {
+    set_reg(NNN, get_reg(NNN) - 1);
+    if (get_reg(NNN) == 0) {
+        set_wide(PC, get_wide(PC) + (signed char)fetch() - 1);
+    }
+    else {
+        inc_pc(1);
+    }
+}
+
+/* 0xD4 - CJNE R0, #data, rel8
+ * 0xD5 - CJNE R1, #data, rel8
+ * 0xD6 - CJNE R2, #data, rel8
+ * 0xD7 - CJNE R3, #data, rel8 
+ * 0xDF - CJNE A, #data8, rel8 */
+void
+CJNE(void) {
+    switch(IR) {
+        
+        case 0xDF:
+             tmpb = fetch();
+            if (tmpb != A) {
+                set_wide(PC, get_wide(PC) + (signed char)fetch() - 1);
+            }
+            else {
+                inc_pc(1);
+            }
+            break;
+
+
+        default:
+            tmpb = fetch();
+            if (tmpb != get_reg(NNN - 4)) {
+                set_wide(PC, get_wide(PC) + (signed char)fetch() - 1);
+            }
+            else {
+                inc_pc(1);
+            }
+            break;
+    }
+}
+
+/* 0xD8 - LJMP addr16 */
+void
+LJMP(void) {
+    set_wide(PC, fetch_wide());
+}
+
+/* 0xD9 - LCALL addr16 */
+void
+LCALL(void) {
+    /* push PC to stack */
+    mem[get_wide(SP)] = get_reg(PCL);
+    set_wide(SP, get_wide(SP) + 1);
+    mem[get_wide(SP)] = get_reg(PCH);
+    set_wide(SP, get_wide(SP) + 1);
+    /* jmp */
+    set_wide(PC, fetch_wide());
+}
+
+/* 0xDA - RET */
+void
+RET(void) {
+    /* get PC from stack */
+    set_wide(SP, get_wide(SP) - 1);
+    tmpb = mem[get_wide(SP)]; /* PCH */
+    set_wide(SP, get_wide(SP) - 1);
+    set_wide(PC, MWIDE(tmpb, mem[get_wide(SP)]));
+}
+
+void
+RETI(void) {
+    /* implement me */
+}
+
+/* 0xDC - SJMP rel8 */
+void
+SJMP(void) {
+    /* -1 because the fetch() increments the PC */
+    set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
+}
+
+/* 0xDD - JMP @A+DPTR
+ * 0xDE - JMP @DPTR */
+void
+JMP(void) {
+    switch(IR) {
+        
+        case 0xDD:
+            set_wide(PC, A + get_wide(DPTR));
+            break;
+        
+        case 0xDE:
+            set_wide(PC, get_wide(DPTR));
+            break;
+    }
+}
+
+/* 0xE0 - JZ rel8 */
+void
+JZ(void) {
+    if (get_flag(Z) == 1) {
+        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
+    }
+    /* skip rel8 if jump not needed */
+    else {
+        inc_pc(1);
+    }
+}
+
+/* 0xE1 - JNZ rel8 */
+void
+JNZ(void) {
+    if (get_flag(Z) == 0) {
+        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
+    }
+    else {
+        inc_pc(1);
+    }
+}
+
+/* 0xE2 - JC rel8 */
+void
+JC(void) {
+    if (get_flag(C) == 1) {
+        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
+    }
+    else {
+        inc_pc(1);
+    }
+}
+
+/* 0xE3 - JNC rel8 */
+void
+JNC(void) {
+    if (get_flag(C) == 0) {
+        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
+    }
+    else {
+        inc_pc(1);
+    }
+}
+
+/* 0xE4 - JPO rel8 */
+void
+JPO(void) {
+    /* P = 1 when parity even */
+    if (get_flag(P) == 0) {
+        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
+    }
+    else {
+        inc_pc(1);
+    }
+
+}
+
+/* 0xE5 - JPE rel8 */
+void
+JPE(void) {
+    if (get_flag(P) == 1) {
+        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
+    }
+    else {
+        inc_pc(1);
+    }
+}
+
+/* 0xE6 - JS rel8 */
+void
+JS(void) {
+    if (get_flag(S) == 1) {
+        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
+    }
+    else {
+        inc_pc(1);
+    }
+}
+
+/* 0xE7 - JNS rel8 */
+void
+JNS(void) {
+    if (get_flag(S) == 0) {
+        set_wide(PC, get_wide(PC) + (signed char)fetch() -1);
+    }
+    else {
+        inc_pc(1);
+    }
+}
+
+/* 0xE8 - PUSH R0
+ * 0xE9 - PUSH R1
+ * 0xEA - PUSH R2
+ * 0xEB - PUSH R3
+ * 0xEC - PUSH DPH
+ * 0xED - PUSH DPL
+ * 0xEE - PUSH A
+ * 0xEF - PUSH FLAGS */
+void
+PUSH(void) {
+    if (NNN < 6) {
+        mem[get_wide(SP)] = get_reg(NNN);
+        set_wide(SP, get_wide(SP) + 1);
+
+    }
+    else {
+        switch(IR) {
+            
+            case 0xEE:
+                mem[get_wide(SP)] = A;
+                set_wide(SP, get_wide(SP) + 1);
+                break;
+
+            case 0xEF:
+                mem[get_wide(SP)] = flags;
+                set_wide(SP, get_wide(SP) + 1);
+                break;
+
+            default:
+                break;
+        }
+    }
+}
+
+/* 0xF0 - POP R0
+ * 0xF1 - POP R1
+ * 0xF2 - POP R2
+ * 0xF3 - POP R3
+ * 0xF4 - POP DPH
+ * 0xF5 - POP DPL
+ * 0xF6 - POP A
+ * 0xF7 - POP FLAGS */
+void
+POP(void) {
+    if (NNN < 6) {
+        set_wide(SP, get_wide(SP) - 1);
+        set_reg(NNN, mem[get_wide(SP)]);
+    }
+    else {
+        switch(IR) {
+            
+            case 0xF6:
+                set_wide(SP, get_wide(SP) - 1);
+                A = mem[get_wide(SP)];
+                break;
+
+            case 0xF7:
+                set_wide(SP, get_wide(SP) - 1);
+                flags = mem[get_wide(SP)];
+                break;
+
+            default:
+                break;
+        }
+    }
+}
+
+
+/* 0xF8 - MUL R0, R1 */
+void
+MUL(void) {
+ /* implement me */    
+}
+
+/* 0xF9 - DIV R0, R1 */
+void
+DIV(void) {
+ /* implement me */   
+}
+
+/* 0xFA - DA A */
+void
+DA(void) {
+ /* implement me */
+}
+
+/* 0xFC - IN port_addr */
+void
+IN(void) {
+ /* implement me */   
+}
+
+/* 0xFD - OUT port_addr */
+void
+OUT(void) {
+ /* implement me */
+}
+
+/* 0xFE INT vect8 */
+void
+INT(void) {
+ /* implement me */    
+}
+
+/* 0xFF - HLT */
+void
+HLT(void) {
+ /* implement me */
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emu52/src/iset.h	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,163 @@
+/* iset.h
+ * op function definitions */
+#ifndef ISET_H
+#define ISET_H
+
+#if defined MAIN
+#define EXTERN
+#else
+#define EXTERN extern
+#endif
+
+
+/* instruction pointer table */
+typedef struct {
+    void (*ops[256])(void);
+} FUNCTION_TABLE;
+
+EXTERN void
+JNS(void);
+
+EXTERN void
+LJMP(void);
+
+EXTERN void
+SET(void);
+
+EXTERN void
+JPO(void);
+
+EXTERN void
+ANL(void);
+
+EXTERN void
+JNZ(void);
+
+EXTERN void
+HLT(void);
+
+EXTERN void
+RRC(void);
+
+EXTERN void
+POP(void);
+
+EXTERN void
+JNC(void);
+
+EXTERN void
+SUBB(void);
+
+EXTERN void
+PCALL(void);
+
+EXTERN void
+IN(void);
+
+EXTERN void
+INC(void);
+
+EXTERN void
+XRL(void);
+
+EXTERN void
+SUB(void);
+
+EXTERN void
+RR(void);
+
+EXTERN void
+SJMP(void);
+
+EXTERN void
+RETI(void);
+
+EXTERN void
+RET(void);
+
+EXTERN void
+INT(void);
+
+EXTERN void
+ADD(void);
+
+EXTERN void
+ADDC(void);
+
+EXTERN void
+RL(void);
+
+EXTERN void
+MUL(void);
+
+EXTERN void
+JC(void);
+
+EXTERN void
+JMP(void);
+
+EXTERN void
+DJNZ(void);
+
+EXTERN void
+CLR(void);
+
+EXTERN void
+JZ(void);
+
+EXTERN void
+JPE(void);
+
+EXTERN void
+LAF(void);
+
+EXTERN void
+MOV(void);
+
+EXTERN void
+RLC(void);
+
+EXTERN void
+JS(void);
+
+EXTERN void
+ORL(void);
+
+EXTERN void
+CJNE(void);
+
+EXTERN void
+XCSD(void);
+
+EXTERN void
+LCALL(void);
+
+EXTERN void
+DA(void);
+
+EXTERN void
+NOP(void);
+
+EXTERN void
+SFA(void);
+
+EXTERN void
+CPL(void);
+
+EXTERN void
+PUSH(void);
+
+EXTERN void
+DIV(void);
+
+EXTERN void
+DEC(void);
+
+EXTERN void
+OUT(void);
+
+EXTERN void
+PJMP(void);
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emu52/src/main.c	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,230 @@
+#include <stdio.h>
+#include <reg52.h>
+
+#define MAIN
+#include "mem.h"
+#include "iset.h"
+
+/* fill instruction table 
+ * MCS-51 - this needs to be stored in code memory */
+
+FUNCTION_TABLE const code iset = {
+    NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP,
+    SET, CLR, SET, CLR, SET, CLR, CPL, CPL,
+    XCSD, SFA, LAF, MOV, MOV, MOV, MOV, MOV,
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+    MOV, MOV, MOV, MOV, MOV, MOV, MOV, MOV,
+    ANL, ANL, ANL, ANL, ANL, ANL, ANL, ANL,
+    ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL,
+    XRL, XRL, XRL, XRL, XRL, XRL, XRL, XRL,
+    RL, RLC, RR, RRC, INC, DEC, INC, DEC,
+    ADD, ADD, ADD, ADD, ADD, ADD, ADD, ADD,
+    ADDC, ADDC, ADDC, ADDC, ADDC, ADDC, ADDC, ADDC,
+    SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB,
+    SUBB, SUBB, SUBB, SUBB, SUBB, SUBB, SUBB, SUBB,
+    PJMP, PJMP, PJMP, PJMP, PJMP, PJMP, PJMP, PJMP,
+    PCALL, PCALL, PCALL, PCALL, PCALL, PCALL, PCALL, PCALL,
+    DJNZ, DJNZ, DJNZ, DJNZ, CJNE, CJNE, CJNE, CJNE,
+    LJMP, LCALL, RET, RETI, SJMP, JMP, JMP, CJNE,
+    JZ, JNZ, JC, JNC, JPO, JPE, JS, JNS,
+    PUSH, PUSH, PUSH, PUSH, PUSH, PUSH, PUSH, PUSH,
+    POP, POP, POP, POP, POP, POP, POP, POP,
+    MUL, DIV, DA, NOP, IN, OUT, INT, HLT
+}; 
+
+BYTE pause;     /* becomes 1 when we hit a break point in run mode */
+BYTE free_run;  /* free run if not 0 */
+BYTE pause;     /* pause flag */
+WIDE addrc;        /* address counter */
+BYTE args[4];   /* dbg args */
+
+WIDE bp[8] = {  0xFFFF,
+                0xFFFF,
+                0xFFFF,
+                0xFFFF,
+                0xFFFF,
+                0xFFFF,
+                0xFFFF,
+                0xFFFF
+};
+
+
+void
+snd(BYTE c) {
+putchar(c);
+}
+
+BYTE
+rcv(void) {
+    return getchar();
+}
+
+void
+step(void) {
+    IR = fetch();
+    iset.ops[IR]();  
+}
+
+void
+run(void) {
+    while (pause != 1) {
+        step();
+        for (addrc = 0; addrc < 8; addrc++) {
+            if (bp[addrc] == get_wide(PC)) {
+                pause = 1;
+            }
+        }
+    }
+}
+
+void controller() {
+    if (free_run == 0) {
+            switch (rcv()) {
+
+                /* step */
+                case 0x00:
+                    step();
+                    break;
+
+                /* run for length steps*/
+                case 0x01:
+                    run();
+                    break;
+
+                /* set reg */
+                case 0x02:
+                    args[0] = rcv(); /* reg */
+                    args[1] = rcv(); /* val */
+                    regs[args[0]] = args[1];
+                    break;
+
+                /* get reg */
+                case 0x03:
+                    args[0] = rcv(); /* reg */
+                    snd(regs[args[0]]);
+                    break;
+
+                /* set flag */
+                case 0x04:
+                    args[0] = rcv(); /* flag */
+                    args[1] = rcv(); /* on? */
+                    set_flag(args[0], args[1]);
+                    break;
+        
+                /* get flag */
+                case 0x05:
+                    args[0] = rcv(); /* flag */
+                    snd(get_flag(args[0]));
+                    break;
+
+                /* write mem block */
+                case 0x06:
+                    args[0] = rcv(); /* addr high */
+                    args[1] = rcv(); /* addr low */
+                    args[2] = rcv(); /* length high */
+                    args[3] = rcv(); /* length low */
+                    tmpw = MWIDE(args[0], args[1]);         
+                    for (addrc = tmpw; addrc < tmpw + MWIDE(args[2], args[3]); addrc++) { 
+                        if (addrc >= 0xFFFF) {
+                            break;
+                        }
+                        mem[addrc] = rcv();
+                    }
+                    break;
+
+                /* read mem block */
+                case 0x07:
+                    args[0] = rcv(); /* addr high */
+                    args[1] = rcv(); /* addr low */
+                    args[2] = rcv(); /* length high */
+                    args[3] = rcv(); /* length low */
+                    tmpw = MWIDE(args[0], args[1]);         
+                    for (addrc = tmpw; addrc < tmpw + MWIDE(args[2], args[3]); addrc++) { 
+                        if (addrc >= 0xFFFF) {
+                            break;
+                        }
+                        snd(mem[addrc]);
+                    }
+                    break;
+
+                /* get A */
+                case 0x08:
+                    snd(A);
+                    break;
+                
+                /* get flags */
+                case 0x09:
+                    snd(flags);
+                    break;
+                
+                /* get instruction register */
+                case 0x0A:
+                    snd(IR);
+                    break;
+               
+		/* run for length */
+                case 0x0B:
+                    args[0] = rcv(); /* length high */
+                    args[1] = rcv(); /* length low */
+                    for (tmpw = 0 ; tmpw < MWIDE(args[0], args[1]) ; tmpw++) {
+                        step();
+                    }
+                    break;
+
+                case 0x0C:
+                    free_run = 1;
+                    break;
+                
+                /* set break point */
+                case 0x0D:
+                    args[0] = rcv(); /* bp index */
+                    args[1] = rcv(); /* address high */
+                    args[2] = rcv(); /* address low */
+                    if (args[0] > 7) {
+                        break;
+                    }
+                    bp[args[0]] = MWIDE(args[1], args[2]);
+                    break;
+                
+                /* test cmd */
+                case 0x54:
+                    snd('A');
+                    break;
+           }
+        }
+    else {
+        step();
+    }
+}
+
+void 
+main(void) {
+     /* serial set up
+     * SCON - mode 1, 8-bit UART, enable rcvr
+     * TMOD - timer 1, mode 2, 8-bit reload
+     * TH1 - reload value for 1200 baud @ 12MHz
+     * TR1 - timer 1 run
+     * TI - set TI to send first char of UART */
+    /* dont go into free run on restart */
+    free_run = 0;
+    SCON  = 0x50;
+    TMOD |= 0x20;
+    TH1   = 0xE8;
+    TR1   = 1;
+    TI    = 1;
+    for (;;) {
+        controller();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emu52/src/mem.c	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,142 @@
+/* mem.c
+ * functions for accessing emulator memory */
+#include "mem.h"
+
+/* get flag value
+ * if invalid flag is requested value is 0 */
+BYTE
+get_flag(BYTE flag) {
+    if (flag > 7) {
+        return 0;
+    }
+    else {
+        return GBIT(flags, flag);
+    }
+}
+
+/*  set flag to 0 if on == 0
+ *  otherwise set flag to 1 */
+void
+set_flag(BYTE flag, BYTE on) {
+    if (flag <= 7) {
+        if (on == 0x00) {
+            flags = CBIT(flags, flag);
+        }
+        else {
+            flags = SBIT(flags, flag);
+        }
+    }
+}
+
+/* sets zero and parity flags based on content of byte */
+void
+set_zp(BYTE val){
+    if (val == 0) {
+        set_flag(Z, 1);
+        set_flag(P, 0);
+    }
+    else {
+        /* check parity
+         * think of this as folding */
+        val ^= val >> 4;
+        val ^= val >> 2;
+        val ^= val >> 1;
+        val &= 1;
+        if (val == 0) {
+            set_flag(P, 1);
+        }
+        else {
+            set_flag(P, 0);
+        }
+    }
+}
+
+WIDE
+get_wide(BYTE reg) {
+    /* high, low */
+    return MWIDE(regs[reg + 4], regs[reg + 12]);
+}
+
+void
+set_wide(BYTE reg, WIDE val) {
+    regs[reg + 4] = GHIGH(val); /* high */
+    regs[reg + 12] = GLOW(val); /* low */
+}
+
+void 
+inc_pc(BYTE n) {
+    if ((regs[PCL] + n) > 0xFF) {
+        regs[PCH]++;
+    }
+    regs[PCL] += n;
+}
+
+BYTE 
+fetch(void) {
+    BYTE val = mem[get_wide(PC)];
+    inc_pc(1);
+    return val;
+}
+
+WIDE
+fetch_wide(void) {
+    WIDE val = MWIDE(mem[get_wide(PC)], mem[get_wide(PC) + 1]);
+    inc_pc(2);
+    return val;
+}
+
+/* 0b000 = R0
+ * 0b001 = R1
+ * 0b010 = R2
+ * 0b011 = R3
+ * 0b100 = DPH
+ * 0b101 = DPL
+ * 0b110 = SPH
+ * 0b111 = SPL */
+BYTE 
+get_reg(BYTE reg) {
+    if (reg < 4) {
+        return regs[reg | (get_flag(BS) << 3)];
+    }
+    else {
+        switch (reg) {
+            
+            case 4:
+                return regs[DPH];
+            case 5:
+                return regs[DPL];
+            case 6:
+                return regs[SPH];
+            case 7:
+                return regs[SPL];
+            default:
+                return 0;
+        }
+    }
+}
+
+void
+set_reg(BYTE reg, BYTE val) {
+    if (reg < 4) {
+        regs[reg | (get_flag(BS) << 3)] = val;
+    }
+    else {
+        switch (reg) {
+            
+            case 4:
+                regs[DPH] = val;
+                break;
+            case 5:
+                regs[DPL] = val;
+                break;
+            case 6:
+                regs[SPH] = val;
+                break;
+            case 7:
+                regs[SPL] = val;
+                break;
+            default:
+                break;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emu52/src/mem.h	Mon Apr 21 19:37:21 2014 +0100
@@ -0,0 +1,133 @@
+/* mem.h */
+#ifndef MEM_H
+#define MEM_H
+
+#if defined MAIN
+#define EXTERN
+#else
+#define EXTERN extern
+#endif
+
+/* 8 bit register encodings */
+#define R0   (0 | (get_flag(0) << 3))
+#define R1   (1 | (get_flag(0) << 3))
+#define R2   (2 | (get_flag(0) << 3))
+#define R3   (3 | (get_flag(0) << 3))
+#define DPH  4
+#define SPH  5
+#define PCH  6 
+#define TMPH 7
+#define DPL  12
+#define SPL  13
+#define PCL  14
+#define TMPL 15
+
+/* 16 bit register encodings */ 
+#define DPTR 0 
+#define SP   1 
+#define PC   2 
+#define TMP  3 
+ 
+/* flag bits numbered from LSB -> MSB 
+ *  7 6 5  4 3 2  1  0 
+ *  C Z AC P S OV IE BS */
+#define BS 0
+#define IE 1
+#define OV 2
+#define S  3
+#define P  4
+#define AC 5
+#define Z  6
+#define C  7
+
+/* for getting and setting flags */ 
+#define GBIT(byte, n) (byte & (0x01 << n) ? 1 : 0)  
+#define SBIT(byte, n) (byte | (0x01 << n)) 
+#define CBIT(byte, n) (byte ^ (0x01 << n)) 
+
+/* for making and breaking 16 bit values */
+#define MWIDE(high, low) (low | (high << 8))
+#define GHIGH(wide) ((wide >> 8) & 0xFF)
+#define GLOW(wide) (wide & 0xFF) 
+
+typedef unsigned char BYTE;
+typedef unsigned short WIDE;
+
+/* these are needed for some operations */
+EXTERN BYTE tmpb;
+EXTERN WIDE tmpw;
+
+EXTERN BYTE IR;
+EXTERN BYTE A;
+EXTERN BYTE flags;
+
+/*  0x00 0b0000 r0 bank 0
+    0x01 0b0001 r1 bank 0
+    0x02 0b0010 r2 bank 0
+    0x03 0b0011 r3 bank 0
+    0x04 0b0100 dph
+    0x05 0b0101 sph
+    0x06 0b0110 pch
+    0x07 0b0111 tmph
+    0x08 0b1000 r0 bank 1
+    0x09 0b1001 r1 bank 1
+    0x0A 0b1010 r2 bank 1
+    0x0B 0b1011 r3 bank 1
+    0x0C 0b1100 dpl
+    0x0D 0b1101 spl
+    0x0E 0b1110 pcl
+    0x0F 0b1111 tmpl */
+EXTERN BYTE regs[0x10];
+
+/* 32K Von Neumann memory */
+EXTERN BYTE xdata mem[0x8000];
+
+/* functions to dealing with flags */
+EXTERN BYTE
+get_flag(BYTE flag);
+
+EXTERN void
+set_flag(BYTE flag, BYTE on);
+
+EXTERN void
+set_zp(BYTE val);
+
+/* this function a byte and returns a byte
+ * with zero and parity flags set or unset.
+ * result should be or'd with flags reg */
+EXTERN BYTE
+gen_flags(BYTE val);
+
+/* functions for dealing with 16-bit registers
+ * access the 16 bit registers.
+ * register map for these function:
+ *   0b00 dptr
+ *   0b01 sp
+ *   0b10 pc
+ *   0b11 tmp */
+EXTERN WIDE
+get_wide(BYTE reg);
+
+EXTERN void
+set_wide(BYTE reg, WIDE val);
+
+/* functions to fetch data at PC */
+EXTERN void
+inc_pc(BYTE n);
+
+EXTERN BYTE
+fetch();
+
+EXTERN WIDE
+fetch_wide();
+
+/* for mapping the register encoding in the instruction
+ * set to the register address */
+EXTERN BYTE
+get_reg(BYTE reg);
+
+EXTERN void
+set_reg(BYTE reg, BYTE val);
+
+
+#endif