
* 
*   PROCESSOR FOR INTERRUPT AFTER READ OR WRITE 
* 
MDIS2 EQU *         ENTRY FOR INTERRUPT AFTER RD/WRT
      STF DMAH      KILL DMA IF STILL RUNNING 
      JSB MSTAT     GO GET STATUS 
      SLA           ANY ERRORS? 
      JMP MERR2     YES, GO CHECK ERROR 
      LIB DMAL      GET DMA WORD COUNT
      SZB,RSS       DMA TRANSFER COMPLETE?
      JMP *+3       YES, CONTINUE NORMALLY
      IOR K.2       NO, INSERT FAKE DATA ERROR BIT
      JMP MERR2       AND GO PROCESS ERROR
      LDA TATUS 
      SZA 
      JSB MFAIL     INFORM OPERATOR OF RETRY
      LDB WDCNT     GET REMAINING WORD COUNT
      SZB,RSS       MORE WORDS NEEDED?
      JMP DOG3      NO, CONCLUDE. 
      LDA DMAWD     YES, GET COUNT OF WORDS JUST RED
      ADA COREM       AND ADD THEM
      STA COREM         TO CORE ADDRESS 
      CLE 
      LDA RDCHK     UPDATE
      ADA ABSEC+1     LOGICAL SECTOR
      STA ABSEC+1       NUMBER FOR
      SEZ                 NEXT CHUNK
      ISZ ABSEC 
      JSB TBSCH     GO FIND DRIVE FOR THIS CHUNK
      JMP DOG6      OUT OF RANGE: EXIT
      LDA B,I       GET SELCODE/UNIT
      LDA A,I 
      SZA           IS DRIVE PRESENT? 
      JMP DOG4      YES, GO READ NEXT CHUNK 
DOG6  LDA K.3       NO, CAN'T GET ENTIRE REQUEST
      STA MBUSY     SET MBUSY TO 3 - INCOMPLETE 
      JMP MDRET     RETURN TO MAIN TASK 
DOG5  CLB 
DOG3  STB MBUSY         INDICATE SUCCESSFUL TRANSFER
      JMP MDRET     RETURN TO MAIN TASK 
      SPC 3 
* 
*  ERROR DURING READ/WRITE OPERATION -- A CONTAINS STATUS 
* 
MERR2 STA TATUS     SAVE STATUS 
      LDB WRFLG     GET RETRY FLAG
      SZB,RSS       RETRY PROCEDURE COMPLETE? 
      JMP WRAIL     YES, GO FAIL
      AND BADWR     ISOLATE UNCORRECTABLE ERROR BITS
      SZA           ERROR POSSIBLY CORRECTABLE? 
      JMP WRAIL     NO, GO FAIL (BLAH!) 
      SSB           FIRST TIME ERROR? 
      JMP MER21     NO, GO CONTINUE RETRY 
      LDA TATUS     GET STATUS AGAIN
      RAR,SLA       DATA ERROR? 
      JMP DTERR     YES, GO CHECK WHETHER READ/WRITE
RELOT LDB KM2       NO, SET RETRY FLAG TO -2 - MEANS
      STB WRFLG         RETRYING OPERATION DIRECTLY 
MER21 ISZ WRTRY     TRY READ/WRITE AGAIN? 
      JMP MOVIT     YES, GO DO IT!
      ISZ WRFLG     NO, NEXT PHASE: INCREMENT FLAG
      CPB KM1       RETRYING OPER. BEFORE RESEEK? 
      JMP WRAIL     NO, WE'VE TRIED HARD -- GO FAIL 
      LDA KM6       YES, INITIALIZE SEEK RETRY COUNTER
      STA SETRY         AND STORE IT
      STA WRTRY     ALSO WRITE/READ RETRY COUNT 
      JMP RESEK     GO INITIATE RESEEK
* 
REONE CLA           SET RETRY FLAG TO 0 -- MEANS
      STA WRFLG         LAST TRY COMING UP
      JMP MOVIT     GO RETRY ONCE 
* 
DTERR LDA COREM     GET WORD CONTAINING RD/WRT BIT
      SSA           IS THIS A READ OR WRITE?
      JMP RELOT     READ: GO TO COMPLICATED RETRY 
      JMP REONE     WRITE: GO TO SINGLE RETRY 
      SPC 3 
* 
*     FAILURE ON READ/WRITE RETRY PROCEDURE (MERR2) 
* 
WRAIL LDA K.2       SET DRIVER BUSY FLAG TO 2 - SEZ 
      STA MBUSY        UNSUCCESSFUL RD/WRT COMPLETE 
      JSB MFAIL     INFORM OPERATOR OF FAILURE
      JMP MDRET     RETURN TO MAIN TASK 
      SKP 
* 
*   SEEK SET UP ROUTINE 
* 
SEEK  NOP 
      LDB CYL       GET CYLINDER NUMBER INTO B
      JSB DCOUT     GO OUTPUT IT TO DATA CHANNEL
      LDA POSIT     GET POSITION (SEEK) COMMAND 
      JSB CCOUT     GO OUTPUT IT TO COMMAND CHANNEL 
      LDB HDSEC     GET HEAD/SECTOR NUMBER INTO B 
      JSB WAITD     WAIT FOR CYLINDER # 2 B ACCEPTED
      JMP SFAFK     NEVER WAS; FAKE SEEK ERROR
      JSB DCOUT     GO OUTPUT HEAD/SECTOR TO DCHAN
      JSB WAITD     WAIT FOR IT TO BE ACCEPTED
      JMP SFAFK     NEVER WAS; FAKE SEEK ERROR
      JMP SEEK,I    RETURN
      SPC 3 
* 
*  DATA CHANNEL OUTPUT ROUTINE  --  DATA MUST BE IN REGISTER B
* 
DCOUT NOP           ENTRY POINT 
DC001 OTB DCHAN     PLACE WORD ON DATA CHANNEL CARD 
DC002 STC DCHAN,C   SET CONTROL TO SIGNAL PRESENCE
      JMP DCOUT,I   RETURN
      SPC 3 
* 
*  COMMAND CHANNEL OUTPUT ROUTINE  --  COMMAND MUST BE IN REGISTER A
* 
CCOUT NOP           ENTRY POINT 
      IOR UNIT      PLUG UNIT INTO COMMAND
CC001 OTA CCHAN     PLACE COMMAND ON CARD 
CC002 CLC CCHAN     MAKE SURE CONTROL IS CLEAR AND
CC003 STC CCHAN,C   THEN SET IT ("WAVE" ENCODE FLAG)
      JMP CCOUT,I   RETURN
      SPC 3 
* 
*  DATA CHANNEL WAIT LOOP -- SINGLE SKIP RETURN WHEN FLAG SEEN
* 
WAITD NOP           ENTRY POINT 
      LDA KM16C     I'M NOT GONNA 
WAIT1 INA,SZA,RSS     WAIT FOREVER
      JMP DC008     NO FLAG; RETURN NO-SKIP 
DC003 SFS DCHAN     DATA ACCEPTED?
      JMP WAIT1     NO, WAIT SOME MORE
      ISZ WAITD     FLAG SEEN; BUMP RETURN ADDRESS
DC008 CLC DCHAN     PREVENT DATA CHANNEL INTERRUPT
      JMP WAITD,I   RETURN
      SKP 
* 
*  STATUS CHECK ROUTINE 
* 
MSTAT NOP           ENTRY POINT 
      LDA STATU     GET STATUS CHECK COMMAND
DC004 STC DCHAN,C   PREPARE DATA CHANNEL FOR INPUT
      JSB CCOUT     GO ISSUE COMMAND
      JSB WAITD     WAIT FOR STATUS WORD
      CCA,RSS       NO STATUS; SET FAKE ("UNIT DEAD") 
DC005 LIA DCHAN     GET STATUS WORD INTO A
      JMP MSTAT,I   RETURN WITH STATUS WORD IN A
      SPC 3 
* 
*  ROUTINE TO SET UP DMA AND START DATA CHANNEL 
* 
DMAGO NOP           ENTRY POINT 
      LDA SCODE     GET SELECT CODE OF DISC 
      IOR DMA1      ASSEMBLE DMA WORD 1 
      OTA DMAH      OUTPUT WORD 1 TO HIGH DMA CHAN
      CLC DMAL      SET DMA MAR FOR WORD 2
      LDB COREM     GET CORE ADDRESS AND DIRECTION
      OTB DMAL      OUTPUT WORD 2 TO LOW DMA CHANNEL
      STC DMAL      SET DMA WCR TO RECEIVE WORD 3 
      LDA DMAWD     GET TRANSFER WORD COUNT 
      CMA,INA       TAKE 2'S COMP. (REQUIRED BY DMA)
      OTA DMAL      OUTPUT WORD 3 TO LOW DMA CHANNEL
DC006 STF DCHAN     SET SERVICE REQUEST LINE (WRITE)
      SSB           IS THIS A WRITE?
DC007 STC DCHAN,C   NO, START DISC AND CLEAR SRQ
      STC DMAH,C    START DMA CHANNEL 
      JMP DMAGO,I   RETURN
      SKP 
* 
*   PROGRAM CONSTANTS AND VARIABLES 
* 
STATU OCT 010000    STATUS CHECK COMMAND
RECAL OCT 020000    RECALIBRATE COMMAND 
POSIT OCT 030000    SEEK COMMAND
WREAD OCT 040000    READ COMMAND
RITE  OCT 050000    WRITE COMMAND 
SFS0  SFS 0         DUMMY SFS INSTRUCTION 
DMA1  OCT 120000    DUMMY DMA WORD 1
* 
KM16C OCT -1600 
KM6   DEC -6
KM4   DEC -4
KM2   DEC -2
KM1   DEC -1
K.2   DEC 2 
K.3   DEC 3 
K.4   DEC 4 
K.6   DEC 6 
KB77  OCT 77
KB100 OCT 100 
KB101 OCT 101 
BADSK OCT 110       UNCORRECTABLE SEEK ERROR BITS 
BADWR OCT 54        UNCORRECTABLE R/W ERROR BITS [B]
KB177 OCT 177 
KB200 OCT 200 
KB301 OCT 301 
KB400 OCT 400 
KBK77 OCT 1077
KB288 OCT 2677
KB3KM OCT 2777
* 
ABSEC BSS 2         ABSOLUTE SECTOR NUMBER (REQUEST)
WDCNT BSS 1         REMAINING WORD COUNT
COREM BSS 1         CORE ADDRESS SAVE AREA
SCODE BSS 1         SELECT CODE SAVE AREA 
UNIT  BSS 1         DRIVE NUMBER
CYL   BSS 1         CYLINDER NUMBER 
HDSEC BSS 1         HEAD/SECTOR WORD
DMAWD BSS 1         DMA WORD COUNT
* 
SCHAD BSS 1         POINTER FOR DISC TABLE SEARCH 
TEMAB BSS 2         A AND B REGISTERS SAVE AREA 
EANDO BSS 1         SAVE AREA FOR REGS E AND O
DENOM EQU SCHAD     POINTER TO DISC TABLE ENTRIES 
REMAN BSS 2         SECTOR-WITHIN-DRIVE SAVE AREA 
SETRY BSS 1         SEEK RETRY COUNTER
WRTRY BSS 1         READ/WRITE RETRY COUNTER
WRFLG BSS 1         READ/WRITE RETRY PHASE WORD 
MDFLG BSS 1         INTERRUPT ORIGIN WORD 
RDCHK BSS 1         READABLE CHUNK SAVE AREA
UNSAV BSS 1         CURRENT UNIT SAVE AREA
TATUS BSS 1         STORAGE FOR STATUS ON ERROR 
      SKP 
* 
*     THE MOVING HEAD DISC TABLE, MHTBL, CONTAINS A 6-WORD ENTRY
*     FOR EACH OF THE 8 POSSIBLE DRIVES ON THE SYSTEM AND A 2-WORD
*     MAXIMUM SECTOR NUMBER, MAXSC.  EACH ENTRY IS AS FOLLOWS:
* 
*              WORDS 0 AND 1: A 2-WORD SIGNED INTEGER SPECIFYING
*                             THE LOGICAL NUMBER OF THE FIRST 
*                             128-WORD HARDWARE SECTOR ON THE DRIVE.
*                             ISS DRIVES HAVE 93380 SECTORS EACH. 
* 
*              WORD 2:        POINTER TO DISC INFORMATION WORD IN 
*                             THE EQUIPMENT TABLE, WHICH CONTAINS:
*                             UPPER 8 BITS: SELECT CODE OF DRIVE'S
*                                              CONTROLLER 
*                             LOWER 8 BITS: UNIT NUMBER OF DRIVE ON 
*                                              CONTROLLER 
*                             THIS WORD IS SET TO ZERO IF THE GIVEN 
*                                  LOGICAL DRIVE IS NOT ON THE
*                                  SYSTEM.
* 
*              WORD 3:        NUMBER OF SECTORS PER CYLINDER ON 
*                                  DRIVE
* 
*              WORD 4:        NUMBER OF SECTORS PER TRACK ON DRIVE
* 
*              WORD 5:        CURRENT CYLINDER POSITION OF HEADS
*                             THIS WORD IS UNUSED BY THE ISS DRIVER.
* 
*     MAXSC IS A 2-WORD SIGNED INTEGER CONSTANT CONTAINING 1 MORE 
*     THAN THE MAXIMUM POSSIBLE LOGICAL SECTOR NUMBER ON THE SYSTEM.
*     FOR ISS, THIS NUMBER IS 8 * 93380 = 747040
* 
* 
MHTBL OCT 0         START OF DRIVE 0: 
      OCT 0           SECTOR # = 0
      DEF DKTBL     POINTER TO SELCODE/UNIT NUMBER
      DEC 460       SECTORS PER CYLINDER
      DEC 23        SECTORS PER TRACK 
      DEC 203       DRIVE POSITION: UNUSED BY ISS 
* 
      OCT 1         START OF DRIVE 1: 
      OCT 66304       SECTOR # = 93380
      DEF DKTBL+1   POINTER TO SELCODE/UNIT NUMBER
      DEC 460 
      DEC 23
      DEC 203 
* 
      OCT 2         START OF DRIVE 2: 
      OCT 154610      SECTOR # = 186760 
      DEF DKTBL+2   POINTER TO SELCODE/UNIT NUMBER
      DEC 460 
      DEC 23
      DEC 203 
      SKP 
      OCT 4         START OF DRIVE 3: 
      OCT 43114       SECTOR # = 280140 
      DEF DKTBL+3   POINTER TO SELCODE/UNIT NUMBER
      DEC 460 
      DEC 23
      DEC 203 
* 
      OCT 5         START OF DRIVE 4: 
      OCT 131420      SECTOR # = 373520 
      DEF DKTBL+4   POINTER TO SELCODE/UNIT NUMBER
      DEC 460 
      DEC 23
      DEC 203 
* 
      OCT 7         START OF DRIVE 5: 
      OCT 17724       SECTOR # = 466900 
      DEF DKTBL+5   POINTER TO SELCODE/UNIT NUMBER
      DEC 460 
      DEC 23
      DEC 203 
* 
      OCT 10        START OF DRIVE 6: 
      OCT 106230      SECTOR # = 560280 
      DEF DKTBL+6   POINTER TO SELCODE/UNIT NUMBER
      DEC 460 
      DEC 23
      DEC 203 
* 
      OCT 11        START OF DRIVE 7: 
      OCT 174534      SECTOR # = 653660 
      DEF DKTBL+7   POINTER TO SELCODE/UNIT NUMBER
      DEC 460 
      DEC 23
      DEC 203 
* 
MAXSC OCT 13        MAXIMUM SECTOR NUMBER + 1:
      OCT 63040       747040
MXDAD OCT 133136    MAXIMUM AVAILABLE BLOCKS ON ISS 
MXDUT DEC -2        ONE'S COMPLEMENT OF MAX UNIT #
PBPC  DEC 230       # OF BLOCKS PER PHYSICAL CYLINDER 
DNDT  DEC 6         DEFAULT # DIR TRKS/2883 DISC
      HED DISC RETRY OR FAILURE PRINTER 
* 
*     THIS ROUTINE INFORMS THE SYSTEM OPERATOR EACH TIME THE
*     DISC DRIVER FAILS TO SUCCESSFULLY COMPLETE A REQUESTED
*     TRANSFER AND EACH TIME RETRIES ARE REQUIRED TO COMPLETE 
*     A REQUESTED TRANSFER.  THE OPERATION, DISC ADDRESS, 
*     NUMBER OF BLOCKS BEING TRANSFERRED, AND STATUS ARE
*     INCLUDED IN THE PRINTOUT. 
* 
MFAIL NOP           ENTRY POINT 
      JSB GMQBP,I   GET POINTER TO MESSAGE QUEUE
      JMP MFAIL,I   NO ROOM: RETURN 
      STA MQBP1     SAVE BUFFER POINTER 
* 
      LDB MBUSY 
      CMB,SZB,RSS   RETRIES OR FAILURE? 
      JMP MFA1      RETRIES 
      INA           FAILURE: SKIP CHARACTER COUNT 
      LDB CRLF      OUTPUT CARRIAGE RETURN -
      STB A,I         LINEFEED
      INA 
      LDB BELL2 
      STB A,I       TWO BELLS 
      INA 
      STA TRSMD     OUTPUT
      LDA DFMSP 
      STA TRSMS       "DISC FAILURE"
      LDB KM6 
      JSB TRSMT 
      LDA MBUSY     FAIL DURING 
      CPA K.2         SEEK OR READ/WRITE? 
      JMP MFA2      READ/WRITE
      LDA SEMSP     SEEK: OUTPUT
      STA TRSMS 
      LDB KM9         "SEEKING TO BLOCK"
      JSB TRSMT 
      LDB K.58
      STB MQBP1,I   SET LENGTH
      JMP MFA3
MFA1  LDB K.54      COME HERE FOR RETRY MESSAGE 
      STB A,I       SET LENGTH
      INA 
      STA TRSMD 
      LDA DRMSP     OUTPUT
      STA TRSMS 
      LDB KM5         "DISC RETRY"
      JSB TRSMT 
      JMP MFA4
* 
MFA2  LDB K.62      READ OR WRITE FAILURE:
      STB MQBP1,I     SET LENGTH
MFA4  LDB COREM     COME HERE FOR "READING" OR
      SSB             "WRITING";  WHICH?
      JMP MFA5      READ
      LDA WRMSP     WRITE, OUTPUT "WRITING" 
      RSS 
MFA5  LDA REMSP     READ, OUTPUT "READING"
      STA TRSMS 
      LDB KM4 
      JSB TRSMT 
* 
**    CALCULATE BLOCK COUNT AND OUTPUT IT 
* 
      LDA DMAWD     ROUND DMA 
      ADA K.255       WORD COUNT
      CLB               TO NEXT HIGHER
      ASR 8               BLOCK 
      DIV K.10      SPLIT DIGITS
      ADA MFAB0     OUTPUT BLANK
      STA TRSMD,I     AND FIRST DIGIT 
      ISZ TRSMD 
      BLF,BLF       OUTPUT SECOND 
      ADB MFA0B       DIGIT AND 
      STB TRSMD,I       BLANK 
      ISZ TRSMD 
* 
      LDA BLMSP 
      STA TRSMS     OUTPUT
      LDB KM5 
      JSB TRSMT       "BLOCKS AT" 
* 
*     CALCULATE DISC ADDRESS AND OUTPUT IT
* 
MFA3  LDB ABSEC     GET LOGICAL SECTOR
      LDA ABSEC+1 
      ASR 1         CONVERT TO LOGICAL BLOCK
      DIV K.10K 
      STB TRSMS 
      JSB MFNUM 
      LDA TRSMS 
      CLB 
      DIV K.100 
      STB TRSMS 
      JSB MFNUM 
      LDA TRSMS 
      JSB MFNUM 
      LDA DOT 
      STA TRSMD,I   PERIOD AND BLANK
      ISZ TRSMD 
* 
*     GET STATUS AND OUTPUT IT
* 
      LDA STMSP     OUTPUT
      STA TRSMS 
      LDB KM4 
      JSB TRSMT       "STATUS"
      LDB TATUS     LOAD STATUS 
      CLA 
      RRL 4 
      STB TRSMS 
      JSB MF8NM     DIGITS 1 AND 2
      LDB TRSMS 
      CLA 
      RRL 6 
      JSB MF8NM 
      LDA TATUS 
      AND MFB77 
      JSB MF8NM 
      LDA CRLF
      STA TRSMD,I   CARRIAGE RETURN / LINEFEED
      JMP MFAIL,I 
* 
* 
TRSMT NOP           TRANSMITS -B WORDS FROM TRSMS,I 
      SSB,INB,RSS     TO TRSMD,I
      JMP TRSMT,I 
      LDA TRSMS,I   GET A WORD
      STA TRSMD,I   STORE IT
      ISZ TRSMS     NUDGE 
      ISZ TRSMD       POINTERS
      JMP TRSMT+1 
* 
* 
MFNUM NOP           CONVERTS A # < 100 TO ASCII 
      CLB 
      DIV K.10
      ALF,ALF 
      ADA B 
      ADA MFA00 
      STA TRSMD,I 
      ISZ TRSMD 
      JMP MFNUM,I 
* 
* 
MF8NM NOP           CONVERTS A # < 100B TO ASCII
      CLB             (TWO OCTAL DIGITS)
      DIV K.8 
      ALF,ALF 
      ADA B 
      ADA MFA00 
      STA TRSMD,I 
      ISZ TRSMD 
      JMP MF8NM,I 
* 
DOT   ASC 1,. 
CRLF  OCT 6412
BELL2 OCT 3407
* 
      SUP 
DFMSP DEF DFMS
DFMS  ASC 6,DISC FAILURE
SEMSP DEF SEMS
SEMS  ASC 9, SEEKING TO BLOCK 
WRMSP DEF WRMS
WRMS  ASC 4, WRITING
REMSP DEF REMS
REMS  ASC 4, READING
DRMSP DEF DRMS
DRMS  ASC 5,DISC RETRY
BLMSP DEF BLMS
BLMS  ASC 5,BLOCKS AT 
STMSP DEF STMS
STMS  ASC 4, STATUS 
      UNS 
* 
MFAB0 ASC 1, 0
MFA0B ASC 1,0 
MFA00 ASC 1,00
* 
MFB77 OCT 77
* 
KM9   DEC -9
KM5   DEC -5
K.8   DEC 8 
K.10  DEC 10
K.54  DEC 54
K.58  DEC 58
K.62  DEC 62
K.100 DEC 100 
K.255 DEC 255 
K.10K DEC 10000 
* 
TRSMS BSS 1 
TRSMD BSS 1 
MQBP1 BSS 1 
      HED DISC AUTO RESTART ROUTINE 
* 
*     THIS ROUTINE IS CALLED BY THE AUTO RESTART ROUTINE IN THE 
*     SYSTEM TO DO ANY DISC HANDLING WHICH IS NECESSARY.  THE A 
*     REGISTER CONTAINS A POINTER TO POWFF, THE "RESTART IN 
*     PROGRESS" FLAG.  THE B REGISTER CONTAINS THE ADDRESS AT WHICH 
*     THE POWER FAIL TOOK PLACE.  DREDY WAITS UNTIL ALL DISCS 
*     PRESENT ON THE SYSTEM ARE READY (UP TO SPEED WITH HEADS 
*     LOADED).  IF A DISC TRANSFER WAS IN PROGRESS WHEN THE POWER 
*     FAILED (AS INDICATED BY MBUSY), DREDY THEN RESARTS THE
*     TRANSFER.  IF THE POWER FAIL TOOK PLACE OUTSIDE THE DISC
*     DRIVER OR IF THERE WAS NO TRANSFER TAKING PLACE, DREDY THEN 
*     RETURNS TO THE MAIN RESTART ROUTINE.
* 
* 
* 
DREDY NOP           ENTRY POINT 
      CLF DINT      DISABLE INTERRUPTS
      STA DREA      * 
      STB DREB      * 
      ERA,ALS       * SAVE REGISTERS
      SOC           * 
      INA           * 
      STA DREEO     * 
* 
      CLA           SAY RECONFIGURING 
      STA DRESC       NECESSARY 
      LDA DREM8     WE MUST CHECK 
      STA DRECT       8 LOGICAL UNITS 
      LDB MHAD      GET ADDRESS OF FIRST
      ADB K.2         SELCODE/UNIT POINTER
DRE1  LDA B,I       GET SELCODE/
      LDA A,I         UNIT NUMBER 
      SZA           IS THERE A UNIT HERE? 
      JMP DRE2      YES, GO WAIT FOR IT TO BE READY 
DRE3  ADB K.6       NO, BUMP POINTER TO NEXT ONE
      ISZ DRECT     ARE THERE MORE TO LOOK AT?
      JMP DRE1      YES, GO DO IT 
      LDB MBUSY     NO, WAS 
      SSB,RSS         DRIVER BUSY?
      JMP DRERT     NO, RETURN
      LDB DREB      GET LOCATION WHEN POWER FAILED
      ADB DRED7     WERE WE IN
      SSB             THE DISC DRIVER?
      JMP DRE5      NO
      ADB DRED8     MAYBE 
      SSB           WERE WE IN THE DROVER?
      JMP DRE6      YOU MEAN THE DRIVER.  YES 
DRE5  LDA DRERP     NOT IN DRIVER, PUT
      STA MDINT       OURSELVES IN ITS RETURN ADDRESS 
      JMP DRE7
DRE6  CLA           IN DRIVER; CLEAR
      STA DREA,I      POWER FAIL FLAG 
DRE7  LDA DRECO     RESTORE 
      STA COREM       CORE ADDRESS
      LDA DREWD     RESTORE 
      STA WDCNT       WORD COUNT
      DLD DRABS     RESTORE 
      DST ABSEC       DISC ADDRESS
      LDB DREBS     RESTORE B REGISTER
      JMP DOG8      JUMP INTO DRIVER
DRERT CLF DINT
      LDA DREEO     * 
      CLO           * 
      SLA,ELA       * RESTORE 
      STO           * REGISTERS 
      LDA DREA      * 
      LDB DREB      * 
      JMP DREDY,I   RETURN
* 
*     COME HERE TO WAIT FOR A UNIT TO BE READY
* 
DRE2  STB DRET1     SAVE POINTER TO SELCODE/UNIT
      LDB A         COPY SELCODE/UNIT INTO B
      AND K.3       ISOLATE UNIT NUMBER 
      STA UNIT      SAVE IT 
      RRL 8         ISOLATE 
      AND KB77        SELECT CODE 
      CPA DRESC     IS RECONFIGURING NECESSARY
      JMP DRE4      NO, GO CHECK STATUS 
      STA DRESC     YES, STICK IN NEW SELCODE 
      JSB RECON     GO RECONFIGURE NECESSARY STUFF
DRE4  JSB MSTAT     GO GET STATUS 
      AND KB100     ISOLATE NOT READY BIT 
      SZA           IS UNIT READY?
      JMP DRE4      NO, WAIT
      LDB DRET1     YES, GO CHECK 
      JMP DRE3        FOR ANOTHER DISC
      SPC 3 
DREM8 DEC -8
DRERP DEF DRERT 
DRED7 ABS -DOG8 
DRED8 ABS DOG8-DOT
DREA  BSS 1         A REG SAVE
DREB  BSS 1         B REG SAVE
DREEO BSS 1         E AND O REGS SAVE 
DRET1 BSS 1         MHTBL SCAN POINTER
DRECT BSS 1         DISC COUNT
DRESC BSS 1         CURRENTLY CONFIGURED SELECT CODE
DRECO BSS 1         COREM SAVE
DREWD BSS 1         WDCNT SAVE
DRABS BSS 2         ABSEC SAVE
DREBS BSS 1         B SAVE
      HED DIREC TABLE 
      ORG 30000B
* 
DIREC BSS 560 
DIREU EQU * 
