Hi again, at the risk of going too much into detail...

A good compiler might support MMX and even newer stuff
as long as you use smart data types or macros or whatever
else to hint it about the possibility to use vector data.

The idea of conditional move and set (movcc and setcc
in Assembly slang) is to avoid conditional jumps, as
those tend to spoil hardware efficiency. Even given
the attempts of modern hardware to predict how often
or even when a condition is likely to be true or false.

The idea of multi byte data types for byte pixels is,
obviously, to do multiple pixels in one operation :-)

So for example you could do

for ... {
        long m = mask[i]; // e.g. 0xff00ffff at one moment
        screen[i] &= ~m; // e.g. screen[i] is 00??0000 now
        screen[i] |= (sprite[i] & m); // sprite replaces 00s
}

I think generating the mask by unpacking a mask of one
bit per pixel into one byte per pixel, using bitstring
operations combined with setcc or maybe something with
a shift loop, would already undo most of the speed gain.

Of course it takes a lot of memory to have 1 Byte of
mask for every 1 Byte pixel and not even having real
alpha blending. But memory is easily available today.

I still think the PCX based approach with one color
being reserved for "transparent" would have a very
nice balance between memory use and speed and would
not even need permanent buffers for sprite & mask :-)

Regards, Eric


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to