#10666 - Burton Radons - Thu Sep 11, 2003 8:26 pm
I noticed that when I wrote a horizontal line segment rendering routine to store u32 instead of u16 that it doubled in speed when using VisualBoy Advance to test. Would this optimisation show up on a real GBA as well, would the 16-bit port size force the same speed, or would it only store the 16-bit and ignore the top half-word? The HLine code is:
(Yeah, I know that it won't do odd-length lines properly.) If this is a false optimisation, are there any GBA emulators which insert slowdown after every instruction or set of instructions to keep the emulated processor running at the same speed as the physical one?
Code: |
void HLine3 (volatile u16* buffer, int sx, int y, int ex, u16 color)
{ volatile u32 *b, *e; /* Parameter clipping excised. */ b = (u32*) (buffer + sx + y * VideoWidth); e = b + (ex - sx) / 2; while (b <= e) *b ++ = color | (color << 16); } |
(Yeah, I know that it won't do odd-length lines properly.) If this is a false optimisation, are there any GBA emulators which insert slowdown after every instruction or set of instructions to keep the emulated processor running at the same speed as the physical one?