         PAGE
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
SR1      EQU      8
SR2      EQU      9
SR3      EQU      10
SR4      EQU      11
D1       EQU       12
D2       EQU      13
D3       EQU      14
D4       EQU      15
         PAGE
FIXARG   DSECT    1
VERSION  EQU      2
         TITLE    'FIXARG'
         SYSTEM   SIG7
*
* FIXARG          FIXED ARGUMENT (TABLE LOOKUP)
*
* INPUT
*
*        R1       0-7    ERROR CODE DESIRED
*                 15-31  TABLE ADDRESS
*        ARGBUFF  ARGUMENT STORAGE BUFFER
*
* OUTPUT
*
*        R1       ARGUMENT ID CODE (INDEX)
*
*
         REF      ERROR,ARGBUFF
         REF      TERM,SAVCMBX,CMBX
         DO       VERSION=2
         REF      OV:NMSZ,OH:NM
         REF      IN%ARG,OUT%ARG
         REF      DEVTBL
         FIN
*
         PSW,SR4  *R7               SAVE RETURN REGISTER
*
         LW,R2    R1                SAVE INPUT
         LW,R1    *R2               GET MAX. TABLE INDEX
*
         LW,R3    ARGBUFF,R7        SEARCH TABLE FOR MATCH
         CW,R3    *R2,R1
         BE       RETURN
         BDR,R1   %-2
         DO       VERSION=2
         LW,R1    TERM,R7      TEST IF TERM IS #.
         CI,R1    X'7B'
         BE       CK%DEVO      YES--DO NOT CHECK.
*                              SYSTEM TABLE.
         LW,R1    =X'02000000'+DEVTBL  IS DEVICE BEING
         CW,R2    R1                   CHECKED
         BNE      CK%DEVO      NO.
         LI,R1    OV:NMSZ      DEVICE IN SYSTEM TABLE.
CMP%NXT  EQU      %
         LH,R3    OH:NM,R1
         SLS,R3   +16          POSITION LOGICAL
         SLS,R3   -8           DEVICE IN REGISTER 3.
         AW,R3    FIXCON
         CW,R3    ARGBUFF,R7
         BE       ST%DCB
         BDR,R1   CMP%NXT
         B        CK%DEVO
ST%DCB   EQU      %
         SLS,R3   8            POSITION LOGICAL
         SLS,R3   -16          DEVICE IN REGISTER 3.
         LI,R1    0
         CI,D1    1
         BE       ST%OUT
         CI,D1    12
         BE       ST%OUT       OUTPUT DEVICE.
         STW,R3   IN%ARG,R7    SAVE INPUT ARGUMENT
         B        RETURN
ST%OUT   EQU      %
         STW,R3   OUT%ARG,R7
         B        RETURN
CK%DEVO  EQU      %
         FIN
         LW,R1    SAVCMBX,R7        IS DEVICE CODE OPTIONAL
         BEZ      ERR               NO
         STW,R1   CMBX,R7           TREAT STRING AS FID - RESET CMBX
         LI,R1    '/'               SIMULATE 'DC/'
         STW,R1   TERM,R7           SET DELIMITER
         LI,R1    3                 SET CODE FOR DC
         B        RETURN
ERR      EQU      %
*
         LB,R1    R2                SET GIVEN ERROR CODE
         BEZ      RETURN
         BAL,SR4  ERROR
         LI,R1    0                 CLEAR ID CODE
*
RETURN   PLW,SR4  *R7
         B        *SR4
         DO1      VERSION=2
FIXCON   DATA     X'02000040'
         END

