Remove unused comments, table-printing function
This commit is contained in:
parent
91c4a068e9
commit
aa08e50eda
13
simulator.js
13
simulator.js
|
|
@ -1,5 +1,4 @@
|
|||
const { INITIAL_IP_ADDRESS, CYCLE_LIMIT } = require('./machine.config');
|
||||
|
||||
const display = require('./display.js');
|
||||
|
||||
// STATE
|
||||
|
|
@ -27,14 +26,12 @@ const Instructions = {
|
|||
store_lit: (lit) => {
|
||||
console.log('STO lit#');
|
||||
CPU.memory[lit] = CPU.Acc;
|
||||
// logTableTitled(CPU.memory, 'Current memory');
|
||||
CPU.IP = CPU.IP += 2;
|
||||
},
|
||||
|
||||
store_addr: (addr) => {
|
||||
console.log('STO addr');
|
||||
CPU.memory[CPU.memory[addr]] = CPU.Acc;
|
||||
//logTableTitled(CPU.memory, 'Memory');
|
||||
CPU.IP = CPU.IP += 2;
|
||||
},
|
||||
|
||||
|
|
@ -127,7 +124,6 @@ const Instructions = {
|
|||
carry_hop: () => {
|
||||
console.log("CHP");
|
||||
console.log(` ↳ Memory at IP+2 and +3: ${CPU.memory[CPU.IP+2]}, ${CPU.memory[CPU.IP+3]}`);
|
||||
// console.table(CPU.memory);
|
||||
if (CPU.CF != 0) {
|
||||
CPU.IP += 4;
|
||||
} else {
|
||||
|
|
@ -155,7 +151,6 @@ const opcodes2mnemonics = {
|
|||
};
|
||||
|
||||
function stepCPU() {
|
||||
// console.group("Step CPU");
|
||||
console.group(`IP: ${CPU.IP}`);
|
||||
let opcode = CPU.memory[CPU.IP];
|
||||
let argument = CPU.memory[CPU.IP+1];
|
||||
|
|
@ -166,7 +161,6 @@ function stepCPU() {
|
|||
|
||||
logCPUState();
|
||||
console.groupEnd(`IP:`);
|
||||
// console.groupEnd("Step CPU");
|
||||
}
|
||||
|
||||
exports.runProgram = async (code, debug = false) => {
|
||||
|
|
@ -206,13 +200,6 @@ function logCPUState() {
|
|||
function num2hex(num) { return num.toString(16) };
|
||||
function hex2num(hex) { return parseInt(hex, 16) };
|
||||
|
||||
logTableTitled = (memory, tableTitle) => {
|
||||
console.log();
|
||||
console.group(tableTitle);
|
||||
console.table(memory);
|
||||
console.groupEnd(tableTitle);
|
||||
};
|
||||
|
||||
function logRunningHeader() {
|
||||
console.log();
|
||||
let time = new Date();
|
||||
|
|
|
|||
Loading…
Reference in New Issue