
             Edinburgh IMP77 Compiler - Version 8.4


        LANG 0000
        PUSHI #0x00000000
        DEF V_0001 NIL  record, name, format=0, constant
        INIT 1
        DEF V_0002 REM  integer, function, format=1, prim-spec-indirect
        START
        DEF V_0003 P  integer, simple, format=1, 0
        DEF V_0004 Q  integer, simple, format=1, 0
        FINISH
        DEF V_0003 FLOAT  real, function, format=1, prim-spec-indirect
        START
        DEF V_0004 N  integer, simple, format=1, 0
        FINISH
        DEF V_0004 TOSTRING  string, function, format=1, prim-spec-indirect
        START
        DEF V_0005 C  integer, simple, format=1, 0
        FINISH
        DEF V_0005 ADDR  integer, function, format=1, prim-spec-indirect
        START
        DEF V_0006 P  type=0, name, format=0, 0
        FINISH
        DEF V_0006 INTEGER  integer, map, format=1, prim-spec
        START
        DEF V_0007 N  integer, simple, format=1, 0
        FINISH
        DEF V_0007 BYTEINTEGER  byte-integer, map, format=2, prim-spec
        START
        DEF V_0008 N  integer, simple, format=1, 0
        FINISH
        DEF V_0008 STRING  string, map, format=0, prim-spec
        START
        DEF V_0009 N  integer, simple, format=1, 0
        FINISH
        DEF V_0009 RECORD  record, map, format=0, prim-spec
        START
        DEF V_000a N  integer, simple, format=1, 0
        FINISH
        DEF V_000a REAL  real, map, format=1, prim-spec
        START
        DEF V_000b N  integer, simple, format=1, 0
        FINISH
        DEF V_000b LONGREAL  long-real, map, format=4, prim-spec
        START
        DEF V_000c N  integer, simple, format=1, 0
        FINISH
        DEF V_000c LENGTH  byte-integer, map, format=2, prim-spec
        START
        DEF V_000d S  string, simple, format=255, 0
        FINISH
        DEF V_000d CHARNO  byte-integer, map, format=2, prim-spec
        START
        DEF V_000e S  string, simple, format=255, 0
        DEF V_000f N  integer, simple, format=1, 0
        FINISH
        DEF V_000e INT  integer, function, format=1, prim-spec-indirect
        START
        DEF V_000f R  long-real, simple, format=4, 0
        FINISH
        DEF V_000f SHORTINTEGER  short-integer, map, format=3, prim-spec
        START
        DEF V_0010 N  integer, simple, format=1, 0
        FINISH
        DEF V_0010 TYPEOF  integer, function, format=1, external-spec-indirect
        START
        DEF V_0011 N  type=0, name, format=0, 0
        FINISH
        DEF V_0011 SIZEOF  integer, function, format=1, external-spec-indirect
        START
        DEF V_0012 N  type=0, name, format=0, 0
        FINISH
        DEF V_0012 TYPENAME  string, function, format=255, external-spec-indirect
        START
        DEF V_0013 T  integer, simple, format=1, 0
        FINISH
        DEF V_0013 ARRAYENTRYSIZE  integer, function, format=1, external-spec-indirect
        START
        DEF V_0014 N  type=0, name, format=0, 0
        FINISH
        DEF V_0014 ARRAYENTRYTYPE  integer, function, format=1, external-spec-indirect
        START
        DEF V_0015 N  type=0, name, format=0, 0
        FINISH
        DEF V_0015 ARRAYDIMENSIONS  integer, function, format=1, external-spec-indirect
        START
        DEF V_0016 N  type=0, name, format=0, 0
        FINISH
        DEF V_0016 ARRAYLOWERBOUND  integer, function, format=1, external-spec-indirect
        START
        DEF V_0017 N  type=0, name, format=0, 0
        DEF V_0018 INDEX  integer, simple, format=1, 0
        FINISH
        DEF V_0017 ARRAYUPPERBOUND  integer, function, format=1, external-spec-indirect
        START
        DEF V_0018 N  type=0, name, format=0, 0
        DEF V_0019 INDEX  integer, simple, format=1, 0
        FINISH
        DEF V_0018 EVENTFM  record, record-format, format=24, 0
        START
        DEF V_0000 EVENT  integer, simple, format=1, 0
        DEF V_0000 SUB  integer, simple, format=1, 0
        DEF V_0000 INFO  integer, simple, format=1, 0
        DEF V_0000 LINE  integer, simple, format=1, 0
        DEF V_0000 MESSAGE  string, simple, format=255, 0
        FINISH
        DEF V_0019 EVENT  record, map, format=24, external-spec
        START
        FINISH
        DEF V_001a INPUTSTREAM  integer, function, format=1, external-spec-indirect
        START
        FINISH
        DEF V_001b INPUTNAME  string, function, format=255, external-spec-indirect
        START
        FINISH
        DEF V_001c SELECTINPUT  type=0, routine, format=0, external-spec
        START
        DEF V_001d N  integer, simple, format=1, 0
        FINISH
        DEF V_001d OPENINPUT  type=0, routine, format=0, external-spec
        START
        DEF V_001e N  integer, simple, format=1, 0
        DEF V_001f FD  string, simple, format=255, 0
        FINISH
        DEF V_001e OPENBINARYINPUT  type=0, routine, format=0, external-spec
        START
        DEF V_001f N  integer, simple, format=1, 0
        DEF V_0020 FD  string, simple, format=255, 0
        FINISH
        DEF V_001f CLOSEINPUT  type=0, routine, format=0, external-spec
        START
        FINISH
        DEF V_0020 RESETINPUT  type=0, routine, format=0, external-spec
        START
        FINISH
        DEF V_0021 SEEKINPUT  type=0, routine, format=0, external-spec
        START
        DEF V_0022 DISPLACEMENT  integer, simple, format=1, 0
        DEF V_0023 STARTPOINT  integer, simple, format=1, 0
        FINISH
        DEF V_0022 TELLINPUT  integer, function, format=1, external-spec-indirect
        START
        FINISH
        DEF V_0023 READSYMBOL  type=0, routine, format=0, external-spec
        START
        DEF V_0024 P  type=0, name, format=0, 0
        FINISH
        DEF V_0024 NEXTSYMBOL  integer, function, format=1, external-spec-indirect
        START
        FINISH
        DEF V_0025 READBUFFER  integer, function, format=1, external-spec-indirect
        START
        DEF V_0026 PTR  type=0, name, format=0, 0
        DEF V_0027 COUNT  integer, simple, format=1, 0
        FINISH
        DEF V_0026 PROMPT  type=0, routine, format=0, external-spec
        START
        DEF V_0027 S  string, simple, format=31, 0
        FINISH
        DEF V_0027 CURRENTPROMPT  string, function, format=31, external-spec-indirect
        START
        FINISH
        DEF V_0028 GETMAXINPUTSTREAM  integer, function, format=1, external-spec-indirect
        START
        FINISH
        DEF V_0029 FILEEND  type=0, predicate, format=0, external-spec
        START
        FINISH
        DEF V_002a ALLOWEOFEVENT  type=0, routine, format=0, external-spec
        START
        FINISH
        DEF V_002b BLOCKEOFEVENT  type=0, routine, format=0, external-spec
        START
        FINISH
        DEF V_002c OUTPUTSTREAM  integer, function, format=1, external-spec-indirect
        START
        FINISH
        DEF V_002d OUTPUTNAME  string, function, format=255, external-spec-indirect
        START
        FINISH
        DEF V_002e SELECTOUTPUT  type=0, routine, format=0, external-spec
        START
        DEF V_002f N  integer, simple, format=1, 0
        FINISH
        DEF V_002f OPENOUTPUT  type=0, routine, format=0, external-spec
        START
        DEF V_0030 N  integer, simple, format=1, 0
        DEF V_0031 FD  string, simple, format=255, 0
        FINISH
        DEF V_0030 OPENBINARYOUTPUT  type=0, routine, format=0, external-spec
        START
        DEF V_0031 N  integer, simple, format=1, 0
        DEF V_0032 FD  string, simple, format=255, 0
        FINISH
        DEF V_0031 CLOSEOUTPUT  type=0, routine, format=0, external-spec
        START
        FINISH
        DEF V_0032 RESETOUTPUT  type=0, routine, format=0, external-spec
        START
        FINISH
        DEF V_0033 SEEKOUTPUT  type=0, routine, format=0, external-spec
        START
        DEF V_0034 DISPLACEMENT  integer, simple, format=1, 0
        DEF V_0035 STARTPOINT  integer, simple, format=1, 0
        FINISH
        DEF V_0034 TELLOUTPUT  integer, function, format=1, external-spec-indirect
        START
        FINISH
        DEF V_0035 PRINTSYMBOL  type=0, routine, format=0, external-spec
        START
        DEF V_0036 SYM  integer, simple, format=1, 0
        FINISH
        DEF V_0036 WRITEBUFFER  integer, function, format=1, external-spec-indirect
        START
        DEF V_0037 PTR  type=0, name, format=0, 0
        DEF V_0038 COUNT  integer, simple, format=1, 0
        FINISH
        DEF V_0037 DEBUGSYMBOL  type=0, routine, format=0, external-spec
        START
        DEF V_0038 SYM  integer, simple, format=1, 0
        FINISH
        DEF V_0038 DEBUGREAL  type=0, routine, format=0, external-spec
        START
        DEF V_0039 D  long-real, simple, format=4, 0
        FINISH
        DEF V_0039 GETMAXOUTPUTSTREAM  integer, function, format=1, external-spec-indirect
        START
        FINISH
        DEF V_003a FLUSHOUTPUT  type=0, routine, format=0, external-spec
        START
        FINISH
        DEF V_003b SKIPSYMBOL  type=0, routine, format=0, external-spec
        START
        FINISH
        DEF V_003c PRINTSTRING  type=0, routine, format=0, external-spec
        START
        DEF V_003d S  string, simple, format=255, 0
        FINISH
        DEF V_003d DEBUGSTRING  type=0, routine, format=0, external-spec
        START
        DEF V_003e S  string, simple, format=255, 0
        FINISH
        DEF V_003e DEBUGNEWLINE  type=0, routine, format=0, external-spec
        START
        FINISH
        DEF V_003f DEBUGSPACE  type=0, routine, format=0, external-spec
        START
        FINISH
        DEF V_0040 DEBUGSPACES  type=0, routine, format=0, external-spec
        START
        DEF V_0041 COUNT  integer, simple, format=1, 0
        FINISH
        DEF V_0041 WRITE  type=0, routine, format=0, external-spec
        START
        DEF V_0042 V  integer, simple, format=1, 0
        DEF V_0043 P  integer, simple, format=1, 0
        FINISH
        DEF V_0042 SPACE  type=0, routine, format=0, external-spec
        START
        FINISH
        DEF V_0043 SPACES  type=0, routine, format=0, external-spec
        START
        DEF V_0044 N  integer, simple, format=1, 0
        FINISH
        DEF V_0044 NEWLINE  type=0, routine, format=0, external-spec
        START
        FINISH
        DEF V_0045 NEWLINES  type=0, routine, format=0, external-spec
        START
        DEF V_0046 N  integer, simple, format=1, 0
        FINISH
        DEF V_0046 PRINTFL  type=0, routine, format=0, external-spec
        START
        DEF V_0047 F  long-real, simple, format=4, 0
        DEF V_0048 DP  integer, simple, format=1, 0
        FINISH
        DEF V_0047 PRINTREAL  type=0, routine, format=0, external-spec
        START
        DEF V_0048 F  long-real, simple, format=4, 0
        DEF V_0049 SF  integer, simple, format=1, 0
        DEF V_004a PLACES  integer, simple, format=1, 0
        FINISH
        DEF V_0048 PRINTFLOAT  type=0, routine, format=0, external-spec
        START
        DEF V_0049 F  long-real, simple, format=4, 0
        DEF V_004a SF  integer, simple, format=1, 0
        FINISH
        DEF V_0049 INTPT  integer, function, format=1, external-spec-indirect
        START
        DEF V_004a R  long-real, simple, format=4, 0
        FINISH
        DEF V_004a TOUPPER  type=0, routine, format=0, external-spec
        START
        DEF V_004b S  string, name, format=0, 0
        FINISH
        DEF V_004b TOLOWER  type=0, routine, format=0, external-spec
        START
        DEF V_004c S  string, name, format=0, 0
        FINISH
        DEF V_004c ITOS  string, function, format=255, external-spec-indirect
        START
        DEF V_004d N  integer, simple, format=1, 0
        DEF V_004e PLACES  integer, simple, format=1, 0
        FINISH
        DEF V_004d FTOS  string, function, format=255, external-spec-indirect
        START
        DEF V_004e F  long-real, simple, format=4, 0
        DEF V_004f SF  integer, simple, format=1, 0
        DEF V_0050 PLACES  integer, simple, format=1, 0
        FINISH
        DEF V_004e FTOSP  string, function, format=255, external-spec-indirect
        START
        DEF V_004f F  long-real, simple, format=4, 0
        DEF V_0050 PLACES  integer, simple, format=1, 0
        FINISH
        DEF V_004f READ  type=0, routine, format=0, external-spec
        START
        DEF V_0050 PTR  type=0, name, format=0, 0
        FINISH
        DEF V_0050 SUBSTRING  string, function, format=255, external-spec-indirect
        START
        DEF V_0051 S  string, simple, format=255, 0
        DEF V_0052 FROM  integer, simple, format=1, 0
        DEF V_0053 TO  integer, simple, format=1, 0
        FINISH
        DEF V_0051 TRIM  string, function, format=255, external-spec-indirect
        START
        DEF V_0052 S  string, simple, format=255, 0
        DEF V_0053 MAX  integer, simple, format=1, 0
        FINISH
        DEF V_0052 SETDEBUG  type=0, routine, format=0, external-spec
        START
        FINISH
        DEF V_0053 CLEARDEBUG  type=0, routine, format=0, external-spec
        START
        FINISH
        DEF V_0054 DEBUGMODE  integer, function, format=1, external-spec-indirect
        START
        FINISH
        DEF V_0055 SHOWDEBUG  type=0, predicate, format=0, external-spec
        START
        FINISH
        DEF V_0056 SETDEBUGLEVEL  type=0, routine, format=0, external-spec
        START
        DEF V_0057 LVL  integer, simple, format=1, 0
        FINISH
        DEF V_0057 INT2ASCII  string, function, format=255, external-spec-indirect
        START
        DEF V_0058 NN  integer, simple, format=1, 0
        DEF V_0059 BASE  integer, simple, format=1, 0
        DEF V_005a PLACES  integer, simple, format=1, 0
        FINISH
        DEF V_0058 FORMATNUMBER  string, function, format=255, external-spec-indirect
        START
        DEF V_0059 N  integer, simple, format=1, 0
        DEF V_005a BASE  integer, simple, format=1, 0
        DEF V_005b PLACES  integer, simple, format=1, 0
        FINISH
        DEF V_0059 INT2HEX  string, function, format=255, external-spec-indirect
        START
        DEF V_005a NN  integer, simple, format=1, 0
        DEF V_005b PLACES  integer, simple, format=1, 0
        FINISH
        DEF V_005a INT2BIN  string, function, format=32, external-spec-indirect
        START
        DEF V_005b NN  integer, simple, format=1, 0
        FINISH
        DEF V_005b SHORT2BIN  string, function, format=16, external-spec-indirect
        START
        DEF V_005c NN  short-integer, simple, format=3, 0
        FINISH
        DEF V_005c GETENVCOUNT  integer, function, format=1, external-spec-indirect
        START
        FINISH
        DEF V_005d GETENVNAME  string, function, format=255, external-spec-indirect
        START
        DEF V_005e INDEX  integer, simple, format=1, 0
        FINISH
        DEF V_005e GETENV  string, function, format=255, external-spec-indirect
        START
        DEF V_005f INDEX  integer, simple, format=1, 0
        FINISH
        DEF V_005f GETENVINDEX  integer, function, format=1, external-spec-indirect
        START
        DEF V_0060 VARNAME  string, simple, format=255, 0
        FINISH
        DEF V_0060 GETENVASSTRING  string, function, format=255, external-spec-indirect
        START
        DEF V_0061 ENVNAME  string, simple, format=255, 0
        FINISH
        DEF V_0061 GETENVASINTEGER  integer, function, format=1, external-spec-indirect
        START
        DEF V_0062 VARNAME  string, simple, format=255, 0
        FINISH
        DEF V_0062 GETARGCOUNT  integer, function, format=1, external-spec-indirect
        START
        FINISH
        DEF V_0063 GETARG  string, function, format=255, external-spec-indirect
        START
        DEF V_0064 INDEX  integer, simple, format=1, 0
        FINISH
        ALIAS "_imp_cliparam"
        DEF V_0064 CLIPARAM  string, function, format=255, external-spec-indirect
        START
        FINISH
        DEF V_0065 NEW  record, map, format=0, external-spec
        START
        DEF V_0066 TEMPLATE  type=0, name, format=0, 0
        FINISH
        DEF V_0066 DISPOSE  type=0, routine, format=0, external-spec
        START
        DEF V_0067 TEMPLATE  type=0, name, format=0, 0
        FINISH
        DEF V_0067 SQRT  long-real, function, format=4, external-spec-indirect
        START
        DEF V_0068 X  long-real, simple, format=4, 0
        FINISH
        DEF V_0068 PI  long-real, function, format=4, external-spec-indirect
        START
        FINISH
        DEF V_0069 SINE  long-real, function, format=4, external-spec-indirect
        START
        DEF V_006a X  long-real, simple, format=4, 0
        FINISH
        DEF V_006a COSINE  long-real, function, format=4, external-spec-indirect
        START
        DEF V_006b X  long-real, simple, format=4, 0
        FINISH
        DEF V_006b LOG2  long-real, function, format=4, external-spec-indirect
        START
        DEF V_006c X  long-real, simple, format=4, 0
        FINISH
        DEF V_006c LOG  long-real, function, format=4, external-spec-indirect
        START
        DEF V_006d X  long-real, simple, format=4, 0
        FINISH
        DEF V_006d LOG10  long-real, function, format=4, external-spec-indirect
        START
        DEF V_006e X  long-real, simple, format=4, 0
        FINISH
        DEF V_006e EXIT  type=0, routine, format=0, external-spec
        START
        DEF V_006f STATUS  integer, simple, format=1, 0
        FINISH
        LINE 2
     1  ! check that sizeof/typeof was giving the expected value
     2  %begin
        BEGIN
        LINE 3
     3    %routine test(%name param)         ;! ia1          ia2
        GOTO L_0000
        DEF V_006f TEST  type=0, routine, format=0, 0
        START
        DEF V_0070 PARAM  type=0, name, format=0, 0
        FINISH
        LINE 4
     4      write(addr(param),0)  ; newline  ;! 2145833816   2145833816
        PUSH V_0041
        PUSH V_0005
        PUSH V_0070
        ASSPAR
        CALL
        ASSPAR
        PUSHI #0x00000000
        ASSPAR
        CALL
        LINE 4
        PUSH V_0044
        CALL
        LINE 5
     5      write(sizeof(param),0); newline  ;! 1            8             1 is sizeof %byte, 8 is sizeof %longreal
        PUSH V_0041
        PUSH V_0011
        PUSH V_0070
        ASSPAR
        CALL
        ASSPAR
        PUSHI #0x00000000
        ASSPAR
        CALL
        LINE 5
        PUSH V_0044
        CALL
        LINE 6
     6      write(typeof(param),0); newline  ;! 5            8             5 is typeof %byte, 8 is typeof %longreal
        PUSH V_0041
        PUSH V_0010
        PUSH V_0070
        ASSPAR
        CALL
        ASSPAR
        PUSHI #0x00000000
        ASSPAR
        CALL
        LINE 6
        PUSH V_0044
        CALL
        LINE 7
     7    %end
        END
        LOCATE L_0000
        LINE 9
     8  
     9    %bytearray ia1(3:5)
        DEF V_0070 IA1  byte-integer, array, format=2, 0
        PUSHI #0x00000003
        PUSHI #0x00000005
        DIM 0001 0001
        LINE 10
    10    %longrealarray ia2(2:4,3:6)
        DEF V_0071 IA2  long-real, array, format=4, 0
        PUSHI #0x00000002
        PUSHI #0x00000004
        PUSHI #0x00000003
        PUSHI #0x00000006
        DIM 0002 0001
        LINE 12
    11  
    12    printstring( "Testing ia1"); newline
        PUSH V_003c
        PUSHS "Testing ia1"
        ASSPAR
        CALL
        LINE 12
        PUSH V_0044
        CALL
        LINE 13
    13    write(addr(ia1),0); newline     ;! 2145833816
        PUSH V_0041
        PUSH V_0005
        PUSH V_0070
        ASSPAR
        CALL
        ASSPAR
        PUSHI #0x00000000
        ASSPAR
        CALL
        LINE 13
        PUSH V_0044
        CALL
        LINE 14
    14    write(addr(ia1(3)),0); newline  ;! 2145833704
        PUSH V_0041
        PUSH V_0005
        PUSH V_0070
        PUSHI #0x00000003
        ACCESS
        PUSHI #0x000000ff
        AND
        ASSPAR
        CALL
        ASSPAR
        PUSHI #0x00000000
        ASSPAR
        CALL
        LINE 14
        PUSH V_0044
        CALL
        LINE 15
    15    write(sizeof(ia1),0); newline   ;! 1                sizeof %btre
        PUSH V_0041
        PUSH V_0011
        PUSH V_0070
        ASSPAR
        CALL
        ASSPAR
        PUSHI #0x00000000
        ASSPAR
        CALL
        LINE 15
        PUSH V_0044
        CALL
        LINE 16
    16    write(typeof(ia1),0); newline   ;! 5                typeof %byte
        PUSH V_0041
        PUSH V_0010
        PUSH V_0070
        ASSPAR
        CALL
        ASSPAR
        PUSHI #0x00000000
        ASSPAR
        CALL
        LINE 16
        PUSH V_0044
        CALL
        LINE 17
    17    test(ia1)
        PUSH V_006f
        PUSH V_0070
        ASSPAR
        CALL
        LINE 19
    18  
    19    printstring( "Testing ia2"); newline
        PUSH V_003c
        PUSHS "Testing ia2"
        ASSPAR
        CALL
        LINE 19
        PUSH V_0044
        CALL
        LINE 20
    20    write(addr(ia2),0); newline      ;! 2145833816
        PUSH V_0041
        PUSH V_0005
        PUSH V_0071
        ASSPAR
        CALL
        ASSPAR
        PUSHI #0x00000000
        ASSPAR
        CALL
        LINE 20
        PUSH V_0044
        CALL
        LINE 21
    21    write(addr(ia2(2,3)),0); newline ;! 2145833708      4 bytes after address of first element of ia1, i.e. ia1(3)
        PUSH V_0041
        PUSH V_0005
        PUSH V_0071
        PUSHI #0x00000002
        INDEX
        PUSHI #0x00000003
        ACCESS
        ASSPAR
        CALL
        ASSPAR
        PUSHI #0x00000000
        ASSPAR
        CALL
        LINE 21
        PUSH V_0044
        CALL
        LINE 23
    22                                      !                 which is 3 %byteinteger elements of 1 byte each, aligned to next 4 bytes.
    23    write(sizeof(ia2),0); newline    ;! 8               sizeof %longreal
        PUSH V_0041
        PUSH V_0011
        PUSH V_0071
        ASSPAR
        CALL
        ASSPAR
        PUSHI #0x00000000
        ASSPAR
        CALL
        LINE 23
        PUSH V_0044
        CALL
        LINE 24
    24    write(typeof(ia2),0); newline    ;! 8               typeof %longreal
        PUSH V_0041
        PUSH V_0010
        PUSH V_0071
        ASSPAR
        CALL
        ASSPAR
        PUSHI #0x00000000
        ASSPAR
        CALL
        LINE 24
        PUSH V_0044
        CALL
        LINE 25
    25    test(ia2)
        PUSH V_006f
        PUSH V_0071
        ASSPAR
        CALL
        LINE 27
    26  
    27  %endofprogram
        END
        END
