The following C function printint prints the integer in the accumulator. It doesn't work (due to overflow) if it happens to be the most negative integer. The contents of the accumulator are lost. void printint(void) { int weight = 1; if (AC<0) {putchar('-'); AC = -AC;} while (AC/weight >= 10) weight *= 10; while(1) { putchar(AC/weight+'0'); if(weight==1) return; AC %= weight; weight /= 10; } } Here's a translation of printint to assembly language. pitoprint: W 1 piweight: I 1 picharminus: C'-' pichar0: I 48 pimask: H 80000000 piC0: I 0 piC1: I 1 piC10: I 10 printint: W 1 STA pitoprint AND pimask BZE piwhile1 LDA picharminus OUT opsys LDA piC0 SUB pitoprint STA pitoprint piwhile1: LDA pitoprint DIV piweight SUB piC10 AND pimask BZE pibody1 BUN piwhile2 pibody1: LDA piweight MUL piC10 STA piweight BUN piwhile1 piwhile2: LDA pitoprint DIV piweight ADD pichar0 OUT opsys LDA piweight XOR piC1 BZE pireturn LDA pitoprint MOD piweight STA pitoprint LDA piweight DIV piC10 STA piweight BUN piwhile2 pireturn: BIN printint