Merge branch '13-initialize-paging' into 'master'

Resolve "Initialize Paging"

Closes #13

See merge request bslathi19/super6502!50
This commit is contained in:
Byron Lathi
2023-11-23 05:06:54 +00:00
11 changed files with 219 additions and 71 deletions

View File

@@ -96,6 +96,8 @@ full sim:
- make clean
- TEST_PROGRAM=$REPO_TOP/sw/bios/bios.hex TEST_FOLDER=$REPO_TOP/sw/bios make full_sim
needs:
- job: build toolchain
artifacts: true
- job: build bios
artifacts: true
- job: build kernel

View File

@@ -1,66 +1,66 @@
<mxfile host="Electron" modified="2023-10-17T05:15:31.071Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.2.8 Chrome/112.0.5615.165 Electron/24.2.0 Safari/537.36" etag="9k0BoEPw61JX0v_Fimzr" version="21.2.8" type="device">
<mxfile host="Electron" modified="2023-11-22T16:14:07.032Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.2.8 Chrome/112.0.5615.165 Electron/24.2.0 Safari/537.36" etag="cZrfsaYxYDLctKnBPGYN" version="21.2.8" type="device">
<diagram name="Page-1" id="GhyEJFUGB68-PMfAT87G">
<mxGraphModel dx="2408" dy="1069" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="NXSZnqqENL-7S4XXd65T-59" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.25;entryY=1;entryDx=0;entryDy=0;shape=flexArrow;fillColor=none;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-1" target="NXSZnqqENL-7S4XXd65T-58">
<mxCell id="NXSZnqqENL-7S4XXd65T-59" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.25;entryY=1;entryDx=0;entryDy=0;shape=flexArrow;fillColor=none;" parent="1" source="NXSZnqqENL-7S4XXd65T-1" target="NXSZnqqENL-7S4XXd65T-58" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-1" value="MM00" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-1" value="MM00" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="240" y="400" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-60" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;shape=flexArrow;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-3" target="NXSZnqqENL-7S4XXd65T-58">
<mxCell id="NXSZnqqENL-7S4XXd65T-60" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;shape=flexArrow;" parent="1" source="NXSZnqqENL-7S4XXd65T-3" target="NXSZnqqENL-7S4XXd65T-58" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="450" y="460" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-3" value="MM01" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-3" value="MM01" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="240" y="440" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-61" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.75;entryY=1;entryDx=0;entryDy=0;shape=flexArrow;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-4" target="NXSZnqqENL-7S4XXd65T-58">
<mxCell id="NXSZnqqENL-7S4XXd65T-61" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.75;entryY=1;entryDx=0;entryDy=0;shape=flexArrow;" parent="1" source="NXSZnqqENL-7S4XXd65T-4" target="NXSZnqqENL-7S4XXd65T-58" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="420" y="540" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-4" value="MMnn" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-4" value="MMnn" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="240" y="520" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-15" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-12" target="NXSZnqqENL-7S4XXd65T-14">
<mxCell id="NXSZnqqENL-7S4XXd65T-15" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="1" source="NXSZnqqENL-7S4XXd65T-12" target="NXSZnqqENL-7S4XXd65T-14" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-28" value="ADDR[15:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-15">
<mxCell id="NXSZnqqENL-7S4XXd65T-28" value="ADDR[15:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="NXSZnqqENL-7S4XXd65T-15" vertex="1" connectable="0">
<mxGeometry x="-0.2088" y="-1" relative="1" as="geometry">
<mxPoint x="-8" y="-21" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-12" value="" style="triangle;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-12" value="" style="triangle;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="290" y="120" width="60" height="80" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-26" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;shape=flexArrow;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-14" target="NXSZnqqENL-7S4XXd65T-35">
<mxCell id="NXSZnqqENL-7S4XXd65T-26" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;shape=flexArrow;" parent="1" source="NXSZnqqENL-7S4XXd65T-14" target="NXSZnqqENL-7S4XXd65T-35" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="585" y="345" as="targetPoint" />
<Array as="points" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-27" value="ADDR[15:12]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-26">
<mxCell id="NXSZnqqENL-7S4XXd65T-27" value="ADDR[15:12]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="NXSZnqqENL-7S4XXd65T-26" vertex="1" connectable="0">
<mxGeometry x="-0.0783" relative="1" as="geometry">
<mxPoint y="-11" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-37" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-14" target="NXSZnqqENL-7S4XXd65T-36">
<mxCell id="NXSZnqqENL-7S4XXd65T-37" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="1" source="NXSZnqqENL-7S4XXd65T-14" target="NXSZnqqENL-7S4XXd65T-36" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-38" value="ADDR[11:0" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-37">
<mxCell id="NXSZnqqENL-7S4XXd65T-38" value="ADDR[11:0" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="NXSZnqqENL-7S4XXd65T-37" vertex="1" connectable="0">
<mxGeometry x="0.1934" y="4" relative="1" as="geometry">
<mxPoint x="-18" y="-16" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-48" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;shape=flexArrow;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-64" target="NXSZnqqENL-7S4XXd65T-47">
<mxCell id="NXSZnqqENL-7S4XXd65T-48" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;shape=flexArrow;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="NXSZnqqENL-7S4XXd65T-64" target="NXSZnqqENL-7S4XXd65T-47" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="-10" y="630" />
@@ -68,52 +68,52 @@
</Array>
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-14" value="n-4&lt;br&gt;4" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-14" value="n-4&lt;br&gt;4" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="490" y="210" width="120" height="80" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-32" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fillColor=default;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-1">
<mxCell id="NXSZnqqENL-7S4XXd65T-32" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fillColor=default;" parent="1" source="NXSZnqqENL-7S4XXd65T-1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="480" y="430" as="sourcePoint" />
<mxPoint x="520" y="420" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-33" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fillColor=default;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-3">
<mxCell id="NXSZnqqENL-7S4XXd65T-33" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fillColor=default;" parent="1" source="NXSZnqqENL-7S4XXd65T-3" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="480" y="430" as="sourcePoint" />
<mxPoint x="520" y="460" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-34" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fillColor=default;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-4">
<mxCell id="NXSZnqqENL-7S4XXd65T-34" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;fillColor=default;" parent="1" source="NXSZnqqENL-7S4XXd65T-4" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="480" y="430" as="sourcePoint" />
<mxPoint x="520" y="540" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-40" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;shape=flexArrow;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-35" target="NXSZnqqENL-7S4XXd65T-36">
<mxCell id="NXSZnqqENL-7S4XXd65T-40" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;shape=flexArrow;" parent="1" source="NXSZnqqENL-7S4XXd65T-35" target="NXSZnqqENL-7S4XXd65T-36" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-42" value="ADDR[24:12]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-40">
<mxCell id="NXSZnqqENL-7S4XXd65T-42" value="ADDR[24:12]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="NXSZnqqENL-7S4XXd65T-40" vertex="1" connectable="0">
<mxGeometry x="-0.5389" y="-2" relative="1" as="geometry">
<mxPoint x="7" y="-17" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-35" value="" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;fixedSize=1;rotation=90;size=55;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-35" value="" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;fixedSize=1;rotation=90;size=55;" parent="1" vertex="1">
<mxGeometry x="465" y="445" width="170" height="60" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-41" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-36">
<mxCell id="NXSZnqqENL-7S4XXd65T-41" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="1" source="NXSZnqqENL-7S4XXd65T-36" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="890" y="250" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-43" value="ADDR[24:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-41">
<mxCell id="NXSZnqqENL-7S4XXd65T-43" value="ADDR[24:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="NXSZnqqENL-7S4XXd65T-41" vertex="1" connectable="0">
<mxGeometry x="-0.3158" relative="1" as="geometry">
<mxPoint x="6" y="-20" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-36" value="+" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-36" value="+" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;" parent="1" vertex="1">
<mxGeometry x="690" y="210" width="80" height="80" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-45" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;entryX=0.25;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" target="NXSZnqqENL-7S4XXd65T-1">
<mxCell id="NXSZnqqENL-7S4XXd65T-45" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;entryX=0.25;entryY=0;entryDx=0;entryDy=0;" parent="1" target="NXSZnqqENL-7S4XXd65T-1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="320" y="320" as="sourcePoint" />
<mxPoint x="310" y="320" as="targetPoint" />
@@ -123,13 +123,13 @@
</Array>
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-50" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;shape=arrow;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-47" target="NXSZnqqENL-7S4XXd65T-49">
<mxCell id="NXSZnqqENL-7S4XXd65T-50" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;shape=arrow;" parent="1" source="NXSZnqqENL-7S4XXd65T-47" target="NXSZnqqENL-7S4XXd65T-49" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-47" value="Decoder" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;fixedSize=1;rotation=-90;size=30;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-47" value="Decoder" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;fixedSize=1;rotation=-90;size=30;" parent="1" vertex="1">
<mxGeometry x="-10" y="370" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-55" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-49" target="NXSZnqqENL-7S4XXd65T-1">
<mxCell id="NXSZnqqENL-7S4XXd65T-55" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="NXSZnqqENL-7S4XXd65T-49" target="NXSZnqqENL-7S4XXd65T-1" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="220" y="360" />
@@ -137,12 +137,12 @@
</Array>
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-81" value="we[1:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-55">
<mxCell id="NXSZnqqENL-7S4XXd65T-81" value="we[1:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="NXSZnqqENL-7S4XXd65T-55" vertex="1" connectable="0">
<mxGeometry x="-0.3218" relative="1" as="geometry">
<mxPoint x="-17" y="-10" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-56" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-49" target="NXSZnqqENL-7S4XXd65T-3">
<mxCell id="NXSZnqqENL-7S4XXd65T-56" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="NXSZnqqENL-7S4XXd65T-49" target="NXSZnqqENL-7S4XXd65T-3" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="210" y="390" />
@@ -150,12 +150,12 @@
</Array>
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-82" value="we[1:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-56">
<mxCell id="NXSZnqqENL-7S4XXd65T-82" value="we[1:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="NXSZnqqENL-7S4XXd65T-56" vertex="1" connectable="0">
<mxGeometry x="-0.7003" relative="1" as="geometry">
<mxPoint x="8" y="-10" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-57" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.75;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-49" target="NXSZnqqENL-7S4XXd65T-4">
<mxCell id="NXSZnqqENL-7S4XXd65T-57" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.75;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="NXSZnqqENL-7S4XXd65T-49" target="NXSZnqqENL-7S4XXd65T-4" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="190" y="420" />
@@ -163,61 +163,61 @@
</Array>
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-83" value="we[1:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-57">
<mxCell id="NXSZnqqENL-7S4XXd65T-83" value="we[1:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="NXSZnqqENL-7S4XXd65T-57" vertex="1" connectable="0">
<mxGeometry x="-0.7895" y="1" relative="1" as="geometry">
<mxPoint x="9" y="-9" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-49" value="&amp;amp;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-49" value="&amp;amp;" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="120" y="330" width="40" height="120" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-51" value="" style="endArrow=classic;html=1;rounded=0;entryX=0.25;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" target="NXSZnqqENL-7S4XXd65T-49">
<mxCell id="NXSZnqqENL-7S4XXd65T-51" value="" style="endArrow=classic;html=1;rounded=0;entryX=0.25;entryY=0;entryDx=0;entryDy=0;" parent="1" target="NXSZnqqENL-7S4XXd65T-49" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="130" y="300" as="sourcePoint" />
<mxPoint x="210" y="310" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-52" value="CS" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-51">
<mxCell id="NXSZnqqENL-7S4XXd65T-52" value="CS" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="NXSZnqqENL-7S4XXd65T-51" vertex="1" connectable="0">
<mxGeometry x="-0.7662" relative="1" as="geometry">
<mxPoint y="-14" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-53" value="" style="endArrow=classic;html=1;rounded=0;entryX=0.75;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" target="NXSZnqqENL-7S4XXd65T-49">
<mxCell id="NXSZnqqENL-7S4XXd65T-53" value="" style="endArrow=classic;html=1;rounded=0;entryX=0.75;entryY=0;entryDx=0;entryDy=0;" parent="1" target="NXSZnqqENL-7S4XXd65T-49" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="150" y="300" as="sourcePoint" />
<mxPoint x="210" y="310" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-54" value="WE" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-53">
<mxCell id="NXSZnqqENL-7S4XXd65T-54" value="WE" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="NXSZnqqENL-7S4XXd65T-53" vertex="1" connectable="0">
<mxGeometry x="-0.7143" relative="1" as="geometry">
<mxPoint y="-14" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-63" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-58" target="NXSZnqqENL-7S4XXd65T-62">
<mxCell id="NXSZnqqENL-7S4XXd65T-63" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;" parent="1" source="NXSZnqqENL-7S4XXd65T-58" target="NXSZnqqENL-7S4XXd65T-62" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-71" value="data[15:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=none;" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-63">
<mxCell id="NXSZnqqENL-7S4XXd65T-71" value="data[15:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=none;" parent="NXSZnqqENL-7S4XXd65T-63" vertex="1" connectable="0">
<mxGeometry x="-0.258" y="-1" relative="1" as="geometry">
<mxPoint x="31" y="-5" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-58" value="" style="shape=trapezoid;perimeter=trapezoidPerimeter;fixedSize=1;size=20;rotation=-180;html=1;whiteSpace=wrap;horizontal=1;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-58" value="" style="shape=trapezoid;perimeter=trapezoidPerimeter;fixedSize=1;size=20;rotation=-180;html=1;whiteSpace=wrap;horizontal=1;" parent="1" vertex="1">
<mxGeometry x="390" y="610" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-72" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;shape=flexArrow;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-62">
<mxCell id="NXSZnqqENL-7S4XXd65T-72" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;shape=flexArrow;" parent="1" source="NXSZnqqENL-7S4XXd65T-62" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="450" y="780" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-73" value="DATA_OUT[7:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-72">
<mxCell id="NXSZnqqENL-7S4XXd65T-73" value="DATA_OUT[7:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="NXSZnqqENL-7S4XXd65T-72" vertex="1" connectable="0">
<mxGeometry x="0.3305" y="-2" relative="1" as="geometry">
<mxPoint x="52" y="-13" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-62" value="" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;fixedSize=1;size=20;rotation=-180;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-62" value="" style="shape=trapezoid;perimeter=trapezoidPerimeter;whiteSpace=wrap;html=1;fixedSize=1;size=20;rotation=-180;" parent="1" vertex="1">
<mxGeometry x="390" y="690" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-66" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-77" target="NXSZnqqENL-7S4XXd65T-62">
<mxCell id="NXSZnqqENL-7S4XXd65T-66" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="NXSZnqqENL-7S4XXd65T-77" target="NXSZnqqENL-7S4XXd65T-62" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="250" y="630" />
@@ -225,31 +225,31 @@
</Array>
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-68" value="ADDR[0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-66">
<mxCell id="NXSZnqqENL-7S4XXd65T-68" value="ADDR[0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="NXSZnqqENL-7S4XXd65T-66" vertex="1" connectable="0">
<mxGeometry x="0.4898" relative="1" as="geometry">
<mxPoint x="3" y="-10" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-64" value="" style="triangle;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-64" value="" style="triangle;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="-160" y="590" width="60" height="80" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-65" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;fillColor=default;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-64" target="NXSZnqqENL-7S4XXd65T-77">
<mxCell id="NXSZnqqENL-7S4XXd65T-65" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;shape=flexArrow;fillColor=default;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="NXSZnqqENL-7S4XXd65T-64" target="NXSZnqqENL-7S4XXd65T-77" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="200" y="630" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-67" value="ADDR[4:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=none;" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-65">
<mxCell id="NXSZnqqENL-7S4XXd65T-67" value="ADDR[4:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=none;" parent="NXSZnqqENL-7S4XXd65T-65" vertex="1" connectable="0">
<mxGeometry x="0.1394" relative="1" as="geometry">
<mxPoint x="-115" y="-15" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-69" value="WORD MUX" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-69" value="WORD MUX" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="410" y="615" width="80" height="30" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-70" value="BYTE MUX" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-70" value="BYTE MUX" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="410" y="695" width="80" height="30" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-74" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;entryX=0.75;entryY=0;entryDx=0;entryDy=0;fillColor=default;" edge="1" parent="1" target="NXSZnqqENL-7S4XXd65T-1">
<mxCell id="NXSZnqqENL-7S4XXd65T-74" value="" style="shape=flexArrow;endArrow=classic;html=1;rounded=0;entryX=0.75;entryY=0;entryDx=0;entryDy=0;fillColor=default;" parent="1" target="NXSZnqqENL-7S4XXd65T-1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="320" y="310" as="sourcePoint" />
<mxPoint x="340" y="380" as="targetPoint" />
@@ -259,32 +259,32 @@
</Array>
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-75" value="DATA_IN[7:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-74">
<mxCell id="NXSZnqqENL-7S4XXd65T-75" value="DATA_IN[7:0]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="NXSZnqqENL-7S4XXd65T-74" vertex="1" connectable="0">
<mxGeometry x="-0.5016" y="-1" relative="1" as="geometry">
<mxPoint x="41" y="-2" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-77" value="4&lt;br&gt;1" style="ellipse;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-77" value="4&lt;br&gt;1" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="190" y="590" width="120" height="80" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-78" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;shape=flexArrow;fillColor=default;" edge="1" parent="1" source="NXSZnqqENL-7S4XXd65T-77" target="NXSZnqqENL-7S4XXd65T-58">
<mxCell id="NXSZnqqENL-7S4XXd65T-78" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;shape=flexArrow;fillColor=default;" parent="1" source="NXSZnqqENL-7S4XXd65T-77" target="NXSZnqqENL-7S4XXd65T-58" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-79" value="ADDR[4:1]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" vertex="1" connectable="0" parent="NXSZnqqENL-7S4XXd65T-78">
<mxCell id="NXSZnqqENL-7S4XXd65T-79" value="ADDR[4:1]" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="NXSZnqqENL-7S4XXd65T-78" vertex="1" connectable="0">
<mxGeometry x="0.1248" relative="1" as="geometry">
<mxPoint x="-11" y="-15" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-85" value="&lt;h1&gt;MM Registers&lt;/h1&gt;&lt;p&gt;MM Registers are 16 bit.&lt;/p&gt;&lt;p&gt;There are 16 MM registers&lt;/p&gt;&lt;p&gt;There are 2 write enables, one for the high byte and one for the low byte.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;For reading, first the register is selected, then the byte in the register is selected&lt;/p&gt;" style="text;html=1;strokeColor=none;fillColor=none;spacing=5;spacingTop=-20;whiteSpace=wrap;overflow=hidden;rounded=0;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-85" value="&lt;h1&gt;MM Registers&lt;/h1&gt;&lt;p&gt;MM Registers are 16 bit.&lt;/p&gt;&lt;p&gt;There are 16 MM registers&lt;/p&gt;&lt;p&gt;There are 2 write enables, one for the high byte and one for the low byte.&lt;/p&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;For reading, first the register is selected, then the byte in the register is selected&lt;/p&gt;" style="text;html=1;strokeColor=none;fillColor=none;spacing=5;spacingTop=-20;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1">
<mxGeometry x="610" y="570" width="230" height="210" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-86" value="" style="triangle;whiteSpace=wrap;html=1;rotation=90;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-86" value="" style="triangle;whiteSpace=wrap;html=1;rotation=90;" parent="1" vertex="1">
<mxGeometry x="290" y="240" width="60" height="80" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-87" value="" style="triangle;whiteSpace=wrap;html=1;rotation=90;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-87" value="" style="triangle;whiteSpace=wrap;html=1;rotation=90;" parent="1" vertex="1">
<mxGeometry x="420" y="770" width="60" height="80" as="geometry" />
</mxCell>
<mxCell id="NXSZnqqENL-7S4XXd65T-88" value="" style="triangle;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxCell id="NXSZnqqENL-7S4XXd65T-88" value="" style="triangle;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="890" y="210" width="60" height="80" as="geometry" />
</mxCell>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View File

@@ -0,0 +1,70 @@
# Memory Mapper
## Overview
The memory mapper gives expands the CPU's address space from 16 bits to 25.
It can be expanded to be 28 bits, but only 25 are needed to access all of
sdram.
Its architecture is show below:
![memory_mapper.drawio.png](memory_mapper.drawio.png)
There are 32 16 bit registers: One for each 4k page in the virtual address
space. The memory mapper is always enabled, but at reset it is identity
mapped, i.e. register _n_ will be reset to value _n_.
## Interface
The Memory mapper is composed of 32 identical 16 bit mapping registers
The chip select should be calculated based on the virtual address. If not,
it will be possible for the CPU to map away access to the mapper, at which
point it is impossible to change the mappings without a reset.
## Registers
### Register Map
| Address | Read | Write |
|--------- |-------------- |-------------- |
| 00 | MM0 Low | MM0 Low |
| 01 | MM0 High | MM0 High |
| 02 | MM1 Low | MM1 Low |
| 03 | MM1 High | MM1 High |
| 04 | MM2 Low | MM2 Low |
| 05 | MM2 High | MM2 High |
| 06 | MM3 Low | MM3 Low |
| 07 | MM3 High | MM3 High |
| 08 | MM4 Low | MM4 Low |
| 09 | MM4 High | MM4 High |
| 0A | MM5 Low | MM5 Low |
| 0B | MM5 High | MM5 High |
| 0C | MM6 Low | MM6 Low |
| 0D | MM6 High | MM6 High |
| 0E | MM7 Low | MM7 Low |
| 0F | MM7 High | MM7 High |
| 10 | MM8 Low | MM8 Low |
| 11 | MM8 High | MM8 High |
| 12 | MM9 Low | MM9 Low |
| 13 | MM9 High | MM9 High |
| 14 | MM10 Low | MM10 Low |
| 15 | MM10 High | MM10 High |
| 16 | MM11 Low | MM11 Low |
| 17 | MM11 High | MM11 High |
| 18 | MM12 Low | MM12 Low |
| 19 | MM12 High | MM12 High |
| 1A | MM13 Low | MM13 Low |
| 1B | MM13 High | MM13 High |
| 1C | MM14 Low | MM14 Low |
| 1D | MM14 High | MM14 High |
| 1E | MM15 Low | MM15 Low |
| 1F | MM15 High | MM15 High |
### MMn Low
Low memory map data. Becomes bits [19:12] of physical address.
### MMn High
High memory map data. Becomes bits [27:20] of physical address.

View File

@@ -7,4 +7,4 @@ outflow
*.gtkw
*.vvp
.mem
*.mem

View File

@@ -0,0 +1,10 @@
#ifndef _MAPPER_H
#define _MAPPER_H
#include <stdint.h>
void init_mapper();
void map(uint16_t p_page, uint8_t v_page);
#endif

View File

@@ -0,0 +1,38 @@
.MACPACK generic
.autoimport
.export _init_mapper
.export _map
MAPPER_BASE = $200
.code
; void init_paging();
; This should be identity mapped at reset, but we can do it again anyway
.proc _init_mapper
ldx #$00
L1:
txa
lsr
sta MAPPER_BASE,x
lda #$00
sta MAPPER_BASE+1,x
inx
inx
cpx #$20
blt L1
rts
.endproc
; void map(uint16_t p_page, uint8_t v_page);
.proc _map
asl
tax ; x = v_page * 2
jsr popa ; low byte of p_page
sta MAPPER_BASE,x ; write low byte to mm_low
jsr popa ; high byte of p_page
sta MAPPER_BASE+1,x ; write high byte to mm_high
rts
.endproc

View File

@@ -15,13 +15,13 @@ RTC_OUTPUT = $30
RTC_CONTROL = $30
THRESHOLD_0 = $a0
; THRESHOLD_1 = $0f
THRESHOLD_1 = $00
THRESHOLD_1 = $0f
; THRESHOLD_1 = $00
THRESHOLD_2 = $00
THRESHOLD_3 = $00
; IRQ_THRESHOLD_0 = $32
IRQ_THRESHOLD_0 = $10
IRQ_THRESHOLD_0 = $32
; IRQ_THRESHOLD_0 = $10
IRQ_THRESHOLD_1 = $00
IRQ_THRESHOLD_2 = $00
IRQ_THRESHOLD_3 = $00

View File

@@ -6,6 +6,8 @@
#define BUTTON (1 << 0)
#define UART (1 << 1)
void init_interrupts();
void register_irq(void* addr, uint8_t irqn);
uint8_t irq_get_status();

View File

@@ -3,15 +3,38 @@
.autoimport
.import _enable_irq
.import _map
.export irq_int, nmi_int
.export _register_irq
.export _init_interrupts
IRQ_CMD_ADDR = $effc
IRQ_DAT_ADDR = $effd
IRQ_CMD_READIRQ = $00
; void init_interrupts();
; remap the upper page into ram,
; then load the new vector addresses.
.proc _init_interrupts
; map(001f, f);
lda #$1f
jsr pushax
lda #$f
jsr _map
lda #<irq_int
sta $fffe
lda #>irq_int
sta $ffff
lda #<nmi_int
sta $fffa
lda #>nmi_int
sta $fffb
rts
.endproc
.proc nmi_int
rti

View File

@@ -1,11 +1,14 @@
#include <conio.h>
#include "devices/interrupt_controller.h"
#include "interrupts/interrupt.h"
#include "devices/mapper.h"
#include "devices/rtc.h"
void handle_rtc_interrupt() {
cputs("In IRQ interrupt!\n");
// cputs("In IRQ interrupt!\n");
cputc('A');
send_eoi();
asm volatile ("rti");
}
@@ -13,11 +16,11 @@ int main() {
cputs("Kernel\n");
// cputs("Init Paging\n")
// init_paging()
cputs("Init Mapper\n");
init_mapper();
// cputs("Initialize Interrupts\n");
// init_interrupts();
cputs("Initialize Interrupts\n");
init_interrupts();
cputs("Initialize Interrupt Controller\n");
init_interrupt_controller();