IO
         IDENT     IO                                                   IO           1
         TITLE INTERFACE TO SCOPE                                       IO           2
*  FOR A LISTING OF THE SNODEF COMDECK, CALLED BELOW, SEE MAINLUP.      IO           3
         LIST  -L                                                       IO           4
*CALL,SNODEF                                                            IO           5
         LIST  L                                                        IO           6
         TITLE I/O ROUTINES COMMON TO RUN-TIME AND COMPILER             IO           7
*  LOWCORE                                                              IO           8
          EXT       LSCOUNT                                             IO           9
*  ERROR                                                                IO          10
         EXT   ERR18,ERR55                                              IO          11
*  MAINLUP                                                              IO          12
         EXT   FAIL                                                     IO          13
*  STORMAN                                                              IO          14
         EXT   MORFREE                                                  IO          15
*  UTILITY                                                              IO          16
         EXT   ZROX7                                                    IO          17
          EXT       ICX1X6                                              IO          18
*  IO                                                                   IO          19
         ENTRY CALLCIO,CALLRCL,PEEKWD,GETWD,SKIPWDS,PUTWD,CHKOUTB       IO          20
         ENTRY INPUT,OUTPUT,CLOSE1,CLOSALL                              IO          21
         ENTRY OPEN                                                     IO          22
         ENTRY GETB,PB                                                  IO          23
         ENTRY ABT,BLANKS,CBI,CBO,CZB                                   IO          24
         ENTRY ABT.                                                     IO          25
          ENTRY     LSCMOUT                                             IO          26
*                                                                       IO          27
          TITLE I/O SUBROUTINES                                         IO          28
*                                                                       IO          29
*                                                                       IO          30
*  CALLCIO  DOES JUST THAT.                                             IO          31
*                                                                       IO          32
*  PARAMETERS:   B2 = ADDRESS OF WORD 0 OF FILE BLOCK                   IO          33
*                X0 = -0 OR -1 AS NO RECALL OR RECALL IS DESIRED.       IO          34
*                X7 = 18 BIT CODE TO PUT IN THE FET BEFORE CALLING  CIO.IO          35
*                                                                       IO          36
*  USES:   A2-X2, X3, A7-X7                                             IO          37
*                                                                       IO          38
CALLCIO  BSSZ  1                   . ENTRY/EXIT                         IO          39
         SA2   B2+FI.FET+FET.LFN                                        IO          40
         MX3   60-18               . REPLACE OLD                        IO          41
         BX2   X3*X2               .   FUNCTION CODE                    IO          42
         BX7   X2+X7               .     WITH NEW                       IO          43
         SA7   A2                                                       IO          44
         SX7   3RCIO                                                    IO          45
         LX7   2                                                        IO          46
         BX7   -X0+X7              . ADD RECALL BIT                     IO          47
         SX3   A7                  . SET X3 = ADDRESS OF FET            IO          48
         LX7   40                                                       IO          49
         NO                                                             IO          50
         BX7   X7+X3                                                    IO          51
         SA7   1                   . ISSUE RA+1 REQUEST                 IO          52
CALLCIOW SA2   1                                                        IO          53
         NZ    X2,CALLCIOW         . WAIT FOR IT TO TAKE                IO          54
         JP    CALLCIO             . RETURN                             IO          55
*                                                                       IO          56
*                                                                       IO          57
*  SIMILARLY  CALLRCL.                                                  IO          58
*                                                                       IO          59
*  PARAMETERS:   X0 = -0 => PERIODIC RECALL; B2 = ANYTHING              IO          60
*                X0 = -1 => AUTO RECALL; B2 = FILE BLOCK WD 0 PTR       IO          61
*                                                                       IO          62
*  USES:   X2, A7-X7                                                    IO          63
*                                                                       IO          64
CALLRCLW SA2   1                                                        IO          65
         NZ    X2,CALLRCLW                                              IO          66
CALLRCL  BSSZ  1                   . ENTRY/EXIT                         IO          67
         SX7   3RRCL                                                    IO          68
         LX7   2                                                        IO          69
         BX7   -X0+X7              . ADD RECALL BIT TO REQUEST WORD     IO          70
         LX7   40                                                       IO          71
         ZR    X0,CALLRCLP         . PERIODIC RECALL, (B2)ARE IRRELEVANTIO          72
         SX2   B2+FI.FET                                                IO          73
         BX7   X7+X2                                                    IO          74
CALLRCLP SA7   1                   . ISSUE RA+1 REQUEST                 IO          75
         JP    CALLRCLW                                                 IO          76
*                                                                       IO          77
*                                                                       IO          78
*  PEEKWD  RETURNS IN  X1  THE NEXT WORD OF A GIVEN FILE, OR            IO          79
*  ELSE FRETURNS IF THE FILE IS POSITIONED AT AN END-OF-RECORD.         IO          80
*                                                                       IO          81
*  CALLING SEQUENCE:   B2 <- STREAM (FILE BLOCK PTR)                    IO          82
*                    + RJ PEEKWD                                        IO          83
*                    - VFD 30/FRET                                      IO          84
*                                                                       IO          85
*  RETURNS  (X1) = NEXT WORD, (X2) = BUFFER ADDRESS OF WORD.            IO          86
*           ALSO, (X1) = 0 ON FRETURN (END OF RECORD)                   IO          87
*                                                                       IO          88
*  USES X0,A1-X1,A2-X2,A3-X3,A7-X7, AND B2 (ONLY ON FRETURN).           IO          89
*                                                                       IO          90
PEEKWD1  SA1   X2+0                . FETCH BUFFER WORD                  IO          91
*                                                                       IO          92
PEEKWD   BSSZ  1                   . ENTRY/EXIT                         IO          93
PEEKWD2  SA1   B2+FI.FET+FET.IN                                         IO          94
         SA2   B2+FI.FET+FET.OUT                                        IO          95
         IX1   X1-X2                                                    IO          96
         NZ    X1,PEEKWD1          . BUFFER IS NOT EMPTY                IO          97
         SA3   B2+FI.FET+FET.LFN                                        IO          98
         LX3   FS.BUSY             . LEFT JUSTIFY THE -BUSY- STATUS BIT IO          99
         PL    X3,PEEKWD3          . WAIT FOR COMPLETION                IO         100
         SA1   A1                                                       IO         101
         IX1   X1-X2                                                    IO         102
         NZ    X1,PEEKWD1          . A PRU WAS JUST INPUT               IO         103
         LX3   60-FS.BUSY+FS.EOR   . LEFT JUSTIFY THE -EOR- STATUS BIT  IO         104
         NG    X3,PEEKWD4          . FRETURN                            IO         105
         CIO   CIO.READ,RECALL                                          IO         106
         JP    PEEKWD2                                                  IO         107
*                                                                       IO         108
PEEKWD3  RCL   AUTO                                                     IO         109
         JP    PEEKWD2                                                  IO         110
*                                                                       IO         111
PEEKWD4  SA2   PEEKWD                                                   IO         112
         LX2   30                                                       IO         113
         BX1   X1-X1               . RETURN X1 = 0                      IO         114
         SA2   X2-1                . FETCH CALLING INSTRUCTION WORD     IO         115
         SB2   X2+0                . FRETURN ADDRESS                    IO         116
         JP    B2                                                       IO         117
*                                                                       IO         118
*                                                                       IO         119
*  GETWD  IS JUST LIKE  PEEKWD , EXCEPT IT 'REMOVES' THE WORD WHICH     IO         120
*  IT RETURNS BY ADVANCING THE BUFFER 'OUT' POINTER.                    IO         121
*                                                                       IO         122
*  RETURNS:   (X1) = THE WORD                                           IO         123
*                                                                       IO         124
*  USES:  X0,A1-X1,A2-X2,A3-X3,A7-X7, AND B2 (ONLY ON FRETURN)          IO         125
*                                                                       IO         126
GETWD    BSSZ  1                   . ENTRY/EXIT                         IO         127
+        RJ    PEEKWD              . RETURNS WORD IN X1, OUT PTR IN X2  IO         128
-        VFD   30/GETWD2           . PROPAGATE THE FRETURN              IO         129
         SA3   B2+FI.FET+FET.LIM                                        IO         130
         SX7   X2+1                                                     IO         131
         SX3   X3                                                       IO         132
         BX3   X3-X7                                                    IO         133
         NZ    X3,GETWD1                                                IO         134
         SA3   B2+FI.FET+FET.FRST  . POINTER HAS WRAPPED AROUND         IO         135
         SX7   X3+0                .   THE CIRCULAR BUFFER              IO         136
GETWD1   SA7   B2+FI.FET+FET.OUT   . UPDATE THE  OUT  POINTER           IO         137
         JP    GETWD               . RETURN                             IO         138
*                                                                       IO         139
GETWD2   SA2   GETWD                                                    IO         140
         LX2   30                                                       IO         141
         SA2   X2-1                                                     IO         142
         SB2   X2+0                                                     IO         143
         JP    B2                  . FRETURN                            IO         144
*                                                                       IO         145
*                                                                       IO         146
*  SKIPWDS  MOVES A CODED FILE TO THE END OF THE CURRENT UNIT           IO         147
*  RECORD OR LOGICAL RECORD, WHICHEVER OCCURS FIRST.                    IO         148
*                                                                       IO         149
*  PARAMETERS:   B2 = FILE BLOCK POINTER                                IO         150
*                X1 = LAST WORD REMOVED FROM BUFFER IF LOWER 12 BITS    IO         151
*                     ARE ZERO, SKIPWDS DOES NOT MOVE THE FILE.         IO         152
*                                                                       IO         153
SKIPWDSL RJ    GETWD               . (SAVES X5)                         IO         154
-        VFD   30/SKIPWDS          . END OF LOGICAL RECORD              IO         155
SKIPWDST BX2   -X5*X1                                                   IO         156
         NZ    X2,SKIPWDSL         . NOT TO END OF UNIT RECORD          IO         157
SKIPWDS  BSSZ  1                   . ENTRY/EXIT                         IO         158
         MX5   60-12                                                    IO         159
         JP    SKIPWDST                                                 IO         160
*                                                                       IO         161
*                                                                       IO         162
*  PUTWD  PLACES THE WORD IN X6 INTO THE FILE POINTED TO BY B2,         IO         163
*  ISSUING A WRITE IF NECESSARY TO MAKE ROOM IN THE BUFFER.             IO         164
*                                                                       IO         165
*  PARAMETERS:   B2 = FILE PTR, X6 = WORD TO OUTPUT                     IO         166
*                                                                       IO         167
*  USES:   X0,A1-X1,A2-X2,A3-X3,A6,A7-X7                                IO         168
*                                                                       IO         169
PUTWDST  NO                                                             IO         170
         SX7   X3                  . UPDATED IN POINTER                 IO         171
         SA6   X1                  . STORE WORD INTO BUFFER             IO         172
         SA7   A1                                                       IO         173
PUTWD    BSSZ  1                   . ENTRY/EXIT                         IO         174
PUTWD1   SA1   B2+FI.FET+FET.IN                                         IO         175
         SA2   B2+FI.FET+FET.LIM                                        IO         176
         SX3   X1+1                                                     IO         177
         SX2   X2                                                       IO         178
         BX2   X3-X2                                                    IO         179
         NZ    X2,PUTWDNW                                               IO         180
         SA3   B2+FI.FET+FET.FRST  . IN POINTER WRAPPED AROUND          IO         181
PUTWDNW  SA2   B2+FI.FET+FET.OUT                                        IO         182
         BX2   X2-X3                                                    IO         183
         SX2   X2                                                       IO         184
         NZ    X2,PUTWDST          . IN .NE. OUT, STORE WORD IN BUFFER  IO         185
         SA2   B2+FI.FET+FET.LFN   . FETCH WORD WITH CODE AND STATUS    IO         186
         LX2   FS.BUSY             . LEFT JUSTIFY THE -BUSY- STATUS BIT IO         187
         PL    X2,PUTWDBSY         . WAIT FOR COMPLETION                IO         188
         CIO   CIO.WRIT,RECALL                                          IO         189
         JP    PUTWD1              . TRY AGAIN                          IO         190
*                                                                       IO         191
PUTWDBSY RCL   AUTO                                                     IO         192
         JP    PUTWD1              . TRY AGAIN                          IO         193
*                                                                       IO         194
*                                                                       IO         195
*  CHKOUTB  ISSUES A LOOK-AHEAD WRITE ON A FILE IF THE BUFFER IS OVER   IO         196
*  HALF FULL AND THE FILE IS NOT BUSY.                                  IO         197
*                                                                       IO         198
*  PARAMETER: B2 = WORD 0 OF FILE BLOCK                                 IO         199
*                                                                       IO         200
*  USES: X0, A1-X1, A2-X2, A3-X3, A7-X7                                 IO         201
*                                                                       IO         202
CHKOUTB  BSSZ  1                   . ENTRY/EXIT                         IO         203
         SA1   B2+FI.FET+FET.IN                                         IO         204
         SA2   B2+FI.FET+FET.OUT                                        IO         205
         IX1   X1-X2               . IN-OUT (=INUSE IF \ 0)             IO         206
         SA2   B2+FI.FET+FET.FRST                                       IO         207
         SA3   B2+FI.FET+FET.LIM                                        IO         208
         IX2   X3-X2               . LIMIT - FIRST = BUFFER LENGTH      IO         209
         SX2   X2                                                       IO         210
         AX2   1                   . (BUFFER LENGTH) / 2                IO         211
         NG    X1,CHKOUTB1                                              IO         212
         BX2   -X2                 . - (BUFFER LENGTH) / 2              IO         213
CHKOUTB1 IX1   X1+X2               . COMPUTE (REMAINING SPACE)          IO         214
*                                      - (LENGTH / 2) = (LENGTH / 2)    IO         215
*                                      - (IN-USE SPACE)                 IO         216
         NG    X1,CHKOUTB          . AT LEAST LENGTH/2 REMAINS, SO EXIT IO         217
         SA1   B2+FI.FET+FET.LFN                                        IO         218
         LX1   FS.BUSY                                                  IO         219
         PL    X1,CHKOUTB          . FILE BUSY, EXIT                    IO         220
         CIO   CIO.WRIT            . WRITE WITHOUT RECALL               IO         221
         JP    CHKOUTB             . EXIT                               IO         222
*                                                                       IO         223
*  MACROS FOR OLD-STYLE I/O ROUTINES.                                   IO         224
RECALL   MACRO AUTO                                                     IO         225
         IFC   EQ,/AUTO//                                               IO         226
         SX0   B0                                                       IO         227
         ELSE                                                           IO         228
         SX0   1                                                        IO         229
         ENDIF                                                          IO         230
         RJ    RCL                                                      IO         231
         ENDM                                                           IO         232
*                                                                       IO         233
READ     MACRO AUTO                                                     IO         234
         IFC   EQ,/AUTO//                                               IO         235
         SX0   B0                                                       IO         236
         ELSE                                                           IO         237
         SX0   1                                                        IO         238
         ENDIF                                                          IO         239
         SX7   CIO.READ                                                 IO         240
         RJ    CIO                                                      IO         241
         ENDM                                                           IO         242
*                                                                       IO         243
WRITE    MACRO AUTO                                                     IO         244
         IFC   EQ,/AUTO//                                               IO         245
         SX0   B0                                                       IO         246
         ELSE                                                           IO         247
         SX0   1                                                        IO         248
         ENDIF                                                          IO         249
         SX7   CIO.WRIT                                                 IO         250
         RJ    CIO                                                      IO         251
         ENDM                                                           IO         252
*                                                                       IO         253
* CIO USES X2,X3,X7, X0 CONTAINS ON INPUT THE RECAL FLAG (0 OR 1) AND ISIO         254
* NOT CHANGED.                                                          IO         255
*                                                                       IO         256
CIOWAIT   SA2      1                                                    IO         257
          NZ       X2,*                                                 IO         258
CIO       DATA      0                                                   IO         259
          SA2       B2             FET FWA                              IO         260
          MX3       42                                                  IO         261
          BX2       X2*X3          CLEAR OUT CODE AND STATUS            IO         262
          BX7       X2+X7          ADD FUNCTION CODE                    IO         263
          SA7      B2                                                   IO         264
          SX7       3RCIO                                               IO         265
          LX7       2                                                   IO         266
          BX7       X0+X7          ADD RECALL BIT                       IO         267
          SX3      B2              FET ADDRESS                          IO         268
          LX7       40                                                  IO         269
          BX7       X3+X7                                               IO         270
          SA7       1                                                   IO         271
          EQ       CIOWAIT                                              IO         272
RCLWAIT   SA2      1                                                    IO         273
          NZ       X2,*                                                 IO         274
RCL                                                                     IO         275
          SX7       3RRCL                                               IO         276
          LX7       2                                                   IO         277
          BX7       X0+X7                                               IO         278
          LX7       40                                                  IO         279
          ZR       X0,RCL1         . B2 CONTAINS GARBAGE                IO         280
          SX2       B2+0                                                IO         281
          BX7      X2+X7                                                IO         282
RCL1      SA7      1                                                    IO         283
          EQ       RCLWAIT                                              IO         284
                                                                        IO         285
* GETB RETURNS THE NEXT WORD IN THE FILE POINTED TO BY B2.  GETB        IO         286
* DECREMENTS B3 BY THE NUMBER OF CHARACTERS IT RETURNS EACH TIME IT IS  IO         287
* CALLED.  WHEN B3 REACHES ZERO, GETB RETURNS ZERO CHARACTERS AND       IO         288
* INCREMENTS B5 BY 2.                                                   IO         289
*                                                                       IO         290
* WHEN GETB REACHES A ZERO BYTE OR EOR, IT RETURNS BLANK CHARACTERS,    IO         291
* INCREMENTS B5 BY 1, AND CONTINUES TO CHECK B3.  THUS TO READ A LINE,  IO         292
* SET B3 = UNIT RECORD LENGTH, B5 = 0, AND CALL GETB UNTIL B5 = 2 OR 3. IO         293
*                                                                       IO         294
* IN X2 IS RETURNED THE FILE WORD WITH BLANK AND/OR ZERO FILL.  IN X3 ISIO         295
* RETURNED THE WORD EXACTLY AS IT APPEARED IN THE FILE (BUT IT IS NOT   IO         296
* RETURNED IF GETB IS CALLED WITH B5 .NE. 0).                           IO         297
*                                                                       IO         298
* REGISTERS SAVED: B1, B2, B6, B7, A0, A4-X4, A5-X5, AND A6-X6.         IO         299
                                                                        IO         300
GETB      DATA      0                                                   IO         301
          ZR        B5,GETB02      EQL/EQUR FLAG NOT SET                IO         302
          SB4       B5-2                                                IO         303
          SX2      0                                                    IO         304
          PL       B4,GETB         . URL EXCEEDED, ZERO FILL            IO         305
GETB01    SA2      BLANKS                                               IO         306
          EQ        GETB05                                              IO         307
                                                                        IO         308
GETB08    RECALL   B2              . WAIT FOR COMPLETION OF LAST OP     IO         309
GETB02    SA1       B2+2           IN                                   IO         310
          SA3       B2+3           OUT                                  IO         311
          IX1       X1-X3                                               IO         312
          ZR        X1,GETB07                                           IO         313
          SA2       X3             PICK UP BUFFER WORDS                 IO         314
          MX0       48                                                  IO         315
          BX1      -X0*X2          . EXTRACT LAST BYTE                  IO         316
          MX0      60-6            . =HOLE 6                            IO         317
          BX7      -X0*X2          . EXTRACT LAST CHARACTER             IO         318
          ZR       X1,GETB10       . PROCESS A ZERO BYTE                IO         319
          ZR       X7,GETB13       . BLANK A ZERO CHARACTER             IO         320
GETB03    SX7      X3+1            . INCREMENT THE OUT POINTER          IO         321
          SA1       B2+4           LIMIT                                IO         322
          SX1       X1                                                  IO         323
          IX1      X1-X7                                                IO         324
          ZR        X1,GETB09      OUT=LIMIT                            IO         325
GETB04    SA7       A3+0           STORE NEW OUT                        IO         326
          BX3       X2             FOR COMPILER LISTING ROUTINE         IO         327
GETB05    SB3       B3-10          DECREMENT UNIT RECORD LENGTH         IO         328
          LT        B0,B3,GETB     RETURN                               IO         329
          SB5       B5+2                                                IO         330
          SB3       -B3                                                 IO         331
          MX0       54                                                  IO         332
GETB06    ZR        B3,GETB                                             IO         333
          BX2       X0*X2                                               IO         334
          LX0       6                                                   IO         335
          SB3       B3-1                                                IO         336
          EQ        GETB06                                              IO         337
GETB07    SA1       B2             FET FWA                              IO         338
          LX1       59                                                  IO         339
          PL       X1,GETB08       . FILE IS BUSY                       IO         340
          LX1      60-4            . =RCY 4 (LEFT-JUSTIFY THE EOR BIT)  IO         341
          NG        X1,GETB12                                           IO         342
          READ      RECALL                                              IO         343
          EQ        GETB02                                              IO         344
GETB09    SA1       B2+1           FIRST                                IO         345
          SX7       X1+0                                                IO         346
          EQ        GETB04                                              IO         347
GETB10    SB5       B5+1           SET EOL FLAG                         IO         348
          SX7       1R                                                  IO         349
GETB11    BX1       -X0*X2                                              IO         350
          NZ        X1,GETB03      FOUND A NON ZERO CHARACTER           IO         351
          BX2       X2+X7                                               IO         352
          LX0       6                                                   IO         353
          LX7       6                                                   IO         354
          EQ        GETB11                                              IO         355
GETB12    SB5       B5+1                                                IO         356
          EQ        GETB01                                              IO         357
GETB13    SX7      1R              . SET UP AND                         IO         358
          JP       GETB11          .   JUMP INTO BLANK FILL LOOP        IO         359
                                                                        IO         360
* CZB MOVES THE (INPUT) FILE WHOSE FET ADDRESS IS CONTAINED IN B2 TO THEIO         361
* NEXT ZERO BYTE OR EOR, WHICHEVER COMES FIRST.  HOWEVER, IF THE LINE   IO         362
* STATUS IN B5 IS 1 OR 3, INDICATING A ZERO BYTE HAS ALREADY BEEN FOUND,IO         363
* CZB DOES NOTHING AND IMMEDIATELY EXITS.                               IO         364
                                                                        IO         365
* REGISTERS SAVED: B1, B2, B6, B7, A0, A5-X5, AND A6-X6.                IO         366
                                                                        IO         367
CZB       DATA     0               . ENTRY/EXIT                         IO         368
CZB1      SB5      B5-2            . B5 = "1 IF ZERO BYTE ENCOUNTERED!  IO         369
*                                        +"2 IF RECORD LENGTH REACHED!  IO         370
          NZ       B5,CZB          . WAS 1 OR 3, SO ZERO BYTE SEEN      IO         371
          SB3      377777B         . =2@17-1, A LONG RECORD             IO         372
          RJ       GETB            . GET BUFFER WORD AND POSSIBLY SET B5IO         373
CZB2      NZ       B5,CZB1         . MOST LIKELY B5 = 1 NOW             IO         374
          RJ       GETB                                                 IO         375
          JP       CZB2                                                 IO         376
                                                                        IO         377
* PB USES X0,X2,X3,X4,X7. IT PUTS THE WORD IN X6 INTO THE BUFFER WHOSE  IO         378
* FET FWA IS IN B2. X6 AND B2 ARE NOT CHANGED.                          IO         379
*                                                                       IO         380
PB3       SA6      X2              . PUT WORD INTO BUFFER               IO         381
          SX7      X4                                                   IO         382
          SA7      A2+0            . UPDATE IN POINTER                  IO         383
PB        DATA      0                                                   IO         384
          SA2       B2+2           FET IN POINTER                       IO         385
          SA3       B2+4               LIMIT POINTER                    IO         386
          SX4       X2+1                                                IO         387
          SX3       X3                                                  IO         388
          IX3       X4-X3                                               IO         389
          NZ        X3,PB1                                              IO         390
          SA4       B2+1           FIRST                                IO         391
PB1       SX4      X4                                                   IO         392
          SA3      B2+3            . OUT                                IO         393
          IX3       X3-X4                                               IO         394
          NZ        X3,PB3                                              IO         395
          SA3       B2             FET FWA                              IO         396
          LX3       59             CHECK COMPLETION BIT                 IO         397
          PL        X3,PB2                                              IO         398
          WRITE     RECALL                                              IO         399
          EQ        PB+1                                                IO         400
PB2       RECALL    B2                                                  IO         401
          EQ        PB+1                                                IO         402
*                                                                       IO         403
* CBO USES X2,X3,X4, AND X7(IF CIO IS CALLED)                           IO         404
* IT RETURNS X2 .NE. 0 IF ZERO BYTE IS NOT IN X6                        IO         405
*                                                                       IO         406
CBO       DATA      0                                                   IO         407
          MX0       48                                                  IO         408
          BX6       -X0*X6                                              IO         409
          NZ        X6,CBO                                              IO         410
          SA2       B2+2           IN                                   IO         411
          SA3       B2+3           OUT                                  IO         412
          IX2       X3-X2                                               IO         413
          SA3       B2+1           FIRST                                IO         414
          SA4       B2+4           LIMIT                                IO         415
          IX3       X4-X3                                               IO         416
          SX3       X3                                                  IO         417
          AX3       1              BUFFER LENGTH / 2                    IO         418
          NG        X2,CBO1                                             IO         419
          BX3       -X3                                                 IO         420
CBO1      IX2       X2+X3                                               IO         421
          PL        X2,CBO                                              IO         422
          SA2       B2                                                  IO         423
          LX2       59                                                  IO         424
          PL        X2,CBO                                              IO         425
          WRITE                                                         IO         426
          EQ        CBO                                                 IO         427
*                                                                       IO         428
CBI2      LX4      5                                                    IO         429
         SA2   B2-FI.FET+FI.RFC    . WORD WITH EOI,EOR FLAGS            IO         430
          MX7       1                                                   IO         431
          LX7       37                                                  IO         432
          BX7       X2+X7          . SET EOI FLAG                       IO         433
          SA7       A2                                                  IO         434
CBI                                . CHECK FOR EOR ON INPUT FILE        IO         435
         SA1   B2-FI.FET+FI.RFC    . EOI,OER FLAGS, REF COUNT WORD      IO         436
          LX1       59-36                                               IO         437
          NG        X1,ERR55       . EOI FLAG WAS SET                   IO         438
CBI0      SA1       B2+2           . IN POINTER                         IO         439
          SA2      B2+3            . OUT POINTER                        IO         440
          IX1      X1-X2                                                IO         441
          NZ       X1,CBI          . BUFFER IS NOT EMPTY                IO         442
          SA4      B2              . FET FIRST WORD                     IO         443
          LX4      59                                                   IO         444
          PL       X4,CBI1         . BUSY                               IO         445
          LX4      51                                                   IO         446
          NG       X4,CBI2         . EOI ENCOUNTERED                    IO         447
          SA1      A1              . IN AGAIN                           IO         448
          IX1      X1-X2                                                IO         449
          NZ       X1,CBI          . A PRU WAS JUST MOVED               IO         450
          LX4      5               . EXAMINE EOR BIT                    IO         451
          NG       X4,CBI          . EOR WAS ENCOUNTERED                IO         452
          READ     RECALL                                               IO         453
          EQ        CBI0           . TRY AGAIN                          IO         454
CBI1      RECALL   B2                                                   IO         455
          EQ        CBI0           . LIKEWISE                           IO         456
*                                                                       IO         457
*                                                                       IO         458
*  (CLOSE ALL OPEN FILES AND) ABORT THE JOB-STEP.                       IO         459
*                                                                       IO         460
ABT      RJ    CLOSALL                                                  IO         461
          RJ        LSCMOUT                                             IO         462
ABT.     SX7   3LABT                                                    IO         463
          LX7      42                                                   IO         464
          SA7      1                                                    IO         465
          EQ       *                                                    IO         466
*                                                                       IO         467
*        SB2   STREAM                                                   IO         468
*        RJ    OPEN                                                     IO         469
*  OPENS THE FILE POINTED TO BY B2.                                     IO         470
*                                                                       IO         471
*  USES: A1/X1, X2, A7/X7                                               IO         472
OPEN     BSSZ  1                   . ENTRY/EXIT                         IO         473
*  CLEAR THE SNOBOL EOI/EOR BITS IN F3 OF THE REF. COUNT WORD.          IO         474
         SA1   B2+FI.RFC                                                IO         475
         LX1   60-2*18             . RIGHT JUSTIFY F3                   IO         476
         MX2   60-18                                                    IO         477
         BX7   X2*X1                                                    IO         478
         LX7   2*18                . REPOSITION THE FI.RFC WORD         IO         479
         SA7   A1+0                                                     IO         480
          SA1      B2+FI.FET+FET.LFN                                    *******      1
          BX7      X1*X2                                                *******      2
          SA7      A1                                                   *******      3
          SA1      1                                                    *******      4
+         SA1      A1+1            LOOP TO FIND SLOT FOR FILE NAME      *******      5
          NZ       X1,*                                                 *******      6
          SX1      A7                                                   *******      7
          BX7      X1+X7                                                *******      8
          SA7      A1              PUT FILE NAME AND POINTER IN SLOT    *******      9
          MX7      0                                                    *******     10
          SA7      A7+1            INSURE NEXT SLOT                     *******     11
          SX7      B2+FI.FET+FET.LFN                                    *******     12
*  RELUCTANT TO FLUSH THE BUFFER IF SNOBOL LOSES CONTROL.               IO         499
          SA1       B2+FI.RFC                                           IO         500
          SX7       1              . SET COMPLETE BIT                   IO         501
          PL        X1,OPENFA                                           IO         502
          SX7       CIO.WRIT+1     . WRITE COMPLETE FOR FILE OUTPUT     IO         503
OPENFA    SA1       B2+FI.FET+FET.LFN                                   IO         504
         BX1   X2*X1                                                    IO         505
         BX7   X1+X7                                                    IO         506
         SA7   A1                                                       IO         507
*                                                                       IO         508
         JP    OPEN                . RETURN                             IO         509
*                                                                       IO         512
*                                                                       IO         513
*  ROUTINE TO CLOSE ALL OUTPUT FILES (A"TUALLY, IT JUST DOES A WRITE EORIO         514
* OF LEVEL ZERO ON EACH.)                                               IO         515
*                                                                       IO         516
CLOSALL  BSSZ  1                   . ENTRY/EXIT                         IO         517
         STREAM FILLIST            . SET B2 = PTR TO FIRST FILE BLOCK   IO         518
CALOOP   RJ    CLOSE1                                                   IO         519
         STREAM B2                 . SET B2 = PTR TO NEXT FILE BLOCK    IO         520
         NZ    B2,CALOOP                                                IO         521
         JP    CLOSALL             . ZERO LINK MARKS END OF FILLIST     IO         522
*                                                                       IO         523
*                                                                       IO         524
*  CLOSE1:     ENSURE OUTPUT FILE ENDS WITH EOR.                        IO         525
*                                                                       IO         526
*  PARAMETER:  B2 = FILE BLOCK POINTER                                  IO         527
*                                                                       IO         528
CLOSE1   BSSZ  1                   . ENTRY/EXIT                         IO         529
*                                                                       IO         530
          SA1       B2+FI.RFC                                           IO         531
          PL        X1,CLOSE1      . FILE NEVER WRITTEN                 IO         532
*                                                                       IO         533
*  CHECK IF LAST OP WAS A WRITE                                         IO         534
*                                                                       IO         535
          SA2       B2+FI.FET+FET.LFN                                   IO         536
          SX0       4B                                                  IO         537
          BX0       X0*X2                                               IO         538
          ZR        X0,CLOSE1      . LAST OP WAS NOT A WRITE            IO         539
*                                                                       IO         540
*  CHECK IF ALREADY HAVE EOR OR EOF                                     IO         541
*                                                                       IO         542
          SX0       20B                                                 IO         543
          BX0       X0*X2                                               IO         544
          NZ        X0,CLOSE2      . CHECK FOR BUFFER FLUSHING          IO         545
*                                                                       IO         546
*  NEED TO ISSUE WRITER                                                 IO         547
*                                                                       IO         548
CLOSE1X  WARTAUF                   . WAIT FOR ALL QUIET                 IO         549
         CIO   CIO.WEOR,RECALL     . WRITE END OF RECORD                IO         550
*                                                                       IO         551
*  CHECK IF BUFFER HAS ANYTHING IN IT                                   IO         552
*                                                                       IO         553
CLOSE2    SA1       B2+FI.FET+FET.IN                                    IO         554
          SA2       B2+FI.FET+FET.OUT                                   IO         555
          IX1       X2-X1                                               IO         556
          ZR        X1,CLOSE1      . BUFFER IS EMPTY                    IO         557
          CIO       CIO.WRIT,RECALL                                     IO         558
         JP    CLOSE1                                                   IO         559
*                                                                       IO         560
*                                                                       IO         561
*                                                                       IO         562
*                                                                       IO         563
*                                                                       IO         564
*  THIS ROUTINE SENDS A MESSAGE TO THE DAYFILE SAYING HOW MANY          IO         565
*  TIMES LIST SPACE WAS COMPACTED                                       IO         566
*                                                                       IO         567
LSCMOUT   BSSZ      1                                                   IO         568
          SA1       LSCOUNT        . COUNT OF CALLS TO GARBCOLL         IO         569
          ZR        X1,LSCMOUT     . LSC NOT CALLED                     IO         570
          RJ        ICX1X6         . GET BCD STRING                     IO         571
          MX2       12                                                  IO         572
          LX2       60-6                                                IO         573
          MX7       6                                                   IO         574
          LX7       60-6                                                IO         575
          BX7       X7*X6          . IS IT ONE OR TWO CHARACTERS        IO         576
          NZ        X7,LSCM1       . WAS TWO CHARACTERS                 IO         577
          MX2       6                                                   IO         578
          LX2       60-12                                               IO         579
LSCM1     SA1       LSCMSG                                              IO         580
          BX1       -X2*X1         . MASK OUT FOR NUMBER                IO         581
          AX6       12             . RIGHT JUSTIFY NUMBER IN FIELD      IO         582
          BX6       X6*X2          . MASK OUT POSSIBLE SIGN EXTENSION   IO         583
          BX6       X1+X6                                               IO         584
          SA6       A1             . STORE MESSAGE WITH NUMBER          IO         585
          SA1       LSMCALL                                             IO         586
          BX6       X1                                                  IO         587
          SA6       1              . ISSUE REQUEST                      IO         588
+         SA1       1                                                   IO         589
          NZ        X1,*           . WAIT TIL CALL IS PICKED UP         IO         590
          EQ        LSCMOUT                                             IO         591
*                                                                       IO         592
LSMCALL   VFD       18/3LMSG,42/LSCMSG                                  IO         593
LSCMSG    DIS       ,$    LIST STORAGE COMPACTION(S) DONE $             IO         594
*                                                                       IO         595
          TITLE     INPUT ROUTINE                                       IO         596
GETL      MACRO                                                         IO         597
          LOCAL    NEXT                                                 IO         598
          SA1      B7              . NEXT FREE WORD                     IO         599
          NZ       X1,NEXT         . NOT THE LAST ONE                   IO         600
          RJ       MORFREE         . GET MORE                           IO         601
NEXT      SB7      X1              . UPDATE FREE POINTER                IO         602
          SX1      X1              . CLEAR UPPER 42 BITS                IO         603
          ENDM                                                          IO         604
*                                                                       IO         605
INPUT     DATA      0                                                   IO         606
          SB1       B3                                                  IO         607
          SA2       B1             INPUT ASSOCIATED VARIABLE DESCRIPTOR IO         608
          AX2       18                                                  IO         609
         SB2   X2+FI.FET           . FWA OF FET                         IO         610
          RJ        CBI                                                 IO         611
         SA3   B2-FI.FET+FI.RFC    . WORD WITH EOR,EOI FLAGS            IO         612
          MX6      1                                                    IO         613
          LX6      1+18+18+1       . EOR FLAG POSITION                  IO         614
          NZ       X1,READ         . BUFFER CONTAINS DATA               IO         615
          BX6      X6+X3           . SET EOR FLAG                       IO         616
          SA6      A3                                                   IO         617
          MX7      1                                                    IO         618
          BX7      -X7*X4          . CBI LEFT FET FIRST WORD IN X4      IO         619
          LX7      5                                                    IO         620
          SA7      A4                                                   IO         621
          RJ       ZROX7                                                IO         622
          SA2      B1                                                   IO         623
          SA7      X2              . NULL VALUE                         IO         624
          EQ       FAIL                                                 IO         625
READ      BX6      -X6*X3          . CLEAR EOR FLAG                     IO         626
          SA6      A3                                                   IO         627
          SB5      B0              . CLEAR END FLAG                     IO         628
          SA4      B1              . INPUT ASSOCIATED SVD               IO         629
          LX4      60-36           . RIGHT JUSTIFY UNIT RECORD LENGTH   IO         630
          SB3      X4                                                   IO         631
          SA1      MXLNGTH         . MAXIMUM STRING LENGTH KEYWORD      IO         632
          SX2      X4                                                   IO         633
          IX2      X1-X2                                                IO         634
          NG       X2,ERR18        . ERROR - TOO LONG                   IO         635
          RJ       GETB            . GET DATA WORD IN X2                IO         636
          GETL                     GET LIST WORD                        IO         637
          SX6       A1                                                  IO         638
          SX3       SSTY                                                IO         639
          LX3       55                                                  IO         640
          BX6       X3+X6          NEW ISD                              IO         641
          MX0       18                                                  IO         642
          LX0       54                                                  IO         643
          LX4       36                                                  IO         644
          BX0       X0*X4                                               IO         645
          BX6       X0+X6                                               IO         646
          SA6       X4                                                  IO         647
          MX0       42                                                  IO         648
          BX6       X0*X2                                               IO         649
          EQ        LOOPA                                               IO         650
LPLP      RJ       GETB            . GET BUFFER WORD ONE                IO         651
          MX0       42                                                  IO         652
          BX6       X0*X2                                               IO         653
          ZR        X6,ENDL                                             IO         654
          GETL                     REACHED END-OF-UNIT-RECORD           IO         655
LOOPA     BX6       X1+X6                                               IO         656
          SA6       A1+0           STORE LIST WORD 1                    IO         657
          BX6       -X0*X2                                              IO         658
          ZR        X6,ENDL                                             IO         659
          RJ        GETB           GET BW2                              IO         660
          MX0       24                                                  IO         661
          LX6       42                                                  IO         662
          BX3       X0*X2                                               IO         663
          LX3       42                                                  IO         664
          BX6       X3+X6                                               IO         665
          GETL                                                          IO         666
          BX6       X1+X6                                               IO         667
          SA6       A1             STORE LW2                            IO         668
          BX6       -X0*X2                                              IO         669
          ZR        X6,ENDL                                             IO         670
          RJ        GETB           GET BW3                              IO         671
          MX0       6                                                   IO         672
          LX6       24                                                  IO         673
          BX3       X0*X2                                               IO         674
          LX3       24                                                  IO         675
          BX6       X3+X6                                               IO         676
          GETL                                                          IO         677
          BX6       X1+X6                                               IO         678
          SA6       A1             STORE LW3                            IO         679
          BX2       -X0*X2                                              IO         680
          ZR        X2,ENDL                                             IO         681
          MX0       42                                                  IO         682
          LX2       6                                                   IO         683
          BX6       X0*X2                                               IO         684
          GETL                                                          IO         685
          BX6       X1+X6                                               IO         686
          SA6       A1             STORE LW4                            IO         687
          BX6       -X0*X2                                              IO         688
          ZR        X6,ENDL                                             IO         689
          RJ        GETB           GET BW4                              IO         690
          MX0       30                                                  IO         691
          LX6       42                                                  IO         692
          BX3       X0*X2                                               IO         693
          LX3       48                                                  IO         694
          BX6       X3+X6                                               IO         695
          GETL                                                          IO         696
          BX6       X1+X6                                               IO         697
          SA6       A1             STORE LW5                            IO         698
          BX6       -X0*X2                                              IO         699
          ZR        X6,ENDL                                             IO         700
          RJ        GETB           GET BW5                              IO         701
          MX0       12                                                  IO         702
          LX6       30                                                  IO         703
          BX3       X0*X2                                               IO         704
          LX3       30                                                  IO         705
          BX6       X3+X6                                               IO         706
          GETL                                                          IO         707
          BX6       X1+X6                                               IO         708
          SA6       A1             STORE LW6                            IO         709
          BX2       -X0*X2                                              IO         710
          ZR        X2,ENDL                                             IO         711
          LX2       12                                                  IO         712
          MX0       42                                                  IO         713
          BX6       X0*X2                                               IO         714
          GETL                                                          IO         715
          BX6       X1+X6                                               IO         716
          SA6       A1             STORE LW7                            IO         717
          BX6       -X0*X2                                              IO         718
          ZR        X6,ENDL                                             IO         719
          RJ        GETB           GET BW6                              IO         720
          MX0       36                                                  IO         721
          LX6       42                                                  IO         722
          BX3       X0*X2                                               IO         723
          LX3       54                                                  IO         724
          BX6       X3+X6                                               IO         725
          GETL                                                          IO         726
          BX6       X1+X6                                               IO         727
          SA6       A1             STORE LW8                            IO         728
          BX6       -X0*X2                                              IO         729
          ZR        X6,ENDL                                             IO         730
          RJ        GETB           GET BW7                              IO         731
          MX0       18                                                  IO         732
          LX6       36                                                  IO         733
          BX3       X0*X2                                               IO         734
          LX3       36                                                  IO         735
          BX6       X3+X6                                               IO         736
          GETL                                                          IO         737
          BX6       X1+X6                                               IO         738
          SA6       A1             STORE LW9                            IO         739
          BX6       -X0*X2                                              IO         740
          ZR        X6,ENDL                                             IO         741
          LX6       18                                                  IO         742
          GETL                                                          IO         743
          BX6       X1+X6                                               IO         744
          SA6       A1             STORE LW10                           IO         745
          EQ       LPLP                                                 IO         746
ENDL      SA1       A6                                                  IO         747
          MX0       42                                                  IO         748
          BX6       X0*X1                                               IO         749
          SA6       A6                                                  IO         750
          SA2       B1             IAVD                                 IO         751
          SA2       X2             ISD                                  IO         752
          SX3       A6             LWA OF NEW STRING                    IO         753
          LX3       18             IS INSERTED                          IO         754
          BX6       X2+X3          INTO ISD                             IO         755
          SA6       A2                                                  IO         756
          RJ        CZB            SKIP UP TO ZERO BYTE                 IO         757
CHECK1    SA1       B2+2           IN                                   IO         758
          SA2       B2+3           OUT                                  IO         759
          IX1       X1-X2                                               IO         760
          SA2       B2+1           FIRST                                IO         761
          SA3       B2+4           LIMIT                                IO         762
          IX2       X3-X2                                               IO         763
          SX2       X2                                                  IO         764
          AX2       1              BUFFER LENGTH / 2                    IO         765
          NG        X1,CHECK2                                           IO         766
          BX2       -X2                                                 IO         767
CHECK2    IX1       X1+X2                                               IO         768
          PL        X1,INPUT                                            IO         769
          SA1      B2                                                   IO         770
          LX1       55                                                  IO         771
          NG        X1,INPUT                                            IO         772
          EQ        INPUT                                               IO         774
BLANKS    DATA     10H                                                  IO         775
          TITLE     OUTPUT ROUTINE                                      IO         776
OUTPUT    DATA      0                                                   IO         777
          SA2       B3             OUTPUT ASSOCIATED VARIABLE DESCRIPTORIO         778
          SA1       X2             SIMPLE VARIABLE DESCRIPTOR           IO         779
          SB4       X1             B4 = NEXT LIST WORD                  IO         780
          AX2       18                                                  IO         781
         SB2   X2+FI.FET           . FWA OF FET                         IO         782
          AX2       18                                                  IO         783
          MX0       54                                                  IO         784
          BX6       -X0*X2         CARRIAGE CONTROL CHARACTER           IO         785
          LX6       54             LEFT JUSTIFY CCC                     IO         786
          NZ        X6,HAV1        IF CCC IS NONNULL, ENTER SEQ AT HAV1 IO         787
HAV0      ZR        B4,H01                                              IO         788
          SA1       B4             GET LIST WORD 1                      IO         789
          SB4       X1                                                  IO         790
          MX0       42                                                  IO         791
          BX6       X0*X1                                               IO         792
          SX1       0                                                   IO         793
          ZR        B4,H01                                              IO         794
          SA1       B4                                                  IO         795
          SB4       X1                                                  IO         796
          MX0       18                                                  IO         797
          BX3       X0*X1                                               IO         798
          LX3       18                                                  IO         799
          BX6       X3+X6                                               IO         800
H01       RJ        PUTB           STORE BUFFER WORD 1                  IO         801
          LX1       18                                                  IO         802
          MX0       24                                                  IO         803
          BX6       X0*X1          REMAINDER TO X6                      IO         804
          SX1       B0                                                  IO         805
HAV4      ZR        B4,H41                                              IO         806
          SA1       B4                                                  IO         807
          SB4       X1                                                  IO         808
          MX0       36                                                  IO         809
          BX3       X0*X1                                               IO         810
          LX3       36                                                  IO         811
          BX6       X3+X6                                               IO         812
H41       RJ        PUTB           STORE BW2                            IO         813
          LX1       36                                                  IO         814
          MX0       6                                                   IO         815
          BX6       X0*X1                                               IO         816
          SX1       B0                                                  IO         817
HAV1      ZR        B4,H11                                              IO         818
          SA1      B4+0                                                 IO         819
          SB4      X1+0                                                 IO         820
          MX0       42                                                  IO         821
          BX3       X0*X1                                               IO         822
          LX3       54                                                  IO         823
          BX6       X3+X6                                               IO         824
          SX1      0                                                    IO         825
HAV8      ZR        B4,H11                                              IO         826
          SA1       B4                                                  IO         827
          SB4       X1                                                  IO         828
          MX0       12                                                  IO         829
          BX3       X0*X1                                               IO         830
          LX3       12                                                  IO         831
          BX6       X3+X6                                               IO         832
H11       RJ        PUTB           STORE BW3                            IO         833
          LX1       12                                                  IO         834
          MX0       30                                                  IO         835
          BX6       X0*X1                                               IO         836
          SX1       B0                                                  IO         837
HAV5      ZR        B4,H51                                              IO         838
          SA1       B4                                                  IO         839
          SB4       X1                                                  IO         840
          MX0       30                                                  IO         841
          BX3       X0*X1                                               IO         842
          LX3       30                                                  IO         843
          BX6       X3+X6                                               IO         844
H51       RJ        PUTB           STORE BW4                            IO         845
          LX1       30                                                  IO         846
          MX0       12                                                  IO         847
          BX6       X0*X1                                               IO         848
          SX1       B0                                                  IO         849
HAV2      ZR        B4,H21                                              IO         850
          SA1      B4+0                                                 IO         851
          SB4      X1+0                                                 IO         852
          MX0       42                                                  IO         853
          BX3       X0*X1                                               IO         854
          LX3       48                                                  IO         855
          BX6       X3+X6                                               IO         856
          SX1      0                                                    IO         857
HAV9      ZR        B4,H21                                              IO         858
          SA1       B4                                                  IO         859
          SB4       X1                                                  IO         860
          MX0       6                                                   IO         861
          BX3       X0*X1                                               IO         862
          LX3       6                                                   IO         863
          BX6       X3+X6                                               IO         864
H21       RJ        PUTB           STORE BW5                            IO         865
          LX1       6                                                   IO         866
          MX0       36                                                  IO         867
          BX6       X0*X1                                               IO         868
          SX1       B0                                                  IO         869
HAV6      ZR        B4,H61                                              IO         870
          SA1       B4                                                  IO         871
          SB4       X1                                                  IO         872
          MX0       24                                                  IO         873
          BX3       X0*X1                                               IO         874
          LX3       24                                                  IO         875
          BX6       X3+X6                                               IO         876
H61       RJ        PUTB           STORE BW6                            IO         877
          LX1       24                                                  IO         878
          MX0       18                                                  IO         879
          BX6       X0*X1                                               IO         880
          SX1       B0                                                  IO         881
HAV3      ZR        B4,H31                                              IO         882
          SA1       B4                                                  IO         883
          SB4       X1                                                  IO         884
          MX0       42                                                  IO         885
          BX3       X0*X1                                               IO         886
          LX3       42                                                  IO         887
          BX6       X6+X3                                               IO         888
H31       RJ        PUTB                                                IO         889
          SX6       0                                                   IO         890
          EQ        HAV0                                                IO         891
PUTB      DATA      0                                                   IO         892
          RJ        PB                                                  IO         893
          RJ        CBO                                                 IO         894
          NZ        X6,PUTB                                             IO         895
          SA1       B2-1           . CHECK IF FILE HAS BEEN WRITTEN     IO         896
          NG        X1,OUTPUT      . FILE HAS BEEN WRITTEN ON BEFORE    IO         897
          MX6       1              . MARK FILE AS                       IO         898
          BX6       X6+X1          . HAVING BEEN WRITTEN INTO           IO         899
          SA6       A1                                                  IO         900
          SA1       B2             . PUT WRITE-COMPLETE IN FET          IO         901
          MX6       42                                                  IO         902
          BX1       X6*X1          . FILENAME                           IO         903
          SX6       CIO.WRIT+1     . WRITE COMPLETE                     IO         904
          BX6       X6+X1                                               IO         905
          SA6       B2             . STORE STATUS                       IO         906
          EQ        OUTPUT                                              IO         907
*                                                                       IO         908
*                                                                       IO         909
         END                                                            IO         910