3 ms·
The memory mapping for High-Res on the Apple II was indeed crazy. Combined with the funky color rules, I was never able to learn enough assembly to make fast l
by dekhn 3y ago
The memory mapping for High-Res on the Apple II was indeed crazy. Combined with the funky color rules, I was never able to learn enough assembly to make fast line drawing.
Having this code when I was a teenager would have been great:
// I told you the memory mapping's crazy
function pixelsToMemory(pixelBytes) {
let mem = new Array(8192).fill(0);
let i = 0;
for (let band = 0; band < 3; band++) {
for (let block_row = 0; block_row < 8; block_row++) {
for (let pixel_row = 0; pixel_row < 8; pixel_row++) {
for (let block_column = 0; block_column < 40; block_column++)
{
let mem_offset = band * 0x28 + block_row * 0x80 + pixel_row * 0x400 + block_column;
mem[mem_offset] = pixelBytes[i];
i++;
}
}
}
}
return mem;
}