pxt-ev3/brick/scripts/dump.js

35 lines
698 B
JavaScript
Raw Normal View History

2017-07-25 13:18:48 +02:00
#!/bin/sh
let fs = require("fs")
let styles = {
"0": "rxtx",
"1": " tx",
"2": "rx ",
}
function build() {
let kern = fs.readFileSync( "foo")
let off = 0x0001df30
kern = kern.slice(off + 6 * 5, off + 6 * (5 + 6))
console.log(kern.toString("hex"))
off = 0
for (let i = 0; i < 30; ++i) {
if (kern[off+4] == 64) {
kern[off+4] = 0
kern[off+5] = 2
}
if(kern[off] == 3 || kern[off] == 4) {
kern[off+4] = 0
kern[off+5] = 1
}
console.log(`ep=${kern[off]} style=${styles[kern[off+1]]} buf=${kern[off+2] == 0 ? "sin" : kern[off+2] == 1 ? "dbl" : "XXX"} pad=${kern[off+3]} sz=${kern[off+4]+(kern[off+5]<<8)}`)
off += 6
}
console.log(kern.toString("hex"))
}
build()