$CONTROL USLINIT,MAP,CODE                                               00010000
<< LOADER1 - MODULE 72 >>                                               00015000
<<HP32002C MPE SOURCE C.00.00>>                                         00020000
$COPYRIGHT     "(C) COPYRIGHT HEWLETT-PACKARD CO. 1982.          ",&    00025000
$  "THIS PROGRAM MAY BE USED WITH ONE COMPUTER SYSTEM AT A       ",&    00030000
$  "TIME AND SHALL NOT OTHERWISE BE RECORDED, TRANSMITTED OR     ",&    00035000
$  "STORED IN A RETRIEVAL SYSTEM.  COPYING OR OTHER REPRODUCTION ",&    00040000
$  "OF THIS PROGRAM EXCEPT FOR ARCHIVAL PURPOSES IS PROHIBITED   ",&    00045000
$  "WITHOUT THE PRIOR WRITTEN CONSENT OF HEWLETT-PACKARD COMPANY."      00050000
$TITLE "     MPE LOADER UTILITIES"                                      00055000
$CONTROL SEGMENT=LOADER1                                                00060000
$CONTROL PRIVILEGED                                            <<06102>>00065000
$THIRTY                                                                 00070000
BEGIN                                                                   00075000
$PAGE                                                                   00080000
                                                                        00085000
                                                                        00090000
<<********************************************>>               <<06102>>00095000
<<                                            >>               <<06102>>00100000
<< THE LOADER1 MODULE HAD BEEN REWRITTEN FOR  >>               <<06102>>00105000
<< THE CST EXPANSION PROJECT AND INTEGRATED   >>               <<06102>>00110000
<< INTO MPE V.             JANUARY, 1983      >>               <<06102>>00115000
<<                                            >>               <<06102>>00120000
<<********************************************>>               <<06102>>00125000
$PAGE                                                                   00130000
                                                                        00135000
<<----------------------------------------------------------->>         00140000
<<                                                           >>         00145000
<<                    LOADER INTRINSICS                      >>         00150000
<<                                                           >>         00155000
<<----------------------------------------------------------->>         00160000
                                                                        00165000
<<ERROR NUMBERS>>                                                       00170000
                                                                        00175000
EQUATE ERR20 = 20,  <<ILLEGAL LIBRARY SEARCH>>                          00180000
       ERR21 = 21,  <<UNKNOWN ENTRY POINT>>                             00185000
       ERR22 = 22,  <<TRACE SYBSYSTEM NOT PRESENT>>                     00190000
       ERR23 = 23,  <<STACK SIZE TOO SMALL>>                            00195000
       ERR24 = 24,  <<MAX. DATA > 32K>>                                 00200000
       ERR25 = 25,  <<DATA SEGMENT > MAX DATA SEGMENT>>                 00205000
       ERR26 = 26,  <<PROGRAM LOADED IN OPPOSITE MODE>>                 00210000
       ERR27 = 27,  <<SL BINDING ERROR>>                                00215000
       ERR28 = 28,  <<INVALID SYSTEM SL FILE>>                          00220000
       ERR29 = 29,  <<INVALID PUBLIC SL FILE>>                          00225000
       ERR30 = 30,  <<INVALID GROUP SL FILE>>                           00230000
       ERR31 = 31,  <<INVALID PROGRAM FILE>>                            00235000
       ERR32 = 32,  <<INVALID LIST FILE>>                               00240000
       ERR33 = 33,  <<CODE SEGMENT > SYSTEM MAX.>>                      00245000
       ERR34 = 34,  <<PROGRAM USES MORE THAN ONE EXTENT>>               00250000
       ERR35 = 35,  <<DATA SEGMENT > 32K>>                              00255000
       ERR36 = 36,  <<DATA SEGMENT > SYSTEM MAX.>>                      00260000
       ERR37 = 37,  <<NR. CODE SEGMENTS > 63>>                          00265000
       ERR38 = 38,  <<NR. CODE SEGMENTS > SYSTEM MAX.>>                 00270000
       ERR39 = 39,  <<ILLEGAL CAPABILITY>>                              00275000
       ERR40 = 40,  <<TOO MANY PROCEDURES LOADED>>                      00280000
       ERR41 = 41,  <<UNKNOWN PROCEDURE NAME>>                          00285000
       ERR42 = 42,  <<INVALID PROCEDURE NUMBER>>                        00290000
       ERR43 = 43,  <<ILLEGAL PROCEDURE UNLOAD>>                        00295000
       ERR44 = 44,  <<ILLEGAL SL CAPABILITY>>                           00300000
       ERR45 = 45,  <<INVALID ENTRY POINT>>                             00305000
       ERR46 = 46,  <<ILLEGAL TO ALLOCATE TEMP PROG FILE>>     <<06102>>00310000
       ERR50 = 50,  <<UNABLE TO OPEN SYSTEM SL FILE>>                   00315000
       ERR51 = 51,  <<UNABLE TO OPEN PUBLIC SL FILE>>                   00320000
       ERR52 = 52,  <<UNABLE TO OPEN GROUP SL FILE>>                    00325000
       ERR53 = 53,  <<UNABLE TO OPEN PROGRAM FILE>>                     00330000
       ERR54 = 54,  <<UNABLE TO OPEN LIST FILE>>                        00335000
       ERR55 = 55,  <<UNABLE TO CLOSE SYSTEM SL FILE>>                  00340000
       ERR56 = 56,  <<UNABLE TO CLOSE PUBLIC SL FILE>>                  00345000
       ERR57 = 57,  <<UNABLE TO CLOSE GROUP SL FILE>>                   00350000
       ERR58 = 58,  <<UNABLE TO CLOSE PROGRAM FILE>>                    00355000
       ERR59 = 59,  <<UNABLE TO CLOSE LIST FILE>>                       00360000
       ERR60 = 60,  <<EOF OR I/O ERROR ON SYSTEM SL FILE>>              00365000
       ERR61 = 61,  <<EOF OR I/O ERROR ON PUBLIC SL FILE>>              00370000
       ERR62 = 62,  <<EOF OR I/O ERROR ON GROUP SL FILE>>               00375000
       ERR63 = 63,  <<EOF OR I/O ERROR ON PROGRAM FILE>>                00380000
       ERR64 = 64,  <<EOF OR I/O ERROR ON LIST FILE>>                   00385000
       ERR65 = 65,  <<UNABLE TO OBTAIN CST ENTRIES>>                    00390000
       ERR66 = 66,  <<UNABLE TO OBTAIN PROCESS DST ENTRY>>              00395000
       ERR67 = 67,  <<UNABLE TO OBTAIN MAIL DATA SEGMENT>>              00400000
       ERR68 = 68,  <<UNABLE TO OBTAIN WORKING SET>>                    00405000
       ERR70 = 70,  <<SEGMENT TABLE OVERFLOW>>                          00410000
       ERR71 = 71,  <<UNABLE TO OBTAIN SUFFICIENT DL STORAGE>>          00415000
       ERR72 = 72,  <<ATTIO ERROR>>                                     00420000
       ERR73 = 73,  <<UNABLE TO OBTAIN VIRTUAL MEMORY>>                 00425000
       ERR74 = 74,  <<DIRECTORY I/O ERROR>>                             00430000
       ERR75 = 75,  <<PRINT I/O ERROR>>                                 00435000
       ERR76 = 76,  <<ILLEGAL DLSIZE>>                                  00440000
       ERR80 = 80,  <<PROGRAM ALREADY ALLOCATED>>                       00445000
       ERR81 = 81,  <<ILLEGAL PROGRAM ALLOCATION>>                      00450000
       ERR82 = 82,  <<PROGRAM NOT ALLOCATED>>                           00455000
       ERR83 = 83,  <<ILLEGAL PROGRAM DEALLOCATION>>                    00460000
       ERR84 = 84,  <<PROCEDURE ALREADY ALLOCATED>>                     00465000
       ERR85 = 85,  <<ILLEGAL PROCEDURE ALLOCATION>>                    00470000
       ERR86 = 86,  <<PROCEDURE NOT ALLOCATED>>                         00475000
       ERR87 = 87,  <<ILLEGAL PROCEDURE DEALLOCATION>>                  00480000
       WARN88= 88,  <<LMAP NOT AVAILABLE>>                              00485000
       WARN89= 89,  <<LOAD WITH LIB=S>>                                 00490000
       WARN90= 90,  <<LOAD WITH LIB=P>>                                 00495000
       WARN91= 91,  <<LOAD WITH LIB=G>>                                 00500000
       ERR92 = 92,  <<ALLOCATE/DEALLOCATE FROM NON-SYSTEM DISC <<E9061>>00505000
       ERR93 = 93,  <<UNABLE TO MOUNT PROG'S HOME VOL. SET>>   <<06102>>00510000
       ERR94 = 94,  <<UNABLE TO MOUNT SYS SL'S H.V.S.>>        <<06102>>00515000
       ERR95 = 95,  <<UNABLE TO MOUNT PRIVATE SL'S H.V.S.>>    <<06102>>00520000
       ERR96 = 96,  <<UNABLE TO MOUNT GROUP SL'S H.V.S.>>      <<06102>>00525000
       ERR97 = 97,  <<UNABLE TO LOAD REMOTE PROGRAM>>                   00530000
       ERR98 = 98,  <<UNABLE TO CONVERT OLD FORMAT>>                    00535000
       ERR99 = 99,  <<UNABLE TO OBTAIN DST FOR LOGICAL MAP>>            00540000
       ERR100=100,  <<TOO MANY MAPPED SEGMENTS>>                        00545000
       ERR101=101,  <<SEGMAP TOO BIG>>                                  00550000
       ERR102=102,  <<UNABLE TO EXPAND SEGMAP>>                         00555000
       ERR103=103;  <<TOO MANY DYNAMIC LOADS ON PROCEDURE>>             00560000
$PAGE                                                                   00565000
<<--------------------------------------------------------->>           00570000
<<                                                         >>           00575000
<< MISCELLANEOUS DEFINITIONS                               >>           00580000
<<                                                         >>           00585000
<<--------------------------------------------------------->>           00590000
DEFINE ASMB           = ASSEMBLE#,                                      00595000
       ABS            = ABSOLUTE#,                                      00600000
       PDISABLE       = ASMB(PSDB)#,                                    00605000
       PENABLE        = ASMB(PSEB)#,                                    00610000
       DISABLE        = ASMB(SED 0)#,                                   00615000
       ENABLE         = ASMB(SED 1)#,                                   00620000
       SETBIT0        = ASSEMBLE(TSBC 0)#,                              00625000
       CONDCODE       = STATUS.(6:2)#,                                  00630000
       TURNOFFTRAPS   = PUSH(STATUS);                                   00635000
                        TOS.(2:1):=0;                                   00640000
                        SET(STATUS)#;                                   00645000
EQUATE CCG            = 0,                                              00650000
       CCL            = 1,                                              00655000
       CCE            = 2;                                              00660000
INTEGER XREG          = X;                                              00665000
LOGICAL LXREG         = X;                                              00670000
INTEGER STATUS        = Q-1;                                            00675000
BYTE BS1              = S-1,                                            00680000
     BS2              = S-2;                                            00685000
INTEGER S0            = S-0,                                            00690000
        S1            = S-1,                                            00695000
        S2            = S-2,                                            00700000
        S3            = S-3,                                            00705000
        S4            = S-4,                                            00710000
        S5            = S-5,                                            00715000
        S6            = S-6;                                            00720000
LOGICAL LS0           = S-0;                                            00725000
DOUBLE DS1            = S-1,                                            00730000
       DS2            = S-2,                                            00735000
       DS3            = S-3;                                            00740000
BYTE POINTER BPS0     = S-0,                                            00745000
             BPS1     = S-1;                                            00750000
INTEGER POINTER PS0   = S-0,                                            00755000
                PS1   = S-1;                                            00760000
DOUBLE POINTER DPS0   = S-0;                                            00765000
INTEGER ARRAY DBAREA(*) = DB+0;                                         00770000
EQUATE LOAD'DONE'MESSAGE = %777,                               <<*7558>>00775000
       LOAD'MESSAGE = %111;                                    <<*7558>>00780000
<<--------------------------------------------------------->>           00785000
<<                                                         >>           00790000
<< SYSTEM DEFINITIONS                                      >>           00795000
<<                                                         >>           00800000
<<--------------------------------------------------------->>           00805000
EQUATE LOGFLAG        = %1167,  <<LOGGING FLAG             >>           00810000
       SSLKEYA        = %1126,  <<SYSTEM SL FILE KEY       >>           00815000
       MAXDATASEG     = %1107,  <<MAX DATA SEG SIZE        >>           00820000
       MAXCODESEG     = %1106,  <<MAX # PROG FILE CODE SEGS>>           00825000
       MAXCODE        = %1105,  <<MAX CODE SEG SIZE        >>           00830000
       DEFAULTDATASEG = %1110;  <<DEFAULT STACK SIZE       >>  <<06280>>00835000
INTEGER POINTER DSTI  = 2;      <<SYSGLOB PTR TO DST       >>           00840000
POINTER PCB           = 3,      <<SYSGLOB PTR TO PCB       >>           00845000
        CSTEXT        = %51;    <<SYSGLOB PTR TO CSTX      >>           00850000
EQUATE DSTB           = 2,      <<DST PTR IN LOW FIXED MEM >>           00855000
       PCBB           = 3,      <<PCB PTR IN LOW FIXED MEM >>           00860000
       LOADSIR        = 1,      <<LOAD PROCESS SIR         >>           00865000
       ATTIOREAD      = 0,      <<READ CODE                >>           00870000
       ATTIOWRITE     = 1;      <<WRITE CODE               >>           00875000
DEFINE DSLEN          = (3:13)#,<<DST ENTRY LENGTH FIELD   >>           00880000
       USERPIN = (CURPRC)/PCBSIZE#,                            <<06648>>00885000
                                <<CURRENT PIN              >>           00890000
       PCBXP          = PUSH(DL);                                       00895000
                        TOS:=TOS-PS0(-2)#;<<PCBX PTR       >>           00900000
                                                                        00905000
<<--------------------------------------------------------->>           00910000
<<                                                         >>           00915000
<< LOADER SEGMENT TABLE DEFINITIONS                        >>           00920000
<<                                                         >>           00925000
<<--------------------------------------------------------->>           00930000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           00935000
<< GLOBAL AREA                                             >>           00940000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           00945000
EQUATE SEGTABDST = 18,          <<LST DST #                >>           00950000
       SEGTABSIR = 17;          <<LST SIR #                >>           00955000
EQUATE NUMENTRYTYPE = 9;        <<# DIRECTORY ENTRY TYPES  >>           00960000
INTEGER ARRAY LST(*) = DB+0;    <<LST                      >>           00965000
INTEGER ARRAY DIR(@) = DB+0;    <<PTR TO ENTRY DIRECTORY   >>           00970000
INTEGER DIRLEN       = DB+1;    <<DIRECTORY LENGTH         >>           00975000
INTEGER ARRAY LCT(@) = DB+2;    <<PTR TO LOADER COMM. TAB. >>           00980000
INTEGER POINTER ENTP = DB+3,    <<PRIMARY ENTRY PTR        >>           00985000
                ENTP1= DB+4,    <<SECONDARY ENTRY PTR      >>           00990000
                ENTP2= DB+5,    <<    "       "    "       >>           00995000
                ENTP3= DB+6;    <<    "       "    "       >>           01000000
DOUBLE POINTER ENTDP = ENTP,    <<    "       "    "       >>           01005000
               ENTDP1= ENTP1,   <<    "       "    "       >>           01010000
               ENTDP2= ENTP2,   <<    "       "    "       >>           01015000
               ENTDP3= ENTP3;   <<    "       "    "       >>           01020000
INTEGER ARRAY SBUF0(@)=DB+7;    <<DISC BUFFER (128 WORDS)  >>           01025000
INTEGER SI           = DB+8,    <<UTILITY INTEGER          >>           01030000
        SJ           = DB+9,    <<   "       "             >>           01035000
        SK           = DB+10,   <<   "       "             >>           01040000
        SL           = DB+11,   <<   "       "             >>           01045000
        SM           = DB+12,   <<   "       "             >>           01050000
        SN           = DB+13,   <<   "       "             >>           01055000
        SO           = DB+14,   <<   "       "             >>           01060000
        SP           = DB+15,   <<   "       "             >>           01065000
        SQ           = DB+16,   <<   "       "             >>           01070000
        SR           = DB+17,   <<   "       "             >>           01075000
        SS           = DB+18,   <<   "       "             >>           01080000
        ST           = DB+19;   <<   "       "             >>           01085000
INTEGER POINTER PSI  = SI,      <<UTILITY PTR              >>           01090000
                PSS  = SS,      <<   "     "               >>           01095000
                PST  = ST;      <<   "     "               >>           01100000
DOUBLE POINTER DPST  = ST;      <<   "     "               >>           01105000
INTEGER ARRAY HDFWDLINK(*)=DB+20,<<HEAD LINK FOR ENTRY TYPE>>           01110000
              HDBKWDLINK(*)=HDFWDLINK+NUMENTRYTYPE;                     01115000
                                <<TAIL LINK FOR ENTRY TYPE >>           01120000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01125000
<<  LOADER COMMUNICATION TABLE (LCT)                       >>           01130000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01135000
EQUATE LCTPTR        = 2,       <<OFFSET TO LCT PTR IN LST >>           01140000
       LCTLENGTH     = 22;      <<LENGTH OF LCT            >>           01145000
<<                >>                                                    01150000
<<INCOMING MESSAGE>>                                                    01155000
<<                >>                                                    01160000
DEFINE MALLOCATE     = LOGICAL(LCTBUF.(0:1))#,<<ALLOCATE CMD>>          01165000
       MCOMMAND      = LCTBUF.(0:2)#, <<LOADER COMMAND     >>           01170000
       MLIBSEARCH    = LCTBUF.(2:2)#, <<LIBRARY SEARCH     >>           01175000
       MPMODE        = LOGICAL(LCTBUF.(4:1))#,<<LOAD MODE  >>           01180000
       MLMAP         = LOGICAL(LCTBUF.(6:1))#,<<LOAD MAP   >>           01185000
       MPIN          = LCTBUF(1)#,    <<PROCESS PIN        >>           01190000
       MLOADDOMAIN   = LCTBUF.(5:1)#, << LOAD DOMAIN       >>           01195000
       MPROGKEY      = LCTBUF(2)#,    <<PROGRAM FILE KEY   >>           01200000
       MPROCNAME     = LCTBUF(3)#,    <<PROCEDURE NAME     >>           01205000
       WPROC         = LCTBUF(11)#,   <<WAITING PROCESS PIN>>           01210000
       USERCAP2      = LCTBUF(12)#,   <<CAPABILITY         >>           01215000
       MPVINFO       = LCTBUF(21)#,   <<PRIVATE VOL INFO   >>           01220000
       MEXTENSION    = LCTBUF(2)#,    <<EXTENSION #        >>           01225000
       MGROUP        = LCTBBUF(26)#,  <<USER GROUP         >>           01230000
       MACCT         = LCTBBUF(34)#;  <<USER ACCOUNT       >>           01235000
DEFINE PROCLOAD      = LOGICAL(MCOMMAND)#,<<LOAD/ALLOCATE  >>           01240000
                                          <<PROCEDURE      >>           01245000
       ALLOCPROC     = MCOMMAND=3#,   <<ALLOCATE PROCEDURE >>           01250000
       PROGLOAD      = NOT PROCLOAD#; <<LOAD/ALLOCATE PROG >>           01255000
<<                >>                                                    01260000
<<OUTGOING MESSAGE>>                                                    01265000
<<                >>                                                    01270000
DEFINE LCTANSWER     = LCTBUF(0)#,<<ANSWER FROM LOAD       >>           01275000
       LCTERROR      = LCTBUF(1)#,<<LOAD ERROR             >>           01280000
       LCTLISTFLAG   = LCTBUF(2)#,<<LOAD MAP FLAG          >>           01285000
       LCTLMAPLDEV   = LCTBUF(3)#,<<LOAD MAP LDEV          >>           01290000
       LCTLMAPHIDA   = LCTBUF(4)#,<<LOAD MAP HI DISC ADDR  >>           01295000
       LCTLMAPLODA   = LCTBUF(5)#;<<LOAD MAP LO DISC ADDR  >>           01300000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01305000
<< DIRECTORY ENTRY DEFINITIONS                             >>           01310000
<<  (COMMON TO ALL ENTRIES)                                >>           01315000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01320000
EQUATE GARBAGE       = 0,       <<GARBAGE ENTRY TYPE #     >>           01325000
       SLFILE        = 1,       <<SL FILE ENTRY TYPE #     >>           01330000
       PROGFILE      = 2,       <<PROGRAM FILE ENTRY TYPE #>>           01335000
       LOADING       = 3,       <<PROGRAM LOADING ENTRY TYP>>           01340000
       WAITING       = 4,       <<PROCESS WAITING ENTRY TYP>>           01345000
       LOADED        = 5,       <<PROCESS WAIT COMPLETED   >>           01350000
       SHARER        = 6,       <<PROCESS INFO ENTRY TYPE  >>           01355000
       EXTENSION     = 7,       <<DYNAMIC LOAD ENTRY TYPE  >>           01360000
       LOADPROCMASTER= 8;       <<MASTER DYNAMIC LOAD ENTRY>>           01365000
EQUATE ANYMODE       = -1,      <<WILD CARD FOR ENTRY MODE >>           01370000
       NORMAL        = 0;       <<NORMAL (PRIV.) MODE      >>           01375000
DEFINE FWDLINK  = ENTP(-3)#,    <<ENTRY FORWARD LINK       >>           01380000
       BKWDLINK = ENTP(-2)#,    <<ENTRY BACKWARD LINK      >>           01385000
       RLENGTH  = ENTP(-1)#,    <<REGION LENGTH--HEADER +  >>           01390000
                                <<  ENTRY + TRAILING EXCESS>>           01395000
       ETYPE    = ENTP.(8:8)#;  <<ENTRY TYPE               >>           01400000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01405000
<<  (GARBAGE ENTRY - TYPE 0)                               >>           01410000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01415000
DEFINE ENWG = ENTP(-1)#;        <<GARBAGE ENTRY LENGTH     >>           01420000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01425000
<<  (SL FILE ENTRY - TYPE 1)                               >>           01430000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01435000
DEFINE EFID        = ENTDP1#,   <<FILE ID                  >>           01440000
       EFID1       = ENTP(1)#,  <<FILE ID - WORD 1         >>           01445000
       EFID2       = ENTP(2)#,  <<FILE ID - WORD 2         >>           01450000
       EPVINFO'SL  = ENTP(3)#,  <<PRIVATE VOL INFO         >>           01455000
       EALLOCSEG'SL= ENTP(4).(0:8)#,<<# ALLOCATED SEG IN SL>>           01460000
       ESLSEG'SL   = ENTP(4).(8:8)#,<<# SEG LIST ENTRIES   >>           01465000
       <<  SEG LIST ENTRY DEFINITIONS                      >>           01470000
       SLLOGSEGNR  = PTEMP2.(0:8)#, <<SL LOGICAL SEG NUMBER>>           01475000
       SYSTEMSEG   = LOGICAL(PTEMP2.(14:1))#, <<FLAGS X-BIT>>           01480000
       REFCOUNT    = PTEMP2(1)#,    <<LOG SEG REFERENCE CNT>>           01485000
       PHYCST      = PTEMP2(2)#;    <<LOG SEG'S CST #      >>           01490000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01495000
<<  (PROGRAM FILE ENTRY - TYPE 2)                          >>           01500000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01505000
DEFINE EPMODE      = ENTP.(0:1)#, <<PROGRAM MODE           >>           01510000
       EPA         = ENTP.(1:1)#, <<ALLOCATED FLAG         >>           01515000
       ELIB        = ENTP.(4:4)#, <<LIB SEARCH             >>           01520000
       ECSTBLK     = ENTP(3)#,    <<CSTBLK INDEX           >>           01525000
       EMAPDST     = ENTP(4)#,    <<SEGMAP DST NUMBER      >>           01530000
       ESHR        = ENTP(5)#,    <<PROG FILE REFERENCE CNT>>           01535000
       ESEG        = ENTP(6).(0:8)#,<<# SEGS IN PROG FILE  >>           01540000
       ESLINFO'PROG= ENTP(6).(8:8)#,<<# SLINFO AREAS       >>           01545000
       EPVINFO'PROG= ENTP(7)#,    <<PRIVATE VOL INFO       >>           01550000
       ETRACE'PLABEL=ENTP1(7)#,   <<TRACE0' EXTERNAL LABEL >>           01555000
       EMAPSIZE    = ENTP3#;      <<# ENTRIES IN MAP ARRAY >>           01560000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01565000
<<  (PROG FILE LOADING ENTRY - TYPE 3)                     >>           01570000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01575000
<< NO DEFINITIONS UNIQUE TO THIS ENTRY TYPE                >>           01580000
<<                                                         >>           01585000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01590000
<<  (PROCESS WAITING ENTRY - TYPE 4)                       >>           01595000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01600000
DEFINE EWAITINGPIN = ENTP2#;    <<PIN OF WAITING PROCESS   >>           01605000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01610000
<<  (LOADED ENTRY - TYPE 5)                                >>           01615000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01620000
<< NO DEFINITIONS UNIQUE TO THIS ENTRY TYPE                >>           01625000
<<                                                         >>           01630000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01635000
<<  (PROCESS INFO ENTRY - TYPE 6)                          >>           01640000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01645000
DEFINE EPID  = ENTP(1)#;        <<PROCESS ID               >>           01650000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01655000
<<  (DYNAMIC LOAD ENTRY - TYPE 7)                                       01660000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01665000
DEFINE EEXT        = ENTP(2)#,     <<EXTENSION #           >>  <<06280>>01670000
       EPIN        = ENTP(1)#,     <<PIN #                 >>  <<06280>>01675000
       EPIN'EXT    = ENTDP1#,                                           01680000
       LOADPROCCOUNT=ENTP(3)#,     <<# LOADPROC'S THIS EXT#>>           01685000
       LOADPROCNAME =ENTP(5)#,                                 <<d7968>>01690000
       ESLINFO'EXT = ENTP(6+ENTP(5).(4:3)).(8:8)#;             <<06280>>01695000
                                   <<# SLINFO AREAS        >>           01700000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01705000
<<  (MASTER DYNAMIC LOAD ENTRY - TYPE 8)                   >>           01710000
<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>           01715000
DEFINE ESLID'LPROC = ENTP(2).(0:8)#, <<# SLID ENTRIES      >>           01720000
       ACTIVE'LPROCS=ENTP(2).(8:8)#, <<# ACTIVE LOADPROC'S >>           01725000
       EMCSTLS'LPROC=ENTP3.(8:8)#;   <<# MCSTLOGSEG ENTRIES>>           01730000
                                                                        01735000
<<--------------------------------------------------------->>           01740000
<<                                                         >>           01745000
<< PROGRAM FILE DEFINITIONS                                >>           01750000
<<                                                         >>           01755000
<<--------------------------------------------------------->>           01760000
EQUATE PROGFILECODE  = 1029;    <<CODE FOR PROGRAM FILE    >>           01765000
DEFINE PZERODB       = (LOGICAL(PROGREC0.(2:1)))#,                      01770000
                                   <<ZERO DB AREA FLAG     >>           01775000
       PCAPABILITY   = PROGREC0.(6:10)#,<<CAPABILITY LIST  >>           01780000
       PPRIVMODE     = PROGREC0.(9:1)#,<<PRIV MODE CAP.    >>           01785000
       PNRSEGS       = PROGREC0(1)#,   <<# CODE SEGMENTS   >>           01790000
       PGLOBALSIZE   = PROGREC0(2)#,   <<GLOBAL AREA SIZE  >>           01795000
       PGLOBALRECD   = PROGREC0(3)#,   <<GLOBAL AREA RECD# >>           01800000
       PSEGMENTRECD  = PROGREC0(4)#,   <<SEGMENT LIST RECD#>>           01805000
       PSTACKSIZE    = PROGREC0(5)#,   <<STACK SIZE        >>           01810000
       PDLSIZE       = PROGREC0(6)#,   <<DL SIZE           >>           01815000
       PMAXDATA      = PROGREC0(7)#,   <<MAX DATA SIZE     >>           01820000
       PENTRYRECD    = PROGREC0(8)#,   <<ENTRY PT LIST RECD>>           01825000
       PSTARTINGSEG  = PROGREC0(9)#,   <<STARTING SEG #    >>           01830000
       PSTARTINGADR  = PROGREC0(10)#,  <<STARTING PB ADDR  >>           01835000
       PSASTLT       = PROGREC0(11)#,  <<STLT ADDRESS      >>           01840000
       PSAFLUT       = PROGREC0(12)#,  <<FLUT ADDRESS      >>           01845000
       PEXTERNALRECD = PROGREC0(13)#,  <<EXTERNAL LIST RECD>>           01850000
       PSTARTINGSTT  = PROGREC0(14)#,  <<STARTING STT #    >>           01855000
       PSATRAPCOM    = PROGREC0(15)#;  <<TRAPCOM ADDRESS   >>           01860000
DEFINE PROGEXTSTT    = (1:1)#;  <<FLAG IN SEG DESC ARRAY   >>           01865000
                                <<=1 IF STT IN MAPPED FORM >>           01870000
<<#########################################################>>           01875000
<<  LOCAL DEFINITIONS FOR PROGRAM FILE                     >>           01880000
<<#########################################################>>           01885000
INTEGER ARRAY PROGREC0(*) = SBUF0;<<PROG FILE REC 0 BUFFER >>           01890000
<<#########################################################>>           01895000
                                                                        01900000
<<--------------------------------------------------------->>           01905000
<<                                                         >>           01910000
<< SL ENTRY POINT CACHE DEFINITIONS                        >>           01915000
<<                                                         >>           01920000
<<--------------------------------------------------------->>           01925000
DEFINE LOADCACHESEG  = ABS(ABS(%1377)+%1072)#; <<DST #     >>           01930000
EQUATE BUCKETSIZE    = 42,      <<SIZE OF EACH CACHE BUCKET>>           01935000
       CACHEHITS     = 0,       <<HIT COUNTER POINTER      >>           01940000
       CACHEMISSES   = 2,       <<MISS COUNTER POINTER     >>           01945000
       BUCKET0       = 4,       <<FIRST BUCKET POINTER     >>           01950000
       NBUCKETS      = 95;      <<NUMBER OF BUCKETS        >>           01955000
                                                                        01960000
<<--------------------------------------------------------->>           01965000
<<                                                         >>           01970000
<< LOGICAL MAPPING SEGMAP DEFINITIONS                      >>           01975000
<<                                                         >>           01980000
<<--------------------------------------------------------->>           01985000
DEFINE LOGICALMAPPING = ABS(%1220)#, <<TRUE IF MAPPING     >>           01990000
       SEGTABDST'EX   = ABS(%1226)#,                           <<06542>>01995000
       NUM'PROGSEGS   = ABS(%1223)#; <<CURRENT PIN'S # OF  >>           02000000
                                     <<PROGRAM SEGMENTS    >>           02005000
                                     <<FIRMWARE IS PRESENT >>           02010000
INTEGER ARRAY SEGMAP(*) = DB+0; <<SEGMAP ARRAY             >>           02015000
$INCLUDE INCLPCB5                                              <<06648>>02020000
                                                                        02025000
<<--------------------------------------------------------->>           02030000
<<                                                         >>           02035000
<<  FILE SYSTEM DEFINITIONS                                >>           02040000
<<                                                         >>           02045000
<<--------------------------------------------------------->>           02050000
EQUATE FILESYSSIR = 37;         <<FILE SYSTEM SIR          >>           02055000
DEFINE FLOADBIT   = FLABEL(28).(2:1)#; <<FILE LOADED BIT   >>           02060000
                                                                        02065000
<<--------------------------------------------------------->>           02070000
<<                                                         >>           02075000
<< PROCEDURE DECLARATIONS                                  >>           02080000
<<                                                         >>           02085000
<<--------------------------------------------------------->>           02090000
                                                                        02095000
PROCEDURE LOADPROCEDURE(ERROR,PROCNAME,LOADPROCID,PLABEL,               02100000
                          OPTION'NUMS,OPTIONS);                         02105000
  BYTE ARRAY PROCNAME;                                                  02110000
  INTEGER ARRAY OPTION'NUMS;                                            02115000
  LOGICAL ARRAY OPTIONS;                                                02120000
  INTEGER ERROR,LOADPROCID,PLABEL;                                      02125000
  OPTION VARIABLE,FORWARD;                                              02130000
                                                                        02135000
PROCEDURE ADJREFCOUNTS (AMOUNT);                                        02140000
   VALUE AMOUNT; INTEGER AMOUNT;                                        02145000
   OPTION FORWARD;                                                      02150000
PROCEDURE ADJSEG (CSTNR);                                               02155000
   VALUE CSTNR;                                                         02160000
   INTEGER CSTNR;                                                       02165000
   OPTION INTERNAL,FORWARD;                                             02170000
INTEGER PROCEDURE ALLOCATEPROC (PROCNAME);                              02175000
   BYTE ARRAY PROCNAME;                                                 02180000
   OPTION FORWARD;                                                      02185000
INTEGER PROCEDURE ALLOCATEPROG (PROGFNAME);                             02190000
   BYTE ARRAY PROGFNAME;                                                02195000
   OPTION FORWARD;                                                      02200000
INTEGER PROCEDURE ALTDSEGSIZE (DSTNR,DELTA);                            02205000
   VALUE DSTNR,DELTA;                                                   02210000
   INTEGER DSTNR,DELTA;                                                 02215000
   OPTION EXTERNAL;                                                     02220000
INTRINSIC  ASCII;                                                       02225000
PROCEDURE AWAKE (PCBINDEX,OLDWAIT,NEWWAIT);                             02230000
   VALUE PCBINDEX,OLDWAIT,NEWWAIT;                                      02235000
   INTEGER PCBINDEX,OLDWAIT,NEWWAIT;                                    02240000
   OPTION EXTERNAL;                                                     02245000
DOUBLE PROCEDURE CHEK (INTRINSIC,FLAGS,PARMS,CAPMASK,OPTVMASK);         02250000
   VALUE INTRINSIC,FLAGS,PARMS,CAPMASK,OPTVMASK;                        02255000
   LOGICAL INTRINSIC,FLAGS,OPTVMASK;                                    02260000
   DOUBLE PARMS,CAPMASK;                                                02265000
   OPTION VARIABLE,EXTERNAL;                                            02270000
                                                                        02275000
DOUBLE PROCEDURE CHEK'NOABORT(INTRIN,FLAGS,PARMS,CAPS,OPTV);            02280000
  VALUE INTRIN,FLAGS,PARMS,CAPS,OPTV;                                   02285000
  LOGICAL INTRIN,FLAGS,OPTV;                                            02290000
  DOUBLE PARMS,CAPS;                                                    02295000
  OPTION VARIABLE,EXTERNAL;                                             02300000
                                                                        02305000
INTEGER PROCEDURE GETDATASEG(MEMSIZE,VDSIZE);                           02310000
  VALUE MEMSIZE,VDSIZE;                                                 02315000
  INTEGER MEMSIZE,VDSIZE;                                               02320000
  OPTION EXTERNAL;                                                      02325000
                                                                        02330000
PROCEDURE RESETCRITICAL(CRIT);                                          02335000
  VALUE CRIT;                                                           02340000
  LOGICAL CRIT;                                                         02345000
  OPTION EXTERNAL;                                                      02350000
                                                                        02355000
LOGICAL PROCEDURE SETCRITICAL;                                          02360000
  OPTION EXTERNAL;                                                      02365000
                                                                        02370000
INTEGER PROCEDURE CONVEXTLABELTODELTAP(XLABEL);                         02375000
  VALUE XLABEL;                                                         02380000
  INTEGER XLABEL;                                                       02385000
  OPTION EXTERNAL;                                                      02390000
                                                                        02395000
PROCEDURE ADDTOLOCALITY(SLLINX,SEGID,FLAGS);                   <<06648>>02400000
   VALUE SLLINX,SEGID,FLAGS;                                   <<06648>>02405000
   INTEGER SLLINX,FLAGS;                                       <<06648>>02410000
   DOUBLE SEGID;                                               <<06648>>02415000
   OPTION EXTERNAL;                                            <<06648>>02420000
LOGICAL PROCEDURE SETSYSDB;                                             02425000
   OPTION EXTERNAL;                                                     02430000
PROCEDURE RESETDB(WHERE);                                               02435000
   VALUE WHERE;                                                         02440000
   INTEGER WHERE;                                                       02445000
   OPTION EXTERNAL;                                                     02450000
                                                                        02455000
PROCEDURE CLEARBIT (BITARRAY,BITNUMBER);                                02460000
   VALUE BITNUMBER;                                                     02465000
   INTEGER ARRAY BITARRAY;                                              02470000
   INTEGER BITNUMBER;                                                   02475000
   OPTION INTERNAL,FORWARD;                                             02480000
PROCEDURE  DEALCSTBLOCK(EIX);                                           02485000
   VALUE  EIX;                                                          02490000
   INTEGER  EIX;                                                        02495000
   OPTION  EXTERNAL;                                                    02500000
INTEGER PROCEDURE DEALLOCATEPROC (PROCNAME);                            02505000
   BYTE ARRAY PROCNAME;                                                 02510000
   OPTION FORWARD;                                                      02515000
INTEGER PROCEDURE DEALLOCATEPROG (PROGFNAME);                           02520000
   BYTE ARRAY PROGFNAME;                                                02525000
   OPTION FORWARD;                                                      02530000
DOUBLE PROCEDURE ENTRYKEY;                                              02535000
   OPTION INTERNAL,FORWARD;                                             02540000
INTEGER PROCEDURE ENTRYLENGTH;                                          02545000
   OPTION INTERNAL,FORWARD;                                             02550000
PROCEDURE ERROREXIT (DESCRIP,ERROR,PARM);                               02555000
   VALUE DESCRIP,ERROR,PARM;                                            02560000
   INTEGER DESCRIP,ERROR,PARM;                                          02565000
   OPTION EXTERNAL;                                                     02570000
INTEGER PROCEDURE ERRORGET (LEVEL);                                     02575000
   VALUE LEVEL;                                                         02580000
   INTEGER LEVEL;                                                       02585000
   OPTION EXTERNAL;                                                     02590000
PROCEDURE ERRORON;                                                      02595000
   OPTION EXTERNAL;                                                     02600000
PROCEDURE ERRORPUT (ERROR,LEVEL);                                       02605000
   VALUE ERROR,LEVEL;                                                   02610000
   INTEGER ERROR,LEVEL;                                                 02615000
   OPTION EXTERNAL;                                                     02620000
INTEGER PROCEDURE EXCHANGEDB (DSTNR);                                   02625000
   VALUE DSTNR; INTEGER DSTNR;                                          02630000
   OPTION EXTERNAL;                                                     02635000
LOGICAL PROCEDURE  FACCESS(FN);                                         02640000
   VALUE FN;                                                            02645000
   INTEGER FN;                                                          02650000
   OPTION EXTERNAL;                                                     02655000
INTRINSIC FCHECK,FCONTROL;                                              02660000
PROCEDURE FCLOSE (FILENUM,DISPOSITION,SECCODE);                         02665000
   VALUE FILENUM,DISPOSITION,SECCODE;                                   02670000
   INTEGER FILENUM,DISPOSITION,SECCODE;                                 02675000
   OPTION EXTERNAL;                                                     02680000
PROCEDURE FGETINFO (FILENUM,FILENAME,FOPTIONS,AOPTIONS,RECSIZE,         02685000
      DEVTYPE,LDNUM,HDADDR,FILECODE,RECPTR,EOF,FLIMIT,LOGCOUNT,         02690000
      PHYSCOUNT,BLKSIZE,EXTSIZE,NUMEXTENTS,USERLABEL,CREATORID,         02695000
      DISKADR);                                                         02700000
   VALUE FILENUM;                                                       02705000
   INTEGER FILENUM,RECSIZE,DEVTYPE,FILECODE,BLKSIZE,NUMEXTENTS,         02710000
      USERLABEL;                                                        02715000
   BYTE ARRAY FILENAME,CREATORID;                                       02720000
   LOGICAL FOPTIONS,AOPTIONS,LDNUM,HDADDR,EXTSIZE;                      02725000
   DOUBLE RECPTR,EOF,FLIMIT,LOGCOUNT,PHYSCOUNT,DISKADR;                 02730000
   OPTION VARIABLE,EXTERNAL;                                            02735000
LOGICAL PROCEDURE FINDLOGSEGMATCH;                                      02740000
  OPTION FORWARD;                                                       02745000
INTEGER PROCEDURE FLABIO(LDEV,SECTOR,FUNC,FLAB);                        02750000
   VALUE LDEV,SECTOR,FUNC,FLAB;                                         02755000
   INTEGER LDEV,FUNC;                                                   02760000
   DOUBLE SECTOR;                                                       02765000
   LOGICAL POINTER FLAB;                                                02770000
   OPTION EXTERNAL;                                                     02775000
PROCEDURE FLOCK (FILENUM,FLAG);                                         02780000
   VALUE FILENUM,FLAG;                                                  02785000
   INTEGER FILENUM;                                                     02790000
   LOGICAL FLAG;                                                        02795000
   OPTION EXTERNAL;                                                     02800000
INTEGER PROCEDURE FOPEN (FILEDESIGNATOR,FOPTIONS,AOPTIONS,              02805000
      RECSIZE,DEVICE,FORMMSG,RECMODE,BLOCKFACTOR,NUMBUFFERS,            02810000
      FILESIZE,NUMEXTENTS,INITALLOC,FILECODE);                          02815000
   VALUE FOPTIONS,AOPTIONS,RECSIZE,RECMODE,BLOCKFACTOR,                 02820000
      NUMBUFFERS,FILESIZE,NUMEXTENTS,INITALLOC,FILECODE;                02825000
   BYTE ARRAY FILEDESIGNATOR,DEVICE,FORMMSG;                            02830000
   LOGICAL FOPTIONS,AOPTIONS;                                           02835000
   INTEGER RECSIZE,RECMODE,BLOCKFACTOR,NUMBUFFERS,                      02840000
      NUMEXTENTS,INITALLOC,FILECODE;                                    02845000
   DOUBLE FILESIZE;                                                     02850000
   OPTION VARIABLE,EXTERNAL;                                            02855000
INTEGER PROCEDURE DFOPEN (FNAME,FOPS,AOPS,RECSIZE,DEV,FORMMSG, <<06102>>02860000
        NUMLABS,BLKFACT,NUMBUFS,FSIZE,NUMEXTS,INITEXTS,FCODE); <<06102>>02865000
   VALUE FOPS,AOPS,RECSIZE,NUMLABS,BLKFACT,NUMBUFS,            <<06102>>02870000
         FSIZE,NUMEXTS,INITEXTS,FCODE;                         <<06102>>02875000
   BYTE ARRAY FNAME,DEV,FORMMSG;                               <<06102>>02880000
   LOGICAL FOPS,AOPS;                                          <<06102>>02885000
   INTEGER RECSIZE,NUMLABS,BLKFACT,NUMBUFS,NUMEXTS,INITEXTS,   <<06102>>02890000
           FCODE;                                              <<06102>>02895000
   DOUBLE FSIZE;                                               <<06102>>02900000
   OPTION VARIABLE,EXTERNAL;                                   <<06102>>02905000
INTEGER PROCEDURE FOPENDA (LDNUM,DISKADR,AOPTIONS,NUMBUF,      <<06102>>02910000
   FILECODE,DNTYPE,DISP,FOPS,PVINFO,COMINFO);                  <<06102>>02915000
   VALUE LDNUM,DISKADR,AOPTIONS,NUMBUF,FILECODE,               <<06102>>02920000
         DNTYPE,DISP,FOPS,PVINFO;                              <<06102>>02925000
   INTEGER LDNUM,AOPTIONS,NUMBUF,FILECODE,DNTYPE,DISP,PVINFO,  <<06102>>02930000
           FOPS;                                               <<06102>>02935000
   ARRAY COMINFO;                                              <<06102>>02940000
   DOUBLE DISKADR;                                             <<06102>>02945000
   OPTION VARIABLE,EXTERNAL;                                   <<06102>>02950000
PROCEDURE FCLOSEDA (FILENUM,DISP,SECCODE);                              02955000
    VALUE   FILENUM,DISP,SECCODE;                                       02960000
    INTEGER FILENUM,DISP,SECCODE;                                       02965000
    OPTION EXTERNAL;                                                    02970000
INTEGER PROCEDURE FGETPVINFO (FILENUM);                                 02975000
    VALUE FILENUM;  INTEGER FILENUM;                                    02980000
    OPTION EXTERNAL;                                                    02985000
PROCEDURE FORMATNAME (DEST,SOURCE);                                     02990000
   BYTE ARRAY DEST,SOURCE;                                              02995000
   OPTION FORWARD;                                                      03000000
INTEGER PROCEDURE FREAD (FILENUM,TARGET,TCOUNT);                        03005000
   VALUE FILENUM,TCOUNT;                                                03010000
   INTEGER FILENUM,TCOUNT;                                              03015000
   INTEGER ARRAY TARGET;                                                03020000
   OPTION EXTERNAL;                                                     03025000
PROCEDURE FREADDIR (FILENUM,TARGET,TCOUNT,RECNUM);                      03030000
   VALUE FILENUM,TCOUNT,RECNUM;                                         03035000
   INTEGER FILENUM,TCOUNT;                                              03040000
   ARRAY TARGET;                                                        03045000
   DOUBLE RECNUM;                                                       03050000
   OPTION EXTERNAL;                                                     03055000
PROCEDURE FUNLOCK (FILENUM);                                            03060000
   VALUE FILENUM;                                                       03065000
   INTEGER FILENUM;                                                     03070000
   OPTION EXTERNAL;                                                     03075000
INTRINSIC FWRITE;                                                       03080000
INTEGER PROCEDURE GENMSG(SETNO,MSGNO,MASK,A,B,C,D,E,                    03085000
      DEST,REPLY,BUFF,DST,IOTYPE);                                      03090000
   VALUE SETNO,MSGNO,MASK,A,B,C,D,E,DEST,REPLY,BUFF,                    03095000
      DST,IOTYPE;                                                       03100000
   LOGICAL SETNO,MSGNO,MASK,A,B,C,D,E,DEST,REPLY,BUFF,                  03105000
      DST,IOTYPE;                                                       03110000
   OPTION VARIABLE,EXTERNAL;                                            03115000
INTEGER PROCEDURE GETSTACK (LENGTH,MAXDATA);                            03120000
   VALUE LENGTH,MAXDATA;                                                03125000
   INTEGER LENGTH,MAXDATA;                                              03130000
   OPTION EXTERNAL;                                                     03135000
LOGICAL PROCEDURE GETSIR (SIR);                                         03140000
   VALUE SIR;                                                           03145000
   INTEGER SIR;                                                         03150000
   OPTION EXTERNAL;                                                     03155000
PROCEDURE  HELP;                                                        03160000
   OPTION EXTERNAL;                                                     03165000
PROCEDURE  IMPEDE( PCBPTR );                                            03170000
   VALUE  PCBPTR;                                                       03175000
   INTEGER  PCBPTR;                                                     03180000
   OPTION  EXTERNAL;                                                    03185000
PROCEDURE LCREATE (LENGTH,TYPE,PMODE,LIBRARY,KEY);                      03190000
   VALUE LENGTH,TYPE,PMODE,LIBRARY,KEY;                                 03195000
   INTEGER LENGTH,TYPE,PMODE,LIBRARY;                                   03200000
   DOUBLE KEY;                                                          03205000
   OPTION FORWARD;                                                      03210000
PROCEDURE LCREATE' (LENGTH,TYPE,PMODE,LIBRARY,KEY);            <<06542>>03215000
   VALUE LENGTH,TYPE,PMODE,LIBRARY,KEY;                        <<06542>>03220000
   INTEGER LENGTH,TYPE,PMODE,LIBRARY;                          <<06542>>03225000
   DOUBLE KEY;                                                 <<06542>>03230000
   OPTION FORWARD;                                             <<06542>>03235000
PROCEDURE LDELETE;                                                      03240000
   OPTION FORWARD;                                                      03245000
PROCEDURE LOADBIT (KEY,BIT,DSTNR);                                      03250000
   VALUE KEY,BIT,DSTNR;                                                 03255000
   DOUBLE KEY;                                                          03260000
   LOGICAL BIT;                                                         03265000
   INTEGER DSTNR;                                                       03270000
   OPTION FORWARD;                                                      03275000
LOGICAL PROCEDURE LOADEDSLSEG (SLKEY,SEGMENTNR);                        03280000
   VALUE SLKEY,SEGMENTNR;                                               03285000
   DOUBLE SLKEY;                                                        03290000
   INTEGER SEGMENTNR;                                                   03295000
   OPTION FORWARD;                                                      03300000
DOUBLE PROCEDURE LOADER (COMMAND,PINNR,NUM1,NUM2,STRING,PVINFO);        03305000
   VALUE COMMAND,PINNR,NUM1,NUM2,PVINFO;                                03310000
   INTEGER COMMAND,PINNR,NUM1,NUM2,PVINFO;                              03315000
   BYTE ARRAY STRING;                                                   03320000
   OPTION INTERNAL,FORWARD;                                             03325000
INTEGER PROCEDURE LOADPROC (PROCNAME,LIBSEARCH,PLABEL);                 03330000
   VALUE LIBSEARCH;                                                     03335000
   BYTE ARRAY PROCNAME;                                                 03340000
   INTEGER LIBSEARCH,PLABEL;                                            03345000
   OPTION FORWARD;                                                      03350000
INTEGER PROCEDURE LOADPROGRAM (PROGFNUM,PROGKEY,PROCESSKEY,             03355000
   COMMAND,PINNR,SAVESIR,PVINFO);                                       03360000
   VALUE PROGFNUM,PROGKEY,PROCESSKEY,COMMAND,PINNR,SAVESIR,PVINFO;      03365000
   INTEGER PROGFNUM,COMMAND,PINNR,SAVESIR,PVINFO;                       03370000
   DOUBLE PROGKEY,PROCESSKEY;                                           03375000
   OPTION FORWARD;                                                      03380000
PROCEDURE LOG4 (NRPROGSEGS,NRSLSEGS,MAXSTACK,MAXXDATASEG,               03385000
                MAXDISC,PIN,CPUTIME,TYPE);                     <<07318>>03390000
   VALUE NRPROGSEGS,NRSLSEGS,MAXSTACK,MAXXDATASEG,MAXDISC,              03395000
         PIN,CPUTIME,TYPE;                                     <<07318>>03400000
   INTEGER NRPROGSEGS,NRSLSEGS,MAXSTACK,MAXXDATASEG,MAXDISC,            03405000
           PIN,TYPE;                                           <<07318>>03410000
   DOUBLE  CPUTIME;                                            <<07318>>03415000
   OPTION EXTERNAL;                                                     03420000
PROCEDURE MOUNT (VSNAME,VSGROUP,VSACCNT,REQTYPE,                        03425000
                 GEN,PVINFO,SOME'OTHER'PIN);                            03430000
VALUE GEN,SOME'OTHER'PIN;                                               03435000
INTEGER REQTYPE,GEN,PVINFO,SOME'OTHER'PIN;                              03440000
BYTE ARRAY VSNAME,VSGROUP,VSACCNT;                                      03445000
OPTION EXTERNAL,VARIABLE;                                               03450000
                                                                        03455000
PROCEDURE DISMOUNT (VSNAME,VSGROUP,VSACCNT,REQTYPE,                     03460000
                    PVINFO,SOME'OTHER'PIN);                             03465000
VALUE PVINFO,SOME'OTHER'PIN;                                            03470000
INTEGER REQTYPE,PVINFO,SOME'OTHER'PIN;                                  03475000
BYTE ARRAY VSNAME,VSGROUP,VSACCNT;                                      03480000
OPTION EXTERNAL,VARIABLE;                                               03485000
DOUBLE PROCEDURE LOGICALCST'(PLABEL,PINX);                     <<06901>>03490000
  VALUE PLABEL,PINX;                                                    03495000
  INTEGER PLABEL,PINX;                                                  03500000
   OPTION UNCALLABLE,FORWARD;                                           03505000
LOGICAL PROCEDURE LSEARCH (KEY,PMODE,TYPE);                             03510000
   VALUE KEY,PMODE,TYPE;                                                03515000
   DOUBLE KEY;                                                          03520000
   INTEGER PMODE,TYPE;                                                  03525000
   OPTION FORWARD;                                                      03530000
PROCEDURE LSTEP (PROC);                                                 03535000
   PROCEDURE PROC;                                                      03540000
   OPTION FORWARD;                                                      03545000
INTEGER PROCEDURE PHYSICALCST (PIN,SEGMENTNR);                          03550000
   VALUE PIN,SEGMENTNR;                                                 03555000
   INTEGER PIN,SEGMENTNR;                                               03560000
   OPTION UNCALLABLE,FORWARD;                                           03565000
PROCEDURE PRINT (MESSAGE,LENGTH,TYPE);                                  03570000
   VALUE LENGTH,TYPE;                                                   03575000
   INTEGER ARRAY MESSAGE;                                               03580000
   INTEGER LENGTH,TYPE;                                                 03585000
   OPTION EXTERNAL;                                                     03590000
PROCEDURE PROCFILE (PIN,FNAME);                                         03595000
   VALUE PIN;                                                           03600000
   INTEGER PIN;                                                         03605000
   BYTE ARRAY FNAME;                                                    03610000
   OPTION UNCALLABLE,FORWARD;                                           03615000
PROCEDURE RELCODESEG (CSTNR);                                           03620000
   VALUE CSTNR;                                                         03625000
   INTEGER CSTNR;                                                       03630000
   OPTION EXTERNAL;                                                     03635000
PROCEDURE RELDATASEG (DSTNR);                                           03640000
   VALUE DSTNR; INTEGER DSTNR;                                          03645000
   OPTION EXTERNAL;                                                     03650000
PROCEDURE RELSIR (SIR,FLAG);                                            03655000
   VALUE SIR,FLAG;                                                      03660000
   INTEGER SIR,FLAG;                                                    03665000
   OPTION EXTERNAL;                                                     03670000
PROCEDURE RETURNENTRY (TYPE,NRENTRIES);                                 03675000
   VALUE TYPE,NRENTRIES;                                                03680000
   INTEGER TYPE,NRENTRIES;                                              03685000
   OPTION EXTERNAL;                                                     03690000
PROCEDURE SETBIT (BITARRAY,BITNUMBER);                                  03695000
   VALUE BITNUMBER;                                                     03700000
   INTEGER ARRAY BITARRAY;                                              03705000
   INTEGER BITNUMBER;                                                   03710000
   OPTION INTERNAL,FORWARD;                                             03715000
PROCEDURE SUDDENDEATH(E);                                               03720000
   VALUE E;                                                             03725000
   INTEGER E;                                                           03730000
   OPTION EXTERNAL;                                                     03735000
INTEGER PROCEDURE SYSPROC(A);                                           03740000
   VALUE  A;                                                            03745000
   INTEGER  A;                                                          03750000
   OPTION  EXTERNAL;                                                    03755000
PROCEDURE SUMSEGS (CSTNR);                                              03760000
   VALUE CSTNR;                                                         03765000
   INTEGER CSTNR;                                                       03770000
   OPTION FORWARD;                                                      03775000
LOGICAL PROCEDURE TESTBIT (BITARRAY,BITNUMBER);                         03780000
   VALUE BITNUMBER;                                                     03785000
   INTEGER ARRAY BITARRAY;                                              03790000
   INTEGER BITNUMBER;                                                   03795000
   OPTION INTERNAL,FORWARD;                                             03800000
PROCEDURE UNLOAD (PIN);                                                 03805000
   VALUE PIN; INTEGER PIN;                                              03810000
   OPTION PRIVILEGED,UNCALLABLE,FORWARD;                                03815000
PROCEDURE UNLOADPROC (PROCID);                                          03820000
   VALUE PROCID;                                                        03825000
   INTEGER PROCID;                                                      03830000
   OPTION FORWARD;                                                      03835000
INTRINSIC  WHO;                                                         03840000
PROCEDURE CLEARWWS;                                            <<06102>>03845000
   OPTION EXTERNAL;                                            <<06102>>03850000
PROCEDURE ADJUSTLOCALITY(PROCINX,OBJID,REQSIZE,FLAGS);         <<06742>>03855000
   VALUE PROCINX,OBJID,REQSIZE,FLAGS;                          <<06742>>03860000
   LOGICAL PROCINX,REQSIZE,FLAGS;                              <<06742>>03865000
   DOUBLE OBJID;                                               <<06742>>03870000
   OPTION EXTERNAL;                                            <<06742>>03875000
INTEGER PROCEDURE FLUSH'CACHE(LDEV,STARTADDR,ENDADDR);         <<f7594>>03880000
   VALUE LDEV,STARTADDR,ENDADDR;                               <<07316>>03885000
   INTEGER LDEV;                                               <<07316>>03890000
   DOUBLE STARTADDR,ENDADDR;                                   <<07316>>03895000
   OPTION EXTERNAL;                                            <<07316>>03900000
PROCEDURE SENDMSG(DESCPIN,SUBQ,MSGLENGTH,FLAGS);               <<*7558>>03905000
   VALUE DESCPIN,SUBQ,MSGLENGTH,FLAGS;                         <<*7558>>03910000
   INTEGER DESCPIN,SUBQ,MSGLENGTH;                             <<*7558>>03915000
   LOGICAL FLAGS;                                              <<*7558>>03920000
   OPTION EXTERNAL;                                            <<*7558>>03925000
PROCEDURE RECEIVEMSG(SUBQ,MSGLENGTH,FLAGS);                    <<*7558>>03930000
   VALUE SUBQ,MSGLENGTH,FLAGS;                                 <<*7558>>03935000
   INTEGER SUBQ,MSGLENGTH;                                     <<*7558>>03940000
   LOGICAL FLAGS;                                              <<*7558>>03945000
   OPTION EXTERNAL;                                            <<*7558>>03950000
$PAGE                                                                   03955000
                                                                        03960000
<<------------------------------------------------------->>             03965000
<<                                                       >>             03970000
<< UTILITY PROCEDURES                                    >>             03975000
<<                                                       >>             03980000
<<------------------------------------------------------->>             03985000
                                                                        03990000
LOGICAL PROCEDURE TESTBIT (BITARRAY,BITNUMBER);                         03995000
   VALUE BITNUMBER;                                                     04000000
   INTEGER ARRAY BITARRAY;                                              04005000
   INTEGER BITNUMBER;                                                   04010000
   OPTION INTERNAL,UNCALLABLE;                                          04015000
   BEGIN                                                                04020000
     TOS := BITNUMBER.(0:12)+@BITARRAY;                                 04025000
     TOS := PS0;                                                        04030000
     XREG := BITNUMBER.(12:4);                                          04035000
     ASSEMBLE(CSL 1,X);                                                 04040000
     TESTBIT := TOS                                                     04045000
   END;                                                                 04050000
PROCEDURE CLEARBIT (BITARRAY,BITNUMBER);                                04055000
  <<CLEARS THE BIT SPECIFIED BY BITNUMBER IN THE BIT ARRAY              04060000
    SPECIFIED BY BITARRAY>>                                             04065000
  VALUE BITNUMBER;                                                      04070000
  INTEGER ARRAY BITARRAY;                                               04075000
  INTEGER BITNUMBER;                                                    04080000
  OPTION INTERNAL,UNCALLABLE;                                           04085000
  BEGIN                                                                 04090000
    TOS := BITNUMBER.(0:12)+@BITARRAY;                                  04095000
    TOS := PS0;                                                         04100000
    XREG := BITNUMBER;                                                  04105000
    ASSEMBLE(TRBC 0,X);                                                 04110000
    PS1 := TOS                                                          04115000
  END;                                                                  04120000
PROCEDURE SETBIT (BITARRAY,BITNUMBER);                                  04125000
  <<SETS THE BIT SPECIFIED BY BITNUMBER IN THE BIT ARRAY                04130000
    SPECIFIED BY BITARRAY>>                                             04135000
  VALUE BITNUMBER;                                                      04140000
  INTEGER ARRAY BITARRAY;                                               04145000
  INTEGER BITNUMBER;                                                    04150000
  OPTION INTERNAL,UNCALLABLE;                                           04155000
  BEGIN                                                                 04160000
    TOS := BITNUMBER.(0:12)+@BITARRAY;                                  04165000
    TOS := PS0;                                                         04170000
    XREG := BITNUMBER;                                                  04175000
    ASSEMBLE(TSBC 0,X);                                                 04180000
    PS1 := TOS                                                          04185000
  END;                                                                  04190000
INTEGER PROCEDURE NEXTBIT(BITARRAY);                                    04195000
  <<RETURN NEXT AVAILABLE INDEX FROM BITARRAY>>                         04200000
  <<IF NONE AVAILABLE RETURN 0             >>                           04205000
  INTEGER ARRAY BITARRAY;                                               04210000
  OPTION PRIVILEGED,UNCALLABLE;                                <<*7861>>04215000
  BEGIN                                                                 04220000
    INTEGER INDEX:=0;                                                   04225000
    <<SEARCH FOR AVAILABLE INDEX>>                                      04230000
    WHILE (INDEX:=INDEX+1) <= 255 DO                                    04235000
      BEGIN                                                             04240000
        IF NOT TESTBIT(BITARRAY,INDEX) THEN                             04245000
          BEGIN            <<FOUND AVAILABLE INDEX>>                    04250000
            <<RESERVE INDEX>>                                           04255000
            SETBIT(BITARRAY,INDEX);                                     04260000
            NEXTBIT:=INDEX;                                             04265000
            RETURN;                                                     04270000
          END;                                                          04275000
      END; <<WHILE>>                                                    04280000
    <<NO AVAILABLE INDEX>>                                              04285000
    NEXTBIT:=0;                                                         04290000
  END;                                                                  04295000
PROCEDURE FORMATNAME (DEST,SOURCE);                                     04300000
  <<MOVES THE STRING FROM SOURCE TO DEST AND TRUNCATES >>               04305000
  <<IT TO 15 CHARACTERS.  THE SOURCE STRING MUST HAVE  >>               04310000
  <<NO LEADING BLANKS AND BE TERMINATED WITH A BLANK OR>>               04315000
  <<CR.  THE DEST STRING HAS THE NUMB OF CHAR IN THE 1ST>>              04320000
  <<BYTE.  NOTE SOURCE AND DEST MAY BE SAME BUFFER      >>              04325000
   BYTE ARRAY DEST,SOURCE;                                              04330000
   OPTION INTERNAL,UNCALLABLE;                                          04335000
   BEGIN                                                                04340000
     EQUATE BLANK = %006440;  <<CR - BLANK>>                            04345000
     DOUBLE STRINGS = DEST;                                             04350000
     TOS := STRINGS;                                                    04355000
     MOVE BPS0 := BPS0 WHILE ANS;  <<UPSHIFT CHARS>>           <<06102>>04360000
     SCAN * UNTIL BLANK,1;  <<FIND TERM. CHAR.>>                        04365000
     TOS := S0-@SOURCE;  <<NR. CHAR'S>>                                 04370000
     IF S0 > 15 THEN S0 := 15;  <<TRUNCATE>>                            04375000
     XREG := S0;  <<SAVE NR. CHAR'S>>                                   04380000
     S2 := S2+S0;                                                       04385000
     ASSEMBLE(DECB,NEG);                                                04390000
     MOVE * := *,(TOS);  <<MOVE STRING>>                                04395000
     DEST := XREG  <<NR. CHAR'S>>                                       04400000
   END;                                                                 04405000
LOGICAL PROCEDURE SAMENAME (NAME1,NAME2);                               04410000
   <<COMPARES TWO NAMES (THE FIRST BYTE BEING THE # OF CHAR>>           04415000
   <<AND RETURNS TRUE IF THEY ARE THE SAME; OTHERWISE FALSE>>           04420000
   INTEGER ARRAY NAME1,NAME2;                                           04425000
   OPTION UNCALLABLE;                                                   04430000
   BEGIN                                                                04435000
     INTEGER RESULT = SAMENAME;                                         04440000
     TOS := @NAME1&LSL(1);                                              04445000
     TOS := @NAME2&LSL(1);                                              04450000
     ASSEMBLE(INCA,INCB);                                               04455000
     TOS := NAME1.(4:4);                                                04460000
     IF NAME2.(4:4) = S0 AND * = *,(TOS)                                04465000
       THEN RESULT:=RESULT+1;                                           04470000
   END;                                                                 04475000
PROCEDURE SETSECPTRS;                                                   04480000
  <<SET SECONDARY POINTERS FOR CURRENT LST ENTRY>>                      04485000
  OPTION PRIVILEGED,UNCALLABLE;                                         04490000
  BEGIN                                                                 04495000
    CASE ETYPE OF                                                       04500000
      BEGIN                                                             04505000
        BEGIN  <<0>>                                                    04510000
          @ENTP1:=@ENTP2:=@ENTP3:=@ENTP;                                04515000
        END;                                                            04520000
        BEGIN  <<1>>                                                    04525000
          @ENTP1:=@ENTP+1;                                              04530000
          @ENTP2:=@ENTP1+4;                                             04535000
          @ENTP3:=@ENTP2+16;                                            04540000
        END;                                                            04545000
        BEGIN  <<2>>                                                    04550000
          @ENTP1:=@ENTP+1;                                              04555000
          @ENTP2:=@ENTP1+8;                                             04560000
          @ENTP3:=@ENTP2+ESLINFO'PROG*19;                               04565000
        END;                                                            04570000
        BEGIN  <<3>>                                                    04575000
          @ENTP1:=@ENTP2:=@ENTP3:=@ENTP+1;                              04580000
        END;                                                            04585000
        BEGIN  <<4>>                                                    04590000
          @ENTP1:=@ENTP+1;                                              04595000
          @ENTP2:=@ENTP3:=@ENTP1+2;                                     04600000
        END;                                                            04605000
        BEGIN  <<5>>                                                    04610000
          @ENTP1:=@ENTP+1;                                              04615000
          @ENTP2:=@ENTP3:=@ENTP1+2;                                     04620000
        END;                                                            04625000
        BEGIN  <<6>>                                                    04630000
          @ENTP1:=@ENTP+2;                                              04635000
          @ENTP2:=@ENTP3:=@ENTP+1;                                      04640000
        END;                                                            04645000
        BEGIN  <<7>>                                                    04650000
          @ENTP1:=@ENTP+1;                                              04655000
          @ENTP2:=@ENTP1+6+ENTP(5).(4:3);                      <<06280>>04660000
          @ENTP3:=@ENTP2+ESLINFO'EXT*19;                                04665000
        END;                                                            04670000
        BEGIN  <<8>>                                                    04675000
          @ENTP1:=@ENTP+3;                                              04680000
          @ENTP2:=@ENTP1+32;                                            04685000
          @ENTP3:=@ENTP2+ESLID'LPROC*2;                                 04690000
        END;                                                            04695000
      END <<CASES>>;                                                    04700000
  END;                                                                  04705000
PROCEDURE UNLINKLSTENTRY;                                               04710000
  <<REMOVE CURRENT ENTRY FROM TYPE CHAIN>>                              04715000
  OPTION PRIVILEGED,UNCALLABLE;                                         04720000
  BEGIN                                                                 04725000
    IF HDFWDLINK(ETYPE) = @ENTP THEN                                    04730000
      BEGIN           <<FIRST IN CHAIN>>                                04735000
        HDFWDLINK(ETYPE):=FWDLINK;                                      04740000
      END ELSE                                                          04745000
      BEGIN           <<NOT FIRST IN CHAIN>>                            04750000
        LST(BKWDLINK-3):=FWDLINK;                                       04755000
      END;                                                              04760000
    IF HDBKWDLINK(ETYPE) = @ENTP THEN                                   04765000
      BEGIN           <<LAST IN CHAIN>>                                 04770000
        HDBKWDLINK(ETYPE):=BKWDLINK;                                    04775000
      END ELSE                                                          04780000
      BEGIN           <<NOT LAST IN CHAIN>>                             04785000
        LST(FWDLINK-2):=BKWDLINK;                                       04790000
      END;                                                              04795000
  END;                                                                  04800000
PROCEDURE LINKLSTENTRY;                                                 04805000
  <<INSERT CURRENT ENTRY INTO TYPE CHAIN>>                              04810000
  OPTION PRIVILEGED,UNCALLABLE;                                         04815000
  BEGIN                                                                 04820000
    <<LINK AT HEAD OF CHAIN>>                                           04825000
    BKWDLINK:=0;                                                        04830000
    FWDLINK:=HDFWDLINK(ETYPE);                                          04835000
    HDFWDLINK(ETYPE):=@ENTP;                                            04840000
    IF FWDLINK = 0 THEN                                                 04845000
      BEGIN        <<ONLY ENTRY ON CHAIN>>                              04850000
        HDBKWDLINK(ETYPE):=@ENTP;                                       04855000
      END ELSE                                                          04860000
      BEGIN         <<NOT ONLY ENTRY ON CHAIN>>                         04865000
        LST(FWDLINK-2):=@ENTP;                                          04870000
      END;                                                              04875000
  END;                                                                  04880000
PROCEDURE BUILDGARBAGE(POSITION,LENGTH);                                04885000
  <<CONVERT REGION INTO GARBAGE ENTRY>>                                 04890000
  <<CONCATENATE ANY ADJACENT GARBAGE >>                                 04895000
  <<ENTRIES.  POSITION POINTS TO 1ST >>                                 04900000
  <<WORD OF AREA                     >>                                 04905000
  VALUE POSITION,LENGTH;                                                04910000
  INTEGER POSITION,LENGTH;                                              04915000
  BEGIN                                                                 04920000
    INTEGER SAVEENTP;                                                   04925000
    SAVEENTP:=@ENTP;                                                    04930000
RESTART:                                                                04935000
    @ENTP:=HDFWDLINK(GARBAGE); <<GET HEAD OF CHAIN>>                    04940000
    IF @ENTP = 0 THEN                                                   04945000
      BEGIN                    <<EMPTY CHAIN>>                          04950000
LINKIT:                                                                 04955000
        @ENTP:=POSITION +3;    <<POINT AT AREA>>                        04960000
        RLENGTH:=LENGTH;       <<AREA SIZE>>                            04965000
        ENTP:=GARBAGE;         <<TYPE>>                                 04970000
        LINKLSTENTRY;          <<LINK INTO CHAIN>>                      04975000
        @ENTP:=SAVEENTP;       <<RESTORE POINTER>>                      04980000
        RETURN;                                                         04985000
      END ELSE                                                          04990000
      BEGIN                    <<NON-EMPTY CHAIN>>                      04995000
        WHILE @ENTP <> 0 DO                                             05000000
          BEGIN                <<WORK THRU CHAIN>>                      05005000
            IF @ENTP+RLENGTH-3 = POSITION THEN                          05010000
              BEGIN            <<FOUND ADJACENT AREA >>                 05015000
                UNLINKLSTENTRY;<<REMOVE AREA FROM CHAIN>>               05020000
                POSITION:=@ENTP-3;<<ADJUST POSITION>>                   05025000
                LENGTH:=LENGTH+RLENGTH; <<ADJUST LENGTH>>               05030000
                GO RESTART;    <<USE CONCATENATED AREAS>>               05035000
              END;                                                      05040000
            IF POSITION+LENGTH+3 = @ENTP THEN                           05045000
              BEGIN            <<FOUND ADJACENT AREA>>                  05050000
                UNLINKLSTENTRY;<<REMOVE AREA FROM CHAIN>>               05055000
                LENGTH:=LENGTH+RLENGTH; <<ADJUST LENGTH>>               05060000
                GO RESTART;    <<USE CONCATENATED AREAS>>               05065000
              END;                                                      05070000
            @ENTP:=FWDLINK;    <<NEXT GARBAGE ENTRY>>                   05075000
          END <<WHILE>>;                                                05080000
        <<ALL ADJACENT AREAS HAVE BEEN CONCATENATED >>                  05085000
        GO LINKIT;                                                      05090000
      END;                                                              05095000
  END;                                                                  05100000
INTEGER PROCEDURE ENTRYLENGTH;                                          05105000
  <<CALCULATES LENGTH OF CURRENT ENTRY>>                                05110000
  OPTION PRIVILEGED,UNCALLABLE;                                         05115000
  BEGIN                                                                 05120000
    ARRAY ELEN(*) = PB:=     <<FIXED AREA SIZES>>                       05125000
          0,  <<GARBAGE>>                                               05130000
          21, <<BASIC SL>>                                              05135000
          9,  <<BASIC PROG FILE>>                                       05140000
          3,  <<LOADING>>                                               05145000
          5,  <<WAITER>>                                                05150000
          5,  <<LOADED>>                                                05155000
          4,  <<SHARER>>                                                05160000
          6,  <<BASIC EXTENSION>>                                       05165000
          35; <<BASIC LOADPROC MASTER>>                                 05170000
                                                                        05175000
    TOS:=ELEN(ETYPE);  <<GET FIXED AREA SIZE>>                          05180000
    IF S0 = GARBAGE THEN                                                05185000
      BEGIN   <<GARBAGE ENTRY>>                                         05190000
        DEL;                                                            05195000
        TOS:=ENWG;                                                      05200000
      END;                                                              05205000
    <<ADD ANY DYNAMIC AREA TO SIZE>>                                    05210000
    CASE ETYPE OF                                                       05215000
      BEGIN                                                             05220000
        <<0>> ;                                                         05225000
        <<1>> TOS:=TOS+ESLSEG'SL*3;                                     05230000
        <<2>> TOS:=TOS+ESLINFO'PROG*19+EMAPSIZE+1;                      05235000
        <<3>> ;                                                         05240000
        <<4>> ;                                                         05245000
        <<5>> ;                                                         05250000
        <<6>> ;                                                         05255000
        <<7>> TOS:=TOS+ENTP(4).(4:3)+ESLINFO'EXT*19                     05260000
                                     +EMAPSIZE+1;                       05265000
        <<8>> TOS:=TOS+(ESLID'LPROC+EMCSTLS'LPROC+1)*2;                 05270000
      END; <<CASE>>                                                     05275000
    ENTRYLENGTH:=TOS;                                                   05280000
  END;                                                                  05285000
DOUBLE PROCEDURE ENTRYKEY;                                              05290000
   <<RETURNS THE KEY OF THE CURRENT ENTRY>>                             05295000
   OPTION INTERNAL,UNCALLABLE;                                          05300000
   BEGIN                                                                05305000
     IF ETYPE < SHARER                                                  05310000
        THEN BEGIN TOS := EFID1; TOS := EFID2 END                       05315000
        ELSE                                                            05320000
           IF ETYPE=EXTENSION THEN                                      05325000
              BEGIN                                            <<06280>>05330000
                 TOS:=EPIN;                                    <<06280>>05335000
                 TOS:=EEXT;                                    <<06280>>05340000
              END                                              <<06280>>05345000
           ELSE                                                         05350000
              BEGIN                                                     05355000
                 TOS:=0;                                                05360000
                 TOS:=EPID;                                             05365000
              END;                                                      05370000
     ENTRYKEY := TOS                                                    05375000
   END;                                                                 05380000
PROCEDURE LSTEP (PROC);                                                 05385000
<<STEPS THRU THE LOGICAL SEGMENTS ARRAY POINTED >>                      05390000
<<TO BY PST.  THE PASSED PROCEDURE IS CALLED FOR>>                      05395000
<<EACH REFERENCED LOGICAL SEGMENT               >>                      05400000
   PROCEDURE PROC;                                                      05405000
   OPTION UNCALLABLE;                                                   05410000
   BEGIN                                                                05415000
     XREG:=255;                <<LOG SEG NR>>                           05420000
     DO BEGIN                                                           05425000
         IF TESTBIT(PST,XREG) THEN                                      05430000
           BEGIN                                                        05435000
             TOS := XREG;  <<CST NR.>>                                  05440000
             PROC(*)  <<APPLY PROCEDURE>>                               05445000
           END;                                                         05450000
         XREG := XREG-1                                                 05455000
        END UNTIL <                                                     05460000
   END;                                                                 05465000
PROCEDURE TRANS'LST'TO'XDST;                                   <<06542>>05470000
<< THIS PROCEDURE TRANSFERS THE CURRENT EXTENSION ENTRY >>     <<06542>>05475000
<< IN LST TO XDST, THEN DELETE THE ONE IN LST.          >>     <<06542>>05480000
OPTION UNCALLABLE;                                             <<06542>>05485000
BEGIN                                                          <<06542>>05490000
   INTEGER SAVEDB;                                             <<06542>>05495000
   INTEGER SOURCE'OFFSET,                                      <<06542>>05500000
           TRANSFER'COUNT;                                     <<06542>>05505000
                                                               <<06542>>05510000
   SAVEDB:=EXCHANGEDB(SEGTABDST);                              <<06542>>05515000
   @ENTP:=HDFWDLINK(EXTENSION);                                <<06542>>05520000
   IF @ENTP = 0 THEN GO ERROR'OUT;                             <<06542>>05525000
   IF FWDLINK <> 0 THEN GO ERROR'OUT;                          <<06542>>05530000
   TRANSFER'COUNT:=RLENGTH-3;                                  <<06542>>05535000
   SOURCE'OFFSET:=@ENTP;                                       <<06542>>05540000
                                                               <<06542>>05545000
   EXCHANGEDB(SEGTABDST'EX);                                   <<06542>>05550000
   LCREATE'(TRANSFER'COUNT,EXTENSION,0,0,DOUBLE(0));           <<06542>>05555000
   IF <> THEN GO ERROR'RECV;                                            05560000
                                                               <<06542>>05565000
   TOS:=SEGTABDST'EX;                                          <<06542>>05570000
   TOS:=@ENTP;                                                 <<06542>>05575000
   TOS:=SEGTABDST;                                             <<06542>>05580000
   TOS:=SOURCE'OFFSET;                                         <<06542>>05585000
   TOS:=TRANSFER'COUNT;                                        <<06542>>05590000
   ASMB(MDS 5);                                                <<06542>>05595000
   CONDCODE:=CCE;                                              <<06542>>05600000
   GO OK'OUT;                                                  <<06542>>05605000
                                                                        05610000
ERROR'RECV:                                                             05615000
   EXCHANGEDB(SEGTABDST);                                               05620000
   SETSECPTRS;                                                          05625000
   ADJREFCOUNTS(-1);                                                    05630000
                                                               <<06542>>05635000
ERROR'OUT:                                                     <<06542>>05640000
   CONDCODE:=CCL;                                              <<06542>>05645000
                                                               <<06542>>05650000
OK'OUT:                                                        <<06542>>05655000
   EXCHANGEDB(SEGTABDST);                                      <<06542>>05660000
   LDELETE;                                                    <<06542>>05665000
   EXCHANGEDB(SAVEDB);                                         <<06542>>05670000
END;                                                           <<06542>>05675000
PROCEDURE TRANS'XDST'TO'LST;                                   <<06542>>05680000
<< THIS PROCEDURE TRANSFERS THE CURRENT EXTENSION ENTRY >>     <<06542>>05685000
<< IN XDST TO LST.                                      >>     <<06542>>05690000
OPTION UNCALLABLE;                                             <<06542>>05695000
BEGIN                                                          <<06542>>05700000
   INTEGER SAVEDB;                                             <<06542>>05705000
   INTEGER SOURCE'OFFSET,                                      <<06542>>05710000
           TRANSFER'COUNT;                                     <<06542>>05715000
                                                               <<06542>>05720000
   SAVEDB:=EXCHANGEDB(SEGTABDST'EX);                           <<06542>>05725000
   IF @ENTP = 0 THEN GO ERROR'OUT;                             <<06542>>05730000
   TRANSFER'COUNT:=RLENGTH-3;                                  <<06542>>05735000
   SOURCE'OFFSET:=@ENTP;                                       <<06542>>05740000
                                                               <<06542>>05745000
   EXCHANGEDB(SEGTABDST);                                      <<06542>>05750000
   LCREATE(TRANSFER'COUNT,EXTENSION,0,0,DOUBLE(0));            <<06542>>05755000
   IF <> THEN GO ERROR'OUT;                                    <<06542>>05760000
                                                               <<06542>>05765000
   TOS:=SEGTABDST;                                             <<06542>>05770000
   TOS:=@ENTP;                                                 <<06542>>05775000
   TOS:=SEGTABDST'EX;                                          <<06542>>05780000
   TOS:=SOURCE'OFFSET;                                         <<06542>>05785000
   TOS:=TRANSFER'COUNT;                                        <<06542>>05790000
   ASMB(MDS 5);                                                <<06542>>05795000
   SETSECPTRS;                                                 <<06542>>05800000
   CONDCODE:=CCE;                                              <<06542>>05805000
   GO OK'OUT;                                                  <<06542>>05810000
                                                               <<06542>>05815000
ERROR'OUT:                                                     <<06542>>05820000
   CONDCODE:=CCL;                                              <<06542>>05825000
                                                               <<06542>>05830000
OK'OUT:                                                        <<06542>>05835000
   EXCHANGEDB(SAVEDB);                                         <<06542>>05840000
END;                                                           <<06542>>05845000
PROCEDURE UPDATE'XDST;                                         <<06542>>05850000
OPTION UNCALLABLE;                                             <<06542>>05855000
BEGIN                                                          <<06542>>05860000
   INTEGER SAVEDB;                                             <<06542>>05865000
                                                               <<06542>>05870000
   SAVEDB:=EXCHANGEDB(SEGTABDST);                              <<06542>>05875000
   TOS:=LOADPROCCOUNT;                                         <<06542>>05880000
   LDELETE;                                                    <<06542>>05885000
   EXCHANGEDB(SEGTABDST'EX);                                   <<06542>>05890000
   LOADPROCCOUNT:=TOS;                                         <<06542>>05895000
   EXCHANGEDB(SAVEDB);                                         <<06542>>05900000
END;                                                           <<06542>>05905000
LOGICAL PROCEDURE LSEARCH' (KEY,PMODE,TYPE);                   <<06542>>05910000
   <<SEARCHES THE DIRECTORY FOR AN ENTRY HAVING THE >>                  05915000
   <<SPECIFIED KEY, MODE, AND TYPE.  IF FOUND TRUE IS>>                 05920000
   <<RETURNED AND ENTP PTRS ARE SET ELSE FALSE RETURNED>>               05925000
   VALUE KEY,PMODE,TYPE;                                                05930000
   DOUBLE KEY;                                                          05935000
   INTEGER PMODE,TYPE;                                                  05940000
   OPTION UNCALLABLE;                                                   05945000
   BEGIN                                                                05950000
     INTEGER RESULT = LSEARCH';                                <<06542>>05955000
     @ENTP:=HDFWDLINK(TYPE);  <<GET HEAD LINK>>                         05960000
     WHILE @ENTP <> 0 DO                                                05965000
       BEGIN                  <<SEARCH CHAINED ENTRIES>>                05970000
         IF (PMODE = -1 OR PMODE = EPMODE) AND                          05975000
            ENTRYKEY = KEY THEN                                         05980000
           BEGIN              <<FOUND ENTRY>>                           05985000
             SETSECPTRS;      <<SETUP SECONDARY POINTERS>>              05990000
             RESULT:=1;       <<RETURN TRUE>>                           05995000
             RETURN;                                                    06000000
           END ELSE                                                     06005000
           BEGIN              <<WRONG ENTRY>>                           06010000
             @ENTP:=FWDLINK;  <<NEXT ENTRY>>                            06015000
           END;                                                         06020000
       END <<WHILE>>;                                                   06025000
     RESULT:=0;               <<RETURN FALSE>>                          06030000
   END;                                                                 06035000
LOGICAL PROCEDURE LSEARCH (KEY,PMODE,TYPE);                    <<06542>>06040000
   <<SEARCHES THE DIRECTORY FOR AN ENTRY HAVING THE >>         <<06542>>06045000
   <<SPECIFIED KEY, MODE, AND TYPE.  IF FOUND TRUE IS>>        <<06542>>06050000
   <<RETURNED AND ENTP PTRS ARE SET ELSE FALSE RETURNED>>      <<06542>>06055000
   <<IF A EXTENSION ENTRY IS TO BE SEARCH THEN DB IS   >>      <<06542>>06060000
   <<CHANGED TO EXTRA DST, SEARCH THE ENTRY, AND MAKE A>>      <<06542>>06065000
   <<COPY OF THE FOUND ENTRY IN LST. POINTERS IN BOTH  >>      <<06542>>06070000
   <<LST AND XDST ARE SET POINTING TO THE ENTRY.       >>      <<06542>>06075000
   VALUE KEY,PMODE,TYPE;                                       <<06542>>06080000
   DOUBLE KEY;                                                 <<06542>>06085000
   INTEGER PMODE,TYPE;                                         <<06542>>06090000
   OPTION UNCALLABLE;                                          <<06542>>06095000
   BEGIN                                                       <<06542>>06100000
      INTEGER SAVEDB;                                          <<06542>>06105000
      IF TYPE = EXTENSION THEN                                 <<06542>>06110000
         BEGIN                                                 <<06542>>06115000
            SAVEDB:=EXCHANGEDB(SEGTABDST'EX);                  <<06542>>06120000
            IF LSEARCH' (KEY,PMODE,TYPE) THEN                  <<06542>>06125000
               BEGIN                                           <<06542>>06130000
                  TRANS'XDST'TO'LST;                           <<06542>>06135000
                  IF <> THEN LSEARCH:=FALSE ELSE LSEARCH:=TRUE;<<06542>>06140000
               END                                             <<06542>>06145000
            ELSE                                               <<06542>>06150000
               LSEARCH:=FALSE;                                 <<06542>>06155000
            EXCHANGEDB(SAVEDB);                                <<06542>>06160000
         END                                                   <<06542>>06165000
      ELSE                                                     <<06542>>06170000
         LSEARCH:=LSEARCH'(KEY,PMODE,TYPE);                    <<06542>>06175000
   END;                                                        <<06542>>06180000
PROCEDURE LCREATE(LENGTH,TYPE,PMODE,LIBRARY,KEY);                       06185000
   <<CREATES ENTRY OF LENGTH,TYPE,MODE        >>                        06190000
   <<AND ID (FROM KEY). THE ENTRY POINTER ENTP>>                        06195000
   <<IS SET TO THE NEW ENTRY.  NOTE--CONDITION>>                        06200000
   <<CODE IS USED TO INDICATE AN ERROR        >>                        06205000
   VALUE LENGTH,TYPE,PMODE,LIBRARY,KEY;                                 06210000
   INTEGER LENGTH,TYPE,PMODE,LIBRARY;                                   06215000
   DOUBLE KEY;                                                          06220000
   OPTION UNCALLABLE;                                                   06225000
   BEGIN                                                                06230000
     INTEGER KEY1 = KEY;                                                06235000
     INTEGER KEY2 = KEY1+1;                                             06240000
     INTEGER RETRY,EXCESS;                                              06245000
     LOGICAL IN'XDST := FALSE;                                 <<06542>>06250000
     ENTRY LCREATE';                                           <<06542>>06255000
                                                               <<06542>>06260000
     GO START;                                                 <<06542>>06265000
LCREATE':                                                      <<06542>>06270000
     IN'XDST:=TRUE;                                            <<06542>>06275000
START:                                                         <<06542>>06280000
     RETRY:=-1;           <<INITIAL VALUE>>                             06285000
                                                                        06290000
     <<* * * FIND SPACE FOR ENTRY * * *>>                               06295000
                                                                        06300000
RESTART:                                                                06305000
     @ENTP:=HDFWDLINK(0);  <<HEAD OF GARBAGE CHAIN>>                    06310000
     WHILE @ENTP <> 0 DO                                                06315000
       BEGIN               <<SEARCH THRU CHAIN>>                        06320000
         IF ENWG >= LENGTH+3 THEN                                       06325000
           BEGIN           <<FOUND LARGE ENOUGH ENTRY>>                 06330000
             UNLINKLSTENTRY; <<REMOVE GARBAGE ENTRY >>                  06335000
             EXCESS:=ENWG-LENGTH-3; <<EXCESS SPACE>>                    06340000
             IF EXCESS >= 4 THEN                                        06345000
               BEGIN       <<RETURN EXCESS>>                            06350000
                 BUILDGARBAGE(@ENTP+LENGTH,EXCESS);                     06355000
               END ELSE                                                 06360000
               BEGIN       <<INSUFFICIENT EXCESS>>                      06365000
                 EXCESS:=0;                                             06370000
               END;                                                     06375000
             RLENGTH:=ENWG-EXCESS; <<REGION LENGTH>>                    06380000
             <<INITIALIZE ENTRY>>                                       06385000
             ENTP:=0;                                                   06390000
             MOVE ENTP(1):=ENTP,(LENGTH-1); << ZERO ENTRY >>            06395000
             ETYPE:=TYPE;                                               06400000
             EPMODE:=PMODE;                                             06405000
             ELIB:=LIBRARY;                                             06410000
             SETSECPTRS; <<SETUP SECONDARY POINTERS>>                   06415000
             LINKLSTENTRY;<<LINK ENTRY INTO CHAIN>>                     06420000
             IF TYPE < SHARER                                           06425000
               THEN EFID:=KEY                                           06430000
               ELSE IF TYPE=EXTENSION THEN                              06435000
                       EPIN'EXT:=KEY                                    06440000
                    ELSE                                                06445000
                       EPID:=KEY2;                                      06450000
             TOS:=CCE;   <<RETURN VALUE>>                               06455000
             GO GETOUT;                                                 06460000
           END ELSE                                                     06465000
           BEGIN          <<GARBAGE ENTRY TOO SMALL>>                   06470000
             @ENTP:=FWDLINK; <<NEXT ENTRY>>                             06475000
           END;                                                         06480000
       END <<WHILE>>;                                                   06485000
     <<NO ADEQUATE GARBAGE ENTRY FOUND>>                                06490000
     <<EXPAND LST                     >>                                06495000
     RETRY:=RETRY+1;                                                    06500000
     IF > THEN GO NFG; <<ALLOW ONE EXPANSION>>                          06505000
     TOS:=0;                                                   <<06542>>06510000
     IF IN'XDST THEN TOS:=SEGTABDST'EX                         <<06542>>06515000
                ELSE TOS:=SEGTABDST;                           <<06542>>06520000
     TOS:=ALTDSEGSIZE(*,1024);                                 <<06542>>06525000
     IF > THEN GO NFG; <<NO DISC SPACE>>                                06530000
     EXCESS:=TOS-@DIR-1-DIRLEN; <<WORDS ADDED>>                         06535000
     IF EXCESS <= 0 THEN GO NFG;<<NO EXPANSION>>                        06540000
     BUILDGARBAGE(@DIR(DIRLEN),EXCESS); <<NEW GARBAGE>>                 06545000
     DIRLEN:=DIRLEN+EXCESS; <<UPDATE DIR LENGTH>>                       06550000
     GO RESTART;            <<TRY AGAIN>>                               06555000
     HELP;        <<SETUP LINKAGE>>                                     06560000
NFG:                                                                    06565000
     TOS:=CCL;                                                          06570000
     @ENTP:=-1;                                                         06575000
GETOUT:                                                                 06580000
     CONDCODE:=TOS;                                                     06585000
   END;                                                                 06590000
PROCEDURE LDELETE;                                                      06595000
  <<DELETES THE CURRENT ENTRY BY MAKING A GARBAGE ENTRY>>               06600000
  <<OUT OF IT                                          >>               06605000
  OPTION PRIVILEGED,UNCALLABLE;                                         06610000
  BEGIN                                                                 06615000
    UNLINKLSTENTRY;   <<UNLINK THE ENTRY>>                              06620000
    BUILDGARBAGE(@ENTP-3,RLENGTH);                                      06625000
  END; <<LDELETE>>                                                      06630000
INTEGER PROCEDURE MOUNTVOLSET (FILENUM,SOME'OTHER'PIN);                 06635000
    VALUE FILENUM,SOME'OTHER'PIN;                                       06640000
    INTEGER FILENUM,SOME'OTHER'PIN;                                     06645000
    OPTION UNCALLABLE,VARIABLE;                                         06650000
    BEGIN                                                               06655000
                                                                        06660000
        COMMENT                                                         06665000
                                                                        06670000
            THIS FUNCTION WILL EXPLICITLY PERFORM A MOUNT ON            06675000
            THE HOME VOLUME SET OF THE FILE'S GROUP AND                 06680000
            ACCOUNT.                                                    06685000
            NO ERROR SHOULD BE RETURNED SINCE AT THIS POINT             06690000
            A SUCCESSFUL MOUNT WOULD HAVE BEEN IMPLICITLY               06695000
            PERFORMED BY THE PREVIOUS FOPEN.                            06700000
                                                                        06705000
            THE PROCEDURE WILL RETURN A VALUE AS A FUNCTION.            06710000
            THE NATURE OF THIS VALUE IS DETERMINED ON THE               06715000
            SETTING OF THE CONDITION CODE AS FOLLOWS:                   06720000
                                                                        06725000
            CCE - OPERATION SUCCEEDED.                                  06730000
                  IF THE VALUE IS NON-ZERO A MOUNT WAS                  06735000
                  PERFORMED SO THAT THE VALUE REPRESENTS THE            06740000
                  PVINFO WORD RETURNED BY THE MOUNT PROCEDURE.          06745000
                  IF THE VALUE IS ZERO NO MOUNT WAS NECESSARY.          06750000
                                                                        06755000
            CCL - A MOUNT FAILURE CAUSED THE OPERATION TO FAIL          06760000
                  IN SOME WAY. THE VALUE RETURNED IS A PV               06765000
                  ERROR NUMBER.                                         06770000
                                                                        06775000
            CCG - NOT RETURNED.                                         06780000
                                                                        06785000
        *** NOTE THAT DB MUST BE AT STACK WHEN THIS PROCEDURE           06790000
        *** IS CALLED.                                                  06795000
                                                                        06800000
        ;                                                               06805000
        EQUATE                                                          06810000
            UNCONDMOUNT = 3,  <<NO BINDING>>                            06815000
            NOHVSET = 28;                                               06820000
                                                                        06825000
        LOGICAL                                                         06830000
            PMAP = Q-4;                                                 06835000
        INTEGER                                                         06840000
            PVINFO = MOUNTVOLSET,                                       06845000
            RESULT = MOUNTVOLSET,                                       06850000
            REQTYPE := UNCONDMOUNT,                                     06855000
            PVERR  = REQTYPE;                                           06860000
                                                                        06865000
        ARRAY                                                           06870000
            NAMES (0:11),                                               06875000
            VSNAME (*) = NAMES (0),                                     06880000
            GNAME (*)  = NAMES (4),                                     06885000
            ANAME (*)  = NAMES (8);                                     06890000
                                                                        06895000
        BYTE ARRAY                                                      06900000
            FILENAME (0:27),                                            06905000
            BVSNAME (*) = VSNAME,                                       06910000
            BGNAME (*)  = GNAME,                                        06915000
            BANAME (*)  = ANAME;                                        06920000
                                                                        06925000
        IF (PVINFO := FGETPVINFO (FILENUM)) <> 0 THEN                   06930000
        BEGIN <<FOPEN CAUSED A LOGICAL MOUNT>>                          06935000
            IF PVINFO = -1 THEN                                <<06102>>06940000
               BEGIN    << IT IS A REMOTE PROG >>              <<06102>>06945000
                  CONDCODE := CCL;                             <<06102>>06950000
                  RETURN;                                      <<06102>>06955000
               END;                                            <<06102>>06960000
            FGETINFO (FILENUM,FILENAME);                                06965000
            NAMES := "  ";                                              06970000
            MOVE NAMES (1) := NAMES, (11);                              06975000
            BVSNAME (0) := "*";                                         06980000
            SCAN FILENAME UNTIL %020056, 1;  <<SPACE/PERIOD>>           06985000
            TOS := TOS+1;  <<SKIP PAST ".">>                            06990000
            MOVE BGNAME := * WHILE ANS, 0;                              06995000
            DELB;  <<DESTINATION ADDR>>                                 07000000
            TOS := TOS+1;  <<SKIP PAST ".">>                            07005000
            MOVE BANAME := * WHILE ANS, 2;                              07010000
            CONDCODE := CCE;  <<ASSUME SUCCESS>>                        07015000
            IF PMAP THEN                                                07020000
             MOUNT (BVSNAME,BGNAME,BANAME,                              07025000
                    REQTYPE,-1,PVINFO,SOME'OTHER'PIN*PCBSIZE)  <<07316>>07030000
            ELSE                                                        07035000
             MOUNT (BVSNAME,BGNAME,BANAME,REQTYPE,-1,PVINFO);           07040000
            IF < THEN                                                   07045000
            BEGIN <<SOME MOUNT FAILURE>>                                07050000
                RESULT := PVERR;                                        07055000
                CONDCODE := CCL;                                        07060000
            END;                                                        07065000
        END;                                                            07070000
    END <<OF MOUNTVOLSET>>;                                             07075000
INTEGER PROCEDURE DISMOUNTVOLSET (PVINFO,SOME'OTHER'PIN);               07080000
    VALUE   PVINFO,SOME'OTHER'PIN;                                      07085000
    INTEGER PVINFO,SOME'OTHER'PIN;                                      07090000
    OPTION UNCALLABLE,VARIABLE;                                         07095000
    BEGIN                                                               07100000
                                                                        07105000
        COMMENT                                                         07110000
            THIS PROCEDURE WILL EXPLICITLY MAKE A CALL TO               07115000
            DISMOUNT FOR LOGICALLY DISMOUNTING A VOLUME SET.            07120000
                                                                        07125000
            THE PRODECURE RETURNS A PV ERROR NUMBER IS THE              07130000
            DISMOUNT FAILS, OTHERWISE (SUCCESSFUL) A ZERO               07135000
            IS RETURNED. THE SETTING OF THE CONDITION CODE              07140000
            DETERMINES THE NATURE OF THE RETURNED VALUE.                07145000
                                                                        07150000
            CCE - OPERATION SUCCEEDED.                                  07155000
                  VALUE RETURNED WILL BE ZERO.                          07160000
                                                                        07165000
            CCL - OPERATION FAILED.                                     07170000
                  VALUE RETURNED WILL BE A PV ERROR NUMBER.             07175000
                                                                        07180000
            CCG - NOT RETURNED.                                         07185000
                                                                        07190000
        *** NOTE THAT DB MUST BE AT STACK WHEN THIS PROCEDURE           07195000
        *** IS CALLED.                                                  07200000
                                                                        07205000
        ;                                                               07210000
        EQUATE                                                          07215000
            UNCONDDISMOUNT = 3;  <<NO UNBINDING>>                       07220000
        LOGICAL                                                         07225000
            PMAP = Q-4;                                                 07230000
        INTEGER                                                         07235000
            REQTYPE := UNCONDDISMOUNT,                                  07240000
            PVERR = REQTYPE;                                            07245000
                                                                        07250000
        IF PMAP THEN                                                    07255000
         DISMOUNT (<<VSNAME>>,<<VSGNAME>>,<<VSANAME>>,                  07260000
                   REQTYPE,PVINFO,SOME'OTHER'PIN*PCBSIZE)      <<07316>>07265000
        ELSE                                                            07270000
         DISMOUNT (<<VSNAME>>,<<VSGNAME>>,<<VSANAME>>,                  07275000
                   REQTYPE,PVINFO);                                     07280000
        IF <> THEN                                                      07285000
        BEGIN                                                           07290000
            DISMOUNTVOLSET := PVERR;                                    07295000
            CONDCODE := CCL;                                            07300000
        END;                                                            07305000
    END <<OF DISMOUNTVOLSET>>;                                          07310000
PROCEDURE INITLOADCACHE;                                                07315000
  <<INITIALIZES THE LOAD CACHE.  TO BE CALLED AT LOAD>>                 07320000
  <<STARTUP TIME AND BY SEGMENTER WHEN MODIFYING THE >>                 07325000
  <<SYSTEM SL.                                       >>                 07330000
  OPTION PRIVILEGED,UNCALLABLE;                                         07335000
  BEGIN                                                                 07340000
    INTEGER BUCKETSIZE';                                                07345000
    LONG ZEROS:=0L0;        <<FOUR WORDS OF ZERO>>                      07350000
    IF LOADCACHESEG<>0 THEN                                             07355000
      BEGIN   <<THERE IS A CACHE>>                                      07360000
        BUCKETSIZE':=BUCKETSIZE+1;  <<INITIAL VALUE>>                   07365000
        TOS:=LOADCACHESEG;          <<TARGET SEGMENT>>                  07370000
        TOS:=BUCKET0;               <<TARGET>>                          07375000
        TOS:=@BUCKETSIZE';          <<SOURCE>>                          07380000
        TOS:=1;                     <<LENGTH>>                          07385000
        ASSEMBLE(MTDS 2);           <<MOVE - SAVE TARGET>>              07390000
                                                                        07395000
        TOS:=LOADCACHESEG;          <<SOURCE SEGMENT>>                  07400000
        TOS:=BUCKET0;               <<SOURCE>>                          07405000
        TOS:=NBUCKETS*BUCKETSIZE-1; <<LENGTH>>                          07410000
        ASSEMBLE(MDS 5);            <<PROPOGATE INITIAL VALUE>>         07415000
                                                                        07420000
        <<ZERO HIT AND MISS COUNTERS>>                                  07425000
        TOS:=LOADCACHESEG;          <<TARGET SEGMENT>>                  07430000
        TOS:=CACHEHITS;             <<TARGET>>                          07435000
        TOS:=@ZEROS;                <<SOURCE>>                          07440000
        TOS:=4;                     <<LENGTH>>                          07445000
        ASSEMBLE(MTDS 4);           <<MOVE>>                            07450000
      END;                                                              07455000
  END;                                                                  07460000
PROCEDURE LOAD (PROGFNAME,ENTRYNAME,CSTINDEX,DELTAP,DSTINDEX,           07465000
   PIN,FLAGS,PCBXSIZE,DLSIZE,STACKSIZE,MAXDATA,                         07470000
   GLOBALSIZE,STRING,STRINGLENGTH,CAPABILITY,MAPFLAG);         <<06102>>07475000
   <<ASSUMES THAT CRITICAL HAS BEEN SET WHEN CALLED AND >>              07480000
   <<THAT DB IS SET TO THE STACK OF THE CALLER>>                        07485000
   VALUE PIN,FLAGS,PCBXSIZE,STRINGLENGTH;                      <<06102>>07490000
   BYTE ARRAY PROGFNAME,ENTRYNAME,STRING;                      <<06102>>07495000
   INTEGER CSTINDEX,DELTAP,DSTINDEX,PIN,PCBXSIZE,DLSIZE,                07500000
      STACKSIZE,MAXDATA,STRINGLENGTH,GLOBALSIZE;               <<06102>>07505000
   INTEGER MAPFLAG;                                                     07510000
   LOGICAL FLAGS,CAPABILITY;                                            07515000
   OPTION PRIVILEGED,UNCALLABLE;                                        07520000
BEGIN                                                                   07525000
  INTEGER PCBPT;  << INDEX OF PCB ENTRY >>                              07530000
  DEFINE PMODE = FLAGS.(12:1)#;                                         07535000
  INTEGER P256 := 256;                                                  07540000
  INTEGER P512 := 512;                                                  07545000
  EQUATE SYSTEMDL = 10,  <<SUBSYSTEM DL AREA SIZE>>                     07550000
         XTRAMAXDATA = 768,  <<EXTRA MAXDATA>>                 <<06102>>07555000
         STACKOVERFLOW = 128;<<SYSTEM STACK OVERFLOW AREA SIZE>>        07560000
  INTEGER MINSTACKSIZE = P512;  <<MIN. STACK SIZE>>                     07565000
  INTEGER SAVESIR := -1;                                                07570000
  DOUBLE DS1 = S-1;                                                     07575000
                                                                        07580000
  <<PROGRAM FILE PARAMETERS>>                                           07585000
                                                                        07590000
  INTEGER PROGFNUM := 0;  <<PROGRAM FILE NR.>>                          07595000
  DOUBLE PROGKEY;  <<PROGRAM FILE KEY>>                                 07600000
INTEGER LDEV;                                                  <<07316>>07605000
DOUBLE STARTADDR,ENDADDR;                                      <<07316>>07610000
INTEGER STARTADDR1=STARTADDR,                                  <<07316>>07615000
        STARTADDR2=STARTADDR+1;                                <<07316>>07620000
  DOUBLE PENTRYRECD';                                                   07625000
  INTEGER ARRAY SBUF(0:255);                                            07630000
  INTEGER ARRAY SBUF3(*)=SBUF,                                          07635000
                SBUF4(*)=SBUF(128);                                     07640000
                                                                        07645000
  <<PROCESS PARAMETERS>>                                                07650000
                                                                        07655000
  DOUBLE PROCESSKEY;  <<PROCESS KEY>>                                   07660000
  INTEGER ARRAY ENTRYNAME' (0:7) = Q;  <<ENTRY POINT NAME>>             07665000
  BYTE ARRAY BENTRYNAME' (*) = ENTRYNAME';                              07670000
  INTEGER PLABEL;          <<ENTRY POINT P-LABEL>>                      07675000
  BYTE STTINDEX = PLABEL;  <<ENTRY POINT STT NR.>>                      07680000
  INTEGER CSTINDEX';       <<ENTRY POINT CST NR.>>                      07685000
  INTEGER DELTAP';         <<ENTRY POINT PB ADR.>>                      07690000
  LOGICAL ZERODB;          <<ZERO DB AND DL AREA?>>                     07695000
  INTEGER GLOBALRECD;      <<REC. NR. OF GLOBAL VALUES>>                07700000
  INTEGER GLOBALSIZE';     <<PROCESS GLOBAL SIZE>>                      07705000
  INTEGER SAFLUT;          <<S.A. OF FLUT>>                             07710000
  INTEGER SASTLT;          <<S.A. OF STLT>>                             07715000
  INTEGER SATRAPCOM;  <<S.A. OF TRAPCOM'>>                              07720000
  INTEGER DLSIZE';  <<PROCESS DL SIZE>>                                 07725000
  INTEGER STACKSIZE';  <<PROCESS STACK SIZE>>                           07730000
  INTEGER MAXDATA';  <<PROCESS MAX. DATA SEG. SIZE>>                    07735000
  INTEGER CAPABILITY';  <<PROCESS CAPABILITY>>                          07740000
  INTEGER DSTINDEX' := 0;  <<PROCESS DATA SEG. DST NR.>>                07745000
  INTEGER STCOUNT := 0; <<#WORDS WORTH OF PASSED STRING>>      <<06102>>07750000
  INTEGER LOADWARN :=0; <<INDICATES ANY SPECIAL ACTIONS TAKEN>><<06102>>07755000
  INTEGER ORIG'DLSIZE,  <<LOCAL COPY OF ORIGINAL DLSIZE>>      <<06102>>07760000
          ORIG'MAXDATA; <<LOCAL COPY OF ORIGINAL MAXDATA>>     <<06102>>07765000
  INTEGER MAPFLAG'; <<MAPPING FLAG FOR CSTINDEX'>>                      07770000
  INTEGER SEGNR; <<STARTING SEG NUMBER>>                                07775000
  INTEGER TRACE'PLABEL;  <<TRACE0' EXTERNAL LABEL>>                     07780000
  LOGICAL MODE;                                                         07785000
  INTEGER                                                               07790000
      PVINFO,                                                           07795000
      JSMP;                                                             07800000
  INTEGER POINTER PXGLOB=S-0;                                           07805000
  EQUATE                                                                07810000
      JITWORD = %13,                                           <<06666>>07815000
      JITSMP = 11;                                             <<06900>>07820000
  DEFINE IA=LOGICAL(SBUF0.(8:1))#;                                      07825000
  DEFINE BA=LOGICAL(SBUF0.(7:1))#;                                      07830000
                                                                        07835000
<<WARNINGS ABOUT DEFAULT STACK SPACE PARAMETERS TAKEN>>        <<06102>>07840000
EQUATE DFLT'STACKSIZE =  -9,  <<DEFAULT STACK SIZE WARN>>      <<06102>>07845000
       DFLT'DLSIZE    = -10,  <<DEFAULT DLSIZE         >>      <<06102>>07850000
       DFLT'MAXDATA   = -11,  <<DEFAULT MAXDATA        >>      <<06102>>07855000
       DLROUNDEDUP    = -12,  <<DL UP TO 128 WRD MULT  >>      <<06102>>07860000
       CONFIGMAXDATA  = -13,  <<MAXDATA @ CONFIG MAX   >>      <<06102>>07865000
       MAXDATAUP      = -14;  <<MAXDATA @ STACK SPACE  >>      <<06102>>07870000
$PAGE                                                                   07875000
INTEGER SUBROUTINE WORDADDRESS (BYTEADDRESS);                  <<06102>>07880000
   VALUE BYTEADDRESS;                                          <<06102>>07885000
   BYTE POINTER BYTEADDRESS;                                   <<06102>>07890000
                                                               <<06102>>07895000
BEGIN                                                          <<06102>>07900000
   TOS:=WORDADDRESS:=@BYTEADDRESS & LSR(1);                    <<06102>>07905000
   PUSH (Z);                                                   <<06102>>07910000
   IF <<WORDADDRESS>> TOS > TOS <<Z>> THEN                     <<06102>>07915000
      WORDADDRESS.(0:1) := 1;                                  <<06102>>07920000
END;                                                           <<06102>>07925000
$PAGE                                                                   07930000
  ERRORON;                                                              07935000
  CONDCODE := CCE;                                                      07940000
  TURNOFFTRAPS;                                                         07945000
  PCBPT := PIN * PCBSIZE;                                               07950000
  PUSH(DL);                                                             07955000
  MODE:=PXGLOB(-PXGLOB(-1)+6);                                          07960000
  TOS := @JSMP;                                                         07965000
  TOS := PS1 (-PS1 (-1) + JITWORD);                            <<06666>>07970000
  TOS := JITSMP;                                                        07975000
  TOS := 1;                                                             07980000
  ASSEMBLE (MFDS);                                                      07985000
  DEL;                                                                  07990000
  FORMATNAME(BENTRYNAME',ENTRYNAME);  <<ENTRY POINT NAME>>              07995000
  IF FLAGS.(10:2) = 3 THEN  <<ILLEGAL LIBSEARCH?>>                      08000000
     BEGIN                                                              08005000
     TOS := ERR20; GO GETOUT                                            08010000
     END;                                                               08015000
  STACKSIZE' := STACKSIZE;                                              08020000
  DLSIZE' := DLSIZE;                                                    08025000
  MAXDATA' := MAXDATA;                                                  08030000
  ORIG'DLSIZE := DLSIZE;                                       <<06102>>08035000
  ORIG'MAXDATA := MAXDATA; <<LOCAL COPY OF DLSIZE & MAXDATA>>  <<06102>>08040000
  IF STRINGLENGTH > 0 THEN                                     <<06102>>08045000
    IF LOGICAL(STRINGLENGTH) THEN                              <<06102>>08050000
      STCOUNT := STRINGLENGTH & LSR(1) + 1                     <<06102>>08055000
    ELSE                                                       <<06102>>08060000
      IF LOGICAL(@STRING) THEN                                 <<06102>>08065000
        STCOUNT := STRINGLENGTH & LSR(1) + 2                   <<06102>>08070000
      ELSE                                                     <<06102>>08075000
        STCOUNT := STRINGLENGTH & LSR(1);                      <<06102>>08080000
  PROCESSKEY := DOUBLE(LOGICAL(PIN));                                   08085000
                                                                        08090000
  <<* * * OPEN PROGRAM FILE * * *>>                                     08095000
                                                                        08100000
  PROGFNUM:=DFOPEN(PROGFNAME,%(2)10000000011,%(2)111110111);   <<06102>>08105000
  IF < THEN  <<ERROR?>>                                                 08110000
     BEGIN                                                              08115000
     TOS := ERR53; GO GETOUT                                            08120000
     END;                                                               08125000
  FLOCK(PROGFNUM,TRUE);  <<GET FILE EXCLUSIVELY>>                       08130000
  ASSEMBLE(ADDS 6);                                            <<4493>> 08135000
  FGETINFO(PROGFNUM,,,,,,S0,,S3,,,,,,,S4,,S5,,DS2);            <<4493>> 08140000
LDEV:=S0;                                                      <<07316>>08145000
STARTADDR1:=S2.(8:8);                                          <<07316>>08150000
STARTADDR2:=S1;                                                <<07316>>08155000
ENDADDR:=STARTADDR+DOUBLE(S4);                                 <<07316>>08160000
  BS2 := TOS;  <<INSERT LOGICAL DEVICE NR.>>                            08165000
  PROGKEY := TOS;  <<PROG. FILE KEY>>                                   08170000
  IF TOS <> PROGFILECODE THEN  <<TYPE PROGRAM?>>                        08175000
     BEGIN                                                              08180000
     TOS := ERR31; GO GETOUT                                            08185000
     END;                                                               08190000
  PVINFO := MOUNTVOLSET (PROGFNUM,PIN);                        <<06102>>08195000
  IF < THEN     <<MOUNT FAILED>>                               <<06102>>08200000
    BEGIN                                                      <<06102>>08205000
      IF PVINFO = -1 THEN                                      <<06102>>08210000
       BEGIN                                                   <<06102>>08215000
          PVINFO := 0;                                         <<06102>>08220000
          TOS:=ERR97;                                          <<06102>>08225000
          GO GETOUT;                                           <<06102>>08230000
       END;                                                    <<06102>>08235000
      PVINFO := 0;                                             <<06102>>08240000
      TOS := ERR93;                                            <<06102>>08245000
      GO GETOUT;                                               <<06102>>08250000
    END;                                                       <<06102>>08255000
  SAVESIR := GETSIR(SEGTABSIR);  <<GET SEGMENT TABLE SIR>>              08260000
  EXCHANGEDB(SEGTABDST);  <<SET DB TO SEGMENT TABLE>>                   08265000
  FREADDIR(PROGFNUM,PROGREC0,128,0D);  <<READ RECORD 0>>                08270000
  IF <> THEN GO IOERROR;  <<ERROR?>>                                    08275000
S1 := S1+1+PEXTERNALRECD;<<EXT. S.A.+#FILELABEL+#USERLABEL>>   <<06102>>08280000
IF TOS > TOS THEN   <<CODE NOT IN 1ST EXTENT>>                 <<06102>>08285000
    BEGIN                                                               08290000
    TOS := ERR34; GO ABORT                                              08295000
    END;                                                                08300000
                                                                        08305000
  IF (IA LOR BA) THEN                                                   08310000
    BEGIN                                                               08315000
      IF MODE.(2:2)  THEN <<INTERACTIVE>>                               08320000
        BEGIN                                                           08325000
          <<SET INTEACTIVE BIT IN PCB>>                        <<06102>>08330000
          LPCB(PIN * PCBSIZE + QUEUEINGINFOWORDNUM).           <<06648>>08335000
              INTERACTIVEFLAG := 1;                            <<06102>>08340000
          IF NOT IA THEN                                                08345000
            BEGIN                                                       08350000
              TOS:=ERR39; GO ABORT;                                     08355000
            END;                                                        08360000
        END                                                             08365000
       ELSE <<BATCH>>                                                   08370000
        IF NOT BA THEN                                                  08375000
          BEGIN                                                         08380000
            TOS:=ERR39; GO ABORT;                                       08385000
          END;                                                          08390000
    END;                                                                08395000
  PENTRYRECD':=DOUBLE(LOGICAL(PENTRYRECD));<<ENTRY PT RECORD>>          08400000
  <<GET INFO ON PRIMARY ENTRY POINT>>                                   08405000
  STTINDEX:=PSTARTINGSTT;  <<STT #>>                                    08410000
  DELTAP' :=PSTARTINGADR;  <<PB ADDR>>                                  08415000
  EXCHANGEDB(0);           <<DB TO STACK>>                              08420000
  <<CHECK IF ALTERNATE ENTRY POINT SPECIFIED>>                          08425000
                                                                        08430000
  IF BENTRYNAME' <> 0 THEN  <<ENTRY POINT SPECIFIED?>>                  08435000
    BEGIN                                                               08440000
     FREADDIR(PROGFNUM,SBUF4,128,PENTRYRECD');                          08445000
     IF <> THEN GO IOERROR;  <<ERROR?>>                                 08450000
     TOS := @SBUF4&LSL(1);  <<TARGET ENTRY NAME>>                       08455000
     COMPNAME:                                                          08460000
     IF BPS0 = 0 THEN  <<END OF LIST?>>                                 08465000
       BEGIN                                                            08470000
        TOS := ERR21; GO ABORT                                          08475000
       END;                                                             08480000
     TOS:=@BPS0+(INTEGER(BPS0.(12:3))+3)&LSL(1);<<NEXT NAME>>           08485000
     IF @BPS0 >= @SBUF4(128)&LSL(1) THEN  <<LOAD NEXT RECORD?>>         08490000
       BEGIN                                                            08495000
        MOVE SBUF3 := SBUF4,(128);                                      08500000
        @BPS1 := @BPS1-P256;  <<ADJ. TARGET POINTER>>                   08505000
        TOS := TOS-P256;  <<ADJ. NEXT TARGET POINTER>>                  08510000
        FREAD(PROGFNUM,SBUF4,128);  <<READ NEXT RECORD>>                08515000
        IF <> THEN GO IOERROR  <<ERROR?>>                               08520000
       END;                                                             08525000
     XREG := BENTRYNAME';  <<NR. CHAR'S>>                               08530000
     IF INTEGER(BPS1.(12:4)) <> XREG THEN  <<NR. CHAR'S MATCH?>>        08535000
       BEGIN                                                            08540000
        NEXTENTRY:                                                      08545000
        DELB;  <<DELETE TARGET POINTER>>                                08550000
        GO COMPNAME  <<NEXT NAME>>                                      08555000
       END;                                                             08560000
     DO BEGIN                                                           08565000
         IF BENTRYNAME'(XREG) <> BPS1(XREG) THEN GO NEXTENTRY;          08570000
         XREG := XREG-1                                                 08575000
        END UNTIL =;                                                    08580000
     TOS := TOS&LSR(1);  <<CONVERT TO WORD POINTER>>                    08585000
     TOS := DPS0(-1);  <<PB ADR. AND STT NR.>>                          08590000
     ASSEMBLE(DXCH,DDEL);                                               08595000
     STTINDEX:=TOS;        <<STARTING STT #>>                           08600000
     DELTAP' :=TOS;        <<STARTING PB ADDR>>                         08605000
    END;                                                                08610000
  EXCHANGEDB(SEGTABDST);   <<DB BACK TO LST>>                           08615000
                                                                        08620000
  <<* * * DETERMINE DATA SEGMENT PARAMETERS * * *>>                     08625000
                                                                        08630000
  TOS := IF DLSIZE' = -1 <<INIT DLSIZE>>                                08635000
           THEN PDLSIZE                                                 08640000
           ELSE DLSIZE';                                                08645000
  IF < THEN  <<INITIAL DLSIZE EXCEEDS 32K?>>                            08650000
    IF DLSIZE' = -1 THEN                                       <<06102>>08655000
      BEGIN                                                    <<06102>>08660000
        TOS:=ERR76;                                            <<06102>>08665000
        GO ABORT;                                              <<06102>>08670000
      END                                                      <<06102>>08675000
    ELSE                                                       <<06102>>08680000
      BEGIN           <<BAD DL FROM USER>>                     <<06102>>08685000
        DEL;                                                   <<06102>>08690000
        TOS:=PDLSIZE;                                          <<06102>>08695000
        IF < THEN                                              <<06102>>08700000
          BEGIN                                                <<06102>>08705000
            TOS:=ERR76;                                        <<06102>>08710000
            GO ABORT;                                          <<06102>>08715000
          END                                                  <<06102>>08720000
        ELSE                                                   <<06102>>08725000
          LOADWARN := DFLT'DLSIZE;                             <<06102>>08730000
      END;                                                     <<06102>>08735000
  DLSIZE':=(TOS+SYSTEMDL+PCBXSIZE+127) & LSR(7) & LSL(7)       <<06102>>08740000
            -PCBXSIZE;                                         <<06102>>08745000
  IF < THEN      <<FINAL DL BAD>>                              <<06102>>08750000
    BEGIN                                                      <<06102>>08755000
      TOS:=ERR76;                                              <<06102>>08760000
      GO ABORT;                                                <<06102>>08765000
    END;                                                       <<07316>>08770000
  IF STACKSIZE' = -1 THEN STACKSIZE' := PSTACKSIZE;                     08775000
  IF STACKSIZE' < MINSTACKSIZE THEN  <<STACK TOO SMALL?>>               08780000
    BEGIN                                                               08785000
      <<TAKE DEFAULT STACKSIZE FROM PROGRAM FILE>>             <<06102>>08790000
      <<IT IS ALWAYS >= 512                     >>             <<06102>>08795000
      LOADWARN := DFLT'STACKSIZE;                              <<06102>>08800000
      STACKSIZE' := PSTACKSIZE;                                <<s8608>>08805000
    END;                                                                08810000
  GLOBALSIZE' := PGLOBALSIZE;                                           08815000
  IF MAXDATA'=0 OR MAXDATA'<-1 THEN                                     08820000
    BEGIN <<ILLEGAL MAXDATA>>                                           08825000
      <<TAKE DEFAULT MAXDATA FROM PROGRAM FILE>>               <<06102>>08830000
      LOADWARN := DFLT'MAXDATA;                                <<06102>>08835000
      MAXDATA' := PMAXDATA;                                    <<07317>>08840000
    END;                                                                08845000
  IF MAXDATA' = -1 THEN MAXDATA' := PMAXDATA;                           08850000
  SAFLUT := PSAFLUT;  <<SAVE S.A. OF FLUT>>                             08855000
  SASTLT := PSASTLT;  <<SAVE S.A. OF STLT>>                             08860000
  SATRAPCOM := PSATRAPCOM;  <<SAVE S.A. OF TRAPCOM'>>                   08865000
  ZERODB := PZERODB;  <<SAVE ZERODB FLAG>>                              08870000
  GLOBALRECD := PGLOBALRECD;<<REC # OF INIT GLOBAL VALUES>>             08875000
  CAPABILITY' := PCAPABILITY;  <<SAVE CAPABILITY>>                      08880000
  TOS := FACCESS(PROGFNUM);                                             08885000
  TOS := TOS&LSR(3);  ASSEMBLE( DUP );                                  08890000
  TOS := TOS&LSR(2);  ASSEMBLE( AND,NOT );                              08895000
  CAPABILITY'.(10:1) := TOS;                                            08900000
                                                                        08905000
  <<* * * LOAD PROGRAM FILE * * *>>                                     08910000
                                                                        08915000
  TOS := LOADPROGRAM (PROGFNUM,PROGKEY,PROCESSKEY,                      08920000
                     FLAGS.(10:6)&LSL(8),JSMP,SAVESIR,PVINFO); <<06102>>08925000
  IF < THEN GO ABORT;  <<ERROR?>>                                       08930000
  MAPFLAG':=S0.(1:1); <<GET MAPPING FLAG>>                              08935000
  TOS.(1:1):=0;       <<CLEAR FLAG      >>                              08940000
  TOS := PLABEL CAT S0 (8:8:8);  <<INSERT CST NR.>>                     08945000
  <<BIT 0 0F PLABEL REFLECTS MAPPING CONDITION-->>                      08950000
  <<OLD FIRMWARE IS SET FOR PHYSICAL MAPPING    >>                      08955000
  IF NOT LOGICALMAPPING OR MAPFLAG' = 1                                 08960000
    THEN SETBIT0;                                                       08965000
  PLABEL := TOS;  <<ENTRY POINT P-LABEL>>                               08970000
  TOS.(0:1) := LS0.(0:1) LAND NOT PMODE;<<ADJ PRIV MODE BIT>>           08975000
  CSTINDEX' := TOS;  <<STARTING CST NR. WITH MODE BIT>>                 08980000
  LSEARCH(PROGKEY,PMODE,PROGFILE);                                      08985000
  SPCBMAPDST := EMAPDST;                                                08990000
  SPCBPBX := ECSTBLK;                                                   08995000
  TRACE'PLABEL:=ETRACE'PLABEL;  <<GET TRACE0' EXTERNAL LABEL>>          09000000
                                                                        09005000
  << * * * CHECK FOR VALID LAUNCH DATA * * * >>                         09010000
                                                                        09015000
  SEGNR := IF LOGICALMAPPING THEN CSTINDEX'.(8:8)                       09020000
     ELSE CSTINDEX'.(10:6);                                             09025000
  IF SEGNR > ABS(CSTEXT(ECSTBLK)+ABS(DSTB)) OR                          09030000
     LOGICAL(DELTAP') >= ABS(XREG+SEGNR*4)&LSL(2) THEN                  09035000
    BEGIN    <<BAD ENTRY POINT DATA>>                                   09040000
      TOS:=ERR45;                                                       09045000
      GO ABORT;                                                         09050000
    END;                                                                09055000
  <<CHECK IF PROGRAM IS BEING TRACED>>                                  09060000
  IF SASTLT <> -1 THEN                                                  09065000
    BEGIN  <<BEING TRACED>>                                             09070000
      <<USE TRACE0' AS THE INITIAL SEGMENT TO EXECUTE>>                 09075000
      DELTAP':=CONVEXTLABELTODELTAP(TRACE'PLABEL);                      09080000
      IF LOGICALMAPPING                                                 09085000
        THEN MAPFLAG':=TRACE'PLABEL.(0:1)                               09090000
        ELSE MAPFLAG':=0;                                               09095000
      CSTINDEX':=TRACE'PLABEL.(8:8);                                    09100000
    END;                                                                09105000
                                                                        09110000
  <<* * * GET DST ENTRY AND INITIALIZE DATA SEGMENT * * *>>             09115000
                                                                        09120000
  << INSURE ENOUGH STACK TO START THE PROCESS UP         >>    <<06102>>09125000
  << THE STACKSIZE < DEFAULTDATASEG CAN ONLY OCCURE BY   >>    <<06102>>09130000
  << USING PREP INSIDE OF THE SEGMENTER OR CALLING THE   >>    <<06102>>09135000
  << SEGMENTER DIRECTLY. THE CI PREP COMMAND WON'T ALLOW >>    <<06102>>09140000
  << SUCH A SPECIFICATION.                               >>    <<06102>>09145000
                                                               <<06102>>09150000
  IF STACKSIZE' < ABS(DEFAULTDATASEG) THEN                     <<06102>>09155000
    STACKSIZE' := ABS(DEFAULTDATASEG);                         <<06102>>09160000
                                                                        09165000
  TOS := 0;  <<FOR RESULT OF GETDATASEG>>                               09170000
  TOS:=DOUBLE(LOGICAL(PCBXSIZE))+DOUBLE(LOGICAL(DLSIZE'))+              09175000
       DOUBLE(LOGICAL(GLOBALSIZE'))+                                    09180000
       DOUBLE(LOGICAL(STACKSIZE'))+                                     09185000
       DOUBLE(LOGICAL(STACKOVERFLOW))+                                  09190000
       DOUBLE(LOGICAL(STCOUNT));                               <<06102>>09195000
  << CHECK IF DATA SEGMENT SIZE EXCEEDS 32K WDS >>                      09200000
  IF DS1 > %77777D THEN                                                 09205000
     BEGIN                                                              09210000
     DELB;  << CONVERT SEG SIZE TO SINGLE PRECISON >>                   09215000
     TOS := ERR35; GO ABORT                                             09220000
     END;                                                               09225000
  DELB;  << CONVERT SEGMENT SIZE TO SINGLE PRECISION >>                 09230000
  TOS:=(((S0+XTRAMAXDATA+127)&LSR(7))+12)&LSL(7);<<VM SPACE>>           09235000
  ASSEMBLE(CAB,CAB);                                                    09240000
  XREG := ABSOLUTE(MAXDATASEG);     << MAX DATA SEG SIZE >>             09245000
  IF LS0 > LXREG THEN  <<DATA SEG. EXCEEDS SYS. MAX.?>>                 09250000
     BEGIN                                                              09255000
     TOS := ERR36; GO ABORT                                             09260000
     END;                                                               09265000
  IF MAXDATA' = -1 THEN MAXDATA' := S0+XTRAMAXDATA                      09270000
                   ELSE MAXDATA' := MAXDATA'+XTRAMAXDATA;               09275000
  IF MAXDATA' < 0 OR MAXDATA' > XREG THEN                               09280000
    BEGIN                                                      <<06102>>09285000
      << SET MAXDATA DOWN TO CONFIGURATION MAXIMUM      >>     <<06102>>09290000
      << REPORT WARNING IF SPECIFIED NAX > CONF MAX     >>     <<06102>>09295000
      IF ORIG'MAXDATA > 0 AND MAXDATA'-XTRAMAXDATA > XREG      <<06102>>09300000
         AND (LOADWARN = 0 OR LOADWARN = DLROUNDEDUP) THEN     <<06102>>09305000
         LOADWARN := CONFIGMAXDATA;                            <<06102>>09310000
      MAXDATA' := XREG;                                        <<06102>>09315000
    END;                                                       <<06102>>09320000
  TOS := MAXDATA';                                                      09325000
  ASSEMBLE(DDUP,LCMP);                                                  09330000
  IF > THEN  <<DATA SEG. > MAX. DATA SEG.?>>                            09335000
     BEGIN                                                              09340000
       LOADWARN:=MAXDATAUP;                                    <<06102>>09345000
       MAXDATA':=S1;                                           <<06102>>09350000
       S0:=MAXDATA';                                           <<06102>>09355000
     END;                                                               09360000
  DSTINDEX' := GETSTACK(*,*);  <<ALLOCATE DATA SEGMENT>>                09365000
  IF = THEN                                                             09370000
    BEGIN                                                               09375000
     EXCHANGEDB(DSTINDEX');  <<SET DB TO DATA SEGMENT>>                 09380000
     TOS := PCBXSIZE+DLSIZE';  <<POINTER TO DB+0>>                      09385000
     DBAREA := 0; ASSEMBLE(DZRO,INCB); TOS := S2;                       09390000
     ASSEMBLE(MOVE 3);  <<ZERO PCBX AND DL AREA>>                       09395000
     DBAREA := S1;  <<INSERT VDS IN PCBX(0)>>                           09400000
     FREADDIR(PROGFNUM,PS0,GLOBALSIZE',                                 09405000
                           DOUBLE(LOGICAL(GLOBALRECD)));                09410000
     IF <> THEN GO IOERROR;  <<ERROR?>>                                 09415000
     PS0(-1) := SAFLUT;  <<INSERT S.A. OF FLUT>>                        09420000
     PS0 (-3) := SATRAPCOM;  <<INSERT S.A. OF TRAPCOM'>>                09425000
     PS0(-6) := SASTLT;  <<INSERT S.A. OF STLT>>                        09430000
     PS0(-8) := PLABEL;  <<INSERT ENTRY POINT P-LABEL>>                 09435000
     DDEL;  <<DELETE VDS AND POINTER>>                                  09440000
    END                                                                 09445000
   ELSE  <<NO DST ENTRY OR NO VIRTUAL MEMORY>>                          09450000
    BEGIN                                                               09455000
     IF  >  THEN  TOS :=  ERR66  ELSE                                   09460000
     TOS := ERR73; GO ABORT                                             09465000
    END;                                                                09470000
                                                                        09475000
  <<* * * CLEAN-UP AND RETURN PARAMETERS * * *>>                        09480000
                                                                        09485000
  EXCHANGEDB(0);  <<RESET DB TO STACK>>                                 09490000
  IF STRINGLENGTH > 0 THEN                                     <<06102>>09495000
    BEGIN                                                      <<06102>>09500000
      << STRING SPECIFIED                                >>    <<06102>>09505000
      << MOVE STRING TO NEW STACK. STCOUNT HAS BEEN SET  >>    <<06102>>09510000
      << SO THAT NOT NECESSARY TO WORD ALIGN THE STRING  >>    <<06102>>09515000
      TOS:= DSTINDEX';                                         <<06102>>09520000
      TOS:= PCBXSIZE+DLSIZE'+GLOBALSIZE';                      <<06102>>09525000
      TOS:= WORDADDRESS(STRING);                               <<06102>>09530000
      TOS:= STCOUNT;                                           <<06102>>09535000
      ASSEMBLE(MTDS 4);                                        <<06102>>09540000
    END;                                                       <<06102>>09545000
  CAPABILITY := CAPABILITY';                                            09550000
  DSTINDEX := DSTINDEX';                                                09555000
  STACKSIZE := STACKSIZE';                                              09560000
  DLSIZE := DLSIZE';                                                    09565000
  MAXDATA := MAXDATA';                                                  09570000
  GLOBALSIZE := GLOBALSIZE';                                            09575000
  CSTINDEX := CSTINDEX';                                                09580000
  DELTAP := DELTAP';                                                    09585000
  MAPFLAG:=MAPFLAG';                                                    09590000
  TOS := 0;  <<NO ERROR>>                                               09595000
  GO GETOUT;                                                            09600000
                                                                        09605000
  <<* * * ERROR RECOVERY * * *>>                                        09610000
                                                                        09615000
IOERROR:                                                                09620000
  TOS := ERR63;                                                         09625000
                                                                        09630000
ABORT:                                                                  09635000
  EXCHANGEDB(SEGTABDST);  <<SET DB TO SEGMENT TABLE>>                   09640000
  IF LSEARCH(PROCESSKEY,PMODE,SHARER) THEN  <<CODE LOADED?>>            09645000
    BEGIN                                                               09650000
     LDELETE;  <<DELETE SHARER ENTRY>>                                  09655000
     LSEARCH(PROGKEY,PMODE,PROGFILE);                                   09660000
     EXCHANGEDB (0);                                           <<06102>>09665000
     << NEED TO SPECIFY ANOTHER MOUNT DURING THIS ERROR >>     <<06102>>09670000
     << CONDITION SO THAT FCLOSE CAN CLOSE PROG FILE    >>     <<06102>>09675000
     MOUNTVOLSET(PROGFNUM);                                    <<06102>>09680000
     EXCHANGEDB (SEGTABDST);                                   <<06102>>09685000
     ADJREFCOUNTS(-1)  <<DECREMENT REFERENCE COUNTS>>                   09690000
    END;                                                                09695000
  EXCHANGEDB(0);  <<RESET DB TO STACK>>                                 09700000
  IF PVINFO <> 0 THEN DISMOUNTVOLSET (PVINFO,PIN);             <<06102>>09705000
  IF DSTINDEX' <> 0 THEN RELDATASEG(DSTINDEX');                         09710000
                                                                        09715000
GETOUT:                                                                 09720000
  IF SAVESIR <> -1 THEN RELSIR(SEGTABSIR,SAVESIR);                      09725000
  IF PROGFNUM <> 0 THEN  <<CLOSE PROG. FILE?>>                          09730000
    BEGIN                                                               09735000
     TOS := ERRORGET(1);  <<SAVE ERROR NR.>>                            09740000
   FLUSH'CACHE(LDEV,STARTADDR,ENDADDR);                        <<07316>>09745000
     FCLOSE(PROGFNUM,0,0);                                              09750000
     ERRORPUT(*,1)  <<RESTORE ERROR NR.>>                               09755000
    END;                                                                09760000
  IF S0 <> 0 THEN CONDCODE := CCL                              <<06102>>09765000
  ELSE  IF LOADWARN <> 0 THEN                                  <<06102>>09770000
          BEGIN                                                <<06102>>09775000
            DEL;                                               <<06102>>09780000
            CONDCODE := CCG;                                   <<06102>>09785000
            TOS:= LOADWARN;                                    <<06102>>09790000
          END;                                                 <<06102>>09795000
  TOS := [10/0,6/13]; ASSEMBLE(XCH,ZERO);                               09800000
  ERROREXIT(*,*,*)                                                      09805000
END;                                                                    09810000
INTEGER PROCEDURE LOADPROGRAM (PROGFNUM,PROGKEY,PROCESSKEY,             09815000
                               COMMAND,PINNR,SAVESIR,PVINFO);           09820000
   <<LOADS THE GIVEN PROGRAM FILE.  THE STARTING CST NUMBER>>           09825000
   <<AND MODE BIT IS RETURNED AS THE RESULT.  NOTE DB MUST >>           09830000
   <<BE SET TO THE LST AND THE CALLER MUST HAVE THE LST SIR>>           09835000
   <<THIS PROCEDURE USES CONDITION CODE TO INDICATE AN ERROR>>          09840000
   <<THE ERROR NUMBER IS RETURNED AS THE RESULT             >>          09845000
   VALUE PROGFNUM,PROGKEY,PROCESSKEY,COMMAND,PINNR,SAVESIR,PVINFO;      09850000
   INTEGER PROGFNUM,COMMAND,PINNR,SAVESIR,PVINFO;                       09855000
   DOUBLE PROGKEY,PROCESSKEY;                                           09860000
   OPTION INTERNAL,UNCALLABLE;                                          09865000
  BEGIN                                                                 09870000
   DEFINE ALLOCATE = LOGICAL(COMMAND.(0:1))#,  <<ALLOCATE?>>            09875000
          LIBRARY = COMMAND.(2:2)#,  << LIBRARY SEARCH >>               09880000
          PMODE = COMMAND.(4:1)#,  <<NORMAL/NOPRIV MODE>>               09885000
          LMAP = LOGICAL(COMMAND.(6:1))#;  <<LMAP WANTED?>>             09890000
   INTEGER LIBSEARCH;                                                   09895000
                                                                        09900000
   SUBROUTINE LOCK;                                                     09905000
      BEGIN                                                             09910000
      IF NOT ALLOCATE THEN  <<NORMAL LOAD?>>                            09915000
         BEGIN                                                          09920000
         TOS := ERRORGET(1);  <<SAVE ERROR NR.>>                        09925000
         FLOCK(PROGFNUM,TRUE);                                          09930000
         ERRORPUT(*,1)  <<RESTORE ERROR NR.>>                           09935000
         END;                                                           09940000
      GETSIR(SEGTABSIR);                                                09945000
      EXCHANGEDB(SEGTABDST);                                            09950000
      END;                                                              09955000
                                                                        09960000
   SUBROUTINE UNLOCK(DO'PDISABLE);                                      09965000
                    VALUE DO'PDISABLE; LOGICAL DO'PDISABLE;             09970000
      BEGIN                                                             09975000
      EXCHANGEDB(0);                                                    09980000
      IF NOT ALLOCATE THEN FUNLOCK(PROGFNUM);                           09985000
      IF DO'PDISABLE THEN PDISABLE;                                     09990000
      RELSIR(SEGTABSIR,SAVESIR);                                        09995000
      END;                                                              10000000
                                                                        10005000
   <<* * * CREATE PROCESS ENTRY * * *>>                                 10010000
                                                                        10015000
   IF NOT ALLOCATE THEN  <<ALLOCATE PROGRAM?>>                          10020000
      BEGIN                                                             10025000
        LCREATE(4,SHARER,PMODE,LIBRARY,PROCESSKEY);                     10030000
        IF < THEN  <<ERROR?>>                                           10035000
           BEGIN                                                        10040000
           NOROOM:                                                      10045000
           TOS := ERR70; GO ABORT                                       10050000
           END;                                                         10055000
        ENTDP1:=PROGKEY;  <<INSERT PROGRAM FILE ID >>                   10060000
      END;                                                              10065000
                                                                        10070000
   <<* * * CHECK FOR LOADED PROGRAM FILE * * *>>                        10075000
TRYAGAIN:                                                               10080000
                                                                        10085000
   TOS := 0;  <<FOR RESULT OF LSEARCH>>                                 10090000
   TOS := PROGKEY;                                                      10095000
   TOS := PMODE; ASSEMBLE(TCBC 15);  <<OPPOSITE MODE>>                  10100000
   IF LSEARCH(*,*,PROGFILE) THEN  <<LOADED IN OTHER MODE?>>             10105000
      BEGIN                                                             10110000
      TOS := ERR26; GO ABORT                                            10115000
      END;                                                              10120000
   IF LSEARCH(PROGKEY,PMODE,PROGFILE) THEN<<ALREADY LOADED?>>           10125000
      BEGIN                                                             10130000
        IF  ALLOCATE  THEN  GO INCREMENT;                               10135000
        TOS := @PROGREC0(28)&LSL(1);  <<CST RE-MAPPING ARRAY>>          10140000
        TOS := @PROGREC0+(PNRSEGS+57)&LSR(1);<<SEG DESC ARRAY>>         10145000
                                          <<CST AND MODE>>              10150000
        TOS:=BPS1(PSTARTINGSEG) CAT PS0(XREG) (0:0:1);                  10155000
        TOS.(1:1):=ENTP.(12:1); <<GET MAPFLAG FROM ENTRY>>              10160000
        GO INCREMENT                                                    10165000
      END;                                                              10170000
                                                                        10175000
   <<* * * CHECK FOR PROGRAM FILE BEING LOADED * * *>>                  10180000
                                                                        10185000
   TOS := 0;  <<FOR RESULT OF LSEARCH>>                                 10190000
   TOS := PROGKEY;                                                      10195000
   TOS := PMODE; ASSEMBLE(TCBC 15);  <<OPPOSITE MODE>>                  10200000
   IF LSEARCH(*,*,LOADING) THEN  <<LOADING IN OTHER MODE?>>             10205000
      BEGIN                                                             10210000
      TOS := ERR26; GO ABORT                                            10215000
      END;                                                              10220000
   IF LSEARCH(PROGKEY,PMODE,LOADING) THEN  <<BEING LOADED?>>            10225000
      BEGIN                                                             10230000
        <<BUILD WAITING ENTRY>>                                         10235000
        LCREATE(5,WAITING,PMODE,LIBRARY,PROGKEY);                       10240000
        IF < THEN GO NOROOM;  <<ERROR?>>                                10245000
        EWAITINGPIN := USERPIN;  <<PIN OF WAITING PROCESS>>             10250000
        UNLOCK(1);                       <<IMPLIED PDISABLE>>           10255000
        IMPEDE(0);                       <<IMPLIED PENABLE>>            10260000
                                                                        10265000
        <<SLEEP>>                                                       10270000
                                                                        10275000
        LOCK;                                                           10280000
        LSEARCH(PROGKEY,PMODE,LOADED);  <<FIND WAITING ENTRY>>          10285000
        TOS:=ENTDP2; <<PARAMETER AND ERROR NO.>>                        10290000
        LDELETE;                                                        10295000
        ASSEMBLE(TEST);                                                 10300000
        IF <> THEN  <<ERROR?>>                                          10305000
           BEGIN                                                        10310000
           ASSEMBLE(STBX);                                              10315000
           IF <> THEN ERRORPUT(XREG,1);<<FILE SYS ERROR #>>             10320000
           GO ABORT                                                     10325000
           END;                                                         10330000
        DEL;                                                            10335000
        IF LSEARCH(PROGKEY,PMODE,PROGFILE) <<GET PROG. ENTRY>>          10340000
          THEN GO INCREMENT  <<FOUND ENTRY>>                            10345000
          ELSE GO TRYAGAIN;  <<PROGRAM ALREADY TERMINATED>>             10350000
      END;                                                              10355000
                                                                        10360000
   <<* * * ACTIVATE LOAD PROCESS * * *>>                                10365000
                                                                        10370000
   <<BUILD LOADING ENTRY>>   <<BUILD LOADING ENTRY>>                    10375000
   LCREATE(3,LOADING,PMODE,LIBRARY,PROGKEY);                            10380000
   IF < THEN GO NOROOM;  <<ERROR?>>                                     10385000
   UNLOCK(0);                                                           10390000
   TOS := 0D;  <<FOR RESULT OF LOADER>>                                 10395000
   TOS := COMMAND;                                                      10400000
   IF LOGICALMAPPING                                                    10405000
     THEN TOS.(5:1):=0 <<MAPPING FIRMWARE PRESENT-->>                   10410000
                       <<ALL PROGRAM LOADS MAPPED  >>                   10415000
     ELSE TOS.(5:1):=1;<<MAPPING FIRMWARE NOT PRESENT-->>               10420000
                       <<ALL PROGRAM LOADS PHYSICAL MAP>>               10425000
   TOS:=PINNR;                                                          10430000
   TOS := PROGKEY;                                                      10435000
   TOS := 0;  <<DON'T CARE>>                                            10440000
   TOS := PVINFO;                                                       10445000
   TOS := LOADER (*,*,*,*,*,*);                                         10450000
   LOCK;                                                                10455000
   ASSEMBLE(TEST);                                                      10460000
   IF <> THEN  GO ABORT;                                       <<06102>>10465000
   DEL;                                                                 10470000
   GO AOK;                                                              10475000
                                                                        10480000
   <<* * * INCREMENT THE REFERENCE COUNTS * * *>>                       10485000
                                                                        10490000
INCREMENT:                                                              10495000
   ADJREFCOUNTS(1);  <<INCREMENT REF. COUNTS>>                          10500000
   IF LMAP THEN  <<LMAP REQUESTED?>>                                    10505000
      BEGIN                                                             10510000
        EXCHANGEDB(0);  <<RESET DB TO STACK>>                           10515000
        GENMSG(9,WARN88);   << LMAP NOT AVAILABLE >>                    10520000
        EXCHANGEDB(SEGTABDST);  <<SET DB TO SEGMENT TABLE>>             10525000
        IF < THEN  <<PRINT ERROR?>>                                     10530000
           BEGIN                                                        10535000
           PRINTERROR:                                                  10540000
           TOS := ERR75; GO ABORT                                       10545000
           END                                                          10550000
      END;                                                              10555000
   IF  ELIB <> LIBRARY  THEN  << DIFFERENT LIBSEARCH >>                 10560000
      BEGIN                                                             10565000
        LIBSEARCH := ELIB;  << OFFSET TO FIND G, P OR S >>              10570000
        EXCHANGEDB(0);      << DB TO STACK >>                           10575000
        GENMSG(9,WARN89+LIBSEARCH);  << PROGRAM LOADED WITH >>          10580000
                                 << LIB = (S, P OR G)   >>              10585000
        TOS := 0;  <<RETURN FOR EXCHANGEDB>>                            10590000
        TOS := SEGTABDST;                                               10595000
        EXCHANGEDB (*); <<SET DB TO SEGMENT TABLE>>                     10600000
        IF  <  THEN  GO PRINTERROR;                                     10605000
      END;                                                              10610000
                                                                        10615000
AOK:                                                                    10620000
   TOS := CCE;  <<OK CONDITION CODE>>                                   10625000
   GO GETOUT;                                                           10630000
                                                                        10635000
ABORT:                                                                  10640000
   IF LSEARCH(PROCESSKEY,PMODE,SHARER) THEN LDELETE;                    10645000
   TOS := CCL;  <<ERROR CONDITION CODE>>                                10650000
                                                                        10655000
GETOUT:                                                                 10660000
   CONDCODE := TOS;  <<STORE CONDITION CODE>>                           10665000
   LOADPROGRAM := TOS  <<PARAMETER>>                                    10670000
  END;                                                                  10675000
DOUBLE PROCEDURE LOADER (COMMAND,PINNR,NUM1,NUM2,STRING,PVINFO);        10680000
   <<LOAD PROCESS COMMUNICATION PROCEDURE.               >>             10685000
   <<RETURNS A DOUBLE                                    >>             10690000
   <<RESULT:  THE 1ST WORD (S-1) IS A PARM (0 IF ERROR)  >>             10695000
   <<THE 2ND WORD (S-0) IS AN ERROR NUMBER (0 IF NO ERROR)>>            10700000
   VALUE COMMAND,PINNR,NUM1,NUM2,PVINFO;                                10705000
   INTEGER COMMAND,PINNR,NUM1,NUM2,PVINFO;                              10710000
   BYTE ARRAY STRING;                                                   10715000
   OPTION INTERNAL,UNCALLABLE;                                          10720000
   BEGIN                                                                10725000
   INTEGER  I, SIRF, SIRF2, TF, TLF, LF;                       <<*8526>>10730000
   INTEGER ARRAY PARMS (*) = COMMAND;                                   10735000
   EQUATE MAILLENGTH = 22;  <<MAIL BUFFER LENGTH>>                      10740000
   INTEGER ARRAY MAILBUF(0:81)=Q; <<MAIL BUFFER>>                       10745000
   INTEGER ARRAY LIST(*)=MAILBUF+10;                                    10750000
   BYTE ARRAY LISTB(*) = LIST;                                          10755000
                                                                        10760000
   SUBROUTINE  FERROR(F,D);                                             10765000
      VALUE F,D; INTEGER F; LOGICAL D;                                  10770000
      BEGIN  << CALLED ON A FILE ERROR >>                               10775000
        MOVE  LIST := "FILE ERROR #     ON ";                           10780000
        IF F=0 OR F=LF THEN MOVE LIST(10) := "LOADLIST" ELSE            10785000
        IF  F=TLF  THEN  MOVE  LIST(10) := "LOADTEMP" ELSE              10790000
        MOVE  LIST(10) := "LOADPROC";                                   10795000
        FCHECK(F,I);                                                    10800000
        ASCII(I,10,LISTB(12));                                          10805000
        PRINT(LIST,-28,0);                                              10810000
        IF D THEN                                                       10815000
        BEGIN << CLOSE LOADER PROCESS FILE AND RELSIR >>                10820000
           FCLOSE(TF,0,0);                                              10825000
           RELSIR(LOADSIR,SIRF);                                        10830000
        END ELSE FCLOSE(LF,0,0); << CLOSE LIST FILE >>                  10835000
        GO DONE;                                                        10840000
      END;                                                              10845000
                                                                        10850000
                                                                        10855000
                                                                        10860000
   TF := TLF := LF := -1; << NULL FILE NUMS >>                          10865000
   SIRF := GETSIR(LOADSIR);                                             10870000
                                                                        10875000
   <<* * * INITIALIZE MAIL DATA SEGMENT * * *>>                         10880000
                                                                        10885000
   IF LOGICAL(COMMAND.(1:1)) THEN                                       10890000
      BEGIN                                                             10895000
         MOVE MAILBUF := PARMS,(3);                                     10900000
         FORMATNAME(MAILBUF(3),STRING);                                 10905000
      END                                                               10910000
   ELSE                                                                 10915000
      MOVE MAILBUF := PARMS,(4);                                        10920000
   WHO( ,MAILBUF(11),,,MAILBUF(13),MAILBUF(17) );                       10925000
  MAILBUF(11) := CURPRC;                                       <<06648>>10930000
   MAILBUF (21) := PVINFO;                                              10935000
                                                               <<*8526>>10940000
   SIRF2 := GETSIR(SEGTABSIR);                                 <<*8526>>10945000
   <<GET OFFSET TO LCT IN LST>>                                         10950000
   TOS:=@I;               <<RECEIVE LCT OFFSET>>                        10955000
   TOS:=SEGTABDST;        <<LST>>                                       10960000
   TOS:=LCTPTR;              <<OFFSET TO LCT PTR>>                      10965000
   TOS:=1;                <<1 WORD>>                                    10970000
   ASSEMBLE(MFDS 4);                                                    10975000
   <<MOVE MAILBUF TO LCT IN LST>>                                       10980000
   TOS:=SEGTABDST;        <<LST>>                                       10985000
   TOS:=I;                <<OFFSET TO LCT>>                             10990000
   TOS:=@MAILBUF;         <<ADDR OF MAILBUF>>                           10995000
   TOS:=MAILLENGTH;       <<SIZE OF TRANSFER>>                          11000000
   ASSEMBLE(MTDS 4);                                                    11005000
   RELSIR(SEGTABSIR,SIRF2);                                    <<*8526>>11010000
                                                               <<*8526>>11015000
                                                                        11020000
TOS:=LOAD'MESSAGE;                                             <<*7558>>11025000
AWAKE(SYSPROC(8),%20,0);                                       <<*7558>>11030000
SENDMSG(SYSPROC(8)/PCBSIZE,4,1,%40000);                        <<*7912>>11035000
ASSEMBLE(ADDS 1);                                              <<*7558>>11040000
RECEIVEMSG(4,1,%40000);                                        <<*7912>>11045000
IF TOS<>LOAD'DONE'MESSAGE THEN                                 <<*7558>>11050000
   SUDDENDEATH(347);                                           <<*7558>>11055000
                                                                        11060000
                                                                        11065000
   <<* * * EXTRACT ANSWER OF LOAD PROCESS * * *>>                       11070000
                                                               <<*8526>>11075000
   SIRF2 := GETSIR(SEGTABSIR);                                 <<*8526>>11080000
   TOS:=@MAILBUF;         <<RECEIVE ANSWER>>                            11085000
   TOS:=SEGTABDST;        <<LST>>                                       11090000
   TOS:=I;                <<OFFSET TO LCT>>                             11095000
   TOS:=6;                <<SIZE OF ANSWER>>                            11100000
   ASSEMBLE(MFDS 4);                                                    11105000
   RELSIR(SEGTABSIR,SIRF2);                                    <<*8526>>11110000
                                                               <<*8526>>11115000
                                                                        11120000
   TOS:=MAILBUF(0);                                                     11125000
   TOS:=MAILBUF(1);                                                     11130000
   IF <> THEN  <<ERROR?>>                                               11135000
      BEGIN                                                             11140000
      ASSEMBLE(STBX);  <<PARAMETER>>                                    11145000
      IF <> THEN ERRORPUT(XREG,1);  <<FILE SYS. ERROR?>>                11150000
      ASSEMBLE(ZERO,XCH)  <<ZERO PARAMETER>>                            11155000
      END;                                                              11160000
   LOADER := TOS;  <<RETURN RESULT>>                                    11165000
   IF LOGICAL(MAILBUF(2)) THEN                                          11170000
     BEGIN  << COPY THE FILE FROM THE LOAD PROCESS >>                   11175000
       TOS := 0;                                                        11180000
       TOS:=MAILBUF(3);       <<LDEV>>                                  11185000
       TOS:=MAILBUF(4);       <<DISK>>                                  11190000
       TOS:=MAILBUF(5);       <<ADDR>>                                  11195000
       TF := FOPENDA(*,*);                                              11200000
       IF  <>  THEN  FERROR(TF,TRUE);                                   11205000
       MOVE LIST := "LOADTEMP ";                                        11210000
       TLF := FOPEN(LIST,%2104,4,36); << OPEN TEMP FILE>>               11215000
       IF <> THEN FERROR(TLF,TRUE);                                     11220000
       I := FREAD(TF,LIST,-72);                                         11225000
       IF < THEN FERROR(TF,TRUE);                                       11230000
       WHILE = DO                                                       11235000
        BEGIN << COPY LOADLIST FILE TO TEMP. HOLDING FILE >>            11240000
           FWRITE(TLF,LIST,-I,0);                                       11245000
           IF <> THEN FERROR(TLF,TRUE);                                 11250000
           I := FREAD(TF,LIST,-72);                                     11255000
           IF < THEN FERROR(TF,TRUE);                                   11260000
        END;                                                            11265000
       FCLOSEDA (TF,0,0); <<CLOSE LOADER PRODUCED FILE>>                11270000
       RELSIR(LOADSIR,SIRF);                                            11275000
       FCONTROL(TLF,5,0); << REWIND TEMP FILE >>                        11280000
       IF <> THEN FERROR(TLF,FALSE);                                    11285000
       MOVE  LIST := "LOADLIST  ";                                      11290000
       LF := FOPEN(LIST,%14,%301);                                      11295000
       IF  <>  THEN  FERROR(LF,FALSE);                                  11300000
       I := FREAD(TLF,LIST,-72);                                        11305000
       IF < THEN FERROR(TLF,FALSE);                                     11310000
       WHILE = DO                                                       11315000
        BEGIN  << COPY A LINE >>                                        11320000
           FWRITE(LF,LIST,-I,0);                                        11325000
           IF <> THEN FERROR(LF,FALSE);                                 11330000
           I := FREAD(TLF,LIST,-72);                                    11335000
           IF  <  THEN  FERROR(TLF,FALSE);                              11340000
        END;                                                            11345000
       FCLOSE(LF,0,0);                                                  11350000
 DONE:                                                                  11355000
       FCLOSE(TLF,0,0);                                                 11360000
     END ELSE RELSIR(LOADSIR,SIRF);                                     11365000
   END;                                                                 11370000
PROCEDURE ADJREFCOUNTS (AMOUNT);                                        11375000
   <<ADJUSTS THE REF COUNTS FOR THE CST ENTRIES IN THE >>               11380000
   <<CURRENT ENTRY BY AMOUNT.  WILL UNLOAD ANY SEGMENT >>               11385000
   <<WHOSE REF COUNT GOES TO ZERO.  WILL DELETE THE ENTRY>>             11390000
   <<IF ITS A PROGRAM FILE ENTRY AND THE SHARE COUNT HAS >>             11395000
   <<GONE TO ZERO                                        >>             11400000
   VALUE AMOUNT;                                                        11405000
   INTEGER AMOUNT;                                                      11410000
   OPTION UNCALLABLE;                                                   11415000
   BEGIN                                                                11420000
   INTEGER AMOUNT' = SI;  <<REFERENCE COUNT INCREMENT>>                 11425000
   LOGICAL DELETEFLAG := FALSE;  << DELETE PROGRAM ENTRY? >>            11430000
   INTEGER PVINFO:=0;                                                   11435000
   INTEGER POINTER SLSEGS = SO;  <<SL CST BIT MAP>>                     11440000
                                                                        11445000
   SUBROUTINE DISMOUNTVS;                                      <<06102>>11450000
       BEGIN                                                   <<06102>>11455000
           TOS := EXCHANGEDB (0); <<TO STACK>>                 <<06102>>11460000
           DISMOUNTVOLSET (PVINFO);                            <<06102>>11465000
           ASMB (ZERO, XCH);                                   <<06102>>11470000
           EXCHANGEDB (*);                                     <<06102>>11475000
           PVINFO := 0;                                        <<06102>>11480000
       END;                                                    <<06102>>11485000
                                                                        11490000
   SUBROUTINE UNLOADFILE;                                               11495000
      <<CLEARS THE "LOADED" BIT IN THE FILE LABEL OF THE >>             11500000
      <<CURRENT ENTRY, DISMOUNTS THE FILE'S HOME VOLUME SET>>           11505000
      <<IF NECESSARY, AND DELETES THE CURRENT ENTRY.     >>             11510000
      BEGIN                                                             11515000
        LOADBIT(EFID,FALSE,SEGTABDST); <<CLEAR LOADED BIT>>             11520000
        LDELETE  <<DELETE ENTRY>>                                       11525000
      END;                                                              11530000
                                                                        11535000
   IF  ETYPE = PROGFILE  THEN                                           11540000
      BEGIN                                                             11545000
        TOS:=ESHR;               <<OLD SHARE COUNT>>                    11550000
        ASSEMBLE(DUP);                                                  11555000
        ESHR:=TOS+AMOUNT;        <<UPDATE SHARE COUNT>>                 11560000
        TOS:=ESHR;    <<UPDATE COUNT IN CST BLOCK>>                     11565000
        DISABLE;                                                        11570000
        XREG := CSTEXT(ECSTBLK)+ABSOLUTE(DSTB)+2;                       11575000
        ABSOLUTE(XREG):=TOS;                                            11580000
        ENABLE;                                                         11585000
        <<IF PROGFILE ALLOCATED OR        >>                            11590000
        <<OLD COUNT*NEW COUNT <> 0        >>                            11595000
      IF  EPA = 1  OR  TOS*ESHR <> 0  THEN                     <<06102>>11600000
      BEGIN                                                    <<06102>>11605000
         IF AMOUNT < 0 <<UNLOAD>>  AND                         <<06102>>11610000
          (PVINFO := EPVINFO'PROG) <> 0 THEN DISMOUNTVS;       <<06102>>11615000
          RETURN;                                              <<06102>>11620000
      END;                                                     <<06102>>11625000
        IF  ESHR = 0  THEN  DELETEFLAG := TRUE;                         11630000
      END;                                                              11635000
                                                                        11640000
   AMOUNT' := AMOUNT;                                                   11645000
   TOS:=@ENTP;         <<SAVE POINTERS>>                                11650000
   TOS:=@ENTP1;                                                         11655000
   TOS:=@ENTP2;                                                         11660000
   TOS:=@ENTP3;                                                         11665000
   @PSS:=@ENTP2+1; <<1ST SLID>>                                         11670000
   IF ETYPE = PROGFILE                                                  11675000
     THEN SK:=ESLINFO'PROG                                              11680000
     ELSE IF ETYPE = EXTENSION                                          11685000
            THEN SK:=ESLINFO'EXT                                        11690000
            ELSE SK:=0;                                                 11695000
   <<CYCLE THRU EACH SL INFO AREA>>                                     11700000
   WHILE (SK:=SK-1) >= 0 DO                                             11705000
     BEGIN                                                              11710000
       @PST:=@PSS+SK*19; <<PTR TO SLID>>                                11715000
       IF LSEARCH(DPST,NORMAL,SLFILE) THEN                              11720000
         BEGIN              <<FOUND SL ENTRY>>                          11725000
           @PST:=@PST+2;    <<PTR TO SEG ARRAY>>                        11730000
           LSTEP(ADJSEG);   <<ADJUST REFCOUNT OF>>                      11735000
                            <<ALL REFERENCED SEGS>>                     11740000
           IF EALLOCSEG'SL = 0 THEN                                     11745000
             BEGIN          <<SL HAS NO ALLOCATED SEGS>>                11750000
               PVINFO:=EPVINFO'SL;                                      11755000
               UNLOADFILE;  <<UNLOAD SL>>                               11760000
               IF PVINFO <> 0 THEN                             <<06102>>11765000
                  DISMOUNTVS;                                  <<06102>>11770000
             END;                                                       11775000
         END;                                                           11780000
     END; <<WHILE>>                                                     11785000
                                                                        11790000
   @ENTP3:=TOS;                                                         11795000
   @ENTP2:=TOS;             <<RESTORE PTRS TO ORIG ENTRY>>              11800000
   @ENTP1:=TOS;                                                         11805000
   @ENTP:=TOS;                                                          11810000
                                                                        11815000
   IF  ETYPE = PROGFILE AND AMOUNT < 0 <<UNLOAD>> THEN         <<06102>>11820000
    PVINFO := EPVINFO'PROG;                                    <<06102>>11825000
   IF DELETEFLAG THEN    << UNLOAD PROGRAM FILE? >>                     11830000
      BEGIN                                                             11835000
      DEALCSTBLOCK(ECSTBLK); <<RELPROG CSTX BLK>>                       11840000
      << RELEASE SEGMAP DST >>                                          11845000
      IF EMAPDST <> 0 THEN RELDATASEG(EMAPDST);                         11850000
      UNLOADFILE;                                                       11855000
      END;                                                              11860000
   IF PVINFO <> 0 THEN DISMOUNTVS;                             <<06102>>11865000
                                                                        11870000
END; << ADJREFCOUNTS >>                                                 11875000
PROCEDURE ADJSEG(LOGSEGNR);                                             11880000
  <<SUPPORT PROCEDURE FOR ADJREFCOUNTS PROCEDURE>>                      11885000
  <<ENTP POINTS TO AN SL ENTRY   >>                                     11890000
  <<SL SEG LIST ENTRIES ARE SEARCHED>>                                  11895000
  <<UNTIL CORRECT ENTRY IS FOUND    >>                                  11900000
  <<  -REFCOUNT IS ADJUSTED         >>                                  11905000
  <<  -IF 0 THEN RELEASE CODE SEG   >>                                  11910000
  <<        AND FREE SEG LIST ENTRY >>                                  11915000
  VALUE LOGSEGNR;                                                       11920000
  INTEGER LOGSEGNR;                                                     11925000
  OPTION INTERNAL,UNCALLABLE;                                           11930000
  BEGIN                                                                 11935000
    INTEGER AMOUNT = SI;  <<REFERENCE COUNT INCREMENT>>                 11940000
    INTEGER TEMP1;                                                      11945000
    INTEGER POINTER PTEMP2,PTEMP3;                                      11950000
    @PTEMP3:=@ENTP+5;     <<PTR TO LOG SEG ARRAY>>                      11955000
    TEMP1:=ESLSEG'SL;     <<# SL SEG LIST ENTRIES>>                     11960000
    @PTEMP2:=@ENTP+21+TEMP1*3; <<PTR TO SEG LIST ENTRY>>                11965000
    <<CYCLE THRU SEGLIST ENTRIES UNTIL CORRECT>>                        11970000
    <<ENTRY IS FOUND                          >>                        11975000
    WHILE (TEMP1:=TEMP1-1) >= 0 DO                                      11980000
      BEGIN                                                             11985000
        @PTEMP2:=@PTEMP2-3;     <<NEXT ENTRY>>                          11990000
        IF SLLOGSEGNR=LOGSEGNR THEN                                     11995000
          BEGIN                 <<FOUND IT>>                            12000000
            REFCOUNT:=REFCOUNT+AMOUNT; <<ADJUST>>                       12005000
            IF REFCOUNT = 0 THEN                                        12010000
              BEGIN             <<NO USAGE>>                            12015000
                RELCODESEG(PHYCST);<<RELEASE CST>>                      12020000
                EALLOCSEG'SL:=EALLOCSEG'SL-1;                           12025000
                             <<# ALLOCATED SEG IN SL>>                  12030000
                TOS:=@PTEMP3;   <<PTR TO SEG ARRAY>>                    12035000
                CLEARBIT(*,LOGSEGNR);                                   12040000
                             <<CLEAR ALLOCATED BIT>>                    12045000
                PHYCST:=0;   <<CLEAR SEGLIST ENTRY>>                    12050000
                SLLOGSEGNR:=255;<<MARK IT FREE    >>                    12055000
              END;                                                      12060000
            RETURN;                                                     12065000
          END;                                                          12070000
      END; <<WHILE>>                                                    12075000
    SUDDENDEATH(346);  <<ENTRY NEVER FOUND>>                            12080000
   END;                                                                 12085000
PROCEDURE LOADBIT (KEY,BIT,DSTNR);                                      12090000
   <<SETS OR CLEARS (DEPENDING ON THE VALUE OF BIT) THE >>              12095000
   <<"LOADED" BIT IN THE FILE LABEL OF FILE "KEY".  DB MAY>>            12100000
   <<BE SET TO STACK OR LST.  NOTE THIS PROCEDURE USES    >>            12105000
   <<THE CONDITION CODE TO INDICATE AN ERROR>>                          12110000
   VALUE KEY,BIT,DSTNR;                                                 12115000
   DOUBLE KEY;                                                          12120000
   LOGICAL BIT;                                                         12125000
   INTEGER DSTNR;                                                       12130000
   OPTION UNCALLABLE;                                                   12135000
   BEGIN                                                                12140000
   INTEGER                                                              12145000
       SAVESIR;    << SIR VALUE >>                                      12150000
   INTEGER POINTER                                                      12155000
       FLABEL;     << FILE LABEL BUFFER >>                              12160000
   SUBROUTINE READWRITE (CODE);                                         12165000
      <<READS OR WRITES (DEPENDING ON THE VALUE OF CODE) >>             12170000
      <<THE FILE LABEL>>                                                12175000
      VALUE CODE;                                                       12180000
      INTEGER CODE;                                                     12185000
      BEGIN                                                             12190000
          TOS := 0D; << FOR FLABIO RETURN AND LDEV # >>                 12195000
          TOS := KEY&TASL(8)&DLSR(8);<<LDEV,DISC ADDR>>                 12200000
          TOS := S5; << READ/WRITE CODE >>                              12205000
          TOS := @FLABEL;                                               12210000
          TOS := FLABIO(*,*,*,*);                                       12215000
          IF TOS <> 0 THEN GO NFG;                                      12220000
      END;                                                              12225000
                                                                        12230000
   <<* * * INITIALIZE LOCAL VARIABLES * * *>>                           12235000
                                                                        12240000
   SAVESIR := GETSIR(FILESYSSIR);                                       12245000
   IF DSTNR <> 0 THEN DSTNR := EXCHANGEDB(0);                           12250000
   PUSH(S); << SET FLABEL >>                                            12255000
   @FLABEL := TOS + 1;                                                  12260000
   ASSEMBLE(ADDS 128); << ALLOCATE BUFFER >>                            12265000
                                                                        12270000
   READWRITE(ATTIOREAD);  <<READ FILE LABEL>>                           12275000
   FLOADBIT := BIT;  <<CLEAR/SET "LOADED" BIT>>                         12280000
   READWRITE(ATTIOWRITE);  <<WRITE FILE LABEL>>                         12285000
   TOS := CCE;  <<OK CONDITION CODE>>                                   12290000
   GO GETOUT;                                                           12295000
                                                                        12300000
   NFG:                                                                 12305000
   TOS := CCL;  <<ERROR CONDITION CODE>>                                12310000
                                                                        12315000
   GETOUT:                                                              12320000
   IF DSTNR <> 0 THEN EXCHANGEDB(DSTNR);                                12325000
   RELSIR(FILESYSSIR,SAVESIR);  <<RELEASE FILE SYSTEM SIR>>             12330000
   CONDCODE := TOS  <<STORE CONDITION CODE>>                            12335000
   END;                                                                 12340000
PROCEDURE UNLOAD (PIN);                                                 12345000
   <<UNLOADS THE SEGMENTS OF THE SPECIFIED PROCESS >>                   12350000
   <<CONDITION CODE CONVENTIONS:                   >>                   12355000
   <<                                              >>                   12360000
   <<    CCE   REQUEST GRANTED                     >>                   12365000
   <<    CCL   REQUEST DENIED - INVALID PIN        >>                   12370000
   <<                                              >>                   12375000
   <<NOTE THAT IT IS ASSUMED THAT DB IS SET TO THE >>                   12380000
   <<STACK OF THE PROCESS BEING UNLOADED           >>                   12385000
   VALUE PIN;                                                           12390000
   INTEGER PIN;                                                         12395000
   OPTION PRIVILEGED,UNCALLABLE;                                        12400000
   BEGIN                                                                12405000
     INTEGER PCBPT;  << INDEX OF PCB ENTRY >>                           12410000
     INTEGER NRPROGSEGS=SP, <<#PROG FILE SEGS FOR LOGGING>>             12415000
             NRSLSEGS=SQ;   <<#NON-MPE SL SEGS FOR LOGGING>>            12420000
     DOUBLE NRSEGS=NRPROGSEGS;                                          12425000
     INTEGER POINTER PCBXFIXEDP,                                        12430000
                     AUXENTP,                                           12435000
                     AUXENTP1,                                          12440000
                     AUXENTP2,                                          12445000
                     AUXENTP3;                                          12450000
     INTEGER PCB'LOADERFLAGS,                                           12455000
             PCB'MAPDST,                                                12460000
             SAVESIR,                                                   12465000
             SAVEDB,                                                    12470000
             MODE,                                                      12475000
             ACTIVE'LPROCS',                                            12480000
             IDX;                                                       12485000
      DOUBLE CPUTIME;                                          <<07318>>12490000
     INTEGER ARRAY CPUTIMEARRAY(*)=CPUTIME;                    <<07318>>12495000
     LOGICAL LOGGING;                                                   12500000
     DOUBLE KEY,                                                        12505000
            NRSEGS';                                                    12510000
     INTEGER NRPROGSEGS'=NRSEGS',                                       12515000
             NRSLSEGS'=NRSEGS'+1;                                       12520000
     DEFINE PCB'LOCALSEGMAP = PCB'LOADERFLAGS.(14:1)#,                  12525000
            PCB'LOADPROCFLAG = PCB'LOADERFLAGS.(15:1)#,                 12530000
            LOG'PROCTERM = ABSOLUTE(LOGFLAG).(11:1)#,                   12535000
            LOG'ENABLED = ABSOLUTE(LOGFLAG).(15:1)#;                    12540000
                                                                        12545000
SUBROUTINE SUMSLSEGS;                                                   12550000
  <<COMPUTE THE NUMBER OF NON-MPE SL >>                                 12555000
  <<SEGMENTS REFERENCED.             >>                                 12560000
  <<FOR EACH SL INFO AREA            >>                                 12565000
  <<  -FIND SL ENTRY                 >>                                 12570000
  <<  -CALL LSTEP                    >>                                 12575000
  BEGIN                                                                 12580000
    TOS:=@ENTP;                                                         12585000
    TOS:=@ENTP1;                                                        12590000
    TOS:=@ENTP2;                                                        12595000
    TOS:=@ENTP3;                                                        12600000
    @PSS:=@ENTP2+1; <<1ST SLID>>                                        12605000
    IF ETYPE = PROGFILE                                                 12610000
      THEN SK:=ESLINFO'PROG                                             12615000
      ELSE IF ETYPE = EXTENSION                                         12620000
             THEN SK:=ESLINFO'EXT                                       12625000
             ELSE SK:=0;                                                12630000
    <<CYCLE THRU EACH SL INFO AREA>>                                    12635000
    WHILE (SK:=SK-1) >= 0 DO                                            12640000
      BEGIN                                                             12645000
        @PST:=@PSS+SK*19;    <<PTR TO SLID>>                            12650000
        IF LSEARCH(DPST,NORMAL,SLFILE) THEN                             12655000
          BEGIN                 <<SL ENTRY FOUND>>                      12660000
            @PST:=@PST+2;       <<PTR TO SEG ARRAY>>                    12665000
            LSTEP(SUMSEGS);     <<COUNT NON-MPE SEG>>                   12670000
          END ELSE                                                      12675000
          BEGIN                 <<SL ENTRY NOT FOUND>>                  12680000
            SUDDENDEATH(345);                                           12685000
          END;                                                          12690000
      END; <<WHILE>>                                                    12695000
    @ENTP3:=TOS;                                                        12700000
    @ENTP2:=TOS;                <<RESTORE PTRS TO >>                    12705000
    @ENTP1:=TOS;                <<ORIGINAL ENTRY  >>                    12710000
    @ENTP:=TOS;                                                         12715000
  END; <<SUMSLSEGS>>                                                    12720000
                                                                        12725000
     <<INITIALIZE LOCAL VARIABLES>>                                     12730000
     PCBPT := PIN * PCBSIZE;                                            12735000
     PCBXP; <<PTR TO PCBXFIXED AREA>>                                   12740000
     @PCBXFIXEDP:=TOS;                                                  12745000
     PCB'LOADERFLAGS:=PCBXFIXEDP(6); <<LOADER FLAGS>>          <<06666>>12750000
     LOGGING:=LOG'PROCTERM LAND LOG'ENABLED; <<LOGGING FLAG>>           12755000
     PCB'MAPDST := SPCBMAPDST;                                          12760000
     SPCBMAPDST := 0; <<CLEAR PCB>>                                     12765000
     IF PCB'MAPDST <> 0 THEN                                   <<06742>>12770000
        ADJUSTLOCALITY(PCBPT,DOUBLE(PCB'MAPDST),0,1);          <<06742>>12775000
     IF PCB'LOCALSEGMAP = 1 THEN                                        12780000
       BEGIN                                                            12785000
         <<THIS PIN HAS A LOCAL SEGMAP--RELEASE IT>>                    12790000
         IF PCB'MAPDST <> 0 THEN                               <<07316>>12795000
         RELDATASEG(PCB'MAPDST);                                        12800000
       END;                                                             12805000
     SAVESIR:=GETSIR(SEGTABSIR);                                        12810000
     SAVEDB:=EXCHANGEDB(SEGTABDST);                                     12815000
     NRSEGS:=0D; <<INITIALIZE LOGGING DATA>>                            12820000
     <<FIND SHARER ENTRY FOR PIN>>                                      12825000
     KEY:=DOUBLE(LOGICAL(PIN)); <<PROCESS PIN>>                         12830000
     IF LSEARCH(KEY,ANYMODE,SHARER) THEN                                12835000
       BEGIN <<FOUND ENTRY>>                                            12840000
         <<USE SHARER ENTRY TO FIND PROGFILE ENTRY>>                    12845000
         KEY:=ENTDP1; <<PROG KEY>>                                      12850000
         MODE:=EPMODE;<<PROG MODE>>                                     12855000
         LDELETE;     <<DELETE SHARER ENTRY>>                           12860000
         IF LSEARCH(KEY,MODE,PROGFILE) THEN                             12865000
           BEGIN <<FOUND ENTRY>>                                        12870000
             IF LOGGING THEN                                            12875000
               BEGIN <<LOG INFO DESIRED>>                               12880000
                 NRPROGSEGS:=ESEG; <<#PROG SEGS>>                       12885000
                 SUMSLSEGS;        <<#NON-MPE SL SEGS>>                 12890000
               END;                                                     12895000
             ADJREFCOUNTS(-1); <<DEC SEG REF COUNTS>>                   12900000
           END;                                                         12905000
       END;                                                             12910000
     <<CHECK FOR ANY LOADPROC'ED SEGMENTS>>                             12915000
     IF PCB'LOADPROCFLAG = 1 THEN                                       12920000
       BEGIN                                                            12925000
         <<THIS PIN HAS ISSUED A LOADPROC REQUEST>>                     12930000
         <<FIND LOADPROCMASTER ENTRY>>                                  12935000
         KEY:=DOUBLE(LOGICAL(PIN));                                     12940000
         IF LSEARCH(KEY,ANYMODE,LOADPROCMASTER) THEN                    12945000
           BEGIN <<FOUNT ENTRY>>                                        12950000
             <<IF ANY ACTIVE EXTENSION ENTRIES>>                        12955000
             <<  .FIND EXTENSION ENTRY        >>                        12960000
             <<  .ADJUST SEG REF COUNTS       >>                        12965000
             <<  .DELETE EXTENSION ENTRY      >>                        12970000
             <<DELETE LOADPROCMASTER ENTRY    >>                        12975000
             IF ACTIVE'LPROCS > 0 THEN                                  12980000
               BEGIN                                                    12985000
                 <<ACTIVE EXTENSIONS MUST BE UNLOADED>>                 12990000
                 @AUXENTP:=@ENTP; <<SAVE LOADPROCMASTER PTRS>>          12995000
                 @AUXENTP1:=@ENTP1;                                     13000000
                 @AUXENTP2:=@ENTP2;                                     13005000
                 @AUXENTP3:=@ENTP3;                                     13010000
                 ACTIVE'LPROCS':=ACTIVE'LPROCS;<<LOCAL COPY>>           13015000
                 <<CYCLE THRU POSSIBLE EXTENSION INDICES>>              13020000
                 IDX:=0;                                                13025000
                 WHILE (IDX:=IDX+1) <= 255 AND                          13030000
                       ACTIVE'LPROCS' > 0 DO                            13035000
                   BEGIN                                                13040000
                     <<CHECK IF INDEX IS BEING USED>>                   13045000
                     IF TESTBIT(AUXENTP1,IDX) THEN                      13050000
                       BEGIN                                            13055000
                         <<THIS INDEX IS ACTIVE>>                       13060000
                         <<FIND EXTENSION ENTRY>>                       13065000
                         KEY:=DOUBLE(LOGICAL(PIN))&DLSL(16)    <<06542>>13070000
                              +DOUBLE(IDX);                    <<06542>>13075000
                         IF LSEARCH(KEY,ANYMODE,EXTENSION) THEN         13080000
                           BEGIN                                        13085000
                             IF LOGGING THEN SUMSLSEGS;                 13090000
                             ADJREFCOUNTS(-1);<<DEC REF CNTS>>          13095000
                             LDELETE; <<DELETE EXTENSION >>             13100000
                             EXCHANGEDB(SEGTABDST'EX);         <<06542>>13105000
                             LDELETE;                          <<06542>>13110000
                             EXCHANGEDB(SEGTABDST);            <<06542>>13115000
                             ACTIVE'LPROCS':=ACTIVE'LPROCS'-1;          13120000
                           END;                                         13125000
                       END;                                             13130000
                   END; <<WHILE>>                                       13135000
                 @ENTP:=@AUXENTP; <<LOADPROCMASTER PTRS>>               13140000
                 @ENTP1:=@AUXENTP1;                                     13145000
                 @ENTP2:=@AUXENTP2;                                     13150000
                 @ENTP3:=@AUXENTP3;                                     13155000
               END;                                                     13160000
             LDELETE; <<DELETE LOADPROCMASTER>>                         13165000
           END;                                                         13170000
       END;                                                             13175000
     NRSEGS':=NRSEGS; <<SAVE LOGGING DATA>>                             13180000
     RELSIR(SEGTABSIR,SAVESIR);                                         13185000
     EXCHANGEDB(SAVEDB);                                                13190000
     IF LOGGING THEN BEGIN    << SET UP AND LOG IT >>          <<07318>>13195000
       CPUTIMEARRAY(0):=PCBXFIXEDP(24);                        <<07318>>13200000
       CPUTIMEARRAY(1):=PCBXFIXEDP(25);                        <<07318>>13205000
       CPUTIME:=CPUTIME+999D;  << ROUND UP >>                  <<07318>>13210000
       IF OVERFLOW THEN                                        <<07318>>13215000
         CPUTIME:=2147483D                                     <<07318>>13220000
       ELSE CPUTIME:=CPUTIME/1000D;                            <<07318>>13225000
       LOG4(NRPROGSEGS',NRSLSEGS',                             <<07318>>13230000
            PCBXFIXEDP(23),PCBXFIXEDP(26),PCBXFIXEDP(27),      <<07318>>13235000
            PIN,CPUTIME,4);                                    <<07318>>13240000
       END;  << LOGGING >>                                     <<07318>>13245000
     CONDCODE:=CCE;                                                     13250000
   END;                                                                 13255000
PROCEDURE SUMSEGS(LOGSEGNR);                                            13260000
  <<SUPPORT PROCEDURE FOR UNLOAD>>                                      13265000
  <<INCREMENT NRSLSEGS[SQ] IF THE LOGICAL SEGMENT>>                     13270000
  <<IS NOT AN MPE SEGMENT.                       >>                     13275000
  <<ENTP POINTS TO AN SL ENTRY                   >>                     13280000
  <<SL SEG LIST ENTRIES ARE SEARCHED UNTIL THE   >>                     13285000
  <<CORRECT ENTRY IS FOUND                       >>                     13290000
  <<    -MPE SEGMENT FLAG IS TESTED              >>                     13295000
  VALUE LOGSEGNR;                                                       13300000
  INTEGER LOGSEGNR;                                                     13305000
  OPTION INTERNAL,UNCALLABLE;                                           13310000
  BEGIN                                                                 13315000
    INTEGER TEMP1;                                                      13320000
    INTEGER POINTER PTEMP2;                                             13325000
    INTEGER NRSLSEGS = SQ;  <<NR. SYS. (NON-MPE) SL SEG'S>>             13330000
    TEMP1:=ESLSEG'SL;   <<# SL SEG LIST ENTRIES>>                       13335000
    @PTEMP2:=@ENTP3+TEMP1*3;<<PTR TO SEG LIST ENTRY>>                   13340000
    <<CYCLE THRU SEG LIST ENTRIES UNTIL >>                              13345000
    <<CORRECT ENTRY FOUND               >>                              13350000
    WHILE (TEMP1:=TEMP1-1) >= 0 DO                                      13355000
      BEGIN                                                             13360000
        @PTEMP2:=@PTEMP2-3;  <<NEXT ENTRY>>                             13365000
        IF SLLOGSEGNR=LOGSEGNR THEN                                     13370000
          BEGIN              <<FOUND IT>>                               13375000
            IF NOT SYSTEMSEG <<NON-MPE SL SEG>>                         13380000
              THEN NRSLSEGS:=NRSLSEGS+1;                                13385000
            RETURN;                                                     13390000
          END;                                                          13395000
      END; <<WHILE>>                                                    13400000
    SUDDENDEATH(344);  <<ENTRY NOT FOUND>>                              13405000
   END;                                                                 13410000
INTEGER PROCEDURE LOADPROC (PROCNAME,LIBSEARCH,PLABEL);                 13415000
   <<LOADS THE SEGMENT CONTAINING THE NAMED PROCEDURE >>                13420000
   <<AND ALL SEGMENTS CONTAINING EXTERNALS OF THE     >>                13425000
   <<SPECIFIED PROCEDURE.  LIBSEARCH SPECIFIES THE FIRST>>              13430000
   <<LIBRARY TO BE SEARCHED.  THE P-LABEL (EXTERNAL FORM)>>             13435000
   <<OF THE PROCEDURE IS RETURNED.  ALSO RETURNED AS THE >>             13440000
   <<RESULT IS THE PROCID NUMBER.  THIS NUMBER IS USED TO>>             13445000
   <<UNLOAD THE PROCEDURE.  THE PROCEDURE NAME MUST BE   >>             13450000
   <<FORMATTED SUCH THAT THERE ARE NO LEADING BLANKS AND >>             13455000
   <<IT MUST BE TERMINATED WITH A BLANK.                 >>             13460000
   <<CONDITION CODE CONVENTIONS:                         >>             13465000
   <<                                                    >>             13470000
   <<    CCE   REQUEST GRANTED                           >>             13475000
   <<    CCL   REQUEST DENIED                            >>             13480000
   <<                                                    >>             13485000
   <<IF CCL THEN THE PRIMARY ERROR NUMBER IS RETURNED AS >>             13490000
   <<THE RESULT OF THE PROCEDURE; THE SECONDARY ERROR NUMB>>            13495000
   <<(FILE SYS ERR NUMB), IF ANY, IS IN PCBX.  NOTE THIS  >>            13500000
   <<PROCEDURE MUST BE CALLED WITH DB SET TO THE STACK>>                13505000
   VALUE LIBSEARCH;                                                     13510000
   BYTE ARRAY PROCNAME;                                                 13515000
   INTEGER LIBSEARCH,PLABEL;                                            13520000
   BEGIN                                                                13525000
     INTEGER ERROR,LOADPROCID;                                          13530000
     INTEGER ARRAY OPTION'NUMS(0:2),                                    13535000
                   OPTIONS(0:1);                                        13540000
                                                                        13545000
     <<CHECK PARAMETERS>>                                               13550000
     ERRORON;                                                           13555000
     CHEK([10/80,6/3],[8/0,2/1,1/0,5/3],[2/2,2/0,2/3]D);                13560000
                                                                        13565000
    <<UPSHIFT PROCNAME>>                                       <<06102>>13570000
    MOVE PROCNAME:=PROCNAME WHILE ANS;                         <<06102>>13575000
     <<SET UP OPTIONS TO LOADPROCEDURE>>                                13580000
     OPTION'NUMS(0):=1;  <<LIBSEARCH>>                                  13585000
     OPTIONS(0):=LIBSEARCH;<<LIBSEARCH VALUE>>                          13590000
     OPTION'NUMS(1):=2;    <<FLAGS>>                                    13595000
     IF LOGICALMAPPING THEN                                             13600000
       BEGIN               <<MAPPING FIRMWARE PRESENT>>                 13605000
         OPTIONS(1):=0;    <<LOGICAL DOMAIN>>                           13610000
                           <<ABORT IF UNSAT. EXTERNALS>>                13615000
       END                                                              13620000
      ELSE                                                              13625000
       BEGIN               <<MAPPING FIRMWARE NOT PRESENT>>             13630000
         OPTIONS(1):=1;    <<PHYSICAL DOMAIN>>                          13635000
                           <<ABORT IF UNSAT. EXTERNALS>>                13640000
       END;                                                             13645000
     OPTION'NUMS(2):=0;    <<END OF LIST>>                              13650000
     LOADPROCEDURE(ERROR,PROCNAME,LOADPROCID,PLABEL,                    13655000
                         OPTION'NUMS,OPTIONS);                          13660000
     IF <> THEN                                                         13665000
       BEGIN     <<ERROR>>                                              13670000
         LOADPROC:=ERROR;                                               13675000
         CONDCODE:=CCL;                                                 13680000
       END                                                              13685000
      ELSE                                                              13690000
       BEGIN     <<OK >>                                                13695000
         LOADPROC:=LOADPROCID;                                          13700000
         CONDCODE:=CCE;                                                 13705000
       END;                                                             13710000
     ERROREXIT([10/80,6/3],0,0);                                        13715000
   END;                                                                 13720000
PROCEDURE UNLOADPROC (PROCID);                                          13725000
   <<UNLOADS THE SEGMENT CONTAINING THE PROCEDURE SPECIFIED >>          13730000
   <<BY THE PROCEDURE ID NUMBER (PROCID) AND ALL THE SEGS   >>          13735000
   <<CONTAINING EXTERNALS OF THE SEGMENT.                  >>           13740000
   <<CONDITION CODE CONVENTIONS:                           >>           13745000
   <<    CCE   REQUEST GRANTED                             >>           13750000
   <<    CCL   REQUEST DENIED - INVALID PROCID             >>           13755000
   <<                                                      >>           13760000
   <<NOTE THAT THIS PROCEDURE MUST BE CALLED WITH DB SET TO>>           13765000
   << THE STACK                                            >>           13770000
   VALUE PROCID;                                                        13775000
   INTEGER PROCID;                                                      13780000
   BEGIN                                                                13785000
    DOUBLE KEY;                                                         13790000
    INTEGER SAVEDB,                                                     13795000
            PCBPT,                                             <<06648>>13800000
            SAVESIR,                                                    13805000
            MCSTIDXTAB'L'DL,                                            13810000
            PROCID',                                                    13815000
            IDX,                                                        13820000
            IDX2,                                                       13825000
            MAXMCST,                                                    13830000
            SEGLEN,                                                     13835000
            STTPTR,                                                     13840000
            DELTA,                                                      13845000
            TARGET,                                                     13850000
            SOURCE,                                                     13855000
            COUNT;                                                      13860000
    LOGICAL SEGMAP'ADJUST;                                              13865000
    INTEGER ARRAY MCSTIDXTAB'L(0:15)=Q;                                 13870000
    INTEGER POINTER AUXENTP,                                            13875000
                    AUXENTP1,                                           13880000
                    AUXENTP2,                                           13885000
                    AUXENTP3;                                           13890000
                                                                        13895000
LOGICAL SUBROUTINE IDX'SET;                                             13900000
  <<RETURN TRUE IF IDX BIT OF MCSTIDXTAB'L IS SET>>                     13905000
  BEGIN                                                                 13910000
    XREG:=(IDX&LSR(1)).(0:12);     <<PROPER WORD>>                      13915000
    TOS:=MCSTIDXTAB'L(XREG);       <<GET PROPER WORD>>                  13920000
    XREG:=(IDX&LSR(1)).(12:4);     <<PROPER BIT>>                       13925000
    ASSEMBLE(CSL 1,X);             <<SHIFT BIT TO BIT 15>>              13930000
    S2:=TOS; <<IDX'SET:=TOS>>                                           13935000
  END;  <<IDX'SET>>                                                     13940000
                                                                        13945000
    ERRORON;                                                            13950000
    PCBPT := CURPRC;                                           <<06648>>13955000
    CHEK([10/81,6/1],[8/0,2/0,1/0,5/1]);                                13960000
    <<CHECK VALIDITY OF PROCID>>                                        13965000
    IF NOT (1<=PROCID<=255) THEN GO RETURNERROR;                        13970000
    <<BUILD KEY>>                                                       13975000
    TOS:=USERPIN;                                                       13980000
    TOS:=PROCID;                                                        13985000
    KEY:=TOS;                                                           13990000
    PROCID':=PROCID;                                                    13995000
    SEGMAP'ADJUST:=FALSE;                                               14000000
    <<COMPUTE DL-REL ADDRO OF MCSTIDXTAB'L>>                            14005000
    TOS:=@MCSTIDXTAB'L;                                                 14010000
    PUSH(DL);                                                           14015000
    MCSTIDXTAB'L'DL:=TOS-TOS;                                           14020000
    SAVESIR:=GETSIR(SEGTABSIR);                                         14025000
    SAVEDB:=EXCHANGEDB(SEGTABDST);                                      14030000
    <<FIND EXTENSION ENTRY>>                                            14035000
    IF LSEARCH(KEY,ANYMODE,EXTENSION) THEN                              14040000
      BEGIN       <<FOUND EXTENSION ENTRY>>                             14045000
        LOADPROCCOUNT:=LOADPROCCOUNT-1;                                 14050000
        IF LOADPROCCOUNT = 0 THEN                                       14055000
          BEGIN                                                         14060000
            <<LOADPROC'ED PROCEDURE IS NO LONGER NEEDED-->>             14065000
            <<TRY TO UNLOAD PROCEDURE                    >>             14070000
            ADJREFCOUNTS(-1);<<DEC COUNTS ON ALL REF'ED SEGS>>          14075000
            @AUXENTP:=@ENTP; <<SAVE PTRS TO EXTENSION ENTRY>>           14080000
            @AUXENTP1:=@ENTP1;                                          14085000
            @AUXENTP2:=@ENTP2;                                          14090000
            @AUXENTP3:=@ENTP3;                                          14095000
            <<FIND LOADPROCMASTER ENTRY>>                               14100000
            <<ADJUST KEY>>                                              14105000
            TOS:=KEY;                                                   14110000
            ASSEMBLE(DLSR 16);                                 <<06280>>14115000
            KEY:=TOS;                                                   14120000
            IF LSEARCH(KEY,ANYMODE,LOADPROCMASTER) THEN                 14125000
              BEGIN  <<FOUND LOADPROCMASTER ENTRY>>                     14130000
                <<DECREMENT # ACTIVE LOADPROC'S>>                       14135000
                ACTIVE'LPROCS:=ACTIVE'LPROCS-1;                         14140000
                <<FREE PROCID>>                                         14145000
                TOS:=@ENTP1;  <<PTR TO EXTIDX TABLE>>                   14150000
                CLEARBIT(*,PROCID');                                    14155000
                <<USE MCSTREF ARRAY TO ADJUST REFCOUNT>>                14160000
                <<IN LOADPROCMASTER'S MCSTLOGSEG ARRAY>>                14165000
                @ENTP1:=@ENTP1+16; <<PTR TO MCSTIDXTAB>>                14170000
                SN:=AUXENTP3+1; <<MCSTREF ARRAY SIZE>>                  14175000
                WHILE (SN:=SN-1) > 0 DO                                 14180000
                  BEGIN                                                 14185000
                    SL:=AUXENTP3(SN).(8:8); <<MCSTIDX>>                 14190000
                    SK:=SL&LSL(1)+1;                                    14195000
                    ENTP3(SK):=ENTP3(SK)-1; <<REFCOUNT>>                14200000
                    IF ENTP3(SK) = 0 THEN                               14205000
                      BEGIN                                             14210000
                        <<THIS MAPPED CST # IS NO LONGER>>              14215000
                        <<NEEDED--FREE IT IN MCSTIDXTAB >>              14220000
                        ENTP3(SK-1):=0; <<CLEAR ENTRY>>                 14225000
                        TOS:=@ENTP1; <<PTR TO MCSTIDXTAB>>              14230000
                        CLEARBIT(*,SL);                                 14235000
                        SEGMAP'ADJUST:=TRUE; <<FLAG CHANGE >>           14240000
                      END;                                              14245000
                  END; <<WHILE>>                                        14250000
                IF SEGMAP'ADJUST THEN                                   14255000
                  BEGIN                                                 14260000
                    <<GET LOCAL COPY OF FINAL MCSTIDXTAB>>              14265000
                    <<FOR USE DURING SEGMAP ADJUSTMENT  >>              14270000
                    TOS:=MCSTIDXTAB'L'DL; <<TARGET>>                    14275000
                    TOS:=@ENTP1;          <<SOURCE>>                    14280000
                    TOS:=16;              <<COUNT>>                     14285000
                    ASSEMBLE(MVBL 3);                                   14290000
                  END;                                                  14295000
              END                                                       14300000
             ELSE                                                       14305000
              BEGIN  <<LOADPROCMASTER NOT FOUND>>                       14310000
                SUDDENDEATH(352);                                       14315000
              END;                                                      14320000
            <<DELETE EXTENSION ENTRY>>                                  14325000
            @ENTP:=@AUXENTP;  <<RESTORE PTRS TO EXTENSION>>             14330000
            @ENTP1:=@AUXENTP1;                                          14335000
            @ENTP2:=@AUXENTP2;                                          14340000
            @ENTP3:=@AUXENTP3;                                          14345000
            LDELETE;                                                    14350000
            EXCHANGEDB(SEGTABDST'EX);                          <<06542>>14355000
            LDELETE;                                           <<06542>>14360000
            EXCHANGEDB(SEGTABDST);                             <<06542>>14365000
          END                                                  <<06542>>14370000
        ELSE                                                   <<06542>>14375000
          UPDATE'XDST;                                         <<06542>>14380000
        EXCHANGEDB(SAVEDB);                                             14385000
        RELSIR(SEGTABSIR,SAVESIR);                                      14390000
      END                                                               14395000
     ELSE                                                               14400000
      BEGIN       <<EXTENSION ENTRY NOT FOUND>>                         14405000
        EXCHANGEDB(SAVEDB);                                             14410000
        RELSIR(SEGTABSIR,SAVESIR);                                      14415000
        GO RETURNERROR;                                                 14420000
      END;                                                              14425000
    IF SEGMAP'ADJUST THEN                                               14430000
      BEGIN                                                             14435000
        <<A CHANGE OCCURRED IN THE MCSTIDXTAB OF THE >>                 14440000
        <<LOADPROCMASTER ENTRY.  ADJUST THE PROCESS'S>>                 14445000
        <<SEGMAP TO AGREE                            >>                 14450000
        SAVEDB := EXCHANGEDB(SPCBMAPDST);                      <<06648>>14455000
        MAXMCST:=SEGMAP(0).(8:8)&LSL(1);                                14460000
        SEGLEN:=SEGMAP(1);                                              14465000
        <<EACH VALID MAPPED CST # WHICH IS NO LONGER >>                 14470000
        <<USED MUST BE REMOVED FROM THE SEGMAP--THIS >>                 14475000
        <<INCLUDES THE MAPPED CST'S EXTERNAL STT'S   >>                 14480000
        IDX:=0;                                                         14485000
        WHILE (IDX:=IDX+2) <= MAXMCST DO                                14490000
          BEGIN                                                         14495000
            <<CHECK IF MAPPED CST #IDX IS NOT BEING  >>                 14500000
            <<USED NOW BUT WAS BEFORE UNLOADPROC     >>                 14505000
            IF NOT IDX'SET AND                                          14510000
               SEGMAP(IDX) <> 0 THEN                                    14515000
              BEGIN                                                     14520000
                <<THIS IDX CHANGED STATE>>                              14525000
                SEGMAP(IDX):=0; <<CLEAR PHYCST>>                        14530000
                IF SEGMAP(IDX+1) <> 0 THEN                              14535000
                  BEGIN                                                 14540000
                    <<THIS IDX HAS EXTERNAL STT'S IN SEGMAP>>           14545000
                    <<WHICH MUST BE REMOVED                >>           14550000
                    STTPTR:=SEGMAP(IDX+1); <<PTR TO STT'S>>             14555000
                    DELTA:=SEGMAP(STTPTR)+1;<<# ENTRIES>>               14560000
                    TARGET:=STTPTR-SEGMAP(STTPTR);                      14565000
                    SOURCE:=STTPTR+1;                                   14570000
                    COUNT:=SEGLEN-SOURCE;                               14575000
                    <<COLLAPSE STT'S FROM SEGMAP>>                      14580000
                    MOVE SEGMAP(TARGET):=                               14585000
                                SEGMAP(SOURCE),(COUNT);                 14590000
                    SEGLEN:=SEGLEN-DELTA; <<NEW SEGMAP LEN>>            14595000
                    SEGMAP(IDX+1):=0; <<CLEAR STTPTR>>                  14600000
                    <<ADJUST STT PTRS OF OTHER MAPPED CST'S>>           14605000
                    IDX2:=1;                                            14610000
                    WHILE (IDX2:=IDX2+2) <= MAXMCST+1 DO                14615000
                      BEGIN                                             14620000
                        IF SEGMAP(IDX2) > SOURCE THEN                   14625000
                          SEGMAP(IDX2):=SEGMAP(IDX2)-DELTA;             14630000
                      END; <<WHILE>>                                    14635000
                  END;                                                  14640000
              END;                                                      14645000
          END; <<WHILE>>                                                14650000
        SEGMAP(1):=SEGLEN; <<SAVE NEW LENGTH>>                          14655000
        EXCHANGEDB(SAVEDB);                                             14660000
      END;                                                              14665000
    CONDCODE:=CCE;                                                      14670000
    ERROREXIT([10/81,6/1],0,0);                                         14675000
    RETURN;                                                             14680000
RETURNERROR:                                                            14685000
    CONDCODE:=CCL;                                                      14690000
    ERROREXIT([10/81,6/1],0,0);                                         14695000
   END;                                                                 14700000
INTEGER PROCEDURE ALLOCATEPROG (PROGFNAME);                             14705000
   <<ALLOCATES OR DEALLOCATES (DEPENDING ON THE ENTRY POINT>>           14710000
   <<USED) THE SPECIFIED PROGRAM FILE. THE ONLY PROGRAMS   >>           14715000
   <<THAT MAY BE ALLOCATED IN THIS FASHION ARE THOSE IN    >>           14720000
   <<PUB.SYS.  ONLY PROGRAMS IN THE SYSTEM DOMAIN MAY BE   >>           14725000
   <<ALLOCATED.  THE PROGAM NAME MUST BE FORMATTED SUCH THAT>>          14730000
   <<THERE ARE NO LEADING BLANKS AND IT MUST BE TERMINATED >>           14735000
   <<WITH A SPECIAL CHAR.                                  >>           14740000
   <<CONDITION CODE CONVENTIONS:                           >>           14745000
   <<                                                      >>           14750000
   <<    CCE   REQUEST GRANTED                             >>           14755000
   <<                                                      >>           14760000
   <<                                                      >>           14765000
   <<IF CCL THEN THE PRIMARY ERROR NUMBER IS RETURNED AS   >>           14770000
   <<THE RESULT OF THE PROCEDURE; THE SECONDARY ERROR NUMBER>>          14775000
   <<(FILE SYS ERR NUMB), IF ANY, IS IN THE PCBX.  NOTE THIS>>          14780000
   <<PROCEDURE MUST BE CALLED WITH DB SET TO THE STACK>>                14785000
   BYTE ARRAY PROGFNAME;                                                14790000
   OPTION UNCALLABLE;                                                   14795000
   BEGIN                                                                14800000
   ENTRY DEALLOCATEPROG;                                                14805000
   LOGICAL FLAG:=FALSE;   <<ALLOCATE/DEALLOCATE FLAG>>         <<06102>>14810000
   INTEGER PROGFNUM;                                           <<06102>>14815000
   DOUBLE PROGKEY;                                             <<06102>>14820000
   INTEGER SAVESIR;                                            <<06102>>14825000
   INTEGER ARRAY PROGREC0(0:19)=Q;                             <<06102>>14830000
   DEFINE SAEXTLIST = PROGREC0(13)#;                           <<06102>>14835000
                                                               <<06102>>14840000
   FLAG:=TRUE;                                                 <<06102>>14845000
                                                               <<06102>>14850000
DEALLOCATEPROG:                                                <<06102>>14855000
                                                                        14860000
   PROGFNUM:=0;                                                         14865000
   PROGKEY:=0D;                                                         14870000
   SAVESIR:=-1;                                                         14875000
                                                                        14880000
   <<* * * OPEN PROGRAM FILE * * *>>                                    14885000
                                                                        14890000
   PROGFNUM:=DFOPEN (PROGFNAME,%(2)10000000011,%(2)111110111); <<06102>>14895000
   IF < THEN  <<ERROR?>>                                                14900000
      BEGIN                                                             14905000
      TOS := ERR53; GO ABORT                                            14910000
      END;                                                              14915000
   FREADDIR(PROGFNUM,PROGREC0,20,0D);                          <<06102>>14920000
   ASSEMBLE (ADDS 7);                                          <<06102>>14925000
   FGETINFO(PROGFNUM,,S0,,,,S1,,S4,,,,,,,S5,,S6,,DS3);         <<06102>>14930000
   IF TOS.(14:2)=2 THEN   <<TEMPORARY FILE>>                   <<06102>>14935000
      BEGIN                                                    <<06102>>14940000
      TOS := ERR46;  GO ABORT                                  <<06102>>14945000
      END;                                                     <<06102>>14950000
   BS2 := TOS;  <<LOGICAL DEVICE NR.>>                                  14955000
   PROGKEY := TOS;  <<PROG. KEY>>                                       14960000
   IF TOS <> PROGFILECODE THEN  <<TYPE PROGRAM?>>                       14965000
      BEGIN                                                             14970000
      TOS := ERR31; GO ABORT                                            14975000
      END;                                                              14980000
S1 := S1+1+SAEXTLIST;<<EXT. S.A.+#FILELABEL+#USERLABEL>>       <<06102>>14985000
IF TOS > TOS THEN   <<CODE NOT IN 1ST EXTENT>>                 <<06102>>14990000
      BEGIN                                                             14995000
      TOS := ERR34; GO ABORT                                            15000000
      END;                                                              15005000
   TOS := FGETPVINFO (PROGFNUM);                                        15010000
   FCLOSE(PROGFNUM,0,0);                                                15015000
   IF TOS <> 0 THEN                                                     15020000
   BEGIN                                                       <<E9061>>15025000
    <<ATTEMPTING TO ALLOCATE/DEALLOCATE FROM NON-SYSEM DISC>>  <<E9061>>15030000
       TOS := ERR92;  GO ABORT;                                         15035000
   END;                                                                 15040000
   SAVESIR := GETSIR(SEGTABSIR);  <<GET SEGMENT TABLE SIR>>             15045000
   EXCHANGEDB(SEGTABDST);  <<SET DB TO SEGMENT TABLE>>                  15050000
                                                                        15055000
   <<* * * ALLOCATE/DEALLOCATE PROGRAM * * *>>                          15060000
                                                                        15065000
   IF FLAG THEN  <<ALLOCATE?>>                                          15070000
      BEGIN                                                             15075000
      TOS:=LOADPROGRAM (0,PROGKEY,0D,%100000,0,SAVESIR,0);              15080000
      IF < THEN GO ABORT;  <<ERROR?>>                                   15085000
      LSEARCH(PROGKEY,NORMAL,PROGFILE);  <<FIND PROG. ENTRY>>           15090000
      IF EPA = 1 THEN  <<ERROR?>>                                       15095000
         BEGIN                                                          15100000
         TOS := ERR80;                                                  15105000
         ADJREFCOUNTS(-1);                                              15110000
         GO ABORT                                                       15115000
         END;                                                           15120000
      EPA := 1;                                                         15125000
      END                                                               15130000
   ELSE  <<DEALLOCATE>>                                                 15135000
      BEGIN                                                             15140000
      IF NOT LSEARCH(PROGKEY,NORMAL,PROGFILE) OR EPA = 0 THEN           15145000
         BEGIN                                                          15150000
         TOS := ERR82; GO ABORT                                         15155000
         END;                                                           15160000
      EPA := 0;                                                         15165000
      ADJREFCOUNTS(-1)                                                  15170000
      END;                                                              15175000
   TOS := CCE;  <<OK CONDITION CODE>>                                   15180000
   GO GETOUT;                                                           15185000
   HELP;   << DUMMY CALL TO ESTABLISH LINKING >>                        15190000
                                                                        15195000
   ABORT:                                                               15200000
   ALLOCATEPROG := TOS;  <<ERROR NR.>>                                  15205000
   IF PROGFNUM <> 0 THEN FCLOSE(PROGFNUM,0,0);                 <<06102>>15210000
   TOS := CCL;  <<ERROR CONDITION CODE>>                                15215000
                                                                        15220000
   GETOUT:                                                              15225000
   EXCHANGEDB(0);  <<SET DB TO STACK>>                                  15230000
   IF SAVESIR <> -1 THEN RELSIR(SEGTABSIR,SAVESIR);                     15235000
   CONDCODE := TOS  <<STORE CONDITION CODE>>                            15240000
   END;                                                                 15245000
INTEGER PROCEDURE ALLOCATEPROC (PROCNAME);                              15250000
   <<ALLOCATES THE SEGMENT CONTAINING THE NAMED PROCEDURE  >>           15255000
   <<VS. LOADING THE PROCEDURE.  SEE LOADPROC FOR DETAILS  >>           15260000
   BYTE ARRAY PROCNAME;                                                 15265000
   OPTION UNCALLABLE;                                                   15270000
   BEGIN                                                                15275000
     TOS:=0D;       <<LOADER RESULT>>                                   15280000
     TOS:=0;        <<COMMAND>>                                         15285000
     TOS.(0:2):=3;  <<ALLOCATE PROCEDURE>>                              15290000
     IF LOGICALMAPPING                                                  15295000
       THEN TOS.(5:1):=0   <<MAPPED DOMAIN>>                            15300000
       ELSE TOS.(5:1):=1;  <<PHYSICAL DOMAIN>>                          15305000
     TOS:=LOADER(*,0,0,0,PROCNAME,0);                                   15310000
     IF S0 = 0                                                          15315000
       THEN CONDCODE:=CCE  <<OK>>                                       15320000
       ELSE CONDCODE:=CCL; <<ERROR>>                                    15325000
     ALLOCATEPROC:=TOS;    <<ZERO OR ERROR CODE>>                       15330000
   END;                                                                 15335000
INTEGER PROCEDURE DEALLOCATEPROC (PROCNAME);                            15340000
   <<DEALLOCATES THE SEGMENT CONTAINING THE NAMED PROCEDURE>>           15345000
   <<AND THE SEGMENTS CONTAINING THE EXTERNALS OF THE      >>           15350000
   <<SPECIFIED PROCEDURE.  SEE DESCRIPTION OF ALLOCATEPROC >>           15355000
   <<FOR FURTHER DETAILS>>                                              15360000
   BYTE ARRAY PROCNAME;                                                 15365000
   OPTION UNCALLABLE;                                                   15370000
   BEGIN                                                                15375000
     DOUBLE SLKEY;                                                      15380000
     INTEGER SAVEDB,SAVESIR,SAVEENTP,ERROR,LOGSEG;                      15385000
     INTEGER POINTER PSEGLIST;                                          15390000
     INTEGER ARRAY QNAME(0:7)=Q;                                        15395000
     <<CREATE Q-REL VERSION OF PROCNAME>>                               15400000
     FORMATNAME(QNAME,PROCNAME);                                        15405000
     SAVESIR:=GETSIR(SEGTABSIR);                                        15410000
     SAVEDB:=EXCHANGEDB(SEGTABDST'EX);                         <<06542>>15415000
     <<MOVE PROCNAME TO SBUF0>>                                         15420000
     SL:=8;                                                             15425000
     WHILE (SL:=SL-1) >= 0 DO SBUF0(SL):=QNAME(SL);                     15430000
     <<SCAN EXTENSION ENTRIES FOR--  >>                                 15435000
     <<  . PIN=0                     >>                                 15440000
     <<  . EXT=0                     >>                                 15445000
     <<  . LIB=0                     >>                                 15450000
     <<  . SAME PROCNAME             >>                                 15455000
     @ENTP:=HDFWDLINK(EXTENSION); <<HEAD OF EXTENSION LIST>>            15460000
     WHILE @ENTP <> 0 DO                                                15465000
       BEGIN                                                            15470000
         IF ENTP(1)=0 AND       <<PIN=0,EXT=0>>                         15475000
            ENTP.(4:4)=0 AND    <<LIB=0>>                               15480000
            SAMENAME(SBUF0(0),LOADPROCNAME) THEN               <<d7968>>15485000
           BEGIN   <<FOUND PROPER EXTENSION ENTRY>>                     15490000
             TRANS'XDST'TO'LST;                                <<06542>>15495000
             IF <> THEN GO GETOUTERR;                          <<06542>>15500000
             EXCHANGEDB(SEGTABDST);                            <<06542>>15505000
             SAVEENTP:=@ENTP;   <<SAVE PTR>>                            15510000
             SETSECPTRS;                                                15515000
             LOGSEG:=ENTP1(1).(8:8); <<GET LOG SEG #>>                  15520000
             TOS:=ENTP2(1);          <<GET SL KEY>>                     15525000
             TOS:=ENTP2(2);                                             15530000
             SLKEY:=TOS;                                                15535000
             IF LSEARCH(SLKEY,NORMAL,SLFILE) THEN                       15540000
               BEGIN  <<FOUND SL ENTRY>>                                15545000
                 SI:=@ENTP;                                             15550000
                 SJ:=LOGSEG;                                            15555000
                 IF FINDLOGSEGMATCH THEN                                15560000
                   BEGIN  <<FOUND SEGLIST ENTRY FOR LOGSEG>>            15565000
                     @PSEGLIST:=SL;                                     15570000
                     PSEGLIST.(12:1):=0; <<CLEAR A BIT>>                15575000
                     @ENTP:=SAVEENTP; <<RESTORE PTRS TO EXT>>           15580000
                     SETSECPTRS;      <<EXTENSION ENTRY>>               15585000
                     ADJREFCOUNTS(-1); <<ADJ COUNT>>                    15590000
                     LDELETE;         <<DELETE EXT ENTRY>>              15595000
                     EXCHANGEDB(SEGTABDST'EX);                 <<06542>>15600000
                     LDELETE;                                  <<06542>>15605000
                     ERROR:=0;        <<OK CODE>>                       15610000
                     CONDCODE:=CCE;                                     15615000
                     GO GETOUT;                                         15620000
                   END;                                                 15625000
               END;                                                     15630000
             @ENTP:=SAVEENTP;                                  <<06542>>15635000
             LDELETE;                                          <<06542>>15640000
             GO GETOUTERR; <<ERROR>>                                    15645000
           END;                                                         15650000
         <<WRONG EXTENSION ENTRY--TRY NEXT>>                            15655000
         @ENTP:=FWDLINK;                                                15660000
       END; <<WHILE>>                                                   15665000
     <<PROCEDURE NOT ALLOCATED>>                                        15670000
GETOUTERR:                                                              15675000
     CONDCODE:=CCL;                                                     15680000
     ERROR:=ERR86;                                                      15685000
GETOUT:                                                                 15690000
     RELSIR(SEGTABSIR,SAVESIR);                                         15695000
     EXCHANGEDB(SAVEDB);                                                15700000
     DEALLOCATEPROC:=ERROR;                                             15705000
   END;                                                                 15710000
LOGICAL PROCEDURE FINDPHYCSTMATCH;                                      15715000
  OPTION UNCALLABLE,PRIVILEGED;                                         15720000
  <<SEARCH SEGLIST OF SL ENTRY FOR MATCHING >>                          15725000
  <<SEGMENT NUMBER                          >>                          15730000
  <<                                        >>                          15735000
  <<INPUT: SI = POINTER TO HEAD OF SL ENTRY >>                          15740000
  <<       SJ = SEGMENT NUMB TO BE MATCHED  >>                          15745000
  <<                                        >>                          15750000
  <<OUTPUT: TRUE IF MATCH FOUND             >>                          15755000
  <<        - SK=LOG SEG #(FINDPHYCSTMATCH) >>                          15760000
  <<        - SK=PHY CST #(FINDLOGSEGMATCH) >>                          15765000
  <<                                        >>                          15770000
  <<        - SL=PTR TO SEGLIST ENTRY       >>                          15775000
  <<                                        >>                          15780000
  <<        FALSE IF NO MATCH FOUND         >>                          15785000
  <<                                        >>                          15790000
  <<*NOTE* ASSUMES DB IS AT THE LST         >>                          15795000
  <<                                        >>                          15800000
  BEGIN                                                                 15805000
    ENTRY FINDLOGSEGMATCH;                                              15810000
    LOGICAL PHY;                                                        15815000
    INTEGER POINTER PSEGLIST,PEND;                                      15820000
    PHY:=TRUE;                                                          15825000
    GO START;                                                           15830000
FINDLOGSEGMATCH:                                                        15835000
    PHY:=FALSE;                                                         15840000
START:                                                                  15845000
    @PSEGLIST:=SI+21; <<PTR TO FIRST SEGLIST>>                          15850000
    @PEND:=@PSEGLIST+PSI(4).(8:8)*3; <<END SEGLIST>>                    15855000
    WHILE @PSEGLIST < @PEND DO                                          15860000
      BEGIN           <<SEARCH ALL SEGLIST ENTRIES>>                    15865000
        IF PHY THEN                                                     15870000
          BEGIN       <<TRY TO MATCH PHYSICAL CST #>>                   15875000
            IF SJ = PSEGLIST(2) THEN                                    15880000
              BEGIN       <<CST'S MATCH>>                               15885000
                SL:=@PSEGLIST;      <<RETURN PTR>>                      15890000
                SK:=PSEGLIST.(0:8); <<LOG SEG NR>>                      15895000
                FINDPHYCSTMATCH:=TRUE;                                  15900000
                RETURN;                                                 15905000
              END;                                                      15910000
          END                                                           15915000
         ELSE                                                           15920000
          BEGIN       <<TRY TO MATCH LOGICAL SEG #>>                    15925000
            IF SJ = PSEGLIST.(0:8) THEN                                 15930000
              BEGIN       <<SEG'S MATCH>>                               15935000
                SL:=@PSEGLIST;   <<RETURN PTR>>                         15940000
                SK:=PSEGLIST(2); <<PHY CST #>>                          15945000
                FINDPHYCSTMATCH:=TRUE;                                  15950000
                RETURN;                                                 15955000
              END;                                                      15960000
          END;                                                          15965000
        @PSEGLIST:=@PSEGLIST+3;  <<NEXT ENTRY>>                         15970000
      END; <<WHILE>>                                                    15975000
    FINDPHYCSTMATCH:=FALSE;                                             15980000
  END; <<FINDPHYCSTMATCH>>                                              15985000
LOGICAL PROCEDURE SCANSLINFOAREAS(PSLINFO,NSLINFO,SEGNR,PHY);           15990000
  VALUE PSLINFO,NSLINFO,SEGNR,PHY;                                      15995000
  INTEGER NSLINFO,SEGNR;                                                16000000
  INTEGER POINTER PSLINFO;                                              16005000
  LOGICAL PHY;                                                          16010000
  OPTION PRIVILEGED,UNCALLABLE;                                <<*7861>>16015000
  <<THE SLINFO AREAS ARE SCANNED LOOKING FOR     >>                     16020000
  <<A MATCH ON THE SEGNR                         >>                     16025000
  <<                                             >>                     16030000
  <<INPUT: PSLINFO = POINTER TO 1ST SL INFO AREA >>                     16035000
  <<       NSLINFO = NUMBER OF SL INFO AREAS     >>                     16040000
  <<       SEGNR  = PHYSICAL CST # BEING MATCHED >>                     16045000
  <<                IF PHY=TRUE                  >>                     16050000
  <<       SEGNR  = LOGICAL SEG # BEING MATCHED  >>                     16055000
  <<                IF PHY=FALSE                 >>                     16060000
  <<                                             >>                     16065000
  <<OUTPUT: TRUE IF MATCH FOUND                  >>                     16070000
  <<        IF PHY=TRUE                          >>                     16075000
  <<         -SK = LOGICAL SEG NUMBER            >>                     16080000
  <<         -SL = SL TYPE                       >>                     16085000
  <<        IF PHY=FALSE                         >>                     16090000
  <<         -SK = PHYSICAL CST #                >>                     16095000
  <<         -SL = GARBAGE                       >>                     16100000
  <<                                             >>                     16105000
  <<        FALSE IF NO MATCH FOUND              >>                     16110000
  <<                                             >>                     16115000
  <<*NOTE* ASSUMES DB IS AT THE LST              >>                     16120000
  <<       LST ENTP POINTERS ARE PRESERVED       >>                     16125000
  <<                                             >>                     16130000
  BEGIN                                                                 16135000
    TOS:=@ENTP;       <<SAVE POINTERS>>                                 16140000
    TOS:=@ENTP1;                                                        16145000
    TOS:=@ENTP2;                                                        16150000
    TOS:=@ENTP3;                                                        16155000
    WHILE (NSLINFO:=NSLINFO-1) >= 0 DO                                  16160000
      BEGIN           <<SEARCH EACH SLINFO AREA>>                       16165000
        TOS:=0;       <<LSEARCH RESULT>>                                16170000
        TOS:=PSLINFO(1); <<SLID>>                                       16175000
        TOS:=PSLINFO(2); <<SLID>>                                       16180000
        IF LSEARCH(*,NORMAL,SLFILE) THEN                                16185000
          BEGIN       <<FOUND SL ENTRY>>                                16190000
            SI:=@ENTP;   <<PTR TO SL ENTRY>>                            16195000
            SJ:=SEGNR;  <<CST TO MATCH>>                                16200000
            IF PHY THEN                                                 16205000
              BEGIN     <<TRY MATCH ON PHYSICAL CST #>>                 16210000
                IF FINDPHYCSTMATCH THEN                                 16215000
                  BEGIN      <<FOUND MATCH>>                            16220000
                    SL:=PSLINFO; <<SL TYPE>>                            16225000
                    SCANSLINFOAREAS:=TRUE;                              16230000
                    GO TO GETOUT;                                       16235000
                  END;                                                  16240000
              END                                                       16245000
             ELSE                                                       16250000
              BEGIN     <<TRY MATCH ON LOG SEG #>>                      16255000
                <<VERIFY LOGSEG WAS REFERENCED >>                       16260000
                TOS:=0; <<TESTBIT RESULT>>                              16265000
                TOS:=@ENTP2; <<LOGSEG ARRAY>>                  <<07316>>16270000
                IF TESTBIT(*,SEGNR) AND                                 16275000
                   FINDLOGSEGMATCH THEN                                 16280000
                  BEGIN         <<FOUND MATCH>>                         16285000
                    SCANSLINFOAREAS:=TRUE;                              16290000
                    GO GETOUT;                                          16295000
                  END;                                                  16300000
              END;                                                      16305000
          END;                                                          16310000
        @PSLINFO:=@PSLINFO+19; <<NEXT SL INFO AREA>>                    16315000
      END; <<WHILE>>                                                    16320000
    SCANSLINFOAREAS:=FALSE; <<NO MATCH FOUND>>                          16325000
GETOUT:                                                                 16330000
    @ENTP3:=TOS;                                                        16335000
    @ENTP2:=TOS;    <<RESTORE POINTERS>>                                16340000
    @ENTP1:=TOS;                                                        16345000
    @ENTP:=TOS;                                                         16350000
  END; <<SCANSLINFOAREAS>>                                              16355000
DOUBLE PROCEDURE LOGICALCST'(SEG'NR,PINX);                     <<06901>>16360000
  VALUE SEG'NR,PINX;                                                    16365000
  INTEGER SEG'NR,PINX;                                                  16370000
  <<RETURN THE SEGMENT NUMBER AND SEGMENT TYPE>>                        16375000
  <<CORRESPONDING TO THE PLABEL               >>                        16380000
  <<                                          >>                        16385000
  <<RETURN: S-0 LOGICAL SEGMENT NO.           >>                        16390000
  <<        S-1 SOURCE OF SEGMENT             >>                        16395000
  <<            =0 SYSTEM SL                  >>                        16400000
  <<            =1 PUB SL                     >>                        16405000
  <<            =2 GROUP SL                   >>                        16410000
  <<            =14 PROG FILE                 >>                        16415000
  <<                                          >>                        16420000
  <<INPUT: SEG'NR = CODE SEGMENT             >>                         16425000
  <<                (0:1)-MAPPING FLAG       >>                         16430000
  <<                      (IGNORED IF NO MAPPING>>                      16435000
  <<                      (FIRMWARE          >>                         16440000
  <<                      =1 PHYSICALLY MAPPED>>                        16445000
  <<                         SEG'NR.(1:15)=  >>                         16450000
  <<                         PHYSICAL CST #  >>                         16455000
  <<                      =0 LOGICALLY MAPPED>>                         16460000
  <<                         SEG'NR.(8:8)=   >>                         16465000
  <<                         LOGICAL CST #   >>                         16470000
  <<       PINX  = THE PROCESS INDEX          >>                        16475000
  <<               TO BE USED                 >>                        16480000
  <<               =0 USE CURRENT PROCESS     >>                        16485000
  <<                                          >>                        16490000
  BEGIN                                                                 16495000
    INTEGER PCBPT = PINX;                                               16500000
    INTEGER CSTNR,NSLINFO,SAVEDST,SAVESIR;                              16505000
    INTEGER SEGMAPDST,BLKIDX;                                           16510000
    INTEGER POINTER PSLINFO;                                            16515000
    INTEGER SLTYPE=LOGICALCST', <<RETURN>>                     <<06901>>16520000
            LOGSEG=SLTYPE+1;   <<VALUES>>                               16525000
    INTEGER POINTER TENTP,TENTP1,TENTP2,TENTP3;                <<06741>>16530000
    SUBROUTINE GET'LSTSIR'DST;                                          16535000
      <<GET LST SIR AND DST>>                                           16540000
      BEGIN                                                             16545000
        SAVESIR:=GETSIR(SEGTABSIR);                                     16550000
        SAVEDST:=EXCHANGEDB(SEGTABDST);                                 16555000
        @TENTP := @ENTP;                                       <<06741>>16560000
        @TENTP1 := @ENTP1;                                     <<06741>>16565000
        @TENTP2 := @ENTP2;                                     <<06741>>16570000
        @TENTP3 := @ENTP3;                                     <<06741>>16575000
      END;  <<GET'LSTSIR'DST>>                                          16580000
                                                                        16585000
    SUBROUTINE REL'LSTSIR'DST;                                          16590000
      <<RELEASE LST SIR AND DST>>                                       16595000
      BEGIN                                                             16600000
        @ENTP := @TENTP;                                       <<06741>>16605000
        @ENTP1 := @TENTP1;                                     <<06741>>16610000
        @ENTP2 := @TENTP2;                                     <<06741>>16615000
        @ENTP3 := @TENTP3;                                     <<06741>>16620000
        EXCHANGEDB(SAVEDST);                                            16625000
        RELSIR(SEGTABSIR,SAVESIR);                                      16630000
      END;  <<REL'LSTSIR'DST>>                                          16635000
                                                                        16640000
    SUBROUTINE SEARCHSYSSL;                                             16645000
      <<SEARCH SYS SL FOR CSTNR>>                                       16650000
      BEGIN                                                             16655000
        TOS:=0;                 <<LSEARCH RESULT>>                      16660000
        TOS:=ABSOLUTE(SSLKEYA);  <<SYS SL>>                             16665000
        TOS:=ABSOLUTE(XREG:=XREG+1); <<SLID>>                           16670000
        IF LSEARCH(*,NORMAL,SLFILE) THEN                                16675000
          BEGIN                 <<ENTRY FOUND>>                         16680000
            SI:=@ENTP;          <<ENTRY PTR>>                           16685000
            SJ:=CSTNR;         <<CST TO MATCH>>                         16690000
            IF FINDPHYCSTMATCH THEN                                     16695000
              BEGIN             <<FOUND MATCH>>                         16700000
                SLTYPE:=0;                                              16705000
                LOGSEG:=SK;                                             16710000
                CONDCODE:=CCE;                                          16715000
              END;                                                      16720000
          END;                                                          16725000
      END; <<SEARCHSYSSL>>                                              16730000
    SUBROUTINE SEARCHPROGENTRY;                                         16735000
      <<SEARCH ALL SL INFO AREAS IN PROGFILE ENTRY>>                    16740000
      BEGIN                                                             16745000
        IF LSEARCH(DOUBLE(LOGICAL(PINX/PCBSIZE)),ANYMODE,      <<07316>>16750000
                                     SHARER) THEN                       16755000
          BEGIN                <<SHARER ENTRY FOUND>>                   16760000
            IF LSEARCH(EFID,EPMODE,PROGFILE) THEN                       16765000
              BEGIN            <<PROGFILE ENTRY FOUND>>                 16770000
                @PSLINFO:=@ENTP2; <<PTR TO SLINFO AREA>>                16775000
                NSLINFO:=ESLINFO'PROG;<<# SLINFO AREAS>>                16780000
                TOS:=0; <<SCANSLINFOAREAS RESULT>>                      16785000
                TOS:=@PSLINFO;                                          16790000
                IF SCANSLINFOAREAS(*,NSLINFO,CSTNR,TRUE) THEN           16795000
                  BEGIN          <<FOUND MATCH>>                        16800000
                    SLTYPE:=SL;                                         16805000
                    LOGSEG:=SK;                                         16810000
                    CONDCODE:=CCE;                                      16815000
                  END;                                                  16820000
              END;                                                      16825000
          END                                                           16830000
         ELSE                                                           16835000
          BEGIN                <<SHARER ENTRY NOT FOUND>>               16840000
            <<TRY SEARCH OF SYSTEM SL>>                                 16845000
            SEARCHSYSSL;                                                16850000
          END;                                                          16855000
      END;  <<SEARCHPROGENTRY>>                                         16860000
    <<ENTRY HERE>>                                                      16865000
    SLTYPE:=0;          <<INITIAL VALUES>>                              16870000
    LOGSEG:=0;                                                          16875000
    CONDCODE:=CCL;                                                      16880000
    IF PINX = 0 AND CURPRC <> 0 THEN                           <<06648>>16885000
       PINX := CURPRC;                                         <<06648>>16890000
       IF PINX <> 0 THEN                                       <<*7861>>16895000
          IF PINX MOD PCBSIZE <> 0 OR PQPTR = -1 THEN          <<*7861>>16900000
             BEGIN                                             <<*7861>>16905000
             CONDCODE := CCG;                                  <<*7861>>16910000
             RETURN;                                           <<*7861>>16915000
             END;                                              <<*7861>>16920000
                                                               <<*7861>>16925000
    IF LOGICALMAPPING THEN                                              16930000
      BEGIN               <<MAPPING FIRMWARE PRESENT>>                  16935000
        IF PINX = 0 THEN                                                16940000
          BEGIN           <<NO PIN FOR MAPPING>>                        16945000
            IF SEG'NR < 0 THEN                                          16950000
              BEGIN       <<PHYSICALLY MAPPED>>                         16955000
                CSTNR:=SEG'NR.(1:15);                                   16960000
                IF CSTNR=0 THEN RETURN; <<BAD CST #>>                   16965000
                GET'LSTSIR'DST; <<GET SIR,DST>>                         16970000
                SEARCHSYSSL;   <<SEARCH SYS SL ONLY>>                   16975000
                REL'LSTSIR'DST; <<RELEASE SIR,DST>>                     16980000
              END;                                                      16985000
          END ELSE                                                      16990000
          BEGIN           <<PIN AVAILABLE FOR MAPPING>>                 16995000
            IF SEG'NR < 0 THEN                                          17000000
              BEGIN       <<PHYSICALLY MAPPED>>                         17005000
                CSTNR:=SEG'NR.(1:15);                                   17010000
                IF CSTNR=0 THEN RETURN; <<BAD CST #>>                   17015000
                GET'LSTSIR'DST; <<GET SIR,DST>>                         17020000
                SEARCHPROGENTRY;<<SEARCH ALL REF'ED SL'S>>              17025000
                REL'LSTSIR'DST; <<RELEASE SIR,DST>>                     17030000
              END ELSE                                                  17035000
              BEGIN       <<LOGICALLY MAPPED>>                          17040000
                CSTNR:=SEG'NR.(8:8);                                    17045000
                IF CSTNR=0 THEN RETURN; <<BAD CST #>>                   17050000
                BLKIDX := SPCBPBX; <<CSTX BLK>>                         17055000
                PDISABLE;                                      <<06528>>17060000
                TOS := IF BLKIDX <> 0 AND                      <<06528>>17065000
                          ABS(CSTEXT(BLKIDX)+ABS(DSTB))        <<06528>>17070000
                          >= CSTNR THEN 1 ELSE 0;              <<06528>>17075000
                PENABLE;                                       <<06528>>17080000
                IF TOS = 1 THEN                                <<06528>>17085000
                  BEGIN  <<PROGRAM SEGMENT>>                            17090000
                    SLTYPE:=14;                                         17095000
                    LOGSEG:=CSTNR-1;                                    17100000
                    CONDCODE:=CCE;                                      17105000
                  END                                                   17110000
                 ELSE                                                   17115000
                  BEGIN  <<SL SEGMENT>>                                 17120000
                    <<MUST USE SEGMAP>>                                 17125000
                    SEGMAPDST := SPCBMAPDST;                            17130000
                    IF SEGMAPDST=0 THEN RETURN;<<BAD CST #>>            17135000
                    SAVEDST:=EXCHANGEDB(SEGMAPDST);                     17140000
                    IF CSTNR <= SEGMAP.(8:8) THEN                       17145000
                      BEGIN  <<VALID CST #>>                            17150000
                        <<GET TRUE PHYSICAL CST #>>                     17155000
                        CSTNR:=SEGMAP(CSTNR&LSL(1));                    17160000
                        EXCHANGEDB(SAVEDST);                            17165000
                        IF CSTNR=0 THEN RETURN;<<INVALIC CST#>>         17170000
                        GET'LSTSIR'DST; <<GET SIR,DST>>                 17175000
                        SEARCHPROGENTRY;                                17180000
                        REL'LSTSIR'DST; <<RELEASE SIR,DST>>             17185000
                      END ELSE                                          17190000
                      BEGIN              <<INVALID CST>>                17195000
                        EXCHANGEDB(SAVEDST);                            17200000
                      END;                                              17205000
                  END;                                                  17210000
              END;                                                      17215000
          END;                                                          17220000
      END ELSE                                                          17225000
      BEGIN               <<NO MAPPING FIRMWARE>>                       17230000
       CSTNR:=SEG'NR.(8:8);                                             17235000
       IF CSTNR=0 THEN RETURN; <<BAD CST #>>                            17240000
        IF CSTNR > %300 THEN                                            17245000
          BEGIN           <<PROG SEG>>                                  17250000
            SLTYPE:=14;                                                 17255000
            LOGSEG:=CSTNR-%301;                                         17260000
            IF PINX <> 0 THEN                                           17265000
              BEGIN       <<PIN AVAILABLE FOR CHECKING>>                17270000
                BLKIDX := SPCBPBX;                                      17275000
                PDISABLE;                                      <<06528>>17280000
                IF ABSOLUTE(CSTEXT(BLKIDX)+                             17285000
                            ABSOLUTE(DSTB)) >= CSTNR-%300               17290000
                  THEN CONDCODE:=CCE; <<VALID CST #>>                   17295000
                PENABLE;                                       <<06528>>17300000
              END;                                                      17305000
          END ELSE                                                      17310000
          BEGIN           <<SL SEG>>                                    17315000
            IF CSTNR = %300 THEN RETURN; <<INVALID CST #>>              17320000
            GET'LSTSIR'DST; <<GET SIR,DST>>                             17325000
            IF PINX = 0                                                 17330000
              THEN SEARCHSYSSL  <<USE SYS SL ONLY>>                     17335000
              ELSE SEARCHPROGENTRY; <<USE ALL REF'ED SL'S>>             17340000
            REL'LSTSIR'DST; <<RELEASE SIR,DST>>                         17345000
          END;                                                          17350000
      END;                                                              17355000
  END; <<LOGICALCST>>                                                   17360000
DOUBLE PROCEDURE LOGICALCST(SEG'NR);                           <<06901>>17365000
   VALUE SEG'NR;                                               <<06901>>17370000
   INTEGER SEG'NR;                                             <<06901>>17375000
   << INTERFACE ROUTINE TO LOGICALCST' PROCEDURE >>            <<06901>>17380000
   << IT HAS THE SAME EXTERNAL SPEC. AS IN MPE IV>>            <<06901>>17385000
   << THIS PROCEDURE CALLS LOGICALCST' WITH PINX >>            <<06901>>17390000
   << =0.                                        >>            <<06901>>17395000
                                                               <<06901>>17400000
   BEGIN                                                       <<06901>>17405000
      INTEGER SEGTYPE = LOGICALCST;                            <<06901>>17410000
                                                               <<06901>>17415000
      LOGICALCST := LOGICALCST'(SEG'NR,0);                     <<06901>>17420000
      IF < THEN                                                <<06901>>17425000
         CONDCODE := CCL                                       <<06901>>17430000
      ELSE                                                     <<06901>>17435000
         IF > THEN                                             <<06901>>17440000
            CONDCODE := CCG                                    <<06901>>17445000
         ELSE                                                  <<06901>>17450000
            BEGIN                                              <<06901>>17455000
               CONDCODE := CCE;                                <<06901>>17460000
               IF SEGTYPE = 14 THEN                            <<06901>>17465000
                  SEGTYPE := 3;                                <<06901>>17470000
            END;                                               <<06901>>17475000
   END;                                                        <<06901>>17480000
DOUBLE PROCEDURE LOGICALCST''(SEG'NR,PINNR);                   <<07317>>17485000
   VALUE SEG'NR,PINNR;                                         <<07317>>17490000
   INTEGER SEG'NR,PINNR;                                       <<07317>>17495000
   << INTERFACE ROUTINE TO LOGICALCST' USING PIN NUMBER >>     <<07317>>17500000
                                                               <<07317>>17505000
   BEGIN                                                       <<07317>>17510000
   LOGICALCST'':=LOGICALCST'(SEG'NR,PINNR*PCBSIZE);            <<07317>>17515000
   PUSH(STATUS);                                               <<07317>>17520000
   TOS:=TOS.(6:2);                                             <<07317>>17525000
   CONDCODE:=TOS;                                              <<07317>>17530000
   END;                                                        <<07317>>17535000
INTEGER PROCEDURE PHYSICALCST(PIN,SEGMENTNR);                           17540000
  <<RETURNS THE PHYSICAL CST # CORRESPONDING TO THE>>                   17545000
  <<GIVEN SEGMENT NUMBER IN THE GIVEN SOURCE FILE  >>                   17550000
  <<CORRESPONDING TO THE GIVEN PIN.                >>                   17555000
  <<                                               >>                   17560000
  <<RETURN: PHYSICAL CST #                         >>                   17565000
  <<                                               >>                   17570000
  <<INPUT:  PIN <> 0 USE PROGFILE ENTRY            >>                   17575000
  <<            =  0 USE SYS SL ONLY               >>                   17580000
  <<                                               >>                   17585000
  <<        SEGMENTNR.(0:4) = SOURCE FILE          >>                   17590000
  <<                          0-SYSTEM SL          >>                   17595000
  <<                          1-PUBLIC SL          >>                   17600000
  <<                          2-GROUP SL           >>                   17605000
  <<                         14-PROGRAM            >>                   17610000
  <<        SEGMENTNR.(8:8) = LOGICAL SEG #        >>                   17615000
  <<                                               >>                   17620000
  <<THIS PROCEDURE MAY BE CALLED IN SPLIT STACK    >>                   17625000
  <<                                               >>                   17630000
  VALUE PIN,SEGMENTNR;                                                  17635000
  INTEGER PIN,SEGMENTNR;                                                17640000
  OPTION UNCALLABLE,PRIVILEGED;                                         17645000
  BEGIN                                                                 17650000
    DOUBLE SLKEY;                                                       17655000
    INTEGER SAVEENTP,SAVEDB,SAVESIR;                                    17660000
    INTEGER POINTER TENTP,TENTP1,TENTP2,TENTP3;                <<06741>>17665000
    DEFINE LOGSEG = SEGMENTNR.(8:8)#, <<LOG SEG #>>                     17670000
           SLTYPE = SEGMENTNR.(0:4)#; <<SOURCE>>                        17675000
                                                                        17680000
    LOGICAL SUBROUTINE SCANSLENTRY;                                     17685000
      <<RETURN TRUE IF MATCH ON LOGSEG # IN SL ENTRY>>                  17690000
      BEGIN                                                             17695000
        SCANSLENTRY:=FALSE;                                             17700000
        IF LSEARCH(SLKEY,NORMAL,SLFILE) THEN                            17705000
          BEGIN   <<SL ENTRY EXISTS>>                                   17710000
            <<SEARCH SEGLIST ENTRIES FOR MATCH>>                        17715000
            <<ON LOG SEG #                    >>                        17720000
            SI:=@ENTP;    <<PTR TO SL ENTRY>>                           17725000
            SJ:=LOGSEG;   <<LOG SEG #>>                                 17730000
            IF FINDLOGSEGMATCH THEN SCANSLENTRY:=TRUE;                  17735000
          END;                                                          17740000
      END; <<SCANSLENTRY>>                                              17745000
    LOGICAL SUBROUTINE MATCHED;                                         17750000
      <<RETURN TRUE IF MATCH ON LOGSEG # USING SPECIFIC>>               17755000
      <<SLINFOAREA IN PROGFILE OR EXTENSION ENTRY      >>               17760000
      BEGIN                                                             17765000
        IF ETYPE = PROGFILE                                             17770000
          THEN SL:=ESLINFO'PROG                                         17775000
          ELSE SL:=ESLINFO'EXT;                                         17780000
        <<FIND PROPER SLINFOAREA>>                                      17785000
        @ENTP2:=@ENTP2+(SL-1)*19;                                       17790000
        WHILE (SL:=SL-1) >= 0 AND                                       17795000
              ENTP2 <> SLTYPE DO                                        17800000
          BEGIN                                                         17805000
            @ENTP2:=@ENTP2-19;                                          17810000
          END;                                                          17815000
        IF SL >= 0 AND                                                  17820000
           SCANSLINFOAREAS(ENTP2,1,LOGSEG,FALSE)                        17825000
          THEN MATCHED:=TRUE                                            17830000
          ELSE MATCHED:=FALSE;                                          17835000
      END; <<MATCHED>>                                                  17840000
    SAVESIR:=GETSIR(SEGTABSIR);                                         17845000
    SAVEDB:=EXCHANGEDB(SEGTABDST);                                      17850000
    @TENTP := @ENTP;                                           <<06741>>17855000
    @TENTP1 := @ENTP1;                                         <<06741>>17860000
    @TENTP2 := @ENTP2;                                         <<06741>>17865000
    @TENTP3 := @ENTP3;                                         <<06741>>17870000
    IF PIN = 0 THEN                                                     17875000
      BEGIN         <<EXAMINE SYS SL ONLY>>                             17880000
        TOS:=ABS(SSLKEYA); <<GET SYS SL KEY>>                           17885000
        TOS:=ABS(XREG:=XREG+1);                                         17890000
        SLKEY:=TOS;                                                     17895000
        IF SCANSLENTRY THEN                                             17900000
          BEGIN     <<FOUND MATCH>>                                     17905000
            PHYSICALCST:=SK;                                            17910000
            CONDCODE:=CCE;                                              17915000
          END                                                           17920000
         ELSE                                                           17925000
          BEGIN     <<NO MATCH>>                                        17930000
            PHYSICALCST:=0;                                             17935000
            CONDCODE:=CCG;                                              17940000
          END;                                                          17945000
      END                                                               17950000
     ELSE                                                               17955000
      BEGIN         <<USE PIN'S REF'ED SEGMENTS>>                       17960000
        IF LSEARCH(DOUBLE(LOGICAL(PIN)),ANYMODE,SHARER) AND             17965000
           LSEARCH(EFID,EPMODE,PROGFILE) THEN                           17970000
          BEGIN     <<FOUND PIN'S PROGFILE ENTRY>>                      17975000
            IF SLTYPE = 14 THEN                                         17980000
              BEGIN <<SOURCE=PROGRAM>>                                  17985000
                IF LOGSEG < ESEG THEN                                   17990000
                  BEGIN         <<VALID LOGSEG>>                        17995000
                    IF LOGICALMAPPING                                   18000000
                      THEN PHYSICALCST:=LOGSEG+1                        18005000
                      ELSE PHYSICALCST:=LOGSEG+%301;                    18010000
                    CONDCODE:=CCE;                                      18015000
                  END                                                   18020000
                 ELSE                                                   18025000
                  BEGIN         <<INVALID LOGSEG>>                      18030000
                    PHYSICALCST:=0;                                     18035000
                    CONDCODE:=CCG;                                      18040000
                  END;                                                  18045000
              END                                                       18050000
             ELSE                                                       18055000
              BEGIN <<SOURCE=SL>>                                       18060000
                <<TRY TO FIND MATCH USING PROGFILE ENTRY>>              18065000
                IF MATCHED THEN                                         18070000
                  BEGIN  <<FOUND MATCH>>                                18075000
                    PHYSICALCST:=SK;                                    18080000
                    CONDCODE:=CCE;                                      18085000
                  END                                                   18090000
                 ELSE                                                   18095000
                  BEGIN  <<NO MATCH>>                                   18100000
                    <<TRY TO FIND MATCH USING EXTENSION ENTRY>>         18105000
                    EXCHANGEDB(SEGTABDST'EX);                  <<06542>>18110000
                    @ENTP:=HDFWDLINK(EXTENSION);                        18115000
                    WHILE @ENTP <> 0 DO                                 18120000
                      BEGIN                                             18125000
                        <<SEARCH EACH EXTENSION ENTRY>>                 18130000
                        IF EPIN = PIN THEN                              18135000
                          BEGIN  <<FOUND EXTENSION FOR PIN>>            18140000
                            TRANS'XDST'TO'LST;                 <<06542>>18145000
                            IF <> THEN                         <<06542>>18150000
                               BEGIN                           <<06542>>18155000
                                  CONDCODE := CCL;             <<06542>>18160000
                                  GO GETOUT;                   <<06542>>18165000
                               END;                            <<06542>>18170000
                            EXCHANGEDB(SEGTABDST);             <<06542>>18175000
                            SAVEENTP:=@ENTP;                            18180000
                            SETSECPTRS;                                 18185000
                            IF MATCHED THEN                             18190000
                              BEGIN <<FOUND MATCH>>                     18195000
                                PHYSICALCST:=SK;                        18200000
                                CONDCODE:=CCE;                          18205000
                                @ENTP:=SAVEENTP;               <<06542>>18210000
                                LDELETE;                       <<06542>>18215000
                                GO GETOUT;                              18220000
                              END;                                      18225000
                            @ENTP:=SAVEENTP;                            18230000
                            LDELETE;                           <<06542>>18235000
                            EXCHANGEDB(SEGTABDST'EX);          <<06542>>18240000
                          END;                                          18245000
                        @ENTP:=ENTP(FWDLINK); <<NEXT EXT>>              18250000
                      END; <<WHILE>>                                    18255000
                    <<NO MATCH IN EXTENSION ENTRIES>>                   18260000
                    PHYSICALCST:=0;                                     18265000
                    CONDCODE:=CCG;                                      18270000
                  END;                                                  18275000
              END;                                                      18280000
          END                                                           18285000
         ELSE                                                           18290000
          BEGIN     <<NO PROGFILE ENTRY--INVALID PIN>>                  18295000
            PHYSICALCST:=0;                                             18300000
            CONDCODE:=CCL;                                              18305000
          END;                                                          18310000
      END;                                                              18315000
GETOUT:                                                                 18320000
    @ENTP := @TENTP;                                           <<06741>>18325000
    @ENTP1 := @TENTP1;                                         <<06741>>18330000
    @ENTP2 := @TENTP2;                                         <<06741>>18335000
    @ENTP3 := @TENTP3;                                         <<06741>>18340000
    RELSIR(SEGTABSIR,SAVESIR);                                          18345000
    EXCHANGEDB(SAVEDB);                                                 18350000
  END;                                                                  18355000
PROCEDURE PROCFILE (PIN,FNAME);                                         18360000
   COMMENT:                                                             18365000
      RETURNS PROGRAM FILE NAME CORRESPONDING TO "PIN".                 18370000
      "FNAME" MUST BE AT LEAST 28 BYTES LONG.  (THIS IS                 18375000
      IN PART A CARRY-OVER FROM A PREVIOUS IMPLEMENTATION               18380000
      WHICH CALLED "FGETINFO".  IT ALSO ENSURES AT LEAST                18385000
      ONE BLANK AFTER THE FILE NAME FOR SCANNING PURPOSES.)             18390000
      NAME IS FULLY QUALIFIED AND PACKED WITH TRAILING                  18395000
      BLANKS.  NOTE SPECIAL FORMAT FOR SYSTEM PROCESSES.                18400000
                                                                        18405000
      DB MUST POINT TO STACK.                                           18410000
                                                                        18415000
      OUTPUT DEPENDS ON CONDITION CODE:                                 18420000
         CCE -- NO ERROR ... "FNAME" CONTAINS PROGRAM NAME              18425000
         CCG -- SYSTEM PROCESS ... "FNAME" CONTAINS "C.I."              18430000
                OR "SYS.PROC." DEPENDING ON PROCESS TYPE                18435000
         CCL -- INVALID PIN OR FILE I/O ERROR ... "FNAME"               18440000
                CONTAINS BLANKS                                         18445000
      ;                                                                 18450000
   VALUE PIN;                                                           18455000
   INTEGER PIN;                                                         18460000
   BYTE ARRAY FNAME;                                                    18465000
   OPTION PRIVILEGED, UNCALLABLE;                                       18470000
   BEGIN                                                                18475000
   INTEGER POINTER PCB= 3; <<SYS GLOB+3>>                               18480000
   DEFINE NUMPCBS= PCB(0) #,                                            18485000
          PTYPE = PCB(PIN * PCBSIZE +                          <<06648>>18490000
                      PROCSTATEWORDNUM).PTYPEFIELD#;           <<07427>>18495000
                                                                        18500000
   EQUATE FLSIZE= 128;                                                  18505000
   INTEGER ARRAY FLAB(0:FLSIZE-1);                                      18510000
   BYTE ARRAY BFLAB(*)= FLAB;                                           18515000
   DEFINE FLBLOCNAME=  BFLAB #,                                         18520000
          FLBGRPNAME=  BFLAB(8) #,                                      18525000
          FLBACCTNAME= BFLAB(16) #;                                     18530000
   EQUATE MINPIN = 1;                                          <<06102>>18535000
   INTEGER LDEV;                                                        18540000
   DOUBLE DISCADDR;                                                     18545000
   BYTE DALDEV= DISCADDR; <<LDEV IN LST ENTRY>>                         18550000
   INTEGER POINTER TENTP,TENTP1,TENTP2,TENTP3;                 <<06741>>18555000
                                                                        18560000
                                                                        18565000
   FNAME:=" ";   MOVE FNAME(1):=FNAME,(27);                             18570000
   TOS := SEGTABSIR;                                                    18575000
   TOS := GETSIR(SEGTABSIR);  <<GET SEGMENT TABLE SIR>>                 18580000
   TOS := 0;  <<FOR RESULT OF EXCHANGEDB>>                              18585000
   TOS := EXCHANGEDB(SEGTABDST);  <<SET DB TO SEGMENT TABLE>>           18590000
   @TENTP := @ENTP;                                            <<06741>>18595000
   @TENTP1 := @ENTP1;                                          <<06741>>18600000
   @TENTP2 := @ENTP2;                                          <<06741>>18605000
   @TENTP3 := @ENTP3;                                          <<06741>>18610000
   IF LSEARCH(DOUBLE(LOGICAL(PIN)),ANYMODE,SHARER) THEN                 18615000
      BEGIN                                                             18620000
DISCADDR:=ENTDP1; <<FILE KEY>>                                          18625000
      @ENTP := @TENTP;                                         <<06741>>18630000
      @ENTP1 := @TENTP1;                                       <<06741>>18635000
      @ENTP2 := @TENTP2;                                       <<06741>>18640000
      @ENTP3 := @TENTP3;                                       <<06741>>18645000
      EXCHANGEDB(*);  <<RESET DB>>                                      18650000
      RELSIR(*,*);  <<RELEASE SEGMENT TABLE SIR>>                       18655000
      LDEV:=DALDEV;                                                     18660000
      DALDEV:=0;                                                        18665000
      IF FLABIO(LDEV,DISCADDR,0,FLAB)<>0 THEN TOS:=CCL                  18670000
      ELSE                                                              18675000
         BEGIN                                                          18680000
         MOVE FNAME:=FLBLOCNAME,(8);                                    18685000
         SCAN FNAME UNTIL " ",1;                                        18690000
         MOVE * := ".",2;                                               18695000
         MOVE BPS0:=FLBGRPNAME,(8);                                     18700000
         SCAN * UNTIL " ",1;                                            18705000
         MOVE * := ".",2;                                               18710000
         MOVE * := FLBACCTNAME,(8);                                     18715000
                                                                        18720000
         FLAB:=0;   MOVE FLAB(1):=FLAB,(FLSIZE-1);                      18725000
         TOS:=CCE;                                                      18730000
         END;                                                           18735000
      END                                                               18740000
   ELSE                                                                 18745000
      BEGIN                                                             18750000
      @ENTP := @TENTP;                                         <<06741>>18755000
      @ENTP1 := @TENTP1;                                       <<06741>>18760000
      @ENTP2 := @TENTP2;                                       <<06741>>18765000
      @ENTP3 := @TENTP3;                                       <<06741>>18770000
      EXCHANGEDB(*);  <<RESET DB>>                                      18775000
      RELSIR(*,*);  <<RELEASE SEGMENT TABLE SIR>>                       18780000
      IF NOT (MINPIN<=PIN<=NUMPCBS) THEN TOS:=CCL              <<06102>>18785000
      ELSE IF 2<=PTYPE<=3 THEN                                          18790000
         BEGIN                                                          18795000
         MOVE FNAME:="C.I.";                                            18800000
         TOS:=CCG;                                                      18805000
         END                                                            18810000
      ELSE IF > THEN                                                    18815000
         BEGIN                                                          18820000
         MOVE FNAME:="SYS.PROC.";                                       18825000
         TOS:=CCG;                                                      18830000
         END                                                            18835000
      ELSE TOS:=CCL;                                                    18840000
      END;                                                              18845000
   CONDCODE := TOS  <<STORE CONDITION CODE>>                            18850000
   END;                                                                 18855000
LOGICAL PROCEDURE LOADEDSLSEG(SLKEY,SEGMENTNR);                         18860000
  <<RETURNS TRUE IF THE SPECIFIED LOGICAL SEG>>                         18865000
  <<OF THE SPECIFIED SL IS CURRENTLY LOADED  >>                         18870000
  VALUE SLKEY,SEGMENTNR;                                                18875000
  DOUBLE SLKEY;                                                         18880000
  INTEGER SEGMENTNR;                                                    18885000
  OPTION UNCALLABLE;                                                    18890000
  BEGIN                                                                 18895000
    INTEGER SAVEDB,SAVESIR;                                             18900000
    LOADEDSLSEG:=FALSE;                                                 18905000
    SAVESIR:=GETSIR(SEGTABSIR);                                         18910000
    SAVEDB:=EXCHANGEDB(SEGTABDST);                                      18915000
    IF LSEARCH(SLKEY,NORMAL,SLFILE) THEN                                18920000
      BEGIN    <<SL ENTRY EXISTS>>                                      18925000
        <<CHECK SEG ARRAY TO DETERMINE>>                                18930000
        <<IF LOGSEG IS LOADED         >>                                18935000
        TOS:=0;      <<TESTBIT RESULT>>                                 18940000
        TOS:=@ENTP2; <<SEG ARRAY>>                                      18945000
        IF TESTBIT(*,SEGMENTNR) THEN LOADEDSLSEG:=TRUE;                 18950000
      END;                                                              18955000
    RELSIR(SEGTABSIR,SAVESIR);                                          18960000
    EXCHANGEDB(SAVEDB);                                                 18965000
  END;                                                                  18970000
PROCEDURE LOADPROCEDURE(ERROR,PROCNAME,LOADPROCID,PLABEL,               18975000
                        OPTION'NUMS,OPTIONS);                           18980000
  <<THIS IS AN EXTENSION OF LOADPROC         >>                         18985000
  <<                                         >>                         18990000
  <<INPUTS>>                                                            18995000
  BYTE ARRAY PROCNAME; <<PROCEDURE NAME>>                               19000000
  INTEGER ARRAY OPTION'NUMS; <<OPTION NUMBERS>>                         19005000
  LOGICAL ARRAY OPTIONS;     <<CORRESPONDING OPTIONS>>                  19010000
  <<OUTPUTS>>                                                           19015000
  INTEGER ERROR,             <<ERROR RETURN>>                           19020000
          LOADPROCID,        <<LOADPROC INDEX>>                         19025000
          PLABEL;            <<PROCEDURE LABEL>>                        19030000
  OPTION VARIABLE,PRIVILEGED,UNCALLABLE;                       <<06280>>19035000
  BEGIN                                                                 19040000
    <<LOCAL VARIABLES>>                                                 19045000
    LOGICAL OVMASK = Q-4;  <<OPTION VARIABLE MASK>>                     19050000
    INTEGER ARRAY QNAME(0:7)=Q;                                         19055000
    INTEGER LOADPROCFLAG',                                              19060000
            EXTIDX',                                                    19065000
            PLABEL',                                                    19070000
            SAVESIR,                                                    19075000
           PCBPT,                                              <<06648>>19080000
            SAVEDB,                                                     19085000
            OLDSEGMAPDST,                                               19090000
            NEWSEGMAPDST,                                               19095000
            LIBSEARCH,                                                  19100000
            LOADDOMAIN,                                                 19105000
            UNSATFLAG,                                                  19110000
            FLAGS,                                                      19115000
            COMMAND,                                                    19120000
            CHEKERR,                                                    19125000
            TEMP;                                                       19130000
    DOUBLE STK'LIMS;                                                    19135000
    INTEGER STK'LOLIM = STK'LIMS,                                       19140000
            STK'HILIM = STK'LIMS+1;                                     19145000
    LOGICAL ENDOFLIST;                                                  19150000
    BYTE POINTER LIBSCAN;                                               19155000
    LOGICAL SAVECRIT;                                                   19160000
    INTEGER POINTER PCBXFIXED,                                          19165000
                    AUXENTP,                                            19170000
                    AUXENTP1,                                           19175000
                    AUXENTP2,                                           19180000
                    AUXENTP3;                                           19185000
    DEFINE PCBX' = PUSH(DL);TOS:=TOS-PS0(-2);@PCBXFIXED:=TOS#,          19190000
           LOADPROCFLAG = PCBXFIXED(6).(15:1)#,                <<06666>>19195000
           SEGMAPFLAG = PCBXFIXED(6).(14:1)#,                  <<06666>>19200000
           FIRSTLOADPROC = LOADPROCFLAG'=0#;                            19205000
    DEFINE HAVE'OPTIONS = OVMASK.(14:2)=3#,                             19210000
           INVALID'OPTIONS = OVMASK.(14:2)=1 OR                         19215000
                             OVMASK.(14:2)=2#;                          19220000
    DEFINE CALLED'NONPM = STATUS.(0:1)=0#;<<MODE BIT>>                  19225000
                                                                        19230000
    EQUATE MAXLIBSEARCH = 2;                                            19235000
    EQUATE MAXOPTS = 3;                                                 19240000
                                                                        19245000
    EQUATE INTRIN'DATA = [10/85,6/7],       <<INTRINSIC DATA>>          19250000
           CHK'FLAG    = [8/0,2/0,1/0,5/6], <<CHEK FLAGS>>              19255000
           CHK'PARM= [2/2,2/2,2/2,2/2,2/3,2/2],<<CHEK PARMS>>           19260000
           CHK'OPTS    = [2/3];             <<CHEK OPTIONS>>            19265000
                                                                        19270000
    EQUATE ERR1 = 1, <<INVALID LOAD DOMAIN>>                            19275000
           ERR2 = 2, <<REQUIRED PARM MISSING>>                          19280000
           ERR3 = 3, <<REQUIRED PARM BAD ADDR>>                         19285000
           ERR4 = 4; <<INVALID OPTION>>                                 19290000
                                                                        19295000
SUBROUTINE RESETDBSIR;                                                  19300000
  BEGIN                                                                 19305000
    EXCHANGEDB(SAVEDB);                                                 19310000
    RELSIR(SEGTABSIR,SAVESIR);                                          19315000
  END; <<RESETDBSIR>>                                                   19320000
                                                                        19325000
SUBROUTINE CREATE'LPROCMASTER;                                          19330000
  <<BUILD LOADPROCMASTER ENTRY>>                                        19335000
  BEGIN                                                                 19340000
    LCREATE(SM,LOADPROCMASTER,NORMAL,0,DOUBLE(USERPIN));                19345000
    IF < THEN                                                           19350000
      BEGIN   <<NO ROOM>>                                               19355000
        RESETDBSIR;                                                     19360000
        ERROR:=ERR70;                                                   19365000
        GO RETURNERROR;                                                 19370000
      END;                                                              19375000
    <<CLEAR ENTRY>>                                                     19380000
    ENTP(2):=0;                                                         19385000
    MOVE ENTP(3):=ENTP(2),(SM-3);                                       19390000
  END; <<CREATE'LPROCMASTER>>                                           19395000
                                                                        19400000
SUBROUTINE BUILDSEGMAP;                                                 19405000
  <<BUILD A PROCESS LOCAL SEGMAP>>                                      19410000
  <<IF PROCESS IS EXECUTING A PROGRAM FILE        >>                    19415000
  <<  THEN USE COPY OF PROGRAM'S SEGMAP           >>                    19420000
  <<  ELSE BUILD NEW SEGMAP                       >>                    19425000
  BEGIN                                                                 19430000
    OLDSEGMAPDST := SPCBMAPDST;                                <<06648>>19435000
    IF OLDSEGMAPDST = 0 THEN                                            19440000
      BEGIN                 <<NO CURRENT SEGMAP>>                       19445000
        <<BASIC SEGMAP MUST BE CREATED>>                                19450000
        <<ALLOCATE DST>>                                                19455000
        TEMP:=(NUM'PROGSEGS+1)&LSL(1); <<MINIMUM SIZE>>                 19460000
        TEMP:=((TEMP+63)&LSR(6))&LSL(6);<<MOD 64>>                      19465000
        NEWSEGMAPDST:=GETDATASEG(TEMP,4090);                            19470000
        IF <> THEN                                                      19475000
          BEGIN    <<ERROR>>                                            19480000
            ERROR:=ERR99;                                               19485000
            GO RETURNERROR;                                             19490000
          END;                                                          19495000
        <<FORMAT SEGMAP>>                                               19500000
        SAVEDB:=EXCHANGEDB(NEWSEGMAPDST);                               19505000
        <<CLEAR SEGMAP>>                                                19510000
        DBAREA(0):=0;                                                   19515000
        MOVE DBAREA(1):=DBAREA(0),(TEMP-1);                             19520000
        TOS:=NUM'PROGSEGS;    <<MAX MCSTIDX>>                           19525000
        DBAREA(0):=TOS;       <<# PROGSEGS,MAXMCSTIDX>>                 19530000
        DBAREA(1):=(NUM'PROGSEGS+1)&LSL(1); <<DBAREA LENGTH>>           19535000
        TEMP:=0;                                                        19540000
        WHILE (TEMP:=TEMP+1) <= NUM'PROGSEGS DO                         19545000
          BEGIN                                                         19550000
            DBAREA(TEMP&LSL(1)):=TEMP; <<PHYCST>>                       19555000
          END; <<WHILE>>                                                19560000
        EXCHANGEDB(SAVEDB);                                             19565000
      END                                                               19570000
     ELSE                                                               19575000
      BEGIN   <<SEGMAP EXISTS>>                                         19580000
        <<MUST CREATE A PCB-LOCAL COPY OF SEGMAP>>                      19585000
        TEMP:=(DSTI(OLDSEGMAPDST&LSL(2)).DSLEN-1)&LSL(2);               19590000
                         <<CURRENT SEGMAP LENGTH>>                      19595000
        NEWSEGMAPDST:=GETDATASEG(TEMP,                                  19600000
                            ((TEMP+4095)&LSR(12))&LSL(12));             19605000
        IF <> THEN                                                      19610000
          BEGIN    <<ERROR>>                                            19615000
            ERROR:=ERR99;                                               19620000
            GO RETURNERROR;                                             19625000
          END;                                                          19630000
        <<COPY SEGMAP>>                                                 19635000
        TOS:=NEWSEGMAPDST;    <<TARGET>>                                19640000
        TOS:=0;               <<OFFSET>>                                19645000
        TOS:=OLDSEGMAPDST;    <<SOURCE>>                                19650000
        TOS:=0;               <<OFFSET>>                                19655000
        TOS:=TEMP;            <<COUNT>>                                 19660000
        ASSEMBLE(MDS 5);                                                19665000
        ADJUSTLOCALITY(PCBPT,DOUBLE(OLDSEGMAPDST),0,1);        <<07316>>19670000
      END;                                                              19675000
    <<UPDATE PCBXFIXED AND PCB>>                                        19680000
    SPCBMAPDST := NEWSEGMAPDST;                                <<06648>>19685000
    SETSYSDB;                                                           19690000
    ADDTOLOCALITY(SLLPTR,DOUBLE(NEWSEGMAPDST),                 <<06648>>19695000
       %400 );                                                          19700000
    RESETDB( -1 );                                                      19705000
    SEGMAPFLAG:=1;                                                      19710000
  END; <<BUILDSEGMAP>>                                                  19715000
                                                                        19720000
INTEGER SUBROUTINE WORDADDR(BYTEADDR);                                  19725000
  <<CONVERT BYTE ADDRESS TO WORD ADDRESS>>                              19730000
  VALUE BYTEADDR;                                                       19735000
  BYTE POINTER BYTEADDR;                                                19740000
  BEGIN                                                                 19745000
    TOS:=WORDADDR:=@BYTEADDR&LSR(1);                                    19750000
    PUSH(Z);                                                            19755000
    <<IF WORDADDR > Z THEN WORDADDR.(0:1):=1>>                          19760000
    IF TOS > TOS THEN WORDADDR.(0:1):=1;                                19765000
  END; <<WORDADDR>>                                                     19770000
                                                                        19775000
SUBROUTINE FIGURE'OPTIONS;                                              19780000
  <<OPTIONAL PARAMETERS PRESENT>>                                       19785000
  <<FIGURE VALUES PASSED>>                                              19790000
  BEGIN                                                                 19795000
    <<SET UP DEFAULT VALUES>>                                           19800000
    LIBSEARCH:=-1;                                                      19805000
    @LIBSCAN:=-1;                                                       19810000
    LOADDOMAIN:=1;                                                      19815000
    UNSATFLAG:=0;                                                       19820000
    FLAGS:=-1;                                                          19825000
    ENDOFLIST:=FALSE;                                                   19830000
    <<CHECK VALUES PASSED>>                                             19835000
    TEMP:=0;                                                            19840000
    WHILE TEMP <= MAXOPTS AND NOT ENDOFLIST DO                          19845000
      BEGIN                                                             19850000
        IF NOT (0 <= OPTION'NUMS(TEMP) <= MAXOPTS) THEN                 19855000
          BEGIN  <<INVALID OPTION NUMBER>>                              19860000
            ENDOFLIST:=TRUE;                                            19865000
          END                                                           19870000
         ELSE                                                           19875000
          BEGIN  <<VALID OPTION NUMBER>>                                19880000
            CASE *OPTION'NUMS(TEMP) OF                                  19885000
              BEGIN                                                     19890000
              <<0>> ENDOFLIST:=TRUE;                                    19895000
              <<1>> IF LIBSEARCH = -1 THEN                              19900000
                      BEGIN <<1ST OCCURRENCE>>                          19905000
                        LIBSEARCH:=OPTIONS(TEMP);                       19910000
                        <<CHECK VALIDITY>>                              19915000
                        IF NOT (0<=LIBSEARCH                            19920000
                                 <=MAXLIBSEARCH) THEN                   19925000
                          BEGIN   <<ILLEGAL LIBSEARCH>>                 19930000
                            ERROR:=ERR20;                               19935000
                            GO RETURNERROR2;                            19940000
                          END;                                          19945000
                      END                                               19950000
                     ELSE                                               19955000
                      BEGIN <<2ND OCCURRENCE>>                          19960000
                        ENDOFLIST:=TRUE;                                19965000
                      END;                                              19970000
              <<2>> IF FLAGS = -1 THEN                                  19975000
                      BEGIN <<1ST OCCURRENCE>>                          19980000
                        FLAGS:=0;                                       19985000
                        UNSATFLAG:=OPTIONS(TEMP).(14:1);                19990000
                        LOADDOMAIN:=OPTIONS(TEMP).(15:1);               19995000
                        <<CHECK VALID LOAD DOMAIN>>                     20000000
                        IF LOGICALMAPPING THEN                          20005000
                          BEGIN <<MAPPING FIRMWARE PRESENT>>            20010000
                            IF LOADDOMAIN=1 AND                         20015000
                               CALLED'NONPM THEN                        20020000
                              BEGIN <<INVALID >>                        20025000
                                ERROR:=ERR1;                            20030000
                                GO RETURNERROR2;                        20035000
                              END                                       20040000
                          END                                           20045000
                         ELSE                                           20050000
                          BEGIN <<NO MAPPING FIRMWARE>>                 20055000
                            <<ALL LOADS PHYSICAL>>                      20060000
                            LOADDOMAIN:=1;                              20065000
                          END;                                          20070000
                      END                                               20075000
                     ELSE                                               20080000
                      BEGIN <<2ND OCCURRENCE>>                          20085000
                        ENDOFLIST:=TRUE;                                20090000
                      END;                                              20095000
              <<3>> IF @LIBSCAN = -1 THEN                               20100000
                      BEGIN <<1ST OCCURRNENCE>>                         20105000
                        @LIBSCAN:=OPTIONS(TEMP);                        20110000
                        <<CHECK VALIDITY>>                              20115000
                        IF NOT (STK'LOLIM<=WORDADDR(LIBSCAN)            20120000
                                         <=STK'HILIM) THEN              20125000
                          BEGIN <<INVALID ADDR>>                        20130000
                            ERROR:=ERR3;                                20135000
                            GO RETURNERROR2;                            20140000
                          END;                                          20145000
                      END                                               20150000
                     ELSE                                               20155000
                      BEGIN <<2ND OCCURRENCE>>                          20160000
                        ENDOFLIST:=TRUE;                                20165000
                      END;                                              20170000
              END; <<CASE>>                                             20175000
          END;                                                          20180000
        TEMP:=TEMP+1;                                                   20185000
      END; <<WHILE>>                                                    20190000
    IF OPTION'NUMS(TEMP-1) <> 0 THEN                                    20195000
      BEGIN  <<INVALID OPTION>>                                         20200000
        ERROR:=ERR4;                                                    20205000
        GO RETURNERROR2;                                                20210000
      END;                                                              20215000
  END;  <<FIGURE'OPTIONS>>                                              20220000
                                                                        20225000
    <<CHECK PARAMETERS>>                                                20230000
    ERRORON;                                                            20235000
    PCBPT := CURPRC;                                           <<06648>>20240000
    PCBX';  <<PTR TO PCBX FIXED AREA>>                                  20245000
    LOADPROCFLAG':=LOADPROCFLAG;                                        20250000
    STK'LIMS:=CHEK'NOABORT(INTRIN'DATA,CHK'FLAG,                        20255000
                      DOUBLE(CHK'PARM),,CHK'OPTS);                      20260000
    IF < THEN                                                           20265000
      BEGIN   <<ERROR FROM CHEK>>                                       20270000
        CHEKERR:=ERRORGET(1).(8:8);                                     20275000
        IF CHEKERR=3                                                    20280000
          THEN ERROR:=ERR2  <<MISSING PARM>>                            20285000
          ELSE ERROR:=ERR3; <<BAD ADDR>>                                20290000
        GO RETURNERROR2;                                                20295000
      END;                                                              20300000
    IF HAVE'OPTIONS THEN                                                20305000
      BEGIN             <<BOTH OPTION VAR PARMS SPECIFIED>>             20310000
        FIGURE'OPTIONS;                                                 20315000
      END                                                               20320000
     ELSE                                                               20325000
      BEGIN             <<BOTH OPT VAR PARMS NOT SPECIFIED>>            20330000
        IF INVALID'OPTIONS THEN                                         20335000
          BEGIN         <<ONE OPT VAP PARM SPECIFIED>>                  20340000
            ERROR:=ERR4;                                                20345000
            GO RETURNERROR2;                                            20350000
          END;                                                          20355000
      END;                                                              20360000
                                                                        20365000
    <<CREATE Q-REL VERSION OF PROCNAME>>                                20370000
    FORMATNAME(QNAME,PROCNAME);                                         20375000
                                                                        20380000
    SAVECRIT:=SETCRITICAL;  <<PROTECT>>                                 20385000
    SAVESIR:=GETSIR(SEGTABSIR);                                         20390000
    SAVEDB:=EXCHANGEDB(SEGTABDST);                                      20395000
    IF FIRSTLOADPROC THEN                                               20400000
      BEGIN  <<FIRST LOADPROCEDURE CALL>>                               20405000
        <<MUST CREATE A LOADPROCMASTER ENTRY FOR PIN>>                  20410000
        <<FIND SHARER ENTRY AND THE PROGRAM FILE ENTRY>>                20415000
        IF LSEARCH(DOUBLE(USERPIN),ANYMODE,SHARER) AND                  20420000
           LSEARCH(EFID,EPMODE,PROGFILE) THEN                           20425000
          BEGIN <<FOUND ENTRIES>>                                       20430000
            <<CREATE LOADPROCMASTER ENTRY>>                             20435000
            SM:=35+ESLINFO'PROG&LSL(1)                                  20440000
                  +(EMAPSIZE+1)&LSL(1); <<ENTRY SIZE>>                  20445000
            @AUXENTP:=@ENTP; <<SAVE PROGFILE ENTRY PTRS>>               20450000
            @AUXENTP1:=@ENTP1;                                          20455000
            @AUXENTP2:=@ENTP2;                                          20460000
            @AUXENTP3:=@ENTP3;                                          20465000
            CREATE'LPROCMASTER;                                         20470000
            <<BUILD ENTRY>>                                             20475000
            SN:=AUXENTP(6).(8:8); <<#SLINFO AREAS>>                     20480000
            ENTP(2).(0:8):=SN;    <<# SLID>>                            20485000
            SETSECPTRS; <<SETUP SECONDARY PTRS TO ENTRY>>               20490000
            <<MOVE SLID TO LOADPROCMASTER>>                             20495000
            SL:=0;                                                      20500000
            WHILE (SL:=SL+1) <= SN DO                                   20505000
              BEGIN                                                     20510000
                ENTP2(0):=AUXENTP2(1); <<SLID-WORD 0>>                  20515000
                ENTP2(1):=AUXENTP2(2); <<SLID-WORD 1>>                  20520000
                @ENTP2:=@ENTP2+2;                                       20525000
                @AUXENTP2:=@AUXENTP2+19;                                20530000
              END;                                                      20535000
            <<CREATE MCSTLOGSEG ARRAY FROM PSEGMAP ARRAY>>              20540000
            SN:=IF LOGICALMAPPING THEN AUXENTP3<<#PSEGMAP ENT>>         20545000
                                  ELSE 0;                               20550000
            ENTP3:=SN;    <<# MCSTLOGSEG ENTRIES>>                      20555000
            @AUXENTP3:=@AUXENTP3+1;                                     20560000
            @ENTP3:=@ENTP3+2;                                           20565000
            @ENTP1:=@ENTP1+16; <<PTR TO MCSTIDX TABLE>>                 20570000
            SL:=0;                                                      20575000
            WHILE (SL:=SL+1) <= SN DO                                   20580000
              BEGIN                                                     20585000
                ENTP3(0):=AUXENTP3; <<LOGSEG,SLID>>                     20590000
                ENTP3(1):=1;        <<REF COUNT>>                       20595000
                <<SET BIT IN MCSTIDX TABLE>>                            20600000
                TOS:=@ENTP1;                                            20605000
                SETBIT(*,SL);                                           20610000
                @ENTP3:=@ENTP3+2;                                       20615000
                @AUXENTP3:=@AUXENTP3+1;                                 20620000
              END;                                                      20625000
            SETSECPTRS;        <<SET SECONDARY PTRS AGAIN>>             20630000
          END                                                           20635000
         ELSE                                                           20640000
          BEGIN <<SHARER AND PROGFILE ENTRIES NOT FOUND>>               20645000
            <<CREATE BASIC LOADPROCMASTER ENTRY>>                       20650000
            SN:=IF LOGICALMAPPING THEN NUM'PROGSEGS<<#PROGSEGS>>        20655000
                                  ELSE 0;                               20660000
            SM:=35+(SN+1)&LSL(1); <<ENTRY LENGTH>>                      20665000
            CREATE'LPROCMASTER;                                         20670000
            <<BUILD ENTRY>>                                             20675000
            SETSECPTRS; <<SET SECONDARY PTRS>>                          20680000
            <<CREATE MCSTLOGSEG ARRAY>>                                 20685000
            ENTP3:=SN;  << # MCSTLOGSEG ARRAY ENTRIES>>                 20690000
            @ENTP3:=@ENTP3+2; <<PTR TO FIRST ENTRY>>                    20695000
            @ENTP1:=@ENTP1+16;<<PTR TO MCSTIDX TAB>>                    20700000
            SL:=0;                                                      20705000
            WHILE (SL:=SL+1) <= SN DO                                   20710000
              BEGIN                                                     20715000
                TOS:=14;  <<SLID>>                                      20720000
                TOS.(0:8):=SL-1; <<LOGSEG>>                             20725000
                ENTP3(0):=TOS;                                          20730000
                ENTP3(1):=1;     <<REF COUNT>>                          20735000
                <<SET BIT IN MCSTIDX TAB>>                              20740000
                TOS:=@ENTP1;                                            20745000
                SETBIT(*,SL);                                           20750000
                @ENTP3:=@ENTP3+2;                                       20755000
              END; <<WHILE>>                                            20760000
            SETSECPTRS; <<SET SECONDARY PTRS AGAIN>>                    20765000
          END;                                                          20770000
        LOADPROCFLAG':=1;  <<LOADPROCMASTER EXISTS>>                    20775000
      END                                                               20780000
     ELSE                                                               20785000
      BEGIN  <<NOT FIRST CALL TO LOADPROCEDURE>>                        20790000
        <<LOADPROCMASTER ENTRY EXISTS>>                                 20795000
        IF LSEARCH(DOUBLE(USERPIN),NORMAL,LOADPROCMASTER) THEN          20800000
          BEGIN  <<FOUND ENTRY>>                                        20805000
            <<CHECK IF PROCEDURE HAS BEEN LOADPROC'ED>>                 20810000
            IF ACTIVE'LPROCS <> 0 THEN                                  20815000
              BEGIN <<CURRENTLY ACTIVE LOADPROC'S>>                     20820000
                EXCHANGEDB(SEGTABDST'EX);                      <<06542>>20825000
                <<MOVE PROCEDURE NAME TO SBUF0>>                        20830000
                SL:=8;                                                  20835000
                WHILE (SL:=SL-1) >= 0 DO                                20840000
                  BEGIN                                                 20845000
                    SBUF0(SL):=QNAME(SL);                               20850000
                  END;                                                  20855000
                <<SCAN EACH EXTENSION ENTRY FOR-->>                     20860000
                <<  . SAME PIN                   >>                     20865000
                <<  . SAME PROCEDURE NAME        >>                     20870000
                <<  . SAME LIBRARY SEARCH        >>                     20875000
                @AUXENTP:=HDFWDLINK(EXTENSION); <<HEAD ENTRY>>          20880000
                WHILE @AUXENTP <> 0 DO                                  20885000
                  BEGIN  <<EACH EXTENSION ENTRY>>                       20890000
                    IF AUXENTP(1) = USERPIN AND                         20895000
                       AUXENTP.(4:4) = LIBSEARCH AND                    20900000
                       SAMENAME(SBUF0(0),AUXENTP(5)) THEN               20905000
                      BEGIN  <<FOUND EXTENSION FOR PROCEDURE>>          20910000
                        TOS:=AUXENTP(3); <<LOADPROC COUNT>>             20915000
                        IF LOGICAL(S0) >= 65535 THEN                    20920000
                          BEGIN    <<TOO MANY TIMES>>                   20925000
                            RESETDBSIR;                                 20930000
                            ERROR:=ERR103;                              20935000
                            GO RETURNERROR;                             20940000
                          END;                                          20945000
                        TOS:=TOS+1; <<INCREMENT COUNT>>                 20950000
                        AUXENTP(3):=TOS;                                20955000
                        EXTIDX':=AUXENTP(2);<<ID>>                      20960000
                        PLABEL':=AUXENTP(4);      <<PLABEL>>            20965000
                        RESETDBSIR;                                     20970000
                        RESETCRITICAL(SAVECRIT);                        20975000
                        GO FINISH;                                      20980000
                      END;                                              20985000
                    @AUXENTP:=AUXENTP(-3); <<NEXT ENTRY>>               20990000
                  END; <<WHILE>>                                        20995000
                <<PROCEDURE HAS NOT BEEN LOADPROC'ED>>                  21000000
                EXCHANGEDB(SEGTABDST);                         <<06542>>21005000
              END;                                                      21010000
          END                                                           21015000
         ELSE                                                           21020000
          BEGIN  <<DID NOT FIND LOADPROCMASTER ENTRY>>                  21025000
            SUDDENDEATH(351);                                           21030000
          END;                                                          21035000
      END;                                                              21040000
    <<GET NEXT EXTENSION ID>>                                           21045000
    TOS:=0;  <<NEXTBIT RESULT>>                                         21050000
    TOS:=@ENTP1; <<EXTIDX TAB>>                                         21055000
    TOS:=NEXTBIT(*);                                                    21060000
    EXTIDX':=S0;                                                        21065000
    IF TOS = 0 THEN                                                     21070000
      BEGIN        <<NO AAVAILABLE IDX>>                                21075000
        RESETDBSIR;                                                     21080000
        ERROR:=ERR40;                                                   21085000
        GO RETURNERROR;                                                 21090000
      END;                                                              21095000
    RESETDBSIR;                                                         21100000
    LOADPROCFLAG:=LOADPROCFLAG'; <<SET LOADPROCMASTER FLAG>>            21105000
                                                                        21110000
    <<CHECK WHETHER PROCESS LOCAL SEGMAP IS TO BE CREATED>>             21115000
    <<REQUIRED IF                                   >>                  21120000
    <<  .LOGICAL MAPPING FIRMWARE PRESENT           >>                  21125000
    <<  .PROCEDURE IS BEING LOADED INTO MAPPED DOMAIN>>                 21130000
    <<  .PROCESS LOCAL SEGMAP DOES NOT ALREADY EXIST>>                  21135000
    IF LOADDOMAIN = 0 AND                                               21140000
       SEGMAPFLAG = 0 THEN                                              21145000
      BEGIN     <<SEGMAP MUST BE CREATED>>                              21150000
        BUILDSEGMAP;                                                    21155000
      END;                                                              21160000
                                                                        21165000
    RESETCRITICAL(SAVECRIT);                                            21170000
    <<SEND REQUEST TO LOADER>>                                          21175000
    COMMAND:=0;                                                         21180000
    COMMAND.(0:2):=1;    <<LOADPROC REQUEST>>                           21185000
    COMMAND.(2:2):=LIBSEARCH; <<LIB SCAN>>                              21190000
    COMMAND.(5:1):=LOADDOMAIN;<<MAPPED OR NON-MAPPED>>                  21195000
    TOS:=LOADER(COMMAND,USERPIN,EXTIDX',0,PROCNAME,0);                  21200000
    ERROR:=TOS;    <<ERROR RETURNED>>                                   21205000
    IF ERROR <> 0 THEN GO RETURNERROR2;                                 21210000
    PLABEL':=TOS;  <<RETURNED PROCEDURE LABEL>>                         21215000
                                                                        21220000
FINISH:                                                                 21225000
    LOADPROCID:=EXTIDX'; <<RETURN LOADPROC ID>>                         21230000
    PLABEL:=PLABEL';     <<RETURN PROCEDURE LABEL>>                     21235000
    CONDCODE:=CCE; <<OK CODE>>                                          21240000
    ERROREXIT([10/80,6/7],0,0);                                         21245000
    RETURN;                                                             21250000
                                                                        21255000
RETURNERROR:                                                            21260000
    RESETCRITICAL(SAVECRIT);                                            21265000
RETURNERROR2:                                                           21270000
    CONDCODE:=CCL;  <<ERROR CODE>>                                      21275000
    LOADPROCFLAG:=LOADPROCFLAG'; <<SET LOADPROCMASTER FLAG>>            21280000
    ERROREXIT([10/80,6/7],0,0);                                         21285000
  END;                                                                  21290000
$CONTROL SEGMENT=MAIN                                                   21295000
END.                                                                    21300000
