changeset 6:3c8b4a4a1787

added some scratch-code for the emulator Wrote my interim report
author james <jb302@eecs.qmul.ac.uk>
date Sat, 07 Dec 2013 16:35:13 +0000
parents d8d210fc1ad9
children 4549109a0d1e
files doc/images/emu.svg doc/report.odt doc/report.pdf emulator/emu.c emulator/emu.h emulator/mem.c
diffstat 6 files changed, 742 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/images/emu.svg	Sat Dec 07 16:35:13 2013 +0000
@@ -0,0 +1,664 @@
+<?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"
+   width="500"
+   height="400"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="emu.svg">
+  <defs
+     id="defs4">
+    <marker
+       inkscape:stockid="Arrow1Mend"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="Arrow1Mend"
+       style="overflow:visible;">
+      <path
+         id="path4906"
+         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
+         transform="scale(0.4) rotate(180) translate(10,0)" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow2Mstart"
+       orient="auto"
+       refY="0.0"
+       refX="0.0"
+       id="Arrow2Mstart"
+       style="overflow:visible">
+      <path
+         id="path4921"
+         style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
+         d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+         transform="scale(0.6) translate(0,0)" />
+    </marker>
+    <linearGradient
+       inkscape:collect="always"
+       id="linearGradient4826">
+      <stop
+         style="stop-color:#000000;stop-opacity:1;"
+         offset="0"
+         id="stop4828" />
+      <stop
+         style="stop-color:#000000;stop-opacity:0;"
+         offset="1"
+         id="stop4830" />
+    </linearGradient>
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient4826"
+       id="linearGradient4832"
+       x1="232.08955"
+       y1="810.57111"
+       x2="232.08955"
+       y2="819.52637"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="translate(45.196549,10.716418)" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1.34"
+     inkscape:cx="263.14902"
+     inkscape:cy="200"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1120"
+     inkscape:window-height="879"
+     inkscape:window-x="36"
+     inkscape:window-y="19"
+     inkscape:window-maximized="0" />
+  <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,-652.36218)">
+    <text
+       xml:space="preserve"
+       style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       x="150.05325"
+       y="920.87207"
+       id="text3125-8"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         x="150.05325"
+         y="920.87207"
+         id="tspan3129-49" /></text>
+    <g
+       transform="translate(0,26)"
+       id="g4358" />
+    <text
+       sodipodi:linespacing="125%"
+       id="text3215"
+       y="696.13025"
+       x="188.65637"
+       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"
+       xml:space="preserve"><tspan
+         y="696.13025"
+         x="188.65637"
+         id="tspan3217"
+         sodipodi:role="line">|--------|</tspan></text>
+    <text
+       sodipodi:linespacing="125%"
+       id="text3219"
+       y="681.35858"
+       x="216.22769"
+       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"
+       xml:space="preserve"><tspan
+         y="681.35858"
+         x="216.22769"
+         id="tspan3221"
+         sodipodi:role="line">|-------- --------|</tspan></text>
+    <text
+       sodipodi:linespacing="125%"
+       id="text3350"
+       y="696.21326"
+       x="88.904503"
+       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"
+       xml:space="preserve"><tspan
+         y="696.21326"
+         x="88.904503"
+         id="tspan3352"
+         sodipodi:role="line">BYTE (unsigned char):</tspan></text>
+    <text
+       sodipodi:linespacing="125%"
+       id="text3350-3"
+       y="681.44586"
+       x="91.822601"
+       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"
+       xml:space="preserve"><tspan
+         y="681.44586"
+         x="91.822601"
+         id="tspan3352-5"
+         sodipodi:role="line">WIDE (unsigned short):</tspan></text>
+    <rect
+       y="728.77649"
+       x="161.2915"
+       height="15.540541"
+       width="54.729729"
+       id="rect2993"
+       style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-opacity:1" />
+    <rect
+       y="753.67468"
+       x="161.2915"
+       height="15.540541"
+       width="54.729729"
+       id="rect2993-4"
+       style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-opacity:1" />
+    <rect
+       y="778.4903"
+       x="161.2915"
+       height="15.540541"
+       width="54.729729"
+       id="rect2993-9"
+       style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-opacity:1" />
+    <rect
+       y="803.30597"
+       x="161.2915"
+       height="15.540541"
+       width="54.729729"
+       id="rect2993-9-0"
+       style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-opacity:1" />
+    <text
+       sodipodi:linespacing="125%"
+       id="text3097"
+       y="740.18689"
+       x="182.61389"
+       style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       xml:space="preserve"><tspan
+         y="740.18689"
+         x="182.61389"
+         id="tspan3099"
+         sodipodi:role="line">R0</tspan></text>
+    <text
+       sodipodi:linespacing="125%"
+       id="text3125"
+       y="765.08997"
+       x="182.62854"
+       style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       xml:space="preserve"><tspan
+         y="765.08997"
+         x="182.62854"
+         id="tspan3127"
+         sodipodi:role="line">R1</tspan><tspan
+         id="tspan3129"
+         y="777.58997"
+         x="182.62854"
+         sodipodi:role="line" /></text>
+    <text
+       sodipodi:linespacing="125%"
+       id="text3125-4"
+       y="814.71637"
+       x="182.66516"
+       style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       xml:space="preserve"><tspan
+         y="814.71637"
+         x="182.66516"
+         id="tspan3127-2"
+         sodipodi:role="line">R3</tspan><tspan
+         id="tspan3129-8"
+         y="827.21637"
+         x="182.66516"
+         sodipodi:role="line" /></text>
+    <text
+       sodipodi:linespacing="125%"
+       id="text3125-9"
+       y="789.9715"
+       x="182.71399"
+       style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       xml:space="preserve"><tspan
+         y="789.9715"
+         x="182.71399"
+         id="tspan3127-26"
+         sodipodi:role="line">R2</tspan><tspan
+         id="tspan3129-1"
+         y="802.4715"
+         x="182.71399"
+         sodipodi:role="line" /></text>
+    <g
+       transform="translate(143.94542,-64.05128)"
+       id="g3312">
+      <rect
+         style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-opacity:1"
+         id="rect2993-3"
+         width="54.729729"
+         height="15.540541"
+         x="16.929052"
+         y="890.68341" />
+      <text
+         xml:space="preserve"
+         style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+         x="35.268036"
+         y="902.09869"
+         id="text3125-48"
+         sodipodi:linespacing="125%"><tspan
+           sodipodi:role="line"
+           id="tspan3127-1"
+           x="35.268036"
+           y="902.09869">DPH</tspan><tspan
+           sodipodi:role="line"
+           x="35.268036"
+           y="914.59869"
+           id="tspan3199" /><tspan
+           sodipodi:role="line"
+           x="35.268036"
+           y="927.09869"
+           id="tspan3129-4" /></text>
+      <g
+         id="g3285"
+         transform="translate(-8,0)">
+        <rect
+           y="890.68341"
+           x="80.351707"
+           height="15.540541"
+           width="54.729729"
+           id="rect2993-3-0"
+           style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-opacity:1" />
+        <text
+           sodipodi:linespacing="125%"
+           id="text3125-49"
+           y="902.09869"
+           x="98.580826"
+           style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+           xml:space="preserve"><tspan
+             y="902.09869"
+             x="98.580826"
+             id="tspan3127-0"
+             sodipodi:role="line">DLP</tspan><tspan
+             id="tspan3129-85"
+             y="914.59869"
+             x="98.580826"
+             sodipodi:role="line" /></text>
+      </g>
+    </g>
+    <rect
+       y="847.39178"
+       x="161.30241"
+       height="15.144198"
+       width="109.50317"
+       id="rect2993-4-7"
+       style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:1.39634192;stroke-opacity:1" />
+    <text
+       sodipodi:linespacing="125%"
+       id="text3203"
+       y="858.604"
+       x="209.92119"
+       style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       xml:space="preserve"><tspan
+         id="tspan3207"
+         y="858.604"
+         x="209.92119"
+         sodipodi:role="line">SP</tspan></text>
+    <text
+       sodipodi:linespacing="125%"
+       id="text3211"
+       y="877.59204"
+       x="209.9456"
+       style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       xml:space="preserve"><tspan
+         y="877.59204"
+         x="209.9456"
+         id="tspan3213"
+         sodipodi:role="line">PC</tspan></text>
+    <rect
+       y="866.37982"
+       x="161.30241"
+       height="15.144198"
+       width="109.50317"
+       id="rect2993-4-7-4"
+       style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:1.39634192;stroke-opacity:1" />
+    <rect
+       y="894.6955"
+       x="25.191351"
+       height="84.615387"
+       width="246.79488"
+       id="rect3418"
+       style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:4, 4;stroke-dashoffset:0" />
+    <text
+       sodipodi:linespacing="125%"
+       id="text4188"
+       y="931.78882"
+       x="148.9093"
+       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"
+       xml:space="preserve"><tspan
+         y="931.78882"
+         x="148.9093"
+         id="tspan4190"
+         sodipodi:role="line">64kB 16-bit Addressable main memory</tspan></text>
+    <text
+       sodipodi:linespacing="125%"
+       id="text4396"
+       y="718.94507"
+       x="188.65427"
+       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"
+       xml:space="preserve"><tspan
+         y="718.94507"
+         x="188.65427"
+         id="tspan4398"
+         sodipodi:role="line">A</tspan></text>
+    <rect
+       style="fill:#000000;fill-opacity:0;stroke:#000000;stroke-opacity:1"
+       id="rect2993-7"
+       width="54.729729"
+       height="15.540541"
+       x="161.29184"
+       y="707.52979" />
+    <text
+       sodipodi:linespacing="125%"
+       id="text4499"
+       y="719.96576"
+       x="329.89075"
+       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"
+       xml:space="preserve"><tspan
+         y="719.96576"
+         x="329.89075"
+         id="tspan4501"
+         sodipodi:role="line">set_reg(reg, BYTE)</tspan></text>
+    <text
+       sodipodi:linespacing="125%"
+       id="text4503"
+       y="838.04767"
+       x="397.20667"
+       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"
+       xml:space="preserve"><tspan
+         y="838.04767"
+         x="397.20667"
+         id="tspan4505"
+         sodipodi:role="line">set_reg_wide(reg, WIDE)</tspan></text>
+    <text
+       xml:space="preserve"
+       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"
+       x="341.28357"
+       y="876.0498"
+       id="text4211"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan4213"
+         x="341.28357"
+         y="876.0498">fetch() -&gt; WIDE</tspan></text>
+    <text
+       xml:space="preserve"
+       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"
+       x="365.26276"
+       y="937.85468"
+       id="text4215"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan4217"
+         x="368.27057"
+         y="937.85468">read_mem(WIDE) -&gt; BYTE </tspan></text>
+    <text
+       xml:space="preserve"
+       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"
+       x="364.02252"
+       y="950.1759"
+       id="text4215-8"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan4217-3"
+         x="367.03033"
+         y="950.1759">write_mem(WIDE, BYTE) </tspan></text>
+    <text
+       xml:space="preserve"
+       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"
+       x="331.66476"
+       y="887.59918"
+       id="text4215-8-7"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan4217-3-9"
+         x="334.67258"
+         y="887.59918">set_pc(WIDE) </tspan></text>
+    <text
+       xml:space="preserve"
+       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"
+       x="409.67166"
+       y="1003.7651"
+       id="text4610"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         x="409.67166"
+         y="1003.7651"
+         id="tspan4614">op = fetch()</tspan></text>
+    <text
+       xml:space="preserve"
+       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"
+       x="432.73221"
+       y="1015.718"
+       id="text4610-1"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         x="432.73221"
+         y="1015.718"
+         id="tspan4614-1">execute(decode(op))}</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline"
+       d="m 216.02157,63.161394 33.23216,0.271442"
+       id="path4748"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#rect2993-7"
+       inkscape:connection-start-point="d4"
+       transform="translate(0,652.36218)" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 216.02123,83.909112 248.50746,83.58209"
+       id="path4768"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#rect2993"
+       inkscape:connection-start-point="d4"
+       transform="translate(0,652.36218)" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 216.02123,108.34205 32.48623,-0.87936"
+       id="path4770"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#rect2993-4"
+       inkscape:connection-start-point="d4"
+       transform="translate(0,652.36218)" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 216.02123,133.75194 31.73996,-0.16985"
+       id="path4772"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#rect2993-9"
+       inkscape:connection-start-point="d4"
+       transform="translate(0,652.36218)" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1.01195955px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 216.02721,810.83341 33.22055,-0.25629"
+       id="path4774"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1.01189673px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 249.52239,811.06663 0,-94.75218"
+       id="path4776"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <text
+       sodipodi:linespacing="125%"
+       id="text4499-2"
+       y="732.58887"
+       x="336.36832"
+       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"
+       xml:space="preserve"><tspan
+         y="732.58887"
+         x="339.37613"
+         id="tspan4501-5"
+         sodipodi:role="line">get_reg(reg) -&gt; BYTE </tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 247.76119,715.55621 24.62687,0"
+       id="path4803"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <text
+       sodipodi:linespacing="125%"
+       id="text4503-6"
+       y="853.00677"
+       x="397.20667"
+       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:url(#linearGradient4832);fill-opacity:1;stroke:none;font-family:DejaVu Sans Mono;-inkscape-font-specification:DejaVu Sans Mono"
+       xml:space="preserve"><tspan
+         y="853.00677"
+         x="397.20667"
+         id="tspan4505-4"
+         sodipodi:role="line"
+         style="fill:url(#linearGradient4832);fill-opacity:1">set_reg(reg, WIDE)</tspan></text>
+    <text
+       sodipodi:linespacing="125%"
+       id="text4503-1"
+       y="850.02167"
+       x="403.66174"
+       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"
+       xml:space="preserve"><tspan
+         y="850.02167"
+         x="403.66174"
+         id="tspan4505-47"
+         sodipodi:role="line">get_reg_wide(reg) -&gt; WIDE</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.52723652px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 269.78824,872.51143 23.85635,0"
+       id="path4855"
+       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"
+       d="m 291.97015,860.57114 0,0"
+       id="path4857"
+       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"
+       d="m 270.80558,202.34192 21.73173,-0.10311"
+       id="path4869"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#rect2993-4-7"
+       inkscape:connection-start-point="d4"
+       transform="translate(0,652.36218)" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 271.02686,182.07635 20.01792,0.0131"
+       id="path4871"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#g3312"
+       inkscape:connection-start-point="d4"
+       transform="translate(0,652.36218)" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.93708032px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 293.04478,855.1457 0,-20.97002"
+       id="path4873"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.91589546px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 271.51019,834.76244 52.3229,-0.83037"
+       id="path4877"
+       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"
+       d="m 271.98623,283.12498 23.53616,-0.28916"
+       id="path4879"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       inkscape:connection-start="#rect3418"
+       inkscape:connection-start-point="d4"
+       transform="translate(0,652.36218)" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Mstart)"
+       d="m 394.02985,219.40299 97.01493,-0.74627"
+       id="path4887"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       transform="translate(0,652.36218)" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1.65783215px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Mstart)"
+       d="m 452.15934,1000.363 39.24413,0"
+       id="path4889"
+       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"
+       d="m 491.55224,870.57114 0,129.10446"
+       id="path4891"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <text
+       xml:space="preserve"
+       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"
+       x="361.82092"
+       y="994.1532"
+       id="text5885"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan5887"
+         x="361.82092"
+         y="994.1532">for(;;) {</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       d="m 283.58209,322.38806 195.52239,0.74627"
+       id="path5897"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0"
+       transform="translate(0,652.36218)" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       d="m 478.98507,975.16815 0,-8.20896"
+       id="path5903"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+       d="m 283.01493,975.09353 0,-8.20896"
+       id="path5903-5"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.94900161;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.94900161, 0.94900161;stroke-dashoffset:0;marker-start:url(#Arrow2Mstart);marker-end:url(#Arrow1Mend)"
+       d="m 310.43536,975.416 0.77239,38.962"
+       id="path5938"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.92228198;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.92228204, 0.92228204;stroke-dashoffset:0;marker-mid:url(#Arrow2Mstart)"
+       d="m 366.78512,1013.3264 -52.31652,-0.8239"
+       id="path5940"
+       inkscape:connector-type="polyline"
+       inkscape:connector-curvature="0" />
+  </g>
+</svg>
Binary file doc/report.odt has changed
Binary file doc/report.pdf has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emulator/emu.c	Sat Dec 07 16:35:13 2013 +0000
@@ -0,0 +1,11 @@
+// emu.c
+#include "emu.h"
+
+void 
+main(void) {
+    registers.PC = 0;
+    memory[0] = 1;
+
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emulator/emu.h	Sat Dec 07 16:35:13 2013 +0000
@@ -0,0 +1,45 @@
+// emu.h
+#ifndef EMU_H
+#define EMU_H
+
+typedef unsigned char BYTE;
+typedef unsigned short WIDE;
+
+struct
+registers {
+    // 8 bit registers
+    BYTE A;
+    BYTE R0;
+    BYTE R1;
+    BYTE R2;
+    BYTE R3;
+    BYTE flags;
+    
+    // 16 bit registers
+    WIDE DPTR;
+    WIDE SP;
+    WIDE PC;
+};
+
+// 64kB byte-addressable main memory
+BYTE
+memory[0x10000];
+
+// memory access function definitions
+BYTE
+read_mem(WIDE addr);
+
+void
+write_mem(BYTE data, WIDE addr);
+
+// get byte at PC
+BYTE
+fetch(void);
+
+// set PC
+void
+set(WIDE data);
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emulator/mem.c	Sat Dec 07 16:35:13 2013 +0000
@@ -0,0 +1,22 @@
+// mem.c
+#include "emu.h"
+
+BYTE
+read_mem(WIDE addr) {
+    return memory[addr];
+}
+
+void
+write_mem(BYTE data , WIDE addr) {
+    memory[addr] = data
+}
+
+BYTE
+fetch(void) {
+    return memory[registers.PC];
+}
+
+void
+set_pc(WIDE data) {
+    registers.PC = data
+}