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 of the xlat2 cycle. Thus, for adding the numbers, the cycle representing the first number is simply incremented until the second cycle turns from a NOP command into a branch command, yielding the end of the incrementation loop. This technique needs less memory than other approaches and allows to read, sum, and output relatively large numbers.
Contact | Site notice (Impressum)