Six years later… August 23, 2005Posted by winden in coding, demoscene.
Today I was a having a refreshment about 68030 and 68060 optimizing, and found out a nice detail: both 127(a0,d0) and 127(pc,d0) addressing modes take the same time to execute! :) What does this mean:
A. Good things: In a texture mapping loop, we could address the texture using pc-relative addressing, which means that we get a free address register for other purposes.
B. Bad things: For each texture we want to use with a texturing loop, we have to copy the loob body just below the texture memory.
Some examples, first the old standard way:
loop: move.w d0,d6 move.b d1,d6 addx.l d2,d0 addx.l d3,d1 move.b (a0,d6.l),(a1)+ dbf d7,loop rts
and now the “new and improved” way:
loop: move.w d0,d6 move.b d1,d6 addx.l d2,d0 addx.l d3,d1 move.b (tex-*)(pc,d6.l),(a1)+ dbf d7,loop rts cnop 0,4 tex: incbin texture.raw
Of course the times were the same for adress-register-relative and pc-relative addressing, but it was re-reading that specific piece together with having been working for some hours on texturemappers that led me to the “logical” result of instancing a new filler specifically for each texture.