Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 18x 6x 3x 157726x 2381x 4x 4x 4x 4x 4x 4x 4x 2032x 2032x 2032x 2032x 52x 52x 52x 4x 4x 4x 52x 4x | export function parseAddr(s) {
if (s[0] === "$" || s[0] === "&") return parseInt(s.substring(1), 16);
if (s.indexOf("0x") === 0) return parseInt(s.substring(2), 16);
return parseInt(s, 16);
}
export function hexbyte(value) {
return ((value >>> 4) & 0xf).toString(16) + (value & 0xf).toString(16);
}
export function hexword(value) {
return hexbyte(value >>> 8) + hexbyte(value & 0xff);
}
export function hd(reader, start, end, opts) {
opts = opts || {};
const width = opts.width || 16;
const gap = opts.gap === undefined ? 8 : opts.gap;
const res = [];
let str = "";
let j = 0;
for (let i = start; i < end; ++i) {
str += " ";
str += hexbyte(reader(i));
if (++j === gap) str += " ";
if (j === width) {
res.push(str);
str = "";
j = 0;
}
}
Iif (str) res.push(str);
let joined = "";
for (let i = 0; i < res.length; ++i) {
joined += hexword(start + i * width) + " :" + res[i] + "\n";
}
return joined;
}
|