Added "lsh" and "rot" commands to the Int36 command-line tool to mimic the PDP-10 opcodes and test their logic
This commit is contained in:
parent
ffb7fa1221
commit
234e8871ba
6 changed files with 308 additions and 45 deletions
|
|
@ -71,10 +71,21 @@ function test(sCmd, fREPL)
|
|||
if (sNum2 != null) console.log(sOp + " " + dumpInt36(i36Op));
|
||||
|
||||
switch(sOp) {
|
||||
case "get":
|
||||
break;
|
||||
|
||||
case "set":
|
||||
i36Reg = new Int36(i36Op);
|
||||
break;
|
||||
|
||||
case "ext":
|
||||
i36Reg.extend(i36Op);
|
||||
break;
|
||||
|
||||
case "red":
|
||||
i36Reg.reduce(i36Op);
|
||||
break;
|
||||
|
||||
case "add":
|
||||
i36Reg.add(i36Op);
|
||||
break;
|
||||
|
|
@ -91,6 +102,18 @@ function test(sCmd, fREPL)
|
|||
i36Reg.div(i36Op);
|
||||
break;
|
||||
|
||||
case "ash":
|
||||
i36Reg.ash(i36Op);
|
||||
break;
|
||||
|
||||
case "lsh":
|
||||
i36Reg.lsh(i36Op);
|
||||
break;
|
||||
|
||||
case "rot":
|
||||
i36Reg.rot(i36Op);
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log("unrecognized command: " + sCmd);
|
||||
return false;
|
||||
|
|
@ -151,6 +174,12 @@ test("set 0o577777777777 0o777777777777");
|
|||
test("set 0o677777777777 0o777777777777");
|
||||
test("set 0o777777777777 0o777777777777");
|
||||
|
||||
test("set 0o112233445566");
|
||||
test("lsh 3");
|
||||
test("lsh -3");
|
||||
test("rot 6");
|
||||
test("rot -6");
|
||||
|
||||
repl.start({
|
||||
prompt: "int36> ",
|
||||
input: process.stdin,
|
||||
|
|
|
|||
Loading…
Reference in a new issue