(C) E.A.Eremin, 2002  Run-Time Library for Pascal MMIX Compiler

% INITIALIZATION
 0   E070 EE00   SETH    $70,  EE00        %set $70 to ROM
 4   E36D FFFF   SETL    $6D,  FFFF        %    0000 0000 0000 FFFF
 8   C56D 6D00   NOR     $6D,  $6D, 00     %$6D=FFFF FFFF FFFF 0000
 C   9F6F 6F00   GO      $6F,  $6F, 00     %return

% CHECK INDEX
10   3074 0372   CMP     $74,  $03, $72    %cmp index ($3) and min ($72)
14   4074 0004   BN      $74,  0004 ==> 1C %error if <0
18   3074 0373   CMP     $74,  $03, $73    %cmp index and max value ($73)
1C   4474 0002   BP      $74,  0002 ==> 1C %error if >0
20   9F6F 6F00   GO      $6F,  $6F, 00     %return
24   9F6F 7030   GO      $6F,  $70, 30     %print the following message
28   1369 6E64       #13 'ind'             %13 symbols
2C   6578 2063       'ex c'
30   6865 636B       'heck'
34   2065 7272       ' err'
38   6F72 0A0D       'or' #0A #0D          %LF/CR codes
3C   0000 0000   TRAP    0                 %exit to system

% CHECK FOR NAN
40   0204 0101   FUN     $04,  $01, $01    %check $1 for NAN
44   F100 0002   JMP     000002 ==> 44
48   0204 0102   FUN     $04,  $01, $02    %check $1 and $2 for NAN
4C   4A04 0002   BNZ     $04,  0002 ==> 4C %print message if <>0
50   9F6F 6F00   GO      $6F,  $6F, 00     %return
54   9F6F 7030   GO      $6F,  $70, 30     %print the following message
58   0B4E 414E       #0B 'NAN'             %0B symbols
5C   2076 616C       ' val'
60   7565 0A0D       'ue' #0A #0D          %LF/CR codes
64   0000 0000   TRAP    0                 %exit to system

% CHECK 2-BYTE INTEGER FOR OVERFLOW
68   2172 0100   ADD     $72,  $01, 00     %check $1
6C   F100 0002   JMPB    000002 ==> 74
70   2172 0200   ADD     $72,  $02, 00     %check $2
74   EF72 7FFF   ANDNL   $72,  7FFF        %reset number bits except sign
78   4272 0003   BZ      $72,  0003 ==> 84 %normal return for positive
7C   E772 8000   INCL    $72,  8000        %invert bits
80   4A72 0002   BNZ     $72,  0002 ==> 88 %to print if negative overflow
84   9F6F 6F00   GO      $6F,  $6F, 00     %return
88   9F6F 7030   GO      $6F,  $70, 30     %print the following message
8C   1732 2D62       #17 '2-b'             %17 symbols
90   7974 6520       'yte '
94   696E 7465       'inte'
98   6765 7220       'ger '
9C   6F76 6572       'over'
A0   666C 6F77       'flow'
A4   0000 0000   TRAP    0                 %exit to system
