Hexadecimal

All numbers in a script must be in hexadecimal notation. This is the base-16 notation familiar to computer programmers, and it is much simpler to translate into and out of RV-C than ordinary decimal. This is because all RV-C data is encoded into packets with 8 bytes, with 8 bits in each packet. Hexadecimal is perfect for data grouped in this way.

If you are not familiar with hexadecimal, Windows includes a calculator that can quickly convert back and forth. Run Windows Calculator, and from the "View" menu select "Scientific". Then you can enter a number in decimal form and click "Hex" to see it in hexadecimal - and vice-versa.

For more help with hex, click on this tutorial.

Another key point when working with numbers in RV-C is that all RV-C values are "little endian". This mean that when a number spans more than one byte, the "least significant" byte comes first. This is the opposite of our normal decimal notation, where the "most significant", i.e. the biggest placevalue, comes first. For example, in the decimal number 321, the first digit is the hundreds place, and is the "most significant", while the last digit is the one place, and thus the "least significant".

If decimals were little-endian, we would write three hundred and twenty one as "123".

In hexadecimal, when we break down a large number such as 1FFD4 into it bytes, we start at the small end and work backwords. In this case we get D4 FF 01. As a convention, we will always use spaces to clearly indicate when we are working with bytes (in little endian).