BINARY AND HEXADECIMAL

Computers count in bits, and people who work close to the machine often write numbers the same way: in binary (base 2, the digits 0 and 1) or in hexadecimal (base 16, the digits 0 to 9 and A to F). satellite has a type for each, and both keep a number exactly as you wrote it, leading zeros and all.

Binary: a b in front

satellite.variable.binary is a number written in bits with a b in front: b1010. satellite.variable.bin is its second spelling. The b is required, so a binary name given 1010 is refused with “ERROR: expected b1010”, and so is 0b1010, the spelling some other languages use.

The width is part of the value. b0010 shows as b0010, and it is not the same binary as b10, although both are worth 2. A binary can also carry a sign: -b0101 is worth -5. There is no length limit.

flags.satlSATELLITE 004 Download
A binary number and its methods
satellite.include(satellite)

satellite.capsule satellite.main()
{
    satellite.variable.binary flags = b0010
    satellite.console.display(flags)
    satellite.console.display(flags == b10)
    satellite.console.display(flags.number)
    satellite.console.display(flags.string)
    satellite.console.display(flags.bin)
    satellite.console.display(b10101010.hex)
    satellite.console.display(b1000.reverse())
    satellite.variable.bin below = -b0101
    satellite.console.display(below)
    satellite.console.display(below.number)
    satellite.return(satellite)
}
OUTPUT
b0010
false
2
b0010
0010
AA
b0001
-b0101
-5
  • .number is what the bits are worth.
  • .string is the binary as text, b and all, and .binary (or .bin) is the digits without the b.
  • .hex is its worth written in base 16.
  • .reverse() turns the bits round and keeps the width.

Hexadecimal: an x in front

satellite.variable.hex is a number in base 16 with an x in front: x1F, x00FF, xDEADBEEF. satellite.variable.hexadecimal is its second spelling. A lower-case digit is read the same as a capital one and always shown in capitals. As with a binary, the x is required, and the width and sign are kept: x00FF and xFF are worth the same and are different values.

mask.satlSATELLITE 004 Download
A hex number and its methods
satellite.include(satellite)

satellite.capsule satellite.main()
{
    satellite.variable.hex mask = x00ff
    satellite.variable.hexadecimal red = xFF
    satellite.console.display(mask)
    satellite.console.display(mask == red)
    satellite.console.display(mask.number == red.number)
    satellite.console.display(mask.binary)
    satellite.console.display(mask.width)
    satellite.console.display(mask.reverse())
    satellite.console.display(xDEADBEEF.number)
    satellite.console.display(-x1F)
    satellite.return(satellite)
}
OUTPUT
x00FF
false
true
0000000011111111
16
xFF00
3735928559
-x1F

A hex has .number, .string and .hex like a binary, plus .binary, which gives four bits for every hex digit, and .width, which counts those bits.

Sums answer a plain number

In a sum, a binary or a hex counts as the number it is worth, and the answer is a plain whole number. That holds when you mix them too: b1100 + xFF is 267. They compare by worth the same way, so b1010 == 10 and b1111 == xF are both true.

To see a value in the other base, ask for its text: .hex on a binary, .binary on a hex, or either one on an ordinary number.

together.satlSATELLITE 004 Download
Binary and hex together, and converting between them
satellite.include(satellite)

satellite.capsule satellite.main()
{
    satellite.variable.binary low = b1100
    satellite.console.display(low + xFF)
    satellite.console.display(b1000 + b0101)
    satellite.console.display(b1111 == xF)
    satellite.console.display(low.hex)
    satellite.console.display(xFF.binary)
    satellite.console.display((12).binary)
    satellite.console.display(255.hex)
    satellite.console.display("255".hex)
    satellite.variable.number n = b0011
    satellite.console.display(n)
    satellite.return(satellite)
}
OUTPUT
267
13
true
C
11111111
1100
FF
FF
3

Because a sum answers a number, it cannot be stored back in a binary or hex name. flags = flags + b0001 is refused when it runs (“it holds a number”). For a hex the message goes further and names the hex you meant: h = h + x01, with h holding xFF, suggests keeping 256 in a satellite.variable.number or writing x100. A number name, on the other hand, happily takes a binary or a hex and keeps its worth, as n does above.

A missing prefix

no_b.satlSATELLITE 004 Download
The b in front of a binary is required
satellite.include(satellite)

satellite.capsule satellite.main()
{
    satellite.variable.binary flags = 1010
    satellite.console.display(flags)
    satellite.return(satellite)
}
OUTPUT
--------------------------------------------------------------------------------
SATELLITE CRITICAL ERROR REPORT
--------------------------------------------------------------------------------
S301: TYPES_DO_NOT_MEET
satl(check): in satellite.main, ERROR: expected b1010

directory: no_b.satl:5
syntax: satellite.variable.binary flags = 1010
        /\

this operator has no scenario for the two kinds it was given. Nothing was
guessed at, because a guess here is an answer that is wrong and does not say so.
machine code 27 types_do_not_meet -- satl exits with this.

--------------------------------------------------------------------------------

A binary digit is 0 or 1, so b12 is refused too, and a hex name given FF asks for xFF.

Not built yet

Sums that answer a binary or a hex, rather than a number, are not built yet, and neither are the bit operators (&, |, ~, <<, >>) or .width on a binary. OPERATORS: LOGIC AND BITS shows what satl says when you try them.

Where next

The FULL REFERENCE lists every binary and hex word. Colors, which are six hex digits, are in COLORS, and ordinary whole numbers are in NUMBERS.

You may also like...

1 Response

  1. September 24, 2026

    […] The FULL REFERENCE lists every color word. Hex numbers themselves are in BINARY AND HEXADECIMAL. […]

Leave a Reply

Your email address will not be published. Required fields are marked *