Osgeld:
result is 1024, not 33424384 as I expected, so what am I missing here?
If you look at the hex of 33424384: 0x1FE0400, you'll notice the lower order word 0x0400 is equivalent to 1024. That means that com * 512 is being done as integer division and the higher order word is lost before it gets casted to an unsigned long. Using the UL against the 512 as PaulS said will force unsigned long multiplication, which won't drop the higher order word.