Unpacking attribute table with lazy evaluation, 68020+/AGA style:
do it 100% on the CPU side.
Code:
char currentAttributeTable[64] = ...;
char previousAttributeTable[64] = ...;
for (i = 0; i < 64; i++)
{
if (currentAttributeTable[i] != previousAttributeTable[i])
{
write 32x32 pixels x 2 bitplanes to chipmem, with currentAttributeTable[i] as the source info
}
}
work to be done:
1) 64*2 = 128 bytes of fastmem reads, regardless of number of changes
2) for every byte that has changed, generate pixelmasks to write to chipmem - should take not more than a bunch of cycles
3) for every byte that has changed, write 32*4*2 = 256 bytes to chipmem
If there is a significant numbeer of updates, then 90%+ of the time will be spent waiting for chipwrites to complete. You could actually build a copperlist (or use a blitter interrupt) and get the blitter to perform the memory writes. This would work out because the amount of info that you need to transfer fast->chip is vastly smaller than the amount of chipmem writing that needs to be done.