you achieve the numbers as each of the sections = a number
i'll show you with 338
338 = 0000 0001 0101 0010
it is made up of XYZ, NORMAL, DIFFUSE and TEX1
these are the only flags that are set to on.
XYZ = 0x002 = 2 = %0010
NORMAL = 0x010 = 16 = %0001 0000
DIFFUSE = 0x040 = 64 = %0100 0000
TEX1 = 0x100 = 256 = %0001 0000 0000
Now all you do is just add them all together with a binary OR routine
XYZ || NORMAL || DIFFUSE || TEX1 = 0000 0001 0101 0010
that this achieves basically is to adds them all together on the binary level effectively doing this ->
for x=0 to len(binary)
if right$(BinA,x)="1" or right$(BinB,x)="1"
final(x)=1
else
final(x)=0
endif
next x
for x=len(binary) to 0 step -1
Bin$ = Bin$ + str$(final(x))
next x
so effectively everything slots into place like so
XYZ...... 0000 0000 0010
NORMAL... 0000 0001 0000
DIFFUSE.. 0000 0100 0000
TEX1..... 0001 0000 0000
FINAL.... 0001 0101 0010
hopefully i makes it a little clearer to how it all works now ^_^

To Survive You Must Evolve... This Time Van Will Not Escape His Fate!
900mhz | 256mb | FX5200Ti 52.16 | Dx9 | WXP-Pro