Think how 512 is stored in memory. Did you get 0x02 and 0x00 (thus forming the 16-bit number 0x0200)? That's where the 0 and 2 come from.

Best not rely on this though. This is going to be very compiler and platform dependent - completely unportable.