; An efficient method to compute exponents. start: ld 3,x1 ld 10,x2 ld end,xC jmp exp end: out x8,!0xe out x0,!0xe hlt ; Raise x1 to the power of x2, result in x8. exp: ld 1,x9 ; Bitmask. xor x0,x9,x8 ; Final result accumulator. xor x0,x1,xB ; x1 ** (2**n) accumulator. xor x0,x2,xA ; Exponent. ld -1,xE ; Amount to shift xA by. loop: xor xA,x0,x0 jnf xC and x9,xA,x0 jnf nomul mul xB,x8,x8 nomul: mul xB,xB,xB shf xA,xE,xA jmp loop