212 lines
7.3 KiB
HTML
212 lines
7.3 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<style>
|
|
body {
|
|
border: 0;
|
|
margin: 30px;
|
|
font-family: monospace;
|
|
font-size: 14px;
|
|
}
|
|
div {
|
|
border: 0;
|
|
padding: 0;
|
|
margin: 0;
|
|
}
|
|
p, pre {
|
|
margin: 0;
|
|
padding: 0;
|
|
line-height: 20px;
|
|
}
|
|
.switch {
|
|
margin: 0 13px 0 0;
|
|
padding: 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h2>Text-mode Altair 8800 simulator</h2>
|
|
|
|
<hr>
|
|
|
|
<p>
|
|
<input type="button" value="POWER ON" onclick="powerOn();">
|
|
<input type="button" value="POWER OFF" onclick="powerOff();">
|
|
<input type="button" value="RUN" onclick="run();">
|
|
<input type="button" value="STOP" onclick="stop();">
|
|
<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>
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<p>LEDs: <!-- ● - on. ○ - off. -->
|
|
<div id="status-leds">
|
|
<p>
|
|
INTE <span class="led">○</span>
|
|
PROT <span class="led">○</span>
|
|
MEMR <span id="memr-led" class="led">○</span>
|
|
INP <span class="led">○</span>
|
|
MI <span id="mi-led" class="led">○</span>
|
|
OUT <span class="led">○</span>
|
|
HLTA <span class="led">○</span>
|
|
STACK <span class="led">○</span>
|
|
WO <span id="wo-led" class="led">○</span>
|
|
INT <span class="led">○</span>
|
|
</p>
|
|
</div>
|
|
|
|
<div id="wait-leds">
|
|
<p>
|
|
WAIT <span id="wait-led" class="led">○</span>
|
|
HLDA <span class="led">○</span>
|
|
</p>
|
|
</div>
|
|
|
|
<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>
|
|
|
|
<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>
|
|
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<p>CPU dump:
|
|
<div id="cpu"></div>
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
<p>Memory dump:
|
|
<div id="mem"></div>
|
|
</p>
|
|
|
|
<script src="js/8080.js"></script>
|
|
<script src="js/sim8800.js"></script>
|
|
<script>
|
|
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] ? '●' : '○';
|
|
}
|
|
}
|
|
|
|
function setWaitLedCallback(isRunning) {
|
|
var ledElem = document.getElementById('wait-led');
|
|
ledElem.innerHTML = isRunning ? '○' : '●';
|
|
}
|
|
|
|
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 ? '●' : '○';
|
|
}
|
|
}
|
|
|
|
var dumpCpuElem = document.getElementById('cpu');
|
|
var dumpMemElem = document.getElementById('mem');
|
|
var sim = new Sim8800(256, 1000000,
|
|
setAddressLedsCallback, setDataLedsCallback,
|
|
setWaitLedCallback, setStatusLedsCallback,
|
|
dumpCpuElem, dumpMemElem);
|
|
|
|
function powerOn() {
|
|
sim.powerOn();
|
|
}
|
|
|
|
function powerOff() {
|
|
sim.powerOff();
|
|
}
|
|
|
|
function run() {
|
|
// Switch echo between A2 and A1.
|
|
// sim.loadDataAsHexString(0, 'db ff d3 ff c3 00 00');
|
|
// Pattern shift.
|
|
sim.loadDataAsHexString(0, '3e 8c d3 ff 0f c3 02 00');
|
|
sim.start();
|
|
}
|
|
|
|
function stop() {
|
|
sim.stop();
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|