Chombit is an open source assembly language created in 2025 by Pete Gonzalez.
| #1523on PLDB | 1Years Old |
The assembly language for Chombit, the 32-bit CPU of the Hybrix virtual computer. Its 25 instructions each have a documented machine code and cycle cost, and its "framed registers" map a function's stack frame directly onto CPU registers. Devices are controlled exclusively via memory-mapped I/O. The Hybrix kernel and garbage collector are written in hand-coded Chombit assembly.
# -----------------------------------------------------------------------------
# fibonacci(n: int): int (assembles to 46 bytes)
@main.fibonacci:
push fp
move fp, sp
add sp, 12
# i:-16 return value
# i:-12 arg_n
# i:-8 return ip
# i:-4 fp
# i:0 a
# i:4 b
# i:8 next
compare i:-12, 0
if less
fail 20 # 20 = function was called with an invalid argument
move i:0, 0 # a = fibonacci(0)
move i:4, 1 # b = fibonacci(1)
@main.fibonacci.l_0:
compare i:-12, 0
if zero
jump @main.fibonacci.l_1
move i:8, i:0
add i:8, i:4 # next = a + b
move i:0, i:4 # a = b
move i:4, i:8 # b = next
add i:-12, -1
jump @main.fibonacci.l_0
@main.fibonacci.l_1:
move i:-16, i:0
add sp, -12
pop fp
pop ip
fill 4Framed registers map a function's stack frame onto CPU registers: negative indexes are parameters and positive indexes are locals, so in i:-12 and i:0 the sign tells you which is which.| Feature | Supported | Example | Token |
|---|---|---|---|
| Hexadecimals | ✓ | store [i:4], byte $ac | |
| Bitwise Operators | ✓ | xor b:kernel.sweep_alloc.dead_mark, $10 | |
| Pointers | ✓ | load b:12, [i:0] | |
| Expressions | ✓ | add sp, (-12 -16) | |
| Constants | ✓ | const kernel.constant.io_region = $d0_0000 | |
| Conditionals | ✓ | compare i:-12, 0 if zero jump @main.fibonacci.l_1 | |
| Gotos | ✓ | jump @main.fibonacci.l_0 | |
| Labels | ✓ | @main.fibonacci.l_0: | |
| Processor Registers | ✓ | move i:8, i:0 |