program PRINTINT;
const NL=CHR(10); FF=CHR(12); HT=CHR(9);
  RETN=255;
const MTABSIZE=162;
  MLIT8=128; MVAR=144; MCALL=145; MIF=146; MERROR=127;
type MTABTYPE=array[0..MTABSIZE-1] of array[0..4] of CHAR;
const MTAB=MTABTYPE(
  'nop  ','xch  ','del  ','null ','error','error','error','error',
  'error','refer','stol ','stor ','error','error','error','pop  ',
  'uinc ','udec ','error','error','error','error','error','error',
  'uceq ','ucne ','ucgt ','ucle ','ucge ','uclt ','umax ','umin ',
  'iadd ','isub ','impy ','idiv ','imod ','error','error','error',
  'ineg ','iabs ','odd  ','float','ceil ','floor','error','error',
  'iinc ','idec ','error','error','error','error','error','error',
  'iceq ','icne ','icgt ','icle ','icge ','iclt ','imax ','imin ',
  'fadd ','fsub ','fmpy ','fdiv ','error','error','error','error',
  'fneg ','fabs ','round','trunc','error','error','error','error',
  'error','error','error','error','error','error','error','error',
  'fceq ','fcne ','fcgt ','fcle ','fcge ','fclt ','fmax ','fmin ',
  'not  ','error','error','error','error','error','nor  ','nand ',
  'eqv  ','xor  ','nimp ','rimp ','imp  ','nrimp','or   ','and  ',
  'compl','union','inter','sdiff','error','sgens','sadel','empty',
  'sceq ','scne ','scgt ','scle ','scge ','sclt ','in   ','error',
  'lit8 ','lit16','rdata','field','ofset','indir','index','movem',
  'byte ','word ','invok','error','rtemp','dtemp','swtch','ident',
  'varbl','call ',
  'if   ','case ','entry','loop ','exit ','for  ','error','error',
  'seq  ','error','error','error','error','proc ','begin','retn ');
var INT,LST: TEXT;
  SIZE,N: INTEGER;

procedure OUTMNE(I: INTEGER);
begin
WRITE(LST,MTAB[I],HT)
end;

procedure OUTC(C: CHAR);
begin
WRITE(LST,C)
end;

procedure OUT8;
begin
GET(INT); WRITE(LST,ORD(INT@))
end;

procedure OUT16;
var I:INTEGER;
begin
GET(INT); I:=ORD(INT@)*256;
GET(INT); WRITE(LST,ORD(INT@)+I)
end;

procedure OUTLEVEL;
begin
WRITE(LST,ORD(INT@)/16)
end;

procedure GETSIZE;
begin
GET(INT); SIZE:=ORD(INT@)
end;

procedure OUTSIZE;
begin
WRITE(LST,':',SIZE)
end;

procedure OUTDS;
begin
GETSIZE; OUT16; OUTSIZE
end;


begin
RESET(INT,'PASCAL.TMP ');
REWRITE(LST,'INT.LST ');
while ~EOF(INT) do begin
  case ORD(INT@) mod 16 of
  0,1,2,3,4,5,6,7: OUTMNE((ORD(INT@)mod 16)*16+(ORD(INT@)/16));
  8: begin OUTMNE(ORD(INT@)/16+MLIT8);
    case ORD(INT@)/16 of
    0,8,12,13,14: OUT8;				{lit8,byte,dtemp,rtemp,swtch}
    1,9: OUT16;					{lit16,word}
    2: begin OUT8; OUTC(','); OUT16 end;	{rdata}
    3,4,5,6,7: OUTDS;				{field,ofset,indir,index,movem}
    10: begin OUT8; OUTC(','); OUT8 end;	{invok}
    15: begin OUTC('''');			{ident}
      GET(INT); N:=ORD(INT@);
      while N>0 do begin GET(INT); WRITE(LST,INT@); N:=N-1 end;
      OUTC('''') end
    end end;
  9: begin OUTMNE(MVAR); OUTLEVEL; OUTC(','); OUTDS end; {varbl}
  10: begin OUTMNE(MCALL); OUTLEVEL; OUTC('(');	{call}
    GETSIZE; OUT8; OUTC(')'); OUTSIZE; OUTC(','); OUT8 end;
  11,12,13,14: OUTMNE(MERROR);			{not used}
  15: begin OUTMNE(ORD(INT@)/16+MIF);		{control structures}
    case ORD(INT@)/16 of
    1: begin OUT8; OUTC(','); OUT8 end;	{case}
    2,3,8: OUT8;					{entry,loop,seq}
    14: begin OUT8; OUTC(';'); OUT8; OUTC(',');
      OUT16; OUTC(','); OUT16 end;
    15: OUTC(FF)				{retn}
    end end
  end;
  OUTC(NL);
  GET(INT)
  end
end.
