Mail Archives: djgpp/1996/12/31/08:42:05
Thomas Harte wrote:
> I wrote it somewhere else, but for anyone who only reads this message, I
> just wanted to add that you can use a shortcut based on the fact that
> 256+64 = 320, that 2 to the power of 8 is 256 and 2 to the power of 6 is
> 64, and that binary is based around two options. Therefore, using the
> correct bit-shifts, you can change the line to :-
>
> _farpokeb(_dos_ds, 0xA0000 + (y << 8) + (y << 6) + x, colour);
>
> . . . .which is faster.
Quibble, quibble: Since djgpp does strength reduction effortlessly, you get
the shifts anyway. I'm sure somebody's pointed this out already, but
putting in explicit shifts can slow your code ( I've timed some examples !).
Anyway the big slowdown is that you keep setting the selector _dos_ds every time
you draw a pixel; set it once with farnsetsel() and use farnspokeb() to poke
your pixels instead: that's a bigger speed increase.
Or how about using near pointers: everybody speaks woe of them, but they're fast,
and I like 'em.
Elliott
- Raw text -