1
0
mirror of https://github.com/pkimpel/retro-b5500.git synced 2026-04-27 20:49:07 +00:00

Further debugging of B5500Processor; implement individual memory access routines based on the registers used.

This commit is contained in:
paul
2013-01-14 03:22:13 +00:00
parent dce44f5bdb
commit 1959547adc
3 changed files with 526 additions and 214 deletions

View File

@@ -269,7 +269,7 @@ B5500CentralControl.prototype.fieldInsert = function(word, start, width, value)
var bottom = // unaffected bottom portion of word
(le == 0 ? 0 : (word % (bpower = B5500CentralControl.pow2[le])));
var top = // unaffected top portion of word
(bit == 0 ? 0 : (word - (word % B5500CentralControl.pow2[ue])));
(ue == 0 ? 0 : (word - (word % B5500CentralControl.pow2[ue])));
return (value % B5500CentralControl.pow2[width])*bpower + top + bottom;
};
@@ -286,7 +286,7 @@ B5500CentralControl.prototype.fieldTransfer = function(word, wstart, width, valu
var bottom = // unaffected bottom portion of word
(le == 0 ? 0 : (word % (bpower = B5500CentralControl.pow2[le])));
var top = // unaffected top portion of word
(bit == 0 ? 0 : (word - (word % B5500CentralControl.pow2[ue])));
(ue == 0 ? 0 : (word - (word % B5500CentralControl.pow2[ue])));
return ((ve == 0 ? value :
(value - value % (vpower = B5500CentralControl.pow2[ve]))/vpower
@@ -709,7 +709,7 @@ B5500CentralControl.prototype.loadComplete = function loadComplete() {
if (completed) {
that.loadTimer = null;
that.LOFF = 0;
that.P1.start();
that.P1.start(0x10); // start execution at C=@20
}
};
@@ -800,7 +800,7 @@ B5500CentralControl.prototype.runTest = function(runAddr) {
this.clear();
this.loadTimer = null;
this.LOFF = 0;
this.P1.start();
this.P1.start(runAddr);
};
/**************************************/

File diff suppressed because it is too large Load Diff

View File

@@ -37,7 +37,7 @@ function setText(id, text) {
/* Replaces the children of the node having id="id" with a text node containing "text" */
var e = $$(id);
var f;
if (!e) {
alert("Invalid setText() node id \"" + id + "\"");
} else {
@@ -49,7 +49,7 @@ function setText(id, text) {
}
function parseToOctal(e) {
/* Obtains the .value from the element "e", parses it, and returns the
/* Obtains the .value from the element "e", parses it, and returns the
result as a B5500 numeric word. If the element text contains any of "-+eE."
the text is parsed as a decimal integer or floating point number, otherwise
it is parsed as an octal value */
@@ -59,7 +59,7 @@ function parseToOctal(e) {
var tv = 0; // sign of parsed value exponent
var text = e.value; // text of element
var v; // parsed value of element text
if (text.search(/\S/) < 0) {
text = "0";
}
@@ -75,7 +75,7 @@ function parseToOctal(e) {
while (v < 0x1000000000) {
v *= 8;
ev--;
}
}
while (v >= 0x8000000000) {
v /= 8;
ev++;
@@ -94,7 +94,7 @@ function parseToOctal(e) {
v = (((sv*2) + tv)*64 + ev%64)*0x8000000000 + mv; // to B5500 format
}
}
if (isNaN(v)) {
e.style.backgroundColor = "red";
} else {
@@ -104,11 +104,11 @@ function parseToOctal(e) {
}
function padOctal(value, octades) {
/* Formats "value" as an octal number of "octades" length, left-padding with
/* Formats "value" as an octal number of "octades" length, left-padding with
zeroes as necessary */
var text = value.toString(8);
var len = text.length;
while (len++ < octades) {
text = "0" + text;
}
@@ -116,10 +116,10 @@ function padOctal(value, octades) {
}
function displayOctal(id, value, octades) {
/* Formats the "value" as octal of length "octades" and sets the "id".value
/* Formats the "value" as octal of length "octades" and sets the "id".value
property with the result */
var e = $$(id);
e.value = padOctal(value, octades);
}
@@ -130,14 +130,14 @@ function displayNumber(id, value) {
var e = (value - m)/0x8000000000; // get the exponent and sign bits
var s = (e & 0x80) >>> 7; // get the mantissa sign
var t = (e & 0x40) >>> 6; // get the exponent sign
e = (t ? -(e & 0x3F) : (e & 0x3F)); // get signed value of exponent
setText(id, (Math.pow(8, e)*(s ? -m : m)).toPrecision(12));
}
function displayMemWord(e, addr, valueID) {
/* Displays the contents of the memory word at "addr" as the value of element "e" */
setText(valueID, "");
e.setAttribute("data-b55sd-addr", addr.toString(8));
accessor.addr = addr;
@@ -151,7 +151,7 @@ function displayMemWord(e, addr, valueID) {
} else if (accessor.MAED) {
e.style.backgroundColor = "yellow";
e.value = "<< INV ADDR >>";
} else {
} else {
e.style.backgroundColor = "";
displayOctal(e.id, accessor.word, 16);
displayNumber(valueID, accessor.word);
@@ -164,18 +164,18 @@ function displayStack() {
var e;
var valueID;
var x;
displayOctal("AReg", cc.P1.A, 16);
displayNumber("ARegValue", cc.P1.A);
$$("AROF").checked = (cc.P1.AROF != 0);
displayOctal("BReg", cc.P1.B, 16);
displayNumber("BRegValue", cc.P1.B);
$$("BROF").checked = (cc.P1.BROF != 0);
for (x=0; x<=7; x++) {
addr = cc.P1.S - x;
setText("SAddr" + x, padOctal(addr, 5));
setText("SAddr" + x, padOctal(addr, 5));
e = $$("SWord" + x);
valueID = e.getAttribute("data-b55sd-valueID");
displayMemWord(e, addr, valueID);
@@ -189,14 +189,14 @@ function displayMemory() {
var suffix;
var valueID;
var x;
for (x=-4; x<=4; x++) {
suffix = (x < 0 ? "M" + (-x) : "P" + x);
addr = memAddr + x;
if (x == 0) {
displayOctal("MAddr", addr, 5);
} else {
setText("MAddr" + suffix, padOctal(addr, 5));
setText("MAddr" + suffix, padOctal(addr, 5));
}
e = $$("MWord" + suffix);
valueID = e.getAttribute("data-b55sd-valueID");
@@ -206,12 +206,12 @@ function displayMemory() {
function displayRegisters() {
/* Displays the non-stack processor registers */
displayOctal("XReg", cc.P1.X, 13);
displayOctal("CReg", cc.P1.C, 5);
displayOctal("LReg", cc.P1.L, 1);
displayOctal("PReg", cc.P1.P, 16);
$$("PROF").checked = (cc.P1.PROF != 0);
$$("PROF").checked = (cc.P1.PROF != 0);
displayOctal("TReg", cc.P1.T, 4);
$$("TROF").checked = (cc.P1.TROF != 0);
displayOctal("EReg", cc.P1.E, 2);
@@ -227,7 +227,7 @@ function displayRegisters() {
displayOctal("RReg", cc.P1.R, 3);
displayOctal("YReg", cc.P1.Y, 2);
displayOctal("ZReg", cc.P1.Z, 2);
displayOctal("NReg", cc.P1.N, 2);
displayOctal("NReg", cc.P1.N, 2);
$$("NCSF").checked = (cc.P1.NCSF != 0);
$$("CWMF").checked = (cc.P1.CWMF != 0);
$$("SALF").checked = (cc.P1.SALF != 0);
@@ -236,7 +236,7 @@ function displayRegisters() {
function displayProcessorState() {
/* Extracts and displays the current processor state on the web page */
displayStack();
displayMemory();
displayRegisters();
@@ -268,15 +268,15 @@ function stepIt(exec) {
saveL = cc.P1.L;
saveP = cc.P1.P;
cc.P1.T = opcode;
}
}
cc.P1.step();
if (exec) {
cc.P1.T = saveT;
cc.P1.C = saveC;
cc.P1.L = saveL;
cc.P1.P = saveP;
}
}
displayProcessorState();
}
@@ -286,7 +286,7 @@ function word_onChange(ev) {
var e = ev.target;
var value;
var valueID = e.getAttribute("data-b55sd-valueID");
value = e.getAttribute("data-b55sd-addr");
addr = parseInt(value, 8);
if (isNaN(addr)) {
@@ -311,7 +311,7 @@ function reg_onChange(ev) {
/* Normalizes, sets, and displays the value of a register when changed */
var e = ev.target;
var value;
value = parseToOctal(e);
if (isNaN(value)) {
e.style.backgroundColor = "red";
@@ -322,11 +322,18 @@ function reg_onChange(ev) {
return value;
}
function ff_onChange(ev) {
/* Sets the value of a flip-flop when changed */
var e = ev.target;
return (e.checked ? 1 : 0);
}
function tos_onChange(ev, valueID, origID) {
/* Normalizes and displays the value of a register when changed */
var e = ev.target;
var value;
value = parseToOctal(e);
if (isNaN(value)) {
e.style.backgroundColor = "red";
@@ -343,43 +350,118 @@ window.onload = function() {
$$("LogoDiv").onclick = function(ev) {
displayProcessorState();
};
$$("AReg").onchange = function(ev) {
cc.P1.A = tos_onChange(ev, "ARegValue", "ARegOrig");
cc.P1.AROF = 1;
$$("AROF").checked = true;
};
$$("AROF").onclick = function(ev) {
cc.P1.AROF = (ev.target.checked ? 1 : 0);
}
cc.P1.AROF = ff_onChange(ev);
};
$$("BReg").onchange = function(ev) {
cc.P1.B = tos_onChange(ev, "BRegValue", "BRegOrig");
cc.P1.BROF = 1;
$$("BROF").checked = true;
};
$$("BROF").onclick = function(ev) {
cc.P1.BROF = (ev.target.checked ? 1 : 0);
}
cc.P1.BROF = ff_onChange(ev);
};
$$("MAddr").onchange = function(ev) {
var addr = parseToOctal(ev.target);
var addr = reg_onChange(ev);
if (!isNaN(addr)) {
memAddr = addr & 0x7FFF;
displayMemory();
}
};
$$("XReg").onchange = function(ev) {
cc.P1.X = reg_onChange(ev);
};
$$("CReg").onchange = function(ev) {
cc.P1.C = reg_onChange(ev);
};
$$("LReg").onchange = function(ev) {
cc.P1.L = reg_onChange(ev);
};
$$("PReg").onchange = function(ev) {
cc.P1.P = reg_onChange(ev);
};
$$("PROF").onclick = function(ev) {
cc.P1.PROF = ff_onChange(ev);
};
$$("TReg").onchange = function(ev) {
cc.P1.T = reg_onChange(ev);
};
$$("TROF").onclick = function(ev) {
cc.P1.TROF = ff_onChange(ev);
};
$$("EReg").onchange = function(ev) {
cc.P1.E = reg_onChange(ev);
};
$$("IReg").onchange = function(ev) {
cc.P1.I = reg_onChange(ev);
};
$$("QReg").onchange = function(ev) {
cc.P1.Q = reg_onChange(ev);
};
$$("MReg").onchange = function(ev) {
cc.P1.M = reg_onChange(ev);
};
$$("GReg").onchange = function(ev) {
cc.P1.G = reg_onChange(ev);
};
$$("HReg").onchange = function(ev) {
cc.P1.H = reg_onChange(ev);
};
$$("SReg").onchange = function(ev) {
var addr = parseToOctal(ev.target);
var addr = reg_onChange(ev);
if (!isNaN(addr)) {
cc.P1.S = addr & 0x7FFF;
displayStack();
}
};
$$("TReg").onchange = function(ev) {
cc.P1.T = reg_onChange(ev);
$$("KReg").onchange = function(ev) {
cc.P1.K = reg_onChange(ev);
};
$$("VReg").onchange = function(ev) {
cc.P1.V = reg_onChange(ev);
};
$$("FReg").onchange = function(ev) {
cc.P1.F = reg_onChange(ev);
};
$$("RReg").onchange = function(ev) {
cc.P1.R = reg_onChange(ev);
};
$$("YReg").onchange = function(ev) {
cc.P1.Y = reg_onChange(ev);
};
$$("ZReg").onchange = function(ev) {
cc.P1.Z = reg_onChange(ev);
};
$$("NReg").onchange = function(ev) {
cc.P1.N = reg_onChange(ev);
};
$$("NCSF").onclick = function(ev) {
cc.P1.NCSF = ff_onChange(ev);
};
$$("CWMF").onclick = function(ev) {
cc.P1.CWMF = ff_onChange(ev);
};
$$("MSFF").onclick = function(ev) {
cc.P1.MSFF = ff_onChange(ev);
};
$$("SALF").onclick = function(ev) {
cc.P1.SALF = ff_onChange(ev);
};
$$("VARF").onclick = function(ev) {
cc.P1.VARF = ff_onChange(ev);
};
$$("SWord0").onchange = word_onChange;
$$("SWord1").onchange = word_onChange;
$$("SWord2").onchange = word_onChange;
@@ -388,7 +470,7 @@ window.onload = function() {
$$("SWord5").onchange = word_onChange;
$$("SWord6").onchange = word_onChange;
$$("SWord7").onchange = word_onChange;
$$("MWordM4").onchange = word_onChange;
$$("MWordM3").onchange = word_onChange;
$$("MWordM2").onchange = word_onChange;
@@ -411,9 +493,9 @@ window.onload = function() {
cc.P1.T = cc.fieldIsolate(cc.P1.P, 0, 12);
cc.P1.TROF = 1;
cc.P1.L = 1; // point to the next instruction
cc.P1.NCSF = 0; // initiate test in control state
displayProcessorState();
}
</script>
@@ -425,7 +507,7 @@ window.onload = function() {
<div id=BurroughsLogo>
<img id=BurroughsLogoImage src="../Burroughs-Logo-Neg.jpg">
</div>
<div id=B5500Logo>B 5500
<div id=B5500Logo>B 5500
</div>
</div>
@@ -451,7 +533,7 @@ window.onload = function() {
data-b55sd-valueID=ARegValue data-b55sd-origID=ARegOrig>
<td id=ARegValue class=number>
<td id=ARegOrig class=number>
<tr>
<tr>
<td class=center>B
<td>
<input id=BROF name=BROF type=checkbox value=1><label for=BROF>BROF</label>
@@ -529,7 +611,7 @@ window.onload = function() {
<tr>
<td colspan=5 class="center bold">MEMORY
<tr>
<td class=center>M+4
<td class=center>+4
<td id=MAddrP4 class="data center">44444
<td>
<input id=MWordP4 name=MWordP4 type=text class=number size=16 maxlength=16
@@ -537,7 +619,7 @@ window.onload = function() {
<td id=MValueP4 class=number>
<td id=MOrigP4 class=number>
<tr>
<td class=center>M+3
<td class=center>+3
<td id=MAddrP3 class="data center">33333
<td>
<input id=MWordP3 name=MWordP3 type=text class=number size=16 maxlength=16
@@ -545,7 +627,7 @@ window.onload = function() {
<td id=MValueP3 class=number>
<td id=MOrigP3 class=number>
<tr>
<td class=center>M+2
<td class=center>+2
<td id=MAddrP2 class="data center">22222
<td>
<input id=MWordP2 name=MWordP2 type=text class=number size=16 maxlength=16
@@ -553,7 +635,7 @@ window.onload = function() {
<td id=MValueP2 class=number>
<td id=MOrigP2 class=number>
<tr>
<td class=center>M+1
<td class=center>+1
<td id=MAddrP1 class="data center">11111
<td>
<input id=MWordP1 name=MWordP1 type=text class=number size=16 maxlength=16
@@ -561,16 +643,16 @@ window.onload = function() {
<td id=MValueP1 class=number>
<td id=MOrigP1 class=number>
<tr>
<td class=center>Mem
<td class=center>Addr
<td class="center">
<input id=MAddr name=MAddr type=text class=center size=5 maxlength=5>
<input id=MAddr name=MAddr type=text class=center size=5 maxlength=5>
<td>
<input id=MWordP0 name=MWordP0 type=text class=number size=16 maxlength=16
data-b55sd-valueID=MValueP0 data-b55sd-origID=MOrigP0>
<td id=MValueP0 class=number>
<td id=MOrigP0 class=number>
<tr>
<td class=center>M-1
<td class=center>-1
<td id=MAddrM1 class="data center">11111
<td>
<input id=MWordM1 name=MWordM1 type=text class=number size=16 maxlength=16
@@ -578,7 +660,7 @@ window.onload = function() {
<td id=MValueM1 class=number>
<td id=MOrigM1 class=number>
<tr>
<td class=center>M-2
<td class=center>-2
<td id=MAddrM2 class="data center">22222
<td>
<input id=MWordM2 name=MWordM2 type=text class=number size=16 maxlength=16
@@ -586,7 +668,7 @@ window.onload = function() {
<td id=MValueM2 class=number>
<td id=MOrigM2 class=number>
<tr>
<td class=center>M-3
<td class=center>-3
<td id=MAddrM3 class="data center">33333
<td>
<input id=MWordM3 name=MWordM3 type=text class=number size=16 maxlength=16
@@ -594,7 +676,7 @@ window.onload = function() {
<td id=MValueM3 class=number>
<td id=MOrigM3 class=number>
<tr>
<td class=center>M-4
<td class=center>-4
<td id=MAddrM4 class="data center">44444
<td>
<input id=MWordM4 name=MWordM4 type=text class=number size=16 maxlength=16
@@ -605,7 +687,7 @@ window.onload = function() {
<table id=RegisterBank2 class="normal border">
<tbody>
<tr>
<tr>
<td class=center>X
<td colspan=5>
<input id=XReg name=XReg type=text class=number size=13 maxlength=13>
@@ -679,15 +761,17 @@ window.onload = function() {
&nbsp;&nbsp;
<input id=CWMF name=CWMF type=checkbox value=1><label for=CWMF>CWMF</label>
&nbsp;&nbsp;
<input id=MSFF name=MSFF type=checkbox value=1><label for=MSFF>MSFF</label>
&nbsp;&nbsp;
<input id=SALF name=SALF type=checkbox value=1><label for=SALF>SALF</label>
&nbsp;&nbsp;
<input id=VARF name=VARF type=checkbox value=1><label for=VARF>VARF</label>
</table>
<p>
<input id=Step name=Step type=button value="Step" onclick="return stepIt(false)">
<input id=Step name=Step type=button value="Step" accesskey=P onclick="return stepIt(false)">
&nbsp;
Syllable:
Syllable:
<select id=OpList name=OpList>
<option value="0055" selected>NOP : No Operation
<option value="0101">ADD : Add
@@ -707,7 +791,7 @@ Syllable:
</select>
&nbsp;
<input id=Step name=Exec type=button value="Exec" onclick="return stepIt(true)">
<input id=Step name=Exec type=button value="Exec" accesskey=X onclick="return stepIt(true)">
</p>
</body>