Malbolge Adder

The Malbolge program adder.mal reads two integer numbers 0 ≤ A, B ≤ 999 and outputs the sum A + B. The numbers A and B must be separated by space.

Internally, the numbers are stored as positions in the xlat2 cycle. To add them, the cycle representing the first number is incremented until the second cycle transitions from a NOP command to a branch command, marking the end of the incrementation loop. This technique requires less memory than other approaches and allows reading, summing, and outputting relatively large numbers.

Contact | Site notice (Impressum)