2020-03-05 23:36:30 -05:00
|
|
|
<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2020-03-06 09:15:26 -05:00
|
|
|
<meta charset="utf-8">
|
|
|
|
<style>
|
|
|
|
body {
|
2020-03-06 10:52:53 -05:00
|
|
|
border: 0;
|
2020-03-06 09:15:26 -05:00
|
|
|
margin: 30px;
|
|
|
|
font-family: monospace;
|
2020-03-06 10:52:53 -05:00
|
|
|
font-size: 14px;
|
|
|
|
}
|
2020-03-06 11:40:54 -05:00
|
|
|
hr {
|
|
|
|
border-top: #ccc solid 1px;
|
|
|
|
height: 0;
|
|
|
|
margin: 10px 0 10px 0;
|
|
|
|
}
|
2020-03-06 10:52:53 -05:00
|
|
|
div {
|
|
|
|
border: 0;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
p, pre {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
line-height: 20px;
|
|
|
|
}
|
|
|
|
.switch {
|
|
|
|
margin: 0 13px 0 0;
|
|
|
|
padding: 0;
|
2020-03-06 09:15:26 -05:00
|
|
|
}
|
2020-03-06 11:40:54 -05:00
|
|
|
.comments {
|
|
|
|
font-size: 11px;
|
|
|
|
color: #666;
|
|
|
|
line-height: 14px;
|
|
|
|
}
|
2020-03-06 09:15:26 -05:00
|
|
|
</style>
|
2020-03-05 23:36:30 -05:00
|
|
|
</head>
|
2020-03-06 09:15:26 -05:00
|
|
|
<body>
|
|
|
|
<h2>Text-mode Altair 8800 simulator</h2>
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
<p>
|
2020-03-06 10:52:53 -05:00
|
|
|
<input type="button" value="POWER ON" onclick="powerOn();">
|
|
|
|
<input type="button" value="POWER OFF" onclick="powerOff();">
|
2020-03-06 09:15:26 -05:00
|
|
|
<input type="button" value="RUN" onclick="run();">
|
|
|
|
<input type="button" value="STOP" onclick="stop();">
|
2020-03-06 10:52:53 -05:00
|
|
|
<input type="button" value="SINGLE STEP" onclick="singleStep();">
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<input type="button" value="EXAMINE" onclick="examine();">
|
|
|
|
<input type="button" value="EXAMINE NEXT" onclick="examineNext();">
|
|
|
|
<input type="button" value="DEPOSIT" onclick="deposit();">
|
|
|
|
<input type="button" value="DEPOSIT NEXT" onclick="depositNext();">
|
|
|
|
<input type="button" value="RESET" onclick="reset();">
|
|
|
|
<input type="button" value="CLR" disabled>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<input type="button" value="PROTECT" disabled>
|
|
|
|
<input type="button" value="UNPROTECT" disabled>
|
|
|
|
<input type="button" value="AUX" disabled>
|
|
|
|
<input type="button" value="AUX" disabled>
|
2020-03-06 09:15:26 -05:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
|
2020-03-06 11:40:54 -05:00
|
|
|
<p>
|
|
|
|
<input id="data" type="text" size="60">
|
|
|
|
<input type="button" value="LOAD DATA" onclick="loadData();">
|
|
|
|
</p>
|
|
|
|
<pre class="comments">
|
|
|
|
Examples - binary data of simple programs:
|
|
|
|
db ff d3 ff c3 00 00 // Switch echo between A2 and A1.
|
|
|
|
3e 8c d3 ff 0f c3 02 00 // Pattern shift.</pre>
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
|
2020-03-06 09:15:26 -05:00
|
|
|
<p>LEDs: <!-- ● - on. ○ - off. -->
|
2020-03-06 10:52:53 -05:00
|
|
|
<div id="status-leds">
|
|
|
|
<p>
|
|
|
|
INTE <span class="led">○</span>
|
|
|
|
PROT <span class="led">○</span>
|
2020-03-06 11:11:13 -05:00
|
|
|
MEMR <span id="memr-led" class="led">○</span>
|
2020-03-06 10:52:53 -05:00
|
|
|
INP <span class="led">○</span>
|
2020-03-06 11:11:13 -05:00
|
|
|
MI <span id="mi-led" class="led">○</span>
|
2020-03-06 10:52:53 -05:00
|
|
|
OUT <span class="led">○</span>
|
|
|
|
HLTA <span class="led">○</span>
|
|
|
|
STACK <span class="led">○</span>
|
2020-03-06 11:11:13 -05:00
|
|
|
WO <span id="wo-led" class="led">○</span>
|
2020-03-06 10:52:53 -05:00
|
|
|
INT <span class="led">○</span>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="wait-leds">
|
|
|
|
<p>
|
2020-03-06 11:11:13 -05:00
|
|
|
WAIT <span id="wait-led" class="led">○</span>
|
2020-03-06 10:52:53 -05:00
|
|
|
HLDA <span class="led">○</span>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
2020-03-06 09:15:26 -05:00
|
|
|
<div id="data-leds">
|
|
|
|
<p>
|
|
|
|
D7 D6 D5 D4 D3 D2 D1 D0<br>
|
|
|
|
<span id="d7" class="led">○</span>
|
|
|
|
<span id="d6" class="led">○</span>
|
|
|
|
<span id="d5" class="led">○</span>
|
|
|
|
<span id="d4" class="led">○</span>
|
|
|
|
<span id="d3" class="led">○</span>
|
|
|
|
<span id="d2" class="led">○</span>
|
|
|
|
<span id="d1" class="led">○</span>
|
|
|
|
<span id="d0" class="led">○</span>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div id="address-leds">
|
|
|
|
<p>
|
|
|
|
A15 A14 A13 A12 A11 A10 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0<br>
|
|
|
|
<span id="a15" class="led">○</span>
|
|
|
|
<span id="a14" class="led">○</span>
|
|
|
|
<span id="a13" class="led">○</span>
|
|
|
|
<span id="a12" class="led">○</span>
|
|
|
|
<span id="a11" class="led">○</span>
|
|
|
|
<span id="a10" class="led">○</span>
|
|
|
|
<span id="a9" class="led">○</span>
|
|
|
|
<span id="a8" class="led">○</span>
|
|
|
|
<span id="a7" class="led">○</span>
|
|
|
|
<span id="a6" class="led">○</span>
|
|
|
|
<span id="a5" class="led">○</span>
|
|
|
|
<span id="a4" class="led">○</span>
|
|
|
|
<span id="a3" class="led">○</span>
|
|
|
|
<span id="a2" class="led">○</span>
|
|
|
|
<span id="a1" class="led">○</span>
|
|
|
|
<span id="a0" class="led">○</span>
|
|
|
|
</p>
|
|
|
|
</div>
|
2020-03-06 10:52:53 -05:00
|
|
|
|
|
|
|
<div id="switches">
|
|
|
|
<p>
|
|
|
|
<input type="checkbox" id="s15" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s14" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s13" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s12" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s11" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s10" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s9" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s8" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s7" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s6" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s5" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s4" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s3" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s2" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s1" class="switch" value="">
|
|
|
|
<input type="checkbox" id="s0" class="switch" value="">
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
2020-03-06 09:15:26 -05:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
<p>CPU dump:
|
|
|
|
<div id="cpu"></div>
|
|
|
|
</p>
|
2020-03-05 23:36:30 -05:00
|
|
|
|
2020-03-06 09:15:26 -05:00
|
|
|
<hr>
|
2020-03-06 00:06:47 -05:00
|
|
|
|
2020-03-06 09:15:26 -05:00
|
|
|
<p>Memory dump:
|
|
|
|
<div id="mem"></div>
|
|
|
|
</p>
|
2020-03-05 23:36:30 -05:00
|
|
|
|
|
|
|
<script src="js/8080.js"></script>
|
|
|
|
<script src="js/sim8800.js"></script>
|
|
|
|
<script>
|
2020-03-06 10:20:38 -05:00
|
|
|
function setAddressLedsCallback(bits) {
|
|
|
|
for (let i = 0; i < bits.length; i++) {
|
|
|
|
var ledElem = document.getElementById('a' + i);
|
|
|
|
ledElem.innerHTML = bits[i] ? '●' : '○';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function setDataLedsCallback(bits) {
|
|
|
|
for (let i = 0; i < bits.length; i++) {
|
|
|
|
var ledElem = document.getElementById('d' + i);
|
|
|
|
ledElem.innerHTML = bits[i] ? '●' : '○';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-06 10:52:53 -05:00
|
|
|
function setWaitLedCallback(isRunning) {
|
|
|
|
var ledElem = document.getElementById('wait-led');
|
|
|
|
ledElem.innerHTML = isRunning ? '○' : '●';
|
|
|
|
}
|
|
|
|
|
2020-03-06 11:11:13 -05:00
|
|
|
function setStatusLedsCallback(isPoweredOn) {
|
|
|
|
var ledElems = [
|
|
|
|
document.getElementById('memr-led'),
|
|
|
|
document.getElementById('mi-led'),
|
|
|
|
document.getElementById('wo-led')
|
|
|
|
];
|
|
|
|
for (let i = 0; i < ledElems.length; i++) {
|
|
|
|
ledElems[i].innerHTML = isPoweredOn ? '●' : '○';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-06 11:20:04 -05:00
|
|
|
function dumpCpuCallback(dumpHtml) {
|
|
|
|
var dumpCpuElem = document.getElementById('cpu');
|
|
|
|
dumpCpuElem.innerHTML = dumpHtml;
|
|
|
|
}
|
|
|
|
|
|
|
|
function dumpMemCallback(dumpHtml) {
|
|
|
|
var dumpMemElem = document.getElementById('mem');
|
|
|
|
dumpMemElem.innerHTML = dumpHtml;
|
|
|
|
}
|
|
|
|
|
2020-03-06 09:15:26 -05:00
|
|
|
var sim = new Sim8800(256, 1000000,
|
2020-03-06 10:20:38 -05:00
|
|
|
setAddressLedsCallback, setDataLedsCallback,
|
2020-03-06 11:11:13 -05:00
|
|
|
setWaitLedCallback, setStatusLedsCallback,
|
2020-03-06 11:20:04 -05:00
|
|
|
dumpCpuCallback, dumpMemCallback);
|
2020-03-06 09:15:26 -05:00
|
|
|
|
2020-03-06 11:11:13 -05:00
|
|
|
function powerOn() {
|
|
|
|
sim.powerOn();
|
2020-03-06 09:15:26 -05:00
|
|
|
}
|
|
|
|
|
2020-03-06 11:11:13 -05:00
|
|
|
function powerOff() {
|
|
|
|
sim.powerOff();
|
2020-03-06 09:15:26 -05:00
|
|
|
}
|
|
|
|
|
2020-03-06 11:58:08 -05:00
|
|
|
function reset() {
|
|
|
|
sim.reset();
|
|
|
|
}
|
|
|
|
|
2020-03-06 11:40:54 -05:00
|
|
|
function loadData() {
|
|
|
|
var data = document.getElementById("data").value;
|
|
|
|
sim.loadDataAsHexString(0, data);
|
|
|
|
}
|
|
|
|
|
2020-03-06 09:15:26 -05:00
|
|
|
function run() {
|
|
|
|
sim.start();
|
|
|
|
}
|
|
|
|
|
2020-03-06 11:40:54 -05:00
|
|
|
function singleStep() {
|
|
|
|
sim.step(1);
|
|
|
|
}
|
|
|
|
|
2020-03-06 09:15:26 -05:00
|
|
|
function stop() {
|
|
|
|
sim.stop();
|
2020-03-05 23:36:30 -05:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|