
             Edinburgh IMP77 Compiler - Version 8.4


        LANG 0000
        LINE 0
     1  %endofperm; %begin
        BEGIN
        LINE 1
     2    %integer global
        DEF V_0001 GLOBAL
        +   0x0011
        +   0x0001
        +   0x0000
        LINE 5
     3  
     4  !%include "test.inc"  { line numbering not handled well by this compiler }
     5  
     6    %routine fred
        GOTO L_0000
        DEF V_0002 FRED
        +   0x0007
        +   0x0000
        +   0x0000
        START
        FINISH
        LINE 6
     7      %integer local
        DEF V_0003 LOCAL
        +   0x0011
        +   0x0001
        +   0x0000
        LINE 7
     8      %integer %array array(5:global)
        DEF V_0004 ARRAY
        +   0x001b
        +   0x0001
        +   0x0100
        PUSHI #0x00000005
        PUSH V_0001
        DIM 0001 0001
        LINE 9
     9  
    10      local = 16_dead; array(6) = 0
        PUSH V_0003
        PUSHI #0x0000dead
        ASSVAL
        LINE 9
        PUSH V_0004
        PUSHI #0x00000006
        ACCESS
        PUSHI #0x00000000
        ASSVAL
        LINE 10
    11      global = 16_beef + array(6)
        PUSH V_0001
        PUSHI #0x0000beef
        PUSH V_0004
        PUSHI #0x00000006
        ACCESS
        ADD
        ASSVAL
        LINE 11
    12      %if local<<16!global = 16_deadbeef %then %monitor
        PUSH V_0003
        PUSHI #0x00000010
        LSH
        PUSH V_0001
        OR
        PUSHI #0xdeadbeef
        JUMPIF # L_0004
        MONITOR
        LOCATE L_0004
        LINE 12
    13    %end
        END
        LOCATE L_0000
        LINE 14
    14  
    15    %integer int
        DEF V_0003 INT
        +   0x0011
        +   0x0001
        +   0x0000
        LINE 15
    16    %string(16_ab) jim
        DEF V_0004 JIM
        +   0x0031
        +   0x00ab
        +   0x0000
        LINE 17
    17  
    18    int = 4
        PUSH V_0003
        PUSHI #0x00000004
        ASSVAL
        LINE 18
    19    jim = "hello
        PUSH V_0004
        PUSHS "hello\nworld \"haha!\""
        ASSVAL
        LINE 20
    20  world ""haha!"""
    21    int = (int * int + int - 4) // 22
        PUSH V_0003
        PUSH V_0003
        PUSH V_0003
        MUL
        PUSH V_0003
        ADD
        PUSHI #0x00000004
        SUB
        PUSHI #0x00000016
        QUOT
        ASSVAL
        LINE 21
    22    global = 8
        PUSH V_0001
        PUSHI #0x00000008
        ASSVAL
        LINE 22
    23    %for int = 1, 3, global %cycle
        PUSH V_0003
        PUSHI #0x00000003
        PUSH V_0001
        PUSHI #0x00000001
        FOR L_0003
        LINE 23
    24      fred
        PUSH V_0002
        CALL
        LINE 24
    25    %repeat
        REPEAT L_0003
        LOCATE L_0004
        LINE 25
    26    %if int = global %then %monitor
        PUSH V_0003
        PUSH V_0001
        JUMPIF # L_0004
        MONITOR
        LOCATE L_0004
        LINE 26
    27    %if int >= global %then %monitor
        PUSH V_0003
        PUSH V_0001
        JUMPIF < L_0004
        MONITOR
        LOCATE L_0004
        LINE 27
    28    %if int > global %then %monitor
        PUSH V_0003
        PUSH V_0001
        JUMPIF <= L_0004
        MONITOR
        LOCATE L_0004
        LINE 28
    29    %if int <= global %then %monitor
        PUSH V_0003
        PUSH V_0001
        JUMPIF > L_0004
        MONITOR
        LOCATE L_0004
        LINE 29
    30    %if int < global %then %monitor
        PUSH V_0003
        PUSH V_0001
        JUMPIF >= L_0004
        MONITOR
        LOCATE L_0004
        LINE 30
    31    %if int # global %then %monitor
        PUSH V_0003
        PUSH V_0001
        JUMPIF = L_0004
        MONITOR
        LOCATE L_0004
        LINE 31
    32  %endofprogram
        END
        END
