Integer Literals
The Language Reference - Integer Literals
Integers, as referred to in this manual, describe a specific (unsigned) subset of the integers, consisting of positive numbers and the number zero.
Depending on their use, these literals are sometimes constrained to 8-bit unsigned integers between 0 .. 255
, but they are otherwise forced to be in the 16-bit unsigned range 0 .. 65536
.
This limitation depends on context (as an example, Addressing Modes), but it should make sense for the most part. In the case of a constant overflow, the compiler will raise an error.
Decimal (base-10) integers are the most straightforward, and consist simply of of the digits 0 .. 9
. For example, 12345
, 240
.
Hexadecimal (base-16) integers consist of the prefix 0x
, followed by digits 0 .. 9
/ A .. F
/ a .. f
. For example, 0xFACE
, 0x23C0
.
Binary (base-2) integers consist of the prefix 0b
, followed by digits 0 .. 1
. For example, 0b101010
, 0b11
.