no diff using different temp

This commit is contained in:
Brooke Vibber 2023-02-11 15:47:58 -08:00
commit 99197bb7b2
3 changed files with 86 additions and 8 deletions

33
tables.js Normal file
View file

@ -0,0 +1,33 @@
function db(func) {
let lines = [];
for (let i = 0; i < 256; i += 16) {
let items = [];
for (let j = 0; j < 16; j++) {
let x = i + j;
items.push(func(x));
}
lines.push(' .byte ' + items.join(', '));
}
return lines.join('\n');
}
console.log(
`.segment "TABLES"
.export mul_lobyte256
.export mul_hibyte256
.export mul_hibyte512
.align 256
mul_lobyte256:
${db((x) => Math.round(x * x / 2) & 0xff)}
.align 256
mul_hibyte256:
${db((x) => (Math.round(x * x / 2) >> 8) & 0xff)}
.align 256
mul_hibyte512:
${db((x) => (Math.round((x + 256) * (x + 256) / 2) >> 8) & 0xff)}
`);