1
0
mirror of https://github.com/aap/pdp6.git synced 2026-02-26 08:54:02 +00:00

wrote new gui; implemented and fixed a bunch of stuff

This commit is contained in:
aap
2016-10-24 22:45:24 +02:00
parent e0d9a181e2
commit 2a37a8f74d
49 changed files with 5041 additions and 5384 deletions

View File

@@ -6,6 +6,8 @@ The maintenance manual has flow charts, schematics and explanations:
[Volume1](http://bitsavers.trailing-edge.com/pdf/dec/pdp6/F-67_166instrManVol1_Sep65.pdf)
[Volume2](http://bitsavers.trailing-edge.com/pdf/dec/pdp6/F-67_166instrManVol2_Sep65.pdf)
![Screenshot of the front panel](https://raw.githubusercontent.com/aap/pdp6/master/art/screenshot.png)
## Code
The code is more or less a transcription of the schematics into C.
@@ -35,14 +37,15 @@ The simulator reads `fmem` and `mem` to initialise the memory and fast memory.
## File tree
* `art` has everything graphical
* `code` contains some test code for the PDP-6
* `misc` contains some misc. and old stuff
* `tools` has tools like an assembler and linker
* `src` source for the emulator
* `art` everything graphical
* `code` some test code for the PDP-6
* `misc` some misc. and old stuff
* `tools` tools like an assembler and linker
## To do
- clock and repeat
- clock, repeat and maint. switches
- test thoroughly!
- devices
- timing

354
art/elements.svg Normal file
View File

@@ -0,0 +1,354 @@
<?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="1000mm"
height="143mm"
viewBox="0 0 3543.3071 506.6929"
id="svg4255"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="elements.svg"
inkscape:export-filename="/home/aap/src/pdp6/art/op_panel.svg.png"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475">
<defs
id="defs4257" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.2066156"
inkscape:cx="406.39064"
inkscape:cy="326.91335"
inkscape:document-units="mm"
inkscape:current-layer="layer7"
showgrid="true"
units="mm"
inkscape:window-width="1920"
inkscape:window-height="1080"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:snap-global="true"
showguides="false"
inkscape:guide-bbox="true"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true"
inkscape:snap-nodes="true">
<inkscape:grid
type="xygrid"
id="grid4805"
units="mm"
spacingx="39.330708"
spacingy="46.062989"
originx="1.7716535"
color="#3f3fff"
opacity="1"
empspacing="1"
empcolor="#ff3f41"
empopacity="0.58431373"
originy="23.031495"
enabled="false"
visible="true" />
<sodipodi:guide
position="0,0"
orientation="1,0"
id="guide4932"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="0,0"
orientation="0,1"
id="guide4934"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="0,506.69297"
orientation="0,1"
id="guide4936"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<inkscape:grid
type="xygrid"
id="grid4974"
color="#3f3fff"
opacity="1"
empcolor="#3f3fff"
empopacity="1"
enabled="false"
spacingx="69.222047"
units="mm"
spacingy="69.222043"
originx="1614.3307"
originy="8.5039365" />
<sodipodi:guide
position="1614.3307,69.094484"
orientation="1,0"
id="guide4976" />
<sodipodi:guide
position="433.60797,450.02295"
orientation="0,1"
id="guide4212" />
<sodipodi:guide
position="606.42857,265.76929"
orientation="0,1"
id="guide4233"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="602.55599,357.89527"
orientation="0,1"
id="guide4235"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="1788.3488,159.22529"
orientation="0,1"
id="guide4308" />
<sodipodi:guide
position="1802.5,65.267857"
orientation="0,1"
id="guide4310" />
<sodipodi:guide
position="795.0558,113.70536"
orientation="0,1"
id="guide4415" />
<sodipodi:guide
position="794.45312,112.20982"
orientation="1,0"
id="guide4417" />
<sodipodi:guide
position="1018.2143,159.22529"
orientation="1,0"
id="guide4518" />
</sodipodi:namedview>
<metadata
id="metadata4260">
<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
inkscape:groupmode="layer"
id="layer7"
inkscape:label="background"
style="display:inline">
<rect
style="fill:#5800ff;fill-opacity:0;stroke:none;stroke-width:2.83464575;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4639"
width="39.330708"
height="46.062988"
x="41.102364"
y="69.094513"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475" />
<rect
style="fill:#ccff00;fill-opacity:0;stroke:none;stroke-width:2.83464575;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4641"
width="39.330708"
height="46.062988"
x="119.76378"
y="69.094513"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475" />
<rect
style="fill:#ccff00;fill-opacity:0;stroke:none;stroke-width:2.83464575;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4643"
width="39.330708"
height="46.062988"
x="41.102364"
y="161.22049"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475" />
<rect
style="fill:#ccff00;fill-opacity:0;stroke:none;stroke-width:2.83464575;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4645"
width="39.330708"
height="46.062988"
x="119.76378"
y="161.22049"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475" />
<rect
style="fill:#ccff00;fill-opacity:0;stroke:none;stroke-width:2.83464575;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4649"
width="69.222046"
height="69.222046"
x="299.11182"
y="152.07877"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475" />
<rect
style="fill:#ccff00;fill-opacity:0;stroke:none;stroke-width:2.83464575;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4651"
width="69.222046"
height="69.222046"
x="437.55591"
y="152.07877"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475" />
<rect
style="fill:#ccff00;fill-opacity:0;stroke:none;stroke-width:2.83464575;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4653"
width="69.222046"
height="69.222046"
x="576"
y="152.07877"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475" />
<circle
style="fill:#d0d0d0;fill-opacity:1;stroke:#000000;stroke-width:1.35701132;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4659"
cx="60.767715"
cy="92.126007"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475"
r="15.266376" />
<circle
r="15.266376"
inkscape:export-ydpi="35.524475"
inkscape:export-xdpi="35.524475"
cy="92.126007"
cx="139.42914"
id="circle4665"
style="fill:#ffd700;fill-opacity:1;stroke:#000000;stroke-width:1.35701132;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<circle
inkscape:export-ydpi="35.524475"
inkscape:export-xdpi="35.524475"
cy="186.68979"
cx="333.72284"
id="circle4667"
style="fill:#d0d0d0;fill-opacity:1;stroke:#000000;stroke-width:1.80934846;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
r="20.355167" />
<circle
r="20.355167"
style="fill:#d0d0d0;fill-opacity:1;stroke:#000000;stroke-width:1.80934846;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="circle4669"
cx="472.16693"
cy="186.68979"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475" />
<circle
inkscape:export-ydpi="35.524475"
inkscape:export-xdpi="35.524475"
cy="186.68979"
cx="610.61102"
id="circle4671"
style="fill:#d0d0d0;fill-opacity:1;stroke:#000000;stroke-width:1.80934846;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
r="20.355167" />
<rect
style="fill:#d0d0d0;fill-opacity:1;stroke:#000000;stroke-width:1.41732287;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4673"
width="9.9700193"
height="38.067345"
x="467.18192"
y="152.78743"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475" />
<rect
y="182.52481"
x="605.62604"
height="38.067345"
width="9.9700193"
id="rect4675"
style="fill:#d0d0d0;fill-opacity:1;stroke:#000000;stroke-width:1.41732287;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475" />
<circle
r="15.266376"
inkscape:export-ydpi="35.524475"
inkscape:export-xdpi="35.524475"
cy="184.25198"
cx="60.767715"
id="circle4677"
style="fill:#d0d0d0;fill-opacity:1;stroke:#000000;stroke-width:1.35701132;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<circle
style="fill:#d0d0d0;fill-opacity:1;stroke:#000000;stroke-width:1.35701132;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="circle4679"
cx="139.42914"
cy="184.25198"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475"
r="15.266376" />
<rect
style="fill:#d0d0d0;fill-opacity:1;stroke:#000000;stroke-width:1.54743171;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4683"
width="4.6283092"
height="26.381079"
x="58.453564"
y="180.12869"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475" />
<rect
inkscape:export-ydpi="35.524475"
inkscape:export-xdpi="35.524475"
y="161.9942"
x="137.11497"
height="26.381079"
width="4.6283092"
id="rect4687"
style="fill:#d0d0d0;fill-opacity:1;stroke:#000000;stroke-width:1.54743171;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<circle
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1.41732283;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4171"
cx="333.72284"
cy="186.68979"
r="5.2116008"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475" />
</g>
<g
inkscape:groupmode="layer"
id="layer3"
inkscape:label="black"
style="display:inline" />
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="text"
style="display:inline" />
<g
inkscape:groupmode="layer"
id="layer5"
inkscape:label="knobs"
style="display:inline">
<circle
r="0"
transform="translate(0,-545.66935)"
cy="938.65692"
cx="794.45312"
id="ellipse5441"
style="display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.77165353;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<g
inkscape:groupmode="layer"
id="layer6"
inkscape:label="holes"
style="display:inline" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-545.66935)"
style="display:inline" />
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 12 KiB

360
art/extra_panel.svg Normal file
View File

@@ -0,0 +1,360 @@
<?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="488.39999mm"
height="143mm"
viewBox="0 0 1730.5512 506.6929"
id="svg4255"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="extra_panel.svg"
inkscape:export-filename="/home/aap/src/pdp6/art/extra_panel.svg.png"
inkscape:export-xdpi="35.524475"
inkscape:export-ydpi="35.524475">
<defs
id="defs4257" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.65809322"
inkscape:cx="788.2525"
inkscape:cy="370.07671"
inkscape:document-units="mm"
inkscape:current-layer="layer3"
showgrid="true"
units="mm"
inkscape:window-width="1920"
inkscape:window-height="1080"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:snap-global="true"
showguides="false"
inkscape:guide-bbox="true"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true"
inkscape:snap-nodes="true">
<inkscape:grid
type="xygrid"
id="grid4805"
units="mm"
spacingx="39.330708"
spacingy="46.062989"
originx="0"
color="#3f3fff"
opacity="1"
empspacing="1"
empcolor="#ff3f41"
empopacity="0.58431373"
originy="0"
enabled="false"
visible="true" />
<sodipodi:guide
position="0,0"
orientation="1,0"
id="guide4932"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="0,0"
orientation="0,1"
id="guide4934"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="0,506.69297"
orientation="0,1"
id="guide4936"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="1614.3307,69.094484"
orientation="1,0"
id="guide4976" />
<sodipodi:guide
position="433.60797,450.02295"
orientation="0,1"
id="guide4212" />
<sodipodi:guide
position="606.42857,265.76929"
orientation="0,1"
id="guide4233"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="602.55599,357.89527"
orientation="0,1"
id="guide4235"
inkscape:label=""
inkscape:color="rgb(0,0,255)" />
<sodipodi:guide
position="1788.3488,159.22529"
orientation="0,1"
id="guide4308" />
<sodipodi:guide
position="1802.5,65.267857"
orientation="0,1"
id="guide4310" />
<sodipodi:guide
position="795.0558,113.70536"
orientation="0,1"
id="guide4415" />
<sodipodi:guide
position="794.45312,112.20982"
orientation="1,0"
id="guide4417" />
<sodipodi:guide
position="1018.2143,159.22529"
orientation="1,0"
id="guide4518" />
<inkscape:grid
type="xygrid"
id="grid5711"
spacingx="112.32284"
empspacing="1"
empcolor="#3f3fff"
empopacity="1"
units="mm"
spacingy="42.200787"
originx="0"
enabled="true"
snapvisiblegridlinesonly="false" />
<sodipodi:guide
position="641.73209,1187.2983"
orientation="0,1"
id="guide4836" />
<sodipodi:guide
position="674.50368,1152.3778"
orientation="0,1"
id="guide5115" />
</sodipodi:namedview>
<metadata
id="metadata4260">
<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:groupmode="layer"
id="layer7"
inkscape:label="background"
style="display:inline"
sodipodi:insensitive="true">
<rect
style="fill:#e6e6e6;fill-opacity:1;stroke:none;stroke-width:2.83464575;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect8412"
width="1730.5511"
height="506.6929"
x="0"
y="-3.3040689e-07" />
</g>
<g
inkscape:groupmode="layer"
id="layer3"
inkscape:label="black"
style="display:inline">
<rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.83464575;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect5713"
width="41.385826"
height="38.657482"
x="451.06299"
y="86.456688" />
<rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.83464575;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect5813"
width="41.385826"
height="38.657482"
x="226.41733"
y="86.456688" />
<rect
y="129.01181"
x="226.41733"
height="38.657482"
width="41.385826"
id="rect5815"
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.83464575;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.83464575;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect5817"
width="41.385826"
height="38.657482"
x="226.41733"
y="171.2126" />
<rect
y="213.41339"
x="226.41733"
height="38.657482"
width="41.385826"
id="rect5819"
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.83464575;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2.83464575;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect5821"
width="41.385826"
height="38.657482"
x="226.41733"
y="255.61417" />
</g>
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="text"
style="display:inline">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:15px;line-height:100%;font-family:'Akzidenz Grotesk PDP6';-inkscape-font-specification:'Akzidenz Grotesk PDP6 Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="495.68625"
y="103.44543"
id="text4225"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
x="495.68625"
y="103.44543"
id="tspan7522">PTR</tspan><tspan
sodipodi:role="line"
x="495.68625"
y="118.44543"
id="tspan4670">MOTOR ON</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:15px;line-height:100%;font-family:'Akzidenz Grotesk PDP6';-inkscape-font-specification:'Akzidenz Grotesk PDP6 Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="271.03891"
y="238.03712"
id="text7936"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
x="271.03891"
y="238.03712"
id="tspan7968">SCT MAINT</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:15px;line-height:100%;font-family:'Akzidenz Grotesk PDP6';-inkscape-font-specification:'Akzidenz Grotesk PDP6 Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="271.03891"
y="272.61041"
id="text7948"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
x="271.03891"
y="272.61041"
id="tspan7972"
style="letter-spacing:0px">SPLIT CYCLE</tspan><tspan
sodipodi:role="line"
x="271.03891"
y="287.61041"
style="letter-spacing:0px"
id="tspan4676">OVERRIDE</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:15px;line-height:100%;font-family:'Akzidenz Grotesk PDP6';-inkscape-font-specification:'Akzidenz Grotesk PDP6 Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="271.03952"
y="111.08043"
id="text8086"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
x="271.03952"
y="111.08043"
id="tspan8088">RIM MAINT</tspan></text>
<text
sodipodi:linespacing="100%"
id="text8090"
y="153.63554"
x="271.03952"
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:15px;line-height:100%;font-family:'Akzidenz Grotesk PDP6';-inkscape-font-specification:'Akzidenz Grotesk PDP6 Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
id="tspan8092"
y="153.63554"
x="271.03952"
sodipodi:role="line">REPEAT BYPASS</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:15px;line-height:100%;font-family:'Akzidenz Grotesk PDP6';-inkscape-font-specification:'Akzidenz Grotesk PDP6 Medium';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="271.03952"
y="195.83633"
id="text8096"
sodipodi:linespacing="100%"><tspan
sodipodi:role="line"
x="271.03952"
y="195.83633"
id="tspan8098">ART3 MAINT</tspan></text>
<rect
style="fill:#cd8d48;fill-opacity:1;stroke:#000000;stroke-width:1.41732287;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4680"
width="393.30707"
height="92.125977"
x="450.00003"
y="202.85434" />
<rect
style="fill:#cd8d48;fill-opacity:1;stroke:#000000;stroke-width:1.41732287;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4685"
width="393.30707"
height="46.062988"
x="450.00003"
y="157.32858" />
<g
id="g5156"
transform="matrix(0.96121615,0,0,0.96121615,-716.025,-105.34641)">
<text
sodipodi:linespacing="125%"
id="text4818"
y="405.96426"
x="1383.0198"
style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:105.96961212px;line-height:125%;font-family:'Akzidenz-Grotesk BQ Super';-inkscape-font-specification:'Akzidenz-Grotesk BQ Super Medium';text-align:center;letter-spacing:10.33999634px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.54330707;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
xml:space="preserve"><tspan
style="letter-spacing:10.33999634px;stroke:#ffffff;stroke-width:3.54330707;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
y="405.96426"
x="1388.1898"
id="tspan4820"
sodipodi:role="line">PDP-</tspan></text>
<path
inkscape:connector-curvature="0"
id="path5121"
d="m 1567.1056,331.25251 -18.8195,32.60268 c -2.8948,4.30593 -4.5856,9.48897 -4.5856,15.06755 0,14.93501 12.107,27.04318 27.042,27.04318 14.935,0 27.042,-12.10817 27.042,-27.04318 0,-13.47399 -9.8548,-24.64243 -22.7496,-26.69937 l 12.04,-20.85932 -19.9693,-0.11154 z m 3.6369,38.18172 c 5.2404,0 9.4885,4.24816 9.4885,9.48851 0,5.24036 -4.2481,9.48852 -9.4885,9.48852 -5.2403,0 -9.4885,-4.24816 -9.4885,-9.48852 0,-5.24035 4.2482,-9.48851 9.4885,-9.48851 z"
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:3.54330707;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:30.66569901px;line-height:125%;font-family:Courier;-inkscape-font-specification:'Courier Bold';text-align:center;letter-spacing:2.09293365px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.41732287;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
x="495.57755"
y="244.16811"
id="text5161"
sodipodi:linespacing="125%"
transform="scale(1.3043891,0.76664241)"><tspan
sodipodi:role="line"
id="tspan5163"
x="496.62399"
y="244.16811">DATA PROCESSOR</tspan></text>
</g>
<g
inkscape:groupmode="layer"
id="layer6"
inkscape:label="holes"
style="display:inline" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-545.66935)"
style="display:inline" />
</svg>

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

BIN
art/ind_panel1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
art/ind_panel2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
art/io_panel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

2583
art/io_panel.svg Normal file

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 614 B

After

Width:  |  Height:  |  Size: 694 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 547 B

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 598 B

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 30 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
art/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 355 B

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 356 B

After

Width:  |  Height:  |  Size: 614 B

View File

@@ -3,3 +3,6 @@ test.rim: main.rel tty.rel
%.rel: %.s
as6 -o $@ $<
%.lst: %.s
as6 -o /dev/null -l $@ $<

View File

@@ -1 +0,0 @@
ケ│€÷睡<EFBFBD>€ケ│€<EFBFBD>€≠ケ│€≠枚<EFBFBD>€ケ│€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€°€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€§€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€ソソ€€ケ│€ケ凍€€聖│€€€ケ│€ケ蔵€€∋│€<EFBFBD><EFBFBD>€€柑│€<EFBFBD>€€€ケ│€<EFBFBD>€€沙│€<EFBFBD>€ケ│€<EFBFBD>€∩ケ│€<EFBFBD>€ケ│€<EFBFBD>€ケ│€<EFBFBD>€€€€€÷€€€€€€

View File

@@ -1 +0,0 @@
€€<EFBFBD>€÷€€€€€€€€€€€€€÷€€€€€€€€€€ケ凍€€<EFBFBD>€€€€ケ蔵€€€€€<EFBFBD>€€○ー€€€€€€<EFBFBD>€€€€€€о€<EFBFBD>€€€€<EFBFBD>€€€€€€€<EFBFBD>€€€€€€<EFBFBD>」ク€€€€€€<EFBFBD>サ柏€€€€€€醇」「亰€€€€€€€<EFBFBD>「氤€€€€€€шサエ精€€€€€€€<EFBFBD>€€€€€€€€€€€€€€€€

View File

@@ -1,54 +0,0 @@
main.s
00001 AC0==0
00002 AC1==1
00003 AC2==2
00004 PDP==17
00005
00006 EXTERNAL PUTC,PUTS
00007
000000' 254000 000102' 00008 ENTRY: JRST START
00009
00010 PDL: BLOCK 100
000101' 777700 000000' 00011 SP: XWD -100,PDL-1
00012
00013 START:
000102' 200740 000101' 00014 MOVE PDP,SP
00015
00016 ; MOVEI AC1,110
00017 ; PUSHJ PDP,PUTC
00018
000103' 205100 440700 00019 MOVSI AC2,440700
000104' 541100 000107' 00020 HRRI AC2,MSG
00021
000105' 260740 000000 00022 PUSHJ PDP,PUTS
00023
00024 ; ILDB AC1,AC2
00025 ; SKIPN AC1
00026 ; HALT
00027 ; PUSHJ PDP,PUTC
00028 ; JRST .-4
00029
000106' 254200 000000 00030 HALT
00031
000107' 443135 466336 00032 MSG: ASCIZ /Hello, world!/
000110' 261016 767744
000111' 663104 100000
00033 ;yo!/
00034
00035 END ENTRY
SYMBOL TABLE
AC0 000000
AC1 000001
AC2 000002
ENTRY 000000'
MSG 000107'
PDL 000001'
PDP 000017
PUTC 000000 EXT
PUTS 000105' EXT
SP 000101'
START 000102'

View File

@@ -1 +0,0 @@
€€<EFBFBD>€÷€€€€€€€€€€€€€÷€€€€€€€€€€€€€€€€÷€о€€€€€€€ソソ€€€€<EFBFBD>€€、〝ャ園€∴枚<EFBFBD>€€€<EFBFBD>€€€€€€€、劑ヲウ椁<EFBFBD>セソ、カ刋斡半サエ梶シ逗€€€€€€<EFBFBD>€€ююゥ<EFBFBD>€€€€€€€<EFBFBD>€€€€€€<EFBFBD>」ク€€€€€€泄吹ク€€€€€€アェ刈オ€€€€€≧アェ苅€€€€€€叶キョィ€€€€€∴刈コ焚€€€€€€<EFBFBD>サ柏€€€€€€準槍€€€イ」「亰€€€€€€€イ」「氤€€€€€≦感セ<EFBFBD>€€€€€慣ァス<EFBFBD>€€€€€€€€€€€€€€€€€€€€<EFBFBD>€€€€€€€€€€€€€€€€

View File

@@ -19,7 +19,7 @@ START:
PUSHJ PDP,PUTS
PUSHJ PDP,GETC
; JRST .-1
JRST .-1
HALT

View File

View File

@@ -1 +0,0 @@
ケ│€÷腹€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€°€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€§€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€€€€€€€ケ│€<EFBFBD>€€€€€€ケ│€ソソ€€÷ケ│€<EFBFBD>€ケ│€€、〝ケ│€ャ園€ケ│€<EFBFBD>€ケ│€<EFBFBD>€<EFBFBD>ケ│€€€€€ケ│€、劑ヲウ椹│€毎疾ソ、ケ│€カ刋斡隼│€シサエ梶シケ│€€€€€ケ│€ケ凍€€聖│€€€ケ│€ケ蔵€€∋│€<EFBFBD>€€€ケ│€<EFBFBD>€€せ│€€€€∋│€<EFBFBD>€€€ケ│€<EFBFBD>€ケ│€€€ケ│€ケ蕩€ケ│€€€ケ│€ケ摺€€∋│€<EFBFBD><EFBFBD>€∩ケ│€<EFBFBD>€€€ケ│€<EFBFBD><EFBFBD>€ケ│€<EFBFBD><EFBFBD>€ケ│€<EFBFBD><EFBFBD>€€€€€÷€€€€€€

View File

@@ -1,41 +0,0 @@
tty.s
00001 TTY=120
00002
00003 AC0==0
00004 AC1==1
00005 AC2==1
00006 PDP==17
00007
00008 INTERNAL PUTC,PUTS
00009
00010 PUTC:
000000' 712300 000020 00011 CONSZ TTY,20 ; wait until not busy
000001' 254000 000000' 00012 JRST .-1
000002' 712140 000001 00013 DATAO TTY,AC1 ; transfer character
00014 ; CAIE AC1,12 ; return unless LF
00015 ; POPJ PDP,
00016 ; MOVEI AC1,15 ; put CR and two DEL
00017 ; PUSHJ PDP,PUTC
00018 ; MOVEI AC1,177
00019 ; PUSHJ PDP,PUTC
00020 ; PUSHJ PDP,PUTC
000003' 263740 000000 00021 POPJ PDP,
00022
00023 PUTS:
000004' 134040 000001 00024 ILDB AC1,AC2
000005' 336000 000001 00025 SKIPN AC1
000006' 263740 000000 00026 POPJ PDP,
000007' 260740 000000' 00027 PUSHJ PDP,PUTC
000010' 254000 000004' 00028 JRST PUTS
SYMBOL TABLE
AC0 000000
AC1 000001
AC2 000001
PDP 000017
PUTC 000000' INT
PUTS 000004' INT
TTY 000120

View File

@@ -1 +0,0 @@
€€<EFBFBD>€÷€€€€€€€€€€€€€÷€€€€€€€€ケ凍€€<EFBFBD>€€€€ケ蔵€€€€€<EFBFBD>€€<EFBFBD>€€€€€€<EFBFBD>€€€€€€┿蕩€€<EFBFBD>€€€音摺€€□ィ<EFBFBD>€∩漫<EFBFBD>€€€<EFBFBD>€€<EFBFBD>€€€<EFBFBD>€€€€€<EFBFBD>€€ююゥ<EFBFBD>€€€€€€€<EFBFBD>€€€€€€<EFBFBD>」ク€€€€€€ェ刈オ€€€€€€糸ェ苅€€€€€<EFBFBD>サ柏€€€€€€醇」「亰€€€€€€€<EFBFBD>「氤€€€€€€шサエ精€€€€€€€<EFBFBD>€€€€€€€€€€€€€€€€

View File

@@ -11,6 +11,8 @@ PUTC:
CONSZ TTY,20 ; wait until not busy
JRST .-1
DATAO TTY,AC1 ; transfer character
POPJ PDP,
; CAIE AC1,12 ; return unless LF
; POPJ PDP,
; MOVEI AC1,15 ; put CR and two DEL
@@ -18,7 +20,7 @@ PUTC:
; MOVEI AC1,177
; PUSHJ PDP,PUTC
; PUSHJ PDP,PUTC
POPJ PDP,
; POPJ PDP,
PUTS:
ILDB AC1,AC2

1093
main.c

File diff suppressed because it is too large Load Diff

24
mem
View File

@@ -1,24 +0,0 @@
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
710600000060
710740000010
254000000021
710440000026
710740000010
254000000024
0
254000000021

View File

@@ -113,17 +113,19 @@ usage(void)
exit(1);
}
int clear;
int port = 6666;
char const *host = "127.0.0.1";
int
main(int argc, char *argv[])
{
int fd;
char const *host;
int port;
host = "127.0.0.1";
port = 6666;
ARGBEGIN{
case 'c':
clear = 1;
break;
case 'p':
port = atoi(EARGF(usage()));
break;
@@ -136,7 +138,9 @@ main(int argc, char *argv[])
fd = opentcp(host, port);
printf("\033[H\033[J"); // clear screen
if(clear)
printf("\033[H\033[J"); // clear screen
fflush(stdout);
if(raw())
return 1;

192
pt.c
View File

@@ -1,192 +0,0 @@
#include "pdp6.h"
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <pthread.h>
#include <poll.h>
/*
* These device are not modeled accurately after the schematics.
*/
#define PTP (0100>>2)
#define PTR (0104>>2)
typedef struct Ptp Ptp;
struct Ptp
{
FILE *fp;
uchar ptp;
bool busy, flag, b;
int pia;
};
Ptp ptp;
typedef struct Ptr Ptr;
struct Ptr
{
FILE *fp;
int motor_on;
word sr;
word ptr;
bool busy, flag, b;
int pia;
};
Ptr ptr;
void
recalc_ptp_req(void)
{
u8 req;
req = ptp.flag ? ptp.pia : 0;
if(req != ioreq[PTP]){
ioreq[PTP] = req;
recalc_req();
}
}
static void
wake_ptp(void)
{
if(IOB_RESET || IOB_CONO_CLEAR){
ptp.pia = 0;
ptp.busy = 0;
ptp.flag = 0;
ptp.b = 0;
ioreq[PTP] = 0;
}
if(IOB_STATUS){
if(ptp.b) iobus0 |= F30;
if(ptp.busy) iobus0 |= F31;
if(ptp.flag) iobus0 |= F32;
iobus0 |= ptp.pia & 7;
}
if(IOB_CONO_SET){
if(iobus0 & F30) ptp.b = 1;
if(iobus0 & F31) ptp.busy = 1;
if(iobus0 & F32) ptp.flag = 1;
ptp.pia |= iobus0 & 7;
}
if(IOB_DATAO_CLEAR){
ptp.ptp = 0;
ptp.busy = 1;
ptp.flag = 0;
}
if(IOB_DATAO_SET){
ptp.ptp = iobus0 & 0377;
if(ptp.b)
putc((ptp.ptp & 077) | 0200, ptp.fp);
else
putc(ptp.ptp, ptp.fp);
ptp.busy = 0;
ptp.flag = 1;
}
recalc_ptp_req();
}
void
recalc_ptr_req(void)
{
u8 req;
req = ptr.flag ? ptr.pia : 0;
if(req != ioreq[PTR]){
ioreq[PTR] = req;
recalc_req();
}
}
void*
ptrthread(void *arg)
{
int c;
for(;;){
if(ptr.busy && ptr.motor_on){
// PTR CLR
ptr.sr = 0;
ptr.ptr = 0;
next:
c = getc(ptr.fp);
if(c == EOF){
ptr.busy = 0;
continue;
}
if(!ptr.b || c & 0200){
// PTR STROBE
ptr.sr <<= 1;
ptr.ptr <<= 6;
ptr.sr |= 1;
ptr.ptr |= c & 077;
if(!ptr.b)
ptr.ptr |= c & 0300;
}
if(!ptr.b || ptr.sr & 040){
ptr.busy = 0;
ptr.flag = 1;
}else
goto next;
recalc_ptr_req();
}
}
return nil;
}
static void
wake_ptr(void)
{
if(IOB_RESET || IOB_CONO_CLEAR){
ptr.pia = 0;
ptr.busy = 0;
ptr.flag = 0;
ptr.b = 0;
ioreq[PTR] = 0;
}
if(IOB_STATUS){
if(ptr.motor_on) iobus0 |= F27;
if(ptr.b) iobus0 |= F30;
if(ptr.busy) iobus0 |= F31;
if(ptr.flag) iobus0 |= F32;
iobus0 |= ptr.pia & 7;
}
if(IOB_DATAI){
iobus0 |= ptr.ptr;
ptr.flag = 0;
// actually when DATAI is negated again
ptr.busy = 1;
}
if(IOB_CONO_SET){
if(iobus0 & F30) ptr.b = 1;
if(iobus0 & F31) ptr.busy = 1;
if(iobus0 & F32) ptr.flag = 1;
ptr.pia |= iobus0 & 7;
}
recalc_ptr_req();
}
void
ptr_setmotor(int m)
{
if(ptr.motor_on == m)
return;
ptr.motor_on = m;
if(ptr.motor_on)
ptr.busy = 0;
ptr.flag = 1;
recalc_ptr_req();
}
void
initpt(void)
{
pthread_t thread_id;
ioreq[PTP] = 0;
iobusmap[PTP] = wake_ptp;
ioreq[PTR] = 0;
iobusmap[PTR] = wake_ptr;
pthread_create(&thread_id, nil, ptrthread, nil);
ptr.fp = fopen("code/test.rim", "rb");
ptp.fp = fopen("code/ptp.out", "wb");
}

View File

@@ -2,7 +2,7 @@ SRC=main.c apr.c mem.c tty.c pt.c
# clang
#CFLAGS= -Wno-shift-op-parentheses -Wno-logical-op-parentheses \
# -Wno-bitwise-op-parentheses
CFLAGS= -fno-diagnostics-show-caret \
CFLAGS= -g -fno-diagnostics-show-caret \
`sdl-config --cflags` `pkg-config SDL_image --cflags`
LIBS= `sdl-config --libs` `pkg-config SDL_image --libs` -lpthread

View File

@@ -2,6 +2,8 @@
#include <unistd.h>
word iobus0, iobus1;
word iobus1_last, iobus1_pulse;
int iodev;
void (*iobusmap[128])(void);
u8 ioreq[128];
@@ -345,8 +347,8 @@ recalc_cpa_req(Apr *apr)
apr->ar_pc_chg_flag && apr->cpa_pc_chg_enable ||
apr->ar_ov_flag && apr->cpa_arov_enable)
req = apr->cpa_pia;
if(ioreq[0] != req){
ioreq[0] = req;
if(ioreq[CPA] != req){
ioreq[CPA] = req;
recalc_req();
}
}
@@ -635,7 +637,7 @@ pulse(mr_start){
apr->cpa_pdl_ov = 0;
apr->cpa_arov_enable = 0;
apr->cpa_pia = 0;
ioreq[0] = 0;
ioreq[CPA] = 0;
// PI
apr->pi_ov = 0; // 8-4
@@ -664,6 +666,8 @@ pulse(mr_pwr_clr){
void
wake_cpa(void)
{
if(iodev != CPA)
return;
// 8-5
if(IOB_STATUS){
if(apr.cpa_pdl_ov) iobus0 |= F19;
@@ -710,6 +714,9 @@ wake_cpa(void)
void
wake_pi(void)
{
if(iodev != PI)
return;
// 8-4, 8-5
if(IOB_STATUS){
trace("PI STATUS %llo\n", iobus0);
@@ -745,9 +752,10 @@ wake_pi(void)
*/
pulse(iot_t4){
trace("IOT T3A\n");
trace("IOT T4\n");
/* Clear what was set in IOT T2 */
iobus1 &= ~(IOBUS_IOB_STATUS | IOBUS_IOB_DATAI);
/* and do something like IOB BUS RESET */
iobus0 = 0;
}
@@ -775,7 +783,7 @@ pulse(iot_t2){
// 8-1
apr->iot_go = 0;
/* These are asserted during INIT SETUP, IOT T2 and FINAL SETUP.
* We clear them in IOT T3A which happens after FINAL SETUP */
* We clear them in IOT T4 which happens after FINAL SETUP */
if(IOT_OUTGOING)
iobus0 |= apr->ar;
if(IOT_STATUS)
@@ -3015,6 +3023,13 @@ nextpulse(Apr *apr, Pulse *p)
apr->nlist[apr->nnextpulses++] = p;
}
void
initapr(void)
{
iobusmap[CPA] = wake_cpa;
iobusmap[PI] = wake_pi;
}
void*
aprmain(void *p)
{
@@ -3029,9 +3044,8 @@ aprmain(void *p)
apr->nnextpulses = 0;
apr->ia_inh = 0;
// TODO: move this somewhere else
iobusmap[0] = wake_cpa;
iobusmap[1] = wake_pi;
iobus0 = 0;
iobus1 = 0;
nextpulse(apr, mr_pwr_clr);
while(apr->sw_power){
@@ -3045,52 +3059,57 @@ aprmain(void *p)
if(c == 'x')
pulsestepping = 0;
}
//usleep(50000);
iobus1_last = iobus1;
for(i = 0; i < apr->ncurpulses; i++)
apr->clist[i](apr);
/* find out which bits were turned on */
iobus1_pulse = (iobus1_last ^ iobus1) & iobus1;
iobus1_pulse &= ~037777000177LL;
/* KEY MANUAL */
/* This is simplified, we have no IOT RESET,
* IOT INIT SET UP or IOT FINAL SETUP really.
* normally we'd have to wait for IOT RESET to clear here */
if(apr->iot_go)
nextpulse(apr, iot_t2);
/* Key pulses */
if(apr->extpulse & EXT_KEY_MANUAL){
apr->extpulse &= ~EXT_KEY_MANUAL;
nextpulse(apr, key_manual);
}
/* KEY INST STOP */
if(apr->extpulse & EXT_KEY_STOP){
apr->extpulse &= ~EXT_KEY_STOP;
if(apr->extpulse & EXT_KEY_INST_STOP){
apr->extpulse &= ~EXT_KEY_INST_STOP;
apr->run = 0;
// hack: cleared when the pulse list was empty
apr->ia_inh = 1;
}
/* This is simplified, we have no IOT RESET,
* IOT INIT SET UP or IOT FINAL SETUP really */
if(apr->iot_go)
nextpulse(apr, iot_t2);
/* pulses and signals through IO bus */
if(iobus1 & (IOBUS_PULSES | IOBUS_IOB_STATUS | IOBUS_IOB_DATAI)){
int dev = 0;
if(iobus1 & IOBUS_IOS3_1) dev |= 0100;
if(iobus1 & IOBUS_IOS4_1) dev |= 0040;
if(iobus1 & IOBUS_IOS5_1) dev |= 0020;
if(iobus1 & IOBUS_IOS6_1) dev |= 0010;
if(iobus1 & IOBUS_IOS7_1) dev |= 0004;
if(iobus1 & IOBUS_IOS8_1) dev |= 0002;
if(iobus1 & IOBUS_IOS9_1) dev |= 0001;
//debug("bus active for %o\n", dev<<2);
if(iobusmap[dev])
iobusmap[dev]();
// TODO: clear IOB STATUS and IOB DATAI too?
iobus1 &= ~IOBUS_PULSES;
/* Pulses and signals through IO bus */
iodev = -1;
if(iobus1_pulse & (IOBUS_PULSES | IOBUS_IOB_STATUS | IOBUS_IOB_DATAI)){
iodev = 0;
if(iobus1 & IOBUS_IOS3_1) iodev |= 0100;
if(iobus1 & IOBUS_IOS4_1) iodev |= 0040;
if(iobus1 & IOBUS_IOS5_1) iodev |= 0020;
if(iobus1 & IOBUS_IOS6_1) iodev |= 0010;
if(iobus1 & IOBUS_IOS7_1) iodev |= 0004;
if(iobus1 & IOBUS_IOS8_1) iodev |= 0002;
if(iobus1 & IOBUS_IOS9_1) iodev |= 0001;
if(iobusmap[iodev])
iobusmap[iodev]();
}
if(iobus1 & IOBUS_IOB_RESET){
if(iobus1_pulse & IOBUS_IOB_RESET){
int d;
for(d = 0; d < nelem(iobusmap); d++)
if(iobusmap[d])
iobusmap[d]();
iobus1 &= ~IOBUS_IOB_RESET;
}
iobus1 &= ~(IOBUS_PULSES | IOBUS_IOB_RESET);
/* Pulses to memory */
if(membus0 & (MEMBUS_WR_RS | MEMBUS_RQ_CYC)){
@@ -3116,17 +3135,15 @@ aprmain(void *p)
if(apr->mc_rq && !apr->mc_stop)
nextpulse(apr, mc_non_exist_mem); // 7-9
}
if(i){
// wakepanel();
if(i)
trace("--------------\n");
}else{
else
/* no longer needed */
apr->ia_inh = 0;
}
}
debug("power off\n");
return NULL;
return nil;
}

View File

667
src/elements.inc Normal file
View File

@@ -0,0 +1,667 @@
Element keys[] = {
/* keys */
{ keysurf, &opgrid2, { 0, 2 }, 1, 0 },
{ keysurf, &opgrid2, { 2.75, 2 }, 1, 0 },
{ keysurf, &opgrid2, { 5.5, 2 }, 1, 0 },
{ keysurf, &opgrid2, { 8.25, 2 }, 1, 0 },
{ keysurf, &opgrid2, { 11, 2 }, 1, 0 },
{ keysurf, &opgrid2, { 13.75, 2 }, 1, 0 },
{ keysurf, &opgrid2, { 16.5, 2 }, 1, 0 },
{ keysurf, &opgrid2, { 19.25, 2 }, 1, 0 },
};
Element switches[] = {
/* data switches */
{ switchsurf, &opgrid1, { 5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 6, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 7, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 8, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 9, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 10, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 11, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 12, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 13, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 14, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 15, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 16, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 17, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 18, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 19, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 20, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 21, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 22, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 23, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 24, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 25, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 26, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 27, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 28, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 29, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 30, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 31, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 32, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 33, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 34, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 35, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 36, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 37, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 38, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 39, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 40, 5 }, 0, 0 },
/* address switches */
{ switchsurf, &opgrid1, { 44.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 45.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 46.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 47.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 48.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 49.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 50.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 51.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 52.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 53.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 54.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 55.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 56.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 57.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 58.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 59.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 60.5, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 61.5, 5 }, 0, 0 },
/* repeat, addr stop, power, disable mem */
{ switchsurf, &opgrid1, { 78, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 78, 7 }, 0, 0 },
{ switchsurf, &opgrid1, { 83, 5 }, 0, 0 },
{ switchsurf, &opgrid1, { 83, 7 }, 0, 0 },
/* maint. switches */
{ switchsurf, &extragrid, { 2, 10 }, 0, 0 },
{ switchsurf, &extragrid, { 2, 9 }, 0, 0 },
{ switchsurf, &extragrid, { 2, 8 }, 0, 0 },
{ switchsurf, &extragrid, { 2, 7 }, 0, 0 },
{ switchsurf, &extragrid, { 2, 6 }, 0, 0 },
};
Element lamps[] = {
/* memory indicator */
{ lampsurf, &opgrid1, { 5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 6, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 7, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 8, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 9, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 10, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 11, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 12, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 13, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 14, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 15, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 16, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 17, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 18, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 19, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 20, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 21, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 22, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 23, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 24, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 25, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 26, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 27, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 28, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 29, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 30, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 31, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 32, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 33, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 34, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 35, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 36, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 37, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 38, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 39, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 40, 7 }, 0, 0 },
/* IR */
{ lampsurf, &opgrid1, { 5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 6, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 7, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 8, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 9, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 10, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 11, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 12, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 13, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 14, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 15, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 16, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 17, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 18, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 19, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 20, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 21, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 22, 9 }, 0, 0 },
/* address indicator */
{ lampsurf, &opgrid1, { 44.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 45.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 46.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 47.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 48.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 49.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 50.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 51.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 52.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 53.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 54.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 55.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 56.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 57.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 58.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 59.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 60.5, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 61.5, 7 }, 0, 0 },
/* PC */
{ lampsurf, &opgrid1, { 44.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 45.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 46.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 47.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 48.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 49.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 50.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 51.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 52.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 53.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 54.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 55.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 56.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 57.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 58.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 59.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 60.5, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 61.5, 9 }, 0, 0 },
/* pi active */
{ lampsurf, &opgrid1, { 68, 5 }, 0, 0 },
{ lampsurf, &opgrid1, { 69, 5 }, 0, 0 },
{ lampsurf, &opgrid1, { 70, 5 }, 0, 0 },
{ lampsurf, &opgrid1, { 71, 5 }, 0, 0 },
{ lampsurf, &opgrid1, { 72, 5 }, 0, 0 },
{ lampsurf, &opgrid1, { 73, 5 }, 0, 0 },
{ lampsurf, &opgrid1, { 74, 5 }, 0, 0 },
/* pi request */
{ lampsurf, &opgrid1, { 68, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 69, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 70, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 71, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 72, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 73, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 74, 7 }, 0, 0 },
/* pi in progress */
{ lampsurf, &opgrid1, { 68, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 69, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 70, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 71, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 72, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 73, 9 }, 0, 0 },
{ lampsurf, &opgrid1, { 74, 9 }, 0, 0 },
/* run, mem stop, pi on */
{ lampsurf, &opgrid1, { 66, 5 }, 0, 0 },
{ lampsurf, &opgrid1, { 66, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 66, 9 }, 0, 0 },
/* repeat, addr stop, power, disable mem */
{ lampsurf, &opgrid1, { 79, 5 }, 0, 0 },
{ lampsurf, &opgrid1, { 79, 7 }, 0, 0 },
{ lampsurf, &opgrid1, { 84, 5 }, 0, 0 },
{ lampsurf, &opgrid1, { 84, 7 }, 0, 0 },
/* Flip flops */
/* MB */
{ lampsurf, &indgrid2, { 4, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 5, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 6, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 7, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 8, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 9, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 10, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 11, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 12, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 13, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 14, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 15, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 16, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 17, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 18, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 19, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 20, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 21, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 22, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 23, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 24, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 25, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 26, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 27, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 28, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 29, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 30, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 31, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 32, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 33, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 34, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 35, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 36, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 37, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 38, 8 }, 0, 0 },
{ lampsurf, &indgrid2, { 39, 8 }, 0, 0 },
/* AR */
{ lampsurf, &indgrid2, { 4, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 5, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 6, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 7, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 8, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 9, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 10, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 11, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 12, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 13, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 14, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 15, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 16, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 17, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 18, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 19, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 20, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 21, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 22, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 23, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 24, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 25, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 26, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 27, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 28, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 29, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 30, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 31, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 32, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 33, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 34, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 35, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 36, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 37, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 38, 6 }, 0, 0 },
{ lampsurf, &indgrid2, { 39, 6 }, 0, 0 },
/* MQ */
{ lampsurf, &indgrid2, { 4, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 5, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 6, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 7, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 8, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 9, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 10, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 11, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 12, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 13, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 14, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 15, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 16, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 17, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 18, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 19, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 20, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 21, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 22, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 23, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 24, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 25, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 26, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 27, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 28, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 29, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 30, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 31, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 32, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 33, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 34, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 35, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 36, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 37, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 38, 4 }, 0, 0 },
{ lampsurf, &indgrid2, { 39, 4 }, 0, 0 },
/* Flip flops */
/* column 1 */
{ lampsurf, &indgrid1, { 1, 10 }, 0, 0 },
{ lampsurf, &indgrid1, { 1, 9 }, 0, 0 },
{ lampsurf, &indgrid1, { 1, 8 }, 0, 0 },
{ lampsurf, &indgrid1, { 1, 7 }, 0, 0 },
{ lampsurf, &indgrid1, { 1, 6 }, 0, 0 },
{ lampsurf, &indgrid1, { 1, 5 }, 0, 0 },
{ lampsurf, &indgrid1, { 1, 4 }, 0, 0 },
{ lampsurf, &indgrid1, { 1, 3 }, 0, 0 },
/* column 2 */
{ lampsurf, &indgrid1, { 2, 10 }, 0, 0 },
{ lampsurf, &indgrid1, { 2, 9 }, 0, 0 },
{ lampsurf, &indgrid1, { 2, 8 }, 0, 0 },
{ lampsurf, &indgrid1, { 2, 7 }, 0, 0 },
{ lampsurf, &indgrid1, { 2, 6 }, 0, 0 },
{ lampsurf, &indgrid1, { 2, 5 }, 0, 0 },
{ lampsurf, &indgrid1, { 2, 4 }, 0, 0 },
{ lampsurf, &indgrid1, { 2, 3 }, 0, 0 },
/* column 3 */
{ lampsurf, &indgrid1, { 3, 10 }, 0, 0 },
{ lampsurf, &indgrid1, { 3, 9 }, 0, 0 },
{ lampsurf, &indgrid1, { 3, 8 }, 0, 0 },
{ lampsurf, &indgrid1, { 3, 7 }, 0, 0 },
{ lampsurf, &indgrid1, { 3, 6 }, 0, 0 },
{ lampsurf, &indgrid1, { 3, 5 }, 0, 0 },
{ lampsurf, &indgrid1, { 3, 4 }, 0, 0 },
{ lampsurf, &indgrid1, { 3, 3 }, 0, 0 },
/* column 4 */
{ lampsurf, &indgrid1, { 4, 10 }, 0, 0 },
{ lampsurf, &indgrid1, { 4, 9 }, 0, 0 },
{ lampsurf, &indgrid1, { 4, 8 }, 0, 0 },
{ lampsurf, &indgrid1, { 4, 7 }, 0, 0 },
{ lampsurf, &indgrid1, { 4, 6 }, 0, 0 },
{ lampsurf, &indgrid1, { 4, 5 }, 0, 0 },
{ lampsurf, &indgrid1, { 4, 4 }, 0, 0 },
{ lampsurf, &indgrid1, { 4, 3 }, 0, 0 },
/* column 5 */
{ lampsurf, &indgrid1, { 5, 10 }, 0, 0 },
{ lampsurf, &indgrid1, { 5, 9 }, 0, 0 },
{ lampsurf, &indgrid1, { 5, 8 }, 0, 0 },
{ lampsurf, &indgrid1, { 5, 7 }, 0, 0 },
{ lampsurf, &indgrid1, { 5, 6 }, 0, 0 },
{ lampsurf, &indgrid1, { 5, 5 }, 0, 0 },
{ lampsurf, &indgrid1, { 5, 4 }, 0, 0 },
{ lampsurf, &indgrid1, { 5, 3 }, 0, 0 },
/* column 6 */
{ lampsurf, &indgrid1, { 6, 10 }, 0, 0 },
{ lampsurf, &indgrid1, { 6, 9 }, 0, 0 },
{ lampsurf, &indgrid1, { 6, 8 }, 0, 0 },
{ lampsurf, &indgrid1, { 6, 7 }, 0, 0 },
{ lampsurf, &indgrid1, { 6, 6 }, 0, 0 },
{ lampsurf, &indgrid1, { 6, 5 }, 0, 0 },
{ lampsurf, &indgrid1, { 6, 4 }, 0, 0 },
{ lampsurf, &indgrid1, { 6, 3 }, 0, 0 },
/* column 7 */
{ lampsurf, &indgrid1, { 7, 10 }, 0, 0 },
{ lampsurf, &indgrid1, { 7, 9 }, 0, 0 },
{ lampsurf, &indgrid1, { 7, 8 }, 0, 0 },
{ lampsurf, &indgrid1, { 7, 7 }, 0, 0 },
{ lampsurf, &indgrid1, { 7, 6 }, 0, 0 },
{ lampsurf, &indgrid1, { 7, 5 }, 0, 0 },
{ lampsurf, &indgrid1, { 7, 4 }, 0, 0 },
{ lampsurf, &indgrid1, { 7, 3 }, 0, 0 },
/* column 8 */
{ lampsurf, &indgrid1, { 8, 10 }, 0, 0 },
{ lampsurf, &indgrid1, { 8, 9 }, 0, 0 },
{ lampsurf, &indgrid1, { 8, 8 }, 0, 0 },
{ lampsurf, &indgrid1, { 8, 7 }, 0, 0 },
{ lampsurf, &indgrid1, { 8, 6 }, 0, 0 },
{ lampsurf, &indgrid1, { 8, 5 }, 0, 0 },
{ lampsurf, &indgrid1, { 8, 4 }, 0, 0 },
{ lampsurf, &indgrid1, { 8, 3 }, 0, 0 },
/* column 9 */
{ lampsurf, &indgrid1, { 9, 10 }, 0, 0 },
{ lampsurf, &indgrid1, { 9, 9 }, 0, 0 },
{ lampsurf, &indgrid1, { 9, 8 }, 0, 0 },
{ lampsurf, &indgrid1, { 9, 7 }, 0, 0 },
{ lampsurf, &indgrid1, { 9, 6 }, 0, 0 },
{ lampsurf, &indgrid1, { 9, 5 }, 0, 0 },
{ lampsurf, &indgrid1, { 9, 4 }, 0, 0 },
{ lampsurf, &indgrid1, { 9, 3 }, 0, 0 },
/* column 10 */
{ lampsurf, &indgrid1, { 10, 10 }, 0, 0 },
{ lampsurf, &indgrid1, { 10, 9 }, 0, 0 },
{ lampsurf, &indgrid1, { 10, 8 }, 0, 0 },
{ lampsurf, &indgrid1, { 10, 7 }, 0, 0 },
{ lampsurf, &indgrid1, { 10, 6 }, 0, 0 },
{ lampsurf, &indgrid1, { 10, 5 }, 0, 0 },
{ lampsurf, &indgrid1, { 10, 4 }, 0, 0 },
{ lampsurf, &indgrid1, { 10, 3 }, 0, 0 },
/* column 11 */
{ lampsurf, &indgrid1, { 11, 10 }, 0, 0 },
{ lampsurf, &indgrid1, { 11, 9 }, 0, 0 },
{ lampsurf, &indgrid1, { 11, 8 }, 0, 0 },
{ lampsurf, &indgrid1, { 11, 7 }, 0, 0 },
{ lampsurf, &indgrid1, { 11, 6 }, 0, 0 },
{ lampsurf, &indgrid1, { 11, 5 }, 0, 0 },
{ lampsurf, &indgrid1, { 11, 4 }, 0, 0 },
{ lampsurf, &indgrid1, { 11, 3 }, 0, 0 },
/* column 12 */
{ lampsurf, &indgrid1, { 12, 10 }, 0, 0 },
{ lampsurf, &indgrid1, { 12, 9 }, 0, 0 },
{ lampsurf, &indgrid1, { 12, 8 }, 0, 0 },
{ lampsurf, &indgrid1, { 12, 7 }, 0, 0 },
{ lampsurf, &indgrid1, { 12, 6 }, 0, 0 },
{ lampsurf, &indgrid1, { 12, 5 }, 0, 0 },
{ lampsurf, &indgrid1, { 12, 4 }, 0, 0 },
{ lampsurf, &indgrid1, { 12, 3 }, 0, 0 },
/* column 13 */
{ lampsurf, &indgrid1, { 13, 10 }, 0, 0 },
{ lampsurf, &indgrid1, { 13, 9 }, 0, 0 },
{ lampsurf, &indgrid1, { 13, 8 }, 0, 0 },
{ lampsurf, &indgrid1, { 13, 7 }, 0, 0 },
{ lampsurf, &indgrid1, { 13, 6 }, 0, 0 },
{ lampsurf, &indgrid1, { 13, 5 }, 0, 0 },
{ lampsurf, &indgrid1, { 13, 4 }, 0, 0 },
{ lampsurf, &indgrid1, { 13, 3 }, 0, 0 },
/* column 14 */
{ lampsurf, &indgrid1, { 14, 10 }, 0, 0 },
{ lampsurf, &indgrid1, { 14, 9 }, 0, 0 },
{ lampsurf, &indgrid1, { 14, 8 }, 0, 0 },
{ lampsurf, &indgrid1, { 14, 7 }, 0, 0 },
{ lampsurf, &indgrid1, { 14, 6 }, 0, 0 },
{ lampsurf, &indgrid1, { 14, 5 }, 0, 0 },
{ lampsurf, &indgrid1, { 14, 4 }, 0, 0 },
{ lampsurf, &indgrid1, { 14, 3 }, 0, 0 },
/* IO bus */
{ lampsurf, &iogrid, { 4, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 5, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 6, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 7, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 8, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 9, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 10, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 11, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 12, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 13, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 14, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 15, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 16, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 17, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 18, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 19, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 20, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 21, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 22, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 23, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 24, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 25, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 26, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 27, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 28, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 29, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 30, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 31, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 32, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 33, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 34, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 35, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 36, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 37, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 38, 13 }, 0, 0 },
{ lampsurf, &iogrid, { 39, 13 }, 0, 0 },
/* card reader */
{ lampsurf, &iogrid, { 4, 15 }, 0, 0 },
{ lampsurf, &iogrid, { 5, 15 }, 0, 0 },
{ lampsurf, &iogrid, { 6, 15 }, 0, 0 },
{ lampsurf, &iogrid, { 7, 15 }, 0, 0 },
{ lampsurf, &iogrid, { 8, 15 }, 0, 0 },
{ lampsurf, &iogrid, { 9, 15 }, 0, 0 },
{ lampsurf, &iogrid, { 10, 15 }, 0, 0 },
{ lampsurf, &iogrid, { 11, 15 }, 0, 0 },
{ lampsurf, &iogrid, { 12, 15 }, 0, 0 },
/* card reader buffer */
{ lampsurf, &iogrid, { 4, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 5, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 6, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 7, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 8, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 9, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 10, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 11, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 12, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 13, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 14, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 15, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 16, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 17, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 18, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 19, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 20, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 21, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 22, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 23, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 24, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 25, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 26, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 27, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 28, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 29, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 30, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 31, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 32, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 33, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 34, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 35, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 36, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 37, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 38, 17 }, 0, 0 },
{ lampsurf, &iogrid, { 39, 17 }, 0, 0 },
/* paper tape reader */
{ lampsurf, &iogrid, { 4, 19 }, 0, 0 },
{ lampsurf, &iogrid, { 5, 19 }, 0, 0 },
{ lampsurf, &iogrid, { 6, 19 }, 0, 0 },
{ lampsurf, &iogrid, { 7, 19 }, 0, 0 },
{ lampsurf, &iogrid, { 8, 19 }, 0, 0 },
{ lampsurf, &iogrid, { 9, 19 }, 0, 0 },
/* paper tape reader buffer */
{ lampsurf, &iogrid, { 4, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 5, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 6, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 7, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 8, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 9, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 10, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 11, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 12, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 13, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 14, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 15, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 16, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 17, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 18, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 19, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 20, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 21, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 22, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 23, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 24, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 25, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 26, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 27, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 28, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 29, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 30, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 31, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 32, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 33, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 34, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 35, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 36, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 37, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 38, 21 }, 0, 0 },
{ lampsurf, &iogrid, { 39, 21 }, 0, 0 },
/* paper tape punch */
{ lampsurf, &iogrid, { 4, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 5, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 6, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 7, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 8, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 9, 23 }, 0, 0 },
/* data */
{ lampsurf, &iogrid, { 12, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 13, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 14, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 15, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 16, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 17, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 18, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 19, 23 }, 0, 0 },
/* teleprinter */
{ lampsurf, &iogrid, { 24, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 25, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 26, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 27, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 28, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 29, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 30, 23 }, 0, 0 },
/* tti data */
{ lampsurf, &iogrid, { 32, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 33, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 34, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 35, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 36, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 37, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 38, 23 }, 0, 0 },
{ lampsurf, &iogrid, { 39, 23 }, 0, 0 },
/* memory protection */
{ lampsurf, &iogrid, { 4, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 5, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 6, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 7, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 8, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 9, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 10, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 11, 25 }, 0, 0 },
/* memory relocation */
{ lampsurf, &iogrid, { 18, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 19, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 20, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 21, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 22, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 23, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 24, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 25, 25 }, 0, 0 },
/* relocated address */
{ lampsurf, &iogrid, { 32, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 33, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 34, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 35, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 36, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 37, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 38, 25 }, 0, 0 },
{ lampsurf, &iogrid, { 39, 25 }, 0, 0 },
/* extra lights */
{ lampsurf, &extragrid, { 4, 10 }, 0, 0 },
};

706
src/main.c Normal file
View File

@@ -0,0 +1,706 @@
#include "pdp6.h"
#include <stdarg.h>
#include <SDL.h>
#include <SDL_image.h>
#include <pthread.h>
#include "args.h"
typedef struct Point Point;
struct Point
{
float x, y;
};
typedef struct Panel Panel;
struct Panel
{
SDL_Surface *surf;
SDL_Rect pos;
};
typedef struct Grid Grid;
struct Grid
{
float xoff, yoff;
float xscl, yscl;
Panel *panel;
};
typedef struct Element Element;
struct Element
{
SDL_Surface **surf;
Grid *grid;
Point pos;
int state;
int active;
};
char *argv0;
FILE *debugfp;
int dotrace;
void
trace(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
if(dotrace){
fprintf(debugfp, " ");
vfprintf(debugfp, fmt, ap);
}
va_end(ap);
}
void
debug(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vfprintf(debugfp, fmt, ap);
va_end(ap);
}
void
err(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "error: ");
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
exit(1);
}
SDL_Surface*
mustloadimg(const char *path)
{
SDL_Surface *s;
s = IMG_Load(path);
if(s == NULL)
err("Couldn't load %s", path);
return s;
}
SDL_Surface *lampsurf[2];
SDL_Surface *switchsurf[2];
SDL_Surface *keysurf[3];
Panel oppanel;
Grid opgrid1; /* the smaller base grid */
Grid opgrid2; /* the key grid */
Panel iopanel;
Grid iogrid;
Panel indpanel1, indpanel2;
Grid indgrid1;
Grid indgrid2;
Panel extrapanel;
Grid extragrid;
/* operator panel */
Element *data_sw, *ma_sw, *misc_sw;
Element *ir_l, *mi_l, *pc_l, *ma_l,
*pih_l, *pir_l, *pio_l, *misc_l;
/* bay indicator panel */
Element *mb_l, *ar_l, *mq_l;
Element *ff_l; /* flip flops */
/* io panel */
Element *iobus_l, *cr_l, *crbuf_l, *ptr_l, *ptrbuf_l,
*ptp_l, *ptpbuf_l, *tty_l, *ttibuf_l,
*pr_l, *rlr_l, *rla_l;
/* extra panel */
Element *extra_sw;
Element *extra_l;
#include "elements.inc"
void
setlights(word w, Element *l, int n)
{
int i;
for(i = 0; i < n; i++)
l[n-i-1].state = !!(w & 1L<<i);
}
word
getswitches(Element *sw, int n)
{
word w;
int i;
w = 0;
for(i = 0; i < n; i++)
w |= (word)sw[n-i-1].state << i;
return w;
}
void
poweron(void)
{
pthread_t apr_thread;
apr.sw_power = 1;
pthread_create(&apr_thread, NULL, aprmain, &apr);
}
#define KEYPULSE(k) (apr.k && !oldapr.k)
void
update(void)
{
Apr oldapr;
oldapr = apr;
setlights(apr.ir, ir_l, 18);
setlights(apr.mi, mi_l, 36);
setlights(apr.pc, pc_l, 18);
setlights(apr.ma, ma_l, 18);
setlights(apr.pih, pih_l, 7);
setlights(apr.pir, pir_l, 7);
setlights(apr.pio, pio_l, 7);
misc_l[0].state = apr.pi_active;
misc_l[1].state = apr.mc_stop;
misc_l[2].state = apr.run;
misc_l[3].state = apr.sw_repeat = misc_sw[0].state;
misc_l[4].state = apr.sw_addr_stop = misc_sw[1].state;
misc_l[5].state = apr.sw_power = misc_sw[2].state;
if(apr.sw_power && !oldapr.sw_power)
poweron();
misc_l[6].state = apr.sw_mem_disable = misc_sw[3].state;
apr.data = getswitches(data_sw, 36);
apr.mas = getswitches(ma_sw, 18);
apr.sw_rim_maint = extra_sw[0].state;
if(apr.sw_rim_maint)
apr.key_rim_sbr = 1;
apr.sw_rpt_bypass = extra_sw[1].state;
apr.sw_art3_maint = extra_sw[2].state;
apr.sw_sct_maint = extra_sw[3].state;
apr.sw_spltcyc_override = extra_sw[4].state;
apr.key_start = keys[0].state == 1;
apr.key_readin = keys[0].state == 2;
apr.key_inst_cont = keys[1].state == 1;
apr.key_mem_cont = keys[1].state == 2;
apr.key_inst_stop = keys[2].state == 1;
apr.key_mem_stop = keys[2].state == 2;
apr.key_io_reset = keys[3].state == 1;
apr.key_exec = keys[3].state == 2;
apr.key_dep = keys[4].state == 1;
apr.key_dep_nxt = keys[4].state == 2;
apr.key_ex = keys[5].state == 1;
apr.key_ex_nxt = keys[5].state == 2;
apr.key_rd_off = keys[6].state == 1;
apr.key_rd_on = keys[6].state == 2;
apr.key_pt_rd = keys[7].state == 1;
apr.key_pt_wr = keys[7].state == 2;
if(apr.sw_power){
if(KEYPULSE(key_start) || KEYPULSE(key_readin) ||
KEYPULSE(key_inst_cont) || KEYPULSE(key_mem_cont) ||
KEYPULSE(key_io_reset) || KEYPULSE(key_exec) ||
KEYPULSE(key_dep) || KEYPULSE(key_dep_nxt) ||
KEYPULSE(key_ex) || KEYPULSE(key_ex_nxt))
apr.extpulse |= EXT_KEY_MANUAL;
if(KEYPULSE(key_inst_stop))
apr.extpulse |= EXT_KEY_INST_STOP;
if(KEYPULSE(key_rd_on))
ptr_setmotor(1);
if(KEYPULSE(key_rd_off))
ptr_setmotor(0);
}
setlights(apr.mb, mb_l, 36);
setlights(apr.ar, ar_l, 36);
setlights(apr.mq, mq_l, 36);
ff_l[0].state = apr.key_ex_st;
ff_l[1].state = apr.key_ex_sync;
ff_l[2].state = apr.key_dep_st;
ff_l[3].state = apr.key_dep_sync;
ff_l[4].state = apr.key_rd_wr;
ff_l[5].state = apr.mc_rd;
ff_l[6].state = apr.mc_wr;
ff_l[7].state = apr.mc_rq;
ff_l[8].state = apr.if1a;
ff_l[9].state = apr.af0;
ff_l[10].state = apr.af3;
ff_l[11].state = apr.af3a;
ff_l[12].state = apr.et4_ar_pse;
ff_l[13].state = apr.f1a;
ff_l[14].state = apr.f4a;
ff_l[15].state = apr.f6a;
ff_l[16].state = apr.sf3;
ff_l[17].state = apr.sf5a;
ff_l[18].state = apr.sf7;
ff_l[19].state = apr.ar_com_cont;
ff_l[20].state = apr.blt_f0a;
ff_l[21].state = apr.blt_f3a;
ff_l[22].state = apr.blt_f5a;
ff_l[23].state = apr.iot_f0a;
ff_l[24].state = apr.fpf1;
ff_l[25].state = apr.fpf2;
ff_l[26].state = apr.faf1;
ff_l[27].state = apr.faf2;
ff_l[28].state = apr.faf3;
ff_l[29].state = apr.faf4;
ff_l[30].state = apr.fmf1;
ff_l[31].state = apr.fmf2;
ff_l[32].state = apr.fdf1;
ff_l[33].state = apr.fdf2;
ff_l[34].state = apr.ir & H6 && apr.mq & F1 && !apr.nrf3;
ff_l[35].state = apr.nrf1;
ff_l[36].state = apr.nrf2;
ff_l[37].state = apr.nrf3;
ff_l[38].state = apr.fsf1;
ff_l[39].state = apr.chf7;
ff_l[40].state = apr.dsf1;
ff_l[41].state = apr.dsf2;
ff_l[42].state = apr.dsf3;
ff_l[43].state = apr.dsf4;
ff_l[44].state = apr.dsf5;
ff_l[45].state = apr.dsf6;
ff_l[46].state = apr.dsf7;
ff_l[47].state = apr.dsf8;
ff_l[48].state = apr.dsf9;
ff_l[49].state = apr.msf1;
ff_l[50].state = apr.mpf1;
ff_l[51].state = apr.mpf2;
ff_l[52].state = apr.mc_split_cyc_sync;
ff_l[53].state = apr.mc_stop_sync;
ff_l[54].state = apr.shf1;
ff_l[55].state = apr.sc == 0777;
ff_l[56].state = apr.chf1;
ff_l[57].state = apr.chf2;
ff_l[58].state = apr.chf3;
ff_l[59].state = apr.chf4;
ff_l[60].state = apr.chf5;
ff_l[61].state = apr.chf6;
ff_l[62].state = apr.lcf1;
ff_l[63].state = apr.dcf1;
ff_l[64].state = apr.pi_ov;
ff_l[65].state = apr.pi_cyc;
ff_l[66].state = !!apr.pi_req;
ff_l[67].state = apr.iot_go;
ff_l[68].state = apr.a_long;
ff_l[69].state = apr.ma == apr.mas;
ff_l[70].state = apr.uuo_f1;
ff_l[71].state = apr.cpa_pdl_ov;
setlights(apr.fe, &ff_l[72], 8);
setlights(apr.sc, &ff_l[80], 8);
ff_l[88].state = !apr.ex_user;
ff_l[89].state = apr.cpa_illeg_op;
ff_l[90].state = apr.ex_ill_op;
ff_l[91].state = apr.ex_uuo_sync;
ff_l[92].state = apr.ex_pi_sync;
ff_l[93].state = apr.mq36;
ff_l[94].state = !!(apr.sc & 0400);
ff_l[95].state = !!(apr.fe & 0400);
ff_l[96].state = apr.key_rim_sbr;
ff_l[97].state = apr.ar_cry0_xor_cry1;
ff_l[98].state = apr.ar_cry0;
ff_l[99].state = apr.ar_cry1;
ff_l[100].state = apr.ar_ov_flag;
ff_l[101].state = apr.ar_cry0_flag;
ff_l[102].state = apr.ar_cry1_flag;
ff_l[103].state = apr.ar_pc_chg_flag;
ff_l[104].state = apr.cpa_non_exist_mem;
ff_l[105].state = apr.cpa_clock_enable;
ff_l[106].state = apr.cpa_clock_flag;
ff_l[107].state = apr.cpa_pc_chg_enable;
ff_l[108].state = apr.cpa_arov_enable;
ff_l[109].state = !!(apr.cpa_pia&4);
ff_l[110].state = !!(apr.cpa_pia&2);
ff_l[111].state = !!(apr.cpa_pia&1);
setlights(apr.pr, pr_l, 8);
setlights(apr.rlr, rlr_l, 8);
setlights(apr.rla, rla_l, 8);
setlights(iobus0, iobus_l, 36);
ptp_l[0].state = ptp.b;
ptp_l[1].state = ptp.busy;
ptp_l[2].state = ptp.flag;
setlights(ptp.pia, &ptp_l[3], 3);
setlights(ptp.ptp, ptpbuf_l, 8);
ptr_l[0].state = ptr.b;
ptr_l[1].state = ptr.busy;
ptr_l[2].state = ptr.flag;
setlights(ptr.pia, &ptr_l[3], 3);
setlights(ptr.ptr, ptrbuf_l, 36);
tty_l[0].state = tty.tti_busy;
tty_l[1].state = tty.tti_flag;
tty_l[2].state = tty.tto_busy;
tty_l[3].state = tty.tto_flag;
setlights(tty.pia, &tty_l[4], 3);
setlights(tty.tti, ttibuf_l, 8);
setlights(iobus0, iobus_l, 36);
extra_l[0].state = ptr.motor_on;
}
void
putpixel(SDL_Surface *screen, int x, int y, Uint32 col)
{
Uint32 *p = (Uint32*)screen->pixels;
if(x < 0 || x >= screen->w ||
y < 0 || y >= screen->h)
return;
p += y*screen->w+x;
*p = SDL_MapRGBA(screen->format,
col&0xFF, (col>>8)&0xFF, (col>>16)&0xFF, (col>>24)&0xFF);
}
void
drawhline(SDL_Surface *screen, int y, int x1, int x2, Uint32 col)
{
for(; x1 < x2; x1++)
putpixel(screen, x1, y, col);
}
void
drawvline(SDL_Surface *screen, int x, int y1, int y2, Uint32 col)
{
for(; y1 < y2; y1++)
putpixel(screen, x, y1, col);
}
Point
xform(Grid *g, Point p)
{
p.x = g->panel->pos.x + g->xoff + p.x*g->xscl;
p.y = g->panel->pos.y + (g->panel->surf->h - (g->yoff + p.y*g->yscl));
return p;
}
int
ismouseover(Element *e, int x, int y)
{
Point p;
p = xform(e->grid, e->pos);
return x >= p.x && x <= p.x + e->surf[e->state]->w &&
y >= p.y && y <= p.y + e->surf[e->state]->h;
}
void
drawgrid(Grid *g, SDL_Surface *s, Uint32 col)
{
SDL_Surface *ps;
int x, y;
int xmax, ymax;
Point p;
ps = g->panel->surf;
xmax = ps->w/g->xscl;
ymax = ps->h/g->yscl;
for(x = 0; x < xmax; x++){
p = xform(g, (Point){ x, 0 });
drawvline(s, p.x,
p.y - ps->h, p.y, col);
}
for(y = 0; y < ymax; y++){
p = xform(g, (Point){ 0, y });
drawhline(s, p.y,
p.x, p.x + ps->w, col);
}
}
void
drawelement(SDL_Surface *screen, Element *elt)
{
SDL_Rect r;
Point p;
int s;
p = xform(elt->grid, elt->pos);
r.x = p.x+0.5;
r.y = p.y+0.5;
if(elt->surf == lampsurf)
s = elt->state && apr.sw_power;
else
s = elt->state;
SDL_BlitSurface(elt->surf[s], nil, screen, &r);
}
void
mouse(int button, int state, int x, int y)
{
static int buttonstate;
Element *e;
int i;
if(button){
if(state == 1)
buttonstate |= 1 << button-1;
else
buttonstate &= ~(1 << button-1);
}
/* keys */
for(i = 0; i < nelem(keys); i++){
e = &keys[i];
/* e->active means latched on/off for keys */
if(buttonstate == 0 || !ismouseover(e, x, y)){
if(!e->active)
e->state = 0;
continue;
}
if((buttonstate & 5) == 5) /* left and right -> latched on/off */
e->active = !e->active;
else if(buttonstate & 1) /* left button -> down */
e->state = 1;
else if(buttonstate & 4) /* right button -> up */
e->state = 2;
}
/* switches */
for(i = 0; i < nelem(switches); i++){
e = &switches[i];
if(buttonstate == 0 || !ismouseover(e, x, y)){
e->active = 0;
continue;
}
if(!e->active){
e->active = 1;
if(buttonstate & 1) /* left button, toggle */
e->state = !e->state;
else if(buttonstate & 2) /* middle button, on */
e->state = 1;
else if(buttonstate & 4) /* right button, off */
e->state = 0;
}
}
}
void
findlayout(int *w, int *h)
{
float gap;
gap = (oppanel.surf->w - indpanel1.surf->w - indpanel2.surf->w)/4.0f;
indpanel1.pos = (SDL_Rect){ 0, 0, 0, 0 };
indpanel1.pos.x += gap;
indpanel2.pos = indpanel1.pos;
indpanel2.pos.x += indpanel1.surf->w + 2*gap;
iopanel.pos = indpanel2.pos;
iopanel.pos.y += indpanel2.surf->h;
oppanel.pos = (SDL_Rect){ 0, 0, 0, 0 };
oppanel.pos.y += indpanel1.surf->h*2.7;
extrapanel.pos = indpanel1.pos;
extrapanel.pos.y = oppanel.pos.y - extrapanel.surf->h;
*w = oppanel.surf->w;
*h = oppanel.pos.y + oppanel.surf->h;
}
void
usage(void)
{
fprintf(stderr, "usage: %s [-td]\n", argv0);
exit(1);
}
int
main(int argc, char *argv[])
{
SDL_Surface *screen;
SDL_Event ev;
SDL_MouseButtonEvent *mbev;
SDL_MouseMotionEvent *mmev;
Element *e;
Uint32 start, end;
int delay;
int i;
int w, h;
const char *outfile;
outfile = "/dev/null";
ARGBEGIN{
case 't':
dotrace = 1;
break;
case 'd':
outfile = EARGF(usage());
break;
default:
usage();
}ARGEND;
if(debugfp = fopen(outfile, "w"), debugfp == nil){
fprintf(stderr, "Can't open %s\n", outfile);
exit(1);
}
if(SDL_Init(SDL_INIT_VIDEO) < 0)
err("%s", SDL_GetError());
lampsurf[0] = mustloadimg("../art/lamp_off.png");
lampsurf[1] = mustloadimg("../art/lamp_on.png");
switchsurf[0] = mustloadimg("../art/switch_d.png");
switchsurf[1] = mustloadimg("../art/switch_u.png");
keysurf[0] = mustloadimg("../art/key_n.png");
keysurf[1] = mustloadimg("../art/key_d.png");
keysurf[2] = mustloadimg("../art/key_u.png");
oppanel.surf = mustloadimg("../art/op_panel.png");
opgrid1.panel = &oppanel;
opgrid1.xscl = opgrid1.panel->surf->w/90.0f;
opgrid1.yscl = opgrid1.panel->surf->h/11.0f;
opgrid1.yoff = opgrid1.yscl/2.0f;
opgrid2.panel = &oppanel;
opgrid2.xscl = opgrid1.xscl*1.76f;
opgrid2.yscl = opgrid2.xscl;
opgrid2.xoff = opgrid1.xscl*44.5f;
opgrid2.yoff = opgrid1.panel->surf->h*2.4f/143.0f;
iopanel.surf = mustloadimg("../art/io_panel.png");
iogrid.panel = &iopanel;
iogrid.xscl = iogrid.panel->surf->w/44.0f;
iogrid.yscl = iogrid.panel->surf->h/28.0f;
indpanel1.surf = mustloadimg("../art/ind_panel1.png");
indgrid1.panel = &indpanel1;
indgrid1.xscl = indgrid1.panel->surf->w*5.0f/77.0f;
indgrid1.yscl = indgrid1.panel->surf->h/12.0f;
indpanel2.surf = mustloadimg("../art/ind_panel2.png");
indgrid2.panel = &indpanel2;
indgrid2.xscl = indgrid2.panel->surf->w/44.0f;
indgrid2.yscl = indgrid2.panel->surf->h/11.0f;
extrapanel.surf = mustloadimg("../art/extra_panel.png");
extragrid = indgrid1;
extragrid.panel = &extrapanel;
findlayout(&w, &h);
screen = SDL_SetVideoMode(w, h, 32, SDL_DOUBLEBUF);
if(screen == nil)
err("%s", SDL_GetError());
e = switches;
data_sw = e; e += 36;
ma_sw = e; e += 18;
misc_sw = e; e += 4;
extra_sw = e; e += 5;
e = lamps;
mi_l = e; e += 36;
ir_l = e; e += 18;
ma_l = e; e += 18;
pc_l = e; e += 18;
pio_l = e; e += 7;
pir_l = e; e += 7;
pih_l = e; e += 7;
misc_l = e; e += 7;
mb_l = e; e += 36;
ar_l = e; e += 36;
mq_l = e; e += 36;
ff_l = e; e += 14*8;
iobus_l = e; e += 36;
cr_l = e; e += 9;
crbuf_l = e; e += 36;
ptr_l = e; e += 6;
ptrbuf_l = e; e += 36;
ptp_l = e; e += 6;
ptpbuf_l = e; e += 8;
tty_l = e; e += 7;
ttibuf_l = e; e += 8;
pr_l = e; e += 8;
rlr_l = e; e += 8;
rla_l = e; e += 8;
extra_l = e; e += 1;
initapr();
initmem();
inittty();
initpt();
// memset(&apr, 0, sizeof apr);
// apr.extpulse = 0;
for(;;){
start = SDL_GetTicks();
while(SDL_PollEvent(&ev))
switch(ev.type){
case SDL_MOUSEMOTION:
mmev = (SDL_MouseMotionEvent*)&ev;
mouse(0, mmev->state, mmev->x, mmev->y);
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
mbev = (SDL_MouseButtonEvent*)&ev;
mouse(mbev->button, mbev->state, mbev->x, mbev->y);
break;
case SDL_QUIT:
SDL_Quit();
return 0;
}
update();
SDL_FillRect(screen, nil, SDL_MapRGBA(screen->format, 0xe6, 0xe6, 0xe6, 0xff));
SDL_BlitSurface(indpanel1.surf, nil, screen, &indpanel1.pos);
SDL_BlitSurface(indpanel2.surf, nil, screen, &indpanel2.pos);
SDL_BlitSurface(extrapanel.surf, nil, screen, &extrapanel.pos);
SDL_BlitSurface(iopanel.surf, nil, screen, &iopanel.pos);
SDL_BlitSurface(oppanel.surf, nil, screen, &oppanel.pos);
for(i = 0, e = lamps; i < nelem(lamps); i++, e++)
drawelement(screen, e);
for(i = 0, e = keys; i < nelem(keys); i++, e++)
drawelement(screen, e);
for(i = 0, e = switches; i < nelem(switches); i++, e++)
drawelement(screen, e);
// SDL_LockSurface(screen);
// drawgrid(&opgrid1, screen, 0xFFFFFF00);
// drawgrid(&opgrid2, screen, 0xFF0000FF);
// drawgrid(&iogrid, screen, 0xFFFFFF00);
// drawgrid(&indgrid1, screen, 0xFFFFFF00);
// drawgrid(&indgrid2, screen, 0xFFFFFF00);
// drawgrid(&extragrid, screen, 0xFFFFFF00);
// SDL_UnlockSurface(screen);
SDL_Flip(screen);
end = SDL_GetTicks();
delay = (1000 / 30) - (end-start);
// if(delay > 0)
// SDL_Delay(delay);
}
return 0;
}

View File

@@ -39,8 +39,8 @@ readmem(char *file, word *mem, word size)
void
initmem(void)
{
readmem("mem", memory, maxmem);
readmem("fmem", fmem, 16);
readmem("../mem", memory, maxmem);
readmem("../fmem", fmem, 16);
}
void

View File

@@ -56,9 +56,9 @@ enum FullwordBits {
/* external pulses, bits of Apr.extpulse */
enum Extpulse {
EXT_KEY_MANUAL = 1,
EXT_KEY_STOP = 2,
EXT_NONEXIT_MEM = 4
EXT_KEY_MANUAL = 1,
EXT_KEY_INST_STOP = 2,
EXT_NONEXIT_MEM = 4
};
enum Opcode {
@@ -126,7 +126,8 @@ struct Apr {
u8 pr, rlr, rla;
bool run;
bool sw_addr_stop, sw_repeat, sw_mem_disable, sw_power;
bool sw_rim_maint;
/* maint switches */
bool sw_rim_maint, sw_rpt_bypass, sw_art3_maint, sw_sct_maint, sw_spltcyc_override;
/* keys */
bool key_start, key_readin;
bool key_mem_cont, key_inst_cont;
@@ -283,6 +284,10 @@ enum {
};
/* 0 is cable 1 & 2 (data); 1 is cable 3 & 4 (above bits) */
extern word iobus0, iobus1;
/* record the state of iobus1 of the last pulse step
* to recognize pulses or edges */
extern word iobus1_last, iobus1_pulse;
extern int iodev;
#define IOB_RESET (iobus1 & IOBUS_IOB_RESET)
#define IOB_DATAO_CLEAR (iobus1 & IOBUS_DATAO_CLEAR)
@@ -299,11 +304,56 @@ extern void (*iobusmap[128])(void);
extern u8 ioreq[128];
void recalc_req(void);
/*
* Devices
*/
void initapr(void);
#define CPA (0000>>2)
#define PI (0004>>2)
/* TTY */
#define TTY (0120>>2)
typedef struct Tty Tty;
struct Tty
{
uchar tto, tti;
bool tto_busy, tto_flag;
bool tti_busy, tti_flag;
int pia;
int fd;
};
extern Tty tty;
void inittty(void);
/* Paper tape */
#define PTP (0100>>2)
typedef struct Ptp Ptp;
struct Ptp
{
FILE *fp;
uchar ptp;
bool busy, flag, b;
int pia;
};
#define PTR (0104>>2)
typedef struct Ptr Ptr;
struct Ptr
{
FILE *fp;
int motor_on;
word sr;
word ptr;
bool busy, flag, b;
int pia;
};
extern Ptp ptp;
extern Ptr ptr;
void initpt(void);
void ptr_setmotor(int m);
//void wakepanel(void);
// for debugging
char *names[0700];

185
src/pt.c Normal file
View File

@@ -0,0 +1,185 @@
#include "pdp6.h"
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <pthread.h>
#include <poll.h>
Ptp ptp;
Ptr ptr;
void
recalc_ptp_req(void)
{
u8 req;
req = ptp.flag ? ptp.pia : 0;
if(req != ioreq[PTP]){
ioreq[PTP] = req;
recalc_req();
}
}
static void
wake_ptp(void)
{
if(IOB_RESET){
ptp.pia = 0;
ptp.busy = 0;
ptp.flag = 0;
ptp.b = 0;
}
if(iodev == PTP){
if(IOB_STATUS){
if(ptp.b) iobus0 |= F30;
if(ptp.busy) iobus0 |= F31;
if(ptp.flag) iobus0 |= F32;
iobus0 |= ptp.pia & 7;
}
if(IOB_CONO_SET){
if(iobus0 & F30) ptp.b = 1;
if(iobus0 & F31) ptp.busy = 1;
if(iobus0 & F32) ptp.flag = 1;
ptp.pia |= iobus0 & 7;
}
if(IOB_CONO_CLEAR){
ptp.pia = 0;
ptp.busy = 0;
ptp.flag = 0;
ptp.b = 0;
}
if(IOB_DATAO_CLEAR){
ptp.ptp = 0;
ptp.busy = 1;
ptp.flag = 0;
}
if(IOB_DATAO_SET){
ptp.ptp = iobus0 & 0377;
if(ptp.fp){
if(ptp.b)
putc((ptp.ptp & 077) | 0200, ptp.fp);
else
putc(ptp.ptp, ptp.fp);
}
ptp.busy = 0;
ptp.flag = 1;
}
}
recalc_ptp_req();
}
void
recalc_ptr_req(void)
{
u8 req;
req = ptr.flag ? ptr.pia : 0;
if(req != ioreq[PTR]){
ioreq[PTR] = req;
recalc_req();
}
}
void*
ptrthread(void *arg)
{
int c;
for(;;){
if(ptr.busy && ptr.motor_on){
// PTR CLR
ptr.sr = 0;
ptr.ptr = 0;
next:
if(ptr.fp)
c = getc(ptr.fp);
else
c = 0;
if(c == EOF)
c = 0;
if(!ptr.b || c & 0200){
// PTR STROBE
ptr.sr <<= 1;
ptr.ptr <<= 6;
ptr.sr |= 1;
ptr.ptr |= c & 077;
if(!ptr.b)
ptr.ptr |= c & 0300;
}
if(!ptr.b || ptr.sr & 040){
ptr.busy = 0;
ptr.flag = 1;
}else
goto next;
recalc_ptr_req();
}
}
return nil;
}
static void
wake_ptr(void)
{
if(IOB_RESET){
ptr.pia = 0;
ptr.busy = 0;
ptr.flag = 0;
ptr.b = 0;
}
if(iodev == PTR){
if(IOB_STATUS){
if(ptr.motor_on) iobus0 |= F27;
if(ptr.b) iobus0 |= F30;
if(ptr.busy) iobus0 |= F31;
if(ptr.flag) iobus0 |= F32;
iobus0 |= ptr.pia & 7;
}
if(IOB_DATAI){
iobus0 |= ptr.ptr;
debug(" PTR: %012lo\n", iobus0);
ptr.flag = 0;
// actually when DATAI is negated again
ptr.busy = 1;
}
if(IOB_CONO_CLEAR){
ptr.pia = 0;
ptr.busy = 0;
ptr.flag = 0;
ptr.b = 0;
}
if(IOB_CONO_SET){
if(iobus0 & F30) ptr.b = 1;
if(iobus0 & F31) ptr.busy = 1;
if(iobus0 & F32) ptr.flag = 1;
ptr.pia |= iobus0 & 7;
}
}
recalc_ptr_req();
}
void
ptr_setmotor(int m)
{
if(ptr.motor_on == m)
return;
ptr.motor_on = m;
if(ptr.motor_on)
ptr.busy = 0;
ptr.flag = 1;
recalc_ptr_req();
}
void
initpt(void)
{
pthread_t thread_id;
ioreq[PTP] = 0;
iobusmap[PTP] = wake_ptp;
ioreq[PTR] = 0;
iobusmap[PTR] = wake_ptr;
pthread_create(&thread_id, nil, ptrthread, nil);
ptr.fp = fopen("../code/test.rim", "rb");
ptp.fp = fopen("../code/ptp.out", "wb");
}

View File

@@ -7,21 +7,6 @@
#include <pthread.h>
#include <poll.h>
/*
* This device is not accurately modeled after the schematics.
*/
#define TTY (0120>>2)
typedef struct Tty Tty;
struct Tty
{
uchar tto, tti;
bool tto_busy, tto_flag;
bool tti_busy, tti_flag;
int pia;
int fd;
};
Tty tty;
void
@@ -45,7 +30,7 @@ ttythread(void *arg)
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if(sockfd < 0){
perror("ERROR opening socket");
perror("error: socket");
exit(1);
}
memset(&serv_addr, 0, sizeof(serv_addr));
@@ -54,7 +39,7 @@ ttythread(void *arg)
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = htons(portno);
if(bind(sockfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0){
perror("ERROR on bind");
perror("error: bind");
exit(1);
}
listen(sockfd,5);
@@ -75,7 +60,7 @@ ttythread(void *arg)
close(newsockfd);
}
if(newsockfd < 0){
perror("ERROR on accept");
perror("error: accept");
exit(1);
}
return nil;
@@ -92,46 +77,47 @@ wake_tty(void)
tty.tti_busy = 0;
tty.tti_flag = 0;
tty.tti = 0;
ioreq[TTY] = 0;
}
if(IOB_STATUS){
if(tty.tti_busy) iobus0 |= F29;
if(tty.tti_flag) iobus0 |= F30;
if(tty.tto_busy) iobus0 |= F31;
if(tty.tto_flag) iobus0 |= F32;
iobus0 |= tty.pia & 7;
}
if(IOB_DATAI){
iobus0 |= tty.tti;
tty.tti_flag = 0;
}
if(IOB_CONO_CLEAR)
tty.pia = 0;
if(IOB_CONO_SET){
if(iobus0 & F25) tty.tti_busy = 0;
if(iobus0 & F26) tty.tti_flag = 0;
if(iobus0 & F27) tty.tto_busy = 0;
if(iobus0 & F28) tty.tto_flag = 0;
if(iobus0 & F29) tty.tti_busy = 1;
if(iobus0 & F30) tty.tti_flag = 1;
if(iobus0 & F31) tty.tto_busy = 1;
if(iobus0 & F32) tty.tto_flag = 1;
tty.pia |= iobus0 & 7;
}
if(IOB_DATAO_CLEAR){
tty.tto = 0;
tty.tto_busy = 1;
tty.tto_flag = 0;
}
if(IOB_DATAO_SET){
tty.tto = iobus0 & 0377;
if(/*tty.tto & 0200 &&*/ tty.fd >= 0){
tty.tto &= ~0200;
write(tty.fd, &tty.tto, 1);
if(iodev == TTY){
if(IOB_STATUS){
if(tty.tti_busy) iobus0 |= F29;
if(tty.tti_flag) iobus0 |= F30;
if(tty.tto_busy) iobus0 |= F31;
if(tty.tto_flag) iobus0 |= F32;
iobus0 |= tty.pia & 7;
}
if(IOB_DATAI){
iobus0 |= tty.tti;
tty.tti_flag = 0;
}
if(IOB_CONO_CLEAR)
tty.pia = 0;
if(IOB_CONO_SET){
if(iobus0 & F25) tty.tti_busy = 0;
if(iobus0 & F26) tty.tti_flag = 0;
if(iobus0 & F27) tty.tto_busy = 0;
if(iobus0 & F28) tty.tto_flag = 0;
if(iobus0 & F29) tty.tti_busy = 1;
if(iobus0 & F30) tty.tti_flag = 1;
if(iobus0 & F31) tty.tto_busy = 1;
if(iobus0 & F32) tty.tto_flag = 1;
tty.pia |= iobus0 & 7;
}
if(IOB_DATAO_CLEAR){
tty.tto = 0;
tty.tto_busy = 1;
tty.tto_flag = 0;
}
if(IOB_DATAO_SET){
tty.tto = iobus0 & 0377;
if(tty.fd >= 0){
tty.tto &= ~0200;
write(tty.fd, &tty.tto, 1);
}
// TTO DONE
tty.tto_busy = 0;
tty.tto_flag = 1;
}
// TTO DONE
tty.tto_busy = 0;
tty.tto_flag = 1;
}
recalc_tty_req();
}

View File

@@ -1329,6 +1329,10 @@ writesymtab(void)
for(i = 0; i < nsym; i++){
s = sortlist[i];
if(s->type & Extern &&
s->v.val == 0 && s->v.rel == 0)
continue;
type = 0;
if(s->type & Intern)
type = SymGlobal;