Update TODO/FIXME comments for increased clarity and accuracy
This commit is contained in:
parent
74c6f83fcc
commit
b08d9854c4
|
|
@ -127,7 +127,7 @@ function decodeNumericOp(arg) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} op
|
* @param {string} op
|
||||||
* @param {object} labels // TODO document better
|
* @param {object} labels // TODO - document labels object
|
||||||
* @param {number} IP
|
* @param {number} IP
|
||||||
* @returns {Array<string>} - array of labels
|
* @returns {Array<string>} - array of labels
|
||||||
**/
|
**/
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ const CPU = require('./cpu.js');
|
||||||
const io = require('./io.js');
|
const io = require('./io.js');
|
||||||
|
|
||||||
|
|
||||||
// TODO TEMPORARY - replace with reading STDIN:
|
// TODO - replace with reading STDIN:
|
||||||
const assembler = require('./assembler.js');
|
const assembler = require('./assembler.js');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ async function tick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function logDisplay() {
|
function logDisplay() {
|
||||||
io.showDisplay(cpu.memory, true); // TODO more compled printing
|
io.showDisplay(cpu.memory, true); // FIXME - display - allow printing hex as well as pretty-printing
|
||||||
}
|
}
|
||||||
|
|
||||||
function logCPUState() {
|
function logCPUState() {
|
||||||
|
|
|
||||||
20
src/cpu.js
20
src/cpu.js
|
|
@ -35,11 +35,11 @@ module.exports = class CPU {
|
||||||
this.memory.set(machineCode, 0);
|
this.memory.set(machineCode, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
peek() { return; } // TODO
|
peek() { return; } // TODO - implement Peek
|
||||||
|
|
||||||
poke() { return; } // TODO
|
poke() { return; } // TODO - implement Poke
|
||||||
|
|
||||||
/** @param {Array} info **/ // TODO type info
|
/** @param {Array} info **/ // TODO - document type for 'sourceInfo'
|
||||||
loadSourceInfo(info) {
|
loadSourceInfo(info) {
|
||||||
this.dbg.sourceInfo = info;
|
this.dbg.sourceInfo = info;
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +54,7 @@ module.exports = class CPU {
|
||||||
this._cycleStartCallbacks.forEach((fn) => fn());
|
this._cycleStartCallbacks.forEach((fn) => fn());
|
||||||
|
|
||||||
if (this.IP >= this.memory.length) {
|
if (this.IP >= this.memory.length) {
|
||||||
console.error('HALTING - IP greater than memory size'); // TODO -- should this throw an error instead?
|
console.error('HALTING - IP greater than memory size'); // FIXME - halting the CPU should throw an error instead
|
||||||
this.running = false;
|
this.running = false;
|
||||||
} else {
|
} else {
|
||||||
this.instruction.opcode = this.memory[this.IP];
|
this.instruction.opcode = this.memory[this.IP];
|
||||||
|
|
@ -68,7 +68,7 @@ module.exports = class CPU {
|
||||||
|
|
||||||
// Temporary limit as a lazy way to halt infinite loops
|
// Temporary limit as a lazy way to halt infinite loops
|
||||||
if ((this._cycleLimit > 0) && this.dbg.cycleCounter >= this._cycleLimit) {
|
if ((this._cycleLimit > 0) && this.dbg.cycleCounter >= this._cycleLimit) {
|
||||||
console.warn(' HALTING - reached cycle limit'); // TODO -- throw error?
|
console.warn(' HALTING - reached cycle limit'); // FIXME - throw error instead
|
||||||
this.running = false;
|
this.running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -164,7 +164,7 @@ module.exports = class CPU {
|
||||||
let bitSixCarry = 0;
|
let bitSixCarry = 0;
|
||||||
if ((this.acc & 64) && (lit & 64)) { bitSixCarry = 1; }
|
if ((this.acc & 64) && (lit & 64)) { bitSixCarry = 1; }
|
||||||
// let overflow = bitSixCarry ^ (this.flags & 8);
|
// let overflow = bitSixCarry ^ (this.flags & 8);
|
||||||
// FIXME FIXME FIXME
|
// FIXME - re-implement overflow
|
||||||
// I'm on a plane and can't remember how this works
|
// I'm on a plane and can't remember how this works
|
||||||
let overflow = 0;
|
let overflow = 0;
|
||||||
if (overflow) {
|
if (overflow) {
|
||||||
|
|
@ -192,7 +192,7 @@ module.exports = class CPU {
|
||||||
let bitSixCarry = 0;
|
let bitSixCarry = 0;
|
||||||
if ((this.acc & 64) && (addr & 64)) { bitSixCarry = 1; }
|
if ((this.acc & 64) && (addr & 64)) { bitSixCarry = 1; }
|
||||||
// let overflow = bitSixCarry ^ (this.flags & 8);
|
// let overflow = bitSixCarry ^ (this.flags & 8);
|
||||||
// FIXME FIXME FIXME
|
// FIXME - re-implement overflow
|
||||||
// I'm on a plane and can't remember how this works
|
// I'm on a plane and can't remember how this works
|
||||||
let overflow = 0;
|
let overflow = 0;
|
||||||
if (overflow) {
|
if (overflow) {
|
||||||
|
|
@ -220,7 +220,7 @@ module.exports = class CPU {
|
||||||
let bitSixCarry = 0;
|
let bitSixCarry = 0;
|
||||||
if ((this.acc & 64) && (lit & 64)) { bitSixCarry = 1; }
|
if ((this.acc & 64) && (lit & 64)) { bitSixCarry = 1; }
|
||||||
// let overflow = bitSixCarry ^ (this.flags & 8);
|
// let overflow = bitSixCarry ^ (this.flags & 8);
|
||||||
// FIXME FIXME FIXME
|
// FIXME - re-implement overflow
|
||||||
// I'm on a plane and can't remember how this works
|
// I'm on a plane and can't remember how this works
|
||||||
let overflow = 0;
|
let overflow = 0;
|
||||||
if (overflow) {
|
if (overflow) {
|
||||||
|
|
@ -248,7 +248,7 @@ module.exports = class CPU {
|
||||||
let bitSixCarry = 0;
|
let bitSixCarry = 0;
|
||||||
if ((this.acc & 64) && (addr & 64)) { bitSixCarry = 1; }
|
if ((this.acc & 64) && (addr & 64)) { bitSixCarry = 1; }
|
||||||
// let overflow = bitSixCarry ^ (this.flags & 8);
|
// let overflow = bitSixCarry ^ (this.flags & 8);
|
||||||
// FIXME FIXME FIXME
|
// FIXME - re-implement overflow
|
||||||
// I'm on a plane and can't remember how this works
|
// I'm on a plane and can't remember how this works
|
||||||
let overflow = 0;
|
let overflow = 0;
|
||||||
if (overflow) {
|
if (overflow) {
|
||||||
|
|
@ -293,7 +293,7 @@ module.exports = class CPU {
|
||||||
flag_toggle: (flagNum) => {
|
flag_toggle: (flagNum) => {
|
||||||
if (flagNum === null) {
|
if (flagNum === null) {
|
||||||
console.error('Invalid flag number');
|
console.error('Invalid flag number');
|
||||||
process.exit(); // TODO review
|
process.exit(); // FIXME -- throw error instead
|
||||||
}
|
}
|
||||||
const flagName = this.flagNums[flagNum];
|
const flagName = this.flagNums[flagNum];
|
||||||
this.dbg.currentMnemonic = `FTG ${flagName}`;
|
this.dbg.currentMnemonic = `FTG ${flagName}`;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ function getKeypadInput(cpu) {
|
||||||
process.stdin.setRawMode(true);
|
process.stdin.setRawMode(true);
|
||||||
}
|
}
|
||||||
process.stdin.on('keypress', (str, key) => {
|
process.stdin.on('keypress', (str, key) => {
|
||||||
// TODO: is it possible to turn this off again?
|
|
||||||
if (key.sequence === '\x03') process.exit();
|
if (key.sequence === '\x03') process.exit();
|
||||||
let name = key.name.toUpperCase();
|
let name = key.name.toUpperCase();
|
||||||
if (name in CFG.keyMap) {
|
if (name in CFG.keyMap) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue