*DECK INSTALL 
          IDENT  INSTALL
          ENTRY  INSTALL
* 
*   THIS PROGRAM MERGES THE BASIC21 OVERLAY (TABLE OF RUNTIME ADDRESSES)
*   INTO THE BASIC00 OVERLAY (THE COMPILER) AT INSTALLATION TIME SO THAT
*   THE BASIC21 OVERLAY NEED NOT BE LOADED AT EXECUTION TIME. 
*   THE BASIC00 OVERLAY IS EXPECTED TO BE ON FILE "TAPE1" 
*   THE BASIC21 OVERLAY IS EXPECTED TO BE ON FILE "TAPE2" 
*   THE UPDATED BASIC00 OVERLAY IS REWITTEN ON FILE "TAPE1" 
* 
 BSC00    BSS    52760B            BASIC (0,0) BUFFER 
* 
 BSC21    BSS    621B              BASIC (2,1) BUFFER 
* 
 FWAS00   BSSZ   1
 FWAS21   BSSZ   1
 LEN00    BSSZ   1
 LEN21    BSSZ   1
 OFFSET   BSSZ   1
* 
 FET1     BSS    0                 TAPE1 FET
          VFD    42/5LTAPE1,18/1
          VFD    60/BSC00          FIRST
          VFD    60/BSC00          IN 
          VFD    60/BSC00          OUT
          VFD    60/BSC00+52760B   LIMIT
* 
 FET2     BSS    0                 TAPE2 FET
          VFD    42/5LTAPE2,18/1
          VFD    60/BSC21          FIRST
          VFD    60/BSC21          IN 
          VFD    60/BSC21          OUT
          VFD    60/BSC21+620B     LIMIT
* 
          DATA   10HINSTALL 
 INSTALL  BSS    0                 ENTRY/EXIT 
          SB1    1                 FORCE B1=1 
* 
*    READ IN BASIC (0,0) OVERLAY FROM TAPE1 INTO BSC00
* 
          READ   FET1,R 
* 
*    READ IN BSFUNTBL (2,1) OVERLAY FROM TAPE2 INTO BSC21 
* 
          READ   FET2,R 
* 
          SA1    FET1+2            FETCH TAPE1 IN POINTER 
          BX6    X1                SAVE FOR LATER USE 
          SA6    LEN00             (0,0) OVL LENGTH 
* 
*     REWIND TAPE1
* 
          REWIND FET1,R 
* 
          SA1    LEN00             FETCH (0,0) OVL LEN
          BX6    X1 
          SA6    FET1+2            UPDATE,TAPE1 IN POINTER
* 
          SA1    BSC00+15          5400 HEADER FOR TAPE1
          SA2   BSC21+20        BSFUNTBL ORIGIN ADDRESS 
          AX1    18 
          MX3    42 
          BX6    -X3*X1            X6 = FWA OF (0,0) OVERLAY
          BX7    -X3*X2            X7 = FWA OF (2,1) OVERLAY
          SA6    FWAS00 
          SA7    FWAS21 
          IX6    X7-X6             GET OFFSET 
          SA6    OFFSET 
* 
*     CALCULATE LENGTH OF BSFUNTBL (2,1) OVERLAY
* 
          SA1    BSC21+16          OVL LEN =BITS 59-42
          AX1    42 
          SX6    X1+5              (2,1) OVL LEN + 5400 HEADER LEN
          SA6    LEN21             SAVE MOVE LENGTH 
* 
*     MERGE (2,1) OVERLAY INTO MAIN (0,0) OVERLAY 
* 
          SB6    X6-1              B6 = (2,1) LENGTH
          SB7    B0                B7 = NO. OF WORDS MOVED
          SX1    BSC00+15          FETCH FWA OF (0,0) 5400 HEADER 
          SA2    OFFSET            X2 = (0,0) LOADER OFFSET 
          IX2    X1+X2             X2 = (0,0) BASE ADDRESS FOR MOVE 
          SA1    BSC21+15          X1 = FIRST (2,1) WORD TO MOVE
 NEXT     BX6    X1 
          SA6    X2                MERGE
          SB7    B7+B1             INCR WORD COUNT
          SA1    A1+B1             FETCH NEXT WORD TO MOVE
          SX2    X2+B1             INCR (0,0) BASE ADDRESS
          LE     B7,B6,NEXT        BR, MOVE NEXT (2,1) WORD 
* 
*     WRITE OUT UPDATED BASIC (0,0) OVERLAY 
* 
          WRITER FET1,R            WRITE OUT NEW (0,0) OVL
* 
          ENDRUN
          END    INSTALL
