Byte Order

From SimsWiki
Jump to: navigation, search

In lots of the descriptions of operands for various primitives in SimAntics, you will see the following description, "operands 1 and 2 give the low and high order byte respectively". What exactly does this mean?

Well, when SimAntics needs a four digit hexadecimal number, for example 0x1234, it will be provided as two, two digit hexadecimal numbers, 0x12 and 0x34, but they will be provided the opposite way around from that which you might expect. The low order byte (in our example 0x34) will be provided in the first operand, and the high order byte (in our example 0x12) will be provided in the second operand.

An illustration of byte order in SimAntics. This picture shows that the bytes of a number are provided in the reverse order from how humans read numbers.

A picture always helps in these things, so here is a picture to make it clear. The little part of the number (the RHS of the number when reading it in the way humans read numbers) is provided first, and the big part of the number (the LHS) is provided second.

Personal tools

game select