Turn on Jsdoc-based type checking
This commit is contained in:
parent
ea26f5d77b
commit
4f82cd9c9e
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"checkJs": true
|
||||
},
|
||||
"exclude": ["node_modules", "**/node_modules/*"]
|
||||
}
|
||||
18
logging.js
18
logging.js
|
|
@ -1,3 +1,10 @@
|
|||
/**
|
||||
* Display a table of memory locations.
|
||||
* Call with [start] and [end] indices to display a range.
|
||||
* @param {Uint8Array} mem - Memory to display
|
||||
* @param {number} [start] - A start-index, in decimal
|
||||
* @param {number} [end] - An end-index, in decimal
|
||||
**/
|
||||
const logMemory = (mem, start=0, end=mem.length) => {
|
||||
// This function can only handle
|
||||
// an even number of array entries
|
||||
|
|
@ -15,7 +22,7 @@ const logMemory = (mem, start=0, end=mem.length) => {
|
|||
// Add a blank row every 4 lines:
|
||||
if (((i + 2) % 8) === 0) {
|
||||
if ((i < (mem.length - 2))) {
|
||||
console.log(`│ │ │ │`);
|
||||
console.log(`│ │ │ │`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -30,7 +37,16 @@ const logRunningHeader = () => {
|
|||
console.log( `└─────────────────────┘`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} num
|
||||
* @returns {string}
|
||||
*/
|
||||
const num2hex = (num) => num.toString(16).toUpperCase().padStart(2, "0");
|
||||
|
||||
/**
|
||||
* @param {string} hex
|
||||
* @returns {number}
|
||||
*/
|
||||
const hex2num = (hex) => parseInt(hex, 16);
|
||||
|
||||
module.exports = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue