         Edinburgh IMP77 Compiler - Version 8.4

    1  %externalroutine write2(%integer n, p)
    2    %string(63)%fn itos(%integer n, p)
    3       %string(255) answer
    4       %byteintegerarray a(0:64)
    5       %integer sign, sym, pt, val
    6       val = p
    7       %if p > 0 %then p = p+1 %else p = -p
    8       p = 63 %if p > 63
    9       sign = ' '
   10       sign = 0 %if val <= 0
   11       pt = 0
   12       %if n < 0 %start
   13          sign = '-'
   14          %if n = 16_80000000 %start
   15             string(addr(a(pt))) = "8463847412"
   16             pt = pt + 10
   17             -> set
   18             %finish
   19          n = -n
   20          %finish
   21       %cycle
   22          sym = n-n//10*10
   23          pt = pt+1
   24          a(pt) = sym+'0'
   25          n = n//10
   26       %repeat %until n = 0
   27      set:
   28       %if sign # 0 %start
   29          pt = pt+1;  a(pt) = sign
   30       %finish
   31       %while pt < p %cycle
   32          pt = pt+1;  a(pt) = ' '
   33       %repeat
   34       answer = ""
   35       %cycle
   36          answer = answer.tostring(a(pt))
   37          pt = pt-1
   38       %repeat %until pt = 0
   39       %result = answer
   40    %end
   41    space %and p = p-1 %while p > 62
   42    printstring(itos(n, p))
   43  %end
   44  
   45  %endoffile

   45 Statements compiled
