
* 
*         SYSTEM ID CHECK 
*     SECTION TO ENSURE THAT ALL LABELS HAVE THE
*     SAME SYSTEM ID AS LOGICAL PACK 0. 
* 
      STA FBTM2     START WITH PACK ZERO LABEL
      LDB FBLQT     GET POINTER TO LOGICAL PACK NUMBER
FBLCD EQU * 
      LDA B,I       GET LOGICAL PACK NUMBER 
      SZA,RSS       WE'RE LOOKING FOR ZERO
      JMP FBLCA     FOUND IT
      INB           LOOK AT NEXT TABLE ENTRY
      ISZ FBTM2     COUNT UP FUNNY NUMBER 
      JMP FBLCD     GO LOOK AT NEXT ENTRY 
      JMP FBER4     "INCONSISTENT LABELS" 
*                   SINCE UNIT ZERO MUST BE IN THE EQT, 
*                   WE WILL NEVER FALL THROUGH. 
* 
FBLCA EQU * 
      LDA FBTM2     GET TABLE DISPLACEMENT FOR LOGICAL ZERO 
      ALF,RAL       * 32
      ADA FBLBA     GENERATE LABEL ADDRESS
      ADA FBD3      MOVE TO SYSTEM ID 
      STA FBTM2     SAVE POINTER TO EXPECTED ID 
      LDA FBLBA     LOAD POINTER TO FIRST LABEL 
      ADA FBD3      MOVE TO FIRST ID
      STA FBTM3     SAVE FOR LOOP 
      LDA FBM5      A _ -5
      STA FBTM1     SAVE COUNTER ( WORDS IN ID )
FBLCF EQU * 
      LDB FBTM3     GET POINTER TO FIRST LABEL
      CLA 
FBLCH EQU * 
      STA FBTM4     SAVE DISPLACEMENT POINTER 
      ADA FBEQT     MAKE POINTER INTO EQUIPMENT TABLE 
      LDA A,I       DOES THIS DRIVE EXIST?
      SZA,RSS       SKIP IF IT DOES 
      JMP FBLCJ     NO SUCH DRIVE 
      LDA FBTM2,I   LOAD EXPECTED LABEL WORD
      CPA B,I       COMPARE WITH THE CURRENT LABEL
      JMP FBLCJ 
* 
      LDA FBM15     A _ -15 
      LDB FBEA6     "WRONG SYSTEM ID" 
      JMP FBER
FBLCJ EQU * 
      ADB FBD32     MOVE TO NEXT LABEL ID AREA
      LDA FBTM4     LOAD DISPLACEMENT NUMBER
      INA           AND COUNT UP
      CPA FBD8      HAVE WE LOOKED AT THIS WORD 
      RSS           IN ALL OF THE LABELS
      JMP FBLCH     CHECK THIS WORD IN NEXT LABEL 
      ISZ FBTM3     COUNT UP BASE ADDRESS 
      ISZ FBTM2     COUNT UP PACK 0 ID ADDRESS
      ISZ FBTM1     CHECK ALL 
      JMP FBLCF       FIVE WORDS. 
* 
*         CHECK COMPLETE
* 
*                   SECTION TO MOVE THE SORTED SELECT 
*                   CODES INTO THE OLD EQT. 
* 
* 
      LDA FBM8      A _ -8
      STA FBTM2     SET COUNTER 
      LDB FBSEQ     GET POINTER TO EXTRA EQT
      STB FBTM1 
      LDB FBEQT     GET POINTER TO OLD EQT
FBMST EQU * 
      LDA FBTM1,I   LOAD SELECT CODE FROM SORTED TABLE
      STA B,I       STORE INTO OLD EQT
      INB           ADVANCE POINTER 
      ISZ FBTM1     ADVANCE LOAD POINTER
      ISZ FBTM2     COVER ENTIRE TABLE
      JMP FBMST 
* 
* 
*         SECTION TO READ IN THE LOADER AND THE 
*     SYSTEM FROM THE DISC. 
*         THE AREA FROM 32000 TO 71777B IS LATER USED FOR 
*     BUFFERS IN LDLIB.  LDLIB RESTORES THE AREA BEFORE 
*     STARTING THE SYSTEM 
* 
      CLA           ALL READS ARE 
      STA FBTPT       ON LOGICAL UNIT ZERO
      LDA MLTBL     LOAD LENGTH OF SST. 
      ADA FELDS     ADD EXTRA ENTRIES FOR        [B]
      STA FBTM1       THE LOADER. 
      LDA MLTFA     LOAD SST ADDRESS. 
      STA FBTM2 
FBLRS EQU * 
      DLD FBTM2,I   LOAD LENGTH AND CORE ADDRESS. 
      STA FBTM3     SAVE - LENGTH AND 
      STB FBTM4       CORE ADDRESS. 
      ISZ FBTM2     COUNT POINTER UP
      ISZ FBTM2       TO DISC ADDRESS 
      LDB FBTM2,I   LOAD BLOCK NUMBER 
      ISZ FBTM2 
      LDA FBTM2,I     INTO B AND A. 
      CLE,ELA 
      ELB           CONVERT TO SECTOR NUMBER
      DIV FBSPC     / (SECTORS PER CYLINDER)
      STA FBCYL     SAVE CYLINDER NUMBER
FBLRT EQU * 
      STB FBERC     SAVE FOR READABLE CHUNK CALCULATION 
      LDA B         GET SECTOR NUMBER WITHIN CYLINDER 
      CLB           SET FOR DIVIDE
      DIV FBSPT     / (SECTORS PER TRACK) 
      ALF,ALF       SHIFT HEAD NUMBER 
      IOR B         PLUG IN SECTOR NUMBER 
      STA FBHDS       AND SAVE FOR DISC DRIVER
      LDA FBERC     GET SECTOR WITHIN CYLINDER
      CMA,INA 
      ADA FBSPC     FIND HOW MANY REMAINING 
      LSL 7         MAKE WORD COUNT 
      LDB A 
      CMA,CLE,INA   MAKE NEGATIVE WORD COUNT
      ADB FBTM3     GET DIFFERENCE
*                                     ( ALLOWED - REQUESTED ).
      SEZ           SKIP IF CHUNKY READ REQUIRED
      JMP FBLRV     READ LAST SECTION.
      STB FBTM3     SAVE W.C. FOR LATER SECTION(S). 
      STA FBWD      SAVE W.C. FOR THIS SECTION. 
      CMA,INA       POSITIVE WORD COUNT AGAIN.
      LDB FBTM4     LOAD CORAD FOR THIS SECTION.
      ADA FBTM4     GENERATE CORE ADDRESS FOR NEXT
      STA FBTM4       SECTION(S). 
      JSB FBRD      READ IN THE CURRENT SECTION.
      ISZ FBCYL     COUNT UP TO NEXT CYLINDER 
      CLB           HEAD/SECTOR ZERO/ZERO.
      JMP FBLRT     GO RECALCULATE READABLE CHUNK SIZE. 
FBLRV EQU * 
      LDA FBTM3     GET WORD COUNT
      STA FBWD      RECORD WORD COUNT 
      LDB FBTM4     LOAD CORE ADDRESS 
      JSB FBRD      READ IN BLOCK 
      ISZ FBTM2 
      ISZ FBTM1     HAVE WE READ ALL PIECES?
      JMP FBLRS 
* 
*     NOW . . . . 
*         JUMP INTO THE LOADER TO FINISH THE DISC 
*     RELOAD PROCESS. 
* 
      JMP LDLIB 
      HED FINAL DISC BOOTSTRAP ERROR MESSAGE PRINTER
* 
*         ROUTINE TO OUTPUT AN ERROR MESSAGE TO THE CONSOLE.
*     ENTER WITH B POINTING TO THE OUTPUT BUFFER, 
*     A THE NEGATIVE CHARACTER COUNT
* 
FBTTY NOP 
      STA FBTCN     SAVE CHARACTER COUNT
      BLS           MAKE B A CHARACTER ADDRESS
      STB FBFAD 
      LDA FB12K 
      OTA TTYSC     TELL TTY TO PRINT 
FBTL  EQU * 
      LDB FBFAD     LOAD CHARACTER POINTER
      ISZ FBFAD     COUNT UP CHARACTER POINTER
      CLE,ERB       MAKE INTO WORD POINTER
      LDA B,I       GET WORD
      SEZ,RSS 
      ALF,ALF       GET THE CORRECT HALF
      AND FB177     MASK TO SEVEN BITS
      IOR FB200     PLUG IN BIT SEVEN 
      OTA TTYSC     OUTPUT IT 
      STC TTYSC,C   START TTY 
      SFS TTYSC     WAIT FOR OPERATION TO FINISH
      JMP *-1 
      ISZ FBTCN     CHECK OUT COUNTER 
      JMP FBTL
      JMP FBTTY,I   RETURN
      SKP 
FBER1 EQU *         NOT READY 
      LDA FBM10     A _ -10 
      LDB FBEA1     "NOT READY" 
      JMP FBER
FBER2 EQU *         READ ERROR
      LDA FBM11     A _ -11 
      LDB FBEA2     "READ ERROR"
      JMP FBER
FBER3 EQU *         NO TSB LABEL
      LDA FBM13     A _ -13 
      LDB FBEA3     "NO TSB LABEL"
      JMP FBER
FBER4 EQU *         INCONSISTENT LABELS 
      LDA FBM20     A _ -20 
      LDB FBEA4     "INCONSISTENT LABELS" 
FBER  EQU * 
      JSB FBTTY     PRINT ERROR MESSAGE 
      LDA FBDC1     GET THE SELECT CODE 
      AND FBB70     ISOLATE LEFT OCTAL DIGIT
      ALF,RAL       PLACE IN LEFT CHARACTER POSITION
      LDB A         COPY TO B 
      LDA FBDC1 
      AND FBB7      ISOLATE RIGHT CHARACTER 
      IOR B         PLUG IN LEFT CHARACTER
      IOR FBAC0     MAKE INTO ASCII CHARACTERS
      STA FBEL1     STORE INTO ERROR MESSAGE
      LDA FBUNT     GET UNIT NUMBER 
      ALF,ALF       TO LEFT CHARACTER POSITION
      IOR FBACC     MAKE INTO ASCII WITH CR 
      STA FBEL2     STORE INTO MESSAGE
      LDA FBM21     A _ -21 
      LDB FBEA5     " SEL CODE MM UNIT N" 
      JSB FBTTY     PRINT TRAILER 
      HLT 
      JMP FBST      RESTART FROM BEGINNING
* 
      SUP 
FBEA1 DEF *+1 
      OCT 5116      LF - N
      ASC 4,OT READY
FBEA2 DEF *+1 
      OCT 5122      LF - R
      ASC 5,EAD ERROR 
FBEA3 DEF *+1 
      OCT 5116      LF - N
      ASC 6,O TSB LABEL 
FBEA4 DEF *+1 
      OCT 5111      LF - I
      ASC 9,NCONSISTENT LABELS
FBEA5 DEF *+1 
      ASC 5, SEL CODE 
FBEL1 OCT 000000
      ASC 3, UNIT 
FBEL2 OCT 000000
      OCT 005000
FBEA6 DEF *+1 
      ASC 8,WRONG SYSTEM ID 
      UNS 
      HED FINAL DISC BOOTSTRAP DISC READ ROUTINES 
* 
* 
FSCMD EQU * 
      NOP 
      IOR FBUNT     PLUG IN UNIT NUMBER 
FBCC1 OTA CC        OUT TO COMMAND CHANNEL
FBCC2 CLC CC        DROP ENCODE 
FBCC3 STC CC,C      GIVE EDGE ON ENCODE 
      JMP FSCMD,I   RETURN
* 
*                   WAIT FOR DATA WORD
* 
FSWTD EQU * 
      NOP 
      LDA FBWD      USE THE WORD COUNT
FBWTF EQU * 
      INA,SZA,RSS   COUNT AND TEST
      JMP FBERR     TOOK TOO LONG 
FBDC1 SFS DC        WAIT FOR FLAG ON DATA CHANNEL 
      JMP FBWTF 
      JMP FSWTD,I   RETURN
* 
FSTUS EQU * 
      OCT 010000    STATUS COMMAND
FSRCL EQU * 
      OCT 020000    RECALIBRATE COMMAND 
FSEEK EQU * 
      OCT 030000    POSITION COMMAND
FSRDC EQU * 
      OCT 040000    READ COMMAND
FSDMC EQU * 
FBDC2 ABS 120000B+DC  DMA CONTROL WORD
* 
*         ROUTINE TO WAIT FOR THE COMMAND CHANNEL FLAG
*     THEN TO CHECK THE DRIVE STATUS. 
* 
FSWAT EQU * 
      NOP 
      CLA 
FSWAX EQU * 
      LDB FB177,I   WASTE TIME
      INA,SZA,RSS   COUNT AND TEST
      JMP FBERR     TOOK TOO LONG, CROAK
FBCC4 SFS CC        WAIT FOR COMMAND FLAG 
      JMP FSWAX     LOOP
* 
*                   STATUS ROUTINE
* 
FBDC3 STC DC,C      SET UP DATA CHANNEL 
      LDA FSTUS     GET STATUS COMMAND
      JSB FSCMD 
      JSB FSWTD     WAIT FOR WORD 
FBDC4 LIA DC        LOAD STATUS WORD
      AND FB177     MASK OFF UNIT BIT 
      SZA,RSS       SKIP IF BAD STATUS
      JMP FSWAT,I   STATUS OKAY, RETURN 
      AND FBNRB     CHECK FOR NOT READY 
      SZA           NO SKIP IF DRIVE NOT READY
      JMP FBER1     NOT READY 
FBERR EQU * 
      CLC 0,C       ZAP I/O 
      ISZ FBERC     CHECK ERROR COUNT 
      JMP FBRLR     TRY AGAIN 
      JMP FBER2     READ ERROR
* 
*                   RECALIBRATE.
* 
FBRLR EQU * 
      LDA FSRCL     LOAD RECALIBRATE COMMAND, 
      JSB FSCMD       ISSUE IT, 
      JSB FSWAT         AND WAIT FOR RESULTS. 
      JMP FBRPT     ENTRY FOR REPEAT
* 
FBRD  EQU *         ENTRY TO READ ROUTINE 
      NOP 
      STB FSCAD     SAVE CORE ADDRESS 
      LDB FBTPT     LOAD UNIT NUMBER
      ADB FBEQT     MAKE REFERENCE TO EQT 
      LDA B,I       GET SELECT CODE AND UNIT NUMBER 
      AND FBB7      MASK OFF TO UNIT NUMBER 
      STA FBUNT     STORE UNIT NUMBER FOR FSCMD ROUTINE 
      LDA B,I       GET SEL CODE BACK 
      ALF,ALF       SELECT CODE TO RIGHT
      AND FB77      ISOLATE SELECT CODE 
      STA FBERC     USE ERROR COUNTER FOR TEMP
      LDB FBAUA     LOAD BEGIN POINTER
FBCL  EQU * 
      LDA B,I       LOAD WORD TO BE CONFIGURED
      AND FDM64     MASK OUT SELECT CODE
      IOR FBERC     PLUG IN NEW SELECT CODE 
      STA B,I       PUT WORD BACK 
      INB           COUNT UP POINTER
      CPB FBAUB     CHECK FOR DOWN TO COMMAND CHANNEL PART
      ISZ FBERC 
      CPB FBAUC     CHECK FOR DONE
      RSS 
      JMP FBCL      GO BACK AND DO SOME MORE
      LDA FBM8      A _ -8
      STA FBERC     SET ERROR COUNTER 
FBRPT EQU * 
      LDA FBCYL     GET CYLINDER NUMBER 
FBDC5 OTA DC        OUT TO DATA CHANNEL 
FBDC6 STC DC,C      SET ENCODE
      LDA FSEEK     LOAD SEEK COMMAND 
      JSB FSCMD       AND DO IT 
      JSB FSWTD     WAIT FOR CYLINDER WORD TO GO
      LDA FBHDS     LOAD HEAD/SECTOR NUMBER 
FBDC7 OTA DC        WORD OUT TO DATA CHANNEL
FBDC8 STC DC,C      ENCODE HIGH 
      JSB FSWTD     WAIT FOR HD/S WORD TO GO
      JSB FSWAT     WAIT FOR SEEK TO FINISH 
      SKP 
* 
*                   SET UP DMA
* 
      LDA FSDMC     LOAD DMA CONTROL WORD 
      OTA DMAH      AND PUT IT OUT TO DMA HIGH
      CLC DMAL      SET UP FOR CORE ADDRESS 
      LDA FSCAD     GET CORE ADDRESS
      IOR FBT15     MAKE READ FORM
      OTA DMAL
      STC DMAL      SET UP FOR WORD COUNT 
      LDA FBWD      GET WORD COUNT
      OTA DMAL
FBDC9 STC DC,C      SET ENCODE, CLEAR SRQ 
      STC DMAH,C    START DMA CHANNEL 
* 
*                   ISSUE READ
* 
      LDA FSRDC     GET READ COMMAND
      JSB FSCMD       AND ISSUE IT
      JSB FSWAT     WAIT FOR READ TO FINISH 
      JMP FBRD,I    RETURN
* 
FELDS DEC -5        MUST BE = TO ELDSG           [B]
FBAUA DEF FBATA,I 
FBAUB DEF FBATB,I 
FBAUC DEF FBATC,I 
FBATA EQU * 
      DEF FBDC1 
      DEF FBDC2 
      DEF FBDC3 
      DEF FBDC4 
      DEF FBDC5 
      DEF FBDC6 
      DEF FBDC7 
      DEF FBDC8 
      DEF FBDC9 
FBATB EQU * 
      DEF FBCC1 
      DEF FBCC2 
      DEF FBCC3 
      DEF FBCC4 
FBATC EQU * 
FDM64 OCT 177700
FBM32 DEC -32 
FBM21 DEC -21 
FBM20 DEC -20 
FBM15 DEC -15 
FBM13 DEC -13 
FBM11 DEC -11 
FBM10 DEC -10 
FBM8  DEC -8
FBM5  DEC -5
FBD3  DEC 3 
FBB7  OCT 000007
FBD8  DEC 8 
FBSPT DEC 23        SECTORS PER TRACK 
FBD32 DEC 32
FBB70 OCT 000070
FB77  OCT 000077
FBNRB OCT 000100    NOT READY BIT 
FB177 OCT 177 
FB200 OCT 000200
FBSPC DEC 460       SECTORS PER CYLINDER
FBLBA OCT 002000    WHERE LABEL BUFFERS START 
FBT15 OCT 100000
FB12K OCT 120000
FBAC0 ASC 1,00
FBACC OCT 030015
FBATS ASC 1,TSB 
FBEQT DEF *+1 
      BSS 8         SELECT CODE AND UNIT TABLE
*                                   ENTRIES APPEAR WHERE THE ORIGINAL 
*                                   SYSTEM HAD A LOGICAL PACK.
MLTFA DEF MLTBL+1   SYSTEM SEGMENT TABLE ADDRESS. 
FBLQT DEF FBLQU 
FBSEQ DEF FBSEU 
* 
*         FINAL DISC BOOTSTRAP TO THIS POINT MUST FIT ON
*     THE TWO DISC BLOCKS ALLOCATED FOR IT. 
*     THE REMAINING BSS AREA ( TO FBEND ) IS USED SOLELY FOR
*     TEMPORARY STORAGE.
* 
FBTPT BSS 1         POINTER TO DISC SELECT CODE 
FBCYL BSS 1         WORD FOR CYLINDER NUMBER
FBFAD BSS 1 
FBHDS BSS 1         FOR HEAD AND SECTOR NUMBERS 
FBTM1 BSS 1 
FBTM2 BSS 1 
FBTM3 BSS 1 
FBTM4 BSS 1 
FBTCN BSS 1 
FBWD  BSS 1         WORD COUNT WORD FOR MINI-DRIVER 
FBERC BSS 1         DISC ERROR COUNTER
FSCAD BSS 1         CORE ADDRESS OF TRANSFER
FBUNT BSS 1 
FBLQU BSS 8         LOGICAL PACK INFORMATION
*                                   USED DURING BOOTSTRAP SEQUENCE
FBSEU BSS 8         EXTRA EQT FOR SORT
FBEND EQU * 
      SPC 3 
* 
*  CHECK FOR PAGE OVERFLOW
* 
      LDA 14000B                                 [B]
